Outbrain is a service that provides related content links to publishers. It is used by some news sites I frequent and recently I’ve been annoyed by its tracking behavior. When you hover with your cursor above the link it seems like a regular benign link but once you click on the link, it changes to an evil tracking URL. To add to the annoyance, it is not always easy to distinguish Outbrain “ads” from legitimate links on first sight.
To end this annoyance for me, I’ve written a little Greasemonkey script. It currently setup to work for Haaretz, Ynet, Calcalist and TheMarker but it should work fine for any site using Outbrain if enabled.
Download: outbrained.user.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==UserScript== | |
// @name Outbrained | |
// @namespace http://www.guyrutenberg.com | |
// @description Removes annoying tracking outbrain links. | |
// @include http://www.haaretz.co.il/* | |
// @include http://www.ynet.co.il/* | |
// @include http://www.calcalist.co.il/* | |
// @include http://www.themarker.com/* | |
// @version 1.0 | |
// @grant none | |
// ==/UserScript== | |
// Change Log | |
// ========== | |
// 1.0: 2014-08-01 | |
// * Initial release. | |
function isOutbrainLink(element) { | |
var onmousedown_attr = element.getAttribute('onmousedown'); | |
return /^this\.href='http:\/\/[^.]+\.outbrain\.com/.test(onmousedown_attr); | |
} | |
function fixLink(element, index, array) { | |
element.removeAttribute('onmousedown'); | |
element.removeAttribute('onclick'); | |
} | |
var all_links = document.getElementsByTagName('a'); | |
for (var i = 0; i < all_links.length; i++) { | |
var link = all_links[i]; | |
if (!isOutbrainLink(link)) | |
continue; | |
fixLink(link); | |
} |
Thank you!! This works on cnn.com too. No more going through Outbrain just to get to a page on CNN’s website!
Uhoh, I spoke too soon. I accidentally tested it on links in the wrong section. The Tech section still has the Outbrain switcheroo going on. I do have it running on cnn.com with an @include. Any ideas? :-/ Thanks!