1document.addEventListener("DOMContentLoaded", () => { 2 setTimeout(() => { 3 window.gtmListener(document); 4 }, 500); 5}); 6 7window.pushEventObj = function (jsonObj) { 8 const eventAttributes = jsonObj; 9 if (eventAttributes) { 10 for (let event of eventAttributes) { 11 window.dataLayer.push(event); 12 } 13 } 14}; 15 16window.pushEventObjVWO = function (vwoEvents) { 17 if (!vwoEvents || !window.VWO?.event) return; 18 try { 19 if (Array.isArray(vwoEvents)) { 20 for (let i = 0; i < vwoEvents.length; i++) { 21 if ( 22 vwoEvents[i] && 23 vwoEvents[i].event_name && 24 vwoEvents[i].interaction 25 ) { 26 window.VWO.event(vwoEvents[i].event_name, { 27 interaction_type: vwoEvents[i].interaction.interaction_type, 28 }); 29 } 30 } 31 } else if (vwoEvents.event_name && vwoEvents.interaction) { 32 window.VWO.event(vwoEvents.event_name, { 33 interaction_type: vwoEvents.interaction.interaction_type, 34 }); 35 } 36 } catch (e) { 37 console.warn("[useTracking] - ", e); 38 } 39}; 40 41window.pushEvent = function (jsonStr) { 42 if (!jsonStr) return; 43 const eventAttributes = cleanJson(jsonStr); 44 window.pushEventObj(eventAttributes); 45 window.pushEventObjVWO(eventAttributes); 46 function cleanJson(strJson) { 47 let s = strJson
48 .replace(/\\n/g, "\\n") 49 .replace(/\\'/g, "\\'") 50 .replace(/\\"/g, '\\"') 51 .replace(/\\&/g, "\\&") 52 .replace(/\\r/g, "\\r") 53 .replace(/\\t/g, "\\t") 54 .replace(/\\b/g, "\\b") 55 .replace(/\\f/g, "\\f"); 56 // remove non-printable and other non-valid JSON chars 57 s = s.replace(/[\u0000-\u0019]+/g, ""); 58 return JSON.parse(s); 59 } 60}; 61 62window.addGtmEventListener = function (target, querySelectorName) { 63 const gtmElements = target.querySelectorAll( 64 "[data-" + querySelectorName + "]" 65 ); 66 if (gtmElements) { 67 for (let element of gtmElements) { 68 element.addEventListener("click", pushEvent); 69 element.addEventListener("auxclick", pushEvent); 70 } 71 } 72 function pushEvent() { 73 window.pushEvent(this.dataset[querySelectorName]); 74 } 75}; 76window.gtmListener = function (target) { 77 window.addGtmEventListener(target, "gtm"); 78 window.addGtmEventListener(target, "ga4"); 79};
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.