Created
January 28, 2014 20:22
-
-
Save emaxerrno/8675553 to your computer and use it in GitHub Desktop.
shinji.form.js
This file contains hidden or 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
| // 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