Skip to content

Instantly share code, notes, and snippets.

@augustohp
Forked from evert/yourmom.js
Created March 30, 2012 21:10
Show Gist options
  • Save augustohp/2255030 to your computer and use it in GitHub Desktop.
Save augustohp/2255030 to your computer and use it in GitHub Desktop.
Greasemonkey script to change every utm_source link attribute value to 'Your mom'
// ==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");
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment