GA4: Setting Up utm_content & utm_term - Duggan Digital (2024)

If you are one of many people who is slowly coming to terms with the migration from Google Analytics Universal (referred to as GA UA going forward) to GA4, you may have noticed a few significant changes. With drastic changes to event naming and UI, other important changes have gotten less attention, but nevertheless are important to address as your organization is forced off GA3 in 2023. One of those is the removal of two commonly-used UTMs: utm_content and utm_term.

GA4: Setting Up utm_content & utm_term - Duggan Digital (1)

The Problem with UTMs in GA4

First off, if you don’t know what UTMs are, you are likely reading the wrong article. GA UA uses 5 built-in UTM parameters that can be populated to pass various information about a user’s origin. Those UTM parameters are:

  • utm_source (referred to as “Source” in GA)
  • utm_medium (Medium)
  • utm_campaign (Campaign)
  • utm_content (Ad Content)
  • utm_term (Keyword)

Most companies leverage at least the first three of these UTMs in their tracking and ads. Many companies also use the final two, utm_content and utm_term, to pass additional information about an audience, ad creative, mailing name (email), or targeting strategy, amongst other data. GA4 has quietly removed automatic tracking of utm_content and utm_term, making more granular breakdowns of traffic difficult. While the values of all query parameters can technically be viewed in custom reports by looking at the “Page Path + Query String” dimension, the flexibility and utility of analyzing UTMs that way is minimal.

Why would GA4 stop making these parameters automatically available in the UI, when it seems features like enhanced measurement position GA4 as superior to GA UA out-of-the-box? I can’t provide an answer to that, but it isn’t the only aspect of GA4 that is counter-intuitive.

One important disclaimer – I want to be fair to GA4 and note that GA4 technically captures both utm_content and utm_term, but the data is only available using the GA4 APIs. If you have the technical chops, I would invite you to explore the API. Still, having UTMs in the UI is vital for quick analysis, and even if you are very comfortable with APIs, your GA4 setup may mention from the below solution.

How to Configure GA4 to Capture All UTMs

Setup Difficulty: Medium

I am going to walk through how to overcome this GA4 limitation using Google Tag Manager. The solution is similar to other tag management solutions, so hopefully anyone can apply these steps to their specific situation.

(Is GTM out of your comfort zone? Feel free to reach out to us – we’re happy to help!)

From a high level, you need to capture the UTMs in GTM, store those values so they can be accessed for the entire session, then pass the values on EVERY event sent to GA4 during that session.

Why do we need to send the UTM data on every hit? Since GA4 does not support session-scoped custom dimensions, we need to set this new tracking as event-scoped. User-scoping these UTMs would be problematic for a variety of reasons.

First, you will want to set up 2 GTM variables, one to capture utm_content and one to capture utm_term.

GA4: Setting Up utm_content & utm_term - Duggan Digital (2)
GA4: Setting Up utm_content & utm_term - Duggan Digital (3)

Next, we’ll need to persist the UTM values so that GTM can read them for all pages in the user’s session. There are a few different mechanisms one can use to persist data in a browser. For the sake of this example, we’ll use the simple first party cookie, but you could also use sessionStorage or localStorage. The GTM tag to set the cookies would look like this:

GA4: Setting Up utm_content & utm_term - Duggan Digital (4)

GTM should be set to fire this tag any time utm_content or utm_term is present in the URL. The additional benefit of firing in that way (rather than some complex landing page-only logic) is that it will overwrite the cookie values if new values appear. Maybe traffic came through Google Ads, then was retargeted and came back from a Facebook ad within 60 minutes. We’d want the second session to have Facebook’s utm_content value, which is accomplished with this setup.

GA4: Setting Up utm_content & utm_term - Duggan Digital (5)

We’ll also set up new GTM variables to track the values of these cookies.

GA4: Setting Up utm_content & utm_term - Duggan Digital (6)
GA4: Setting Up utm_content & utm_term - Duggan Digital (7)

One final set of variables we need makes sure the UTM values are always ready for the config tag. We can’t solely rely on cookies, since we’re setting them on pageview and depending on your setup, the values might not be ready in time for the initial config/pageview to GA4. We’ll use some quick and easy Javascript for this logic.

GA4: Setting Up utm_content & utm_term - Duggan Digital (8)
GA4: Setting Up utm_content & utm_term - Duggan Digital (9)

Next, you’ll want to edit your GA4 Config Tag to pass these parameters. You’ll enter these in the “Fields to Set” section of the GA4 Config Tag, along with any other event-scoped parameters you may have. You do not need to add the parameters to every single GA4 event/tag in your container. Setting the parameters in the config tag will automatically pass the values with every single event.

GA4: Setting Up utm_content & utm_term - Duggan Digital (10)

Finally, we’ll go ahead and set up the custom definitions in GA4. You’ll do this by going into your GA4 property, Configure -> Custom definitions -> Create custom dimensions. The names are arbitrary, but the parameter must match what you used in GTM. If you are copying our roadmap, that would mean setting the parameters to utm_content and utm_term.

GA4: Setting Up utm_content & utm_term - Duggan Digital (11)

Publish your GTM container and you’ll be back in business! “UTM Content” and “UTM Term” will be available in GA4 and Google Data Studio. I’d imagine this work-around will eventually be unnecessary as GA4 evolves, but for now, it’s necessary for full attribution detail and data collection.

I hope this step-by-step guide was helpful! Post any questions/comments/concerns you may have in the comment section.

GA4: Setting Up utm_content & utm_term - Duggan Digital (2024)

References

Top Articles
Latest Posts
Article information

Author: Edmund Hettinger DC

Last Updated:

Views: 6068

Rating: 4.8 / 5 (78 voted)

Reviews: 93% of readers found this page helpful

Author information

Name: Edmund Hettinger DC

Birthday: 1994-08-17

Address: 2033 Gerhold Pine, Port Jocelyn, VA 12101-5654

Phone: +8524399971620

Job: Central Manufacturing Supervisor

Hobby: Jogging, Metalworking, Tai chi, Shopping, Puzzles, Rock climbing, Crocheting

Introduction: My name is Edmund Hettinger DC, I am a adventurous, colorful, gifted, determined, precious, open, colorful person who loves writing and wants to share my knowledge and understanding with you.