1function epiGat(settings) { 2 if (settings.downloads || settings.external || settings.mailto) { 3 var isinternal = new RegExp('^' + window.location.protocol + '\/\/' + window.location.host, 'i'); 4 5 function addEvent(obj, type, fn) { 6 if (obj.addEventListener) 7 obj.addEventListener(type, fn, false); 8 else if (obj.attachEvent) { 9 obj['e' + type + fn] = fn; 10 obj[type + fn] = function () { obj['e' + type + fn](window.event); } 11 obj.attachEvent('on' + type, obj[type + fn]); 12 } 13 } 14 15 var isdownload = new RegExp('[.](' + settings.extensions + ')$', 'i'); 16 var islink = new RegExp('^https?://'); 17 var ismailto = new RegExp('^mailto:', 'i'); 18 19 function instead(e, a) { 20 var isDefaultPrevented = e.defaultPrevented; 21 22 if (e.preventDefault) e.preventDefault(); 23 else if (event) event.returnValue = false; 24 25 if (isDefaultPrevented == false) { 26 setTimeout(function () { window.location = a.href; }, 200); 27 } 28 } 29 30 // https://developers.google.com/analytics/devguides/collection/upgrade/reference/gajs-analyticsjs#events 31 addEvent(document, 'click', function (e) { 32 e = e || event; 33 var a = e.target || e.srcElement; 34 35 // Depend on TrackScriptOption to decided Clasic or Universal or Customer 36 var trackingEvent = function (category, action, opt_label, opt_value) { 37 // Universal syntax 38 if (settings.trackingOption == 'Universal') { 39 ga('send', 'event', category, action, opt_label, opt_value); 40 } 41 else { // Classic syntax 42 _gaq.push(['_trackEvent', category, action, opt_label, opt_value]); 43 } 44 }; 45 46 // Depend on TrackScriptOption to decided Clasic or Universal or Customer 47 var trackingPageView = function (path) { 48 // Universal syntax 49 if (settings.trackingOption == 'Universal') { 50 ga('send', 'pageview', path); 51 } 52 else { // Classic syntax 53 _gaq.push(['_trackPageview', path]); 54 } 55 }; 56 57 for (; a.parentNode; a = a.parentNode) { 58 if (a.tagName !== 'A') { 59 continue; 60 } 61 62 if (settings.downloads && isdownload.test(a.href)) { 63 var extension = isdownload.exec(a.href); 64 trackingEvent('Download', extension[1].toUpperCase(), a.href.replace(isinternal, '')); 65 66 if (!a.target || a.target === "_top") 67 instead(e, a); 68 } 69 else if (settings.external && islink.test(a.href) && !isinternal.test(a.href)) { 70 if (settings.externalsAsViews) { 71 trackingPageView('/external/' + a.href.replace(islink, '')); 72 } else { 73 trackingEvent('External', 'Clicked', a.href); 74 } 75 if (!a.target || a.target === "_top") 76 instead(e, a); 77 } 78 else if (settings.mailto && ismailto.test(a.href)) { 79 trackingEvent('Mailto', 'Clicked', a.href.replace(ismailto, '')); 80 } 81 82 return; 83 } 84 }); 85 } 86 87 // if track post of the EPiServer.Forms 88 if (settings.trackForms == true) { 89 90 if (typeof $$epiforms == "undefined" || !$$epiforms) { 91 return; 92 } 93 94 $$epiforms(document).ready(function () { 95 96 $$epiforms(".EPiServerForms").on("formsSubmitted", function (event) { 97 98 if (event.isFinalizedSubmission != true) { 99 return; 100 } 101 102 var gaEventCategory = "EPiServer Forms"; 103 var gaEventLabel = event.workingFormInfo.Name; 104 var gaEventAction = "EPiServer Forms Submit " + event.workingFormInfo.Id; 105 // Universal syntax 106 if (settings.trackingOption == 'Universal') { 107 ga('send', 'event', gaEventCategory, gaEventAction, gaEventLabel, 1); 108 } 109 else if (settings.trackingOption == 'Classic') { // Classic syntax 110 _gaq.push(['_trackEvent', gaEventCategory, gaEventAction, gaEventLabel, 1]); 111 } 112 }); 113 }); 114 } 115};
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.