Build UTM Tracking Parameters for Google Analytics 4

ga4

Measurement within Google Analytics & Tracking other Channels In GA4 Requires a Consistent Process for UTM Parameter Naming Conventions

 

utm tracking parameters are the Primary method of tracking, measuring and comparing all Google and non-Google channels within Google Analytics 4. The benefits of consistently naming and applying UTMs with standard values is often massively overlooked by organisations, marketing departments and agencies. If utm tracking parameters are not implemented then the true source of that traffic can be lost to Direct or Referral and in-platform metrics like cost, impressions and clicks cannot be imported.

GA4 comes with cross-channel attribution as standard, so the ability to compare channels side-by-side and end-to-end, from impression to conversion, is not possible without an agreed cross-team plan on how to build URLs consistently by appending these parameters in advance of launching any non-google marketing activity.

TL;DR UTM_Builder Tool

“File > Make a copy” and use this “utm builder” google sheet that incorporates the advice of this post!

The ease of which is it possible to import non-Google in-platform metrics into GA is also dependent on building UTMs consistently. The best way to achieve this is to consistently name the source and medium while taking the campaign value directly from the channel e.g. from Facebook. Exporting this data from Facebook, segmented by day, along with the metrics: spend, clicks, impressions means it can be uploaded to Google Analytics without any further data manipulation.

  • Google Analytics can then also generate from these metrics: ROAS, CPA, CTR, CPC

Cross Channel Advertising performance in GA4 reports on Ad Cost, Conversions, Cost per Conversion, Total Revenue and ROAS which can be segmented by the Dimensions of:

  • Default Channel Group

  • Source Platform

  • Source

  • Medium

  • Campaign

Why Does Google Analytics Need UTM Parameters

Google Analytics relies on utm tracking parameters in order to identify marketing campaign traffic as this is not something it can understand without our help. By default, the only inbound sources that Google Analytics can “see” is referral url’s which get passed to it as standard by the browser. This allows Google Analytics to categorise the following “medium” / “source” value pairs

  1. organic (with e.g. “google” as the source)

  2. referral (with the “source” being the website domain that the user clicked on before landing on your site)

  3. (none) / (direct) is the classification used when the browser doesn’t contain any information as to how the user landed on your site

    1. It may mean the user typed your exact domain into a browser or already had it bookmarked from a previous visit but that is an assumption

The only thing we know for sure about “Direct” traffic is that we don’t know where it came from

GA4 Default Channel Grouping

GA4 is much better about using the referral information and applying some additional rules in order to create meaningful buckets e.g. a referral from facebook.com, linkedin.com, instagram.com will the grouped under “Organic Social”

Overriding the Default Rules

To go any deeper about performance of a specific posting, placement, audience, paid link or full blown marketing campaign then the landing page URL used in the “paid” activity needs to include utm parameters. These override and overwrite the default referral data. The utm parameters are written as key-value pairs where the “value” is any text you like so being consistent is critical. utm_source and utm_medium are required and necessary as the minimum number of “keys”.

  • utm_parameters must include at least source and medium (no longer a requirement in GA4)

  • Do not add any parameters to any links on the website Google Analytics is installed on.

    • utms are only so you know how a user first found your website and are only relevant internally to the business for reporting

    • do not dictate utms from any links on your website to a different website

      • These should be provided by that website owner as it relates only to their google analytics reports

Available UTM Parameters

  1. utm_source_platform e.g. SA360, DV360, Manual

  2. utm_source * e.g. “facebook”

  3. utm_medium * e.g. “paid-social”

  4. utm_id ** (campaign ID) e.g. 123456

  5. utm_campaign (name of the campaign)

  6. utm_term (keyword)

    1. GA4 Dimension is “Manual term”

  7. utm_content (something about the ad worth labelling)

    1. GA4 Dimension is “Manual ad content”

  8. utm_creative_format *** e.g. "video”

  9. utm_marketing_tactic *** e.g. “remarketing”

* Must be included (required) in the URL for Universal Analytics (There are no requirements to include any specific UTMs in GA4)

** utm_id is required as part of the schema for importing Cost data to GA4

*** Can be included but not reported in GA4 (at time of writing)

utm_term gets mapped to the dimension of “keyword” in GA3 and “manual term” in GA4
 
 

*required for Importing Cost Data to GA4 and “use without quotes”

Valid Landing Page URL Format

  1. Start with the URL as usual

  2. If it already has a ? and some query parameters that the CMS needs then add on new utms with an &

  3. If there is no ? then add a ? to denote the start of the utms

An example of this if I had created an Ad on LinkedIn the landing page URL could be: https://playhouse.digital?utm_source=linkedin&utm_medium=paid-social&utm_campaign=sme&utm_content=market-sizing-post


Character limits of UTMs

I’ve found contradictory advice about this from multiple sources e.g. there are different character limits per parameter which I can’t verify is the case. Some say:

  • 100 characters (custom event parameter character count in GA4)

  • 200 characters

  • 255 characters for campaign names within campaign manager 360 (but this is something different)

  • 500 characters

What seems most likely is that, generally speaking, max length of URLs should be less than 2000 characters (which includes query parameters).

There is also this google resource stating that GA4 event parameter value character limit is 100 characters. This does not apply to utm parameter values however as they are an exception to this limit.

Having tested this out with various utm_campaign parameter lengths I’ve found that 500 is not the upper limit so the main constraint appears to be the total URL length is less that 2000 characters.

 

Auto-Tagging In Google Ads and Microsoft Ads

Google ads does not require any of this to be set up manually as there is an account level setting to enable “auto-tagging”. In addition, make sure the Google Ads and Google Analytics platforms are linked. Auto-tagging does a lot more than forgo the need to define utms manually including passing of data via gclids, defining GA4 reporting for “session google ads ad group name”. Note that there is no utm for “ad group” which is a massive anomaly.

Microsoft (Bing) Ads also has an account level option to enable auto-tagging but this literally adds all utm info it can to the ends of URLs and that is as much as this can do.

 

Build Dynamic URL Paramaters For Facebook Ads

 

Facebook has some very handy dynamic parameter values that can be automatically inserted into the key-value pair that gets sent to Google Analytics. These are:

  1. {{site_source_name}}

  2. {{placement}}

  3. {{campaign.name}}

  4. {{adset.name}}

  5. {{ad.name}}

  6. {{campaign.id}}

  7. {{adset.id}}

  8. {{ad.id}}

Note that these do not map 1:1 with the available utm_parameters but more can be added in the “Custom parameters” section

 
  • {{site_source_name}}

    • this is e.g. facebook (fb), instragram (ig), messenger (msg), audience_network (an)

  • {{placement}}

    • this is the ad placement/inventory e.g. it might be Instagram_Stories, Facebook_Right_Column or Facebook_Desktop_Feed

    • Facebook_Desktop_Feed

      Facebook_Instant_Articles

      Facebook_Instream_Video

      Facebook_Marketplace

      Facebook_Mobile_Feed

      Facebook_Right_Column

      Facebook_Stories

      Instagram_Explore

      Instagram_Explore_Grid_Home

      Instagram_Feed

      Instagram_Profile_Feed

      Instagram_Reels

      Instagram_Shop_Tab

      Instagram_Stories

      Messenger_Inbox

      Messenger_Stories

  • {{campaign.name}}

    • actual name of the Campaign in FB

  • {{adset.name}} (note: there is no direct equivalent of this as a UTM)

    • actual name of the Ad Set in FB

  • {{ad.name}}

    • actual Ad Name

  • {{campaign.id}} should be mapped to utm_id in the “Add parameter” section

When using the builder, multiple dynamic values can be stringed together with delimiters, for example a - or _

The value can also be filled in with any static text instead of in addition to the dynamic values.

 
 

Some Tips for Choosing Which Facebook Dynamic Parameter to Use With Which UTM

The best tip is to be consistent. Not just within a Campaign but across the whole Ad Account and for every Campaign activated year after year regardless of which person creates the campaign be it across multiple marketing agencies or internal marketing team members

For utm_source *, I tend to use a static value. If Facebook Ads is a new traffic source “meta” would be nice! If the precedence has already been set then stick with whatever this is (it’s probably “facebook”). Avoid using {{site_source_name}} as the dynamic insertion does not always work.

For utm_medium *, I tend to use “paid-social” but this could be “cpc” or something else, as long it is done consistently and makes sense alongside all the other acquisition channels. Avoid using {{site_source_name}} or {{placement}} as the dynamic insertion does not always work.

For utm_campaign *, I tend to string together the dynamic values from {{campaign.name}}_{{adset.name}} (even though dynamic values do not always work)

For utm_content, I tend to use at least the dynamic values from {{placement}}

For utm_id *, use {{campaign.id}}

Add utm_id to all Paid Channel Landing Page URLs

Importing Cost Data into GA4 requires utm_id, utm_campaign, utm_source and utm_medium so for Facebook this is collected via the {{campaign.id}} dynamic value

{{site_source_name}} and {{placement}} are dynamically inserted by Facebook and these are 2 values not available by any other means so they are extremely useful

Once saved, this pop-up updates these fields in the correct format and appends them to the destination URL of the website. But there’s no need to stop here and only use these parameters.

  • ?utm_source=meta&utm_medium=paid-social&utm_campaign={{campaign.name}}_{{adset.name}}&utm_content={{placement}}-{{ad.name}}

Sometimes All Dynamic Parameters fail to populate so never rely solely on these for populating source and medium (possibly even campaign)

Unfortunately the Audience Network tracking does not always populate, even though there are values for this and if that happens all dynamic values associated with the Ad Placement also do not populate. The only way to ensure this is avoided is by not using the Audience Network. At Ad Set Level targeting, Advantage+ placements should be avoided.

UTM Tracking for Organic Social

Building URL parameters can and should also be factored into every organic social media post (that contains a link to your website). Although GA4s ability to more astutely separate out the different organic sources, it cannot know anything else than it came from LinkedIn. If you want to monitor on individual organic post performance in driving traffic and beyond then add some UTMs. The principle is exactly the same.

Campaign Naming Convention (from Platform to GA4 Report)

utm_campaign is the main key-value pair that can add instant value to all acquisition reports in Google Analytics. The easiest way to deliver this goldmine of data is to factor in the whole utm journey from “facebook campaign name” > appears in the web address of the browser > appears in GA4 reports

Facebook (or any other marketing channel) Campaign Name

The marketer decides this when they create a campaign in Facebook but what this is called will now become “stuck“ forever in an analytics report! Choose carefully and set it once. This is especially true for facebook as once a dynamic parameter “name” goes from Draft to Published the campaign “name” sticks even if it is subsequently changed within Business Manager. So if the “name” of a published campaign needs to change (and it hasn’t gone live yet) then make a copy first to re-draft it.

How Does the URL (Query) Look in the Browser

I used to avoid using spaces in campaign names as the browser would need to encode this query part of the URL by substituting the space for a + sign or %20. Facebook or the browser will do this automatically. (Technically, if there was a space in the /path/ part of the URL this would be substituted for a %20 sign and if it was in the query part it should use a + sign).

Facebook has an odd anomaly in that if, for example a campaign contains spaces and the ad placement is right hand column, it uses %20 in the query parameters but + for desktop feed ads

  • RHC Ad

    • ?utm_source=meta_fb&utm_medium=paid-social&utm_content=Facebook_Right_Column&utm_campaign=New%20Traffic%20Campaign_New%20Traffic%20Ad%20Set

  • Desktop Newsfeed Ad

    • ?utm_source=meta_fb&utm_medium=paid-social&utm_content=Facebook_Desktop_Feed&utm_campaign=New+Traffic+Campaign_New+Traffic+Ad+Set

Both the browser and GA don’t seem to mind/care too much about this and it rarely “breaks” these days but still, I’d rather be safe than sorry (if I can be bothered)

How Does It Look in Google Analytics

URLs and GA are both case sensitive. Dimensions such as Source / Medium in GA will reflect exactly how the utm values were written into the landing page URL. If a Microsoft Ads Campaign name is edited from “Proper Case” to “lower case” then this would create two rows of data and appear to be two different campaigns. This could be avoided by using absolute campaign IDs but it then makes the GA reports impossible to read in-situ. The campaign ID could be appended to the utm_campaign value but it would still be quite unsightly to read in a GA4 report.

A useful Universal Analytics filter to avoid this situation was to create a rule to “lowercase” all incoming UTMs but this is not a feature of GA4 (at the time of writing)


Taken from the “Google Merchandise Store” GA4 account

Previous
Previous

Auto-Tag Google Shopping Organic Free Listings to Track Performance in GA4

Next
Next

Google Ads Optimisation Score Recommendations Dos and Donts