How to Remove utm_source & Other Parameters From Your URLs

Cat cleaning its mouth with her tongue.

Have you noticed some unwanted crap being added to website addresses?

Yes, I’m talking about utm_source crap and similar website address pollution!

utm_source crap is usually merely annoying and distracting but it can even break websites.

Yet most of the time the tracking aspects may creep you out due to privacy concerns.

Here are some solutions and explanations how to get rid of unwanted parameters.

How to add gay porn to any site

These days there is a quite common and very annoying habit!

Many services attach utm_source and other so called parameters to your Internet address aka URL.

It’s not only that. The issue is even broader and may be more embarrassing!

Basically anybody can add anything as a parameter to your website address!

Strangers can make it appear as if it’s part of your blog or site.

Outrageous isn’t it? Just try adding

  • “?content=gay,porn”
  • “?utm_source=ISIS”
  • “?you-suck”

to any of your website addresses or links to other sites!

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 cause a lot of harm 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 links 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 to website links in the first place.

It backfires even for marketing purposes in manifold ways!

When I click a link on Facebook which is tagged it gets wrongly counted as stemming from Twitter and not Facebook.

It is still tagged as even though you shared it and someone visited it on Facebook.

Just because the first share happened on X/Twitter does not mean that Facebook it got shared on later should get no credit.

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 may 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.

That’s not enough to remove all other unwanted parameters from your address though.

Thus I wrote this tiny script in JavaScript you can add to your WordPress blog anywhere in the header:

How to remove all unwanted parameters from your site?

This is the actual script I used for years on my blog here.

Then I had to delete 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.

Delete 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 SEO experts found thousands of links from my blog on their link profile using advanced tools.

Thus you can safely use the basic script below on your blog or site.

I still use this script successfully on my custom built static website.

<script language="JavaScript" type="text/javascript">

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);

I know it’s quite redundant and not very elegant but my JavaScript skills haven’t been used much in the last decade so you are welcome to customize it.

The script basically checks where the parameter starts and removes everything from the URL including the question mark “?”

This 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.

When you added the script to your site already a link like this one should get redirected:

to the clean address instead.

You can actually still try it on my main website:

Are there better solutions by now?

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.

Fix utm_source crap in your browser

ClearURLs extension that is available for all major browsers

What happens when the utm_source crap appears on other people’s websites?

There is good news! You can also strip the tracking parameters right in your browser!

How? Simply by 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.

Make sure to clean your addresses for everybody not just yourself.