(window.onload = function() { if(typeof $ != "function"){return;} var afid = ""; var uqid = ""; var referer = "none"; if(document.referrer) { referer = btoa(document.referrer); } document.cookie.split(';').forEach(function(value) { var content = value.split('='); if(content[0].trim() == "afid") { afid = content[1]; } if(content[0].trim() == "uqid") { uqid = content[1]; } }); var limit = 30; var nowdate = new Date(); nowdate.setTime(nowdate.getTime() + limit*24*60*60*1000); var limitdate = nowdate.toGMTString(); if(window.location.search){ tempafid = window.location.search.replace('?',''); re = /a_[0-9]+_[0-9]+/; if(re.test(tempafid)){ afid = tempafid; document.cookie = 'afid='+afid+';expires='+limitdate+";"; history.replaceState(null,null,"/"); console.log(afid); }else{ console.log("not match"); } } if(!uqid) { uqid = new Date().getTime().toString(16) + Math.floor(1234+Math.random()).toString(16) document.cookie = 'uqid='+uqid+';expires='+limitdate+";"; } if(afid){ $.ajax({ type: 'get', url: 'https://a.vehofitness.com/log/access/'+afid+'/'+uqid+'/'+referer, async : true, timeout: 3000, success: function(data) { console.log("access:"+afid); } }); } if(afid){ $(document).on("click", ".s-email-form-button",function(){ var email = btoa(unescape(encodeURIComponent($(".s-contact-section-columns").find(".s-email-field").find("input").val()))); var name = btoa(unescape(encodeURIComponent($(".s-contact-section-columns").find(".s-name-field").find("input").val()))); if(!email || !name) { return; } $.ajax({ type: 'get', url: 'https://a.vehofitness.com/log/contact/'+afid+'/'+uqid+'/'+referer+'/'+name+'/'+email, async : false, cache: false, timeout: 3000, success: function(data) { console.log(data); } }); }); } })();