Created
November 8, 2013 17:32
-
-
Save timelf123/7374596 to your computer and use it in GitHub Desktop.
Drop this code on a splash page that links to your landing pages to append your tracking parameters.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$(document).ready(function(){ | |
// Grab querystrings | |
var querystring = window.location.href.slice(window.location.href.indexOf('?') + 1); | |
// Append the above to each link on our page so we maintain utm params etc | |
$('a').each(function() | |
{ | |
var href = $(this).attr('href'); | |
if(href) { | |
href += (href.match(/\?/) ? '&' : '?') + querystring; | |
$(this).attr('href', href); | |
} | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment