# 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.

#### 1. Create a cookie variable for each value

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:

<table id="bkmrk-cookie-namewhat-it-h"><thead><tr><th>Cookie name</th><th>What it holds</th></tr></thead><tbody><tr><td>`utm_source`, `utm_medium`, `utm_campaign`</td><td>The latest campaign</td></tr><tr><td>`first_utm_source`, `first_utm_medium`, `first_utm_campaign`</td><td>The first campaign that brought the visitor</td></tr><tr><td>`traffic_source`</td><td>The traffic type: Paid, Organic, Social, Referral, Direct or Other</td></tr><tr><td>`gclid`</td><td>The Google Ads click ID</td></tr></tbody></table>

#### 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:

- **Thank-you page:** choose **Page View** as the trigger type. Select **Some Page Views**, then set **Page URL**, **contains**, and the address of your thank-you page, for example `thank-you`.
- **Form event:** choose **Custom Event** as the trigger type, and type the event name that your form plugin pushes to the dataLayer.

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 &gt; Data collection and modification &gt; 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:

<table id="bkmrk-parameter-namevalue-"><thead><tr><th>Parameter name</th><th>Value</th></tr></thead><tbody><tr><td>`handl_source`</td><td>`{{HandL - utm_source}}`</td></tr><tr><td>`handl_medium`</td><td>`{{HandL - utm_medium}}`</td></tr><tr><td>`handl_campaign`</td><td>`{{HandL - utm_campaign}}`</td></tr><tr><td>`handl_first_source`</td><td>`{{HandL - first_utm_source}}`</td></tr><tr><td>`handl_first_medium`</td><td>`{{HandL - first_utm_medium}}`</td></tr><tr><td>`handl_first_campaign`</td><td>`{{HandL - first_utm_campaign}}`</td></tr><tr><td>`handl_traffic_source`</td><td>`{{HandL - traffic_source}}`</td></tr><tr><td>`handl_gclid`</td><td>`{{HandL - gclid}}`</td></tr></tbody></table>

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 &gt; Data display &gt; 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 &gt; Data display &gt; 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 &gt; Data display &gt; 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

- Use `%20` for spaces in your UTM links, not `+`. A `+` stays in the saved value, so `sat+imagery` shows as "sat+imagery" in GA4.
- GA4 cuts parameter values after 100 characters. Keep long values, such as full page URLs, out of the parameters.
- If you use a consent banner, UTM Grabber only saves cookies after the visitor accepts, so the `handl_` parameters are empty for visitors who decline.

# 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](https://docs.utmgrabber.com/books/102-getting-started-for-handl-utm-grabber-v3/page/enforce-consent-from-3rd-party-eg-gtm).

# 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](https://docs.utmgrabber.com/books/google-tag-manager-integration/page/ush-rabber-ata-into-data-ayer) 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](https://docs.utmgrabber.com/books/zapier-integration/page/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](https://docs.utmgrabber.com/books/102-getting-started-for-handl-utm-grabber-v3/page/native-wp-shortcodes).

Make users: see [Make Integromat integration](https://docs.utmgrabber.com/books/makecomintegromat-utm-tracking-integration).