Advertisement
teknoraver

notrack

Apr 14th, 2016
195
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. var links = document.body.getElementsByTagName("a");
  2. for (var i in links) {
  3.     var href = links[i].getAttribute("href");
  4.     console.log(href);
  5.     if(href.startsWith("http://") || href.startsWith("https://") || href.startsWith("/") &&
  6.        href.match(/utm_(source|campaign|medium|content)/)) {
  7.         href = href.replace(/(\?|&)utm_(source|campaign|medium|content)=[^&]*/g, "$1")
  8.                .replace(/(\?|&)&+/g, "$1")
  9.         links[i].setAttribute("href", href);
  10.     }
  11. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement