Skip to content

Instantly share code, notes, and snippets.

@j4p3
Created September 25, 2015 19:42
Show Gist options
  • Save j4p3/5baaf471217bac3b3904 to your computer and use it in GitHub Desktop.
Save j4p3/5baaf471217bac3b3904 to your computer and use it in GitHub Desktop.
$.fn.utmMirror = function () {
if (window.location.search) {
var sep = this.attr('href').includes('?') ? '&' : '?';
this.attr('href', this.attr('href') + sep + window.location.search.substring(1));
}
}
@j4p3
Copy link
Author

j4p3 commented Sep 25, 2015

Plug this into your wp-head and call it on the desired element, e.g. $('.top-nav-link.demo').utmMirror().

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment