if (window.Evergage && window.SalesforceInteractions && window.SalesforceInteractions.mcis) { try { window.SalesforceInteractions.log.warn("Aborting SDK load since the SalesforceInteractions SDK was already found on this page."); } catch(e) {} } else { window.evergageBeaconParseTimeStart = (new Date().getTime()); 'use strict';var Evergage=function(n){function tc(c,d){var a=Object.keys(c);if(Object.getOwnPropertySymbols){var b=Object.getOwnPropertySymbols(c);d&&(b=b.filter(function(a){return Object.getOwnPropertyDescriptor(c,a).enumerable}));a.push.apply(a,b)}return a}function t(c){for(var d=1;darguments.length?c:a):b.value};return ja.apply(this,arguments)}function ya(c,d){var a=Array.isArray(c)?c:void 0;if(!a)a:{var b=null==c?null: "undefined"!=typeof Symbol&&c[Symbol.iterator]||c["@@iterator"];if(null!=b){var e,f,g,h=[],l=!0,E=!1;try{if(f=(b=b.call(c)).next,0===d){if(Object(b)!==b){a=void 0;break a}l=!1}else for(;!(l=(e=f.call(b)).done)&&(h.push(e.value),h.length!==d);l=!0);}catch(qa){E=!0;var k=qa}finally{try{if(!l&&null!=b.return&&(g=b.return(),Object(g)!==g)){a=void 0;break a}}finally{if(E)throw k;}}a=h}else a=void 0}if(!(c=a||wc(c,d)))throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); return c}function nb(c){var d=Array.isArray(c)?ob(c):void 0;d||(d="undefined"!==typeof Symbol&&null!=c[Symbol.iterator]||null!=c["@@iterator"]?Array.from(c):void 0);if(!(c=d||wc(c)))throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");return c}function wc(c,d){if(c){if("string"===typeof c)return ob(c,d);var a=Object.prototype.toString.call(c).slice(8,-1);"Object"===a&&c.constructor&&(a=c.constructor.name); if("Map"===a||"Set"===a)return Array.from(c);if("Arguments"===a||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(a))return ob(c,d)}}function ob(c,d){if(null==d||d>c.length)d=c.length;for(var a=0,b=Array(d);ac.indexOf(a)})}function ze(c,d,a,b,e){e.guid=e.guid||p.guid++;var f=c.___ce=c.___ce||{};f[d]=f[d]||[];f[d].push([a,b,e]);c.addEventListener(d, e)}function xb(c){c=c.split(".");return[c[0],c.slice(1).sort()]}function Ra(c,d,a,b,e){var f=c.___ce=c.___ce||{};if(d)f[d]&&(f[d]=f[d].filter(function(f){var g=ya(f,3);f=g[0];var l=g[1];g=g[2];if(e&&g.guid!==e.guid||!Dc(f,a)||b&&b!==l)return!0;c.removeEventListener(d,g)}));else for(d in f)Ra(c,d,a,b,e)}function Ec(c){return c.multiple&&c.options?V(tb.call(c.options,function(c){return c.selected&&!c.disabled&&!c.parentNode.disabled}),"value"):c.value||""}function Fc(c){if(!G(c))return[];if(Ae.test(c))return[ma(RegExp.$1)]; var d=Be.test(c)&&RegExp.$1;d=Gc[d]||Gc["*"];d.innerHTML=c;return p(d.childNodes).detach().get()}function Ce(c,d){c=p(c);c.filter("script").add(c.find("script")).each(function(a,b){if(De.test(b.type)&&yb.contains(b)){var c=ma("script");c.text=b.textContent.replace(Ee,"");C(Fe,function(a,d){b[d]&&(c[d]=b[d])});d.head.insertBefore(c,null);d.head.removeChild(c)}})}function ba(c,d,a,b,e,f,g,h){C(c,function(c,f){C(p(f),function(c,f){C(p(d),function(c,d){var g=a?d:f;d=a?f:d;c=c?g.cloneNode(!0):g;e?d.insertBefore(c, b?d.firstElementChild:null):d.parentNode.insertBefore(c,b?d:d.nextElementSibling);Ce(c,d.ownerDocument)},h)},g)},f);return d}function Hc(c,d){var a=Object.keys(c);if(Object.getOwnPropertySymbols){var b=Object.getOwnPropertySymbols(c);d&&(b=b.filter(function(a){return Object.getOwnPropertyDescriptor(c,a).enumerable}));a.push.apply(a,b)}return a}function z(c){for(var d=1;darguments.length?c:a):b.value};return Ta.apply(this,arguments)}function Kc(c){var d=Array.isArray(c)?Ab(c):void 0;d||(d="undefined"!==typeof Symbol&&null!=c[Symbol.iterator]||null!=c["@@iterator"]?Array.from(c):void 0);if(!(c=d||Lc(c)))throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");return c}function Lc(c, d){if(c){if("string"===typeof c)return Ab(c,d);var a=Object.prototype.toString.call(c).slice(8,-1);"Object"===a&&c.constructor&&(a=c.constructor.name);if("Map"===a||"Set"===a)return Array.from(c);if("Arguments"===a||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(a))return Ab(c,d)}}function Ab(c,d){if(null==d||d>c.length)d=c.length;for(var a=0,b=Array(d);a=c.length?{done:!0}:{done:!1,value:c[b++]}},e:function(a){throw a;},f:d}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");}var e=!0,f=!1,g;return{s:function(){a=a.call(c)},n:function(){var b=a.next();e=b.done;return b},e:function(a){f=!0;g=a},f:function(){try{e||null==a.return||a.return()}finally{if(f)throw g; }}}}function Mc(c){r.setLoggingLevel(c)}function Nc(){return r.getLoggingLevel()}function Cb(c){var d,a,b,e=[],f=[a=1732584193,b=4023233417,~a,~b,3285377520],g=[],h=unescape(encodeURI(c))+"\u0080",l=h.length;for(g[c=--l/4+2|15]=8*l;~l;)g[l>>2]|=h.charCodeAt(l)<<8*~l--;for(d=l=0;dl;a=[a[4]+(e[l]=16>l?~~g[d+l]:2*h|0>h)+1518500249+[b&E|~b&k,h=341275144+(b^E^k),882459459+(b&E|b&k|E&k),h+1535694389][l++/5>>2]+((h=a[0])<<5|h>>>27),h,b<<30|b>>>2,E,k]){h=e[l-3]^e[l-8]^e[l-14]^e[l-16]; b=a[1];var E=a[2];var k=a[3]}for(l=5;l;)f[--l]+=a[l]}for(h="";40>l;)h+=(f[l>>3]>>4*(7-l++)&15).toString(16);return h}function Oc(){var c=(window.navigator.userAgent||"")+(window.navigator.platform||"")+(new Date).getTime+JSON.stringify({})+Math.random();return Da(c).slice(0,16)}function Pc(c,d,a){return"function"===typeof a?{bind:c,selector:d,callback:a}:null}function Le(){Db=v.onFireException.on(function(c,d){document.dispatchEvent(new CustomEvent(w.OnException,{detail:{error:c,context:d}}))});Eb= v.onEventSend.on(function(c){document.dispatchEvent(new CustomEvent(w.OnBeforeEventSend,{detail:{actionEvent:c},cancelable:!0}))&&document.dispatchEvent(new CustomEvent(w.OnEventSend,{detail:{actionEvent:c}}))});Fb=v.onPageMatchStatusUpdated.on(function(c){document.dispatchEvent(new CustomEvent(w.OnPageMatchStatusUpdated,{detail:{matchStatus:c}}))});Gb=v.onInitSitemap.on(function(c){document.dispatchEvent(new CustomEvent(w.OnInitSitemap,{detail:{sitemapConfig:c}}))})}function W(c){Db&&Db();Eb&&Eb(); Fb&&Fb();Gb&&Gb();document.dispatchEvent(new CustomEvent(w.OnShutDown,{detail:{message:c}}));Hb="shutDown";return!1}function Ua(c,d,a,b){return c.addEventListener?(c.addEventListener(d,a,b),!0):!1}function ca(c,d,a,b){return c.removeEventListener?(c.removeEventListener(d,a,b),!0):!1}function Ib(c){var d=document.createElement("a");d.href=c;return d}function Qc(c){try{return decodeURIComponent(c.replace(/\+/g," "))}catch(d){return null}}function Rc(c){if(c=c.detail&&c.detail.actionEvent)if(c.itemAction&& c.itemAction.includes("View"))Va();else{var d;if(d=c.interaction)c=c.interaction.name,d=c===oa.ViewCatalogObject||c===oa.ViewCatalogObjectDetail||c===oa.QuickViewCatalogObject||c===Ea.StopQuickViewCatalogObject;d&&Va()}}function Jb(c){-1!==X&&(Kb(!1,c),clearTimeout(X),X=-1)}function Va(){if(!q.beaconConfig.doNotTrackPingRequestsForActions){Jb(!0);document.removeEventListener(n.CustomEvents.OnEventSend,Rc);document.addEventListener(n.CustomEvents.OnEventSend,Rc);var c=Date.now();if(-1===H||c-H>=q.beaconConfig.minimumActivityTimeToRegister)H= c;X=setTimeout(function(){Kb(!0)},q.beaconConfig.timeOnPageTimerLengthMillis);r.info("Setting up time on page listeners.");ca(window,"unload",Lb);Ua(window,"unload",Lb);ca(window,"blur",Mb);Ua(window,"blur",Mb);ca(window,"focus",Nb);Ua(window,"focus",Nb);ca(document,"mousemove keydown scroll click",Fa);Ua(document,"mousemove keydown scroll click",Fa)}}function Kb(c,d){var a=Date.now();-1!==H&&(a-=H,q.beaconConfig.timeOnPageTimerLengthMillisD&&(D=0);c&&(-1!==X&&clearTimeout(X),X=setTimeout(function(){Kb(!0)},q.beaconConfig.timeOnPageTimerLengthMillis))}function Me(c){c={timeOnPageMillis:c};var d=Tc(),a={};if(d&&d.itemAction&&d.catalog)a=d.catalog;else if(d&&d.interaction&& d.interaction.catalogObject){a=d.interaction.catalogObject;var b={},e=a.id,f=a.type,g=xa(a,Oe);e&&f&&(b[a.type]={_id:e});a.relatedCatalogObjects&&(f=g.relatedCatalogObjects,e=f.Category,f=xa(f,Pe),Array.isArray(e)&&(b[a.type].categories=Uc(e)),0!==Object.keys(f).length&&(b[a.type].relatedCatalogObjects=f));a=b}0!==Object.keys(a).length&&(c.catalog=a);d&&d.interaction&&null!=d.interaction.name?c.action=d.interaction.name:d&&null!=d.action&&(c.action=d.action);Vc();c.performance={};d=xa(y,Qe);for(var h in d)y[h]&& (c.performance[h]=y[h]);return c}function Lb(c){Jb()}function Mb(c){try{r.trace("Evergage: window blurred"),Wa()}catch(d){x(d,"windowBlurFunction")}}function Nb(c){try{r.trace("Evergage: window focused"),Fa()}catch(d){x(d,"windowFocusFunction")}}function Wa(){try{-1!==Y&&(clearTimeout(Y),Y=-1);var c=Date.now(),d=0;-1!==H&&(d=c-H);r.trace("Evergage: timeOnPage before: setUserInactive: ".concat(D));D+=d;r.trace("Evergage: timeOnPage after: setUserInactive: ".concat(D));H=-1}catch(a){x(a,"setUserInactive")}} function Fa(){r.trace("activity registered");try{-1!==Y&&(clearTimeout(Y),Y=-1);var c=Date.now();if(-1===H||c-H>=q.beaconConfig.minimumActivityTimeToRegister)-1!==H&&(r.trace("Evergage: timeOnPage before: activityRegistered: ".concat(D)),D+=c-Math.max(H,-1),r.trace("Evergage: timeOnPage after: activityRegistered: ".concat(D))),H=c}catch(d){x(d,"activityRegistered")}}function Ob(c,d){c="string"===typeof c?Error(c):c;for(var a in d)Object.defineProperty(c,a,{value:d[a],enumerable:!1});return c}var M= function(c,d){return d={exports:{}},c(d,d.exports),d.exports}(function(c,d){c.exports=function(){function a(){for(var a=0,b={};a/,se=/^\w+$/,Pa=function(){function c(d){var a=1d?0:1;aarguments.length?this[0]&&this[0][c]:this.each(function(a,e){e[c]=d});for(var a in c)this.prop(a,c[a]);return this}};m.get=function(c){return void 0===c?Yc.call(this):this[0>c?c+this.length:c]};m.eq=function(c){return p(this.get(c))};m.first=function(){return this.eq(0)};m.last=function(){return this.eq(-1)};m.filter=function(c){var d=sb(c);return p(tb.call(this,function(a,b){return d.call(a,b,a)}))};var ue=/\S+/g;m.hasClass=function(c){return!!c&&wb.call(this,function(d){return d.classList.contains(c)})}; m.removeAttr=function(c){var d=Qa(c);return this.each(function(a,b){C(d,function(a,c){b.removeAttribute(c)})})};m.attr=function(c,d){if(c){if(G(c)){if(2>arguments.length){if(!this[0])return;var a=this[0].getAttribute(c);return null===a?void 0:a}return void 0===d?this:null===d?this.removeAttr(c):this.each(function(a,e){e.setAttribute(c,d)})}for(a in c)this.attr(a,c[a]);return this}};m.toggleClass=function(c,d){var a=Qa(c),b=void 0!==d;return this.each(function(c,f){C(a,function(a,c){b?d?f.classList.add(c): f.classList.remove(c):f.classList.toggle(c)})})};m.addClass=function(c){return this.toggleClass(c,!0)};m.removeClass=function(c){return arguments.length?this.toggleClass(c,!1):this.attr("class","")};p.unique=T;m.add=function(c,d){return p(T(this.get().concat(p(c,d).get())))};var ub=/^--/,vb={},xe=Wc.style,we=["webkit","moz","ms"];p.prefixedProp=zc;var ye={animationIterationCount:!0,columnCount:!0,flexGrow:!0,flexShrink:!0,fontWeight:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,widows:!0,zIndex:!0}; m.css=function(c,d){if(G(c)){var a=ub.test(c);c=zc(c,a);if(2>arguments.length)return this[0]&&la(this[0],c,a);if(!c)return this;d=Ac(c,d,a);return this.each(function(b,f){f&&1===f.nodeType&&(a?f.style.setProperty(c,d):f.style[c]=d)})}for(var b in c)this.css(b,c[b]);return this};m.data=function(c,d){if(!c){if(!this[0])return;var a={},b;for(b in this[0].dataset)a[b]=Bc(this[0],b);return a}if(G(c))return 2>arguments.length?this[0]&&Bc(this[0],c):this.each(function(a,b){a=d;try{a=JSON.stringify(a)}catch(g){}b.dataset[za(c)]= a});for(a in c)this.data(a,c[a]);return this};C([!0,!1],function(c,d){C(["Width","Height"],function(a,b){var c="".concat(d?"outer":"inner").concat(b);m[c]=function(e){if(this[0])return rb(this[0])?Aa[c]:this[0]["".concat(d?"offset":"client").concat(b)]+(e&&d?sa(this[0],"margin".concat(a?"Top":"Left"))+sa(this[0],"margin".concat(a?"Bottom":"Right")):0)}})});C(["width","height"],function(c,d){m[d]=function(a){if(!this[0])return void 0===a?void 0:this;if(!arguments.length)return rb(this[0])?this[0][za("outer-".concat(d))]: this[0].getBoundingClientRect()[d]-Cc(this[0],!c);var b=parseInt(a,10);return this.each(function(a,f){f&&1===f.nodeType&&(a=la(f,"boxSizing"),f.style[d]=Ac(d,b+("border-box"===a?Cc(f,!c):0)))})}});var Rb={};m.toggle=function(c){return this.each(function(d,a){if(void 0===c?"none"===la(a,"display"):c){if(a.style.display=a.___cd||"","none"===la(a,"display")){d=a.style;a=a.tagName;if(Rb[a])a=Rb[a];else{var b=ma(a);S.body.insertBefore(b,null);var e=la(b,"display");S.body.removeChild(b);a=Rb[a]="none"!== e?e:"block"}d.display=a}}else a.___cd=la(a,"display"),a.style.display="none"})};m.hide=function(){return this.toggle(!1)};m.show=function(){return this.toggle(!0)};var Sb={focus:"focusin",blur:"focusout"},Zc={mouseenter:"mouseover",mouseleave:"mouseout"},Xe=/^(mouse|pointer|contextmenu|drag|drop|click|dblclick)/i;m.off=function(c,d,a){var b=this;if(void 0===c)this.each(function(a,b){Ra(b)});else if(G(c))ka(d)&&(a=d,d=""),C(Qa(c),function(c,e){c=xb(Zc[e]||Sb[e]||e);c=ya(c,2);var f=c[0],g=c[1];b.each(function(b, c){Ra(c,f,g,d,a)})});else for(var e in c)this.off(e,c[e]);return this};m.on=function(c,d,a,b){var e=this;if(!G(c)){for(var f in c)this.on(f,d,c[f]);return this}ka(d)&&(a=d,d="");C(Qa(c),function(c,f){c=xb(Zc[f]||Sb[f]||f);c=ya(c,2);var g=c[0],h=c[1];e.each(function(c,e){c=function He(c){if(!c.namespace||Dc(h,c.namespace.split("."))){var f=e;if(d){for(var l=c.target;!qb(l,d);){if(l===e)return;l=l.parentNode;if(!l)return}f=l;c.___cd=!0}c.___cd&&Object.defineProperty(c,"currentTarget",{configurable:!0, get:function(){return f}});l=a.call(f,c,c.data);b&&Ra(e,g,h,d,He);!1===l&&(c.preventDefault(),c.stopPropagation())}};c.guid=a.guid=a.guid||p.guid++;ze(e,g,h,d,c)})});return this};m.one=function(c,d,a){return this.on(c,d,a,!0)};m.ready=function(c){"loading"!==S.readyState?c(p):S.addEventListener("DOMContentLoaded",function(){c(p)});return this};m.trigger=function(c,d){if(G(c)){var a=xb(c),b=ya(a,2);a=b[0];b=b[1];var e=Xe.test(a)?"MouseEvents":"HTMLEvents";c=S.createEvent(e);c.initEvent(a,!0,!0);c.namespace= b.join(".")}c.data=d;var f=c.type in Sb;return this.each(function(a,b){if(f&&ka(b[c.type]))b[c.type]();else b.dispatchEvent(c)})};var Ye=/%20/g,Ze=/file|reset|submit|button|image/i,$e=/radio|checkbox/i;m.serialize=function(){var c="";this.each(function(d,a){C(a.elements||[a],function(a,d){d.disabled||!d.name||"FIELDSET"===d.tagName||Ze.test(d.type)||$e.test(d.type)&&!d.checked||(a=Ec(d),void 0!==a&&(a=Qb(a)?a:[a],C(a,function(a,b){a=c;b="&".concat(encodeURIComponent(d.name),"=").concat(encodeURIComponent(b).replace(Ye, "+"));c=a+b})))})});return c.slice(1)};m.val=function(c){return void 0===c?this[0]&&Ec(this[0]):this.each(function(d,a){if("SELECT"===a.tagName){var b=Qb(c)?c:null===c?[]:[c];C(a.options,function(a,c){c.selected=0<=b.indexOf(c.value)})}else a.value=null===c?"":c})};m.clone=function(){return this.map(function(c,d){return d.cloneNode(!0)})};m.detach=function(){return this.each(function(c,d){d.parentNode&&d.parentNode.removeChild(d)})};var Be=/^\s*<(\w+)[^>]*>/,Ae=/^\s*<(\w+)\s*\/?>(?:<\/\1>)?\s*$/, Gc={"*":Wc,tr:Se,td:Xc,th:Xc,thead:Pb,tbody:Pb,tfoot:Pb};p.parseHTML=Fc;m.empty=function(){return this.each(function(c,d){for(;d.firstChild;)d.removeChild(d.firstChild)})};m.html=function(c){return void 0===c?this[0]&&this[0].innerHTML:this.each(function(d,a){a.innerHTML=c})};m.remove=function(){return this.detach().off()};m.text=function(c){return void 0===c?this[0]?this[0].textContent:"":this.each(function(d,a){a.textContent=c})};m.unwrap=function(){this.parent().each(function(c,d){c=p(d);c.replaceWith(c.children())}); return this};m.offset=function(){var c=this[0];if(c)return c=c.getBoundingClientRect(),{top:c.top+Aa.pageYOffset-yb.clientTop,left:c.left+Aa.pageXOffset-yb.clientLeft}};m.offsetParent=function(){return p(this[0]&&this[0].offsetParent)};m.position=function(){var c=this[0];if(c)return{left:c.offsetLeft,top:c.offsetTop}};m.children=function(c){return ra(p(T(V(this,function(c){return c.children}))),c)};m.contents=function(){return p(T(V(this,function(c){return"IFRAME"===c.tagName?[c.contentDocument]: c.childNodes})))};m.find=function(c){return p(T(V(this,function(d){return pb(c,d)})))};var Ee=/^\s*\s*$/g,De=/^$|^module$|\/(java|ecma)script/i,Fe=["type","src","nonce","noModule"];m.after=function(){return ba(arguments,this,!1,!1,!1,!0,!0)};m.append=function(){return ba(arguments,this,!1,!1,!0)};m.appendTo=function(c){return ba(arguments,this,!0,!1,!0)};m.before=function(){return ba(arguments,this,!1,!0)};m.insertAfter=function(c){return ba(arguments,this,!0,!1,!1, !1,!1,!0)};m.insertBefore=function(c){return ba(arguments,this,!0,!0)};m.prepend=function(){return ba(arguments,this,!1,!0,!0,!0,!0)};m.prependTo=function(c){return ba(arguments,this,!0,!0,!0,!1,!1,!0)};m.replaceWith=function(c){return this.before(c).remove()};m.replaceAll=function(c){p(c).replaceWith(this);return this};m.wrapAll=function(c){c=p(c);for(var d=c[0];d.children.length;)d=d.firstElementChild;this.first().before(c);return this.appendTo(d)};m.wrap=function(c){return this.each(function(d, a){var b=p(c)[0];p(a).wrapAll(d?b.cloneNode(!0):b)})};m.wrapInner=function(c){return this.each(function(d,a){d=p(a);a=d.contents();a.length?a.wrapAll(c):d.append(c)})};m.has=function(c){var d=G(c)?function(a,b){return pb(c,b).length}:function(a,b){return b.contains(c)};return this.filter(d)};m.is=function(c){var d=sb(c);return wb.call(this,function(a,b){return d.call(a,b,a)})};m.next=function(c,d){return ra(p(T(V(this,"nextElementSibling",d))),c)};m.nextAll=function(c){return this.next(c,!0)};m.not= function(c){var d=sb(c);return this.filter(function(a,b){return!d.call(b,a,b)})};m.parent=function(c){return ra(p(T(V(this,"parentNode"))),c)};m.index=function(c){var d=c?p(c)[0]:this[0];c=c?this:p(d).parent().children();return yc.call(c,d)};m.closest=function(c){var d=this.filter(c);if(d.length)return d;var a=this.parent();return a.length?a.closest(c):d};m.parents=function(c){return ra(p(T(V(this,"parentElement",!0))),c)};m.prev=function(c,d){return ra(p(T(V(this,"previousElementSibling",d))),c)}; m.prevAll=function(c){return this.prev(c,!0)};m.siblings=function(c){return ra(p(T(V(this,function(c){return p(c).parent().children().not(c)}))),c)};var Tb=["error","warn","info","debug","trace"],r=new (function(){function c(){var d=0=new Date(a.lastSentTime)}).map(function(a){return a.consent});hf(d.consents)};document.addEventListener(w.OnConsentRevoke,function(d){d.detail&&d.detail.revokedConsent&&of({interaction:{name:ua.MetadataUpdate},consents:[d.detail.revokedConsent.consent]})}); var qd=function(d){return pd(d,mf).catch(function(a){r.error(a.message);v.onFireException.emit(a,"Site-wide JavaScript");return d})},of=function(d){pd(d,function(){return!0}).then(function(){return r.debug("Consent revoked")},function(a){return v.onFireException.emit(a,"Site-wide JavaScript")})},pd=function(d,a){a:{var b=d,e=u.matchedConfig;try{b=e&&e.onActionEvent?e.onActionEvent(b):b;if("object"===J(b)){d=b;break a}v.onFireException.emit(Error("onActionEvent failed for the ".concat(u.matchedConfig.name, " page config. Must return an object or null.")),"Site-wide Javascript")}catch(f){v.onFireException.emit(Error("onActionEvent failed for the ".concat(u.matchedConfig.name," page config. ").concat(f.message,".")),"Site-wide Javascript")}d=void 0}a:{b=d;try{b=N.global&&N.global.onActionEvent?N.global.onActionEvent(b):b;if("object"===J(b)){d=b;break a}v.onFireException.emit(Error("onActionEvent failed for the global page config. Must return an object or null."),"Site-wide Javascript")}catch(f){v.onFireException.emit(Error("onActionEvent failed for the global page config. ".concat(f.message, ".")),"Site-wide Javascript")}d=void 0}od(d);a&&!a()&&r.debug("No opt-in consents provided. Event will still be dispatched.");r.debug("Sent event: ",d);v.onEventSend.emit(d);return Promise.resolve(d)},pf=function(d){return new Promise(function(a,b){v.onInitSitemap.once(function(){return b("sitemap_reinit")});var e={name:null},f=[];Object.keys(d.interaction).forEach(function(a){var b=rd(d.interaction[a],a).then(function(b){e[a]=b});f.push(b)});Promise.all(f).then(function(){a(e)}).catch(function(a){v.onFireException.emit(Error("Catalog object interaction config was rejected"), "Site-wide Javascript")})})},rd=function(d,a){try{return F=a,"object"===J(d)&&!Array.isArray(d)&&0=e&&(Ia(b),g(!1))}catch(qa){Ia(b),h(qa)}},f);fa[b]=function(){clearInterval(k)}})},unbind:Ia,getBindings:function(){return fa},clearBindings:function(){for(var a in fa)fa.hasOwnProperty(a)&&"function"===typeof fa[a]&&Ia(a)}}};var Hb="shutDown";var va={cookieDomain:null, consents:null},zd=function(){function a(a,b,f){if(f)for(a=Math.random().toString(36).slice(2);e[a];)a=Math.random().toString(36).slice(2);else a=a||b;return a}function b(b,f){return{pageElementLoaded:function(h,l){if("string"!==typeof l||""===l)l=0"+h,f);e[b]=function(){E&&E.disconnect()}})},pageElementVisible:function(h, l){var k=l||0;if("string"!==typeof h||""===h||"number"!==typeof k||0>k||1"+h,f);e[b]=function(){n.disconnect()}})},pageExit:function(h){h=h||0;if("number"!==typeof h||0>h)throw Error("[pageExit] Invalid arguments"); return new Promise(function(l){function k(a){clearTimeout(p);10>=a.pageY-window.pageYOffset&&(p=0",f);e[b]=function(){n.off("mousemove",k)}})},pageInactive:function(h){function l(a,e){var f=new Promise(function(f){function h(a){a=a||new Event("pageInactive");b&&!e.isSubscribe?g.unbind(b):k.off("mousemove click scroll keyup keydown", l);f(a)}function l(b){clearTimeout(m);m=setTimeout(h.bind(this,b),a)}var k=B(document),m;l();k.on("mousemove click scroll keyup keydown",l)});f.subscribe=function(h){delete f.subscribe;e.isSubscribe=!0;f.then(function(f){f.disconnect=function(){b?g.unbind(b):e.isDisconnected=!0};h(f);!e.isDisconnected&&l(a,e).subscribe(h)});return f};return f}if("number"!==typeof h||0>=h)throw Error("[pageInactive] Invalid arguments");var k={isDisconnected:!1,isSubscribe:!1};b=a(b,"",f);e[b]=function(){k.isDisconnected= !0};return l(h,k)},pageScroll:function(h){if("number"!==typeof h||0>h||1=h&&(l(a),b?g.unbind(b):m.off("scroll",k))}var m=B(document);m.on("scroll",k);b=a(b,"",f);e[b]=function(){m.off("scroll",k)}})}}}var e={},f=b(null,!0),g=function(){return{bind:function(a){a&&e[a]&&(e[a](),delete e[a]);return b(a)},unbind:function(a){if(!a|| "string"!==typeof a||"function"!==typeof e[a])return null;e[a]();delete e[a]},getBindings:function(){return e},clearBindings:function(){for(var a in e)e.hasOwnProperty(a)&&(e[a](),delete e[a])}}}();return Object.assign(f,g)}(),cb=function(){function a(b){var e=this;Ba(this,a);this.clearRateLimiter=function(){e.sentEvents=[]};this.eventWithinLimitTimeRange=function(a,b,e){return e-b.timeg)?(r.info("Event rate limit exceeded. More than ".concat(g," events ")+"sent in ".concat(f,"ms.")),!0):!1};this.checkLimits=function(a,b){return e.checkGlobalLimits(a, b.time)};this.sentEvents=[];this.eventRateLimiterConfig=b}Ca(a,[{key:"resetCounters",value:function(){this.globalCounter=0}},{key:"isTriggerLimitExceeded",value:function(a){var b=Date.now();a=z(z({},a),{},{time:b});this.sentEvents.push(a);this.removeOldEvents(b);this.resetCounters();for(b=this.sentEvents.length-1;0<=b;b--)if(this.checkLimits(b,a))return!0;return!1}}]);return a}(),zf=function(a){function b(a){Ba(this,b);var f=e.call(this,a);f.getTimeRangeMax=function(){return f.eventRateLimiterConfig.perInteractionTimeRange? Math.max(f.eventRateLimiterConfig.globalTimeRange,f.eventRateLimiterConfig.perInteractionTimeRange):f.eventRateLimiterConfig.globalTimeRange};f.checkInteractionLimits=function(a,b,e){return f.eventRateLimiterConfig.perInteractionLimit&&f.eventRateLimiterConfig.perInteractionTimeRange&&f.eventWithinLimitTimeRange(f.eventRateLimiterConfig.perInteractionTimeRange,f.sentEvents[a],b)&&f.sentEvents[a].name===e&&(f.perEventCounter++,f.perEventCounter>f.eventRateLimiterConfig.perInteractionLimit)?(r.info("Event rate limit exceeded. More than ".concat(f.eventRateLimiterConfig.perInteractionLimit, " events ")+"with interaction name of ".concat(e," sent in ").concat(f.eventRateLimiterConfig.perInteractionTimeRange,"ms.")),!0):!1};f.checkLimits=function(a,b){return f.checkGlobalLimits(a,b.time)||f.checkInteractionLimits(a,b.time,b.name)};return f}Ie(b,a);var e=Ke(b);Ca(b,[{key:"resetCounters",value:function(){Ta(na(b.prototype),"resetCounters",this).call(this);this.perEventCounter=0}},{key:"isTriggerLimitExceeded",value:function(a){return Ta(na(b.prototype),"isTriggerLimitExceeded",this).call(this, a)}}]);return b}(cb),Db,Eb,Fb,Gb,bc=function(){var a=0=a.length)return a;var b=731,e=244;974!=b+e&&(b+=974-(b+e));10f.eventRateLimiterConfig.perExperienceLimit)return r.info("Event rate limit exceeded. More than ".concat(f.eventRateLimiterConfig.perExperienceLimit," events ")+"with experience id of ".concat(e," sent in ").concat(f.eventRateLimiterConfig.perExperienceTimeRange,"ms.")),!0}};f.checkLimits=function(a,b){return f.checkGlobalLimits(a,b.time)||f.checkExperienceLimits(a,b.time)};return f}Na(b,a);var e=Oa(b);ia(b,[{key:"resetCounters", value:function(){ja(R(b.prototype),"resetCounters",this).call(this);this.experienceRates=new Map}},{key:"isTriggerLimitExceeded",value:function(a){return ja(R(b.prototype),"isTriggerLimitExceeded",this).call(this,a)}}]);return b}(cb),lc=function(){function a(b){ha(this,a);this.baseURL=b}ia(a,[{key:"send",value:function(a){Nf(a);var b=this.baseURL+"?";var f="";var g=[],h;"string"!==typeof f&&(f="?");for(l in a)if(Lf.call(a,l)){(h=a[l])||null!==h&&void 0!==h&&!isNaN(h)||(h="");var l=encodeURIComponent(l); h=encodeURIComponent(h);null!==l&&null!==h&&g.push(l+"="+h)}a=g.length?f+g.join("&"):"";b+=a;if(navigator&&navigator.sendBeacon)return a=new Blob([],{type:"application/x-www-form-urlencoded"}),navigator.sendBeacon(b,a);a=new XMLHttpRequest;a.open("GET",b,!0);a.send()}}]);return a}(),Of=function(a){function b(a,g){ha(this,b);a=e.call(this,a);a.eventRateLimiter=g||new cb({globalLimit:q.beaconConfig.errorRateLimiterConfig.globalLimit,globalTimeRange:q.beaconConfig.errorRateLimiterConfig.globalTimeRange}); return a}Na(b,a);var e=Oa(b);ia(b,[{key:"send",value:function(a){if(this.eventRateLimiter.isTriggerLimitExceeded())r.warn("Error event rate limiter triggered.");else return ja(R(b.prototype),"send",this).call(this,a)}}]);return b}(lc),Pf=function(a){function b(a,g){ha(this,b);a=e.call(this,a);a.eventRateLimiter=g||new cb({globalLimit:q.beaconConfig.pingRateLimiterConfig.globalLimit,globalTimeRange:q.beaconConfig.pingRateLimiterConfig.globalTimeRange});return a}Na(b,a);var e=Oa(b);ia(b,[{key:"send", value:function(a){if(this.eventRateLimiter.isTriggerLimitExceeded())r.warn("Ping event rate limiter triggered.");else return ja(R(b.prototype),"send",this).call(this,a)}}]);return b}(lc),Qf=function(a){function b(a,g){ha(this,b);a=e.call(this,a);a.eventRateLimiter=g||new Mf({globalLimit:q.beaconConfig.campaignStatRateLimiterConfig.globalLimit,globalTimeRange:q.beaconConfig.campaignStatRateLimiterConfig.globalTimeRange,perExperienceLimit:q.beaconConfig.campaignStatRateLimiterConfig.perExperienceLimit, perExperienceTimeRange:q.beaconConfig.campaignStatRateLimiterConfig.perExperienceTimeRange});return a}Na(b,a);var e=Oa(b);ia(b,[{key:"send",value:function(a,e){e=e?e:[];if(this.eventRateLimiter.isTriggerLimitExceeded({experienceIds:e}))r.warn("Campaign Stat event rate limiter triggered.");else return ja(R(b.prototype),"send",this).call(this,a)}}]);return b}(lc),Nf=function(a){Object.keys(a).forEach(function(b){var e=a[b];if("number"!=typeof e&&"boolean"!==typeof e&&null!=e)if("string"==typeof e){a:switch(b){case "url":case "urlref":e= e.substring(0,3072);break a;case "title":e=e.substring(0,1024);break a;default:e=e.substring(0,1024)}a[b]=e}else"function"==typeof e?delete a[b]:a[b]=JSON.stringify(e)})},eb,fb,gb,Jd=!1,Kd=!1,Ld=!1,y={sdkLoadTime:null,sdkParseTime:null,sdkDnsTime:null,pageLoadTime:null,domLoadTime:null,networkTime:null,eventDnsTime:null},Md=function(){return window.performance.getEntriesByType?window.performance.getEntriesByType("resource").reverse().find(function(a){return 0<=a.name.indexOf("/api2/event/")}):null}, Nd=function(){return window.performance.getEntriesByType?window.performance.getEntriesByType("resource").find(function(a){return/\/evergage(Small)?(\.min)?\.js$/.test(a.name)}):null},Od=function(){if(window.performance.getEntriesByType){var a=window.performance.getEntriesByType("navigation");if(a&&0this.status)try{var a=JSON.parse(l.response); e(a)}catch(Ge){g(Ob(Ge,{status:this.status,statusText:l.statusText}))}else g(Ob("Response was not OK: ".concat(l.responseText),{status:this.status,statusText:l.statusText}))};l.onerror=function(){if(""===l.responseType||"text"===l.responseType){var a=l.responseText||l.statusText;if(a){g(Ob("Response error: ".concat(a),{status:this.status,statusText:l.statusText}));return}}r.debug("An error was sent with no text. This is un-actionable so it is being logged instead of written.")}; if(a.debug&&a.debug.explanations||a.explain)l.withCredentials=!0;if("true"==mc("isReadableEvent"))b.sendPost(l,b.baseURL,f);else try{if(!/^[\x20-\x7E]+$/.test(f))throw Error("GET request payload contains non-ASCII characters, try sending POST request");var k=encodeURIComponent(window.btoa(f)),m=b.baseURL+"?event="+k;if(8192 { if (validateOnTemplateDisplayEndEvent(event)) { const payload = event.detail.payload; const campaignElement = getCampaignElementFromPayload(payload); sendImpression(payload, campaignElement); bindCampaignClickthroughsAndDismissals(campaignElement); } }); const sendImpression = (payload, campaignElement) => { const userGroup = payload.userGroup; const stat = { control: userGroup === CAMPAIGN_STAT_USER_GROUP.CONTROL, experienceId: payload.experience, stat: CAMPAIGN_STAT_TYPE.IMPRESSION }; const itemStats = generateItemStats(campaignElement); if (Object.keys(itemStats).length > 0) { stat.catalog = itemStats; } if (userGroup === CAMPAIGN_STAT_USER_GROUP.CONTROL || (userGroup === CAMPAIGN_STAT_USER_GROUP.TEST && campaignElement.length > 0)) { Evergage.sendStat({campaignStats: [stat]}); } else { Evergage.log.warn("campaignStatsTracking.js", "Experience", payload.experience, "not found in DOM."); } }; const generateItemStats = (campaignElement) => { const catalogStats = {}; const itemNodes = Evergage.cashDom(campaignElement).find("[" + CAMPAIGN_STAT_ATTRIBUTE.ITEM_TYPE + "]"); if (!itemNodes || itemNodes.length === 0) { return catalogStats; } Array.from(itemNodes).forEach(function(itemNode) { const itemId = Evergage.cashDom(itemNode).attr(CAMPAIGN_STAT_ATTRIBUTE.ITEM); const itemType = Evergage.cashDom(itemNode).attr(CAMPAIGN_STAT_ATTRIBUTE.ITEM_TYPE); if (itemId && itemType) { if (!catalogStats[itemType]) { catalogStats[itemType] = []; } if (!catalogStats[itemType].includes(itemId)) { catalogStats[itemType].push(itemId); } } }); return catalogStats; } const buildCampaignSelector = (experienceId) => { return `[${CAMPAIGN_STAT_ATTRIBUTE.EXPERIENCE}='${experienceId}']` } const getCampaignElementFromPayload = (payload) => { const experienceId = payload.experience; const campaignSelector = buildCampaignSelector(experienceId); return Evergage.cashDom(campaignSelector); }; const getCampaignClickthroughAndDismissalElements = (campaignElement) => { const experienceId = Evergage.cashDom(campaignElement).attr(`${CAMPAIGN_STAT_ATTRIBUTE.EXPERIENCE}`); const campaignSelector = buildCampaignSelector(experienceId); return Evergage.cashDom(campaignElement).parent().find(` ${campaignSelector}[${CAMPAIGN_STAT_ATTRIBUTE.CLICKTHROUGH}], ${campaignSelector} a, ${campaignSelector} [${CAMPAIGN_STAT_ATTRIBUTE.CLICKTHROUGH}], ${campaignSelector} [${CAMPAIGN_STAT_ATTRIBUTE.DISMISSAL}] `); }; const sendClickthroughOrDismissal = (e) => { if (Evergage.cashDom(e.target).closest(`[${CAMPAIGN_STAT_ATTRIBUTE.IGNORE_CLICKTHROUGH}]`).length > 0) { return; } const campaignElement = Evergage.cashDom(e.target).closest(`[${CAMPAIGN_STAT_ATTRIBUTE.EXPERIENCE}]`); if (campaignElement.length > 0 && Evergage.cashDom(e.target).closest(` a, [${CAMPAIGN_STAT_ATTRIBUTE.CLICKTHROUGH}], [${CAMPAIGN_STAT_ATTRIBUTE.DISMISSAL}]`).length > 0) { const stat = { control: campaignElement.attr(CAMPAIGN_STAT_ATTRIBUTE.USER_GROUP) === CAMPAIGN_STAT_USER_GROUP.CONTROL, experienceId: campaignElement.attr(CAMPAIGN_STAT_ATTRIBUTE.EXPERIENCE), stat: Evergage.cashDom(e.target).closest(`[${CAMPAIGN_STAT_ATTRIBUTE.CLICKTHROUGH}]`).length > 0 || Evergage.cashDom(e.target).closest("a").length > 0 ? CAMPAIGN_STAT_TYPE.CLICKTHROUGH : CAMPAIGN_STAT_TYPE.DISMISSAL }; if (stat.stat === CAMPAIGN_STAT_TYPE.CLICKTHROUGH) { const itemClickthroughStats = generateItemClickthroughStats(e.target); if (Object.keys(itemClickthroughStats).length > 0) { stat.catalog = itemClickthroughStats; } } Evergage.sendStat({campaignStats: [stat]}); } }; const generateItemClickthroughStats = (target) => { const itemStats = {}; const itemId = Evergage.cashDom(target).closest("[" + CAMPAIGN_STAT_ATTRIBUTE.ITEM + "]").attr(CAMPAIGN_STAT_ATTRIBUTE.ITEM); const itemType = Evergage.cashDom(target).closest("[" + CAMPAIGN_STAT_ATTRIBUTE.ITEM_TYPE + "]").attr(CAMPAIGN_STAT_ATTRIBUTE.ITEM_TYPE); if (itemId && itemType) { itemStats[itemType] = [itemId]; } return itemStats; } const bindCampaignClickthroughsAndDismissals = (campaignElement) => { const elements = getCampaignClickthroughAndDismissalElements(campaignElement); elements.off("click", sendClickthroughOrDismissal); elements.on("click", sendClickthroughOrDismissal); }; const validateOnTemplateDisplayEndEvent = (event) => { if (!event.detail) { Evergage.log.warn("campaignStatsTracking.js", "No detail object found for onTemplateDisplayEndEvent", event); return false; } if (!event.detail.payload) { Evergage.log.warn("campaignStatsTracking.js", "No payload object found for onTemplateDisplayEndEvent", event); return false; } if (!event.detail.payload.campaign) { Evergage.log.warn("campaignStatsTracking.js", "No campaign found in payload object", event.detail); return false; } if (!event.detail.payload.experience) { Evergage.log.warn("campaignStatsTracking.js", "No experience found in payload object", event.detail); return false; } if (!event.detail.payload.userGroup) { Evergage.log.warn("campaignStatsTracking.js", "No user group found in payload object", event.detail); return false; } return true; }; } catch (e) { if (typeof window.Evergage === "object" && typeof window.Evergage.getVersion === "function" && window.Evergage.getVersion() >= 5) { Evergage.sendException(e, "beaconExtension: Campaign Stats Tracking:campaignStatsTracking.js"); } }; try { /** * Personalization Flicker Defense */ Evergage.FlickerDefender = Evergage.FlickerDefender || (() => { const personalizationSectionsSelector = "head > style.evergagePersonalizationSections"; let personalizedSectionsString = ""; let sectionsHaveEverBeenHidden = false; let hasBeenHidden = false; let shouldReshowNow = false; let hiddenSections = {}; const timeoutOptions = { pageMatchTimeout: 1000, redisplayTimeout: Evergage.getConfig().hideContentSectionsMillis || 2500 } const utils = { getGlobalContentZoneSelectors: () => { return ((Evergage.getState().config.global || {}).contentZones || []) .filter((contentZone) => (contentZone || {}).selector) .map((contentZone) => contentZone.selector); }, getPageTypeContentZoneSelectors: () => { const { pageTypes } = Evergage.getState().config; return pageTypes.length < 1 ? [] : pageTypes .map((pageType) => pageType.contentZones || []) .reduce((acc, contentZonesArr) => acc.concat(contentZonesArr), []) .filter((contentZone) => (contentZone || {}).selector) .map((contentZone) => contentZone.selector); }, buildContentZoneSelectors: () => { return [ ...new Set([ ...utils.getGlobalContentZoneSelectors(), ...utils.getPageTypeContentZoneSelectors() ]) ]; }, addToPersonalizedSectionsString: (selector) => { if (typeof selector === "string") { try { document.querySelector(selector); if (personalizedSectionsString !== "") { personalizedSectionsString += ", "; } personalizedSectionsString += selector; } catch (exception) { Evergage.sendException(exception, "hideSectionsInvalidCSSSelector"); } } }, hasBeenReshown: () => { return Evergage.cashDom(personalizationSectionsSelector).length === 0; } }; const actions = { hideSections: () => { if (sectionsHaveEverBeenHidden) return; const selectors = utils.buildContentZoneSelectors(); if (selectors.length === 0) { Evergage.log.debug("Evergage: Issue with malformed request in hideSections."); return; } for (const selector of selectors) { utils.addToPersonalizedSectionsString(selector); } if (!personalizedSectionsString) return; const head = document.head || document.getElementsByTagName("head")[0]; const style = document.createElement("style"); Evergage.cashDom(style) .attr({ type: "text/css", class: "evergagePersonalizationSections" }) .text(`${personalizedSectionsString} { visibility: hidden !important; }`); clearTimeout(window.evergageReshowPersonalizedSectionsTimeout); window.evergageReshowPersonalizedSectionsTimeout = setTimeout(function () { if (utils.hasBeenReshown()) return; shouldReshowNow = true; actions.reshowPersonalizedSectionsNow(); }, timeoutOptions.redisplayTimeout); head.appendChild(style); sectionsHaveEverBeenHidden = true; }, reshowPersonalizedSections: () => { if (utils.hasBeenReshown()) return; try { if (typeof window.requestAnimationFrame === "function") { Evergage.log.info("Evergage: Scheduling for next animation frame redisplay of sections of the page marked for personalization."); window.requestAnimationFrame(actions.reshowPersonalizedSectionsNow); } else { actions.reshowPersonalizedSectionsNow(); } } catch (exception) { Evergage.sendException(exception, "reshowPersonalizedSections"); } }, reshowReadyPersonalizedSections: () => { Evergage.cashDom(personalizationSectionsSelector).text(`${personalizedSectionsString} { visibility: hidden !important }`); Evergage.log.info(`Evergage: Redisplaying the following sections of the page marked for personalization: ${personalizedSectionsString}`); }, reshowAllPersonalizedSections: () => { Evergage.cashDom(personalizationSectionsSelector).remove(); Evergage.log.info("Evergage: Redisplaying outstanding sections of the page marked for personalization."); }, reshowPersonalizedSectionsNow: () => { if (utils.hasBeenReshown()) return; try { if (shouldReshowNow || Object.keys(hiddenSections).length === 0) { actions.reshowAllPersonalizedSections(); } else if (Object.keys(hiddenSections).length > 0) { personalizedSectionsString = ""; for (const contentZone in hiddenSections) { utils.addToPersonalizedSectionsString(hiddenSections[contentZone]); } actions.reshowReadyPersonalizedSections(); } } catch (exception) { Evergage.sendException(exception, "reshowPersonalizedSectionsNow"); } } }; const beaconListeners = { addOnInit: () => { document.addEventListener(Evergage.CustomEvents.OnInit, (domEvent) => { clearTimeout(window.evergagePageMatchTimeout); window.evergagePageMatchTimeout = setTimeout(function () { const { pageType } = (Evergage.getCurrentPage().source || {}); if (utils.hasBeenReshown() || (typeof pageType === "string" && pageType !== "")) return; shouldReshowNow = true; actions.reshowPersonalizedSectionsNow(); }, timeoutOptions.pageMatchTimeout); }); }, addPageMatchStatusUpdated: () => { document.addEventListener(Evergage.CustomEvents.OnPageMatchStatusUpdated, (domEvent) => { if (!hasBeenHidden) { actions.hideSections(); if (Evergage.cashDom(personalizationSectionsSelector).length > 0) { hasBeenHidden = true; } } }); }, addOnEventResponse: () => { document.addEventListener(Evergage.CustomEvents.OnEventResponse, (domEvent) => { const { campaignResponses } = ((domEvent.detail || {}).response || {}); if ((campaignResponses || []).length >= 1) { personalizedSectionsString = ""; for (const campaign of campaignResponses) { const { contentZone } = ((campaign || {}).payload || {}); const contentZoneSelector = Evergage.getContentZoneSelector(((campaign || {}).payload || {}).contentZone); if (typeof contentZoneSelector === "string") { hiddenSections[contentZone] = contentZoneSelector; utils.addToPersonalizedSectionsString(contentZoneSelector); } } if (!personalizedSectionsString) { actions.reshowPersonalizedSections(); return; } Evergage.cashDom(personalizationSectionsSelector).text(`${personalizedSectionsString} { visibility: hidden !important; }`); } else { actions.reshowPersonalizedSections(); } }); }, addOnTemplateDisplayEnd: () => { document.addEventListener(Evergage.CustomEvents.OnTemplateDisplayEnd, (domEvent) => { if (utils.hasBeenReshown()) return; const { contentZone } = ((domEvent.detail || {}).payload || {}); if (typeof contentZone === "string" && hiddenSections[contentZone]) { delete hiddenSections[contentZone]; } actions.reshowPersonalizedSections(); }); }, }; return { setPageMatchTimeout: (millis) => { if (typeof millis === "number" && millis >= 0) { timeoutOptions.pageMatchTimeout = parseInt(millis); } else { Evergage.log.warn("flickerDefender.js", "setPageMatchTimeout: Passed argument must be a number and must be greater than or equal to 0", millis); } }, setRedisplayTimeout: (millis) => { if (typeof millis === "number" && millis >= 0) { timeoutOptions.redisplayTimeout = parseInt(millis); } else { Evergage.log.warn("flickerDefender.js", "setRedisplayTimeout: Passed argument must be a number and must be greater than or equal to 0", millis); } }, init: function() { for (const key in beaconListeners) { beaconListeners[key](); } } }; })(); if (window.SalesforceInteractions && window.SalesforceInteractions.mcis) { window.SalesforceInteractions.mcis.FlickerDefender = Evergage.FlickerDefender; } if (typeof Evergage.FlickerDefender.init === "function" && (window.frameElement || {}).id !== "siteEditorFrame") { Evergage.FlickerDefender.init(); } } catch (e) { if (typeof window.Evergage === "object" && typeof window.Evergage.getVersion === "function" && window.Evergage.getVersion() >= 5) { Evergage.sendException(e, "beaconExtension: Flicker Defender:flickerDefender.js"); } }; try { !function(e,t){for(var n in t)e[n]=t[n]}(window,function(e){var t={};function n(r){if(t[r])return t[r].exports;var o=t[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}return n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)n.d(r,o,function(t){return e[t]}.bind(null,o));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=3)}([function(e,t,n){"use strict";var r=this&&this.__createBinding||(Object.create?function(e,t,n,r){void 0===r&&(r=n),Object.defineProperty(e,r,{enumerable:!0,get:function(){return t[n]}})}:function(e,t,n,r){void 0===r&&(r=n),e[r]=t[n]}),o=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),i=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)"default"!==n&&Object.hasOwnProperty.call(e,n)&&r(t,e,n);return o(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.restrictContentZone=t.executeControl=t.handleCampaignResponses=t.renderTemplate=t.resetTemplate=t.registerTemplate=t.executeBundles=void 0;var a=n(5),l=n(1),s=i(n(2)),c=new Map,u=new Map,p=new Set,d=function(){return document.getElementsByTagName("html").length>0&&null!=document.getElementsByTagName("html")[0].getAttribute(s.VE_LOADING_ATTRIBUTE)||null!=document.getElementById(s.VE_ACTIVE_ELEMENT_ID)||"true"===localStorage.getItem(s.VE_INDICATOR_FLAG)||document.location.href.includes(s.TEST_TEMPLATE_PARAMETER)},f=function(e){return c.get(e)},h=function(e,t){return[e,t.campaign,t.experience].join(":")};t.executeBundles=function(e){if(e){var n=!0;e.forEach((function(e){var r,o;try{try{var i=document.createElement("script");o="prepareTemplate"+e.id,i.text="function "+o+"(TemplateService) { "+e.bundle+" }",r=document.head.appendChild(i),window[o]({registerTemplate:t.registerTemplate})}catch(r){n=!1,Function("TemplateService",e.bundle)({registerTemplate:t.registerTemplate})}}catch(e){l.dispatchError(e)}finally{r&&r.parentNode.removeChild(r),o&&window[o]&&(window[o]=void 0)}})),n||console.log("Marketing Cloud Personalization will soon require your Content Security Policy to allow `unsafe-inline`.")}},t.registerTemplate=function(e){var t=new a.Template(e);c.set(e.name,t)},t.resetTemplate=function(e,t){var n=h(e,t),r=u.get(n);if(r)try{r()}catch(e){l.dispatchError(e)}u.delete(n)},t.renderTemplate=function(e,t){if(c.has(e)){var n=f(e).render(t);u.set(h(e,t),n)}},t.handleCampaignResponses=function(e){d()||e.filter((function(e){return"ng"===e.type})).filter((function(e){return!g(e)})).forEach((function(e){switch(e.userGroup){case"Default":m(e);break;case"Control":t.executeControl(e)}}))};var m=function(e){e.templateNames.forEach((function(n){t.renderTemplate(n,e.payload)}))};t.executeControl=function(e){e.templateNames.forEach((function(t){var n=f(t),r=e.payload;if(n.control)try{var o=n.control(r);l.handleTemplateDispatch(o,r)}catch(e){l.dispatchError(e)}}))};var g=function(e){return e.payload.contentZone&&p.has(e.payload.contentZone)};t.restrictContentZone=function(e){e&&p.add(e)}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.dispatchError=t.handleTemplateDispatch=t.getQueryParam=void 0,t.getQueryParam=function(e){var t=location.search;e=e.replace(/[[]/,"\\[").replace(/[\]]/,"\\]");var n=new RegExp("[\\?&]"+e+"=([^&#]*)").exec(t);return null===n?"":decodeURIComponent(n[1].replace(/\+/g," "))};var r=function(e){document.dispatchEvent(new CustomEvent(window.Evergage.CustomEvents.OnTemplateDisplayEnd,{detail:{payload:e}})),document.dispatchEvent(new CustomEvent(window.SalesforceInteractions.mcis.CustomEvents.OnTemplateDisplayEnd,{detail:{payload:e}}))};t.handleTemplateDispatch=function(e,t){window.Promise&&"function"==typeof window.Promise.resolve?window.Promise.resolve(e).then((function(){r(t)})):r(t)},t.dispatchError=function(e){document.dispatchEvent(new CustomEvent(window.SalesforceInteractions.CustomEvents.OnException,{detail:{error:new Error(e),context:"Handlebars Template Gear"}}))}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.VE_ACTIVE_ELEMENT_ID=t.VE_INDICATOR_FLAG=t.VE_LOADING_ATTRIBUTE=t.TEST_TEMPLATE_PARAMETER=t.TEST_TEMPLATE_STORAGE_KEY=void 0,t.TEST_TEMPLATE_STORAGE_KEY="testTemplate",t.TEST_TEMPLATE_PARAMETER="evergageTestTemplate",t.VE_LOADING_ATTRIBUTE="evergagevisualeditorloading",t.VE_INDICATOR_FLAG="evgVE",t.VE_ACTIVE_ELEMENT_ID="evg_ui-visual-editor"},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.render=void 0;var r=n(4),o=n(6),i=n(0);function a(){/complete|interactive|loaded/.test(document.readyState)?(r.renderTestTemplate(),o.initPreview()):document.addEventListener("DOMContentLoaded",(function(){r.renderTestTemplate(),o.initPreview()}))}document.addEventListener(window.Evergage.CustomEvents.OnEventResponse,(function(e){i.executeBundles(e.detail.response.compiledCampaignTemplates),i.handleCampaignResponses(e.detail.response.campaignResponses)})),t.render=a,a()},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.renderTestTemplate=void 0;var r=n(0),o=n(1),i=n(2);t.renderTestTemplate=function(){if("true"==o.getQueryParam(i.TEST_TEMPLATE_PARAMETER)){var e=a();addEventListener("storage",(function(t){t.key==i.TEST_TEMPLATE_STORAGE_KEY&&(e&&r.resetTemplate(e.templateName,e.templateConfig),e=a())}))}};var a=function(){var e=localStorage.getItem(i.TEST_TEMPLATE_STORAGE_KEY);if(e)try{var t=JSON.parse(e);return r.executeBundles(t.templates),r.renderTemplate(t.templateName,t.templateConfig),r.restrictContentZone(t.templateConfig.contentZone),t}catch(e){}}},function(e,t,n){"use strict";var r=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.Template=void 0;var o=r(n(7)),i=n(1),a=function(){function e(e){var t=this;if(this.getContentZoneFromMatchedConfig=function(e){var t=window.Evergage.getState().result.matchedConfig;return e.contentZone&&t&&t.contentZones&&0!==t.contentZones.length&&t.contentZones.find((function(t){return t.name===e.contentZone}))||null},this.applyRender=function(e){var n=t.getContentZoneFromMatchedConfig(e);n&&t.executeInsertionForTarget(n,e)},this.replaceContentAtTarget=function(e,t){t.innerHTML=e},this.name=e.name,this.apply=e.apply,this.reset=e.reset,this.control=e.control,e.handlebars)try{this.generateHtml=o.default.template(e.handlebars),o.default.partials[e.name]=o.default.template(e.handlebars)}catch(e){i.dispatchError(e)}else this.generateHtml=function(){}}return e.prototype.render=function(e){try{var t=this.apply(e,this.generateHtml,this.applyRender);return i.handleTemplateDispatch(t,e),this.reset.bind(this,e,this.generateHtml)}catch(e){i.dispatchError(e)}},e.prototype.executeInsertionForTarget=function(e,t){if(this.generateHtml){var n=e.selector;try{var r=document.querySelector(n);if(!r){var o='Could not render template. Content zone "'+e.name+'" defined but the selector "'+n+'" not found on the page.';return void i.dispatchError(o)}var a=this.generateHtml(t);if(!a)return;this.replaceContentAtTarget(a,r)}catch(e){i.dispatchError(e)}}},e}();t.Template=a},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.initPreview=void 0;var r=n(2),o=n(0);t.initPreview=function(){window.Evergage.Render={render:function(e,t,n){var i=JSON.stringify({templateName:e,templateConfig:t,templates:n});window.localStorage.setItem(r.TEST_TEMPLATE_STORAGE_KEY,i),o.resetTemplate(e,t),o.executeBundles(n),o.renderTemplate(e,t)},reset:o.resetTemplate}}},function(e,t,n){"use strict";n.r(t);var r={};n.r(r),n.d(r,"extend",(function(){return u})),n.d(r,"toString",(function(){return p})),n.d(r,"isFunction",(function(){return d})),n.d(r,"isArray",(function(){return f})),n.d(r,"indexOf",(function(){return h})),n.d(r,"escapeExpression",(function(){return m})),n.d(r,"isEmpty",(function(){return g})),n.d(r,"createFrame",(function(){return v})),n.d(r,"blockParams",(function(){return E})),n.d(r,"appendContextPath",(function(){return T}));var o={};n.r(o),n.d(o,"VERSION",(function(){return k})),n.d(o,"COMPILER_REVISION",(function(){return j})),n.d(o,"LAST_COMPATIBLE_COMPILER_REVISION",(function(){return I})),n.d(o,"REVISION_CHANGES",(function(){return L})),n.d(o,"HandlebarsEnvironment",(function(){return R})),n.d(o,"log",(function(){return H})),n.d(o,"createFrame",(function(){return v})),n.d(o,"logger",(function(){return M}));var i={};n.r(i),n.d(i,"checkRevision",(function(){return V})),n.d(i,"template",(function(){return B})),n.d(i,"wrapProgram",(function(){return G})),n.d(i,"resolvePartial",(function(){return Z})),n.d(i,"invokePartial",(function(){return F})),n.d(i,"noop",(function(){return q}));const a={"&":"&","<":"<",">":">",'"':""","'":"'","`":"`","=":"="},l=/[&<>"'`=]/g,s=/[&<>"'`=]/;function c(e){return a[e]}function u(e){for(let t=1;t0?(n.ids&&(n.ids=[n.name]),e.helpers.each(t,n)):r(this);if(n.data&&n.ids){let e=v(n.data);e.contextPath=T(n.data.contextPath,n.name),n={data:e}}return o(t,n)}))}(e),function(e){e.registerHelper("each",(function(e,t){if(!t)throw new b("Must pass iterator to #each");let n,r,o=t.fn,i=t.inverse,a=0,l="";function s(t,i,a){n&&(n.key=t,n.index=i,n.first=0===i,n.last=!!a,r&&(n.contextPath=r+t)),l+=o(e[t],{data:n,blockParams:E([e[t],t],[r+t,null])})}if(t.data&&t.ids&&(r=T(t.data.contextPath,t.ids[0])+"."),d(e)&&(e=e.call(this)),t.data&&(n=v(t.data)),e&&"object"==typeof e)if(f(e))for(let t=e.length;a{void 0!==t&&s(t,a-1),t=e,a++}),void 0!==t&&s(t,a-1,!0)}return 0===a&&(l=i(this)),l}))}(e),function(e){e.registerHelper("helperMissing",(function(){if(1!==arguments.length)throw new b('Missing helper: "'+arguments[arguments.length-1].name+'"')}))}(e),function(e){e.registerHelper("if",(function(e,t){if(2!=arguments.length)throw new b("#if requires exactly one argument");return d(e)&&(e=e.call(this)),!t.hash.includeZero&&!e||g(e)?t.inverse(this):t.fn(this)})),e.registerHelper("unless",(function(t,n){if(2!=arguments.length)throw new b("#unless requires exactly one argument");return e.helpers.if.call(this,t,{fn:n.inverse,inverse:n.fn,hash:n.hash})}))}(e),function(e){e.registerHelper("log",(function(){let t=[void 0],n=arguments[arguments.length-1];for(let e=0;e=0?t:parseInt(e,10)}return e},log:function(e,...t){if(e=C.lookupLevel(e),"undefined"!=typeof console&&C.lookupLevel(C.level)<=e){let n=C.methodMap[e];console[n]||(n="log"),console[n](...t)}}};var M=C;function A(...e){return u(Object.create(null),...e)}const x=Object.create(null);function S(e,t){return void 0!==e.whitelist[t]?!0===e.whitelist[t]:void 0!==e.defaultValue?e.defaultValue:(function(e){!0!==x[e]&&(x[e]=!0,(void 0)("error",`Handlebars: Access has been denied to resolve the property "${e}" because it is not an "own property" of its parent.\nYou can add a runtime option to disable the check or this warning:\nSee https://handlebarsjs.com/api-reference/runtime-options.html#options-to-control-prototype-access for details`))}(t),!1)}const k="4.7.7",j=8,I=7,L={1:"<= 1.0.rc.2",2:"== 1.0.0-rc.3",3:"== 1.0.0-rc.4",4:"== 1.x.x",5:"== 2.0.0-alpha.x",6:">= 2.0.0-beta.1",7:">= 4.0.0 <4.3.0",8:">= 4.3.0"};function R(e,t,n){this.helpers=e||{},this.partials=t||{},this.decorators=n||{},_(this),O(this)}R.prototype={constructor:R,logger:M,log:M.log,registerHelper:function(e,t){if("[object Object]"===p.call(e)){if(t)throw new b("Arg not supported with multiple helpers");u(this.helpers,e)}else this.helpers[e]=t},unregisterHelper:function(e){delete this.helpers[e]},registerPartial:function(e,t){if("[object Object]"===p.call(e))u(this.partials,e);else{if(void 0===t)throw new b(`Attempting to register a partial called "${e}" as undefined`);this.partials[e]=t}},unregisterPartial:function(e){delete this.partials[e]},registerDecorator:function(e,t){if("[object Object]"===p.call(e)){if(t)throw new b("Arg not supported with multiple decorators");u(this.decorators,e)}else this.decorators[e]=t},unregisterDecorator:function(e){delete this.decorators[e]},resetLoggedPropertyAccesses(){Object.keys(x).forEach(e=>{delete x[e]})}};let H=M.log;function N(e){this.string=e}N.prototype.toString=N.prototype.toHTML=function(){return""+this.string};var D=N;function V(e){const t=e&&e[0]||1;if(!(t>=I&&t<=j)){if(t{let r=e[n];e[n]=function(e,t){const n=t.lookupProperty;return function(e,t){return"function"!=typeof e?e:function(){const n=arguments[arguments.length-1];return arguments[arguments.length-1]=t(n),e.apply(this,arguments)}}(e,e=>u({lookupProperty:n},e))}(r,t)})}(i,r),r.helpers=i,e.usePartial&&(r.partials=r.mergeIfNeeded(o.partials,t.partials)),(e.usePartial||e.useDecorators)&&(r.decorators=u({},t.decorators,o.decorators)),r.hooks={},r.protoAccessControl=function(e){let t=Object.create(null);t.constructor=!1,t.__defineGetter__=!1,t.__defineSetter__=!1,t.__lookupGetter__=!1;let n=Object.create(null);return n.__proto__=!1,{properties:{whitelist:A(n,e.allowedProtoProperties),defaultValue:e.allowProtoPropertiesByDefault},methods:{whitelist:A(t,e.allowedProtoMethods),defaultValue:e.allowProtoMethodsByDefault}}}(o);let a=o.allowCallsToHelperMissing||n;P(r,"helperMissing",a),P(r,"blockHelperMissing",a)}},o._child=function(t,n,o,i){if(e.useBlockParams&&!o)throw new b("must pass block params");if(e.useDepths&&!i)throw new b("must pass parent depths");return G(r,t,e[t],n,0,o,i)},o}function G(e,t,n,r,o,i,a){function l(t,o={}){let l=a;return!a||t==a[0]||t===e.nullContext&&null===a[0]||(l=[t].concat(a)),n(e,t,e.helpers,e.partials,o.data||r,i&&[o.blockParams].concat(i),l)}return(l=U(n,l,e,a,r,i)).program=t,l.depth=a?a.length:0,l.blockParams=o||0,l}function Z(e,t,n){return e?e.call||n.name||(n.name=e,e=n.partials[e]):e="@partial-block"===n.name?n.data["partial-block"]:n.partials[n.name],e}function F(e,t,n){const r=n.data&&n.data["partial-block"];let o;if(n.partial=!0,n.ids&&(n.data.contextPath=n.ids[0]||n.data.contextPath),n.fn&&n.fn!==q){n.data=v(n.data);let e=n.fn;o=n.data["partial-block"]=function(t,n={}){return n.data=v(n.data),n.data["partial-block"]=r,e(t,n)},e.partials&&(n.partials=u({},n.partials,e.partials))}if(void 0===e&&o&&(e=o),void 0===e)throw new b("The partial "+n.name+" could not be found");if(e instanceof Function)return e(t,n)}function q(){return""}function U(e,t,n,r,o,i){if(e.decorator){let a={};u(t=e.decorator(t,a,n,r&&r[0],o,i,r),a)}return t}function Y(){let e=new R;return u(e,o),e.SafeString=D,e.Exception=b,e.Utils=r,e.escapeExpression=m,e.VM=i,e.template=function(t){return B(t,e)},e}let K=Y();K.create=Y,function(e){let t="undefined"!=typeof global?global:window,n=t.Handlebars;e.noConflict=function(){return t.Handlebars===e&&(t.Handlebars=n),e}}(K),K.default=K;t.default=K}])); } catch (e) { if (typeof window.Evergage === "object" && typeof window.Evergage.getVersion === "function" && window.Evergage.getVersion() >= 5) { Evergage.sendException(e, "beaconExtension: Handlebars Templates:index.js"); } }; try { // syncs with @frontend/packages/ui-chrome-extension/src/constants.ts#CUSTOM_EVENT.MESSAGE_FROM_INTERACTION_STUDIO_TOOLS_GEAR var VE_CUSTOM_EVENT_NAME = 'msg_from_interaction_studio_tools_gear'; // syncs with @frontend/packages/ui-chrome-extension/src/constants.ts#EVENT_TYPE.MESSAGE_FROM_INTERACTION_STUDIO_TOOLS_GEAR var TO_LAUNCHER_MESSAGE_TYPE = 'nxve_messageFromInteractionStudioToolsGear'; var TO_LAUNCHER_PAYLOAD_TYPE = 'beaconSDK_domEvent'; function sendMessageToEvergageLauncher(message) { try { document.dispatchEvent( new CustomEvent(VE_CUSTOM_EVENT_NAME, { detail: JSON.stringify(message), }) ); } catch (e) { console.error(e); } } var eventLinkId = null; if (Evergage !== null) { document.addEventListener(Evergage.CustomEvents.OnInit, function ( domEvent ) { sendMessageToEvergageLauncher({ type: TO_LAUNCHER_MESSAGE_TYPE, payload: { type: TO_LAUNCHER_PAYLOAD_TYPE, payload: { name: Evergage.CustomEvents.OnInit, detail: domEvent.detail, }, }, }); }); document.addEventListener(Evergage.CustomEvents.OnEventSend, function ( domEvent ) { eventLinkId = Math.random().toString().slice(2); const { actionEvent } = domEvent.detail || {}; actionEvent._toolsEventLinkId = eventLinkId; if (actionEvent.interaction) { actionEvent.explain = true; } else { actionEvent.debug = Object.assign( (actionEvent.debug || {}), { explanations: true } ); } sendMessageToEvergageLauncher({ type: TO_LAUNCHER_MESSAGE_TYPE, payload: { type: TO_LAUNCHER_PAYLOAD_TYPE, payload: { name: Evergage.CustomEvents.OnEventSend, detail: domEvent.detail, }, }, }); }); document.addEventListener(Evergage.CustomEvents.OnEventResponse, function ( domEvent ) { if (domEvent.detail) { const currentPage = Evergage.getCurrentPage(); const sitemapConfig = Evergage.getState().config; const matchedPageConfig = Evergage.getState().result && Evergage.getState().result.matchedConfig; eventLinkId = null; sendMessageToEvergageLauncher({ type: TO_LAUNCHER_MESSAGE_TYPE, payload: { type: TO_LAUNCHER_PAYLOAD_TYPE, payload: { name: Evergage.CustomEvents.OnEventResponse, detail: { response: domEvent.detail.response, currentPage: currentPage, sitemapConfig: sitemapConfig, matchedPageConfig: matchedPageConfig, }, }, }, }); } }); } } catch (e) { if (typeof window.Evergage === "object" && typeof window.Evergage.getVersion === "function" && window.Evergage.getVersion() >= 5) { Evergage.sendException(e, "beaconExtension: System Tools:interactionStudioTools.js"); } }; try { Evergage.Surveys = Evergage.Surveys || (function() { var SURVEY_ACTION = { SUBMIT: "submit", PAGE_NEXT: "pageNext", PAGE_PREV: "pagePrev" }; var SURVEY_EVENT_PARAM = { SURVEY_ACTION: 'surveyAction', SURVEY_ID: 'surveyId', SURVEY_START_TIME: 'surveyStartTime' }; var initialized = false; function isInitialized() { return (initialized || typeof window.Survey === 'object'); } /** * processSurveyResponses * ** recursive ** * @param responses {object} a collection of survey element response values keyed by element.name (question.name) * @param elements {object} a collection of SurveyElements for a given page or panel of a survey * @param addResponseFn {function} invoked for each questionType element that has been processed */ function processSurveyResponses(elements, survey, sender) { try { var shouldHandleElementAsPanel = function(element) { return (element.type === 'panel' && Evergage.cashDom.isArray(element.elements) && element.elements.length !== 0 && !isString(element.questionId)); }; var formatAnswer = function(answer) { var result = (answer) ? answer : null; if (result != null && Evergage.cashDom.isArray(result) || isPlainObject(result)) { result = JSON.stringify(result); } return result; }; var formatQuestionId = function(element, rowId) { var questionId = "survey:" + survey.id + ":" + element.questionId; if (isString(rowId)) { questionId += ":" + rowId; } return questionId; }; var responses = []; for (var elementIndex = 0; elementIndex < elements.length; elementIndex++) { var element = elements[elementIndex]; if (shouldHandleElementAsPanel(element)) { responses = responses.concat(processSurveyResponses(element.elements, survey, sender)); } else { if (element.type === "matrix") { for (var rowIndex = 0; rowIndex < element.rows.length; rowIndex++) { var row = element.rows[rowIndex]; var rowId = element.rowIds[rowIndex]; var allRowsValues = sender.data[element.name] ? sender.data[element.name] : {}; if (allRowsValues[row.value]) { var rowValue = allRowsValues[row.value]; responses.push({ questionId: formatQuestionId(element, rowId), answer: rowValue }); } } } else { var answer = formatAnswer(sender.data[element.name]); if (answer) { responses.push({ questionId: formatQuestionId(element), answer: answer }); } } } } return responses; } catch (e) { Evergage.log.error('Evergage: There was an error when attempting to ' + 'process survey responses: ', e); } } function isPlainObject(obj) { if (typeof obj !== 'object' || obj === null) return false; const proto = Object.getPrototypeOf(obj); return proto === null || proto === Object.prototype; } function isString(property) { return typeof property === 'string' || property instanceof String; } function handleSurveyAction(surveyAction, survey, sender) { try { if (surveyAction === SURVEY_ACTION.PAGE_NEXT) { return; } else { var surveyActionEvent = new SurveyActionEvent(surveyAction, survey.id, new Date().getTime()); Evergage.cashDom.each(survey.config.pages, function(index, page) { surveyActionEvent.addResponses(processSurveyResponses(page.elements, survey, sender)); }); surveyActionEvent.send(); } } catch (e) { Evergage.log.error('Evergage: There was an error when attempting to ' + 'submit survey responses surveyId[' + message.surveyConfig.survey.id + ']: ', e); } } function renderSurvey(survey, renderTarget) { if (typeof survey !== "object" || !renderTarget) return Evergage.log.error("Evergage: renderSurvey arguments are not valid"); return injectSurveyResourcesIntoPage().then(() => { try { if (surveyAlreadyRendered(survey.id, renderTarget)) return; window.Survey.JsonObject.metaData.addProperty("questionbase", "questionId"); window.Survey.JsonObject.metaData.addProperty("questionbase", "rowIds"); var surveyModel = new window.Survey.Model(survey.config); // eslint-disable-next-line new-cap Evergage.cashDom(renderTarget).Survey({ model: surveyModel, onComplete: function(sender) { handleSurveyAction(SURVEY_ACTION.SUBMIT, survey, sender); }, onPartialSend: function(sender) { handleSurveyAction(SURVEY_ACTION.PAGE_NEXT, survey, sender); } }); Evergage.cashDom(renderTarget).attr("data-evg-survey-id", survey.id); } catch (e) { Evergage.log.error('Evergage: There was an error when attempting to render the survey', e); } }); } function injectSurveyResourceIntoPage(type, url) { try { var documentHead = document.head || document.getElementsByTagName('head')[0]; var isStylesheet = (type === 'style'); var surveyResourceElement = document.createElement(isStylesheet ? 'link' : 'script'); surveyResourceElement.setAttribute('type', ((isStylesheet) ? 'text/css' : 'text/javascript')); surveyResourceElement.setAttribute('class', 'evergageSurvey-' + type); surveyResourceElement.setAttribute(((isStylesheet) ? 'href' : 'src'), url); if (isStylesheet) { surveyResourceElement.setAttribute('rel', 'stylesheet'); } documentHead.appendChild(surveyResourceElement); Evergage.log.trace('Evergage: Injected survey resource of type[' + type + '] url[' + url + ']'); } catch (e) { Evergage.log.error('Evergage: There was an error when attempting to inject surveyJS resources into the page: ', e); } } function injectSurveyResourcesIntoPage() { return new Promise(resolve => { if (isInitialized()) { return resolve(); } var SURVEY_JS_CDN_BASE_URL = '//cdn.evergage.com/evergage-content/3pp'; var SURVEY_JS_VERSION = 'surveyjs-1.0.95'; var SURVEY_JS_SCRIPT_NAME = 'survey.cash.min.js'; var SURVEY_JS_STYLESHEET_NAME = 'survey.min.css'; Object.entries({ script: [SURVEY_JS_CDN_BASE_URL, SURVEY_JS_VERSION, SURVEY_JS_SCRIPT_NAME].join('/'), style: [SURVEY_JS_CDN_BASE_URL, SURVEY_JS_VERSION, SURVEY_JS_STYLESHEET_NAME].join('/') }).forEach(function(entry) { const [resourceType, resourceUrl] = entry injectSurveyResourceIntoPage(resourceType, resourceUrl); }); var interval = setInterval(function(){ if (Evergage.cashDom.fn.Survey != null && window.Survey != null) { clearInterval(interval); initialized = true; resolve(); } }, 100); }) } function surveyAlreadyRendered(surveyId, renderTarget) { return Evergage.cashDom(renderTarget).attr("data-evg-survey-id") === surveyId; } function SurveyActionEvent(surveyAction, surveyId, timestamp) { this.params = { source: {}, attributes: {} }; this.params.source[SURVEY_EVENT_PARAM.SURVEY_ACTION] = surveyAction; this.params.source[SURVEY_EVENT_PARAM.SURVEY_ID] = surveyId; this.params.source[SURVEY_EVENT_PARAM.SURVEY_START_TIME] = timestamp; } SurveyActionEvent.prototype.addResponses = function(responses) { for (var i = 0; i < responses.length; i++) { var response = responses[i]; this.addResponse(response.questionId, response.answer); } }; SurveyActionEvent.prototype.addResponse = function(name, value) { Evergage.log.trace('Evergage: Adding response to SurveyActionEvent: ' + JSON.stringify({ name: name, value: value })); this.params.attributes[name] = value; }; SurveyActionEvent.prototype.send = function() { Evergage.log.trace('Evergage: Tracking survey event: ', this.params); Evergage.sendEvent({ action: "Survey " + this.params.source[SURVEY_EVENT_PARAM.SURVEY_ACTION], source: this.params.source, user: { attributes: this.params.attributes } }); }; return { renderSurvey: renderSurvey, injectSurveyResourcesIntoPage: injectSurveyResourcesIntoPage }; })(window); if (window.SalesforceInteractions && window.SalesforceInteractions.mcis) { window.SalesforceInteractions.mcis.Surveys = Evergage.Surveys; } } catch (e) { if (typeof window.Evergage === "object" && typeof window.Evergage.getVersion === "function" && window.Evergage.getVersion() >= 5) { Evergage.sendException(e, "beaconExtension: Surveys:SurveyJS.js"); } }; try { (function () { var VE_LOCAL_STORAGE_KEY = 'evgVE'; var SITEMAP_EDITOR_LOCAL_STORAGE_KEY = 'evgVE-cdp-sitemap-editor'; var SdkNamespace = window.Evergage || window.SalesforceInteractions; function injectEditorLaunchScript(isStandaloneSitemapEditor) { try { // getConfig() is not exposed on the Salesforce/CDP build of the SDK var trackerUrl = typeof SdkNamespace.getConfig === 'function' && SdkNamespace.getConfig().trackerUrl; var baseUrl = !isStandaloneSitemapEditor && trackerUrl ? trackerUrl : 'https://cdn.evergage.com'; var scriptPath = isStandaloneSitemapEditor ? '/evergage-content/sitemap-editor/4.0.2/launch.sitemap-editor.js' : '/visual-editor/launch.js'; var scriptUrl = [baseUrl, scriptPath].join(''); var scriptTag = document.createElement('script'); scriptTag.setAttribute('id', 'salesforceInteractionsLauncherScript'); scriptTag.src = scriptUrl; if ( document.getElementById('salesforceInteractionsLauncherScript') == null ) { document.head.appendChild(scriptTag); } else { SdkNamespace.log.info('Launch script is already here.'); } } catch (err) { SdkNamespace.log.error( 'Failed to inject Salesforce Interactions Launcher script: ' + err ); } } function getUrlBoolean(name) { name = name.replace(/[\[]/, '\\[').replace(/[\]]/, '\\]'); var regex = new RegExp('[\\?&]' + name + '=([^&#]*)'); var results = regex.exec(location.search); return results === null ? null : results[1] === 'true'; } var visualEditorParam = getUrlBoolean('evergageEditor'); var standaloneEditorParam = getUrlBoolean('salesforceInteractionsSitemapEditor'); var visualEditorEnabledInStorage = function () { return window.localStorage[VE_LOCAL_STORAGE_KEY] === 'true'; }; var standloneSitemapEditorEnabledInStorage = function () { return window.localStorage[SITEMAP_EDITOR_LOCAL_STORAGE_KEY] === 'true'; }; // honor and set local storage based off queryParam if (visualEditorParam !== null) { window.localStorage.setItem(VE_LOCAL_STORAGE_KEY, visualEditorParam); } if (standaloneEditorParam !== null) { window.localStorage.setItem( SITEMAP_EDITOR_LOCAL_STORAGE_KEY, standaloneEditorParam ); } var inSiteEditorFrameContext = window.frameElement && window.frameElement.id === 'siteEditorFrame'; // trigger off of localStorage only // chrome extension reads/sets localStorage more easily than modifying the currentTab URL if ( !visualEditorEnabledInStorage() && !standloneSitemapEditorEnabledInStorage() && !inSiteEditorFrameContext ) { return; } if (window.top === window.self || inSiteEditorFrameContext) { document.addEventListener( SdkNamespace.CustomEvents.OnInit, (event) => { injectEditorLaunchScript( standloneSitemapEditorEnabledInStorage() ); event.preventDefault(); }, { once: true } ); } })(); } catch (e) { if (typeof window.Evergage === "object" && typeof window.Evergage.getVersion === "function" && window.Evergage.getVersion() >= 5) { Evergage.sendException(e, "beaconExtension: Visual Editor:visualEditor.js"); } }; try { var evgr = Evergage.resolvers; SalesforceInteractions.init({ cookieDomain: "booking.com" }).then(() => { const buildLocale = () => { let l = SalesforceInteractions.cashDom("html").attr("lang"); var locale; const localeMap = { "en-us": "en_US", "en": "en_GB", "fr": "fr_FR", "es": "es_ES", "bg": "bg_BG", "cs": "cs_CZ", "de": "de_DE", "el": "el_GR", "xa": "es_AR", "hr": "hr_HR", "it": "it_IT", "hu": "hu_HU", "nl": "nl_NL", "pl": "pl_PL", "pt-pt": "pt_PT", "pt-br": "pt_BR", "ro": "ro_RO", "ru": "ru_RU", "sr": "sr_RS", "sv": "sv_SE", "tr": "tr_TR", "ar": "ar_AE", "he": "he_IL", "id": "id_ID", "xt": "zh_TW", "zh-hans": "zh_CN", "ko": "ko_KR", "ja": "ja_JP", "th": "th_TH", "vi": "vi_VN", }; if (l in localeMap) locale = localeMap[l]; return locale; }; const trainingSignUpSelector = ` #block-booking-content > article > div > div > div:nth-child(1) > div > div > div > div > div.layout__region.bui-grid__column-full.bui-grid__column-6\\@large.layout__region--first > div > div > div > p:nth-child(3) > a, #block-booking-content > article > div > div > div:nth-child(8) > div > div > div > div > div.layout__region.layout__region--first.bui-grid__column-full.bui-grid__column-8\\@large > div > div > div > p > a.bui-button.bui-button--primary `; const joinArticleGetStartedSelectors = ` #paragraph-hero-campaign-16107 > div > div > a, #block-booking-content > article > div > div > div:nth-child(8) > div > div > div > div > div > div > div > p:nth-child(2) > a, #block-booking-content > article > div > div > div:nth-child(11) > div > div > div > div > div > div > div > div > p:nth-child(3) > a `; const extranetPaymentsByBookingSelectors = ` .join-payments-hero__payments.bui-spacer--large > * button, .join-payments-hero__payments.bui-spacer--large > * button *, .join-payments-cta > * button, .join-payments-cta > * button * `; const extranetAddPhotosSelectors = ` [class*="bui-button bui-button--primary"][photos-page-tour-second-step], .photo-item__empty, .panoramic-gallery-card-button.bui-button.bui-button--primary `; const buildImage = () => { let sc = getAttributeFromDataLayer("gtmPageTitle").gtmPageTitle.split("|")[1].split('-').pop(); var image; const scMap = { //Account & Log in "400": "https://partner.booking.com/sites/default/files/2022-11/Women%20in%20Tech%5B79%5D%20%281%29_0.jpg", "401": "https://partner.booking.com/sites/default/files/2022-11/Women%20in%20Tech%5B79%5D%20%281%29_0.jpg", //Working with Connectivity Providers "412": "https://partner.booking.com/sites/default/files/2022-11/gettyimages-1178688001_optimized.jpg", "389": "https://partner.booking.com/sites/default/files/2022-11/gettyimages-1178688001_optimized.jpg", "406": "https://partner.booking.com/sites/default/files/2022-11/gettyimages-1178688001_optimized.jpg", "408": "https://partner.booking.com/sites/default/files/2022-11/gettyimages-1178688001_optimized.jpg", "409": "https://partner.booking.com/sites/default/files/2022-11/gettyimages-1178688001_optimized.jpg", "407": "https://partner.booking.com/sites/default/files/2022-11/gettyimages-1178688001_optimized.jpg", "410": "https://partner.booking.com/sites/default/files/2022-11/gettyimages-1178688001_optimized.jpg", "411": "https://partner.booking.com/sites/default/files/2022-11/gettyimages-1178688001_optimized.jpg", //Commercial Insights "402": "https://partner.booking.com/sites/default/files/2022-11/gettyimages-1191193130_optimized.jpg", "403": "https://partner.booking.com/sites/default/files/2022-11/gettyimages-1191193130_optimized.jpg", //Comissions, Invoices & Tax "426": "https://partner.booking.com/sites/default/files/2022-11/_xph_customlandmark-12490-002_optimized.jpg", "427": "https://partner.booking.com/sites/default/files/2022-11/_xph_customlandmark-12490-002_optimized.jpg", "391": "https://partner.booking.com/sites/default/files/2022-11/_xph_customlandmark-12490-002_optimized.jpg", "393": "https://partner.booking.com/sites/default/files/2022-11/_xph_customlandmark-12490-002_optimized.jpg", //Your First Steps with Booking.com "419": "https://partner.booking.com/sites/default/files/2022-11/gettyimages-1169548088_optimized.jpg", "418": "https://partner.booking.com/sites/default/files/2022-11/gettyimages-1169548088_optimized.jpg", //Growing your business "440": "https://partner.booking.com/sites/default/files/2022-11/gettyimages-1404746311_optimized.jpg", "394": "https://partner.booking.com/sites/default/files/2022-11/gettyimages-1404746311_optimized.jpg", "422": "https://partner.booking.com/sites/default/files/2022-11/gettyimages-1404746311_optimized.jpg", //Guest Reviews "442": "https://partner.booking.com/sites/default/files/2022-11/gettyimages-1159376681_optimized.jpg", "416": "https://partner.booking.com/sites/default/files/2022-11/gettyimages-1159376681_optimized.jpg", //Legal & Security "649": "https://partner.booking.com/sites/default/files/2022-11/gettyimages-1332711299_optimized.jpg", "392": "https://partner.booking.com/sites/default/files/2022-11/gettyimages-1332711299_optimized.jpg", "425": "https://partner.booking.com/sites/default/files/2022-11/gettyimages-1332711299_optimized.jpg", //Guest Policies & Payments "435": "https://partner.booking.com/sites/default/files/2022-11/gettyimages-1169552292_optimized.jpg", "433": "https://partner.booking.com/sites/default/files/2022-11/gettyimages-1169552292_optimized.jpg", "395": "https://partner.booking.com/sites/default/files/2022-11/gettyimages-1169552292_optimized.jpg", //Your Property Page Content "399": "https://partner.booking.com/sites/default/files/2022-11/gettyimages-900233634_optimized.jpg", "443": "https://partner.booking.com/sites/default/files/2022-11/gettyimages-900233634_optimized.jpg", "428": "https://partner.booking.com/sites/default/files/2022-11/gettyimages-900233634_optimized.jpg", "576": "https://partner.booking.com/sites/default/files/2022-11/gettyimages-900233634_optimized.jpg", //Your Reservations "414": "https://partner.booking.com/sites/default/files/2022-11/gettyimages-1169549804_optimized.jpg", "423": "https://partner.booking.com/sites/default/files/2022-11/gettyimages-1169549804_optimized.jpg", "413": "https://partner.booking.com/sites/default/files/2022-11/gettyimages-1169549804_optimized.jpg", "415": "https://partner.booking.com/sites/default/files/2022-11/gettyimages-1169549804_optimized.jpg", "434": "https://partner.booking.com/sites/default/files/2022-11/gettyimages-1169549804_optimized.jpg", "397": "https://partner.booking.com/sites/default/files/2022-11/gettyimages-1169549804_optimized.jpg", "396": "https://partner.booking.com/sites/default/files/2022-11/gettyimages-1169549804_optimized.jpg", //Your Rates & Availability "432": "https://partner.booking.com/sites/default/files/2022-11/gettyimages-1322234491_1_optimized.jpg", "431": "https://partner.booking.com/sites/default/files/2022-11/gettyimages-1322234491_1_optimized.jpg", "441": "https://partner.booking.com/sites/default/files/2022-11/gettyimages-1322234491_1_optimized.jpg", "398": "https://partner.booking.com/sites/default/files/2022-11/gettyimages-1322234491_1_optimized.jpg", //Working together with Booking.com "404": "https://partner.booking.com/sites/default/files/2022-11/gettyimages-1325134720_optimized.jpg", "420": "https://partner.booking.com/sites/default/files/2022-11/gettyimages-1325134720_optimized.jpg", //Feedback, Technical Support & Contacting Us "436": "https://partner.booking.com/sites/default/files/2022-11/gettyimages-1332711299_optimized.jpg", "439": "https://partner.booking.com/sites/default/files/2022-11/gettyimages-1332711299_optimized.jpg", }; if (dataLayer && getAttributeFromDataLayer("gtmPageTitle")) { if (sc in scMap) image = scMap[sc]; return image; } }; const buildCategory = () => { let mc = getAttributeFromDataLayer("gtmPageTitle").gtmPageTitle.split("|")[1].split('-').pop(); var maincat; const mcMap = { //Account & Log in "400": "378", "401": "378", //Working with Connectivity Providers "412": "381", "389": "381", "406": "381", "408": "381", "409": "381", "407": "381", "410": "381", "411": "381", //Commercial Insights "402": "379", "403": "379", //Comissions, Invoices & Tax "426": "383", "427": "383", "391": "383", "393": "383", //Your First Steps with Booking.com "419": "373", "418": "373", //Growing your business "440": "385", "394": "385", "422": "385", //Guest Reviews "442": "374", "416": "374", //Legal & Security "649": "375", "392": "375", "425": "375", //Guest Policies & Payments "435": "376", "433": "376", "395": "376", //Your Property Page Content "399": "377", "443": "377", "428": "377", "576": "377", //Your Reservations "414": "387", "423": "387", "413": "387", "415": "387", "434": "387", "397": "387", "396": "387", //Your Rates & Availability "432": "386", "431": "386", "441": "386", "398": "386", //Working together with Booking.com "404": "382", "420": "382", //Feedback, Technical Support & Contacting Us "436": "384", "439": "384", }; if (dataLayer && getAttributeFromDataLayer("gtmPageTitle")) { if (mc in mcMap) maincat = mcMap[mc]; return maincat; } }; let partnerSiteConfig = { global: { locale: buildLocale(), contentZones: [ { name: "sidebar_banner", selector: ".youwe-sidebar-banner" }, { name: "popup_survey" }, { name: "booking_mcp_ga" }, ], onActionEvent: (actionEvent) => { //CMSUserId if (getAttributeFromDataLayer("userId") && (getAttributeFromDataLayer("userId").userId != 0)) { const userId = getAttributeFromDataLayer("userId").userId; actionEvent.user = actionEvent.user || {}; actionEvent.user.identities = actionEvent.user.identities || {}; actionEvent.user.identities.cmsUserID = userId; } //Expid const expid = getAttributeFromDataLayer("expid"); if (expid != undefined && expid != null && expid.expid != undefined) { actionEvent.user = actionEvent.user || {}; actionEvent.user.identities = actionEvent.user.attributes || {}; actionEvent.user.identities.expid = expid.expid; } const gaCookie = getCookie("_ga") if (gaCookie != undefined && gaCookie != null) { actionEvent.user = actionEvent.user || {}; actionEvent.user.identities = actionEvent.user.attributes || {}; actionEvent.user.identities.gaClientId = gaCookie.substring(6); } // HotelID const hotelIDParam = new URLSearchParams(window.location.search); const url = window.location.href; const hash = window.location.hash; const getParameterValue = (url, parameter) => { parameter = parameter.replace(/[\[\]]/g, '\\$&'); const regex = new RegExp('[?&]' + parameter + '(=([^&#]*)|&|#|$)'); const results = regex.exec(url); if (!results || !results[2]) return null; return decodeURIComponent(results[2].replace(/\+/g, ' ')); }; const hotelId = getParameterValue(url, 'hotel_id'); if (hash.includes('hotel_id')) { actionEvent.user = actionEvent.user || {}; actionEvent.user.identities = actionEvent.user.identities || {}; actionEvent.user.profileObjects = actionEvent.user.profileObjects || {}; actionEvent.user.profileObjects.UserHotel = actionEvent.user.profileObjects.UserHotel || []; if (hotelId) { let newHotel = { id: hotelId, attributes: { channel: "Email" } }; actionEvent?.user?.profileObjects?.['UserHotel'].push(newHotel); } } else if (!window.location.hash && hotelIDParam.has('hotel_id')) { actionEvent.user = actionEvent.user || {}; actionEvent.user.identities = actionEvent.user.identities || {}; actionEvent.user.profileObjects = actionEvent.user.profileObjects || {}; actionEvent.user.profileObjects.UserHotel = actionEvent.user.profileObjects.UserHotel || []; const hotelIdFromParam = hotelIDParam.get('hotel_id'); if (hotelIdFromParam) { let newHotel = { id: hotelIdFromParam, attributes: { channel: "Email" } }; actionEvent?.user?.profileObjects?.['UserHotel'].push(newHotel); } } return actionEvent; }, //Catalog Object listeners: [ SalesforceInteractions.DisplayUtils.pageElementVisible('html').then(() => { const hotelIDParam = new URLSearchParams(window.location.search); const url = window.location.href; const hash = window.location.hash; const getParameterValue = (url, parameter) => { parameter = parameter.replace(/[\[\]]/g, '\\$&'); const regex = new RegExp('[?&]' + parameter + '(=([^&#]*)|&|#|$)'); const results = regex.exec(url); if (!results || !results[2]) return null; return decodeURIComponent(results[2].replace(/\+/g, ' ')); }; // Get the hotel_id value from the URL const hotelId = getParameterValue(url, 'hotel_id'); if (hash.includes('hotel_id')) { SalesforceInteractions.sendEvent({ interaction: { name: SalesforceInteractions.CatalogObjectInteractionName.ViewCatalogObject, catalogObject: { type: "Hotel", id: hotelId, }, }, }); } else if (!window.location.hash && hotelIDParam.has('hotel_id')) { SalesforceInteractions.sendEvent({ interaction: { name: SalesforceInteractions.CatalogObjectInteractionName.ViewCatalogObject, catalogObject: { type: "Hotel", id: hotelIDParam.get('hotel_id'), }, }, }); } }), ], }, pageTypeDefault: { name: "default", interaction: { name: "Default Page", }, }, pageTypes: [ { name: "Homepage", isMatch: () => new Promise((resolve, reject) => { let intervalId = setInterval(() => { if (window.dataLayer && window.dataLayer.length > 0) { clearInterval(intervalId); if (getAttributeFromDataLayer("gtmPageTitle") && getAttributeFromDataLayer("gtmPageTitle").gtmPageTitle.split("|")[0].split('-')[0] === "NEW Homepage") { resolve(true); } else { resolve(false); } } }, 300); }), interaction: { name: "Viewed Homepage" }, contentZones: [ { name: "homepage_carousel", selector: "article[data-banner-area='Hero']" }, //{ name: "booking_banner", selector: "#paragraph-viewsreference-6059 > div > div > div > div > div > div.field__items.slick-initialized.slick-slider > div > div > div > div > article" }, //{ name: "booking_homepage_background", selector: ".stream-tra2023 .tra__homepage-background" }, { name: "homepage_mini_hero_banner", selector: "#block-booking-content > article > div > div > div:nth-child(4) > div" }, { name: "homepage_recommended_reads", selector: "#paragraph-viewsreference-6063 > div > div > div > div > div.bui-carousel__inner.slick-initialized.slick-slider.slick-dotted > div > div" }, { name: "homepage_recommended_reads_1st_teaser", selector: "#slick-slide00 > div > div > article" }, { name: "homepage_cta", selector: "a[data-entity-uuid='d6109d2a-18a2-4f7d-b346-36437712dd0e']" }, ] }, { name: "Search Results", isMatch: () => new Promise((resolve, reject) => { let intervalId = setInterval(() => { if (window.dataLayer && window.dataLayer.length > 0) { clearInterval(intervalId); if (getAttributeFromDataLayer("gtmPageTitle") && getAttributeFromDataLayer("gtmPageTitle").gtmPageTitle === "Search results-11458") { resolve(true); } else { resolve(false); } } }, 300); }), interaction: { name: "Viewed Search Results" }, }, { name: "Legal Resources Main", action: "Viewed Legal Resources Main", isMatch: () => new Promise((resolve, reject) => { let intervalId = setInterval(() => { if (window.dataLayer && window.dataLayer.length > 0) { clearInterval(intervalId); if (getAttributeFromDataLayer("gtmPageTitle") != undefined && getAttributeFromDataLayer("gtmPageTitle").gtmPageTitle === "Legal resources-3560") { resolve(true); } else { resolve(false); } } }, 300); }), interaction: { name: SalesforceInteractions.CatalogObjectInteractionName.ViewCatalogObject, catalogObject: { type: "Category", id: () => { return "3560" }, attributes: { name: () => { return "Legal Resources"; }, }, }, }, }, { name: "Legal Resources Article", isMatch: () => new Promise((resolve, reject) => { let intervalId = setInterval(() => { if (window.dataLayer && window.dataLayer.length > 0) { clearInterval(intervalId); const dlElement = getAttributeFromDataLayer("gtmPageTitle").gtmPageTitle.split("|"); if (getAttributeFromDataLayer("gtmPageTitle") && (dlElement[0].split('-')[0] === "Legal resources")) { resolve(true); } else { resolve(false); } } }, 300); }), interaction: { name: SalesforceInteractions.CatalogObjectInteractionName.ViewCatalogObject, catalogObject: { type: "Article", id: () => { if (dataLayer) { const id = getAttributeFromDataLayer("gtmPageTitle").gtmPageTitle.split("-").pop(); return id; } }, attributes: { name: () => { return SalesforceInteractions.cashDom("h1").text(); }, url: SalesforceInteractions.resolvers.fromHref(), imageUrl: () => SalesforceInteractions.resolvers.fromMeta("og:image:url")(), description: () => { const des1 = SalesforceInteractions.resolvers.fromMeta("description")(); const des2 = SalesforceInteractions.cashDom("p:nth-child(4)").text(); return des1 !== undefined ? des1 : des2; }, }, relatedCatalogObjects: { Category: ["3560"], Language: () => { return [buildLocale()]; } }, }, }, onActionEvent: (actionEvent) => { const articleID = getAttributeFromDataLayer("gtmPageTitle").gtmPageTitle.split("-").pop(); if (dataLayer && articleID) { actionEvent.user = actionEvent.user || {}; actionEvent.user.attributes = actionEvent.user.attributes || {}; actionEvent.user.attributes.lastViewedArticleId = articleID; actionEvent.user.attributes.lastViewedSolutionsArticleId = articleID; } return actionEvent; }, }, { name: "Video Page", isMatch: () => new Promise((resolve, reject) => { let intervalId = setInterval(() => { if (window.dataLayer && window.dataLayer.length > 0) { clearInterval(intervalId); const gtmPageTitle = getAttributeFromDataLayer("gtmPageTitle"); if (gtmPageTitle != undefined && gtmPageTitle.gtmPageTitle.startsWith("Video: ")) { resolve(true); } else { resolve(false); } } }, 300); }), interaction: { name: "Viewed Video Page" }, listeners: [ SalesforceInteractions.listener("click", "#block-booking-content > article > div > div > div:nth-child(2) > div > div > div > div > div.layout__region.layout__region--second.bui-grid__column-full.bui-grid__column-4\\@large > div > div > div > p:nth-child(7) > a.bui-button.bui-button--primary", () => { const gtmPageTitle = getAttributeFromDataLayer("gtmPageTitle"); if (gtmPageTitle !== undefined && gtmPageTitle.gtmPageTitle === "Video: Tips for capturing and uploading high-quality photos-132906") { SalesforceInteractions.sendEvent({ interaction: { name: "Continue Your Registration - Video Page" } }); } }), ] }, { name: "Profile Library Page", isMatch: () => new Promise((resolve, reject) => { let intervalId = setInterval(() => { if (window.dataLayer && window.dataLayer.length > 0) { clearInterval(intervalId); if (getAttributeFromDataLayer("gtmPageTitle") != undefined && getAttributeFromDataLayer("gtmPageTitle").gtmPageTitle === "my-library") { resolve(true); } else { resolve(false); } } }, 300); }), interaction: { name: "Viewed Profile Page" }, contentZones: [ { name: "profile_page_banner", selector: "#profile-banner-container" }, { name: "library_page_recs", selector: "#panel-recommended" } ] }, { name: "Profile Opportunities Page", isMatch: () => new Promise((resolve, reject) => { let intervalId = setInterval(() => { if (window.dataLayer && window.dataLayer.length > 0) { clearInterval(intervalId); const gtmPageTitle = getAttributeFromDataLayer("gtmPageTitle"); if (gtmPageTitle != undefined && gtmPageTitle.gtmPageTitle === "my-opportunities") { resolve(true); } else { resolve(false); } } }, 300); }), interaction: { name: "Viewed Profile Opportunities Page" }, contentZones: [ { name: "profile_opportunities_recommendations", selector: "#block-booking-content > article > div.own-user-profile__tabs" }, ] }, { name: "Solutions Main", //action: "Viewed Solution Main", isMatch: () => new Promise((resolve, reject) => { let intervalId = setInterval(() => { if (window.dataLayer && window.dataLayer.length > 0) { clearInterval(intervalId); if (getAttributeFromDataLayer("gtmPageTitle") && getAttributeFromDataLayer("gtmPageTitle").gtmPageTitle === "Solutions-502|Solutions-2615") { resolve(true); } else { resolve(false); } } }, 300); }), contentZones: [ { name: "solution_main_page_advice", selector: "#slick-slide00 > div > div > article", } ], interaction: { name: SalesforceInteractions.CatalogObjectInteractionName.ViewCatalogObject, catalogObject: { type: "Category", id: () => { return "502"; }, attributes: { name: () => { return "Solutions"; }, }, }, }, }, { name: "Solutions Article", isMatch: () => new Promise((resolve, reject) => { let intervalId = setInterval(() => { if (window.dataLayer && window.dataLayer.length > 0) { clearInterval(intervalId); const dlElement = getAttributeFromDataLayer("gtmPageTitle").gtmPageTitle.split("|"); if (getAttributeFromDataLayer("gtmPageTitle") && (dlElement[0].split('-')[0] === "Solutions") || (dlElement[0].split('-')[0] === "Advice")) { resolve(true); } else { resolve(false); } } }, 300); }), interaction: { name: SalesforceInteractions.CatalogObjectInteractionName.ViewCatalogObject, catalogObject: { type: "Article", id: () => { if (dataLayer) { const id = getAttributeFromDataLayer("gtmPageTitle").gtmPageTitle.split("-").pop(); return id; } }, attributes: { name: SalesforceInteractions.cashDom("h1").text().trim(), url: SalesforceInteractions.resolvers.fromHref(), imageUrl: () => SalesforceInteractions.resolvers.fromMeta("og:image")(), description: () => { const des1 = SalesforceInteractions.resolvers.fromMeta("description")(); const des2 = SalesforceInteractions.cashDom("div > div > div > p:nth-child(1)").text(); return des1 !== undefined ? des1 : des2; }, }, relatedCatalogObjects: { Category: () => { if (dataLayer && getAttributeFromDataLayer("gtmPageTitle")) { //const subCat = getAttributeFromDataLayer("gtmPageTitle").gtmPageTitle.split("|")[1].split('-').pop(); return ["502"]; } }, AttributionLabel: () => { if (dataLayer && getAttributeFromDataLayer("attributionLabels")) { const attributionLabels = getAttributeFromDataLayer("attributionLabels").attributionLabels; return attributionLabels; } }, Language: () => { return [buildLocale()]; } }, }, }, onActionEvent: (actionEvent) => { const articleID = getAttributeFromDataLayer("gtmPageTitle").gtmPageTitle.split("-").pop(); if (dataLayer && articleID) { actionEvent.user = actionEvent.user || {}; actionEvent.user.attributes = actionEvent.user.attributes || {}; actionEvent.user.attributes.lastViewedArticleId = articleID; actionEvent.user.attributes.lastViewedSolutionsArticleId = articleID; } return actionEvent; }, listeners: [ //listener on buttons on drive performance page SalesforceInteractions.listener("click", "a.bui-button.bui-button--primary", () => { if (window.location.pathname.endsWith("/solutions/drive-performance-managing-your-property-content")) SalesforceInteractions.sendEvent({ interaction: { name: "Update property information" } }); }), SalesforceInteractions.listener("click", "a[title='very unhappy']", () => { SalesforceInteractions.sendEvent({ interaction: { name: "Feedback - Very unhappy" } }); }), SalesforceInteractions.listener("click", "a[title='unhappy']", () => { SalesforceInteractions.sendEvent({ interaction: { name: "Feedback - Unhappy" } }); }), SalesforceInteractions.listener("click", "a[title='neither happy nor unhappy']", () => { SalesforceInteractions.sendEvent({ interaction: { name: "Feedback - Neither happy nor unhappy" } }); }), SalesforceInteractions.listener("click", "a[title='happy']", () => { SalesforceInteractions.sendEvent({ interaction: { name: "Feedback - Happy" } }); }), SalesforceInteractions.listener("click", "a[title='very happy']", () => { SalesforceInteractions.sendEvent({ interaction: { name: "Feedback - Very happy" } }); }) ], contentZones: [ { name: "solutionsCTA", selector: "p:nth-child(8) > a:nth-child(1)", } ], }, { name: "News and Insights Main", //action: "Viewed News and Insights Main", isMatch: () => new Promise((resolve, reject) => { let intervalId = setInterval(() => { if (window.dataLayer && window.dataLayer.length > 0) { clearInterval(intervalId); const dlElement = getAttributeFromDataLayer("gtmPageTitle").gtmPageTitle; if (getAttributeFromDataLayer("gtmPageTitle") && (dlElement === "Click. Magazine-499|Click. Magazine-1548")) { resolve(true); } else { resolve(false); } } }, 300); }), interaction: { name: SalesforceInteractions.CatalogObjectInteractionName.ViewCatalogObject, catalogObject: { type: "Category", id: () => { return "499"; }, attributes: { name: SalesforceInteractions.cashDom("h1").text().trim(), url: SalesforceInteractions.resolvers.fromHref() /*name: () => { return "News and Insights"; },*/ }, }, }, }, { name: "News and Insights Category", isMatch: () => new Promise((resolve, reject) => { let intervalId = setInterval(() => { if (window.dataLayer && window.dataLayer.length > 0) { clearInterval(intervalId); const dlElement = getAttributeFromDataLayer("gtmPageTitle").gtmPageTitle; if (getAttributeFromDataLayer("gtmPageTitle") && (dlElement.split('-')[0] === "Click. Magazine" && getAttributeFromDataLayer("gtmPageTitle").gtmPageTitle.split("|").length === 2)) { resolve(true); } else { resolve(false); } } }, 300); }), interaction: { name: SalesforceInteractions.CatalogObjectInteractionName.ViewCatalogObject, catalogObject: { type: "Category", id: () => { const subCatID = getAttributeFromDataLayer("gtmPageTitle").gtmPageTitle.split('-')[2]; if (getAttributeFromDataLayer("gtmPageTitle")) { return "499" + "|" + subCatID; } }, attributes: { name: SalesforceInteractions.cashDom('h1').text().trim(), url: SalesforceInteractions.resolvers.fromHref() /*name: () => { const subCatName = getAttributeFromDataLayer("gtmPageTitle").gtmPageTitle.split('-')[1].split('|')[1]; if (getAttributeFromDataLayer("gtmPageTitle")) { return subCatName; } },*/ }, }, }, }, { name: "News and Insights Article", //action: "Viewed News and Insights Article", isMatch: () => new Promise((resolve, reject) => { let intervalId = setInterval(() => { if (window.dataLayer && window.dataLayer.length > 0) { clearInterval(intervalId); const dlElement = getAttributeFromDataLayer("gtmPageTitle").gtmPageTitle.split("|"); if (getAttributeFromDataLayer("gtmPageTitle") && (dlElement[0].split('-')[0] === "Click. Magazine") && getAttributeFromDataLayer("gtmPageTitle").gtmPageTitle.split("|").length === 3) { resolve(true); } else { resolve(false); } } }, 300); }), interaction: { name: SalesforceInteractions.CatalogObjectInteractionName.ViewCatalogObject, catalogObject: { type: "Article", id: () => { if (dataLayer) { const id = getAttributeFromDataLayer("gtmPageTitle").gtmPageTitle.split("-").pop(); return id; } }, attributes: { name: SalesforceInteractions.cashDom("h1").text().trim(), url: SalesforceInteractions.resolvers.fromHref(), imageUrl: () => SalesforceInteractions.resolvers.fromMeta("og:image")(), description: SalesforceInteractions.resolvers.fromSelector(".field__item > p:nth-child(2)") }, relatedCatalogObjects: { Category: () => { if (dataLayer && getAttributeFromDataLayer("gtmPageTitle")) { const subCat = getAttributeFromDataLayer("gtmPageTitle").gtmPageTitle.split("|")[1].split('-').pop(); return ["499" + "|" + subCat]; } }, AttributionLabel: () => { if (dataLayer && getAttributeFromDataLayer("attributionLabels")) { const attributionLabels = getAttributeFromDataLayer("attributionLabels").attributionLabels; return attributionLabels; } }, }, }, }, onActionEvent: (actionEvent) => { const articleID = getAttributeFromDataLayer("gtmPageTitle").gtmPageTitle.split("-").pop(); if (articleID) { actionEvent.user = actionEvent.user || {}; actionEvent.user.attributes = actionEvent.user.attributes || {}; actionEvent.user.attributes.lastViewedArticleId = articleID; actionEvent.user.attributes.lastViewedNIArticleId = articleID; } return actionEvent; }, listeners: [ SalesforceInteractions.listener("click", "a[title='very unhappy']", () => { SalesforceInteractions.sendEvent({ interaction: { name: "Feedback - Very unhappy" } }); }), SalesforceInteractions.listener("click", "a[title='unhappy']", () => { SalesforceInteractions.sendEvent({ interaction: { name: "Feedback - Unhappy" } }); }), SalesforceInteractions.listener("click", "a[title='neither happy nor unhappy']", () => { SalesforceInteractions.sendEvent({ interaction: { name: "Feedback - Neither happy nor unhappy" } }); }), SalesforceInteractions.listener("click", "a[title='happy']", () => { SalesforceInteractions.sendEvent({ interaction: { name: "Feedback - Happy" } }); }), SalesforceInteractions.listener("click", "a[title='very happy']", () => { SalesforceInteractions.sendEvent({ interaction: { name: "Feedback - Very happy" } }); }) ], }, { name: "Help Main", action: "Viewed Help Main", isMatch: () => new Promise((resolve, reject) => { let intervalId = setInterval(() => { if (window.dataLayer && window.dataLayer.length > 0) { clearInterval(intervalId); const dlElement = getAttributeFromDataLayer("gtmPageTitle").gtmPageTitle; if (getAttributeFromDataLayer("gtmPageTitle") && (dlElement === "Help-498|Partner Help-19")) { resolve(true); } else { resolve(false); } } }, 300); }), contentZones: [ { //name: "booking_help_banner", selector: "#paragraph-editors-pick-help-3553 > div:nth-child(1) > article", name: "help_main_page_featured_articles", selector: "#paragraph-editors-pick-help-3553 > div:nth-child(1) > article" }, { name: "help_main_page_featured_articles_and_header", selector: "#block-booking-content > article > div > div > div:nth-child(2)" }, ], interaction: { name: SalesforceInteractions.CatalogObjectInteractionName.ViewCatalogObject, catalogObject: { type: "Category", id: () => { return "498"; }, attributes: { name: SalesforceInteractions.cashDom("h1").text().trim(), url: SalesforceInteractions.resolvers.fromHref() /*name: () => { return "Partner Help"; },*/ }, }, }, }, { name: "Help Category", isMatch: () => new Promise((resolve, reject) => { let intervalId = setInterval(() => { if (window.dataLayer && window.dataLayer.length > 0) { clearInterval(intervalId); const dlElementS = getAttributeFromDataLayer("gtmPageTitle").gtmPageTitle.split("|"); const jsonEl = SalesforceInteractions.resolvers.fromJsonLd("@graph")()[0].breadcrumb; if (jsonEl != undefined && jsonEl.itemListElement != undefined) if (jsonEl.itemListElement.length == 3 && dlElementS.length === 2 && dlElementS[0].split('-')[0] === "Help") { resolve(true); } else { resolve(false); } } }, 300); }), interaction: { name: SalesforceInteractions.CatalogObjectInteractionName.ViewCatalogObject, catalogObject: { type: "Category", id: () => { //const attrs = getAttributeFromDataLayer("gtmPageTitle").gtmPageTitle.split("|")[1].split('-').length; const helpSubcategory = getAttributeFromDataLayer("gtmPageTitle").gtmPageTitle.split("|")[1].split('-').pop(); //const t = getAttributeFromDataLayer("gtmPageTitle").gtmPageTitle.split("|")[1].split('-'); if ((getAttributeFromDataLayer("gtmPageTitle")) && (helpSubcategory)) { return "498" + "|" + helpSubcategory; } }, attributes: { name: SalesforceInteractions.cashDom("h1").text().trim(), url: SalesforceInteractions.resolvers.fromHref() /*name: () => { const helpSubcategoryName = getAttributeFromDataLayer("gtmPageTitle").gtmPageTitle.split("|")[1].split('-')[0]; if (getAttributeFromDataLayer("gtmPageTitle")) return helpSubcategoryName; },*/ }, }, }, }, { name: "Help Subcategory", isMatch: () => new Promise((resolve, reject) => { let intervalId = setInterval(() => { if (window.dataLayer && window.dataLayer.length > 0) { clearInterval(intervalId); const dlElementS = getAttributeFromDataLayer("gtmPageTitle").gtmPageTitle.split("|"); const jsonEl = SalesforceInteractions.resolvers.fromJsonLd("@graph")()[0].breadcrumb; if (jsonEl != undefined && jsonEl.itemListElement != undefined) if (jsonEl.itemListElement.length == 4 && dlElementS.length === 2 && dlElementS[0].split('-')[0] === "Help") { resolve(true); } else { resolve(false); } } }, 300); }), interaction: { name: SalesforceInteractions.CatalogObjectInteractionName.ViewCatalogObject, catalogObject: { type: "Category", id: () => { //const attrs = getAttributeFromDataLayer("gtmPageTitle").gtmPageTitle.split("|")[1].split('-').length; const helpSubcategory = getAttributeFromDataLayer("gtmPageTitle").gtmPageTitle.split("|")[1].split('-').pop(); //const t = getAttributeFromDataLayer("gtmPageTitle").gtmPageTitle.split("|")[1].split('-'); if ((getAttributeFromDataLayer("gtmPageTitle")) && (helpSubcategory)) { return "498" + "|" + buildCategory() + "|" + helpSubcategory; } }, attributes: { name: SalesforceInteractions.cashDom("h3.help-categories-articles__group-title").text(), url: SalesforceInteractions.resolvers.fromHref() /*name: () => { const helpSubcategoryName = getAttributeFromDataLayer("gtmPageTitle").gtmPageTitle.split("|")[1].split('-')[0]; if (getAttributeFromDataLayer("gtmPageTitle")) return helpSubcategoryName; }, */ }, }, }, }, /* { name: "Viewed Welcome to Booking.com", isMatch: () => new Promise((resolve, reject) => { let intervalId = setInterval(() => { if (window.dataLayer && window.dataLayer.length > 0) { clearInterval(intervalId); const dlElement = getAttributeFromDataLayer("gtmPageTitle").gtmPageTitle; if (getAttributeFromDataLayer("gtmPageTitle") && dlElement === "Learn more-574|Welcome to Booking.com-3491") { resolve(true); } else { resolve(false); } } }, 300); }), interaction: { name: "Viewed Welcome to Booking.com", }, }, */ { name: "Help Article", isMatch: () => new Promise((resolve, reject) => { let intervalId = setInterval(() => { if (window.dataLayer && window.dataLayer.length > 0) { clearInterval(intervalId); const dlElement = getAttributeFromDataLayer("gtmPageTitle").gtmPageTitle.split("|"); if (getAttributeFromDataLayer("gtmPageTitle") && (dlElement.length === 3) && (dlElement[0].split('-')[0] === "Help")) { resolve(true); } else { resolve(false); } } }, 300); }), contentZones: [ { name: "help_related_content_1st_teaser", selector: "#block-booking-content > article > section > div.field.field--name-dynamic-block-fieldnode-related-content.field--type-ds.field--label-above.node__related-content > div > div > div > div > div > div:nth-child(1) > article" }, ], interaction: { name: SalesforceInteractions.CatalogObjectInteractionName.ViewCatalogObject, catalogObject: { type: "Article", id: () => { if (dataLayer && getAttributeFromDataLayer("gtmPageTitle")) { const id = getAttributeFromDataLayer("gtmPageTitle").gtmPageTitle.split("-").pop(); return id; } }, attributes: { name: SalesforceInteractions.cashDom("h1").text().trim(), url: SalesforceInteractions.resolvers.fromHref(), imageUrl: () => { return buildImage(); }, description: () => { const des1 = SalesforceInteractions.resolvers.fromMeta("description")(); const des2 = SalesforceInteractions.cashDom(".field__item > p:nth-child(1)").text(); return des1 !== undefined ? des1 : des2; }, }, relatedCatalogObjects: { Category: () => { if (dataLayer && getAttributeFromDataLayer("gtmPageTitle")) { const subCat = getAttributeFromDataLayer("gtmPageTitle").gtmPageTitle.split("|")[1].split("-").pop(); //console.log(buildCategory()) return ["498" + "|" + buildCategory() + "|" + subCat]; } }, AttributionLabel: () => { if (dataLayer && getAttributeFromDataLayer("attributionLabels")) { const attributionLabels = getAttributeFromDataLayer("attributionLabels").attributionLabels; return attributionLabels; } }, }, }, }, onActionEvent: (actionEvent) => { const articleID = getAttributeFromDataLayer("gtmPageTitle").gtmPageTitle.split("-").pop(); if (articleID) { actionEvent.user = actionEvent.user || {}; actionEvent.user.attributes = actionEvent.user.attributes || {}; actionEvent.user.attributes.lastViewedArticleId = articleID; actionEvent.user.attributes.lastViewedHelpArticleId = articleID; } return actionEvent; }, listeners: [ SalesforceInteractions.listener("click", "a[title='very unhappy']", () => { SalesforceInteractions.sendEvent({ action: "Feedback - Very unhappy", }); }), SalesforceInteractions.listener("click", "a[title='unhappy']", () => { SalesforceInteractions.sendEvent({ action: "Feedback - Unhappy", }); }), SalesforceInteractions.listener("click", "a[title='neither happy nor unhappy']", () => { SalesforceInteractions.sendEvent({ action: "Feedback - Neither happy nor unhappy", }); }), SalesforceInteractions.listener("click", "a[title='happy']", () => { SalesforceInteractions.sendEvent({ action: "Feedback - Happy", }); }), SalesforceInteractions.listener("click", "a[title='very happy']", () => { SalesforceInteractions.sendEvent({ action: "Feedback - Very happy", }); }) ], }, { name: "Campaign Article", isMatch: () => new Promise((resolve, reject) => { let intervalId = setInterval(() => { if (window.dataLayer && window.dataLayer.length > 0) { clearInterval(intervalId); const dlElement = getAttributeFromDataLayer("gtmPageTitle").gtmPageTitle.split("|"); if (getAttributeFromDataLayer("gtmPageTitle") && (dlElement[0].split('-')[0] === "Campaign")) { resolve(true); } else { resolve(false); } } }, 300); }), interaction: { name: SalesforceInteractions.CatalogObjectInteractionName.ViewCatalogObject, catalogObject: { type: "Article", id: () => { if (dataLayer && getAttributeFromDataLayer("gtmPageTitle")) { const id = getAttributeFromDataLayer("gtmPageTitle").gtmPageTitle.split("-").pop(); return id; } }, attributes: { name: () => { const title = SalesforceInteractions.resolvers.fromMeta("og:title")(); const title2 = SalesforceInteractions.cashDom(".bui-text--variant-headline_1").text().trim(); if (title !== undefined && title2 !== undefined) { if (title.length >= title2.length) { return title; } else { return title2; } } else if (title !== undefined) { return title; } else if (title2 !== undefined) { return title2; } }, url: SalesforceInteractions.resolvers.fromHref(), imageUrl: () => SalesforceInteractions.resolvers.fromMeta("og:image")(), description: SalesforceInteractions.resolvers.fromSelector(".field__item > p:nth-child(1)") }, relatedCatalogObjects: { Category: () => { if (dataLayer && getAttributeFromDataLayer("gtmPageTitle")) { //const subCat = getAttributeFromDataLayer("gtmPageTitle").gtmPageTitle.split("|")[1].split("-").pop(); return ["582"]; } }, AttributionLabel: () => { if (dataLayer && getAttributeFromDataLayer("attributionLabels")) { const attributionLabels = getAttributeFromDataLayer("attributionLabels").attributionLabels; return attributionLabels; } }, }, }, }, listeners: [ SalesforceInteractions.listener("click", trainingSignUpSelector, () => { SalesforceInteractions.sendEvent({ interaction: { name: "Sign Up for Training" }, }); }), SalesforceInteractions.listener("click touchstart mousedown", "button#edit-download", () => { setTimeout(() => { const traDownloadStatus = getLatestAttributeFromDataLayer("status"); if (traDownloadStatus && traDownloadStatus.status == "success") { SalesforceInteractions.sendEvent({ interaction: { name: "TRA Download Successful" }, /* user: { profileObjects: { UserHotel: [{ id: traDownloadStatus.property_id, attributes: { channel: "TRA" } }] } } */ }); } }, 3000); }), SalesforceInteractions.listener("click", "#award-images--3 > div > ul > li:nth-child(1) > a", () => { setTimeout(() => { const traDownloadStatus = getSynchEventFromDataLayer("tra_download_image_click"); if (traDownloadStatus && traDownloadStatus.event === "tra_download_image_click") { SalesforceInteractions.sendEvent({ interaction: { name: "TRA Download Successful - Mobile" }, /* user: { profileObjects: { UserHotel: [{ id: traDownloadStatus.property_id, attributes: { channel: "TRA" } }] } } */ }); } }, 3000); }), //CTA tracking for Summer NH campaign - Summer Home SalesforceInteractions.listener("click", "#paragraph-viewsreference-18038 > div > div > div > div > article > div > div.bui-card__header > h3 > div > a", () => { const dLGTM = getAttributeFromDataLayer("gtmPageTitle"); if (dLGTM && dLGTM.gtmPageTitle.split("|")[1].split('-')[1] == "134470") { SalesforceInteractions.sendEvent({ interaction: { name: "NHSummer24 - Click on Summer Home Article" }, }); } }), SalesforceInteractions.listener("click", "#block-booking-content > article > div > div > div:nth-child(4) > div > div > div > div > div.layout__region.bui-grid__column-12.bui-grid__column-5\\@large.layout__region--vertical-alignment-center > div > div > div > p:nth-child(3) > a", () => { const dLGTM = getAttributeFromDataLayer("gtmPageTitle"); if (dLGTM && dLGTM.gtmPageTitle.split("|")[1].split('-')[1] == "134470") { SalesforceInteractions.sendEvent({ interaction: { name: "NHSummer24 - Learn more about automation" }, }); } }), SalesforceInteractions.listener("click", "#block-booking-content > article > div > div > div:nth-child(5) > div > div > div > div > div.layout__region.bui-grid__column-12.bui-grid__column-5\\@large.bui-grid__column--offset-1\\@large.layout__region--vertical-alignment-center > div > div > div > p:nth-child(3) > a", () => { const dLGTM = getAttributeFromDataLayer("gtmPageTitle"); if (dLGTM && dLGTM.gtmPageTitle.split("|")[1].split('-')[1] == "134470") { SalesforceInteractions.sendEvent({ interaction: { name: "NHSummer24 - Discover tips" }, }); } }), SalesforceInteractions.listener("click", "#block-booking-content > article > div > div > div:nth-child(6) > div > div > div > div.layout__region.bui-grid__column-12.bui-grid__column-5\\@large.layout__region--vertical-alignment-center > div > div > div > p:nth-child(4) > a", () => { const dLGTM = getAttributeFromDataLayer("gtmPageTitle"); if (dLGTM && dLGTM.gtmPageTitle.split("|")[1].split('-')[1] == "134470") { SalesforceInteractions.sendEvent({ interaction: { name: "NHSummer24 - Find out how" }, }); } }), SalesforceInteractions.listener("click", "#block-booking-content > article > div > div > div:nth-child(7) > div > div > div > div > div > div > div > div > div > div > p:nth-child(3) > a", () => { const dLGTM = getAttributeFromDataLayer("gtmPageTitle"); if (dLGTM && dLGTM.gtmPageTitle.split("|")[1].split('-')[1] == "134470") { SalesforceInteractions.sendEvent({ interaction: { name: "NHSummer24 - Get ready for summer (home)" }, }); } }), //CTA tracking for Summer NH campaign - Summer SalesforceInteractions.listener("click", "#paragraph-viewsreference-18022 > div > div > div > div > article > div > div.bui-card__header > h3 > div > a", () => { const dLGTM = getAttributeFromDataLayer("gtmPageTitle"); if (dLGTM && dLGTM.gtmPageTitle.split("|")[1].split('-')[1] == "66414") { SalesforceInteractions.sendEvent({ interaction: { name: "NHSummer24 - Click on Summer Article" }, }); } }), SalesforceInteractions.listener("click", "#block-booking-content > article > div > div > div:nth-child(4) > div > div > div > div > div.layout__region.bui-grid__column-12.bui-grid__column-5\\@large.layout__region--vertical-alignment-center > div > div > div > p:nth-child(3) > a", () => { const dLGTM = getAttributeFromDataLayer("gtmPageTitle"); if (dLGTM && dLGTM.gtmPageTitle.split("|")[1].split('-')[1] == "66414") { SalesforceInteractions.sendEvent({ interaction: { name: "NHSummer24 - Capture demand" }, }); } }), SalesforceInteractions.listener("click", "#block-booking-content > article > div > div > div:nth-child(5) > div > div > div > div > div.layout__region.bui-grid__column-12.bui-grid__column-5\\@large.bui-grid__column--offset-1\\@large.layout__region--vertical-alignment-center > div > div > div > p:nth-child(3) > a", () => { const dLGTM = getAttributeFromDataLayer("gtmPageTitle"); if (dLGTM && dLGTM.gtmPageTitle.split("|")[1].split('-')[1] == "66414") { SalesforceInteractions.sendEvent({ interaction: { name: "NHSummer24 - Explore tips" }, }); } }), SalesforceInteractions.listener("click", "#block-booking-content > article > div > div > div:nth-child(6) > div > div > div > div > div > div > div > div > div > div > p:nth-child(3) > a", () => { const dLGTM = getAttributeFromDataLayer("gtmPageTitle"); if (dLGTM && dLGTM.gtmPageTitle.split("|")[1].split('-')[1] == "66414") { SalesforceInteractions.sendEvent({ interaction: { name: "NHSummer24 - Get ready for summer" }, }); } }), ], onActionEvent: (actionEvent) => { const articleID = getAttributeFromDataLayer("gtmPageTitle").gtmPageTitle.split("-").pop(); if (articleID) { actionEvent.user = actionEvent.user || {}; actionEvent.user.attributes = actionEvent.user.attributes || {}; actionEvent.user.attributes.lastViewedArticleId = articleID; } return actionEvent; }, }, { name: "Join Article", isMatch: () => new Promise((resolve, reject) => { let intervalId = setInterval(() => { if (window.dataLayer && window.dataLayer.length > 0) { clearInterval(intervalId); const gtmPageTtile = getAttributeFromDataLayer("gtmPageTitle"); if (gtmPageTtile && gtmPageTtile.gtmPageTitle.split("-")[1] === "100422") { resolve(true); } else { resolve(false); } } }, 300); }), interaction: { name: "Viewed Join Article" }, contentZones: [ { name: "join_page_quote", selector: "#block-booking-content > article > div > div > div:nth-child(5)" }, { name: "join_page_block_p13n", selector: "#block-booking-content > article > div > div.paragraphs > div:nth-child(1) > header > div > div.hero-campaign__text" }, { name: "join_page_cta_p13n", selector: "#paragraph-hero-campaign-16107 > div" } ], listeners: [ SalesforceInteractions.listener("click", joinArticleGetStartedSelectors, () => { SalesforceInteractions.sendEvent({ interaction: { name: "Start Registration - PH Acquisition Page" } }); }), ] }, { name: "Onboarding Main", isMatch: () => new Promise((resolve, reject) => { let intervalId = setInterval(() => { if (window.dataLayer && window.dataLayer.length > 0) { clearInterval(intervalId); if (getAttributeFromDataLayer("gtmPageTitle").gtmPageTitle === "Learn more-574|Welcome to Booking.com-3491") { resolve(true); } else { resolve(false); } } }, 300); }), interaction: { name: SalesforceInteractions.CatalogObjectInteractionName.ViewCatalogObject, catalogObject: { type: "Category", id: () => { return "574"; }, attributes: { name: () => { return "Learn more"; }, }, }, }, listeners: [ SalesforceInteractions.listener("click", "a.education-category-teaser__link", () => { SalesforceInteractions.sendEvent({ interaction: { name: "Onboarding Main - teaser click" } }); }), SalesforceInteractions.listener("click", "a.bui-link--icon.bui-link--icon-arrow-right", () => { SalesforceInteractions.sendEvent({ interaction: { name: "Onboarding Main - text link click" } }); }) ], }, { name: "Onboarding Article", isMatch: () => new Promise((resolve, reject) => { let intervalId = setInterval(() => { if (window.dataLayer && window.dataLayer.length > 0) { clearInterval(intervalId); const dlElement = getAttributeFromDataLayer("gtmPageTitle").gtmPageTitle.split("|"); if (getAttributeFromDataLayer("gtmPageTitle") && dlElement.length === 3 && dlElement[0].split('-')[0] === "Learn more") { resolve(true); } else { resolve(false); } } }, 300); }), interaction: { name: SalesforceInteractions.CatalogObjectInteractionName.ViewCatalogObject, catalogObject: { type: "Article", id: () => { if (dataLayer && getAttributeFromDataLayer("gtmPageTitle")) { const id = getAttributeFromDataLayer("gtmPageTitle").gtmPageTitle.split("-").pop(); return id; } }, attributes: { name: SalesforceInteractions.cashDom("h1").text().trim(), url: SalesforceInteractions.resolvers.fromHref(), imageUrl: () => SalesforceInteractions.resolvers.fromJsonLd("@graph")()[0].image.url, description: SalesforceInteractions.resolvers.fromSelector("#block-booking-content > article > header > div > div > section > h3") }, relatedCatalogObjects: { Category: () => { if (dataLayer && getAttributeFromDataLayer("gtmPageTitle")) { return ["574"]; } }, AttributionLabel: () => { if (dataLayer && getAttributeFromDataLayer("attributionLabels")) { const attributionLabels = getAttributeFromDataLayer("attributionLabels").attributionLabels; return attributionLabels; } }, }, }, }, onActionEvent: (actionEvent) => { const articleID = getAttributeFromDataLayer("gtmPageTitle").gtmPageTitle.split("-").pop(); if (getAttributeFromDataLayer("gtmPageTitle") && articleID) { actionEvent.user = actionEvent.user || {}; actionEvent.user.attributes = actionEvent.user.attributes || {}; actionEvent.user.attributes.lastViewedArticleId = articleID; actionEvent.user.attributes.lastViewedOnboardingArticleId = articleID; } return actionEvent; }, listeners: [ SalesforceInteractions.DisplayUtils.pageScroll(0.25).then(() => { const oStep = getAttributeFromDataLayer("gtmPageTitle"); if (!(getAttributeFromDataLayer("gtmPageTitle") && getAttributeFromDataLayer("gtmPageTitle").gtmPageTitle.split("|").length === 3 && getAttributeFromDataLayer("gtmPageTitle").gtmPageTitle.split("|")[0].split('-')[0] === "Learn more")) { return; } SalesforceInteractions.sendEvent({ interaction: { name: "Onboarding 25%", }, user: { attributes: { lastViewedOnboardingStep: oStep.gtmPageTitle.split("-").pop(), onboardingScrollingPercent: 25 } } }); }), SalesforceInteractions.DisplayUtils.pageScroll(0.75).then(() => { const oStep = getAttributeFromDataLayer("gtmPageTitle"); if (!(getAttributeFromDataLayer("gtmPageTitle") && getAttributeFromDataLayer("gtmPageTitle").gtmPageTitle.split("|").length === 3 && getAttributeFromDataLayer("gtmPageTitle").gtmPageTitle.split("|")[0].split('-')[0] === "Learn more")) { return; } SalesforceInteractions.sendEvent({ interaction: { name: "Onboarding 75%", }, user: { attributes: { lastViewedOnboardingStep: oStep.gtmPageTitle.split("-").pop(), onboardingScrollingPercent: 75 } } }); }), //this is a listener for page load, executes when page is visible, here we store the id of the article SalesforceInteractions.DisplayUtils.pageElementLoaded('html').then(() => { if (!(getAttributeFromDataLayer("gtmPageTitle") && getAttributeFromDataLayer("gtmPageTitle").gtmPageTitle.split("|").length === 3 && getAttributeFromDataLayer("gtmPageTitle").gtmPageTitle.split("|")[0].split('-')[0] === "Learn more")) { return; } //getting article ID from data layer and storing it in global variable const articleID = getAttributeFromDataLayer("gtmPageTitle").gtmPageTitle.split("-").pop(); window.lastViewedOnboardingStep = articleID; //storing time at which the user started reading the page //const start = Date.now(); //the following event listener only fires if the user changes page window.addEventListener('beforeunload', () => { //this event object will store one or both attributes depending if we want to send them or not const eventObject = {}; //checking if the user has completed the page scroll. only store the attribute if he has NOT completed if (window.lastViewedOnboardingStep !== null && window.lastViewedOnboardingStep !== undefined) eventObject.lastViewedOnboardingStep = window.lastViewedOnboardingStep; eventObject.onboardingScrollingPercent = window.scrollPercent ? window.scrollPercent : 0; if (window.scrollPercent > 25) SalesforceInteractions.sendEvent({ interaction: { name: "Onboarding Page Change", }, user: { attributes: eventObject } }); }) }), ], }, { name: "Community Main", action: "Viewed Community Homepage", isMatch: () => window.location.pathname.endsWith("/community"), interaction: { name: SalesforceInteractions.CatalogObjectInteractionName.ViewCatalogObject, catalogObject: { type: "Category", id: () => { return "500" }, attributes: { name: () => { return "Community"; }, }, }, }, }, { name: "Community Post", isMatch: () => new Promise((resolve, reject) => { let intervalId = setInterval(() => { if (window.dataLayer && window.dataLayer.length > 0) { clearInterval(intervalId); if (getAttributeFromDataLayer("gtmPageTitle") && getAttributeFromDataLayer("gtmPageTitle").gtmPageTitle.split("|").length == 3 && getAttributeFromDataLayer("gtmPageTitle").gtmPageTitle.split("|")[0].split("-")[0] === "Community") { resolve(true); } else { resolve(false); } } }, 300); }), interaction: { name: SalesforceInteractions.CatalogObjectInteractionName.ViewCatalogObject, catalogObject: { type: "Category", id: () => { const commCatID = getAttributeFromDataLayer("gtmPageTitle").gtmPageTitle.split("-")[2].split("-")[0].split("|")[0]; if (dataLayer && getAttributeFromDataLayer("gtmPageTitle")) { return "500" + "|" + commCatID; } }, attributes: { name: () => { const commCat = getAttributeFromDataLayer("gtmPageTitle").gtmPageTitle.split("|")[1].split("-")[0] if (dataLayer && getAttributeFromDataLayer("gtmPageTitle")) { return commCat; } }, }, }, }, }, { name: "Community Category", //action: "Viewed Community Category Page", isMatch: () => new Promise((resolve, reject) => { let intervalId = setInterval(() => { if (window.dataLayer && window.dataLayer.length > 0) { clearInterval(intervalId); if (getAttributeFromDataLayer("gtmPageTitle") && getAttributeFromDataLayer("gtmPageTitle").gtmPageTitle.split("|")[0].split("-")[0] === "Community" && SalesforceInteractions.cashDom(".view-content > .bui-grid").length > 0) { resolve(true); } else { resolve(false); } } }, 300); }), interaction: { name: SalesforceInteractions.CatalogObjectInteractionName.ViewCatalogObject, catalogObject: { type: "Category", id: () => { const commCatID = getAttributeFromDataLayer("gtmPageTitle").gtmPageTitle.split("-")[2].split("-")[0].split("|")[0]; if (dataLayer && getAttributeFromDataLayer("gtmPageTitle")) { return "500" + "|" + commCatID; } }, attributes: { name: () => { const commCat = getAttributeFromDataLayer("gtmPageTitle").gtmPageTitle.split("|")[1].split("-")[0] if (dataLayer && getAttributeFromDataLayer("gtmPageTitle")) { return commCat } }, }, }, }, }, { name: "Community Tag", //action: "Viewed Community Tag Page", isMatch: () => new Promise((resolve, reject) => { let intervalId = setInterval(() => { if (window.dataLayer && window.dataLayer.length > 0) { clearInterval(intervalId); if (getAttributeFromDataLayer("gtmPageTitle") && getAttributeFromDataLayer("gtmPageTitle").gtmPageTitle.split("|").length == 2 && getAttributeFromDataLayer("gtmPageTitle").gtmPageTitle.split("|")[0].split("-")[0] === "Community" && SalesforceInteractions.cashDom(".view-content > .bui-grid").length == 0) { resolve(true); } else { resolve(false); } } }, 300); }), interaction: { name: SalesforceInteractions.CatalogObjectInteractionName.ViewCatalogObject, catalogObject: { type: "Category", id: () => { if (dataLayer && getAttributeFromDataLayer("gtmPageTitle")) { return "500" } }, attributes: { name: () => { if (dataLayer && getAttributeFromDataLayer("gtmPageTitle")) { return "Community" } }, }, }, }, }, ] }; /* join.booking.com Sitemap */ let joinSiteConfig = { global: { locale: buildLocale(), contentZones: [ { name: "booking_affiliate_datalayer" } ], listeners: [ SalesforceInteractions.DisplayUtils.pageElementLoaded('body').then(() => { setTimeout(() => { if (window.location.pathname !== "/become-a-host/agreement.html") { const url = new URL(window.location.href); const aid = url.searchParams.get('aid'); const affiliateData = getAttributeFromDataLayer("affiliateData"); const matchingAffiliate = affiliateData?.affiliateData?.affiliates?.find(affiliate => affiliate?.attributes?.affiliateId?.value === aid ); if (matchingAffiliate) { const affiliateUPO = getAttributeFromDataLayer("affiliateUPO"); const conversionStatus = affiliateUPO?.affiliateUPO?.affiliateUPO?.[aid]?.attributes?.conversion?.value; const isNewUser = !affiliateUPO?.affiliateUPO?.affiliateUPO; //hotel_account_id from datalayer - event => step-saved const joinHotelAccountId = getSynchEventFromDataLayer("sf-step-saved"); if ((isNewUser || conversionStatus === false || conversionStatus === undefined) && (joinHotelAccountId && joinHotelAccountId.partner_account_id != 1)) { SalesforceInteractions.sendEvent({ interaction: { name: "User Affiliate ID Retrieval (Conversion = False)" }, user: { profileObjects: { Affiliation: [{ id: aid, attributes: { name: matchingAffiliate.attributes.name.value, affiliateId: aid, conversion: false, timestamp: Date.now() } }] } } }); } } } }, 1500); }) ] }, pageTypeDefault: { name: "default", interaction: { name: "Default Page", }, }, pageTypes: [ { name: "Join Homepage", isMatch: () => /^\/$/.test(window.location.pathname), interaction: { name: "Viewed Join Homepage" }, /* contentZones: [ { name: "", selector: "" }, ] */ }, { name: "Become a Host Page", isMatch: () => /^\/become-a-host\/.*$/.test(window.location.pathname), interaction: { name: () => { const pathSegments = window.location.pathname.split('/'); const index = pathSegments.indexOf('become-a-host'); const categoryValue = pathSegments[index + 1].replace(/\.html$/, ''); return "Viewed " + (categoryValue.charAt(0).toUpperCase() + categoryValue.slice(1)) + " Step" }, }, }, { name: "Join Agreement (Registration Complete)", isMatch: () => { if (window.location.pathname === "/become-a-host/agreement.html") return true; }, interaction: { name: "Viewed Join Agreement" }, listeners: [ SalesforceInteractions.DisplayUtils.pageElementLoaded('body').then(() => { const interval = setInterval(() => { const agreementSubmission = getSynchEventFromDataLayer("15min-agreement-submit"); if (agreementSubmission && agreementSubmission.event === "15min-agreement-submit") { const affiliateUPO = getLatestAttributeFromDataLayer("affiliateUPO"); if (affiliateUPO && affiliateUPO.affiliateUPO) { const affiliates = affiliateUPO.affiliateUPO.affiliateUPO; // Iterate over each affiliate in affiliates Object.keys(affiliates).forEach(id => { const affiliate = affiliates[id]; if (affiliate) { const affiliateAttributes = affiliate.attributes; const conversion = affiliateAttributes.conversion.value; const timestamp = affiliateAttributes.timestamp.value; //hotel_account_id from datalayer - event => step-saved const joinHotelAccountId = getSynchEventFromDataLayer("sf-step-saved"); // Check if the conversion value is false if (!conversion && joinHotelAccountId && joinHotelAccountId.hotel_account_id != 1) { SalesforceInteractions.sendEvent({ interaction: { name: "User Conversion from " + affiliateAttributes.name.value }, user: { profileObjects: { Affiliation: [{ id: id, attributes: { name: affiliateAttributes.name.value, affiliateId: id, conversion: true, // Send conversion as true timestamp: Date.now() } }] } } }); } } }); } clearInterval(interval) } }, 3000) }), ] }, ], }; let extranetSiteConfig = { global: { onActionEvent: (actionEvent) => { const hotel_account_id = getAttributeFromDataLayer("user_id"); if (hotel_account_id && hotel_account_id !== undefined && (hotel_account_id.user_id != 0) && (hotel_account_id.user_id != 1)) { const user_id = hotel_account_id.user_id; actionEvent.user = actionEvent.user || {}; actionEvent.user.identities = actionEvent.user.identities || {}; actionEvent.user.identities.hotelAccountID = user_id; } return actionEvent; }, locale: buildLocale(), listeners: [ //Go open and bookable - Make My Property Live (Homepage) SalesforceInteractions.listener("click", "#main-content > div > div.bui-grid > div.bui-grid__column-full.bui-grid__column-8\\@medium > div.bui-card > div > div > button", () => { if (window.location.href.includes('home.html')) { SalesforceInteractions.sendEvent({ interaction: { name: "Go open and bookable" } }); } }), //Go open and bookable - Make My Property Live (Calendar) SalesforceInteractions.listener("click", "#main-content > div:nth-child(1) > div.av-cal-header > div:nth-child(1) > div > div > div > div > a", () => { if (window.location.href.includes('/manage/calendar/index.html')) { SalesforceInteractions.sendEvent({ interaction: { name: "Go open and bookable" } }); } }), //US State Rates SalesforceInteractions.listener("click", "[class='bui-button bui-button--secondary bui-button--wide'][href*='state_rates'], [class='bui-button bui-button--secondary bui-button--wide'][href*='state_rates'] *", () => { SalesforceInteractions.sendEvent({ interaction: { name: "US State Rates - Add Promotion Button - Extranet" } }); }), SalesforceInteractions.listener("click", "[data-test-id='review-modal-submit-button'][class='bui-button bui-button--primary'], [data-test-id='review-modal-submit-button'][class='bui-button bui-button--primary'] *", () => { if (window.location.href.includes('/manage/state_rate.html')) { SalesforceInteractions.sendEvent({ interaction: { name: "US State Rates - Activate Button - Extranet" } }); } }), //New Property Deal SalesforceInteractions.listener("click", "[class='bui-button bui-button--secondary bui-button--wide'][href*='/manage/new_property_deal'], [class='bui-button bui-button--secondary bui-button--wide'][href*='/manage/new_property_deal'] *", () => { SalesforceInteractions.sendEvent({ interaction: { name: "New Property Deal - Add Promotion Button - Extranet" } }); }), SalesforceInteractions.listener("click", ".bui-button.bui-button--primary.bui-button--large, .bui-button.bui-button--primary.bui-button--large *", () => { if (window.location.href.includes('/manage/new_property_deal')) { SalesforceInteractions.sendEvent({ interaction: { name: "New Property Deal - Activate Button - Extranet" } }); } }), //Getaway Deal SalesforceInteractions.listener("click", "[class='bui-button bui-button--secondary bui-button--wide'][href*='preset_id=38'], [class='bui-button bui-button--secondary bui-button--wide'][href*='preset_id=38'] *", () => { SalesforceInteractions.sendEvent({ interaction: { name: "Getaway Deal - Add Promotion Button - Extranet" } }); }), SalesforceInteractions.listener("click", ".pro-modal__button.bui-button.bui-button--primary, .pro-modal__button.bui-button.bui-button--primary *", () => { const paramValue = getQueryParam('preset_id'); if (paramValue === "38") { SalesforceInteractions.sendEvent({ interaction: { name: "Getaway Deal - Activate Button - Extranet" } }); } }), //Late Escape Deal SalesforceInteractions.listener("click", "[class='bui-button bui-button--secondary bui-button--wide'][href*='product=LATE_ESCAPE_CAMPAIGN'], [class='bui-button bui-button--secondary bui-button--wide'][href*='product=LATE_ESCAPE_CAMPAIGN'] *", () => { SalesforceInteractions.sendEvent({ interaction: { name: "Late Escape Deal - Add Promotion Button - Extranet" } }); }), SalesforceInteractions.listener("click", "[data-test-id='review-modal-submit-button'], [data-test-id='review-modal-submit-button'] *", () => { const paramValue = getQueryParam('product'); if (paramValue === "LATE_ESCAPE_CAMPAIGN") { SalesforceInteractions.sendEvent({ interaction: { name: "Late Escape Deal - Activate Button - Extranet" } }); } }), //Country Rates SalesforceInteractions.listener("click", "[class='bui-button bui-button--secondary bui-button--wide'][href*='/manage/country_rate'], [class='bui-button bui-button--secondary bui-button--wide'][href*='/manage/country_rate'] *", () => { SalesforceInteractions.sendEvent({ interaction: { name: "Country Rates - Add Promotion Button - Extranet" } }); }), SalesforceInteractions.listener("click", "[data-test-id='review-modal-submit-button'][class='bui-button bui-button--primary']", () => { const paramValue = getQueryParam('product'); console.log("Activate Click!") if (paramValue === "COUNTRY_RATE") { SalesforceInteractions.sendEvent({ interaction: { name: "Country Rates - Activate Button - Extranet" } }); } }), //Family Cots SalesforceInteractions.listener("click", ".child-policies-actions > * .bui-button.bui-button--primary, .child-policies-actions > * .bui-button.bui-button--primary *", () => { if (window.location.href.includes('crib_and_extra_beds.html')) { SalesforceInteractions.sendEvent({ interaction: { name: "Family Cots - Save Button - Extranet" } }); } }), //Non-refundable Date Change SalesforceInteractions.listener("click", ".bui-group.bui-group--inline > .bui-button.bui-button--primary, .bui-group.bui-group--inline > .bui-button.bui-button--primary", () => { if (window.location.href.includes('cxl_mod.html')) { SalesforceInteractions.sendEvent({ interaction: { name: "NR Date Change - Update Preferences Button - Extranet" } }); } }), //Preferred Partner Programme SalesforceInteractions.listener("click", ".bui-group.bui-group--inline > * .bui-button.bui-button--primary, .bui-group.bui-group--inline > * .bui-button.bui-button--primary * ,.bui-group.bui-group--inline > .bui-button.bui-button--primary, .bui-group.bui-group--inline > .bui-button.bui-button--primary *", () => { if (window.location.href.includes('preferred_program.html')) { SalesforceInteractions.sendEvent({ interaction: { name: "Preferred Partner Programme - Join Today Button - Extranet" } }); } }), //Preferred Plus Partner Programme SalesforceInteractions.listener("click", ".preferred-container > * .bui-group.bui-group--inline > .bui-button.bui-button--primary, .preferred-container > * .bui-group.bui-group--inline > .bui-button.bui-button--primary *, .preferred-container > * .bui-group.bui-group--inline > * .bui-button.bui-button--primary, .preferred-container > * .bui-group.bui-group--inline > * .bui-button.bui-button--primary *", () => { if (window.location.href.includes('preferred_program.html')) { SalesforceInteractions.sendEvent({ interaction: { name: "Preferred Plus Partner Programme - Request to Join Button - Extranet" } }); } }), //Payments by Booking SalesforceInteractions.listener("click", extranetPaymentsByBookingSelectors, () => { SalesforceInteractions.sendEvent({ interaction: { name: "Payments by Booking - Signup Button - Extranet" } }); }), //Rate Plan Page (Family) SalesforceInteractions.listener("click", ".child-policies-actions > * .bui-button.bui-button--primary, .child-policies-actions > * .bui-button.bui-button--primary *", () => { SalesforceInteractions.sendEvent({ interaction: { name: "Family Rate Plan - Save Button - Extranet" } }); }), SalesforceInteractions.listener("click", ".bui-card.children-pricing-rates-type-card > * [class='bui-button bui-button--secondary'][href*='/manage/child_essential_rates'], .bui-card.children-pricing-rates-type-card > * [class='bui-button bui-button--secondary'][href*='/manage/child_essential_rates'] *", () => { SalesforceInteractions.sendEvent({ interaction: { name: "Family Rate Plan - Set Up [STANDARD CHILD RATES] - Extranet" } }); }), SalesforceInteractions.listener("click", ".bui-card.children-pricing-rates-type-card > * [class='bui-button bui-button--secondary'][href*='/manage/children_rate'], .bui-card.children-pricing-rates-type-card > * [class='bui-button bui-button--secondary'][href*='/manage/children_rate'] *", () => { SalesforceInteractions.sendEvent({ interaction: { name: "Family Rate Plan - Activate [FLEXIBLE CHILD RATE] - Extranet" } }); }), //Room Difference Indicator (Save All) SalesforceInteractions.listener("click", ".rds-room-actions__btn.rds-room-actions__save > .rds-room-actions__button.bui-button.bui-button--primary, .rds-room-actions__btn.rds-room-actions__save > .rds-room-actions__button.bui-button.bui-button--primary *, .rds-facility__button.bui-button.bui-button--primary, .rds-facility__button.bui-button.bui-button--primary *, .rds-photo-list, .rds-photo-list *, .rds-amenity__list, .rds-amenity__list *", () => { SalesforceInteractions.sendEvent({ interaction: { name: "Room Difference Indicator - Save Buttons - Extranet" } }); }), //Rate Plan Page (Flexible) SalesforceInteractions.listener("click", "[type='button'][data-on-click*='openFlexRPAT']", () => { SalesforceInteractions.sendEvent({ interaction: { name: "Add Rate Plan Flexible - Extranet" } }); }), SalesforceInteractions.listener("click", "#flexible_rate_form > * button[type='submit']", () => { SalesforceInteractions.sendEvent({ interaction: { name: "Activate Rate Plan Flexible - Extranet" } }); }), //Rate Plan Page (Non-Refundable) SalesforceInteractions.listener("click", "[type='button'][data-on-click*='openNRRPAT']", () => { SalesforceInteractions.sendEvent({ interaction: { name: "Add Rate Plan Non-Refundable - Extranet" } }); }), SalesforceInteractions.listener("click", "#non_refundable_rate_form > * button[type='submit']", () => { SalesforceInteractions.sendEvent({ interaction: { name: "Activate Rate Plan Non-Refundable - Extranet" } }); }), //Rate Plan Page (Monthly) SalesforceInteractions.listener("click", "[type='button'][data-on-click*='openMonthlyRPAT']", () => { SalesforceInteractions.sendEvent({ interaction: { name: "Add Rate Plan Monthly - Extranet" } }); }), SalesforceInteractions.listener("click", "#monthly_rate_form > * button[type='submit']", () => { SalesforceInteractions.sendEvent({ interaction: { name: "Activate Rate Plan Monthly - Extranet" } }); }), //Rate Plan Page (Weekly) SalesforceInteractions.listener("click", "[type='button'][data-on-click*='openWeeklyRPAT'], [type='button'][data-on-click*='openWeeklyRPAT'] *", () => { SalesforceInteractions.sendEvent({ interaction: { name: "Add Rate Plan Weekly - Extranet" } }); }), SalesforceInteractions.listener("click", "#weekly_rate_form > * [type='button'][data-on-click*='loadReviewStep'], #weekly_rate_form > * [type='button'][data-on-click*='loadReviewStep'] *", () => { SalesforceInteractions.sendEvent({ interaction: { name: "Review Rate Plan Weekly - Extranet" } }); }), SalesforceInteractions.listener("click", "#weekly_rate_form > * button[type='submit'], #weekly_rate_form > * button[type='submit'] *", () => { SalesforceInteractions.sendEvent({ interaction: { name: "Activate Rate Plan Weekly - Extranet" } }); }), //Pricing Per Guest SalesforceInteractions.listener("click", "[class='ext-navigation-submenu-item'][data-nav-tag='occupancy_setup_page'], [class='ext-navigation-submenu-item'][data-nav-tag='occupancy_setup_page'] *", () => { SalesforceInteractions.sendEvent({ interaction: { name: "Pricing Per Guest Click - Extranet" } }); }), SalesforceInteractions.listener("click", ".obp-form > .bui-button.bui-button--primary, .obp-form > .bui-button.bui-button--primary *", () => { SalesforceInteractions.sendEvent({ interaction: { name: "Pricing Per Guest - Save Changes - Extranet" } }); }), //Value Adds SalesforceInteractions.listener("click", "[class='bui-button bui-button--primary'][href*='value_adds'], [class='bui-button bui-button--primary'][href*='value_adds'] *", () => { console.log("Create Value Adds CLICKED") SalesforceInteractions.sendEvent({ interaction: { name: "Create Value Adds - Extranet" } }); }), SalesforceInteractions.listener("click", "[class='bundle-rates-form__button bundle-rates-form__button--submit'] > [class='bui-button bui-button--primary'], [class='bundle-rates-form__button bundle-rates-form__button--submit'] > [class='bui-button bui-button--primary'] *, .peg-wizard-navigation__action-button > [data-test-id='peg-wizard-navigation-apply'], .peg-wizard-navigation__action-button > [data-test-id='peg-wizard-navigation-apply'] *", () => { SalesforceInteractions.sendEvent({ interaction: { name: "Done Click - Value Adds - Extranet" } }); }), //Genius Page SalesforceInteractions.listener("click", "[class*='genius'] > * .bui-button.bui-button--primary.bui-button--large", () => { SalesforceInteractions.sendEvent({ interaction: { name: "Try Genius Now - Extranet" } }); }), //Calendar List View SalesforceInteractions.listener("click", "#main-content > div:nth-child(1) > div:nth-child(2) > div:nth-child(1) > div.scroll-sync-container.av-cal-list__content > div > div.av-cal-list-room__name-row.av-cal-list-room-name-row > div.av-cal-list-room-name-row__area.av-cal-list-room-name-row__area--secondary > button", () => { if (/calendar/.test(window.location.href)) { SalesforceInteractions.sendEvent({ interaction: { name: "Calendar Bulk Edit - Extranet" } }); } }), SalesforceInteractions.listener("click", ".av-general-modal__forms button[type='submit']", () => { if (/calendar/.test(window.location.href)) { SalesforceInteractions.sendEvent({ interaction: { name: "Calendar Save Changes List View - Extranet" } }); } }), //Calendar Monthly View SalesforceInteractions.listener("click", ".av-monthly-container__block button[type='submit']", () => { if (/calendar/.test(window.location.href)) { SalesforceInteractions.sendEvent({ interaction: { name: "Calendar Save Changes Monthly View - Extranet" } }); } }), //Photos SalesforceInteractions.listener("click", extranetAddPhotosSelectors, () => { SalesforceInteractions.sendEvent({ interaction: { name: "Add Property Photos - Extranet" } }); }), //Promotions SalesforceInteractions.listener("click", '[class="ext-promotions__header-cta bui-button bui-button--primary"]', () => { SalesforceInteractions.sendEvent({ interaction: { name: "Choose New Promotion Click - Extranet" } }); }), SalesforceInteractions.listener("click", '.bui-button.bui-button--secondary.bui-button--wide[href*="product=MOBILE_RATE"]', () => { SalesforceInteractions.sendEvent({ interaction: { name: "Add Promotion Click (Mobile Rate) - Extranet" } }); }), SalesforceInteractions.listener("click", '.bui-button.bui-button--secondary.bui-button--wide[href*="deal_type=basic"]', () => { SalesforceInteractions.sendEvent({ interaction: { name: "Add Promotion Click (Basic Deal) - Extranet" } }); }), SalesforceInteractions.listener("click", '#main-content > div > div > div > div.bui-grid.bui-grid--reversed > div.bui-grid__column.bui-grid__column-12.bui-grid__column-8\\@large > div.bui-group.bui-group--inline.bui-group--vertical-align-middle.bui-button-group > div:nth-child(1) > button', () => { const paramValue = getQueryParam('product'); if (paramValue === "MOBILE_RATE") { SalesforceInteractions.sendEvent({ interaction: { name: "Review Click (Mobile Rate) - Extranet" } }); } }), SalesforceInteractions.listener("click", 'button[data-test-id="review-modal-submit-button"]', () => { const paramValue = getQueryParam('product'); if (paramValue === "MOBILE_RATE") { SalesforceInteractions.sendEvent({ interaction: { name: "Activate Click (Mobile Rate) - Extranet" } }); } }), ] }, pageTypeDefault: { name: "default", interaction: { name: "Default Page", }, }, pageTypes: [ { name: "Hotel Page", isMatch: () => new Promise((resolve, reject) => { setTimeout(() => { resolve(dataLayer && getAttributeFromDataLayer("property_id")); }, 1000); }), interaction: { name: SalesforceInteractions.CatalogObjectInteractionName.ViewCatalogObject, catalogObject: { type: "Hotel", id: () => { if (getAttributeFromDataLayer("property_id")) { const id = getAttributeFromDataLayer("property_id").property_id; return id; } }, /* HOTEL NAME REMOVED attributes: { hotelName: () => { if (getAttributeFromDataLayer("hotel_name")) { const hotelName = getAttributeFromDataLayer("hotel_name").hotel_name; return hotelName; } } }, */ relatedCatalogObjects: { Country: () => { if (getAttributeFromDataLayer("property_country")) { const country_name_en = getAttributeFromDataLayer("property_country").property_country; return [country_name_en]; } }, PartnerCategory: () => { if (getAttributeFromDataLayer("bhome_segmentation")) { const partner_category = getAttributeFromDataLayer("bhome_segmentation").bhome_segmentation; return [partner_category]; } }, StatusLabel: () => { const statusData = getAttributeFromDataLayer("hotel_status_code"); return statusData?.hotel_status_code ? [statusData.hotel_status_code] : []; }, AccommodationType: () => { if (getAttributeFromDataLayer("property_type_id")) { const accommodationtype_id = getAttributeFromDataLayer("property_type_id").property_type_id; return [accommodationtype_id + '']; } }, }, }, }, onActionEvent: (actionEvent) => { const hotelID = getAttributeFromDataLayer("property_id"); if (dataLayer && hotelID && hotelID !== undefined) { actionEvent.user = actionEvent.user || {}; actionEvent.user.identities = actionEvent.user.identities || {}; actionEvent.user.identities.lastViewedHotel = hotelID.property_id; actionEvent.user.profileObjects = actionEvent.user.profileObjects || {}; actionEvent.user.profileObjects.UserHotel = actionEvent.user.profileObjects.UserHotel || []; let newHotel = { id: getAttributeFromDataLayer("property_id").property_id, attributes: { channel: "Web", /* HOTEL NAME REMOVED hotelName: getAttributeFromDataLayer("hotel_name") ? getAttributeFromDataLayer("hotel_name").hotel_name : "", */ isNewPartner: getSynchEventFromDataLayer("page_view") && !!getSynchEventFromDataLayer("page_view").is_new_partner }, relatedCatalogObjects: { PartnerCategory: [getAttributeFromDataLayer("bhome_segmentation")?.bhome_segmentation || ''], Hotel: [getAttributeFromDataLayer("property_id")?.property_id || ''], AccommodationType: [getAttributeFromDataLayer("property_type_id")?.property_type_id + '' || ''], Country: [getAttributeFromDataLayer("property_country")?.property_country || ''], StatusLabel: [getAttributeFromDataLayer("hotel_status_code")?.hotel_status_code || ''] }, } actionEvent?.user?.profileObjects?.['UserHotel'].push(newHotel); } return actionEvent; }, }, { name: "Group Homepage", isMatch: () => /groups\/home\/index\.html/.test(window.location.pathname), interaction: { name: "Viewed Group Homepage" }, } ], }; const getAttributeFromDataLayer = (attribute_datalayer) => { if (window.dataLayer) { for (let i = 0; i < window.dataLayer.length; i++) { if (window.dataLayer[i][attribute_datalayer]) { return window.dataLayer[i]; } } } }; const getSynchEventFromDataLayer = (eventName) => { if (dataLayer && dataLayer.length > 0) { for (let i = dataLayer.length - 1; i >= 0; i--) { if (dataLayer[i].event == eventName) { return dataLayer[i]; } } } }; const getLatestAttributeFromDataLayer = (attribute_datalayer) => { if (window.dataLayer) { for (let i = window.dataLayer.length - 1; i >= 0; i--) { if (window.dataLayer[i][attribute_datalayer]) { return window.dataLayer[i]; } } } }; var getScrollPercent = function () { var winHeight = window.innerHeight || document.documentElement.clientHeight; var docHeight = Math.max( document.body.scrollHeight || 0, document.documentElement.scrollHeight || 0, document.body.offsetHeight || 0, document.documentElement.offsetHeight || 0, document.body.clientHeight || 0, document.documentElement.clientHeight || 0 ); var scrollTop = window.pageYOffset || (document.documentElement || document.body.parentNode || document.body).scrollTop; var trackLength = docHeight - winHeight; var pctScrolled = Math.floor((scrollTop / trackLength) * 100); return pctScrolled; }; // Add a scroll event listener to the window window.addEventListener("scroll", () => { if (window.scrollPercent == undefined) window.scrollPercent = 0; if (getScrollPercent() > window.scrollPercent) { window.scrollPercent = getScrollPercent(); } }); const handleSPAPageChange = () => { let url = window.location.href; const urlChangeInterval = setInterval(() => { if (url !== window.location.href) { url = window.location.href; SalesforceInteractions.reinit(); } }, 2000); } handleSPAPageChange(); if (window.location.hostname === "partner.booking.com" && window.location.hostname !== "admin.booking.com") { SalesforceInteractions.initSitemap(partnerSiteConfig); } else if (window.location.hostname === "admin.booking.com") { SalesforceInteractions.initSitemap(extranetSiteConfig); } else if (!getAttributeFromDataLayer("gtmPageTitle") && window.location.hostname === "join.booking.com" && window.location.hostname !== "admin.booking.com") { SalesforceInteractions.initSitemap(joinSiteConfig); } }); /* Helper Functions */ function getCookie(cookieName) { const cookies = document.cookie.split('; '); for (let i = 0; i < cookies.length; i++) { const cookie = cookies[i]; const [name, value] = cookie.split('='); if (name === cookieName) { return decodeURIComponent(value); } } // Return null if the cookie is not found return null; } function getQueryParam(param) { const urlParams = new URLSearchParams(window.location.search); return urlParams.get(param); } function sendCampaignInfoToDL(campaignId) { results = Evergage?.getState()?.campaignResponses; let campaignName = ''; let experienceName = ''; let experienceId = ''; if (results !== undefined && results.length !== undefined) { results.forEach((res) => { if (res?.campaignId == campaignId) { campaignName = res?.campaignName; experienceId = res?.experienceId experienceName = res?.experienceName; } }); } window.dataLayer = window.dataLayer || []; if (dataLayer) window.dataLayer.push({ event: "sf_campaign", eventData: { sf_campaign_id: campaignId, sf_campaign_name: campaignName, sf_experience_id: experienceId, sf_experience_name: experienceName, }, }); } function updateAriaLabel(campaignId) { results = Evergage?.getState()?.campaignResponses; let campaignName = ''; if (results !== undefined && results.length !== undefined) { results.forEach((res) => { if (res?.campaignId == campaignId) { campaignName = res?.campaignName } }) } SalesforceInteractions.cashDom(`[data-evg-campaign-id="${campaignId}"]`).attr({ 'aria-label': campaignName }) } function sendDataToGA(impressionType, eventLabel, clickedLink) { const gaCookie = getCookie("_ga"); // Define the URL of the Google Analytics Measurement Protocol endpoint const apiUrl = 'https://www.google-analytics.com/collect'; // Create an object with the parameters you want to send const data = { v: '1', // Protocol version t: 'event', // Hit type tid: 'UA-6284728-15', // Tracking ID cid: gaCookie.substring(6), // Client ID ec: 'SF Campaign Performance', // Event category ea: 'Banner ' + impressionType, // Event action el: eventLabel, // Event label ni: '1', // Non-interaction hit (optional) dp: clickedLink }; // Create a URLSearchParams object to encode the data as a query string const params = new URLSearchParams(data); // Make a POST request using the fetch API fetch(apiUrl, { method: 'POST', body: params.toString(), // Convert the data to a query string headers: { 'Content-Type': 'application/x-www-form-urlencoded' } }) .then(response => { // Check if the response status is OK (status code 200) if (!response.ok) { throw new Error('GA3 Network response was not ok'); } // The request was successful }) .catch(error => { // Handle any errors that occurred during the fetch console.error('There was a problem with the GA3 fetch operation:', error); }); } function sendDataToGA4(impressionType, eventLabel, clickedLink) { const ga4ApiSecret = 'R_mTLzfgR8Sbz96ffDduFw'; const measurementId = 'LVHK6H547B'; const gaCookie = getCookie("_ga"); // Define the GA4 Measurement Protocol endpoint const apiUrl = `https://www.google-analytics.com/mp/collect?api_secret=${ga4ApiSecret}&measurement_id=${measurementId}`; // Create the payload for the GA4 event const payload = { client_id: gaCookie, non_personalized_ads: false, events: [ { name: 'salesforce_' + impressionType.toLowerCase(), params: { banner_name: eventLabel, banner_url: clickedLink, banner_action: impressionType // Use the impressionType parameter here } } ] }; // Make a POST request using the fetch API fetch(apiUrl, { method: 'POST', body: JSON.stringify(payload), /*headers: { 'Content-Type': 'application/json' }*/ }) .then(response => { // Check if the response status is OK (status code 200) if (!response.ok) { throw new Error(`Server returned ${response.status} ${response.statusText}`); } }) .catch(error => { // Log the detailed error message console.error('There was a problem with the fetch operation:', error.message); }); } } catch (e) { if (typeof window.Evergage === "object" && typeof window.Evergage.getVersion === "function" && window.Evergage.getVersion() >= 5) { console.error("siteWideJavascriptError" + e); } }; }