
Browser extension that strips Google Analytics tokens from URL query strings - falcon620
https://github.com/jparise/chrome-utm-stripper
======
pastullo
Why do you need this? Is it because you are paranoid of being tracked?

UTMs offer a transparent, honest way of tracking where a user is coming from.
This is super important for any company that runs multiple channel marketing.

Making impossible for company to track their marketing effort doesn't protect
your privacy. It just makes it tougher for companies to manage their marketing
spending.

Marketing is not evil. It's how the world works. You need to market something
to be able to sell it.

I feel there is a paranoia about being tracked and privacy, where anything
that is somehow tracking, is evil and must be stopped.

UTMs parameters are absolutely harmless and stripping them away offer no
privacy benefit whatsoever.

~~~
taf2
This issue will get worse... As people choose to remove transparent forms of
tracking... utm parameters, cookies, etc... we find "better" ways that aren't
as obvious. Really it's a choice... we can have clear tracking or we can have
hidden tracking... blanket blocking is going to lead to a much harder to block
and aware form of tracking. As the saying goes... "be careful what you wish
for"

~~~
michaelmrose
Alternatively we could just regulate matters until the only way for them to
make money is to stand in front of a frier and make french fries.

Acting like this is a losing battle makes such a foregone conclusion.
Marketing is like 0.0001% of the population its ok for the rest of us to
disagree and regulate them to the degree required to ensure our continued
wellbeing even if this means regulating them virtually out of existence.

------
skytrue
Just going to pile on here and say that GA is pretty benign. I’m very anti-
tracking, but GA at least provides a minimally invasive way to verify whether
or not you are providing value to a specific audience.

It’s impossible to always create something perfect for the right audience.
It’s a lot of guess work. Without having at least a little data, it’s like
shooting in the dark.

~~~
falcon620
So, just to repeat my stance: Google already knows everything about me. I have
accepted that, sort of.

However, they have crossed a line: they have made URLs ugly by default.

~~~
nfoz
Google doesn't know everything about me. I don't use gmail, I don't use google
search, and I have an iPhone.

GA gives them basically all of my browsing habits. It's crazy.

------
Jerry2
There is also this extension that strips tracking parameters from all kinds of
trackers and not just from the Google one:

