#GoogleAnalytics

Google Analytics Adds Parameters to Links When Consent Mode Is Set Up Wrong

by Radu

I decided to add Google Analytics to this blog, but it wasn’t without issues. After getting the “Missing Permissions” error when trying to access my account, I faced another problem where I noticed parameters added to every link on my blog.

After excluding Cross-domain Linking Configuration and Enhanced Measurement, I found out what was causing the issue.

Why Does Google Analytics Behave Like This When Using Consent Mode

Normally, when you set up Google Consent Mode, everything except Necessary cookies should be set to “Denied” to comply with whatever laws are in place.

The problem is that if Consent Mode is set to “Denied”, Google Analytics will add parameters to your links. But this shouldn’t happen in the first place because if you block cookies correctly, preventing them from firing before consent, the Google Tags won’t load at all, therefore no parameters will show in your URLs.

Here are a couple of explanations that I found on Reddit:

Explanation 1

It can happen if ad_storage and analytics_storage cookie consents are set to denied. It allow passing ID parameters through URL without storing them in cookies.

Explanation 2

If you properly block ga/gtag tags from firing based on user consent, the ga/gtag library won’t load at all on the pages. Therefore, no garbage in your urls.

How to Prevent Google Analytics from Adding Parameters in URLs

What you need to do in this case is to properly block Google Analytics cookies from firing before user consent.

Mine were firing because I had enabled “Allow Google tags to fire before consent” in my Consent Management Platform – Cookieyes.

Once I disabled that and the cookies were properly blocked, the parameters in the links stopped showing.

That’s a Wrap

I hope this guide helped you understand why Google Analytics adds parameters to links in this case, and how to prevent that from happening.

If some info is outdated or incorrect, or you have anything to add, say or ask, please contact me via Twitter or email.

Looking for a modern & optimized presentation website?

Hire me on Fiverr

About Radu

I've been working online, from home, for over 11 years, and I learned a lot of different things related to websites. My main expertise is WordPress, but for some time, I also started focusing on web development.