#GoogleAnalytics

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

Available for new projects • My FREE templatesWeb Design

Author: 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.

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 post has helped you out.

If you're interested in my web design services or free templates, want to collaborate, or just have something to say, feel free to shoot me a message.

About Radu

I've been working online from home for over 11 years, gaining valuable experience and developing a wide range of skills, including web design and development, optimization, and SEO.

More posts