[https://github.com/newhouse/url-tracking-
stripper](https://github.com/newhouse/url-tracking-stripper)

[https://chrome.google.com/webstore/detail/url-tracking-
strip...](https://chrome.google.com/webstore/detail/url-tracking-
stripper/flnagcobkfofedknnnmofijmmkbgfamf)

~~~
skeletonjelly
Damn. Not for Firefox though. Can't find it at least.

Looks great otherwise!

~~~
Vinnl
Someone linked this elsewhere: [https://addons.mozilla.org/en-
US/firefox/addon/neat-url/](https://addons.mozilla.org/en-
US/firefox/addon/neat-url/)

------
f2n
I used to use something called UTM Mangler that would replace the referral
links with shock sites. I felt that was much better than simply removing them.

Here's the github, it looks like the chrome extension linked in the README is
no longer there: [https://github.com/huntwelch/UTM-
Mangler](https://github.com/huntwelch/UTM-Mangler)

~~~
portugee
I don't see how deliberately providing false data to organization is amusing
here. If you don't want your web sessions tracked that's fine, but there are
legitimate reasons for websites to want to understand user behavior. Some of
it is for digital marketing purposes but also for usability, for example, how
are folks getting to our documentation, is this prominent enough?

Seems a popular opinion that user tracking = bad but it's more nuanced than
that.

~~~
politician
Would it change your mind if the OP were doing it as a form of guerrilla
advertising for those sites?

~~~
portugee
No. It's still deliberately injecting misleading data.

~~~
colemickens
So what? Is "portugee" your real name? I have no obligation or contract that I
will "not modify URL parameters".

~~~
colemickens
Cool that no one responded and I just got downvoted. Let me just say I openly
laugh at anyone that thinks I have some implicit responsiblity or obligation
to not modify the URL of a website I'm visiting. Actual laughter that someone
would get indignant about that.

edit: And somehow this is auto-downvoted within 30 seconds? This website is so
fantastic!

------
nwj
For those on Firefox, NeatURL[1] does this too.

[1] [https://addons.mozilla.org/en-US/firefox/addon/neat-
url/](https://addons.mozilla.org/en-US/firefox/addon/neat-url/)

~~~
laumars
The linked repo does Firefox as well. Not sure why the HN title[1] is Chrome
specific because that's not the title on GitHub. But it's still a handy
submission regardless.

[1] At time of writing, "chrome-utm-stripper: Chrome extension to strip Google
Analytics data from URLs"

~~~
kevlar1818
It looks like Neat URL might block more than UTM tags:

[https://github.com/Smile4ever/firefoxaddons/tree/master/Neat...](https://github.com/Smile4ever/firefoxaddons/tree/master/Neat%20URL-
webext)

------
lmkg
This extension is only mildly useful. The UTM parameters are generally pretty
coarse-grained. They don't add information that comes close to individually
identifying users. Especially compared to the rest of what Google Analytics
tracks by default, the additional data from UTM parameters is very small.

Your privacy is much more impacted by the GCLID and DCLID query parameters,
which are added by AdWords and DoubleClick campaigns respectively. This are
auto-generated by their respective tools and are much more granular.

~~~
ianhawes
IIRC GCLID and DCLID parameters can't be queried except by Google Analytics.

------
guessmyname
I created another extension with the same functionality [1] but also added
functions to fix other type of links, Amazon product pages [2] for example.
Unfortunately, I moved to Safari and have had no time to port the code. If
anyone is interested, feel free to fork and improve it [3] — _(the main
purpose of the extension is to mark links as read though)_.

[1]
[https://github.com/cixtor/markasread/blob/master/markasread....](https://github.com/cixtor/markasread/blob/master/markasread.js#L23-L41)

[2]
[https://github.com/cixtor/markasread/blob/master/markasread....](https://github.com/cixtor/markasread/blob/master/markasread.js#L43-L62)

[3]
[https://github.com/cixtor/markasread](https://github.com/cixtor/markasread)

------
jpz
Is it safe to use any of these Chrome extensions? I get quite paranoid about
them these days.

~~~
koolba
In the end comes down to whether you trust the developer, not the current
code, as an "evil" update could come down the line. Heck the developer could
even sell the extension and let someone else be evil...

------
jagthebeetle
Unfortunately, or not, GA makes it very easy to work around this. By default,
it will do its UTM parsing serverside these days based on the page URL the
webmaster sends to it.

So all I have to do as a webmaster is start using
`?aaa_source=foo&aaa_medium=bob`

Then I do `ga(‘send’, ‘pageview’, location.pathname.replace(/aaa/g, ‘utm’)`

A more robust implementation would have to modify the web request to GA
itself, assuming the goal is to destroy that data.

EDIT: Upon looking at the actual implementation
(`chrome.webRequest.onBeforeRequest`), the points above should be addressable:
the key is to strip out potentially URL-encoded utm values in the requets sent
to GA [1], which may be either in the query string or the (beacon) POST
payload shipped to google-analytics.com).

i.e. `google-analytics.com/collect?v=1&dp={url-encoded-path-with-utm-values}`
should be purged as well.

[1]:
[https://developers.google.com/analytics/devguides/collection...](https://developers.google.com/analytics/devguides/collection/protocol/v1/parameters#content)

------
BerislavLopac
This is the bookmarklet I've been using for the same purpose:

    
    
        javascript:window.location=window.location.href.replace(/\?([^#]*)/,function(_,s){s=s.split('&').filter(function(v){return(!/^utm_/.test(v))}).join('&');return(s?'?'+s:'')});

------
CapacitorSet
A Mozilla extension that covers utm_ and more:
[https://github.com/idlewan/link_cleaner](https://github.com/idlewan/link_cleaner)

------
neovive
Out of curiosity, do utm tags still offer much value beyond standard Google
Analytics? I remember them being popular back in the pre-GA (Urchin) days.
Since GA already tracks referrals coming from email, social media, web,
mobile, etc.; perhaps the major benefit is tracking a specific campaign that
is already a few steps removed from the initial referral.

~~~
cosmie
There are a lot of use cases where they're still quite valuable.

\- Social sites tend to redirect outbound links to sanitize referral
information. So you can get a bunch of traffic from Facebook, and have no idea
if it's people viewing your page, going through their news feed, postings in
Groups, etc. All of your Facebook traffic will have a referral of
(l|lm|m|business|mobile|web).facebook.com/(l.php)? [1]

\- Unless someone is using a web client, any clicks from email will show up as
direct traffic, just as if someone typed the url in their browser directly. So
you can't evaluate email performance in GA without dedicated utm parameters.

\- The Source field in GA defaults to the referrer, but is overridden by any
explicitly provided utm_source data. If you capture the true referral
information separately (i.e. put the value of document.referrer into a custom
dimension), you can compare the two and glean all kinds of nifty info like
traffic from Site B and Site C resulted from a link on Site A.[2]

\- The concerted effort to upgrade sites from http -> https has led to
increase in traffic marked as direct that's not direct, because of referral
header stripping. Note that it's not inherently an issue with https itself,
but with the fact that not everyone is using https yet, combined with the
cumulative number of pre-existing http links.[3]

There are plenty more, but those are some of the bigger things I can think of
off the top of my head where standard GA falls short and having utm-tagged
links are beneficial.

[1] Yes, I'm aware that this regex is lacking escape characters. But having
them reduced readability.

[2] If someone takes a utm tagged link from Facebook and shares it on Twitter,
by default it'll look like it came from Facebook in GA. Unless you're
capturing the document.referrer value manually in a custom dimension, you
wouldn't be able to suss out that this was happening and would never know that
they're actually coming from Twitter _based on a link you shared on Facebook_.
Or even that they're coming from Twitter at all.

[3] [https://developer.mozilla.org/en-
US/docs/Web/HTTP/Headers/Re...](https://developer.mozilla.org/en-
US/docs/Web/HTTP/Headers/Referrer-Policy)

------
lzbrc
Seems like the extension is no longer supported (1 year) also it seems it
doesn't work for https.

So, not sure what actually works.

------
jwineinger
What are the chances google blacklists the extension? Seems like something
outside the browser would be more reliable.

------
ddtaylor
Google has a history of policing their extensions to favor themselves, example
being YouTube downloading extensions.

~~~
adamnemecek
If you build it from source they'll have a hard time stopping you.

~~~
ddtaylor
They can kill usability, like for this the benefit is being is to install and
use.

------
trustfundbaby
pinboard does this by default when you save a link and its awesome.

------
Dig1t
Does this do something that Ghostery does not?

------
falcon620
I am not the author. I was just so tired of having to manually strip crap like
"?utm_term=.b1e20fe33a88" from the end of URLs before sharing them. This
extension solves that problem nicely.

I wonder why Google doesn't build something into Chrome that just hides this
crap from the visible URL? I guess they could get some PR pushback from
paranoids if they did that though. Better to just hide behind some fictitious
UTM Inc.

~~~
Ajedi32
I think the share UI in Chrome mobile already strips that data, provided the
site you're on defines a canonical URL in a link tag.

~~~
amelius
I want my browser to strip UTM from links when I follow them, not just when I
share them.

~~~
madeofpalk
Why? Just install a blocker extension to stop all of these analytics and
tracking solutions, rather than fairly benign UTM tags.

~~~
MightySCollins
The site you visit can still use that information with an ad blocker.

------
Exuma
This will ruin a lot of legitimate uses that's not paranoia-induced security
protection... I would recommend not using that and simply using uBlock Origin,
so people can still read where their users are coming from on their campaigns.

~~~
sincerely
What if I, the user, don't want the website I'm visiting to know where I'm
coming from? Why does a website deserve to know what _other_ website I was on
before??

~~~
Exuma
See my other answers

------
unbeli
Installing this extension basically means trusting a random dude (the author)
with _all_ the data passing through the browser just to screw over some random
people trying to get coarse-grained stats on where people come to their
websites from. Sounds like a rather idiotic idea, but I'm sure even this will
have its users.

~~~
zulln
In general I would agree, but the source code is so short here that you would
be able to glance through it first to confirm nothing sketchy is going on
there: [https://github.com/jparise/chrome-utm-
stripper/blob/master/b...](https://github.com/jparise/chrome-utm-
stripper/blob/master/background.js)

~~~
always_good
Are you going to notice and reinspect every invisible OTA update?

It's a perfectly valid concern when you install a plugin. We just don't care
because most people are trustworthy.

But for example there's a market for selling your browser addon to someone
that wants to do this.

~~~
RIMR
You're basically arguing that open source isn't really open because you don't
have the time to inspect every commit...

If you build this from source, you'll have proof of any malice by the
developer.

------
MightySCollins
Please don't remove these tags. Our system needs them to tie up your orders to
where you came from and your personal information. Which we can use to analyse
and ensure we spend more money on targeting people like you.

