Skip to content

Instantly share code, notes, and snippets.

@ulitiy
Last active August 29, 2015 13:56
Show Gist options
  • Save ulitiy/9139751 to your computer and use it in GitHub Desktop.
Save ulitiy/9139751 to your computer and use it in GitHub Desktop.
$(function(){
function getURLParameter(name) {
return decodeURIComponent((new RegExp('[?|&]' + name + '=' + '([^&;]+?)(&|#|;|$)').exec(location.search)||[,""])[1].replace(/\+/g, '%20'))||null;
}
$.each(["utm_source","utm_medium","utm_campaign","utm_term",'source_type','source','position_type','position','added','creative','matchtype'],function(i,v){
$('<input type="hidden" />').attr({
name: "content["+v+"]",
value: getURLParameter(v)
}).appendTo("form")
})
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment