Skip to content

Instantly share code, notes, and snippets.

@emaxerrno
Created January 28, 2014 20:22
Show Gist options
  • Select an option

  • Save emaxerrno/8675553 to your computer and use it in GitHub Desktop.

Select an option

Save emaxerrno/8675553 to your computer and use it in GitHub Desktop.
shinji.form.js
// this could be minified by their build system
// Test: http://static.stg.yieldmo.com/~agallego/shinji.form.html
//
(function(window,document){
var tokenizer = function(key, searchString) {
var result = new RegExp(key + "=([^&]*)", "i").exec(searchString || window.location.search);
return result && unescape(result[1]) || "";
};
var clickId = tokenizer('click_id');
if(!clickId || clickId.length < 1){
return;
}
[].forEach.call(document.getElementsByClassName('ym_tag_with_click'),function(element){
// this is only for this advertiser
var input = element.getAttribute('value');
if(input && input.indexOf('click_id') === -1) {
element.setAttribute('value', input + '?click_id=' + clickId);
}
});
})(window,document);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment