1 2 3 if (!arv_empty(ga_suite_opt['aid'])){ 4 window.google_analytics_uacct = ga_suite_opt['aid']; 5} 6 7/** initilize everything */ 8 var _gaq = _gaq || []; 9 _gaq.push(['_setAccount',ga_suite_opt['id'] ]); 10 11 12/* */ 13jQuery(document).ready(function($) { 14 15 if (!arv_empty(ga_suite_opt['dnt']) && !arv_empty(navigator.doNotTrack) && navigator.doNotTrack == "1" ){//we cant track unfortunately 16 17 18 }else{ 19 20 21/* anonymize IP*/ 22if (!arv_empty(ga_suite_opt['tanon'])){ 23 _gaq.push(['_gat._anonymizeIp']); 24/* /end anonymize*/ 25} 26/* page speed trarking*/ 27if (!arv_empty(ga_suite_opt['pagespeed'])){ 28 _gaq.push(['_trackPageLoadTime']); 29} 30/*--*/ 31/** Scroll Depth */ 32if (!arv_empty(ga_suite_opt['scroll'])){ 33 $.scrollDepth(); 34 35}/** end scroll depth*/ 36 37 38 39/** Select external links*/ 40 if (!arv_empty(ga_suite_opt['outlink'])){ 41 $.expr[':'].external = function(obj){ 42 return !obj.href.match(/^mailto\:/) 43 && (obj.hostname != location.hostname) && !arv_empty(obj.href); 44 }; 45 46 $('a:external').click(function(e){ 47 48 var url = arv_empty(e.target.href) ? '' : e.target.href; 49 if (url==''){return;} 50 var targh= $(e).attr("target"); 51 _gaq.push(['_trackEvent', 'Outbound Links', e.currentTarget.host, url, 0]); 52 if (e.metaKey || e.ctrlKey || (!arv_empty(targh) && targh=="_blank") ) { 53 var newtab = true; 54 } 55 if (!newtab) { 56 e.preventDefault(); 57 setTimeout('document.location = "' + url + '"', 200); 58 } 59 60 }); 61} 62/** Downloads */ 63if (!arv_empty(ga_suite_opt['download'])){ 64 var n = ga_suite_opt['edownloads']; 65 $(n).each(function(i,elem){ 66 67 $('*[href$=".' + elem + '"]').each(function(i,elem){ 68 $(elem).click(function(e){ 69 70 _gaq.push(['_trackEvent', 'Download', e.target.href]); 71 var targh= $(e).attr("target"); 72 73 if (e.metaKey || e.ctrlKey || (!arv_empty(targh) && targh=="_blank") ) { 74 var newtab = true; 75 } 76 if (!newtab) { 77 78 e.preventDefault(); 79 setTimeout('document.location = "' + url + '"', 200); 80 } 81 82 }); 83 84 }); 85 }); 86 87} 88 /** */ 89 90 if (!arv_empty(ga_suite_opt['pageview'])){ 91 _gaq.push(['_trackPageview']); //pageviews 92} 93 94 95 96 (function() { 97 var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true; 98 ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js'; 99 var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s); 100 })(); 101 102 103} //end check if we may track 104}); 105 106function arv_empty(what){ 107 return (typeof what == 'undefined') || ((typeof what === 'array') && what.length==0) || (what==""); 108} 109 110 111 112 113 114/*! 115* jquery.scrolldepth.js | v0.1.2 116* Copyright (c) 2012 Rob Flaherty (@robflaherty) 117* Licensed under the MIT and GPL licenses. 118*/ 119;(function ( $, window, document, undefined ) { 120 121 "use strict"; 122 123 var defaults = { 124 elements: [], 125 minHeight: 0, 126 offset: 0, // Not used yet 127 percentage: true, 128 testing: false 129 }, 130 131 $window = $(window), 132 cache = []; 133 134 /* 135* Plugin 136*/ 137 138 $.scrollDepth = function(options) { 139 140 var startTime = +new Date; 141 142 options = $.extend({}, defaults, options); 143 144 // Return early if document height is too small 145 if ( $(document).height() < options.minHeight ) { 146 return; 147 } 148 149 // Establish baseline (0% scroll) 150 sendEvent('Percentage', 'Baseline'); 151 152 /* 153* Functions 154*/ 155 156 function sendEvent(action, label, timing) { 157 if (!options.testing) { 158 159 _gaq.push(['_trackEvent', 'Scroll Depth', action, label, 1, true]); 160 161 if (arguments.length > 2) { 162 _gaq.push(['_trackTiming', 'Scroll Depth', action, timing, label, 100]); 163 } 164 165 } else { 166// $('#console').html(action + ': ' + label); 167 } 168 } 169 170 function calculateMarks(docHeight) { 171 return { 172 '25%' : parseInt(docHeight * 0.25, 10), 173 '50%' : parseInt(docHeight * 0.50, 10), 174 '75%' : parseInt(docHeight * 0.75, 10), 175 // 1px cushion to trigger 100% event in iOS 176 '100%': docHeight - 1 177 }; 178 } 179 180 function checkMarks(marks, scrollDistance, timing) { 181 // Check each active mark 182 $.each(marks, function(key, val) { 183 if ( $.inArray(key, cache) === -1 && scrollDistance >= val ) { 184 sendEvent('Percentage', key, timing); 185 cache.push(key); 186 } 187 }); 188 } 189 190 function checkElements(elements, scrollDistance, timing) { 191 $.each(elements, function(index, elem) { 192 if ( $.inArray(elem, cache) === -1 && $(elem).length ) { 193 if ( scrollDistance >= $(elem).offset().top ) { 194 sendEvent('Elements', elem, timing); 195 cache.push(elem); 196 } 197 } 198 }); 199 } 200 201 /* 202* Scroll Event 203*/ 204
205 $window.on('scroll.scrollDepth', function() { 206 207 /* 208* We calculate document and window height on each scroll event to 209* account for dynamic DOM changes. 210*/ 211 212 var docHeight = $(document).height(), 213 winHeight = window.innerHeight ? window.innerHeight : $window.height(), 214 scrollDistance = $window.scrollTop() + winHeight, 215 216 // Offset not being used yet 217 offset = parseInt(winHeight * (options.offset / 100), 10), 218 219 // Recalculate percentage marks 220 marks = calculateMarks(docHeight), 221 222 // Timing 223 timing = +new Date - startTime; 224 225 // If all marks already hit, unbind scroll event 226 if (cache.length >= 4 + options.elements.length) { 227 $window.off('scroll.scrollDepth'); 228 return; 229 } 230 231 // Check specified DOM elements 232 if (options.elements) { 233 checkElements(options.elements, scrollDistance, timing); 234 } 235 236 // Check standard marks 237 if (options.percentage) { 238 checkMarks(marks, scrollDistance, timing); 239 } 240 }); 241 242 }; 243 244})( jQuery, window, document );
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.