This tool page is the public reference for the script, what it does, and how to install it.
If you need a fast way to preserve marketing attribution data and push it into a hidden form field, this script is built for that job.
Instead of rebuilding the same tracking snippet on every site, you can load one public script, point it at the hidden field you want to populate, and verify in a few minutes that attribution data is actually being captured.
What this script does
The script is hosted at:
https://cdn.intelsquid.com/scripts/marketing-attribution/v1.0.0.js
Once it loads, it reads attribution context from the current page, stores that payload in localStorage, and writes the same JSON into a hidden field on the page.
That means a form submission can carry useful context such as:
- UTM parameters
- referrer and landing page
- basic traffic source classification
- session identifiers
- available Google Analytics identifiers
If you have ever wanted form submissions to include more than just the visible fields a user typed in, this is the problem the script is solving.
Why you might want it
Attribution data often breaks down in the handoff between landing page visit and form submission.
A user clicks a paid ad, lands on a page, fills out a form, and the CRM receives only a name, email, and phone number. The campaign context is gone, or it survives only in partial, inconsistent snippets spread across different sites.
This script is meant to close that gap.
Use it when you want to:
- preserve UTM parameters without pasting custom logic into every site
- write attribution data into a hidden CRM or form field
- keep the same tracking behavior across multiple websites
- host one maintained script instead of a separate snippet per property or client
If the site already has a hidden input ready to receive the payload, installation is lightweight.
What the script captures
The payload currently includes:
- URL query parameters from the current page
- basic traffic classification such as direct, referral, organic, and paid click identifiers
- browser context such as landing page, referrer, language, timezone, and device type
- session and Google Analytics identifiers when available
The resulting JSON is stored under:
localStorage.marketing_attribution
The same JSON is also written into a hidden input field so it can be submitted with a form.
How it works
The script runs client-side after it loads.
At a high level, it does four things:
- reads the current URL parameters and selected cookies
- builds an attribution payload
- stores that payload in
localStorage - writes the same JSON string into a hidden field on the page
The file itself is a static asset served from cdn.intelsquid.com, so there is no dynamic script generation happening on every pageview.
Installation
First, add a hidden input to the page:
<input type="hidden" name="custom_marketing_field" value="">
Then include the script:
<script
src="https://cdn.intelsquid.com/scripts/marketing-attribution/v1.0.0.js"
data-field-name="custom_marketing_field"
defer
></script>
The data-field-name value should match the name of the hidden input you want to populate.
Configuring the target field
Different sites often use different hidden field names.
Instead of creating a custom script build for every site, this script reads the field name from its own embed tag.
For example:
<script
src="https://cdn.intelsquid.com/scripts/marketing-attribution/v1.0.0.js"
data-field-name="lead_tracking_payload"
defer
></script>
With that embed, the script will target:
<input type="hidden" name="lead_tracking_payload" value="">
If no field name is provided, the script falls back to the default field name:
marketing_data
How to test it
A simple local test is enough.
- create a plain HTML file
- add a hidden input
- add the script include
- open the page in the browser
- inspect the hidden field value and
localStorage
In DevTools, check three things:
- Network: the JS request returns
200 - Headers:
server: cloudflareis present - Caching:
cf-cache-status: HITappears after the cache is warm
Then in the Console:
document.querySelector('[name="custom_marketing_field"]').value
localStorage.getItem('marketing_attribution')
If both return JSON, the script is loaded and writing the payload correctly.
What the payload should look like
The exact values will vary by page and traffic source, but you should expect a JSON object with sections like:
attribution.paramsattribution.sourceattribution.mediumcontext.landing_pagecontext.referrercontext.session_id
If the page URL includes UTM parameters such as utm_source and utm_medium, those should appear inside the stored payload.
Caching and performance
The script is served as a static versioned file behind Cloudflare.
That matters for performance:
- browsers can cache it
- Cloudflare can cache it at the edge
- your site does not need to generate JavaScript dynamically on every pageview
In practice, once the cache is warm, repeated requests should show cf-cache-status: HIT.
Versioning policy
The current public URL is versioned:
v1.0.0.js
That is intentional.
When behavior changes, the safe pattern is to publish a new file such as:
v1.0.1.jsv1.1.0.jsv2.0.0.js
and then update embeds selectively.
That avoids silently changing a public file that other sites may already depend on.
Final note
If your forms need to carry real attribution context instead of just raw lead data, this script gives you a practical drop-in starting point.
The value is consistency: one maintained public script, one installation pattern, and a straightforward way to verify that attribution data is actually being captured.
