1var excludePaths = '/widget/, /group/control_panel'; 2var excludePathArray = excludePaths.split(', '); 3 4function addGoogleAnalyticsScript(globalNum) { 5 6 var googleAnalytics = document.createElement('script'); 7 googleAnalytics.async = true; 8 googleAnalytics.src = 'https://www.googletagmanager.com/gtag/js?id=' + globalNum; 9 googleAnalytics.type = 'text/javascript'; 10 11 var scriptTag = document.getElementsByTagName('script')[0]; 12 scriptTag.parentNode.insertBefore(googleAnalytics, scriptTag); 13 14} 15 16function runAnalytics(json) { 17 18 var globalNum = json.globalTag; 19 var cohortNum = json.cohortTag; 20 var clubNum = json.clubTag; 21 22 addGoogleAnalyticsScript(globalNum); 23 window.dataLayer = window.dataLayer || []; 24 25 function gtag() { 26 dataLayer.push(arguments); 27 } 28 29 gtag('js', new Date()); 30 gtag('set', { 31 'dimension1': clubNum 32 }); 33 34 gtag('config', clubNum); 35 gtag('config', globalNum, { 'groups': 'Connect' }); 36 gtag('config', cohortNum, { 'groups': 'Connect' }); 37} 38 39function updateGoogleTags(jsonResponse) { 40 41 try { 42 43 var pathName = window.location.pathname; 44 var excludePage = false; 45 46 if (pathName && typeof pathName != 'undefined') { 47 48 /*Check for pathName contain excluded URL keywords*/ 49 excludePathArray.forEach(function(value) { 50 if (pathName.indexOf(value) != -1) { 51 excludePage = true; 52 } 53 }); 54 55 /*If path was not excluded then execute Google Analytics code*/ 56 if (!excludePage) { 57 var gaTags = JSON.parse(jsonResponse); 58 if (gaTags && typeof gaTags != 'undefined' && gaTags.globalTag.length > 0 && gaTags.cohortTag.length > 0) { 59 runAnalytics(gaTags); 60 } 61 } 62 } 63 } catch (err) { 64 console.error('error in updateGoogleTags: ' + err); 65 } 66 67} 68 69updateGoogleTags(googleAnalyticsResponse);
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.