1(function ($) { 2 3 var body = $('body'); 4 var languageAttr = $('html').attr('lang'); 5 6 7 window.template = ''; 8 window.language = languageAttr.charAt(0) + languageAttr.charAt(1);; 9 window.isRoomsPage = ''; 10 window.roomPageName = ''; 11 window.roomCode = ''; 12 window.envChannnel = ''; 13 window.roomPrice = ''; 14 window.envChannnel = window.innerWidth < 768 ? 'mobile' : 'desktop'; 15 16 if (body.hasClass('rooms')) { 17 window.template = 'category'; 18 window.isRoomsPage = 'Chambres et Suites'; 19 } else if (body.hasClass('single-room')) { 20 window.template = 'product'; 21 window.isRoomsPage = 'Chambres et Suites'; 22 window.roomPageName = $('h1').attr('data-title-dft-lng'); 23 window.roomCode = $('qw-price').attr('qw-price-room-id'); 24 } else if (body.hasClass('error404')) { 25 window.template = 'error'; 26 window.isRoomsPage = 'errors'; 27 } else if (body.hasClass('page_on_front')) { 28 window.template = 'home'; 29 } else { 30 window.template = 'other'; 31 window.isRoomsPage = $('h1').html; 32 } 33 34 function pushDataLayer() { 35 window.dataLayer = window.dataLayer || []; 36 window.dataLayer.push({ 37 "PageType": template, 38 "language": language, 39 "env_channel": envChannnel, 40 "page_cat_1": isRoomsPage, 41 "page_cat_2": roomPageName, 42 "product_id": roomCode, 43 "product_category": isRoomsPage, 44 "product_price_ati": roomPrice, 45 }); 46 } 47 48 try { 49 if (!body.hasClass('single-room')) { 50 pushDataLayer(); 51 } else { 52 //Use MutationObserver to check when price inside main content has been loaded 53 let price = document.querySelector('.main qw-price'); 54 let observer = new MutationObserver(mutations => { 55 for (let mutation of mutations) { 56 $(window).trigger('price_data_layer_loaded'); 57 } 58 }); 59 observer.observe(price, {childList: true, subtree: true}); 60 61 $(window).on('price_data_layer_loaded', function () { 62 var component = $('.main qw-price .qw-price__main-price'); 63 window.roomPrice = component.html(); 64 if(window.roomPrice !== '--'){ 65 window.roomPrice = roomPrice.replace(/\D/g,'') 66 pushDataLayer(); 67 } 68 69 }); 70 } 71 } catch (e) { 72 // die silently; 73 window.console && console.log('Custom Hidden Hotel tracking failed'); 74 } 75 76})(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.