1const EVENT_TYPE = "edo_event"; 2 3function getBrandId(hostname) { 4 const defaultBrand = "edreams"; 5 const brandIds = { 6 edreams: "G-0F2PG8WMQ1", 7 opodo: "G-03F834EHLM", 8 govoyages: "G-VF634C8Y99", 9 travellink: "G-1S3V91S7YF", 10 }; 11 12 const host = hostname.toLowerCase(); 13 14 for (const [brand, brandId] of Object.entries(brandIds)) { 15 if (host.includes(brand)) { 16 return brandId; 17 } 18 } 19 return brandIds[defaultBrand]; 20} 21 22function getTrackingSender() { 23 // Check for Android WebView interface 24 if (typeof window.AnalyticsWebInterface?.logEvent === "function") { 25 return (payload) => { 26 window.AnalyticsWebInterface.logEvent( 27 EVENT_TYPE, 28 JSON.stringify(payload), 29 ); 30 }; 31 } 32 33 // Check for iOS WebView message handler 34 if ( 35 typeof window.webkit?.messageHandlers?.firebase?.postMessage === "function" 36 ) { 37 return (payload) => { 38 window.webkit.messageHandlers.firebase.postMessage({ 39 command: "logEvent", 40 name: EVENT_TYPE, 41 parameters: payload, 42 }); 43 }; 44 } 45 46 // Check for Google Analytics gtag web function 47 if (typeof window.gtag === "function") { 48 const brandId = getBrandId(window.location.hostname); 49 return (payload) => { 50 window.gtag("event", EVENT_TYPE, { 51 send_to: brandId, 52 ...payload, 53 }); 54 }; 55 } 56 57 return null; 58} 59 60$(".track-event").on("click", function () { 61 const sendTrackingEvent = getTrackingSender(); 62 63 if (!sendTrackingEvent) { 64 console.warn("No tracking method available"); 65 return; 66 } 67 68 const $element = $(this); 69 sendTrackingEvent({ 70 event_category: "WMP-tracking", 71 event_action: String($element.attr("data-action")), 72 event_label: String($element.attr("data-label")), 73 edo_timestamp: Date.now(), 74 }); 75});
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.