How to Block Reddit from tracking outbound links

Reddit announced a week ago that it decided to start tracking outbound links on the site which effectively means that they know on which outbound links Reddit users clicked.

According to Reddit, doing so will open up new possibilities for the site, for instance to better combat spam or better stats such as clicks to votes.

Reddit tracks what each individual user clicks on but does not share the data with third-parties.

You can verify the tracking using the Developer Tools of your web browser. While on Reddit hit F12 to open the developer tools, and use the inspector tool to select an outbound link on the Reddit page you are own.

You should see the attributes data-href-url and data-outbound-url associated with the link.

Block outbound tracking on Reddit

reddit outbound links tracking

The attributes have the following values:

  • data-href-url is the direct target url.
  • data-outbound-url is the tracking link that is activated when you click on the outbound link. Reddit records the click and redirects your request to the data-href-url URL afterwards.

If you don’t want to be tracked on Reddit, you have two options to deal with the issue. First, instead of left or middle-clicking on a link, right-click on it and select to copy it instead. Open a new browser tab and load the link this way.

While this may work for light use, it is not overly comfortable if you open links regularly on the site.

A Reddit user has created a userscript that you can add to your browser instead. Chrome users need to install Tampermonkey and Firefox users Greasemonkey first before they can make use of it.

Here is the script:

// ==UserScript==
// @name Don’t track my clicks, reddit
// @namespace
// @author OperaSona
// @match *://**
// @grant none
// ==/UserScript==

var a_col = document.getElementsByTagName(‘a’);
var a, actual_fucking_url;
for(var i = 0; i < a_col.length; i++) {
a = a_col[i];
actual_fucking_url = a.getAttribute(‘data-href-url’);
if(actual_fucking_url) a.setAttribute(‘data-outbound-url’, actual_fucking_url);

Adding it to Tampermonkey

To add the Reddit click tracking blocking script using Tampermonkey, do the following:

  1. Click on the Tampermonkey icon in the browser’s address bar and select “add a new script” from the selection menu.
  2. Copy and paste the script listed above into the editor. Make sure you replace all information that Tampermonkey adds on its own in the process.
  3. Click on the save button at the top.

Adding it to Greasemonkey

Greasemonkey is supported as well. To add the script to the extension, do the following:

  1. Click on the down arrow icon next to the Greasemonkey button in the browser and select New User Script.
  2. Fill out the name only and click on okay. This opens the main editor where you paste the full userscript in.
  3. Click on the save button in the end.

The result is the same: The data tracking attribute is replaced by the original link so that Reddit cannot track the click anymore.

reddit no tracking

It is unclear right now whether Reddit will implement an option to opt-out of the outbound link tracking on the site in the future. It seems likely however that third-party extensions such as RES will add the functionality eventually.

Redazione Autore