Created
May 6, 2011 08:07
-
-
Save usefulthink/958595 to your computer and use it in GitHub Desktop.
Javascript WTF - clicktracking.
This file contains 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 is an anonymized but otherwise unmodified copy from the | |
// documentation of a renowned tracking-provider. | |
var toSleep = true; | |
function stopTimer(){toSleep=false;} | |
function clickTracker(LinkName){ | |
var secureID="XXX"; | |
var redirectUrl="http://wehave.teh-trackingz.com/1px.gif"; | |
img=new Image(1,1); | |
toSleep=true; | |
img.src="http://wehave.teh-trackingz.com?key="+secureID+"&url="+redirectUrl+"&lnkname="+LinkName; | |
img.onload=stopTimer; | |
if(toSleep==true) {maxDelay(500);} | |
return true; | |
} | |
function maxDelay(gap){ | |
var then,now;then=new Date().getTime(); | |
now=then; | |
while( toSleep==true&&(now-then)<gap){ | |
now=new Date().getTime(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment