Skip to content

Instantly share code, notes, and snippets.

@richardh-vccp
Last active August 29, 2015 14:05
Show Gist options
  • Save richardh-vccp/698c16ce5b0fe4ee894b to your computer and use it in GitHub Desktop.
Save richardh-vccp/698c16ce5b0fe4ee894b to your computer and use it in GitHub Desktop.
Add tracking tag before hash fragment
function add_tracking_tag(u, t) {
var url = u,
tag = t;
if (url.match('#')) {
url = url.replace('#', tag + '#');
} else {
url = url + tag;
}
return url;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment