1wng.googleAnalytics.addSiteSpecificCustomDimensionsOrMetrics = function (opt, analyticsUtils) { 2 var dimensions = { 3 'firstTouch': 'dimension15', 4 'lastTouch': 'dimension16', 5 'firstBlogAuthor': 'dimension17', 6 'lastBlogAuthor': 'dimension18' 7 }; 8 9 var internalUtils = { 10 'domainFromUrl': function (url) { 11 var withoutProtocol = url.replace(/^[a-z]+:\/\//, ''); 12 var withoutPath = withoutProtocol.split('/')[0]; 13 14 return withoutPath; 15 }, 16 'stripW3FromDomain': function (domain) { 17 return domain.replace(/^www\./, '').toLowerCase(); 18 }, 19 'stripWorldNomadsFromDomain': function (domain) { 20 return domain.replace(/\.?worldnomads\.com/, '').toLowerCase(); 21 }, 22 'first100Characters': function (string) { 23 return string.substr(0, 100); 24 } 25 }; 26 27 var currentDomain = internalUtils.stripW3FromDomain(window.location.host); 28 var subdomain = internalUtils.stripWorldNomadsFromDomain(window.location.host); 29 30 // First Journals author 31 if (subdomain == 'journals') { 32 var firstBlogAuthorCookieName = 'blogauthor'; 33 var blogAuthorCookie = analyticsUtils.getCookie(firstBlogAuthorCookieName); 34 35 if (!blogAuthorCookie) { 36 var toTrack = internalUtils.first100Characters(subdomain + window.location.pathname); 37 analyticsUtils.setCookie(firstBlogAuthorCookieName, toTrack, { 'expires': 365 }); 38 ga('set', dimensions.firstBlogAuthor, toTrack); 39 } 40 } 41 42 // Last Journals or Answers page 43 if (subdomain == 'journals' || subdomain == 'answers') { 44 var toTrack = internalUtils.first100Characters(subdomain + window.location.pathname); 45 ga('set', dimensions.lastBlogAuthor, toTrack); 46 } 47 48 // First touch 49 var firstTouchCookieName = 'firsttouch'; 50 var firstTouchCookie = analyticsUtils.getCookie(firstTouchCookieName); 51 52 if (!firstTouchCookie) { 53 var toTrack = internalUtils.first100Characters(opt.url ? opt.url : window.location.host + window.location.pathname + window.location.search); 54 analyticsUtils.setCookie(firstTouchCookieName, toTrack, { 'expires': 183 }); 55 ga('set', dimensions.firstTouch, toTrack); 56 } 57 58 // Last touch domain 59 if (document.referrer) { 60 var referrerDomain = internalUtils.stripW3FromDomain(internalUtils.domainFromUrl(document.referrer)); 61 var rootDomain = 'worldnomads.com'; 62 var currentDomainIsRoot = currentDomain == rootDomain; 63 var referrerDomainIsRoot = referrerDomain == rootDomain; 64 65 if (!referrerDomainIsRoot && currentDomainIsRoot) { 66 ga('set', dimensions.firstTouch, referrerDomain); 67 } 68 } 69};
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.