1(function ($) { 2 'use strict'; 3 4 $(document).ready(function () { 5 let url = window.location.href; 6 let domain = window.location.hostname; 7 let queryString = url ? url.split('?')[1] : window.location.search.slice(1); 8 let params = new URLSearchParams(queryString); 9 10 let { 11 gclid, 12 msclkid, 13 utm_campaign: utmCampaign, 14 utm_source: utmSource, 15 utm_medium: utmMedium 16 } = Object.fromEntries(params.entries()); 17 18 let tcrCampaign = Cookies.get('tcrCampaign'); 19 let tcrReferrer = Cookies.get('tcrReferrer'); 20 let tcrPagePath = Cookies.get('tcrPagePath'); 21 let tcrMedium = Cookies.get('tcrMedium'); 22 23 let httpReferrer = (document.referrer.toLowerCase().includes(domain)) ? '' : document.referrer; 24 let encodedHttpReferrer = encodeURIComponent(httpReferrer); 25 let encodedUrl = encodeURIComponent(url); 26 27 let dttcr4 = new Date(); 28 let dttcr5 = new Date(); 29 let dttcr6 = new Date(); 30 31 if ((encodedHttpReferrer !== undefined && encodedHttpReferrer !== 'undefined' && encodedHttpReferrer !== null && encodedHttpReferrer !== '') && 32 (tcrReferrer === undefined || tcrReferrer === 'undefined' || tcrReferrer === null || tcrReferrer === '')) { 33 34 dttcr4.setTime(dttcr4.getTime() + (1 * 24 * 60 * 60 * 1000)); 35 dttcr5.setTime(dttcr5.getTime() + (1 * 24 * 60 * 60 * 1000)); 36 dttcr6.setTime(dttcr6.getTime() + (1 * 24 * 60 * 60 * 1000)); 37 38 if ((utmCampaign === undefined || utmCampaign || 'undefined' || utmCampaign === null || utmCampaign === '') && 39 (utmSource === undefined || utmSource === 'undefined' || utmSource === null || utmSource === '') && 40 (utmMedium === undefined || utmMedium === 'undefined' || utmMedium === null || utmMedium === '') && 41 (gclid === undefined || gclid === 'undefined' || gclid === null || gclid === '') && 42 (msclkid === undefined || msclkid === 'undefined' || msclkid === null || msclkid === '')) { 43 44 document.cookie = `tcrReferrer=${encodedHttpReferrer}; expires=${dttcr4.toUTCString()}; domain=${document.location.hostname}; path=/`; 45 document.cookie = `tcrPagePath=${encodedUrl}; expires=${dttcr5.toUTCString()}; domain=${document.location.hostname}; path=/`; 46 document.cookie = `tcrMedium=organic; expires=${dttcr6.toUTCString()}; domain=${document.location.hostname}; path=/`; 47 48 tcrReferrer = decodeURIComponent(encodedHttpReferrer); 49 tcrPagePath = decodeURIComponent(encodedUrl); 50 tcrMedium = "organic"; 51 } else { 52 document.cookie = `tcrCampaign=; expires=${new Date(0).toUTCString()}; domain=${document.location.hostname}; path=/`; 53 document.cookie = `tcrReferrer=; expires=${new Date(0).toUTCString()}; domain=${document.location.hostname}; path=/`; 54 document.cookie = `tcrPagePath=; expires=${new Date(0).toUTCString()}; domain=${document.location.hostname}; path=/`; 55 document.cookie = `tcrMedium=; expires=${new Date(0).toUTCString()}; domain=${document.location.hostname}; path=/`; 56 } 57 } 58 }); 59 60})(jQuery);
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.