function CreateTrackingTag(){if(cookiesAcceptedByUser){var u=window.location.hostname=="wl.hrs.de"?"prod":"qa",n="//tags.tiqcdn.com/utag/hrs/whitelabel/"+u+"/utag.js",r=document,i="script",t=r.createElement(i);t.src=n;t.type="text/java"+i;t.async=!0;n=r.getElementsByTagName(i)[0];n.parentNode.insertBefore(t,n)}}function TrackPageView(){if(typeof md.mpsc=="undefined"&&$.extend(md,baseMd),typeof utag=="undefined")CreateTrackingTag();else try{utag.view(md)}catch(n){}}function GetRoomCategoryShort(n){return n?(n=n.toLowerCase(),roomCategories.hasOwnProperty(n)?roomCategories[n]:""):"UNK"}function GetTariffForGtm(n,t,i,r){return n?t?"BUSINESSFLEX":i?"BUSINESSHOT":"BUSINESSBASIC":r?"ARRANGEMENT":t?"FLEX":i?"HOT":"BASIC"}function GetProductsFromSelectedRates(n,t){var h=[],u,e,f,o;if(n&&n.length&&n.length>0){for(u=[],e=0;e<n.length;e++)f=n[e],u[f.Id]=u[f.Id]||[],u[f.Id].push(f);for(o in u)if(u.hasOwnProperty(o)){var i=u[o][0],s=u[o].length,c="";i.OfferForBooking.totalWasPriceInclusiveCustomer!==null&&i.OfferForBooking.totalWasPriceInclusiveCustomer.amount!==null&&(c=(i.OfferForBooking.totalWasPriceInclusiveCustomer.amount/t.duration).toFixed(2));var v=i.Rate.BusinessTariff===!0,y=i.Rate.FlexOffer===!0,p=i.Rate.HotDeal===!0,w=i.OfferForBooking.package!==null,l=GetRoomCategoryShort(i.Title),a=GetTariffForGtm(v,y,p,w),r="[HKEY]:[RTYPE]:[RCAT]:[TTYPE]";r=r.replace("[HKEY]",HotelKey);r=r.replace("[RTYPE]",i.Roomtype.toLowerCase()==="single"?"1":"2");r=r.replace("[RCAT]",l);r=r.replace("[TTYPE]",a);h.push({name:DETAIL.hotelName,id:r,dimension4:l,price:i.Rate.PricePerNightCustomer.toFixed(2),dimension1:c,dimension8:(i.Rate.PricePerNightCustomer*s*t.duration).toFixed(2),brand:"0",category:i.Rate.CancellationPossible?"Y":"N",variant:"N",dimension3:i.AvailabilityNumber,dimension2:a,quantity:s*t.duration,dimension6:i.Rate.BreakfastInclusive?"Y":"N",dimension7:i.Rate.PriceBreakfastCustomer>0?i.Rate.PriceBreakfastCustomer.toFixed(2):"",metric1:s,metric2:t.duration})}}return h}function GetCurrentPageObject(){var n={name:"",isHomePage:!1,isHotelListPage:!1,isHotelDetailPage:!1,isErrorPage:!1,isPrivacyPage:!1},t=$("body");switch(!0){case t.hasClass("start"):n.name="Homepage";n.isHomePage=!0;break;case t.hasClass("hotellist"):n.name="Hotel List";n.isHotelListPage=!0;break;case t.hasClass("detail-page"):n.name="Hotel Detail";n.isHotelDetailPage=!0;break;case t.hasClass("page-404"):n.name="Error Page 404";n.isErrorPage=!0;break;case t.hasClass("page-privacy"):n.name="Cookie Policy";n.isPrivacyPage=!0;break;default:n.name="Unknown Page"}return n}function StringifyObjectValues(n){var r,t,i;if(Array.isArray(n))return r=n.slice(0),$.each(r,function(n,t){r[n]=StringifyObjectValues(t)}),r;t=$.extend(!0,{},n);for(i in t)t.hasOwnProperty(i)&&(typeof t[i]=="object"&&t[i]!==null?t[i]=StringifyObjectValues(t[i]):t[i]===""||typeof t[i]=="undefined"?t[i]=undefined:typeof t[i]!="string"&&(t[i]=new String(t[i]).valueOf()));return t}function PushObjIntoDataLayer(n){var t=StringifyObjectValues(n);window.dataLayer=window.dataLayer||[];window.dataLayer.push(t)}function GetDataLayerObject(){var n={},t,r,u,i;for(n.adultCount=0,n.childCount=0,n.singleRoomCount=0,n.doubleRoomCount=0,t=wizardGetBaseSearchobject(),n.rooms=t.Rooms,r=0;r<t.Rooms.length;r++)u=t.Rooms[r],n.adultCount+=u.Adults,n.childCount+=u.Children,u.Roomtype===1?n.singleRoomCount++:n.doubleRoomCount++;return n.arrival=moment({year:t.StartDateYear,month:t.StartDateMonth-1,day:t.StartDateDay}),n.departure=moment({year:t.EndDateYear,month:t.EndDateMonth-1,day:t.EndDateDay}),n.today=moment(),n.duration=n.departure.diff(n.arrival,"days"),n.daysToArrival=Math.ceil(moment.duration(n.arrival.diff(n.today)).asDays()),n.SearchId=window.searchId,n.SearchTerm=WL.Destination,n.SearchType=GetSearchType(),n.Leisure=getIntFromUrl("leisure")===1,i=GetDestinationData(),n.LocationId=WL.LocationIdSelected,n.DestinationCity=i.City,n.DestinationRegion=i.Region,n.DestinationContinent=i.Continent,n.DestinationCountry=i.Country,n}function GetDestinationData(){var i={City:"",Region:"",Continent:"",Country:""},o=WL.Destination!==""?WL.Destination:getUrlParameter("Location"),n=o.split(" - "),t,f,e,r,u;return n.length&&n.length>0&&(t=getLocCategoryFromSession(),(t==="LOC"||t==="DIST"||t==="POI")&&(f=n[0].split(" "),e=f.filter(function(n){return n.indexOf("(")<0&&n.indexOf(")")<0}).join(" "),i.City=e),t==="REG"&&(r="",n.length===2?r=n[0]:n.length===3&&(r=n[1]),i.Region=r),u="",n.length===2?n[1].length===3&&(u=n[1]):n.length===3&&n[2].length===3&&(u=n[2]),i.Country=get2LetterCountryCodeBy3Letter(u)),i}function GetSearchType(){var n=getLocCategoryFromSession();return n==="LOC"?"0":n==="DIST"?"1":n==="REG"?"2":n==="POI"?"3":""}function GetBestprice(n){var f=0,i=0,t,r,u;if(n&&n.length&&n.length>0)for(t=0;t<n.length;t++)if(n[t].room.roomType==="single")for(r=0;r<n[t].offers.length;r++)(f===0||f>n[t].offers[r].totalPriceInclusiveCustomer.amount)&&(f=n[t].offers[r].totalPriceInclusiveCustomer.amount);else if(n[t].room.roomType==="double")for(u=0;u<n[t].offers.length;u++)(i===0||i>n[t].offers[u].totalPriceInclusiveCustomer.amount)&&(i=n[t].offers[u].totalPriceInclusiveCustomer.amount);return i>0?i:f}function GetBestWasPrice(n){var f=0,u=0,t,i,r;if(n&&n.length&&n.length>0)for(t=0;t<n.length;t++)if(n[t].room.roomType==="single")for(i=0;i<n[t].offers.length;i++)n[t].offers[i].totalWasPriceInclusiveCustomer&&n[t].offers[i].totalWasPriceInclusiveCustomer.amount&&(f===0||f>n[t].offers[i].totalWasPriceInclusiveCustomer.amount)&&(f=n[t].offers[i].totalWasPriceInclusiveCustomer.amount);else if(n[t].room.roomType==="double")for(r=0;r<n[t].offers.length;r++)n[t].offers[r].totalWasPriceInclusiveCustomer&&n[t].offers[r].totalWasPriceInclusiveCustomer.amount&&(u===0||u>n[t].offers[r].totalWasPriceInclusiveCustomer.amount)&&(u=n[t].offers[r].totalWasPriceInclusiveCustomer.amount);return u>0?u:f}function GetCookieConsent(){return document.cookie.indexOf("consentCookie=accepted")>-1?"accepted":document.cookie.indexOf("consentCookie=declined")>-1?"declined":document.cookie.indexOf("consentCookie=default")>-1?"default":""}function InitGtm(){if(!gtmOldTrackingDisabled){if(typeof GoogleTagManagerContainerId!="string"||typeof GoogleTagManagerAuth!="string"||typeof GoogleTagManagerPreview!="string")return;(function(n,t,i,r,u){n[r]=n[r]||[];n[r].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var e=t.getElementsByTagName(i)[0],f=t.createElement(i),o=r!="dataLayer"?"&l="+r:"";f.async=!0;f.src="https://www.googletagmanager.com/gtm.js?id="+u+o+"&gtm_auth="+GoogleTagManagerAuth+"&gtm_preview="+GoogleTagManagerPreview+"&gtm_cookies_win=x";e.parentNode.insertBefore(f,e)})(window,document,"script","dataLayer",GoogleTagManagerContainerId)}}function InitGtmGA4(){}var currency=getUrlParameter("cur"),md,mpc,baseMd;currency=currency===""?"EUR":currency.toUpperCase();md={};mpc="";getIntFromUrl("leisure")===1&&(mpc=getUrlParameter("customerid2"));mpc===""&&(mpc=getUrlParameter("customerid"));baseMd={mpsc:"Partner",mpc:mpc,mpcc:currency,mplocale:getUrlParameter("lang")};var GTM=window.GTM||{},GTMGA4=window.GTMGA4||{},gtmDoTrack=!0,gtmOldTrackingDisabled=!0,roomCategories={standard:"STA",comfort:"COM",superior:"SUP",juniorsuite:"JUN",suite:"SUI",apartment:"APA",family:"FAM",business:"BUS",terrace:"TER",balcony:"BAL",ocean:"SEA",lake:"LAK",river:"RIV",pool:"POO",mountain:"MOU",economy:"ECO"};GTM.AddPageViewEvent=function(n,t){var f,e,o;if(gtmOldTrackingDisabled)n&&InitGtmGA4();else{if(!gtmDoTrack){console.log("AddPageViewEvent("+n+", "+t+")");return}var r=GetCurrentPageObject(),i=!r.isPrivacyPage&&!r.isErrorPage?GetDataLayerObject():null,u={event:"whitelabelPageView",pageLanguage:window.Common.Language,pageCurrency:window.Common.CurrencyCode,pageName:t||r.name,pageProduct:"Partner",pageVersion:"1",pageKKey:getUrlParameter("customerid"),pageFKey:getUrlParameter("customerid2"),pagePartnerName:window.CustomClient};r.isPrivacyPage&&(u.pagePagination="1",u.userConsent=GetCookieConsent());r.isHotelListPage&&(u.pagePagination="1");r.isHomePage||r.isPrivacyPage||r.isErrorPage||(u.pageHierarchyDestination="",u.searchType=i.SearchType);i!==null&&(f={userMyHRSID:"",userType:"99",availabilityLocationID:i.LocationId,availabilitySingleRooms:i.singleRoomCount,availabilityDoubleRooms:i.doubleRoomCount,availabilityDateOfArrival:i.arrival.format("YYYY-MM-DD"),availabilityDateOfDeparture:i.departure.format("YYYY-MM-DD"),availabilityDurationOfStay:i.duration,availabilityDaysToArrival:i.daysToArrival,availabilityAdults:i.adultCount,availabilityChildren:i.childCount,searchID:i.SearchId,searchTerm:i.SearchTerm,searchTravelReason:"private"},r.isHotelListPage&&(f.searchNumberOfResults=RESULTS.count,f.isSearchResultPage=i.SearchId?"Y":"N",f.destinationCity=i.DestinationCity,f.destinationRegion=i.DestinationRegion,f.destinationContinent=i.DestinationContinent,f.destinationCountry=i.DestinationCountry),$.extend(u,f),r.isHotelDetailPage&&(e={hotelID:HotelKey,hotelName:DETAIL.hotelName,hotelType:"",hotelLocationID:DETAIL.locationId,hotelLocationName:DETAIL.city,hotelLocationLatitude:DETAIL.lat,hotelLocationLongitude:DETAIL.lon,hotelChainID:DETAIL.chainId,hotelCategory:DETAIL.category,hotelImageURL:DETAIL.imageUrl,hotelImageTotal:DETAIL.imageTotal,hotelSource:"0",hotelRatingAverage:DETAIL.ratingAverage,hotelLocationZIP:DETAIL.postalCode,hotelLocationCity:DETAIL.city,hotelLocationRegion:DETAIL.region,hotelLocationCountry:get2LetterCountryCodeBy3Letter(DETAIL.iso3Country),hotelRatingNumberTotal:DETAIL.ratingNumberTotal},$.extend(u,e)));o=StringifyObjectValues(u);n?(window.dataLayer=[o],InitGtm(),InitGtmGA4()):PushObjIntoDataLayer(u)}};GTM.AvailabilityCheck=function(){var r;if(!gtmOldTrackingDisabled){if(!gtmDoTrack){console.log("AvailabilityCheck()");return}var t=GetCurrentPageObject(),n=GetDataLayerObject(),i={event:"whitelabelAvailabilityCheck",availabilityLocationID:n.LocationId,availabilitySingleRooms:n.singleRoomCount,availabilityDoubleRooms:n.doubleRoomCount,availabilityDateOfArrival:n.arrival.format("YYYY-MM-DD"),availabilityDateOfDeparture:n.departure.format("YYYY-MM-DD"),availabilityDurationOfStay:n.duration,availabilityDaysToArrival:n.daysToArrival,availabilityAdults:n.adultCount,availabilityChildren:n.childCount};t.isHotelDetailPage&&(r={hotelID:HotelKey,hotelName:DETAIL.hotelName,hotelType:"",hotelLocationID:DETAIL.locationId,hotelLocationName:DETAIL.city,hotelLocationLatitude:DETAIL.lat,hotelLocationLongitude:DETAIL.lon,hotelChainID:DETAIL.chainId,hotelCategory:DETAIL.category,hotelImageURL:DETAIL.imageUrl,hotelImageTotal:DETAIL.imageTotal,hotelSource:"0",hotelRatingAverage:DETAIL.ratingAverage,hotelLocationZIP:DETAIL.postalCode,hotelLocationCity:DETAIL.city,hotelLocationRegion:DETAIL.region,hotelLocationCountry:get2LetterCountryCodeBy3Letter(DETAIL.iso3Country),hotelRatingNumberTotal:DETAIL.ratingNumberTotal,pageName:t.name,pageProduct:"Partner"},$.extend(i,r));PushObjIntoDataLayer(i)}};GTM.SearchInquiry=function(){if(!gtmOldTrackingDisabled){if(!gtmDoTrack){console.log("SearchInquiry()");return}var t=GetCurrentPageObject(),n=GetDataLayerObject(),i={event:"whitelabelSearchInquiry",pageName:t.name,pageProduct:"Partner",searchID:n.SearchId,searchTerm:n.SearchTerm,searchType:n.SearchType,searchTravelReason:"private",availabilityLocationID:n.LocationId,availabilitySingleRooms:n.singleRoomCount,availabilityDoubleRooms:n.doubleRoomCount,availabilityDateOfArrival:n.arrival.format("YYYY-MM-DD"),availabilityDateOfDeparture:n.departure.format("YYYY-MM-DD"),availabilityDurationOfStay:n.duration,availabilityDaysToArrival:n.daysToArrival,availabilityAdults:n.adultCount,availabilityChildren:n.childCount};PushObjIntoDataLayer(i)}};GTM.HeaderElementClick=function(){if(!gtmOldTrackingDisabled){if(!gtmDoTrack){console.log("HeaderElementClick()");return}var n=GetCurrentPageObject(),t={event:"whitelabelElementClick",elementClickName:"Header",elementClickPosition:"1",elementClickAdditionalInfo:"Logo",pageName:n.name,pageProduct:"Partner"};PushObjIntoDataLayer(t)}};GTM.LanguageButtonElementClick=function(n,t){if(!gtmOldTrackingDisabled){if(!gtmDoTrack){console.log("LanguageButtonElementClick("+n+", "+t+")");return}var i=GetCurrentPageObject(),r={event:"whitelabelElementClick",elementClickName:"Language Selection",elementClickPosition:t,elementClickAdditionalInfo:n,pageName:i.name,pageProduct:"Partner"};PushObjIntoDataLayer(r)}};GTM.FooterLinkElementClick=function(n,t){if(!gtmOldTrackingDisabled){if(!gtmDoTrack){console.log("FooterLinkElementClick("+n+", "+t+")");return}var i=GetCurrentPageObject(),r={event:"whitelabelElementClick",elementClickName:"Footer",elementClickPosition:t,elementClickAdditionalInfo:n,pageName:i.name,pageProduct:"Partner"};PushObjIntoDataLayer(r)}};GTM.PageRollReachHRSWhitelabelHotelList=function(){if(!gtmOldTrackingDisabled){if(!gtmDoTrack){console.log("PageRollReachHRSWhitelabelHotelList()");return}PushObjIntoDataLayer({event:"whitelabelScrollReachHRSHotelList",viewedSection:"Header"})}};GTM.GAWhitelabelEventHotelListView=function(n){var r,h;if(!gtmOldTrackingDisabled){if(!gtmDoTrack){console.log("GAWhitelabelEventHotelListView(hotelListViewObj)");return}var u=GetCurrentPageObject(),t=GetDataLayerObject(),f=[];if(n&&n.length&&n.length>0)for(r=0;r<n.length;r++)if(typeof n[r]!="undefined"){var i=n[r],e=GetBestprice(i.roomOffers),c=e>0?(e/t.duration).toFixed(2):"",o=GetBestWasPrice(i.roomOffers),l=o>0?(o/t.duration).toFixed(2):"",a=i.roomOffers[0].offers[0].includedRebateType==="company",v=i.roomOffers[0].offers[0].flexOffer===!0,y=i.roomOffers[0].offers[0].hotDeal===!0,p=i.roomOffers[0].offers[0].package!==null,w=GetTariffForGtm(a,v,y,p),s="";i.hotel.ratings&&i.hotel.ratings.length&&i.hotel.ratings.length>0&&(s=i.hotel.ratings[0].averageRating);f.push({name:i.hotel.hotelName,id:i.hotelKey,price:c,dimension1:l,brand:"0",category:i.hotel.category,variant:s,list:u.name,dimension2:w,dimension3:i.roomOffers[0].offers[0].roomsLeft,position:r+1})}h={event:"whitelabelHotelListView",pageName:u.name,pageProduct:"Partner",searchID:t.SearchId,searchTerm:t.SearchTerm,searchType:t.SearchType,searchTravelReason:"private",searchNumberOfResults:u.isHotelListPage?RESULTS.count:"",availabilityLocationID:t.LocationId,availabilitySingleRooms:t.singleRoomCount,availabilityDoubleRooms:t.doubleRoomCount,availabilityDateOfArrival:t.arrival.format("YYYY-MM-DD"),availabilityDateOfDeparture:t.departure.format("YYYY-MM-DD"),availabilityDurationOfStay:t.duration,availabilityDaysToArrival:t.daysToArrival,availabilityAdults:t.adultCount,availabilityChildren:t.childCount,destinationCity:t.DestinationCity,destinationRegion:t.DestinationRegion,destinationContinent:t.DestinationContinent,destinationCountry:t.DestinationCountry,hotelListSearchView:"List",ecommerce:{currencyCode:"EUR",impressions:f.length>0?f:""}};PushObjIntoDataLayer(h)}};GTM.GAWhitelabelEventHotelListClick=function(n,t,i){if(!gtmOldTrackingDisabled){if(!gtmDoTrack){console.log("GAWhitelabelEventHotelListClick(productObj, "+t+", "+i+")");return}var r=GetDataLayerObject(),u=GetBestprice(n.roomOffers),o=u>0?(u/r.duration).toFixed(2):"",f=GetBestWasPrice(n.roomOffers),s=f>0?(f/r.duration).toFixed(2):"",e="";n.hotel.ratings&&n.hotel.ratings.length&&n.hotel.ratings.length>0&&(e=n.hotel.ratings[0].averageRating);var h=n.roomOffers[0].offers[0].includedRebateType==="company",c=n.roomOffers[0].offers[0].flexOffer===!0,l=n.roomOffers[0].offers[0].hotDeal===!0,a=n.roomOffers[0].offers[0].package!==null,v=GetTariffForGtm(h,c,l,a),y={event:"whitelabelHotelListClick",hotelListSearchView:"List",elementClickName:i,elementClickPosition:t,elementClickAdditionalInfo:n.hotel.hotelName,ecommerce:{currencyCode:"EUR",click:{actionField:{list:"Hotel List"},products:[{name:n.hotel.hotelName,id:n.hotelKey,price:o,dimension1:s,brand:"0",category:n.hotel.category,variant:e,dimension2:v,dimension3:n.roomOffers[0].offers[0].roomsLeft,position:t}]}}};PushObjIntoDataLayer(y)}};GTM.OpenMapViewElementClick=function(){if(!gtmOldTrackingDisabled){if(!gtmDoTrack){console.log("OpenMapViewElementClick()");return}var n=GetCurrentPageObject(),t={event:"whitelabelElementClick",elementClickName:"Hotel List",elementClickPosition:"1",elementClickAdditionalInfo:"Map View",pageName:n.name,pageProduct:"Partner"};PushObjIntoDataLayer(t)}};GTM.GAWhitelabelEventApplyFilterPriceRange=function(n,t){if(!gtmOldTrackingDisabled){if(!gtmDoTrack){console.log("GAWhitelabelEventApplyFilterPriceRange("+n+", hotelListViewObj)");return}var i={event:"whitelabelApplyFilterPriceRange",searchFilterPriceLow:"0.00",searchFilterPriceHigh:n.toFixed(2).toString()};PushObjIntoDataLayer(i);GTM.GAWhitelabelEventHotelListView(t)}};GTM.GAWhitelabelEventSelectFilter=function(n,t){if(!gtmOldTrackingDisabled){if(!gtmDoTrack){console.log("GAWhitelabelEventSelectFilter("+n+", hotelListViewObj)");return}var i={event:"whitelabelSelectFilter",searchFilterOption:n};PushObjIntoDataLayer(i);GTM.GAWhitelabelEventHotelListView(t)}};GTM.GAWhitelabelEventUnselectFilter=function(n,t){if(!gtmOldTrackingDisabled){if(!gtmDoTrack){console.log("GAWhitelabelEventUnselectFilter("+n+", hotelListViewObj)");return}var i={event:"whitelabelUnselectFilter",searchFilterOption:n};PushObjIntoDataLayer(i);GTM.GAWhitelabelEventHotelListView(t)}};GTM.GAWhitelabelEventApplyFilterRatingRange=function(n,t){if(!gtmOldTrackingDisabled){if(!gtmDoTrack){console.log("GAWhitelabelEventApplyFilterRatingRange("+n+", hotelListViewObj)");return}var i={event:"whitelabelApplyFilterRatingRange",searchFilterRatingLow:n.toFixed(1),searchFilterRatingHigh:"10.0"};PushObjIntoDataLayer(i);GTM.GAWhitelabelEventHotelListView(t)}};GTM.GAWhitelabelEventApplyFilterHRSStars=function(n,t){if(!gtmOldTrackingDisabled){if(!gtmDoTrack){console.log("GAWhitelabelEventApplyFilterHRSStars("+n+", hotelListViewObj)");return}var i={event:"whitelabelApplyFilterHRSStars",searchFilterHRSStarsLow:n.toFixed(1),searchFilterHRSStarsHigh:"5.0"};PushObjIntoDataLayer(i);GTM.GAWhitelabelEventHotelListView(t)}};GTM.GAWhitelabelEventElementClick=function(n){if(!gtmOldTrackingDisabled){if(!gtmDoTrack){console.log("GAWhitelabelEventElementClick(hotelListViewObj)");return}PushObjIntoDataLayer({event:"whitelabelElementClick",elementClickName:"Hotel List",elementClickPosition:"1",elementClickAdditionalInfo:"Filter - Reset",pageName:"Hotel List",pageProduct:"Partner"});GTM.GAWhitelabelEventHotelListView(n)}};GTM.GAWhitelabelEventApplySorting=function(n,t,i){if(!gtmOldTrackingDisabled){if(!gtmDoTrack){console.log("GAWhitelabelEventApplySorting("+n+", "+t+", hotelListViewObj)");return}var r={event:"whitelabelApplySorting",searchResultSortingCriteria:n,searchResultSortingDirection:t};PushObjIntoDataLayer(r);GTM.GAWhitelabelEventHotelListView(i)}};GTM.GAWhitelabelEventHotelDetailView=function(n){var i,u,f,t,e,c,o;if(!gtmOldTrackingDisabled){if(!gtmDoTrack){console.log("GAWhitelabelEventHotelDetailView(roomDetailList)");return}if(i=GetDataLayerObject(),u=[],n&&n.length&&n.length>0)for(f=0;f<n.length;f++){t=n[f];e="";t.OfferForBooking.totalWasPriceInclusiveCustomer!==null&&t.OfferForBooking.totalWasPriceInclusiveCustomer.amount!==null&&(e=(t.OfferForBooking.totalWasPriceInclusiveCustomer.amount/i.duration).toFixed(2));var l=t.Rate.BusinessTariff===!0,a=t.Rate.FlexOffer===!0,v=t.Rate.HotDeal===!0,y=t.OfferForBooking.package!==null,s=GetRoomCategoryShort(t.Title),h=GetTariffForGtm(l,a,v,y),r="[HKEY]:[RTYPE]:[RCAT]:[TTYPE]";r=r.replace("[HKEY]",HotelKey);r=r.replace("[RTYPE]",t.Roomtype.toLowerCase()==="single"?"1":"2");r=r.replace("[RCAT]",s);r=r.replace("[TTYPE]",h);u.push({name:DETAIL.hotelName,id:r,dimension4:s,price:t.Rate.PricePerNightCustomer.toFixed(2),dimension1:e,brand:"0",category:t.Rate.CancellationPossible?"Y":"N",variant:"N",dimension3:t.AvailabilityNumber,dimension2:h,dimension6:t.Rate.BreakfastInclusive?"Y":"N",dimension7:t.Rate.PriceBreakfastCustomer>0?t.Rate.PriceBreakfastCustomer.toFixed(2):"",metric2:i.duration})}c={hotelLocationID:DETAIL.locationId,hotelLocationName:DETAIL.city,hotelLocationLatitude:DETAIL.lat,hotelLocationLongitude:DETAIL.lon,hotelID:HotelKey,hotelName:DETAIL.hotelName,hotelChainID:DETAIL.chainId,hotelCategory:DETAIL.category,hotelRatingAverage:DETAIL.ratingAverage,hotelRatingNumberTotal:DETAIL.ratingNumberTotal,hotelImageURL:DETAIL.imageUrl,hotelImageTotal:DETAIL.imageTotal,hotelSource:"0",hotelType:"",hotelLocationZIP:DETAIL.postalCode,hotelLocationCity:DETAIL.city,hotelLocationRegion:DETAIL.region,hotelLocationCountry:get2LetterCountryCodeBy3Letter(DETAIL.iso3Country)};o={event:"whitelabelHotelDetailsView",availabilitySingleRooms:i.singleRoomCount,availabilityDoubleRooms:i.doubleRoomCount,numberOfRoomsTotal:i.singleRoomCount+i.doubleRoomCount,numberOfPersonsTotal:i.adultCount+i.childCount,availabilityAdults:i.adultCount,availabilityChildren:i.childCount,searchTravelReason:"private",availabilityDateOfArrival:i.arrival.format("YYYY-MM-DD"),availabilityDateOfDeparture:i.departure.format("YYYY-MM-DD"),availabilityDurationOfStay:i.duration,availabilityDaysToArrival:i.daysToArrival,ecommerce:{currencyCode:"EUR",detail:{actionField:{list:"Hotel Detail"},products:u.length>0?u:""}}};$.extend(o,c);PushObjIntoDataLayer(o)}};GTM.GAWhitelabelHotelImageViews=function(n){if(!gtmOldTrackingDisabled){if(!gtmDoTrack){console.log("GAWhitelabelHotelImageViews("+n+")");return}var t={event:"whitelabelHotelImageView",hotelImageURL:n,hotelID:HotelKey,hotelName:DETAIL.hotelName,hotelSource:"0",hotelType:"",hotelLocationID:DETAIL.locationId,hotelLocationName:DETAIL.city,hotelLocationLatitude:DETAIL.lat,hotelLocationLongitude:DETAIL.lon,hotelLocationZIP:DETAIL.postalCode,hotelLocationCity:DETAIL.city,hotelLocationRegion:DETAIL.region,hotelLocationCountry:get2LetterCountryCodeBy3Letter(DETAIL.iso3Country),hotelRatingAverage:DETAIL.ratingAverage,hotelRatingNumberTotal:DETAIL.ratingNumberTotal,hotelChainID:DETAIL.chainId,hotelCategory:DETAIL.category};PushObjIntoDataLayer(t)}};GTM.GAWhitelabelEventAddToCart=function(){if(!gtmOldTrackingDisabled){if(!gtmDoTrack){console.log("GAWhitelabelEventAddToCart()");return}var n=GetDataLayerObject(),i={hotelID:HotelKey,hotelChainID:DETAIL.chainId,hotelCategory:DETAIL.category,hotelSource:"0",hotelType:"",hotelImageURL:DETAIL.imageUrl,hotelImageTotal:DETAIL.imageTotal,hotelRatingAverage:DETAIL.ratingAverage,hotelRatingNumberTotal:DETAIL.ratingNumberTotal,hotelLocationZIP:DETAIL.postalCode,hotelLocationCity:DETAIL.city,hotelLocationRegion:DETAIL.region,hotelLocationCountry:get2LetterCountryCodeBy3Letter(DETAIL.iso3Country),hotelLocationID:DETAIL.locationId,hotelLocationName:DETAIL.city,hotelLocationLatitude:DETAIL.lat,hotelLocationLongitude:DETAIL.lon},t={event:"whitelabelAddToCart",availabilitySingleRooms:n.singleRoomCount,availabilityDoubleRooms:n.doubleRoomCount,numberOfRoomsTotal:n.singleRoomCount+n.doubleRoomCount,numberOfPersonsTotal:n.adultCount+n.childCount,availabilityAdults:n.adultCount,availabilityChildren:n.childCount,searchTravelReason:"private",availabilityDateOfArrival:n.arrival.format("YYYY-MM-DD"),availabilityDateOfDeparture:n.departure.format("YYYY-MM-DD"),availabilityDurationOfStay:n.duration,availabilityDaysToArrival:n.daysToArrival,ecommerce:{currencyCode:"EUR",add:{products:[{name:"SOHO Hotel",id:"118196:2:JUN:FLEX",dimension4:"JUN",price:"35.45",dimension1:"55.00",dimension8:"106.35",brand:"0",category:"Y",variant:"Y",dimension3:"3",dimension2:"FLEX",quantity:"3",dimension6:"Y",dimension7:"25.00",metric1:"1"}]}}};$.extend(t,i);PushObjIntoDataLayer(t)}};GTM.GAWhitelabelEventRemoveFromCart=function(){if(!gtmOldTrackingDisabled){if(!gtmDoTrack){console.log("GAWhitelabelEventRemoveFromCart()");return}var n=GetDataLayerObject(),i={hotelID:HotelKey,hotelChainID:DETAIL.chainId,hotelCategory:DETAIL.category,hotelSource:"0",hotelType:"",hotelImageURL:DETAIL.imageUrl,hotelImageTotal:DETAIL.imageTotal,hotelRatingAverage:DETAIL.ratingAverage,hotelRatingNumberTotal:DETAIL.ratingNumberTotal,hotelLocationZIP:DETAIL.postalCode,hotelLocationCity:DETAIL.city,hotelLocationRegion:DETAIL.region,hotelLocationCountry:get2LetterCountryCodeBy3Letter(DETAIL.iso3Country),hotelLocationID:DETAIL.locationId,hotelLocationName:DETAIL.city,hotelLocationLatitude:DETAIL.lat,hotelLocationLongitude:DETAIL.lon},t={event:"whitelabelRemoveFromCart",availabilitySingleRooms:n.singleRoomCount,availabilityDoubleRooms:n.doubleRoomCount,numberOfRoomsTotal:n.singleRoomCount+n.doubleRoomCount,numberOfPersonsTotal:n.adultCount+n.childCount,availabilityAdults:n.adultCount,availabilityChildren:n.childCount,searchTravelReason:"private",availabilityDateOfArrival:n.arrival.format("YYYY-MM-DD"),availabilityDateOfDeparture:n.departure.format("YYYY-MM-DD"),availabilityDurationOfStay:n.duration,availabilityDaysToArrival:n.daysToArrival,ecommerce:{currencyCode:"EUR",remove:{products:[{name:"SOHO Hotel",id:"118196:2:JUN:FLEX",dimension4:"JUN",price:"35.45",dimension1:"55.00",dimension8:"106.35",brand:"0",category:"Y",variant:"Y",dimension3:"3",dimension2:"FLEX",quantity:"3",dimension6:"Y",dimension7:"25.00",metric1:"1"}]}}};$.extend(t,i);PushObjIntoDataLayer(t)}};GTM.NavigationPopoutLinksElementClick=function(n){if(!gtmOldTrackingDisabled){if(!gtmDoTrack){console.log("NavigationPopoutLinksElementClick("+n+")");return}var t=GetCurrentPageObject(),i={event:"whitelabelElementClick",elementClickName:"Hotel Detail - Navigation",elementClickPosition:"1",elementClickAdditionalInfo:n,pageName:t.name,pageProduct:"Partner"};PushObjIntoDataLayer(i)}};GTM.GAWhitelabelEventCheckoutStep1=function(n){if(!gtmOldTrackingDisabled){if(!gtmDoTrack){console.log("GAWhitelabelEventCheckoutStep1(selectedRates)");return}var t=GetDataLayerObject(),i=GetProductsFromSelectedRates(n,t),u={hotelID:HotelKey,hotelName:DETAIL.hotelName,hotelChainID:DETAIL.chainId,hotelCategory:DETAIL.category,hotelSource:"0",hotelType:"",hotelImageURL:DETAIL.imageUrl,hotelImageTotal:DETAIL.imageTotal,hotelRatingAverage:DETAIL.ratingAverage,hotelRatingNumberTotal:DETAIL.ratingNumberTotal,hotelLocationZIP:DETAIL.postalCode,hotelLocationCity:DETAIL.city,hotelLocationRegion:DETAIL.region,hotelLocationCountry:get2LetterCountryCodeBy3Letter(DETAIL.iso3Country),hotelLocationID:DETAIL.locationId,hotelLocationName:DETAIL.city,hotelLocationLatitude:DETAIL.lat,hotelLocationLongitude:DETAIL.lon},r={event:"whitelabelCheckoutStep1",checkoutStep:"1 - Checkout Started",availabilitySingleRooms:t.singleRoomCount,availabilityDoubleRooms:t.doubleRoomCount,numberOfRoomsTotal:t.singleRoomCount+t.doubleRoomCount,numberOfPersonsTotal:t.adultCount+t.childCount,availabilityAdults:t.adultCount,availabilityChildren:t.childCount,searchTravelReason:"private",availabilityDateOfArrival:t.arrival.format("YYYY-MM-DD"),availabilityDateOfDeparture:t.departure.format("YYYY-MM-DD"),availabilityDurationOfStay:t.duration,availabilityDaysToArrival:t.daysToArrival,ecommerce:{currencyCode:"EUR",checkout:{actionField:{step:1},products:i.length>0?i:""}}};$.extend(r,u);PushObjIntoDataLayer(r)}};GTM.GAWhitelabelEventCheckoutStep2=function(n,t){if(!gtmOldTrackingDisabled){if(!gtmDoTrack){console.log("GAWhitelabelEventCheckoutStep2(requestData, selectedRates)");return}var i=GetDataLayerObject(),r=GetProductsFromSelectedRates(t,i),f={hotelID:HotelKey,hotelName:DETAIL.hotelName,hotelChainID:DETAIL.chainId,hotelCategory:DETAIL.category,hotelSource:"0",hotelType:"",hotelImageURL:DETAIL.imageUrl,hotelImageTotal:DETAIL.imageTotal,hotelRatingAverage:DETAIL.ratingAverage,hotelRatingNumberTotal:DETAIL.ratingNumberTotal,hotelLocationZIP:DETAIL.postalCode,hotelLocationCity:DETAIL.city,hotelLocationRegion:DETAIL.region,hotelLocationCountry:get2LetterCountryCodeBy3Letter(DETAIL.iso3Country),hotelLocationID:DETAIL.locationId,hotelLocationName:DETAIL.city,hotelLocationLatitude:DETAIL.lat,hotelLocationLongitude:DETAIL.lon},u={event:"whitelabelCheckoutStep2",checkoutStep:"2 - Checkout Enter User Details",availabilitySingleRooms:i.singleRoomCount,availabilityDoubleRooms:i.doubleRoomCount,numberOfRoomsTotal:i.singleRoomCount+i.doubleRoomCount,numberOfPersonsTotal:i.adultCount+i.childCount,availabilityAdults:i.adultCount,availabilityChildren:i.childCount,additionalHotelRequestsText:n.ReservationWish,searchTravelReason:"private",availabilityDateOfArrival:i.arrival.format("YYYY-MM-DD"),availabilityDateOfDeparture:i.departure.format("YYYY-MM-DD"),availabilityDurationOfStay:i.duration,availabilityDaysToArrival:i.daysToArrival,bookingCheckoutType:"0",bookingCreditCardType:CcRequired&&n.PcibookingCardType?n.PcibookingCardType:"",bookingCreditCardRequired:CcRequired===!0?"Y":"N",ecommerce:{currencyCode:"EUR",checkout:{actionField:{step:2},products:r.length>0?r:""}}};$.extend(u,f);PushObjIntoDataLayer(u)}};GTM.GeneralTCLinkElementClick=function(){if(!gtmOldTrackingDisabled){if(!gtmDoTrack){console.log("GeneralTCLinkElementClick()");return}PushObjIntoDataLayer({event:"whitelabelElementClick",elementClickName:"Booking Form",elementClickPosition:"1",elementClickAdditionalInfo:"T & C for Reservations",pageName:"Booking Form",pageProduct:"Partner"})}};GTM.GAWhitelabelEventBookingSuccess=function(n,t,i){if(!gtmOldTrackingDisabled){if(!gtmDoTrack){console.log("GAWhitelabelEventBookingSuccess(requestData, bookingData, selectedRates)");return}var r=GetDataLayerObject(),u=GetProductsFromSelectedRates(i,r),e=n.RoomOffer[0].Offer.taxesAndFees.reduce(function(n,t){return t.taxAndFeeType!=="vat"&&t.taxAndFeeType!=="cityTax"?n:n+t.amountTotalCustomer.amount},0),o={hotelID:HotelKey,hotelName:DETAIL.hotelName,hotelChainID:DETAIL.chainId,hotelCategory:DETAIL.category,hotelSource:"0",hotelType:"",hotelImageURL:DETAIL.imageUrl,hotelImageTotal:DETAIL.imageTotal,hotelRatingAverage:DETAIL.ratingAverage,hotelRatingNumberTotal:DETAIL.ratingNumberTotal,hotelLocationZIP:DETAIL.postalCode,hotelLocationCity:DETAIL.city,hotelLocationRegion:DETAIL.region,hotelLocationCountry:get2LetterCountryCodeBy3Letter(DETAIL.iso3Country),hotelLocationID:DETAIL.locationId,hotelLocationName:DETAIL.city,hotelLocationLatitude:DETAIL.lat,hotelLocationLongitude:DETAIL.lon},f={event:"whitelabelHotelBooking",bookingProcess:"Book",availabilitySingleRooms:r.singleRoomCount,availabilityDoubleRooms:r.doubleRoomCount,numberOfRoomsTotal:r.singleRoomCount+r.doubleRoomCount,numberOfPersonsTotal:r.adultCount+r.childCount,availabilityAdults:r.adultCount,availabilityChildren:r.childCount,additionalHotelRequestsText:n.ReservationWish,searchTravelReason:"private",availabilityDateOfArrival:r.arrival.format("YYYY-MM-DD"),availabilityDateOfDeparture:r.departure.format("YYYY-MM-DD"),availabilityDurationOfStay:r.duration,availabilityDaysToArrival:r.daysToArrival,bookingCheckoutType:"0",bookingCreditCardType:CcRequired&&n.PcibookingCardType?n.PcibookingCardType:"",userBookings:"",userBookingCancelations:"",bookingCreditCardRequired:CcRequired===!0?"Y":"N",ecommerce:{currencyCode:"EUR",purchase:{actionField:{id:t.ReservationProcessKey,revenue:t.TotalPriceCustomer.toFixed(2),tax:e.toFixed(2)},products:u.length>0?u:""}}};$.extend(f,o);PushObjIntoDataLayer(f)}};GTM.PrintBookingConfirmationButtonElementClick=function(){if(!gtmOldTrackingDisabled){if(!gtmDoTrack){console.log("PrintBookingConfirmationButtonElementClick()");return}PushObjIntoDataLayer({event:"whitelabelElementClick",elementClickName:"Print",elementClickPosition:"1",elementClickAdditionalInfo:"Helpful auxiliaries",pageName:"Booking Confirmation",pageProduct:"Partner",bookingID:"82778691"})}};GTM.SMSBookingConfirmationButtonElementClick=function(){if(!gtmOldTrackingDisabled){if(!gtmDoTrack){console.log("SMSBookingConfirmationButtonElementClick()");return}PushObjIntoDataLayer({event:"whitelabelElementClick",elementClickName:"Send as SMS",elementClickPosition:"1",elementClickAdditionalInfo:"Helpful auxiliaries",pageName:"Booking Confirmation",pageProduct:"Partner",bookingID:"82778691"})}};GTM.SendAsEmailButtonElementClick=function(){if(!gtmOldTrackingDisabled){if(!gtmDoTrack){console.log("SendAsEmailButtonElementClick()");return}PushObjIntoDataLayer({event:"whitelabelElementClick",elementClickName:"Send as Email",elementClickPosition:"1",elementClickAdditionalInfo:"Helpful auxiliaries",pageName:"Booking Confirmation",pageProduct:"Partner",bookingID:"82778691"})}};GTM.AddToCalendarButtonElementClick=function(){if(!gtmOldTrackingDisabled){if(!gtmDoTrack){console.log("AddToCalendarButtonElementClick()");return}PushObjIntoDataLayer({event:"whitelabelElementClick",elementClickName:"Show on Calendar",elementClickPosition:"1",elementClickAdditionalInfo:"Helpful auxiliaries",pageName:"Booking Confirmation",pageProduct:"Partner",bookingID:"82778691"})}};GTM.GAWhitelabelEventBookingCancelation=function(){if(!gtmOldTrackingDisabled){if(!gtmDoTrack){console.log("GAWhitelabelEventBookingCancelation()");return}PushObjIntoDataLayer({event:"whitelabelBookingCancelation",bookingProcess:"Cancel",daysBetweenCancelationArrival:"5",ecommerce:{refund:{actionField:{id:"1232456"},products:[{id:"118196:2:JUN:FLEX",quantity:1},{id:"118196:2:STA:FLEX",quantity:1}]}}})}};GTM.CookieButtonElementClick=function(){if(!gtmOldTrackingDisabled){if(!gtmDoTrack){console.log("CookieButtonElementClick()");return}var n=GetCurrentPageObject(),t={event:"whitelabelElementClick",elementClickName:"Accept",elementClickPosition:"2",elementClickAdditionalInfo:"Cookie Banner",pageName:n.name,pageProduct:"Partner",pageKKey:getUrlParameter("customerid"),userConsent:GetCookieConsent()};PushObjIntoDataLayer(t)}};GTM.MoreInformationElementClick=function(){if(!gtmOldTrackingDisabled){if(!gtmDoTrack){console.log("MoreInformationElementClick()");return}var n=GetCurrentPageObject(),t={event:"whitelabelElementClick",elementClickName:"More Information",elementClickPosition:"0",elementClickAdditionalInfo:"Cookie Banner",pageName:n.name,pageProduct:"Partner",pageKKey:getUrlParameter("customerid"),userConsent:GetCookieConsent()};PushObjIntoDataLayer(t)}};GTM.CookiesConsentButtonElementClick=function(n){if(!gtmOldTrackingDisabled){if(!gtmDoTrack){console.log("CookiesConsentButtonElementClick("+n+")");return}var t={event:"whitelabelElementClick",elementClickName:n?"Accept":"Decline",elementClickPosition:"0",elementClickAdditionalInfo:"Cookie Banner",pageName:"Cookie Policy",pageProduct:"Partner",pageKKey:getUrlParameter("customerid"),userConsent:GetCookieConsent()};PushObjIntoDataLayer(t)}};GTMGA4.PushObjIntoDataLayer=function(n){var t=StringifyObjectValues(n);gtmOldTrackingDisabled&&(window.dataLayer=window.dataLayer||[]);window.dataLayer.push(t);console.log("**************************************************************");console.log("DEBUG GA4 DATALAYER #1");console.log("**************************************************************");console.log("window.dataLayer",window.dataLayer);console.log("**************************************************************")};GTMGA4.AddPageViewEvent=function(n,t){var b=GetCurrentPageObject(),s=window.location.search,h=window.location.hostname,o=window.location.pathname,c=window.location.protocol,l=c+"//"+h+o+s,r,e;const a=window.innerWidth<576,v=window.innerWidth>=576&&window.innerWidth<992,y=window.innerWidth>=992&&window.innerWidth<1216,p=window.innerWidth>=1216;r="";r=a?"mobile":r;r=v||y||p?"desktop":r;var i=new Date,f=i.getDate(),u=i.getMonth()+1,w=i.getFullYear(),k=i.getHours(),d=i.getMinutes(),g=i.getSeconds();f<10&&(f="0"+f);u<10&&(u="0"+u);try{e={event:"page_view",page_referral:refPage,page_path:o,page_title:t,page_type:n,page_url:l,page_version:"production_"+w+"-"+u+"-01_11h30m00s",page_product:"Partner",page_KKey:getUrlParameter("customerid"),language:window.Common.Language,portal:"HRS",platform:"Web",breakpoints:r,hit_timestamp:i.toISOString(),page_view_id:pageViewId};console.log("**************************************************************");console.log("DEBUG GA4 DATALAYER #2");console.log("**************************************************************");console.log(e);console.log("**************************************************************");GTMGA4.PushObjIntoDataLayer(e)}catch(nt){}};GTMGA4.AddPurchaseEvent=function(n,t,i,r,u){var f=GetDataLayerObject(),o,e;console.log("**************************************************************");console.log("DEBUG GA4 DATALAYER #3");console.log("**************************************************************");console.log("requestData => ",i);console.log("bookingData => ",r);console.log("selectedRates => ",u);console.log("dataLayerObj => ",f);console.log("DETAIL => ",DETAIL);console.log("**************************************************************");o=new Date;try{e={event:"purchase",page_title:t,page_type:n,page_product:"Partner",hit_timestamp:o.toISOString(),funnel:"checkout",feature:"ecommerce",start_date:f.arrival.format("YYYY-MM-DD"),end_date:f.departure.format("YYYY-MM-DD"),ecommerce:{transaction_id:r.ReservationProcessKey,value:r.TotalPriceCustomer.toFixed(2),currency:"EUR",hotel_id:HotelKey,hotel_name:DETAIL.hotelName,hotel_city:DETAIL.city,hotel_country:DETAIL.iso3Country}};console.log("**************************************************************");console.log("DEBUG GA4 DATALAYER #4");console.log("**************************************************************");console.log(e);console.log("**************************************************************");GTMGA4.PushObjIntoDataLayer({ecommerce:null});GTMGA4.PushObjIntoDataLayer(e)}catch(s){console.log("**************************************************************");console.log("ERROR");console.log("**************************************************************");console.log(s);console.log("**************************************************************")}}