A Band-Aid for Google’s Search Tracking

There are some appealing aspects of Google. Namely it actually finds what you’re searching for. Often with uncanny accuracy. On the other hand, it frequently lies to you about what it’s doing, redirecting and rewriting links on the fly. Which I’m not a fan of. I have been using my hosts file to block googleadservices.com, but this is sometimes a hassle as links don’t really work transparently anymore. As I already run a server on my machine I thought, why not do the redirect myself. Here’s what I came up with, I have no experience with javascript so I’m sure this could be better in more than one way, but it does seem to work.  Please leave a comment if you see an improvement.

<title>Google Pagead Redir Test</title>
var prmstr = window.location.search.substr(1);
var prmarr = prmstr.split ("&");
var params = {};

for ( var i = 0; i < prmarr.length; i++) {
    var tmparr = prmarr[i].split("=");
    params[tmparr[0]] = tmparr[1];
var target = params.adurl;
target = target.replace("%3F","?", "g");
target = target.replace("%3D","=", "g");
target = target.replace("%26","&", "g");
window.location = target;

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: