public
Created

Greasemonkey script to change every utm_source link attribute value to 'Your mom'

  • Download Gist
yourmom.js
JavaScript
1 2 3 4 5 6 7 8 9 10 11
// ==UserScript==
// @name Referral: your mom
// @namespace yourmom
// @description This script changes every utm_source variable in links to 'Your mom'.
// @include *
// ==/UserScript==
 
var links = document.getElementsByTagName('a');
for(var i=0; i<links.length; i++) {
links[i].href = links[i].href.replace(/([&|?])utm_source=(.*)([&|?|^])/,"$1utm_source=Your+mom$3");
}

Be careful using this. Just noticed that it changes all '#partial' links to an absolute url. Had some javascript failing on me :)

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.