1// Cookie length in days 2let iCookieLength = 30; 3// Name of the first party cookie to utilise for last click referrer de-duplication 4let sCookieName = 'source'; 5// The parameter used by networks and other marketing channels to tell you who drove the traffic 6let sSourceParameterName = 'utm_source'; 7 8let _getQueryStringValue = function (sParameterName) { 9 let aQueryStringPairs = document.location.search.substring(1).split('&'); 10 for (let i = 0; i < aQueryStringPairs.length; i++) { 11 let aQueryStringParts = aQueryStringPairs[i].split('='); 12 if (sParameterName.toLowerCase() === aQueryStringParts[0].toLowerCase()) { 13 return aQueryStringParts[1]; 14 } 15 } 16}; 17 18let _setCookie = function (sCookieName, sCookieContents, iCookieLength) { 19 let dCookieExpires = new Date(); 20 dCookieExpires.setTime(dCookieExpires.getTime() + (iCookieLength * 24 * 60 * 60 * 1000)); 21 document.cookie = sCookieName + '=' + sCookieContents + '; expires=' + dCookieExpires.toGMTString() + '; path=/;'; 22}; 23 24 25if (_getQueryStringValue(sSourceParameterName)) { 26 _setCookie(sCookieName, _getQueryStringValue(sSourceParameterName), iCookieLength); 27} else if (_getQueryStringValue('gclid')) { 28 _setCookie(sCookieName, 'googleAds', iCookieLength); 29} 30else if (_getQueryStringValue('fbclid')) { 31 _setCookie(sCookieName, 'facebook', iCookieLength); 32} 33else if (_getQueryStringValue('msclid')) { 34 _setCookie(sCookieName, 'bing', iCookieLength); 35} 36else if (_getQueryStringValue('insid')) { 37 _setCookie(sCookieName, 'instagram_stories', iCookieLength); 38}
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.