e5e7ebd1d5db9ca3af6b72804b55633741511f2937LeadEngage
    Sign In
    e5e7ebd1d5db9ca3af6b72804b55633741511f2937LeadEngage

    The Lead Engagement Platform

    © Copyright 2025 LeadEngage. All Rights Reserved.

    About
    • Contact
    Legal
    • Terms of Service
    • Privacy Policy
    • Cookie Policy
    • Site Configuration
    • Inbound Calls
    • Inbound Form Leads
    • Install Tracking Scripts

    Install Tracking Scripts

    Installing the LeadEngage Phone Number Tracking and Form Capture Scripts

    Overview

    Two primary website scripts are used to integrate your website with LeadEngage:

    1. Phone Number Tracking Script — dynamically swaps phone numbers on your website with tracking numbers (DNI).
    2. Form Capture Script — captures form submissions and sends them to LeadEngage for

    These are offered as two separate packages for customers who only want to enable a single feature. However, most customers will use both scripts together for full functionality.

    Install Phone Number Tracking Script

    To enable dynamic phone number swapping and tracking on your website, you need to install the LeadEngage Phone Number Tracking script. This script dynamically replaces phone numbers on your website with tracking numbers based on visitor attributes.

    You can install the script either by using Google Tag Manager (recommended) or by directly embedding the script into your site's HTML.

    Prerequisites

    • A LeadEngage account with access to your site settings.
    • You have configured your Marketing Sources in the LeadEngage dashboard.
    • You have configured your Phone Numbers for each of your marketing sources.
    • Google Tag Manager container for the site (if using GTM).

    Get the scripts from LeadEngage

    1. Log in to the LeadEngage dashboard.
    2. Navigate to Sites.
    3. Locate your site and select the Call Attribution Script Generator
    4. Copy the script provided in the popup window.

    Installing with Google Tag Manager (recommended)

    Why use GTM?

    • Easier deployments and rollback.
    • Centralized tag management and environment targeting (staging/production).

    Steps:

    1. Open your Google Tag Manager container and click "Tags → New".
    2. Name the tag: LeadEngage — Phone Swap.
    3. Click Tag Configuration → Custom HTML and paste the script.
    4. Set the tag to fire on the All Pages trigger so the DNI loader runs on every page with phone numbers.
    5. Enable support document.write on the tag configuration
    6. Save the tag.
    7. Publish the container when verified.

    Installing without GTM (direct site install)

    1. Edit your site's HTML template (typically the <head> or just before </body> ).
    2. Paste the combined script tag from "Get the scripts" into the <head> (recommended) so it can run early and swap numbers before user sees them.

    Example (HTML):

    <!-- apps/web/public or your template head -->
    <script
      src="https://prod.leadengage.net/api/scripts/phone-swap"
      data-site-id="7d2bd1ff-e55e-4a40-b8b4-0000000"
      data-default-number="+155512345678"
      data-attribution-mode="last"
      data-cookie-ttl-days="30"
      defer
    ></script>
    

    Form Capture Script

    The Form Capture portion will listen for form submissions on configured selectors and send the captured payload to LeadEngage.

    • By default the script tries common form selectors (form[data-leadengage], form, etc.). If your forms are custom, provide a selector in the platform settings or configure the form tag with a small snippet that registers the selector.
    • Contact support for help if your forms are not capturing after configuration.

    Prerequisites

    • A LeadEngage account with access to your site settings.
    • Google Tag Manager container for the site (if using GTM).

    Get the scripts from LeadEngage

    1. Log in to the LeadEngage dashboard.
    2. Navigate to Sites.
    3. Locate your site and select the Form Tracking Script Generator
    4. Copy the script provided in the popup window.

    Installing with Google Tag Manager (recommended)

    Why use GTM?

    • Easier deployments and rollback.
    • Centralized tag management and environment targeting (staging/production).

    Steps:

    1. Open your Google Tag Manager container and click "Tags → New".
    2. Name the tag: LeadEngage — Form Capture.
    3. Click Tag Configuration → Custom HTML and paste the script.
    4. Set the tag to fire on the All Pages trigger so the DNI loader runs on every page with forms.
    5. Optional: Instead, set the tag to fire on the specific pages where your forms are located.
    6. Enable support document.write on the tag configuration
    7. Save the tag.
    8. Publish the container when verified.

    Installing without GTM (direct site install)

    1. Edit your site's HTML template (typically the <head> or just before </body> ).
    2. Paste the combined script tag from "Get the scripts" into the <head> (recommended) so it can run early and swap numbers before user sees them.

    Example(HTML):

    <!-- apps/web/public or your template head -->
    <script>
      (function() {
        var script = document.createElement('script');
        script.src = 'https://prod.leadengage.net/scripts/form-capture.js';
        script.setAttribute('data-site-id', '7d2bd1ff-e55e-4a40-b8b4-0000000');
        script.setAttribute('data-api-url', 'https://prod.leadengage.net');
        script.setAttribute('data-debug', 'false');
        document.body.appendChild(script);
      })();
    </script>
    

    Targeting Specific Forms

    If you need to target a specific selector, you can do so by setting the window.LE.formSelector variable. This is an advanced configuration. Contact our support team for help on advanced form configuration.

    Example to target a specific form using a small inline script (Custom HTML in GTM or inline just after form):

    <script>
    	window.LE || (window.LE = {});
    	window.LE.formSelector = '#contact-form';
    </script>
    
    1. Overview
      1. Install Phone Number Tracking Script
        1. Prerequisites
        2. Get the scripts from LeadEngage
        3. Installing with Google Tag Manager (recommended)
        4. Installing without GTM (direct site install)
        5. Form Capture Script
        6. Prerequisites
        7. Get the scripts from LeadEngage
        8. Installing with Google Tag Manager (recommended)
        9. Installing without GTM (direct site install)