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:
http://somesite.com/artices/title-of-the-article?utm_campagin=fsafser454fasfdsaffffas&utm_bullshit=543fasdfafd534254543&somethingelse=uselessstuffffsafafafad&utm_source=foobar
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 “http://somesite.com/artices/title-of-the-article”. 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.
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:
http://somesite.com/artices/title-of-the-article?utm_campagin=fsafser454fasfdsaffffas&utm_bullshit=543fasdfafd534254543&somethingelse=uselessstuffffsafafafad&utm_source=foobar
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 “http://somesite.com/artices/title-of-the-article”. 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.
Use replaceState instead of pushState, otherwise you’ll break the Back button!
Thanks, fixed
Thanks for the tip! Although I am too lazy to clean up the URLs I usually send over Skype, this is a good way to keep my analytics correct.
I’ve said this before 🙂 But your own blog uses:
http://techblog.bozho.net/?p=1497
Why not add category / title into your own URLs?
😉 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 🙂 )
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.
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
info.
Feel free to surf to my web site – Online blogs
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 (xinyujc.com)
Thanks , I have just been looking for info about this topic
for a long time and yours is the best I have found out till now.
But, what about the conclusion? Are you certain concerning the source?
Awesome post.
My site … Redriverrounders.org
Useful info. Lucky me I discovered your
website accidentally, and I am stunned why this coincidence
did not happened earlier! I bookmarked it.
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.
Good post! We are linking to this great content on our site.
Keep up the good writing.
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.
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?
Thanks!
It’s actually a nice and helpful piece of info.
I’m satisfied that you just shared this helpful info with
us. Please keep us up to date like this. Thank you for sharing.
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
someone!
That is a good tip especially to those new to the blogosphere.
Simple but very precise info… Thanks for sharing this one.
A must read post!
What a stuff of un-ambiguity and preserveness of precious familiarity concerning unexpected feelings.
Cool blog! Is your theme custom made or did you download it from somewhere?
A theme like yours with a few simple tweeks would really make my blog shine.
Please let me know where you got your theme. Kudos
I faced the problem of link pollution and sorted out the malware sites using wireshark. Here is the details
https://lifeinbracket.wordpress.com/2018/02/08/polluted-link-and-phishing-my-interception-with-malware/