/* adjusted-bounce-rate v1.1.1 (2014-05-15) */ if(typeof debug==="undefined"){window.debug=function(){var i=this,b=Array.prototype.slice,d=i.console,h={},f,g,m=9,c=["error","warn","info","debug","log"],l="assert clear count dir dirxml exception group groupCollapsed groupEnd profile profileEnd table time timeEnd trace".split(" "),j=l.length,a=[];while(--j>=0){(function(n){h[n]=function(){m!==0&&d&&d[n]&&d[n].apply(d,arguments)}})(l[j])}j=c.length;while(--j>=0){(function(n,o){h[o]=function(){var q=b.call(arguments),p=[o].concat(q);a.push(p);e(p);if(!d||!k(n)){return}d.firebug?d[o].apply(i,q):d[o]?d[o](q):d.log(q)}})(j,c[j])}function e(n){if(f&&(g||!d||!d.log)){f.apply(i,n)}}h.setLevel=function(n){m=typeof n==="number"?n:9};function k(n){return m>0?m>n:c.length+m<=n}h.setCallback=function(){var o=b.call(arguments),n=a.length,p=n;f=o.shift()||null;g=typeof o[0]==="boolean"?o.shift():false;p-=typeof o[0]==="number"?o.shift():n;while(p0){setTimeout(this.start,options.min_engagement_seconds*1e3)}else{this.start()}},stop:function(){var elapsedTime=_self.formatElapsedTime(elapsedSecs);debug.log('Adjusted_Bounce_Rate.stop(): stopped after "'+elapsedTime+'" ('+elapsedSecs+" seconds).");clearInterval(timer)},tick:function(firstTick){if(typeof firstTick==="undefined"){firstTick=false}var now=new Date;var elapsedDiff=_self.dateDiff(elapsedTime,now,"seconds");if(elapsedDiff>=options.engagement_interval_seconds||firstTick===true){hitCount++;elapsedSecs=hitCount*options.engagement_interval_seconds;_self.trackEvent();elapsedTime=new Date}if(elapsedSecs>=options.max_engagement_seconds){_self.stop()}},trackEvent:function(){var elapsedTime=_self.formatElapsedTime(elapsedSecs);debug.log("Adjusted_Bounce_Rate.trackEvent(): "+hitCount+" hits"+", elapsedSecs="+elapsedSecs+', elapsedTime="'+elapsedTime+'"');if(typeof gaTracking==="undefined"||gaTracking==""){if(typeof window.pageTracker!=="undefined"){gaTracking="pageTracker"}if(typeof _gaq!=="undefined"){gaTracking="_gaq"}}if(!sandboxMode){if(gaTracking=="pageTracker"){pageTracker._trackEvent(options.engagement_event_category,options.engagement_event_action,elapsedTime,elapsedSecs)}else if(gaTracking=="_gaq"){_gaq.push(["_trackEvent",options.engagement_event_category,options.engagement_event_action,elapsedTime,elapsedSecs])}else{debug.warn("Adjusted_Bounce_Rate: [warning] No supported version of Google Analytics script seems to be loaded.")}}},formatElapsedTime:function(totalSecs){var mins=Math.floor(totalSecs/60);var secs=totalSecs%60;if(mins<10){mins="0"+mins}if(secs<10){secs="0"+secs}return mins+":"+secs},dateDiff:function(fromDate,toDate,interval){var second=1e3,minute=second*60;if(!interval){interval="milliseconds"}if(typeof fromDate==="string"){fromDate=new Date(fromDate)}if(typeof toDate==="string"){toDate=new Date(toDate)}var timeDiff=toDate-fromDate;if(isNaN(timeDiff))return NaN;switch(interval){case"years":return toDate.getFullYear()-fromDate.getFullYear();case"months":return toDate.getFullYear()*12+toDate.getMonth()-(fromDate.getFullYear()*12+fromDate.getMonth());case"weeks":return Math.floor(timeDiff/week);case"days":return Math.floor(timeDiff/day);case"hours":return Math.floor(timeDiff/hour);case"minutes":return Math.floor(timeDiff/minute);case"seconds":return Math.floor(timeDiff/second);case"milliseconds":return timeDiff;default:return undefined}}};return _self}()})(jQuery);