Created
March 15, 2012 22:40
-
-
Save codylindley/2047418 to your computer and use it in GitHub Desktop.
Revisions
-
codylindley created this gist
Mar 15, 2012 .There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,34 @@ trackIt: function(p,callback,evil){ //mpg window.mpq.track(label,params{ }); //gaq window._gaq.push('_trackEvent',category,action,label,value); var g = false, m = false; var yesCallback = arguments[1] !== undefined && typeof arguments[1] === 'function'; //window._gaq.push('_trackEvent',p.category,p.action,p.label,p.value); window._gaq.push(['_trackEvent',p.category,p.action,p.label,p.value]); window._gaq.push(function(){ g = true; }); window.mpq.track(p.category,p,function(){ m = true; }); //only call... callback if its actually set if(yesCallback && arguments[2] === undefined){ var check = setInterval (function(){ if(g == true && m == true){ clearInterval(check); callback(); } },10); window.setTimeout(callback,1000); }else if(yesCallback && arguments[2] === 'evil'){ var sleep = function(d){var s = new Date().getTime();while (new Date().getTime() < s + d);}; sleep(1000); callback(); } }