Google Analytics IP Masking (UserJS)

The Google Analytics-API provides a new feature, that allows a webmaster to instruct the Google Analytics tracker (that is constructed by of a tiny piece of Javascript code embedded in the web page's markup) not to store the last 8 bits of the IP address of you, the visitor.

This UserScript checks each inline script embedded in a web page, whether a Google Analytics Tracker is constructed therein. If that is the case, it surgically 😉 inserts an Analytics-API call to the _anonymizeIp() function, thus requesting the masquerade of the IP.

New: As an experimental feature you can also enable the handling of asynchronous trackers. A call to _anonymizeIp() is pushed into the _gaq command queue in these cases.

You may consider it one step in direction of an alternative to the Google Analytics Opt-Out Addons available for other major browsers. …

Installation

Copy the attached file into your ”User JavaScript folder“ (you can get this information from the opera:about page or set it up in ”Preference»Advanced»Content::Javascript Options»User JavaScript folder“).

Configuration

You may turn on or off features or set options in the config section of the script. This section is located between [user configuration] / [/user configuration] markers.

Notes

This script has not been extensively tested yet! (I use to block analytics via Opera's urlfilter feature, anyways.) 😉

Download

»» all-googleanalytics-maskip-xa.js


Changelog

Version 1.11 [2010-06-01]

  • Support being managed by ”UJS Manager“ Opera-Unite App.

Version 1.10 [2010-06-01]

  • Experimental asynchronous tracker (_gaq) support implemented. Turn feature on setting featureGAQmaskip to true in config section.

Version 1.00 [2010-05-26]

  • Initial version.

4 Replies to “Google Analytics IP Masking (UserJS)”

  1. May be you can make the user settings UJS-Manager ready. That would allow the user to switch between the values without the need to search for the script on his HDD to open it with an external editor :)See ujs_configuration.html for more info.

  2. I implemented an experimental handling of asynchronous trackers. It pushes a function calling _anonymizeIp() on _gat into the _gaq queue each first time (per script) a queue-push is discovered.This feature has to be enabled editing the script! And I’m not yet sure, if that works (althoug I have some indication it does) – even more unsure, if older API versions choke it.

Leave a Reply

Your email address will not be published. Required fields are marked *