Articles index

Stop Google Search Results Tracking

January 17, 2019

By Jeff Johnson (Developer of StopTheMadness and Underpass)

Have you ever heard of The Old Switcheroo? Google pulls that magic trick when you click on a search result link. Below is what it looks like when you hover over a search result link in Safari with the ⌘ key pressed just before you click to open in a new tab. Pay particular attention to the status bar at the bottom:

Google Search before click

And here's what it looks like when you hover over the same link just after you ⌘-clicked:

Google Search after click

Whoa, what happened?!? Whole stole my link?

That was a rhetorical question, because we know who stole the link. Their name is written all over it, so to speak. Let's look at the HTML source before the click:

<a href="https://underpassapp.com/StopTheMadness/" 
onmousedown="return rwt(this,'','','','2','AOvVaw1Md3Oo0YwwUAVuZw24Ip9c',
'','2ahUKEwigzMnwgNXfAhUK_4MKHXTjA1AQFjABegQICBAB','','',event)">
<h3 class="LC20lb">StopTheMadness - Underpass</h3><br>
<div style="display:inline-block" class="TbwUpd">
<cite class="iUh30">https://underpassapp.com/StopTheMadness/</cite>
</div>
</a>

Notice the onmousedown attribute of the link. Here's the HTML after the click:

<a href="/url?sa=t&amp;rct=j&amp;q=&amp;esrc=s&amp;source=web&amp;cd=2
&amp;ved=2ahUKEwimsqKlh9zfAhUSiIMKHek3A8sQFjABegQICBAB
&amp;url=https%3A%2F%2Funderpassapp.com%2FStopTheMadness%2F
&amp;usg=AOvVaw1Md3Oo0YwwUAVuZw24Ip9c" 
onmousedown="return rwt(this,'','','','2','AOvVaw1Md3Oo0YwwUAVuZw24Ip9c',
'','2ahUKEwimsqKlh9zfAhUSiIMKHek3A8sQFjABegQICBAB','','',event)" 
data-ctbtn="0" 
data-cthref="/url?sa=t&amp;rct=j&amp;q=&amp;esrc=s&amp;source=web&amp;cd=2
&amp;ved=2ahUKEwimsqKlh9zfAhUSiIMKHek3A8sQFjABegQICBAB
&amp;url=https%3A%2F%2Funderpassapp.com%2FStopTheMadness%2F
&amp;usg=AOvVaw1Md3Oo0YwwUAVuZw24Ip9c">
<h3 class="LC20lb">StopTheMadness - Underpass</h3><br>
<div style="display:inline-block" class="TbwUpd">
<cite class="iUh30">https://underpassapp.com/StopTheMadness/</cite>
</div>
</a>

When you click on the link, the onmousedown action runs some JavaScript that swaps the original URL with a new tracking URL. Google does this as you click, right under your nose. Or finger.

That was the bad news. The good news is that you can stop this madness. You just need to install my extension StopTheMadness. By default, StopTheMadness has ⌘-Click and Drag and Drop protections enabled. A side effect of these protections is that you're also protected from link hijacking. Why? Clicking on a link in a browser is preceded and triggered by mousedown and mouseup events. Thus, if a web site could hijack these events, it could prevent the link click from working as expected. This is why StopTheMadness prevents mousedown and mouseup events from getting hijacked when you ⌘-click on a link. But what about clicks without the ⌘ key? StopTheMadness prevents mousedown from getting hijacked whenever you click on a link, even without the ⌘ key, because dragging a link in a browser is preceded and triggered by a mousedown event. For full protection against link hijacking, then, you need both ⌘-Click and Drag and Drop protections enabled (as they both are by default). When I was writing my extension, I wasn't thinking about stopping Google search result tracking — I wasn't even aware of how it happened — but as a happy coincidence, my extension does in fact stop this.

Link hijacking is merely one of countless forms of "madness" that web sites inflict on users. I couldn't possibly illustrate them all. However, for your enlightenment and "enjoyment" I've created a StopTheMadness Test page that shows some of the terrible power a web site has over your browsing experience. If you visit the page with StopTheMadness installed and enabled, everything seems fine. I invite you to visit the page without StopTheMadness, just to see how the extension protects you. Go mad!

After you've experienced unmitigated madness, you'll probably want to stop it forever. Fortunately, StopTheMadness is available for Safari, Firefox, and even Google Chrome. So you could use Google Chrome to defeat tracking from Google Search! Delicious irony, yum.

Articles index