Blog

Step Up Your Game & Track Custom UTM Parameters in Google Analytics

Ever find yourself limited by standard UTM Parameters and wish you could see Custom UTM Parameters in Google Analytics reports?

I have, and from what I came across in forums others have as well. As a result, I was prompted to write a simple step-by-step guide.

Before I show you how to track Custom UTM Parameters in Google Analytics let’s go over the basics.

 

giphy 2

 

What are UTM Parameters?

 

UTM stands for Urchin Tracking Module.

Google defined the five standard tracking variables in its early Urchin days (Pre-Google Analytics).

The five standard parameters Google Analytics provides are:

 

Source = utm_source

Medium = utm_medium

Campaign Name = utm_campaign

Term [Keyword] = utm_term

Content [ad content] = utm_content

Note: Google recently added new UTM Parameters for GA4 for the first time in over a decade. You can learn more here.

For example, using Google’s Campaign URL Builder, you can build URL Parameters that look something like this:

 

https://example.com/?utm_source=facebook&utm_medium=cpc&utm_campaign=spring+sale&utm_term=green+cta&utm_content=lifestyle+image

 

You can find the above parameters as dimensions in Google Analytics in standard and custom reports as primary and secondary dimensions.

 

Custom UTM Parameters

 

 

What are Custom UTM Parameters?

 

In the above example, I am using the medium as the audience instead of CPC or social.

In theory, this works (and I do use it for some clients) but it can mess with your default channel grouping and measurement plan.

And what if you are looking to track additional values such as Site ID or Placement?

You can append custom parameters to your URLs. However, the problem is that you cannot see these in standard and custom Google Analytic reports.

This quick guide solves precisely that problem.

It is a pretty simple set up as long as you are managing your tags via Google Tag Manager.

 

Creating Custom UTM Parameters

 

Since these are custom, you can define these however you want. I like to follow the Google format, but that is not required.

Make sure to come up with a clean and consistent naming structure that can be applied account wide.

For this example, I will create a custom parameter so that I can pass my Facebook Campaign Audiences to a Google Analytics custom dimension called Audience.

My Custom UTM Parameter

utm_audience

And here it is appended to a URL:

 

https://example.com/?utm_source=example+source&utm_medium=example+medium&utm_audience=example+audience+1

 

Creating The Custom Dimension

 

Now that we have our Custom UTM Parameter defined let’s set up our Custom Dimension.

Go to admin, navigate to the middle Property column and click on Custom Dimension under Custom Definitions.

 

Custom UTM Parameters

 

Click create +New Custom Dimension.

 

Custom UTM Parameters

 

Give the Custom Dimension a Name and call it Audience and set the Scope level to Session.

 

Custom UTM Parameters

 

Remember your custom dimension Index Number since we will be using it in the next step.

 

Custom UTM Parameters

 

Passing Custom UTM Parameters Value to Custom Dimensions

 

Ok, let’s head over to the Google Tag Manager for the remainder of the setup.

First, we need to create a User-Defined Variables and call it utm_audience

 

Custom UTM Parameters

 

Choose URL as the Variable Type

 

Custom UTM Parameters

 

Change the Component Type to Query and define the Query Key as utm_audience and click save.

 

Custom UTM Parameters

 

Now head over to your Google Analytics Tag in GTM and expand More Settings.

 

Custom UTM Parameters

 

Under Custom Dimensions define the Index Number that corresponds with your Audience Dimension and set the Dimension Value using the utm_audience variable.

 

Custom UTM Parameters

 

Next, click save, publish your changes, and you are done.

 

Finding the data in Google Analytics

 

You can now access your custom dimension in custom reports or standard reports as a secondary dimension.

For example, below I am looking at the standard source/medium report with Audience pulled in as a Secondary Dimension.

Note: If you are excluding URL Query Parameters in your view setting or using filters make sure to add your new custom UTM Parameters to keep your Google Analytics page reports clean.

 

Custom UTM Parameters

 

Conclusion

 

Setting up Custom UTM Parameters this way is super helpful in tracking and reporting on additional values outside of the five standard Google UTM variables.

What will you be tracking using this approach?

 


 

Leave a comment

Your email address will not be published. Required fields are marked *

Hi,

does it work also with other queries, such as “#”?

For example, can it read “company” from URL mysite.com/#company?

Thank you for letting me know.

All the best,

Lukas

Reply

Hi Lukas,

Yes, it is possible to apply a similar approach using URL Fragments.

Here is a good post on how to do this http://bit.ly/2qU9mBR

Reply

HI,
I have created a custom dimension via the instructiosn above labeled as utm_mkt-campaign however the dimension isnt populating with values in GA. Did you have any suggestions aroudn trouble shooting this?

Cheers,
Sam

Reply

Hey Sam,

I typically set this up with Scope set to session but other users have seen this work with scope set to hit. Give that a try and let me know if that works.

Reply

