1(function ($) { 2 'use strict'; 3 4 $(document).ready(function () { 5 // work on this 6 let tcrParams = Cookies.get('tcrParams'); // tcrParams is basically window.location.search? | 7 let tcrReturningCustomer = Cookies.get('tcrReturningCustomer'); 8 9 let url = window.location.href; 10 let domain = window.location.hostname.split('.').slice(-2).join('.'); 11 let queryString = url ? url.split('?')[1] : window.location.search.slice(1); 12 let params = new URLSearchParams(queryString); 13 14 // Remove unwanted params and append back to queryString 15 const paramsToDelete = ['s', 'post_type']; 16 paramsToDelete.forEach(paramToDelete => { 17 if (params.has(paramToDelete)) { 18 params.delete(paramToDelete); 19 } 20 }); 21 queryString = params.toString(); 22 23 let { 24 returningcustomer: returningCustomer, 25 utm_campaign: utmCampaign, 26 gclid, 27 msclkid, 28 } = Object.fromEntries(params.entries()); 29 30 let httpReferrer = (document.referrer.toLowerCase().includes(domain)) ? '' : document.referrer; 31 32 let dttcr = new Date(); 33 let dttcr2 = new Date(); 34 let dttcr3 = new Date(); 35 36 let goldenHippoLoginStateproduction = Cookies.get('ghm_logged_in'); 37 38 if ((tcrParams === '' || tcrParams === null || tcrParams === 'undefined' || tcrParams === undefined) || 39 (utmCampaign !== undefined && utmCampaign !== 'undefined' && utmCampaign !== null && utmCampaign !== '' && utmCampaign !== '') 40 ) { 41 dttcr.setTime(dttcr.getTime() + (1 * 24 * 60 * 60 * 1000)); // match the logged in cookie state 42 if (queryString !== undefined && queryString !== 'undefined' && queryString !== null && queryString !== '') { 43 document.cookie = `tcrParams=|${queryString}; expires=${dttcr.toUTCString()}; domain=.${domain}; path=/`; 44 tcrParams = queryString; 45 } 46 } 47 48 if (tcrReturningCustomer === '' || tcrReturningCustomer === null || tcrReturningCustomer === 'undefined' || tcrReturningCustomer === undefined) { 49 dttcr2.setTime(dttcr2.getTime() + (1 * 24 * 60 * 60 * 1000)); // match the logged in cookie state 50 if (returningCustomer !== undefined && returningCustomer !== 'undefined' && returningCustomer !== null && returningCustomer !== '') { 51 document.cookie = `tcrReturningCustomer=${returningCustomer}; expires=${dttcr2.toUTCString()}; domain=.${domain}; path=/`; 52 tcrReturningCustomer = returningCustomer; 53 } 54 } 55 56 if (goldenHippoLoginStateproduction == "1") { 57 if (tcrReturningCustomer === '' || tcrReturningCustomer === null || tcrReturningCustomer === 'undefined' || tcrReturningCustomer === undefined) { 58 dttcr3.setTime(dttcr3.getTime() + (1 * 24 * 60 * 60 * 1000)); // match the logged in cookie state 59 document.cookie = `tcrReturningCustomer=1; expires=${dttcr3.toUTCString()}; domain=.${domain}; path=/`; 60 } 61 $('body').addClass('ghm-logged-in'); 62 } else { 63 document.cookie = `tcrReturningCustomer=; expires=${new Date(0).toUTCString()}; domain=.${domain}; path=/`; 64 $('body').removeClass('ghm-logged-in'); 65 } 66 67 const event = new CustomEvent('tcrParamsUpdated', { 68 detail: tcrParams 69 }); 70 document.dispatchEvent(event); 71 }); 72})(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.