1/** 2 * UTM Parameter Capture 3 * 4 * Captures utm_* query parameters from the landing URL and stores them 5 * in a cookie scoped to the root domain so they survive cross-subdomain 6 * redirections (e.g. pizzabolis.com -> adams-morgan-ustreet.pizzabolis.com). 7 * Cookie lasts 3 days and overwrites existing values. 8 */ 9(function () { 10 'use strict'; 11 12 var COOKIE_NAME = 'ftc_utm_params'; 13 var COOKIE_DAYS = 3; 14 15 function getRootDomain() { 16 var parts = window.location.hostname.split('.'); 17 if (parts.length <= 2) { 18 return '.' + window.location.hostname; 19 } 20 return '.' + parts.slice(-2).join('.'); 21 } 22 23 function setCookie(name, value, days) { 24 var expires = new Date(Date.now() + days * 864e5).toUTCString(); 25 document.cookie = 26 name + '=' + encodeURIComponent(value) + 27 '; expires=' + expires + 28 '; path=/' + 29 '; domain=' + getRootDomain() + 30 '; SameSite=Lax'; 31 } 32 33 function getUtmParams() { 34 var params = {}; 35 var search = window.location.search.substring(1); 36 if (!search) return params; 37 var pairs = search.split('&'); 38 for (var i = 0; i < pairs.length; i++) { 39 var kv = pairs[i].split('='); 40 var key = decodeURIComponent(kv[0] || ''); 41 if (key.indexOf('utm_') === 0) { 42 params[key] = decodeURIComponent(kv[1] || ''); 43 } 44 } 45 return params; 46 } 47 48 var utmParams = getUtmParams(); 49 if (Object.keys(utmParams).length > 0) { 50 setCookie(COOKIE_NAME, JSON.stringify(utmParams), COOKIE_DAYS); 51 } 52})();
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.