/*! adjusted-bounce-rate - v1.2.0 - 2015-03-27 */ if("undefined"==typeof debug&&(window.debug=function(){function e(n){!f||!g&&d&&d.log||f.apply(i,n)}function k(n){return m>0?m>n:c.length+m<=n}for(var f,g,i=this,b=Array.prototype.slice,d=i.console,h={},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=[];--j>=0;)!function(n){h[n]=function(){0!==m&&d&&d[n]&&d[n].apply(d,arguments)}}(l[j]);for(j=c.length;--j>=0;)!function(n,o){h[o]=function(){var q=b.call(arguments),p=[o].concat(q);a.push(p),e(p),d&&k(n)&&(d.firebug?d[o].apply(i,q):d[o]?d[o](q):d.log(q))}}(j,c[j]);return h.setLevel=function(n){m="number"==typeof n?n:9},h.setCallback=function(){var o=b.call(arguments),n=a.length,p=n;for(f=o.shift()||null,g="boolean"==typeof o[0]?o.shift():!1,p-="number"==typeof o[0]?o.shift():n;n>p;)e(a[p++])},h}()),"undefined"==typeof gkn||!gkn)var gkn={};!function($){gkn.AdjustedBounceRate=function(){var startTime,elapsedTime,timer,gaTracking,debugMode=!0,sandboxMode=!1,options={},hitCount=0,elapsedSecs=0;debugMode===!1&&debug.setLevel(0);var _self={init:function(_options){"undefined"!=typeof window.pageTracker||"undefined"!=typeof window._gaq||"undefined"!=typeof window.ga||"undefined"!=typeof window.__gaTracker||debugMode===!0?(options=_options,debugMode&&debug.log("Adjusted_Bounce_Rate.init(): options="+JSON.stringify(options)),_self.initAjaxify(),options.min_engagement_seconds>0?setTimeout(this.start,1e3*options.min_engagement_seconds):this.start()):debug.log("Adjusted Bounce Rate: GA is not loaded.")},initAjaxify:function(){$(window).on("statechangecomplete",function(){_self.restart()})},start:function(){debugMode&&debug.log("Adjusted_Bounce_Rate.start()"),startTime=new Date,elapsedTime=startTime,hitCount=0,elapsedSecs=0,_self.tick(!0),timer=setInterval(_self.tick,500)},restart:function(){debugMode&&debug.log("Adjusted_Bounce_Rate.restart()"),_self.stop(),options.min_engagement_seconds>0?setTimeout(this.start,1e3*options.min_engagement_seconds):this.start()},stop:function(){var elapsedTime=_self.formatElapsedTime(elapsedSecs);debugMode&&debug.log('Adjusted_Bounce_Rate.stop(): stopped after "'+elapsedTime+'" ('+elapsedSecs+" seconds)."),clearInterval(timer)},tick:function(firstTick){"undefined"==typeof firstTick&&(firstTick=!1);var now=new Date,elapsedDiff=_self.dateDiff(elapsedTime,now,"seconds");(elapsedDiff>=options.engagement_interval_seconds||firstTick===!0)&&(hitCount++,elapsedSecs=hitCount*options.engagement_interval_seconds,_self.trackEvent(),elapsedTime=new Date),elapsedSecs>=options.max_engagement_seconds&&_self.stop()},trackEvent:function(){var elapsedTime=_self.formatElapsedTime(elapsedSecs);debugMode&&debug.log("Adjusted_Bounce_Rate.trackEvent(): "+hitCount+" hits, elapsedSecs="+elapsedSecs+', elapsedTime="'+elapsedTime+'"'),("undefined"==typeof gaTracking||""==gaTracking)&&("undefined"!=typeof window.pageTracker?gaTracking="pageTracker":"undefined"!=typeof window._gaq?gaTracking="_gaq":"undefined"!=typeof window.ga?gaTracking="ga":"undefined"!=typeof window.__gaTracker&&(gaTracking="__gaTracker")),sandboxMode||("pageTracker"==gaTracking?window.pageTracker._trackEvent(options.engagement_event_category,options.engagement_event_action,elapsedTime,elapsedSecs||0):"_gaq"==gaTracking?window._gaq.push(["_trackEvent",options.engagement_event_category,options.engagement_event_action,elapsedTime,elapsedSecs||0]):"ga"==gaTracking?ga("send",{hitType:"event",eventCategory:options.engagement_event_category,eventAction:options.engagement_event_action,eventLabel:elapsedTime,eventValue:elapsedSecs||0}):"__gaTracker"==gaTracking?__gaTracker("send",{hitType:"event",eventCategory:options.engagement_event_category,eventAction:options.engagement_event_action,eventLabel:elapsedTime,eventValue:elapsedSecs||0}):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),secs=totalSecs%60;return 10>mins&&(mins="0"+mins),10>secs&&(secs="0"+secs),mins+":"+secs},dateDiff:function(fromDate,toDate,interval){var second=1e3,minute=60*second;interval||(interval="milliseconds"),"string"==typeof fromDate&&(fromDate=new Date(fromDate)),"string"==typeof toDate&&(toDate=new Date(toDate));var timeDiff=toDate-fromDate;if(isNaN(timeDiff))return 0/0;switch(interval){case"years":return toDate.getFullYear()-fromDate.getFullYear();case"months":return 12*toDate.getFullYear()+toDate.getMonth()-(12*fromDate.getFullYear()+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 void 0}}};return _self}()}(jQuery);