1jQuery(function($) { 2 // Debug flag 3 var debugMode = false; 4 5 // Default time delay before checking location 6 var callBackTime = 100; 7 8 // # px before tracking a reader 9 var readerLocation = 150; 10 11 // Set some flags for tracking & execution 12 var timer = 0; 13 var scroller = false; 14 var endContent = false; 15 var commentbox = false; 16 var didComplete = false; 17 18 // Set some time variables to calculate reading time 19 var startTime = new Date(); 20 var beginning = startTime.getTime(); 21 var totalTime = 0; 22 23 // Track the aticle load 24 /* (!debugMode) { 25 _gaq.push(['_trackEvent', 'Reading', 'ArticleLoaded', '', , true]); 26 }*/ 27 28 // Check the location and track user 29 function trackLocation() { 30 bottom = $(window).height() + $(window).scrollTop(); 31// alert("h "+ $(window).height()+ " srcoll "+$(window).scrollTop()); 32 height = $(document).height(); 33 34 // If user starts to scroll send an event 35 if (bottom > readerLocation && !scroller) { 36 currentTime = new Date(); 37 scrollStart = currentTime.getTime(); 38 timeToScroll = Math.round((scrollStart - beginning) / 1000); 39 if (!debugMode) { 40 try { 41 _gaq.push(['_trackEvent', 'Reading', 'StartReading', '', timeToScroll]); 42 } 43 catch(err) { 44 ga('newTracker2.send','event', 'Reading', 'StartReading', '', timeToScroll); 45 ga('send','event', 'Reading', 'StartReading', '', timeToScroll); 46 } 47 } else { 48 alert('started reading ' + timeToScroll); 49 } 50 scroller = true; 51 } 52 53 // If user has hit the bottom of the content send an event 54// alert( $('.the_content').scrollTop()+" "+ $('.the_content').innerHeight()+" "+bottom+" "); 55 if (bottom >= $('.the_content').scrollTop() + $('.the_content').innerHeight() && !endContent) { 56 currentTime = new Date(); 57 contentScrollEnd = currentTime.getTime(); 58 timeToContentEnd = Math.round((contentScrollEnd - scrollStart) / 1000); 59 if (!debugMode) { 60 try { 61 _gaq.push(['_trackEvent', 'Reading', 'ArticleBottom', '', timeToContentEnd]); 62 } 63 catch(err) { 64 ga('newTracker2.send','event', 'Reading', 'ArticleBottom', '', timeToContentEnd); 65 ga('send','event', 'Reading', 'ArticleBottom', '', timeToContentEnd); 66 } 67 } else { 68 alert('end content section '+timeToContentEnd); 69 } 70 endContent = true; 71 } 72 if (bottom >= $('.boxCommPost').offset().top + $('.boxCommPost').innerHeight() && !commentbox) { 73 currentTime = new Date(); 74 contentScrollEnd = currentTime.getTime(); 75 timeToContentEnd = Math.round((contentScrollEnd - scrollStart) / 1000); 76 if (!debugMode) { 77 try { 78 _gaq.push(['_trackEvent', 'Reading', 'CommentBox', '', timeToContentEnd]); 79 } 80 catch(err) { 81 ga('newTracker2.send','event', 'Reading', 'CommentBox', '', timeToContentEnd); 82 ga('send','event', 'Reading', 'CommentBox', '', timeToContentEnd); 83 } 84 } else { 85 alert('comment box '+timeToContentEnd); 86 } 87 commentbox = true; 88 } 89 90 // If user has hit the bottom of page send an event 91 if (bottom >= height && !didComplete) { 92 currentTime = new Date(); 93 end = currentTime.getTime(); 94 totalTime = Math.round((end - scrollStart) / 1000); 95 if (!debugMode) { 96 if (totalTime < 60) { 97 _gaq.push(['_setCustomVar', 5, 'ReaderType', 'Scanner', 2]); 98 } else { 99 _gaq.push(['_setCustomVar', 5, 'ReaderType', 'Reader', 2]); 100 } 101 try { 102 _gaq.push(['_trackEvent', 'Reading', 'PageBottom', '', totalTime]); 103 } 104 catch(err) { 105 ga('newTracker2.send','event', 'Reading', 'PageBottom', '', totalTime); 106 ga('send','event', 'Reading', 'PageBottom', '', totalTime); 107 } 108 } else { 109 alert('bottom of page '+totalTime); 110 } 111 didComplete = true; 112 } 113 } 114 115 // Track the scrolling and track location 116 $(window).scroll(function() { 117 if (timer) { 118 clearTimeout(timer); 119 } 120 121 // Use a buffer so we don't call trackLocation too often. 122 timer = setTimeout(trackLocation, callBackTime); 123 }); 124 125 126 jQuery( ".tstrack" ).click(function() { 127 //event.preventDefault(); 128 try {
129 _gaq.push(['_trackEvent', '_services_', 'trackbox_post_corr']); 130 } 131 catch(err) { 132 ga('newTracker2.send','event', '_services_', 'trackbox_post_corr'); 133 ga('send','event', '_services_', 'trackbox_post_corr'); 134 } 135 window.location.href($(this).attr('href')); 136 }); 137 138});
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.