Skip to content

Instantly share code, notes, and snippets.

@nicohvi
Created February 1, 2017 10:07
Show Gist options
  • Select an option

  • Save nicohvi/a3ec834a09d462c5b967ea3963c1fedb to your computer and use it in GitHub Desktop.

Select an option

Save nicohvi/a3ec834a09d462c5b967ea3963c1fedb to your computer and use it in GitHub Desktop.
$(document).ready(function() {
// nå er alt lastet
function GetUrlValue(VarSearch){
var SearchString = window.location.search.substring(1);
var VariableArray = SearchString.split('&');
for(var i = 0; i < VariableArray.length; i++){
var KeyValuePair = VariableArray[i].split('=');
if(KeyValuePair[0] == VarSearch){
return KeyValuePair[1];
}
}
}
var asid = GetUrlValue('aspid');
var campaign = GetUrlValue('utm_campaign');
if(asid != undefined) {
$("a").attr('href', function(i, h) {
return h + (h.indexOf('?') != -1 ? "&aspid=" + asid : "?aspid=" + asid);
});
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment