Get Rid of the URL Pollution

You want to copy the URL of a nice article/video/picture you’ve just opened and send it to friends in skype chats, whatsapp, other messengers or social networks. And you realize the URL looks like this:

What are these parameters that pollute the URL? The above example uses some of the Google Analytics parameters (utm*), but other analytics tools use the same approach. And probably other tools as well. How are these parameters useful? They tell Google Analytics (which is run with javascript) details about the current campaign, probably where the user is coming from, and other stuff I and especially users don’t really care about.

And that’s ugly. I myself always delete the meaningless parts of the URL, so that in the end people see only “”. But that’s me – a software engineer, who can distinguish the useless parts of the URL. Not many people can, and even fewer are bothered to cut parts of the URL, which results in looong and ugly URLs being pasted around. Why is that bad?

  • website owners have put effort in making their URLs pretty/ With “url pollution” that efforts goes to waste.
  • defeating the purpose of the parameters – when you copy-paste such a url, all the people that open it may be counted as, for example, coming from a specific AdWords campagin. Or from a source that’s actually wrong (because they got the URL in skype, for example, but utm_source is ‘facebook’)
  • lower likelihood of clicking on a hairy url with meaningless stuff in it (at least I find myself more hesitant)

If you have a website, what can you do about this URL pollution, without breaking your analytics tool? You can get rid of them with javascript:

    window.history.replaceState(null, null, 
        window.location.href.replace("utm_source=....", ""));

This won’t trigger fake analytics results (for GA, at least, as it requires manual work to trigger it after pushState). Now there are three questions: how to get the exact parameters, when to run the above code, and is it worth it?

You can get all parameters (as shown here) and then either remove some blacklisted ones (utm_source, utm_campagin, etc.), or remove all, unless your whitelisted parameters. If your application isn’t using GET parameters at all, that’s easy. If it is, then keeping the whitelist in sync would be tedious, so probably go for the blacklist.

When should you do that? A little after the page loads, and the analytics tool does its job. When exactly is that – I don’t know. Maybe on window.load, maybe you have to wait for a second and then remove the parameters. You’d have to experiment.

And is it worth it? I think yes. Less useless parameters, less noise, nicer, friendlier URLs (that’s why you spent time prettifying them, right?), and less incorrect analytics results due to copy-pasted long URLs.

And I have a request to Google and all other providers of similar tools – please cleanup your “mess” after you read it, so that we don’t have to do it ourselves.

22 thoughts on “Get Rid of the URL Pollution”

  1. 😉 I’m not necessarily a fan of having the title in the URL, it was just an example (it’s a configuration switch in wordpress, I think; I’ll consider it 🙂 )

  2. Is it possible to change the color of the bad parts of the URL and leave the good parts of the URL in visible color. I think this is best solution, but not all browser have API to change URL color. It require combinatorial colaboration between browser factory at Msoft and Googles.

  3. Thanks for every other informative web site. The place else
    may I am getting that type of information written in such an ideal approach?

    I’ve a undertaking that I’m simply now working on, and I’ve been on the look out for such

    Feel free to surf to my web site – Online blogs

  4. This isn’t to say that if you’re youthful than 21, you will not
    find an insurance coverage – because you can –
    but will probably be more expensive and tough.

    Feel free to visit my web-site wifehoods (

  5. You’ll be able to simply realize some nice deals on the online, and benefit of them Still, watch out that
    you simply area unit creating the correct call before finalizing.
    This can mean they will have to travel capital t fulfill ankle rehab ebook or even use meeting amenities to keep conferences as well as symposiums.
    In most cases the earlier you book your room the less expensive it will be, and the better your
    chances of getting the room and location that you want.

  6. I’m amazed, I must say. Rarely do I encounter a blog that’s both equally educative and entertaining, and
    without a doubt, you have hit the nail on the head.
    The problem is something which not enolugh men and women are speakin intelligently about.
    I am very happy I found this during my hunt for something concerning this.

  7. When I originally commented I clicked the “Notify me when new comments are added”
    checkbox and now each time a comment is added I get four emails wjth the same
    comment. Is there any way you can remove peeople from that service?

  8. Today, while I was at work, my cousin stole
    my iphone and tested to see if it can survive a thirty
    foot drop, just so she can be a youtube sensation. My apple ipad is now broken and she has 83 views.
    I know this is entirely off topic but I had to share it with

  9. Pingback: atomic blonde cda

Leave a Reply

Your email address will not be published.