-
Notifications
You must be signed in to change notification settings - Fork 0
GTM Deployment
John Williams edited this page Mar 11, 2026
·
1 revision
Deploy any script from this repo via Google Tag Manager — no code deploys, fully versioned, testable before going live.
- No code deploys required
- Preview mode lets you test before publishing
- Full version history — roll back instantly
- Works across Salesforce, HubSpot, WordPress, Shopify
- GTM → Tags → New
- Tag Configuration → Custom HTML
- Paste the appropriate script from
/scripts/ - Update the CONFIG section (field names, property internal names, etc.)
The GCLID arrives on the landing page URL. The script needs to fire there to read it from the URL and store it in localStorage. On subsequent pages, it reads from localStorage and writes to the form field.
Trigger: All Pages → Page View
- Click Preview in GTM
- Enter your URL with
?gclid=TEST_123appended - Navigate to your form page in the same session
- In the GTM Tag Assistant panel, confirm your tag appears in "Tags Fired"
- Open browser console and run:
// Replace with your actual field name document.querySelector('[name="Gclid__c"]').value // Should return: "TEST_123"
- ✅ Pass → close Preview → Submit
After publishing:
- Visit:
yourdomain.com/landing-page?gclid=TEST_LIVE_001 - Navigate to your form page and submit with a test email
- Check CRM — the GCLID field on the new lead must show
TEST_LIVE_001
// Paste in DevTools console on your form page
Array.from(document.querySelectorAll('input[type=hidden]'))
.map(i => ({ name: i.name, id: i.id, value: i.value }))
.filter(i => i.name || i.id)
.forEach((i,n) => console.log('['+n+']', JSON.stringify(i)));Compare the name values to what you have in the script's CONFIG. Case-sensitive: Gclid__c ≠ gclid__c.