How to Hide Google UTM Parameters from URL
See how to create branded URLs via GTM – like www.yoursite.com#instagram.

Google Campaign UTM parameters – we know we need to use them but they make our URLs look so ugly!
And a URL shortener results in losing out on brand-friendly URLs.
Consider links on your social profiles:
Worst: https://goo.gl/PDMy8P
Better: https://www.getelevar.com/?utm_source=instagram.com&utm_medium=social&utm_campaign=profile-link
Best: https://www.getelevar.com/#instagram
Good news! Now you can get the “Best” option with a quick Google Tag Manager configuration.
Campaign URL Building Tips
Learn why campaign tagging is a must for ROI
Once you’ve completed the setup below in GTM, you’ll be able to create inbound links to your site that are campaign friendly (with Google’s UTM parameters) that enable:
- Consistent brand standards (& happy marketing team!)
- Instill trust to viewers of your link
- If you’re not in need of an enterprise solution like bit.ly that supports a more robust solution then you can save the cost of an additional service
- Improved offline or print attribution
Prerequisites for this to work for you:
- You have Google Tag Manager setup on your website
- You have a Universal Analytics tag that triggers on all pages
How it Works
Basically what you’re doing is telling Google Analytics:
“Hey, when I put #instagram at the end of my URL, when someone clicks on that link to visit my site then automagically set the campaign source, medium, and name for that visit to be https://www.getelevar.com/?utm_source=instagram.com&utm_medium=social&utm_campaign=profile-link.”
To accomplish this, we have three things to do in GTM:
- Create four User-Defined Custom Variables
- Set three custom field names on your Google Analytics Settings variable
- Ensure we have default-value fallbacks for these UTM parameters so other campaign data is not lost
That’s it.
To demonstrate I’m going to create custom URLs that I’ll use for our profile pages on social networks.
Step 1: Create Default UTM Parameter Variables
Inside of GTM, go to Variables > User-Defined Variables > New >
- Type = URL
- Component Type = Query
- Query Key = utm_source
Repeat this step for:
- utm_medium
- utm_campaign
Step 2: Create URL Fragment Variable
Inside of GTM, go to Variables > User-Defined Variables > New >
- Type = URL
- Component Type = Fragment
- (under More Settings) URL Source = Page URL / Default
Step 3: Create Lookup Variable for Campaign Source
This is where we are setting the Campaign Source UTM parameter in our URL.
Inside of GTM, go to Variables > User-Defined Variables > New >
- Type = Lookup Table
- Input Variable = this is the variable you created in Step 1; so in the example above it would be {{ URL – Fragment – Campaign URLs }}
- Build your Lookup Table with Inputs and Outputs
- Set Default Value Variable (from Step 1)
This might be a little confusing at first, but it’s really not that complicated.
Using the example with www.getelevar.com#instagram, the Input is the #instagram that you append to the end of your URL. The Output is the Campaign Source and what you will see in Google Analytics reports (e.g. “instagram.com / social” Source / Medium All Traffic).
In the example above I have four different Inputs and Outputs set for various social networks:
- #share for linkedin.com
- #social for facebook.com
- #interact for t.com (Twitter)
- #instagram for instagram.com
Step 4: Create Lookup Variable for Campaign Medium
Now we need to set the Campaign Medium UTM parameter in our URL.
This will be very similar to the previous step:
- Copy the previous variable (shown above)
- Name the new copied variable “Lookup – Medium URL”
- Update the Output field
- Set the Default Value Variable (from Step 1)
In my example below I have four new Outputs set for Campaign Medium, with all being “social”
- #share for social (remember, on linkedin.com source from above)
- #social for social (remember, on facebook.com source from above)
- #interact for social (remember, on t.co source from above)
- #instagram for social (remember, on instagram.com source from above)
Step 5: Create Lookup Variable for Campaign Name
Hopefully you got the hang of it now! This is the same process as the previous step and where you’ll want to customize the Output to match your Campaign Name UTM parameter.
I’ve set specific Output names for each to match the intent of the link I’ve shared/set on each social profile. This will likely be very subjective to your own business.
Step 6: Set Fields on Google Analytics Variable
The hard part is done. Now all you need to do is go to GTM > Variables > User-Defined > View your Google Analytics Settings variable*
Under the More Settings > Fields to Set step, configure your settings to look like this:
The individual Field Names and Values can be selected by clicking the + icon.
The order of the Field Names does not matter and you can have other fields set here in addition to this process if you already have other Field Name uses in place.
*If you don’t have one of these set yet and you’re just setting your GA settings on each individual tag then the same process applies.
Step 7: Preview & Validate Data
In your GTM workspace that you just completed all of this work in, enable Preview Mode and test one of your new fancy URLs:
- www.yoursite.com#share
- www.yoursite.com#social
- www.yoursite.com#interact
- www.yoursite.com#instagram
And when viewing your GTM Debug toolbar > Page View > Variables, you will see the variables that start with “Lookup” that contain the values we just setup above!
You can also verify this when looking inside of the Real Time reports in Google Analytics:
A few additional notes:
- Google Analytics ignores fragments (i.e. the #share at the end of the URL) which means you won’t be creating duplicate page URLs in GA reports.
- The lookup table is an exact match – so double check your inputs and outputs.
- You can also set Campaign content & keyword variables as well (not pictured above).
Conclusion
There is a quick and easy way to enable brand-friendly URLs that contain Campaign UTM parameters used when analyzing campaign performance.
You’re likely to implement more than four lookup “fragments” but if you take time to set up all of your upcoming marketing links at once then you’ll save time from having to manage these links individually every time you get ready to post.
If you have other helpful tips or examples please share with us on Twitter or email me at [email protected]
Get Exclusive Elevar Insights directly to your inbox.
Get free analytics tips and resources delivered directly to your inbox.