Google Tag Manager UTM Tracking Integration

Track UTM parameters and campaign attribution with Google Tag Manager UTM Tracking Integration and HandL UTM Grabber on WordPress.

Send UTM Grabber Data to GA4 with Google Tag Manager

UTM attribution overview

UTM Grabber saves each visitor's UTMs and click IDs in first-party cookies, and keeps them while the visitor browses your site and when they come back later. GA4 only sees the source of the current visit. This guide sends UTM Grabber's saved values to GA4 with your lead event, so GA4 can report on the campaign that brought the lead, including the first one.

Google Tag Manager reads the values directly from UTM Grabber's cookies. This works on cached pages and with page speed plugins that delay scripts, and it needs no code on your site.

You need: UTM Grabber on your site, a Google Tag Manager container on your site, and a GA4 property.

In Google Tag Manager, go to Variables. Under User-Defined Variables, click New, then Variable Configuration.

  1. Choose 1st Party Cookie as the variable type.
  2. In Cookie Name, type the UTM Grabber cookie name, for example utm_source.
  3. Select URI-decode cookie. UTM Grabber saves values URL-encoded, so without this, "Google Ads" shows as "Google%20Ads".
  4. Name the variable, for example HandL - utm_source, and save it.

Do this for each value you want in GA4. We recommend:

2. Create a trigger for your lead

Fire the event only when a lead is complete. If you already have a trigger for your lead conversion, use it. If not, go to Triggers, click New, then Trigger Configuration, and create one of these:

Name the trigger, for example Lead - thank-you page, and save it.

3. Create the GA4 event tag

Go to Tags and click New. Click Tag Configuration and choose Google Analytics, then Google Analytics: GA4 Event.

  1. In Measurement ID, enter your GA4 ID, which starts with G-. In GA4, you find it under Admin > Data collection and modification > Data streams, in your web stream.
  2. In Event Name, type generate_lead.
  3. Open Event Parameters and add one parameter for each variable from step 1. Type the parameter name, then click the variable icon next to the value and choose the variable. Use names that start with handl_, so they do not mix with GA4's own campaign fields:
Parameter nameValue
handl_source{{HandL - utm_source}}
handl_medium{{HandL - utm_medium}}
handl_campaign{{HandL - utm_campaign}}
handl_first_source{{HandL - first_utm_source}}
handl_first_medium{{HandL - first_utm_medium}}
handl_first_campaign{{HandL - first_utm_campaign}}
handl_traffic_source{{HandL - traffic_source}}
handl_gclid{{HandL - gclid}}

Then click Triggering, choose the trigger from step 2, name the tag, for example GA4 - generate_lead, and save it.

4. Register the parameters in GA4

GA4 only shows event parameters in reports after you register them as custom dimensions.

  1. In GA4, go to Admin > Data display > Custom definitions. On the Custom dimensions tab, click Create custom dimensions.
  2. In Dimension name, type a name, for example HandL first source. Set Scope to Event. In Event parameter, type the parameter name from step 3, for example handl_first_source. Save it.
  3. Do this for each parameter.
  4. Go to Admin > Data display > Events, open the Key events tab, click New key event, type generate_lead, and save it.

5. Test

  1. In Google Tag Manager, click Preview and enter your site address with test UTMs, for example https://yoursite.com/?utm_source=test&utm_medium=test&utm_campaign=gtm_test. Google Tag Assistant opens your site in a new tab.
  2. Browse to another page, then complete a test lead.
  3. In Google Tag Assistant, select the event of your lead, open the GA4 - generate_lead tag, and check that each handl_ parameter has the test value.
  4. In GA4, go to Admin > Data display > DebugView, and check that generate_lead appears with its handl_ parameters.
  5. In Google Tag Manager, click Submit, then Publish.

The custom dimensions show in GA4 reports 24 to 48 hours after the data is sent. They only show data from leads after this setup.

Notes

Push UTM Grabber Data into GTM dataLayer

UTM attribution overview

Connect HandL UTM Grabber with Google Tag Manager UTM Tracking Integration. GTM users often want UTMs in the dataLayer for GA4 or ad pixels. UTM Grabber already stores them in handl_utm.

GTM users often want UTMs in the dataLayer for GA4 or ad pixels. UTM Grabber already stores them in handl_utm.

Steps

dataLayer.push(Object.assign({event: 'handl_utms_ready'}, handl_utm));

Trigger tags on that event. See also GTM consent guide.

Fire GTM Events with UTM Grabber on Thank-You Pages

UTM attribution overview

This walkthrough covers sending full UTM Grabber data from Google Tag Manager UTM Tracking Integration to Zapier, Make, or your own webhook. Handy when you need gclid, fbclid, first-touch fields, or custom params alongside the lead or order.

Start with the main Google Tag Manager UTM Tracking Integration setup guide if you have not wired hidden fields or checkout links yet.

When a webhook makes sense

Native fields in Google Tag Manager UTM Tracking Integration often stop at basic UTMs. A webhook lets you push everything UTM Grabber stores without trimming values or losing click IDs.

Thank-you page script

Paste this on your confirmation page. Swap in your Zapier or Make hook URL.

<script>
var qvars = {};
window.location.href.replace(/[?&]+([^=&]+)=([^&]*)/gi, function(m, key, value) {
    qvars[key] = decodeURIComponent(value.replace(/\+/g, ' '));
});
qvars = Object.assign({}, (typeof handl_utm !== 'undefined' ? handl_utm : {}), qvars);
setTimeout(function() {
    var data = new URLSearchParams(qvars).toString();
    var xmlHttp = new XMLHttpRequest();
    xmlHttp.open('GET', 'https://hooks.zapier.com/hooks/catch/YOUR_ID/YOUR_KEY/?' + data, true);
    xmlHttp.send(null);
}, 1000);
</script>

Full pattern explained in Triggering Zapier on Thank you Page.

Quick Zapier / Make checklist

  1. Create a Catch Hook trigger and copy the URL
  2. Run a test conversion with UTMs in the landing URL
  3. Confirm gclid, utm_source, and email (if present) show up in the payload
  4. Map fields into your CRM or spreadsheet

Parameter reference: Native WP Shortcodes.

Make users: see Make Integromat integration.