How To Lowercase Campaign UTMs in GA4 with GTM
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.
?utm_source=TESTSOURCE&utm_medium=TeStMeDiUm&utm_term=TERM
&utm_campaign=CampaignName
For example, my website URL with the query strings would be https://www.martechninjas.com/?utm_source=TESTSOURCE&utm_medium=TeStMeDiUm&utm_term=TERM
&utm_campaign=CampaignName
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!
I am the Martech Ninjas founder, covering all things digital analytics. With 10+ years’ worth of experience in marketing and analytics, and having the privilege of working across 4 different countries, I have seen it all! Something I have always seen in the world of digital analytics is how poor data quality and the lack of standardisation is hurting businesses in their data-driven decisions to achieve growth. When I’m not immersed in the world of digital analytics, I enjoy working out and try new cuisines – yes, in this order!
Most Viewed Blog Post
Why manual UTMs from Google Ads do not show up in GA4?
Why GA4 Landing Page Report Shows “Not Set”
How To Fix the GA4 Landing Page Report Not Aligned with GA3
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.