Skip to content

Instantly share code, notes, and snippets.

@michaelrhodes
Created February 20, 2021 02:13
Show Gist options
  • Save michaelrhodes/ba7b4eb6dbcbad91585d9c3c1f32fae9 to your computer and use it in GitHub Desktop.
Save michaelrhodes/ba7b4eb6dbcbad91585d9c3c1f32fae9 to your computer and use it in GitHub Desktop.
Remove tracking parameters from anchor tags
javascript:!function(d){[].forEach.call(d.querySelectorAll('a'),a=>{a.setAttribute('rel','noreferrer%20noopener');(a.href=a.href.split('?').map((v,i)=>i?v.replace(/&?(ref|utm_[^=]+)=[^&]*(&|$)/g,''):v).join('?').replace(/\?$/,''))})}(document)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment