UTM-parameters tell you exactly where your traffic is coming from. But some browsers (looking at you, Safari and Brave) and plugins (uBlock, we’re talking about you) love to strip them away, leaving your analytics in the dark.

Stape has come to the rescue with a smart and practical solution. They’ve published a detailed step-by-step guide that explains how to stop UTM parameters from being removed using Server-Side Google Tag Manager (sGTM). We’re sharing their approach here to help you implement it—and keep your data accurate.

What’s the problem?
Browsers and ad blockers often see UTM parameters as trackers (even though they don’t contain personal data) and remove them. This leads to unattributed traffic in Google Analytics and unreliable campaign metrics.

What’s the solution?
Workaround involves replacing your UTMs with custom parameters that browsers don’t recognize as trackers. Once the data is safely collected, these custom parameters are transformed back into UTMs on the server side.

Here’s the gist:
1. Create custom replacements for UTM parameters.
Example:
- utm_source → st_src
- utm_medium → st_mdm
- utm_campaign → st_cmp

2. Update your marketing platforms.
Replace standard UTMs with your custom parameters in tools like Google Ads.

3. Set up the transformation in sGTM.
- Install the Query Replacer template.
- Map your custom parameters back to UTMs in the sGTM container.
- Configure a transformation rule to apply this logic only to your analytics tags (e.g., GA4).

Test your setup in Preview mode, publish the changes, and enjoy reliable data again!

If you work with GA4 to BigQuery exports, be sure to check out my SQL cheat sheet.