// Use class 'enabled' to force enable an input field or class 'disabled' to disable data collection on a field //var serverUrl = "http://localhost:3002/track/"; // put the address of your server script here //var key = null; var cf_tracker = cf_tracker || []; var funnel_stat = 0; if(typeof ecookie === 'undefined'){ var ecookie = false; } cf_tracker.push = function(a) { if(funnel_state === undefined){ funnel_stat = 0 } action = a[0] data1 = a[1] data2 = a[2] var perform = null; push = true; action=='record' ? perform = action : null ; action=='set' ? perform = action : null ; action=='identify' ? perform = action : null ; action=='alias' ? perform = action : null ; if (perform) { var location = window.location; var referrer = document.referrer; var url = serverUrl + '?_unique='+Math.random(); url += '&_uniqueVisitorID='+cfUniqueVisitorID; url += '&_action='+perform; url += '&_data1='+formatObject(data1); url += '&_data2='+formatObject(data2); url += '&_key='+cf_key; url += '&_page_key='+page_key; url += '&_fid='+fid; url += '&_fspos='+fspos; url += '&_fvrs='+fvrs; url += '&_funnel_stat='+funnel_stat; url += '&_location='+location; url += '&_referrer='+referrer; if(url_params['affiliate_id']){ url += '&affiliate_id='+url_params['affiliate_id']; } if(url_params['aff_sub']){ url += '&aff_sub='+url_params['aff_sub']; } if(url_params['aff_sub2']){ url += '&aff_sub2='+url_params['aff_sub2']; } if(action=="identify"){ url += '&email='+formatObject(data1); } cfUniqueVisitorID = readCookie('cf_uvid'); sender = document.createElement('script'); sender.src = url; replied = false; //sender.onload = function(){if(!replied){answered(instance, attached);}}; // ??? TODO: Fix instance missing - preventing more then 1 record action per page load sender.onreadystatechange = function(){if(!replied){(this.readyState=='complete'||this.readyState=='loaded') ? answered(instance, attached) : null; }}; document.body!=null?document.body.appendChild(sender):postpone(); return true; } return false; } if(!Array.indexOf) { Array.prototype.indexOf = function(obj) { for(var i=0; i milliseconds){ break; } } } function checkresponse(instance, attached, request, postpone){ //alert("checkresponse"); now = false; timeout=0; // don't wait for response if link or form if(instance.href){now=true;timeout=500;}else if(instance.action){ now = true; timeout=500;} setTimeout( function(){ if(!replied){(request.readyState==4||(now==true && request.readyState>0)) ? answered(instance, attached, request) : postpone?setTimeout(function(){checkresponse(instance, attached, request)}, 500):null; } },timeout); } //attached != 'undefine' && attached != 'nul' && attached !== undefined && function answered(instance, attached, request){ replied=true; if(attached != 'undefine' && attached != 'nul' && attached !== undefined && attached){eval(attached);} if(request != 'undefine' && request != 'nul' && request !== undefined && request){eval(request.responseText);} if(instance.href){window.location=instance.href;}else if(instance.action && instance.push == undefined){ // try{ // //TODO: Fix stripping on submit value from submit button clicked // try{ // console.log("attempting form.submit.apply method") // var form = document.createElement("form"); // form.submit.apply(instance); // }catch(err){ // console.log("attempting instance.submit method") // instance.submit(); // } // }catch(err){ // try{ // HTMLFormElement.prototype.submit.call($('#'+instance.id)[0]); // }catch(err){ // console.log("prototype.submit.call failure"); // console.log(err); // } // console.log(err); // } //alert("waittt"); } } function postpone(){if(document.body!=null){document.body.appendChild(sender);}else{setTimeout('postpone()', 500);} } var formSubmitFunctions = {}; function formAttach() { var forms = document.getElementsByTagName('form'); var counter; //alert("forms "+forms); for (counter=0; counter