How To Lowercase Campaign UTMs in GA4 with GTM

Published   May 19, 2023 | Updated on May 19, 2023
Google Analytics 4

Do you want to make your campaign UTMs consistent and easy to read in GA4? By using Google Tag Manager (GTM) to lowercase your UTM parameters before they reach GA4, you can avoid messy data.

Previously, in Universal Analytics (GA3), there was a custom filter type (Custom filters) – Lowercase – which could be used to lowercase your UTMs: ‘utm_source’, ‘utm_medium’, ‘utm_term’ and ‘utm_campaign’ values in the frontend user interface (UI). Unfortunately, this feature is not available in GA4 but there is an alternative.

Just follow these 5 steps to set it up:

Step 1: Create a new variable in GTM.

Go to:
Workspace > Variables > New.


Name your variable: ‘URL Query – UTM Source Lowercase’. Choose ‘URL’ as the variable type and ‘Query’ as the component type. Enter ‘utm_source’ as the query key. Click on ‘Format Value’ and check the box ‘Change Case to…’. Select ‘Lowercase’ and click ‘Save’.


Step 2: Repeat the previous step and create a variable for the other UTMs.

You have created a variable for the UTM source. Now do the same for the UTM medium, term and campaign. The only thing that changes is the query key. Use ‘utm_medium’, ‘utm_term’ and ‘utm_campaign’ for each variable.


Step 3: Add the variables to your GA4 configuration tag.

Go to:
Workspace > Tags.


Find your GA4 tag with the type ‘Google Analytics: GA4 Configuration’ and open it.

Click on ‘Fields to Set’ and ‘Add Row’. Type ‘source’ as the field name and choose the variable ‘URL Query – UTM Source Lowercase’ as the value. Do this for the other UTMs with the field names ‘medium’, ‘term’ and ‘campaign’. Choose the corresponding variables as the values.

Click ‘Save’ when you are done.


Step 4: Test your setup.

In GTM, click the Preview button and enter your website URL. A new tab will open with your website. Add these query strings to the URL and press enter.


For example, my website URL with the query strings would be

Now, go back to GTM preview and check the events. Under the ‘Variables’ tab, you should see the values of the variables created in lowercase.


Verify this in GA4 by going to Admin > DebugView and looking at the ‘page_view’ event. The parameters ‘source’, ‘medium’, ‘term’ and ‘campaign’ should be all in lowercase.


Step 5: Publish the Changes in GTM.

If everything looks good, you can publish the changes to your live website.

In GTM, click on ‘Submit’ and on the ‘Publish and Create Version’ tab give a name and a description to the changes. Click on ‘Publish’ once done.

Final Thoughts

That’s how you can lowercase your UTMs in GA4 with GTM in five easy steps. If you feel overwhelmed by this process, don’t worry. We are here to help!

We have a team of experts who can set this up for you in no time. You can trust us to handle everything and make sure you get the best out of your GA4 and GTM. Contact us today and let’s get started!


Comment on this article:

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

Generic selectors
Exact matches only
Search in title
Search in content
Post Type Selectors

Get a Free

GA4 Guide

Enter your name and email address. We'll send you a free copy of our GA4 guide, which highlights the importance of migrating to GA4 and its amazing benefits for your business.

This field is for validation purposes and should be left unchanged.