Money back guarantee
From $0.07 per 1 000 credits

How to Track Custom UTM Parameters in GA4 with GTM

To track an extra URL parameter in Google Analytics 4, read it with a Google Tag Manager URL variable, send its value as a GA4 event parameter, and register that parameter as an event-scoped custom dimension. Then test collection in GTM Preview and GA4 DebugView before building an Exploration.

Adding utm_audience=prospecting to a link alone won't create an Audience column in GA4. The steps below connect that query key to a report without replacing your normal source, medium, or campaign tags.

Illustrative setup captures utm_audience from a campaign link in a GTM Query URL variable, sends it as campaign_audience on campaign_context, and registers Campaign audience as an Event-scoped GA4 custom dimension.

Know which parameters need custom setup

GA4 already recognizes standard campaign parameters such as utm_source, utm_medium, utm_campaign, and utm_content. Check Google's campaign URL documentation before creating a custom field. If an existing dimension answers your question, use it rather than spending a custom dimension slot.

An arbitrary key such as utm_audience needs explicit collection and registration. Its utm_ prefix doesn't give it special powers. You could call it campaign_audience instead, provided your links and GTM configuration agree.

Older tutorials use Universal Analytics dimension indexes and Session scope. GA4 uses named event parameters for this setup, with no dimension index to enter.

Build a tagged link with one extra field

Say a bike shop in Portland promotes winter servicing through separate prospecting and remarketing ads. It wants the audience label alongside its campaign data, without putting prospecting into utm_medium and sending paid traffic to GA4’s Unassigned channel.

SparkTraffic, a website traffic platform, offers a free UTM builder for the standard campaign fields. Build those first, then append the extra query key:

https://example.com/winter-service?utm_source=facebook&utm_medium=paid_social&utm_campaign=winter_service&utm_audience=prospecting

The remarketing version changes only the last value to remarketing. Use lowercase labels consistently. Here, “audience” describes your campaign's targeting label, not a verified personal characteristic or membership in a GA4 Audience.

Keep the query string before any # fragment. If you need campaign categories instead, the same method works with utm_category and an appropriately named event parameter.

Read utm_audience in GTM

GTM needs to extract the value from the current page URL. Google's URL variable documentation explains that this variable reads the current document location unless you supply another source.

In your website's GTM container:

  1. Open Variables > User-Defined Variables > New.
  2. Name the variable URL - utm_audience.
  3. Select Variable Configuration > URL.
  4. Set Component Type to Query.
  5. Enter utm_audience as the Query Key, then save.

Enter the key alone, without ?, =, or a value. On the example page, the variable should return prospecting. It won't remember that value after the visitor moves to a URL without the parameter.

Send the value with a GA4 event

A separate context event makes this first implementation easier to inspect and avoids adding a second page_view. This recipe assumes GTM and your GA4 Google tag already work, with the Google tag loading before the context event, normally on Initialization - All Pages, subject to your consent setup.

Create a tag with type Google Analytics: GA4 Event. Enter your existing GA4 web stream's Measurement ID and use these settings:

  • Event Name: campaign_context
  • Event parameter name: campaign_audience
  • Parameter value: {{URL - utm_audience}}

The URL key and event parameter can have different names. What matters is that the event parameter name later matches the custom definition exactly. Google's event parameter setup guide documents this tag configuration.

Create a DOM Ready trigger, choose Some DOM Ready Events, and set {{URL - utm_audience}} to matches RegEx:

^(prospecting|remarketing)$

Attach it to the tag and save. This allowlist accepts the two planned labels and skips missing, blank, or unexpected values. Extend it deliberately when your naming plan changes.

This sends one context event per qualifying page load, not necessarily once per session. Reloading the tagged page can send another. Don't mark this diagnostic event as a key event: receiving a label isn't a business outcome.

Register an event-scoped custom dimension

Sending the parameter collects it, but registration makes it available as a reporting dimension. In GA4, an Editor or Administrator can open Admin > Data display > Custom definitions > Create custom dimensions and enter:

  • Dimension name: Campaign audience
  • Scope: Event
  • Event parameter: campaign_audience

Save the definition. Type the parameter name if it isn't available in the selector yet. Do not enter utm_audience here, because this implementation sends the value under campaign_audience.

Google's custom dimension instructions say to allow 24 to 48 hours after the definition is created and data is sent before reporting on it. Set this up before launch. Today's tag cannot recover values you never collected.

Test in GTM Preview and GA4 DebugView

A saved tag isn't proof that GA4 received the right value. Test the variable, the outgoing event, and the received parameter before publishing.

Click Preview in GTM and connect to the equivalent URL on your own tagged test site. Replace example.com with the hostname that actually loads your container, and keep the example query string. In Tag Assistant, select DOM Ready and inspect Variables. Confirm that URL - utm_audience equals prospecting, then check that the campaign_context tag fired with campaign_audience set to that value.

Next, open GA4 Admin > Data display > DebugView, select your test device, and click the campaign_context event. Its parameters should include campaign_audience: prospecting. GTM Preview enables debugging for your test visit, as described in Google's DebugView guide.

Repeat with remarketing, then with the custom key removed. The first should send the changed value; the second should not fire the context tag. Submit and publish the container after those checks pass.

If DebugView stays empty, check the Measurement ID, consent state, blockers, and selected device. Don't bypass consent to make a test pass. If the variable is empty, inspect the final destination URL: a redirect or page script may remove the query before DOM Ready.

Compare campaign labels in an Exploration

Once reporting has processed, open Explore > Free form and select a date range covering collection after setup. Import Campaign audience, Event name, and Session source / medium as dimensions, plus Event count as a metric.

Put Campaign audience in Rows and Event count in Values. Filter Event name to exactly match campaign_context. Add Session source / medium as another row to inspect where the labeled events occurred.

You should now see prospecting and remarketing labels separately. These are event counts, not ad clicks, unique visitors, or purchases. The event filter also prevents unrelated events without the parameter from filling the table with (not set).

If DebugView shows the value but the Exploration doesn't, check processing time, spelling, date range, and active developer-traffic filters. Debug events excluded by a filter won't prove that normal production data reaches reports.

Keep landing labels separate from conversion attribution

Event scope is the main boundary. A label sent on campaign_context doesn't automatically attach to a purchase on another page. For conversion analysis, deliberately persist the value under your consent rules, define when it expires or gets replaced, and send it on the relevant conversion event. Don't mistake browser-session storage for a GA4 session definition.

Keep values categorical. Google allows 50 event-scoped custom dimensions in standard properties and warns against high-cardinality fields, such as unique session IDs or timestamps. Never put email addresses or other identifying information in campaign URLs.

The useful output is a reportable campaign label with a known collection rule. Before comparing revenue by that label, make sure the revenue event actually carries it.

SparkTraffic

Website traffic and analytics guides from SparkTraffic.

Content on this site is openly accessible for indexing and use by AI systems and LLMs (e.g., ChatGPT, Gemini, Claude, Perplexity, etc.).
We support transparency and innovation in AI. 🤖