How to Remove utm_source & Other Parameters From Your URLs
How to Add Gay Porn to Any Site
These days it’s a quite common and very annoying habit by a few services to attach utm_source and other so called parameters to your Internet address aka URL. It’s not only that.
Basically anybody can add anything as a parameter to your website address
and make it appear as if it’s part of your blog or site. Outrageous isn’t it? Just try adding
to any of your website addresses or other sites’ URLs. Most sites accept that without even showing an error “not found”.
In case you link such an address Google will even index it.
This way you can make Google show up fake pages that do not even exist on other people’s websites.
Unwanted parameters can break a lot of things on your site. You get unlimited duplicate content this way. Everybody can meddle with your address using parameters.
People share the wrong (polluted) links. Thus you lose juice on social media. Links can even break because of the added parameters. In the best case they are just confusing.
Who Adds utm_source to Your URLs and Why?
utm_source is added by multiple services in order to track website visitors on Google Analytics. You get misleading numbers on Google Analytics that way though. That’s why
I do not recommend adding such parameters in the first place.
When I click a link on Facebook which is tagged utm_source=Twitter.com it gets wrongly counted as stemming from Twitter and not Facebook. It is still tagged as Twitter.com even though you shared it and someone visited it on Facebook.
Also public social media counts often do not add up anymore. An address with added parameters will get counted as different and separate than the original link. Websites lose out on social proof that way.
You can prevent Buffer and other social media automation and tracking tools from adding the utm_source crap.
How to Remove all Unwanted Parameters?
This is the actual script I used for years on my blog here. Then I had to remove the script from my site as it seems WordPress 3.6+ redirection interferes with it. I’m not even sure. Nobody could help me explain that.
This way spammers who bombarded my blog with requests created countless invisible additional pages. Remove yours too in case you use WordPress and the same issue appears.
For most people the “additional pages” problem will stay invisible though even if it happens. I only discovered it because Google optimization experts found thousands of links from my blog on their link profile using advanced tools. Thus you can safely use this basic script on your blog or site.
I still use this script successfully on my custom built statics website.
var url = self.location.href;
var p = url.indexOf("?");
var str = url;
var parameter = str.slice(p);
if (p >= 1 && parameter.indexOf("p") != 1 && parameter.indexOf("s") != 1)
url = str.slice(0,p);
The script basically checks where the parameter starts and removes everything from the URL including the question mark “?”
which signifies the start of the parameters. It then redirects visitors on the client-side to the accurate URL without parameter crap in the address.
In the end people end up on the actual address they should end up from the start. Don’t let someone else prevent them from reaching their destination by polluting the URL with parameter spam.
The only acceptable parameters are the “p” so that you can still use the post preview function in your WordPress and “s” for the search function.
Are There Better Solutions by Now?
When you added the script to your site already a link like this one should get redirected: http://example.com/?you-suck
to the clean address instead.
You can actually still try it on my main website: http://onreact.com/?you-suck
Also take note that I have elaborated on the topic of utm_source crap in a more recent post.
There I link to two more sophisticated solutions. I used both of them, one locally on my Firefox browser and another on this blog here.
They aren’t perfect either though. They just remove utm_source crap but not all other types of polluting parameters. That way the gay pron would still show up in your address.
There is good news though. You can also strip the tracking parameters right in your browser using the ClearURLs extension that is available for all major browsers including
I have used it successfully for a while on my Firefox.
There is one pet-peeve though. In case you’re into affiliate marketing those sites may stop working. Some other sites may not work properly anymore either.
When you solely remove the tracking parameters in your browser other people will still see them on your site. Also the ?you-suck example is not a tracking parameter and thus it won’t get blocked at all. Ensure to clean your addresses for everybody not just yourself.