How to Set Up Lead Attribution Tracking with AI Agent
Our Lead Attribution tool helps you accurately track where your leads are coming from—even when they don’t convert right away or return from different sources. With first-touch and last-touch tracking, cookie-based data storage, and JavaScript field lookups, you can ensure your CRM or lead tool receives rich attribution data automatically.
Coming Soon: AI features for attribution analysis and journey mapping.
What This Tool Does
The Lead Attribution Agent captures attribution data like:
- Referring URLs
- UTM parameters (source, medium, campaign, etc.)
- First and last visited pages
Channels (organic, paid, referral, etc.)
It stores this data in a 90-day cookie and automatically passes the information into your lead capture form using hidden fields.
Setup Instructions
Step 1: Add the Tracking Script
Place the tracking script in the header section of every page you want to track.
- Go to AI Agents > Lead Attribution
- Click Copy Tracking Script
- Paste it into your website builder (e.g., in Leadpages:
Settings > Analytics > Head Section
)
Step 2: Add the Body Script
This secondary script goes just before the closing </body>
tag of the page where your lead capture form lives.
- Back in the Lead Attribution tool, copy the second script
- Paste it before the
</body>
tag in your site or landing page editor
Step 3: Configure Hidden Form Fields
Capture key attribution data via JavaScript variable lookup fields in your form.
Here’s how:
- In your form builder, locate the step where form fields are added
- Click Add Field
- Choose field type: JavaScript Variable Lookup
- Enter a name (e.g.,
term
)
- Paste the corresponding variable (copied from the Lead Attribution tool)
- Click Save
You can repeat this for multiple fields if needed.
Recommended fields to include:
- Referring URL
- Last visited page
- Channel
- UTM parameters (
utm_source
,utm_medium
,utm_campaign
,utm_term
,utm_content
)
How It Works
- Data is saved into a 90-day cookie even if users return days or weeks later.
- Upon form submission, the cookie data is pulled and passed to the form via hidden fields.
- First-touch and last-touch distinctions are tracked and available.
Testing Tips
Test your setup by:
- Visiting your page with UTM parameters (e.g., via a paid ad)
- Filling out and submitting the form
- Verifying that the attribution data is captured correctly in your lead record
Need Help?
If you get stuck or have questions at any point, reach out to us via support@leadcapture.io or email, and we’ll be happy to walk you through it.