Google Analytics Opt Out (Block Tracking)
SakkTrakk (The Germanizah)—a small hakk to sakk the GA trakker
My colleague Christoffer Luthman at Mark Red has developed a small piece of code that makes it possible for website owners to offer a site-based opt-out function to visitors. It offers the possibility to block being tracked by Google Analytics on individual websites. The opt out does not work on a global level. A visitor has to opt out of being tracked by each website. The process for opting out is easy. There is simply a button to click on!
You may have seen the articles on sites like Econsultancy and TechCrunch about how Google Analytics may become banned in Germany. One of the reasons would be the lack of a possibility to opt out from being tracked without having to adjust cookie settings in the browser.
To offer a little bit of help to German website owners threatened with hefty fines we decided to make this little piece of code. It does not solve all of Google’s problems in Germany, but it’s one step in the right direction. I have written about the other points on my Swedish blog, but will leave that for now and simply focus on the opt out issue.
Download SakkTrakk now!
How does SakkTrakk work? Well, it places a cookie in the web browser for users who do not wish to be tracked. The setting in the cookie determines whether the Google Analytics tracker should be used or if the “mock object” gaOptOut.js should be used.
Implementation
Add “gaOptOut.js” within the head section of all pages:

Instead of using _getTracker(), use getOptOutTracker():

Caution: If the user deletes her cookies she’ll be tracked again until she activates SakkTrakk again. This script is provided “as is”, is free to use, and comes without any kind of warranty. Hey! it’s free, what did you expect?! You may alter the script to suit your needs. The script does currently not work if you use asynchronous tracking.
Post in German: Opt out für Google Analytics
PS. My apologies for the name of the product. My bad. I was simply inspired by the use of double k’s in German web analytics tool names.
You should also know that Mark Red is a big fan of Google Analytics, but we respect privacy.
Share on LinkedInPosted in Google Analytics, Web Analytics | 10 Comments »
Subscribe to RSS feed
Subscribe by email
December 15th, 2009 at 11:41 pm
[...] Uppdaterat 15 december: nu finns det en möjlighet till opt out på webbplatsnivå [...]
December 15th, 2009 at 11:42 pm
[...] Uppdaterat 15 december: Opt out för Google Analytics på webbplatsnivån. [...]
December 16th, 2009 at 1:50 pm
So, you use a persistent cookie to tell GA not to set a persistent cookie, right?
December 17th, 2009 at 10:26 am
[...] Analytics selbst bauen kann. Eine hat Marco Hassler vorgestellt und eine weitere habe ich bei Lars Johansson gefunden. Beide beruhen auf dem selben Prinzip. Man setzt einen Cookie in dem der Opt-Out-Status [...]
December 17th, 2009 at 12:39 pm
[...] Analytics selbst bauen kann. Eine hat Marco Hassler vorgestellt und eine weitere habe ich bei Lars Johansson gefunden. Beide beruhen auf dem selben Prinzip. Man setzt einen Cookie in dem der Opt-Out-Status [...]
December 17th, 2009 at 5:28 pm
[...] engelska: Google Analytics opt out Förslag på annan läsning:Certifierad i Google Analytics (GAIQ)15 tips för Google [...]
December 17th, 2009 at 10:48 pm
[...] Samtidigt kan jag påminna om att Mark Red tagit fram en möjlighet att erbjuda besökarna opt out från att bli mätt med Google Analytics. [...]
May 10th, 2010 at 12:06 am
[...] realistiska version: En webbplatsbaserad opt out för Google Analytics Förslag på annan läsning:Excellent Analytics v. 1.0.0.48 har nu släppts!Ny version av Excellent [...]
May 26th, 2010 at 10:46 am
[...] Funktion durch ein paar Tüftler (Marco Hassler an dieser Stelle und die Kollegen um Lars Johansson an jener) bereits programmiert, einsatzbereit und voll nutzbar war, dort allerdings über das [...]
May 28th, 2010 at 9:56 am
[...] föregår alternativa lösningar (som svensk Mark Red’s fullösning) genom att släppa en egen opt-out lösning som gör besökare osynliga för Google [...]