I'm using Wordpress and on my site I have link to my subdomain. When I click the link it adds query parameter _gl
. I don't want it. I want my link to look clean.
How to turn it off?
When I click link it looks like:
https://mysubdomain.mydomain.org/?_gl=1*...*_ga*...*_ga_....*....
where ...
are some random changing code.
So I figured out. _gl
parameter was added because of Google Analytics 4
. And in my Wordpress it was enabled by plugin Site Kit
by Google.
Site Kit
plugin.
Clear Post Cache
in your Wordpress wp-admin
console. Just cos I did't I spent another hour figuring why it didn't disappeared cos probably bloody CDN remembered scripts...Anyway this means your Google Analytics will not work at all on your site. Which might not be an ideal solution.
better solution I found out I can keep Site Kit
enabled and just add following Javascript code:
window.addEventListener("load", function() {
if (window.google_tag_data && indow.google_tag_data.gl.decorators){
window.google_tag_data.gl.decorators = [];
}
});
(Again don't forget to Celar Post Cache
.)
You can add javascript easily for example using plugin Simple Custom CSS and JS
By SilkyPress.com.
I did set javascript to be added in <footer>
.
Now what you lost by removing this _gl
parameter? You lost cross-domain analytics. Meaning if one person comes from your domain to your subdomain he will be counted twice... Boo hoo. I don't care... Although I understand it's cool feature, not worthy for me to have ugly URL...
Also I would be happy if someone would figure out how to turn _gl
query parameter off directly in Google Analytics 4
settings (https://analytics.google.com/)...
I already tried in Admin->Data Streams->click your data stream->Configure tag settings
:
Configure your domains
. I removed all my domains from there or then later also tried add all of them them and nothing worked...Show More->List unwanted referrals
and I filled all my domains and subdomains and didn't help either.And note somewhere I saw people were guiding how to remove it from reporting. That is useless for me I want to remove it from my URL link so link looks nice...