Link Untracker

Remove tracking elements from links

Från och med 2017-11-24. Se den senaste versionen.

You will need to install an extension such as Tampermonkey, Greasemonkey or Violentmonkey to install this script.

You will need to install an extension such as Tampermonkey or Violentmonkey to install this script.

You will need to install an extension such as Tampermonkey or Violentmonkey to install this script.

You will need to install an extension such as Tampermonkey or Userscripts to install this script.

You will need to install an extension such as Tampermonkey to install this script.

You will need to install a user script manager extension to install this script.

(I already have a user script manager, let me install it!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

(I already have a user style manager, let me install it!)

// ==UserScript==
// @name        Link Untracker
// @namespace   IzzySoft
// @description Remove tracking elements from links
// @license     CC BY-NC-SA
// @include     *
// @exclude     *phpmyadmin*
// @version     2
// @grant       unsafeWindow
// ==/UserScript==

var badp = ['utm_','referrer']; /* we strip parameters starting with that */
var anch = '';

for(var i = 0; i < document.links.length; i++) {
  var elem = document.links[i];
  if (elem.search == '') continue;
  var purl = new URLSearchParams(elem.search);
  for (let b of badp) { purl.delete(b); }
  if (elem.href.indexOf('#') > 0) anch = '#' + elem.href.split('#')[1];
  else anch = '';
  elem.href = elem.href.split('?')[0] + '?' + purl.toString() + anch;
}