Purpose of This Guide
This guide explains how to install and use the External Tracking Script to record page views and track GHL and standard HTML form submissions on external websites like WordPress, Shopify, Wix, Webflow, or custom HTML.
Use this setup if you:
Embed a GHL form on an external website
Use a standard HTML form (not iframe-based)
Want page views and submissions tracked for attribution
Want to trigger workflows when those events occur
⚠️ Iframe-based or widget-based third-party forms are still not supported.
Forms must exist directly in the DOM and use valid HTML <form> elements.
TABLE OF CONTENTS
- What Is the External Tracking Script?
- Important Behavior Notes
- Why You Need It
- What It Does
- Before You Start
- Step 1: Get Your Tracking Script
- Step 2: Install the Script
- Step 3: Ensure Your Form Is Compatible
- ✨ Custom Field Capture (New)
- Smarter Field Mapping
- Better Data Handling
- Step 4: View Submissions
- Step 5: Workflow Triggers
- Advanced Troubleshooting
- Example Full Form
- Platform-Specific Installation
- FAQs
What Is the External Tracking Script?
The tracking script is a small piece of JavaScript unique to your account.
When placed on your external site, it:
Records page views
Tracks compatible form submissions
Captures mapped custom field values
Stores anonymous activity until the visitor becomes known
Sends tracked events to your CRM for reporting and workflow automation
It acts as the bridge that lets you see activity from sites not hosted inside the platform.
Important Behavior Notes
⚠️ No contact or activity log will appear until a form submission occurs.
Here’s how it works:
Page views are tracked anonymously
Anonymous activity is stored in the browser
Once a form is submitted:
A contact is created or updated
All prior activity is linked to that contact
This script does not:
Create contacts from iframe-based or widget-based forms
Track interactions like clicks or scrolls
Track session analytics or cross-domain behavior
Capture hidden or disabled form fields (unless explicitly configured)
Why You Need It
Without the tracking script, we cannot:
Record page views on external websites
Attribute leads or conversions to campaigns
Trigger workflows based on external activity
With the tracking script installed:
You can track our forms on external websites
You can measure page performance in the Attribution Report
You can trigger automations for visitors who submit a form
What It Does
Tracks:
Page views
Form submissions
Workflow triggers (based on above events)
Doesn’t track:
Scrolls, clicks, or time-on-page
Session-level analytics
Cross-domain behavior
Before You Start
The site domain must be connected to your account
The form must:
Be a GHL embed, or
Be a standard HTML
<form>with valid input fields
Forms inside iframes, popups, or JS widgets will not be tracked
Step 1: Get Your Tracking Script
In your account:
Go to Settings → External Tracking
Click Copy Script
Your snippet will look like this:
<script
src="https://link.yourdomain.com/js/external-tracking.js"
data-tracking-id="tk_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx">
</script>Do not modify your data-tracking-id. It’s unique to your account.
Step 2: Install the Script
Paste the script before the closing </body> tag on your website.
Option A: Add Directly (Recommended)
Example:
<!-- External Tracking Script -->
<script
src="https://link.yourdomain.com/js/external-tracking.js"
data-tracking-id="tk_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx">
</script>
</body>
</html>Works for:
Custom HTML sites
WordPress
Wix / Squarespace / Webflow
Option B: Install via Google Tag Manager (GTM)
⚠️ Known Issue: GTM may remove the data-tracking-id attribute, breaking initialization.
If you see console errors like
LC Tracking: Missing data-tracking-id attribute,
your GTM setup is stripping the ID.
Temporary Fix / Workaround:
Create a Custom HTML Tag in GTM.
Paste your full tracking code (do not modify it).
Set trigger to All Pages.
Preview the page, open DevTools → Elements tab.
Verify the data-tracking-id attribute is still present in the script tag.
If it’s missing → install the code manually in your site footer.
Step 3: Ensure Your Form Is Compatible
The tracking script supports:
GHL embedded forms
Standard HTML forms rendered directly in the DOM
Form Requirements
For submissions and field capture to work:
A real
<form>tag must existFields must:
Be visible
Have a valid
nameattribute
An email field must be present
Not Supported
Forms inside iframes
Popup-based forms
Third-party widgets that do not expose real inputs in the DOM
✨ Custom Field Capture (New)
External Tracking now captures more than just name and email.
Supported Field Types
The script can capture:
Single-line & multi-line text
Dropdowns (single & multi-select)
Checkboxes & radio buttons
Ratings & scores
Number, monetary & date picker fields
File uploads & signatures (metadata only)
Source, captcha & boolean fields
Field Capture Rules
Fields are captured only if they:
Are visible on the form
Have a valid
nameattribute
Hidden or disabled fields are ignored unless explicitly configured.
Smarter Field Mapping
Captured fields are mapped using this priority order:
Field
namematches a HighLevel property or custom field keyField label matches a HighLevel display name
Field
namematches label text (case-insensitive)
If no match is found:
The value is stored as
unmapped_fieldThis helps identify and fix mapping issues quickly
Better Data Handling
Captured values are stored with awareness of:
Text vs numeric fields
Single-select vs multi-select values
Metadata-only handling for file uploads and signatures
This ensures consistent behavior in workflows and automations.
Step 4: View Submissions
In the CRM :
Go to Sites → Forms → Submissions
Filter by External Form Name
Submissions appear with a tag:
external form: {form_name}
Step 5: Workflow Triggers
You can automate actions based on:
Page View Trigger: Fires when a visitor views a page with the tracking script even if anonymous. Anonymous activity is stored and later attached to the contact when they submit an LC form.
Form Submission Trigger: Fires when a compatible form is submitted.
Available filters:
Domain
Page path
External form name
UTM parameters (Campaign, Source, Medium, etc.)
Advanced Troubleshooting
1. Enable Debug Mode
Add data-debug="true" to your script:
<script
src="https://link.yourdomain.com/js/external-tracking.js"
data-tracking-id="tk_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
data-debug="true">
</script>Then open DevTools → Console and check for [LC Tracking] logs.
2. Network Checks
Look for successful 2xx responses.
Ensure no CORS errors appear.
3. Cookie Verification
Go to Application → Cookies
Confirm a session cookie is created.
If missing → browser privacy or third-party restrictions might block it.
4. Common Issues
Example Full Form
<form name="signup">
<label>Email</label>
<input type="email" name="email" required />
<label>First Name</label>
<input type="text" name="first_name" />
<button type="submit">Submit</button>
</form>Platform-Specific Installation
WordPress
Copy tracking code.
Go to Appearance → Theme Editor → Footer (or use Insert Headers and Footers plugin).
Paste before </body> tag.
Save changes.
Avoid page builders or plugins that replace forms with <div> widgets.
Important for WordPress users
Many WordPress page builders and plugins use non-form elements (such as <div> containers or JavaScript-based widgets) instead of real <form> tags.
Those forms are not compatible with the tracking script for submission tracking.
If your forms do not use real <form> tags:
Page view tracking will still work, but
Form submissions will not sync to your CRM.
To ensure compatibility:
Use plugins that output valid HTML forms (for example, WPForms, Gravity Forms, or Contact Form 7).
Confirm that the form includes <form> and <input type="email"> elements.
Avoid forms inside iframes or popups.
Wix
Go to Settings → Advanced → Custom Code → + Add Custom Code
Paste your script
Set All Pages → Load code on each new page → Place in Body (end)
Apply and publish.
Squarespace
Go to Settings → Advanced → Code Injection
Paste the script in the Header or Footer field
Save and publish.
Shopify
In Shopify Admin → Online Store → Themes → Edit Code
Open theme.liquid
Paste code before </body>
Save.
HubSpot
Go to Settings → Website → Pages → Templates or Site Footer HTML
Paste your script before </body>
Save and publish.
Drupal
Go to Structure → Blocks → Add Block
Paste your script into the block body
Save.
Magento
Follow Magento’s Design Guide for adding third-party JavaScript in the Header or Footer HTML.
Joomla
Go to Extensions → Templates → Templates → index.php
Paste before </body>
Save.
FAQs
Q: Can I capture custom fields from external forms now?
Yes. External Tracking can now capture and map supported custom field types from compatible forms.
Q: Are third-party forms supported?
Only if they render real HTML inputs directly in the DOM. Iframe-based or widget forms are still unsupported.
Q: Are files uploaded via forms stored?
No. Only file metadata is captured.
Q: Does this affect attribution or workflows?
Yes. Captured field data can be used reliably in workflows and attribution reporting.
Was this article helpful?
That’s Great!
Thank you for your feedback
Sorry! We couldn't be helpful
Thank you for your feedback
Feedback sent
We appreciate your effort and will try to fix the article