Thank you!! This article was exactly what I was looking for, and it’s the most straightforward one I’ve ever come across for GTM.

Reply

Thanks 🙂

Reply

Will these custom parameters get pulled into the API for Google Data Studio?

Reply

No the custom parameters will get pulled into Google Analytics but once you connect GA to Google Data Studio the custom parameters should be available in Data Studio as dimensions.

Reply

I tried it, but it’s not working! I find the dimension, but it has no data in it! It might be a problem with the translation, my gtag is in portuguese and I couldn’t find the “query” key. What are the other options in english. Maybe I can guess which is which! (it didn’t translate to any of my options well)

Reply

Another user mentioned that setting the scope to hit instead of sessions worked for him can you give that a try?

Reply

Hi,

Are there any additional steps that need to be done? Do we set a trigger? Also, the JavaScript that is GA, do i change the dimension value within that script. If so, how do i add in gtm, as a custom html, data layer etc?

Reply

Once you follow the steps outlined in the post you just need the traffic to come to your site 😊 To test this you can append the URL Parameters to any link for your site and see if it translated properly in Google Analytics. Let me know if you have any other questions.

Reply

Hi!

Thanks for the detail of this post. It’s very helpful.

One problem we are having is implementing the necessary JavaScript to our GA, given that our e-commerce site runs on Shopify and we use the native GA/Shopify tag integration that doesn’t give us the ability to add custom parameters. Do you know of any solution/workaround to this?

Thanks in advance!

Best,

C

Reply

You do need the Google Tad Manager installed on the site which you can do by adding scripts in Shopify. You can then add the GA snippet for custom dimensions required for custom dimensions the same way you added the GTM snippet on Shopify. Just make sure it is placed in the right section of code. All other customizations happen within GTM or the Google Analytics Admin section.

Reply

Hi, when I set the scope to session Level, I see a huge bucket of undefined / null. When I set it to hit level it works great.
Is the session scope really the correct one for this case ?

Reply

Good question I double-checked my set up and it is working with the scope set to sessions. Is the data you are seeing on the hit level accurate?

Reply

Hi,
I have successfully implemented Cross-Domain tracking with Google Analytics (1 session as user jumps across domain, same _ga cookie on both domains, etc.) However, when the user jumps to the second domain and completes a purchase, the eCommerce transaction is not getting attributed to the utm custom campaign from the first page. It seems you can’t pass the utm custom campaign information cross-domain. Is this true? What say you?

Reply

It is possible to track custom campaign information across domains for eCommerce transactions. Optimize Smart has a detailed guide on setting this up. Let us know if you have any questions about this. https://www.optimizesmart.com/cross-domain-tracking-in-universal-analytics-demystified/

Reply

Is it possible to pass a parameter that is in Facebook like {{placement}} but in Google Analytics the dimension is defined as Placement URL ga:adPlacementUrl or Placement Domain ga:adPlacementDomain just to not create another custom dimension that represent the same data but to integrate both?

Reply

That is a really good idea. TBH will need to look into it. Will post an update here shortly.

Reply

Saved as a favorite!, I like it!

Reply

I dont have custom dimension tab. Do we need to link with google ad account?

Reply

You can find custom dimensions in Google Analytics under Admin > Middle Column (Property Column) > Custom Definitions. Let me know if that helps.

Reply

Hi there,

This is precisely what I am looking to try and do.

I have followed your guide and am unable to see data in GA. I have tried changing from sessions to hits with no luck.

I have inherited this account from a previous employee. Within tag manager, is it the “Page View – All Pages” tag that I should be adding the custom dimension to? I can’t see a generic GA one.

Thanks for your help!

Reply

You should have the global Google Analytics site tag installed vie the tag manager firing on all pages. However, I have seen people hardcode the GA global site tag directly on their site or install it via their CMS and then use GTM for any additional custom tags i.e. events. The first thing I would do is verify how you have the global site tag installed and if hardcoded on the site move the install to GTM. If this is not the cause for the error let me know.

Reply

Hi,
Thanks a lot. Nice post! I did everything you wrote. Now I can see my custom parameters in custom dimensions, but I have a problem with the traffic sources.
I did this configuration on the cross-domain tracking and after adding a custom parameter to a link all the traffic from that link becomes direct/(none).
Google Tag Assistant and GA debugger shows that everything works fine, but in GA reports I can see direct traffic appeared exactly for the new link and landing page this link leads to.
Please could you help me to understand what I did wrong?

Thanks,
Roman

Reply

It is hard to troubleshoot the issue without seeing the exact configuration. However, if you have cross-cross domain tracking installed with the allowLinker it should transfer UTM Parameters across domains.

If you cannot enable allowLinker then you could try to implement a custom script via Google Tag Manager using this method.

Reply

I’m using a chat bot on my site for the sole purposes of directing users to specific content on my site. Can I use something like ?utm_custom=chatbot in the link without adding source/medium. My thinking is that I could view the special page in behavior in GA and then have a secondary dimension of custom dimension. This would tell me what percentage of the users came to this page with the help of the bot versus those that navigated there. Would this work?

Reply

Hey Steve,

Yes that should work. If you do implement the above Custom UTM Parameters I would love to hear how applying this workaround works out for you from an analysis perspective.

Reply

Do you need to install the javascript on the site using tag manager. I can’t see that step included above?

Reply

You do not need to install Javascript on the site to make this work as long as GTM is installed you should be good to go. Let us know if this helps clarify things.

Reply

What about the cookie expiration date? The utms have a cookie lifetime of 6 months but with the session set to scope it will last the duration of the session. How do you keep the same expiration date knowing that people can come back via direct traffic?

Reply

You can set the scope on the user level however since cookies don’t follow you across devices and with the rollout of ITP and cookie deletion it probably won’t have a huge impact. Take a look at this article on scopes.

Reply

Do I need to include the language “UTM_” in my custom parameters for GA to track these values?

Ex: Can I use http://www.mywebsite.com?kw=analytics&l=colorado OR do I have to use http://www.mywebsite.com?UTM_kw=analytics&UTM_l=colorado

Reply

You do not need to include UTM_ in the custom parameter. Just make sure that the query key in the User-Defined URL Variable exactly matches your custom parameter name other wise the values won’t translate.

Reply

Hi

Thanks for the article really helpful…

I cannot see “More Settings” under my UA, and not able to set custom dimensions as you described in the GTM… is that settings something moved another place in GTM?

Thanks!

Reply

Make sure you have ‘Enable overriding settings in this tag’ checked otherwise you will not see more settings.

Reply

Thank you for the post! I just followed all the instructions but don’t see any data populating yet. Does it work retroactively or only moving forward like goals? Should I just give it a day or so to collect data?

Best,
Marina

Reply

It does not work retroactivly it will only populate data from the time you configured your custom UTMs and custom dimensions. Let me know if you are seeing the data now or if you have any other questions.

Reply

hi Can we add
utm
like the utm_source=facebook&utm_medium=cpc&utm_campaign=demo&utm_content=banner&utm_audeince=Page+visits&utm_pagevisits=&utm_session=time+spent&utm_geo=us

Reply

Yes, but you would need to configure a custom dimension for each custom value [utm_audience, utm_pagevisits, utm_sessions, utm_geo] to report on them in Google Analytics.

Reply

Hi! I have a url parameter which is email=mailname@exemple.com and I would like to see a report with every email.

The email would be a new utm, can I actually get the emails of my customers through the parameter?

Reply

I strongly recommend you do not include any personal identifiable information in your UTM Parameters. UTMs are not secure and anyone can access that information. You are better off setting up a user ID view in Google Analytics that captures user IDs. Then you can leverage the User Explorer reports. Or if you have a CRM pass UTM_Parameter values to your CRM and do the analysis within your CRM.

Reply

Hi and thanks for that article. More over year we are using custom dimension for one client and we are constantly experiencing the same issue. The number of session is higher in report without displaying custom dimension than the number of session in report with custom dimension parametr displayed as secondary dimension. The campaign is correctly labeled with basic utm parametrs, but it seems like the custom utm parametr in some amount of the traffic is missing. We had checked the URL’s and all of them are correctly marked with all utms. Do you have any idea how it is possible? Or how we could test it?

Reply

What scope are you using for your custom dimension?

Reply

is there a way to set this up without GTM?

Reply

You could manually modify your tracking code however, it would require custom development support and a solid understanding of Google Analytics. In most cases configuring GTM for your site is the easier way to go about it.

Reply

Thank you so much for this posy, it really gives a clear idea and step by step implementation guide.

Reply

Glad to hear you found the post helpful 🙂

Reply

Hi, this is great! I have set this up for my site, but I have a question about how the data appears in Google Analytics. When users land on a page via a URL tagged with my custom UTM parameter (utm_audience), instead of attributing the visit to that page url (e.g., /index), GA creates a new page URL (e.g., /index?utm_audience=example) that appends the custom UTM (but not any of the traditional UTM parameters). For example:
If I have an ad driving to the Index page of my site, and I tag it with only traditional UTM parameters–when I look at landing page data for the Index page in Google Analytics, it shows all the visits to /index (whether those visits came from my ad, or they came from a different traffic source).
However, if I have an ad driving to the Index page, only this time I use traditional UTMs AND my custom utm_audience parameter–when I look at landing page data for the Index page, I see visits to /index, but then ALSO see a separate line item for /index?utm_audience=example.
The traditional UTM parameters aren’t appended to the URL in GA–only the custom parameter.
Is there a way to consolidate all the traffic (whether it has a custom UTM appended to the clicked URL or not) into the /index page in Google Analytics?

Reply

All you need to do is exclude URL Query Parameters in either the Google Analytics view setting or by setting filters on the account level. You can learn how to do this here.

Reply