Pixel Manager for WooCommerce – Track Google Analytics, Google Ads, Facebook and more - Version 1.16.5

Version Description

08.04.2022

  • Tweak: More verbose logging of WPM load and pixel consent status into the dev console
  • Tweak: Added new logic to retrieve categories for variations
Download this release

Release Info

Developer alekv
Plugin Icon 128x128 Pixel Manager for WooCommerce – Track Google Analytics, Google Ads, Facebook and more
Version 1.16.5
Comparing to
See all releases

Code changes from version 1.16.6 to 1.16.5

js/admin/wpm-admin-freemius.p1.min.js CHANGED
@@ -1,2 +1,2 @@
1
- (()=>{var e={92:()=>{!function(){try{new MutationObserver((function(e){e.forEach((function(e){"class"===e.attributeName&&jQuery(e.target).prop(e.attributeName).includes("disabled")&&jQuery(".fs-modal").find(".button-deactivate").removeClass("disabled")}))})).observe(jQuery(".fs-modal").find(".button-deactivate")[0],{attributes:!0})}catch(e){console.error(e)}}()}},t={};function r(o){var a=t[o];if(void 0!==a)return a.exports;var n=t[o]={exports:{}};return e[o](n,n.exports,r),n.exports}r.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return r.d(t,{a:t}),t},r.d=(e,t)=>{for(var o in t)r.o(t,o)&&!r.o(e,o)&&Object.defineProperty(e,o,{enumerable:!0,get:t[o]})},r.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),(()=>{"use strict";r(92)})()})();
2
  //# sourceMappingURL=wpm-admin-freemius.p1.min.js.map
1
+ (()=>{var e={309:()=>{!function(){try{new MutationObserver((function(e){e.forEach((function(e){"class"===e.attributeName&&jQuery(e.target).prop(e.attributeName).includes("disabled")&&jQuery(".fs-modal").find(".button-deactivate").removeClass("disabled")}))})).observe(jQuery(".fs-modal").find(".button-deactivate")[0],{attributes:!0})}catch(e){console.error(e)}}()}},t={};function r(o){var a=t[o];if(void 0!==a)return a.exports;var n=t[o]={exports:{}};return e[o](n,n.exports,r),n.exports}r.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return r.d(t,{a:t}),t},r.d=(e,t)=>{for(var o in t)r.o(t,o)&&!r.o(e,o)&&Object.defineProperty(e,o,{enumerable:!0,get:t[o]})},r.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),(()=>{"use strict";r(309)})()})();
2
  //# sourceMappingURL=wpm-admin-freemius.p1.min.js.map
js/admin/wpm-admin-freemius.p1.min.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"wpm-admin-freemius.p1.min.js","mappings":"sBAAA,WACC,IAEgB,IAAIA,kBAAiB,SAAUC,GAC7CA,EAAUC,SAAQ,SAAUC,GACI,UAA3BA,EAASC,eACSC,OAAOF,EAASG,QAAQC,KAAKJ,EAASC,eACxCI,SAAS,aAC3BH,OAAO,aAAaI,KAAK,sBAAsBC,YAAY,kBAMtDC,QAAQN,OAAO,aAAaI,KAAK,sBAAsB,GAAI,CACnEG,YAAY,IAGZ,MAAOC,GACRC,QAAQD,MAAMA,IAnBhB,KCCIE,EAA2B,GAG/B,SAASC,EAAoBC,GAE5B,IAAIC,EAAeH,EAAyBE,GAC5C,QAAqBE,IAAjBD,EACH,OAAOA,EAAaE,QAGrB,IAAIC,EAASN,EAAyBE,GAAY,CAGjDG,QAAS,IAOV,OAHAE,EAAoBL,GAAUI,EAAQA,EAAOD,QAASJ,GAG/CK,EAAOD,QCpBfJ,EAAoBO,EAAKF,IACxB,IAAIG,EAASH,GAAUA,EAAOI,WAC7B,IAAOJ,EAAiB,QACxB,IAAM,EAEP,OADAL,EAAoBU,EAAEF,EAAQ,CAAEG,EAAGH,IAC5BA,GCLRR,EAAoBU,EAAI,CAACN,EAASQ,KACjC,IAAI,IAAIC,KAAOD,EACXZ,EAAoBc,EAAEF,EAAYC,KAASb,EAAoBc,EAAEV,EAASS,IAC5EE,OAAOC,eAAeZ,EAASS,EAAK,CAAEI,YAAY,EAAMC,IAAKN,EAAWC,MCJ3Eb,EAAoBc,EAAI,CAACK,EAAK5B,IAAUwB,OAAOK,UAAUC,eAAeC,KAAKH,EAAK5B,G","sources":["webpack://WooCommerce-Pixel-Manager/./src/js/admin/freemius-keep-deactivate-button-enabled.js","webpack://WooCommerce-Pixel-Manager/webpack/bootstrap","webpack://WooCommerce-Pixel-Manager/webpack/runtime/compat get default export","webpack://WooCommerce-Pixel-Manager/webpack/runtime/define property getters","webpack://WooCommerce-Pixel-Manager/webpack/runtime/hasOwnProperty shorthand"],"sourcesContent":["(function () {\n\ttry {\n\n\t\tlet observer = new MutationObserver(function (mutations) {\n\t\t\tmutations.forEach(function (mutation) {\n\t\t\t\tif (mutation.attributeName === \"class\") {\n\t\t\t\t\tlet attributeValue = jQuery(mutation.target).prop(mutation.attributeName);\n\t\t\t\t\tif (attributeValue.includes('disabled')) {\n\t\t\t\t\t\tjQuery('.fs-modal').find('.button-deactivate').removeClass('disabled');\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t});\n\t\t});\n\n\t\tobserver.observe(jQuery('.fs-modal').find('.button-deactivate')[0], {\n\t\t\tattributes: true\n\t\t});\n\n\t} catch (error) {\n\t\tconsole.error(error);\n\t}\n})();\n","// The module cache\nvar __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tvar cachedModule = __webpack_module_cache__[moduleId];\n\tif (cachedModule !== undefined) {\n\t\treturn cachedModule.exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\t// no module.id needed\n\t\t// no module.loaded needed\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId](module, module.exports, __webpack_require__);\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n","// getDefaultExport function for compatibility with non-harmony modules\n__webpack_require__.n = (module) => {\n\tvar getter = module && module.__esModule ?\n\t\t() => (module['default']) :\n\t\t() => (module);\n\t__webpack_require__.d(getter, { a: getter });\n\treturn getter;\n};","// define getter functions for harmony exports\n__webpack_require__.d = (exports, definition) => {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))"],"names":["MutationObserver","mutations","forEach","mutation","attributeName","jQuery","target","prop","includes","find","removeClass","observe","attributes","error","console","__webpack_module_cache__","__webpack_require__","moduleId","cachedModule","undefined","exports","module","__webpack_modules__","n","getter","__esModule","d","a","definition","key","o","Object","defineProperty","enumerable","get","obj","prototype","hasOwnProperty","call"],"sourceRoot":""}
1
+ {"version":3,"file":"wpm-admin-freemius.p1.min.js","mappings":"uBAAA,WACC,IAEgB,IAAIA,kBAAiB,SAAUC,GAC7CA,EAAUC,SAAQ,SAAUC,GACI,UAA3BA,EAASC,eACSC,OAAOF,EAASG,QAAQC,KAAKJ,EAASC,eACxCI,SAAS,aAC3BH,OAAO,aAAaI,KAAK,sBAAsBC,YAAY,kBAMtDC,QAAQN,OAAO,aAAaI,KAAK,sBAAsB,GAAI,CACnEG,YAAY,IAGZ,MAAOC,GACRC,QAAQD,MAAMA,IAnBhB,KCCIE,EAA2B,GAG/B,SAASC,EAAoBC,GAE5B,IAAIC,EAAeH,EAAyBE,GAC5C,QAAqBE,IAAjBD,EACH,OAAOA,EAAaE,QAGrB,IAAIC,EAASN,EAAyBE,GAAY,CAGjDG,QAAS,IAOV,OAHAE,EAAoBL,GAAUI,EAAQA,EAAOD,QAASJ,GAG/CK,EAAOD,QCpBfJ,EAAoBO,EAAKF,IACxB,IAAIG,EAASH,GAAUA,EAAOI,WAC7B,IAAOJ,EAAiB,QACxB,IAAM,EAEP,OADAL,EAAoBU,EAAEF,EAAQ,CAAEG,EAAGH,IAC5BA,GCLRR,EAAoBU,EAAI,CAACN,EAASQ,KACjC,IAAI,IAAIC,KAAOD,EACXZ,EAAoBc,EAAEF,EAAYC,KAASb,EAAoBc,EAAEV,EAASS,IAC5EE,OAAOC,eAAeZ,EAASS,EAAK,CAAEI,YAAY,EAAMC,IAAKN,EAAWC,MCJ3Eb,EAAoBc,EAAI,CAACK,EAAK5B,IAAUwB,OAAOK,UAAUC,eAAeC,KAAKH,EAAK5B,G","sources":["webpack://WooCommerce-Pixel-Manager/./src/js/admin/freemius-keep-deactivate-button-enabled.js","webpack://WooCommerce-Pixel-Manager/webpack/bootstrap","webpack://WooCommerce-Pixel-Manager/webpack/runtime/compat get default export","webpack://WooCommerce-Pixel-Manager/webpack/runtime/define property getters","webpack://WooCommerce-Pixel-Manager/webpack/runtime/hasOwnProperty shorthand"],"sourcesContent":["(function () {\n\ttry {\n\n\t\tlet observer = new MutationObserver(function (mutations) {\n\t\t\tmutations.forEach(function (mutation) {\n\t\t\t\tif (mutation.attributeName === \"class\") {\n\t\t\t\t\tlet attributeValue = jQuery(mutation.target).prop(mutation.attributeName);\n\t\t\t\t\tif (attributeValue.includes('disabled')) {\n\t\t\t\t\t\tjQuery('.fs-modal').find('.button-deactivate').removeClass('disabled');\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t});\n\t\t});\n\n\t\tobserver.observe(jQuery('.fs-modal').find('.button-deactivate')[0], {\n\t\t\tattributes: true\n\t\t});\n\n\t} catch (error) {\n\t\tconsole.error(error);\n\t}\n})();\n","// The module cache\nvar __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tvar cachedModule = __webpack_module_cache__[moduleId];\n\tif (cachedModule !== undefined) {\n\t\treturn cachedModule.exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\t// no module.id needed\n\t\t// no module.loaded needed\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId](module, module.exports, __webpack_require__);\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n","// getDefaultExport function for compatibility with non-harmony modules\n__webpack_require__.n = (module) => {\n\tvar getter = module && module.__esModule ?\n\t\t() => (module['default']) :\n\t\t() => (module);\n\t__webpack_require__.d(getter, { a: getter });\n\treturn getter;\n};","// define getter functions for harmony exports\n__webpack_require__.d = (exports, definition) => {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))"],"names":["MutationObserver","mutations","forEach","mutation","attributeName","jQuery","target","prop","includes","find","removeClass","observe","attributes","error","console","__webpack_module_cache__","__webpack_require__","moduleId","cachedModule","undefined","exports","module","__webpack_modules__","n","getter","__esModule","d","a","definition","key","o","Object","defineProperty","enumerable","get","obj","prototype","hasOwnProperty","call"],"sourceRoot":""}
js/admin/wpm-admin.p1.min.js CHANGED
@@ -1,2 +1,2 @@
1
- (()=>{var e={684:()=>{jQuery((function(){function e(e,t){e.preventDefault();let n={action:"wpm_dismissed_notice_handler",set:t};jQuery.post(ajaxurl,n,(function(e){})),jQuery(".wpm-rating-success-notice").remove()}jQuery(".wpm-rating-success-notice").show(),jQuery(document).on("click","#wpm-rate-it",(function(t){e(t,"rating_done"),window.open("https://wordpress.org/support/view/plugin-reviews/woocommerce-google-adwords-conversion-tracking-tag?rate=5#postform","_blank").focus()})),jQuery(document).on("click","#wpm-already-did",(function(t){e(t,"rating_done")})),jQuery(document).on("click","#wpm-maybe-later",(function(t){e(t,"later")}))}))},940:()=>{function e(e){jQuery.post(ajaxurl,e,(function(e){location.reload()}))}jQuery((function(){jQuery(document).on("click",".incompatible-plugin-error-dismissal-button",(function(t){t.preventDefault(),e({action:"environment_check_handler",disable_warning:jQuery(this).data("plugin-slug")})})),jQuery(document).on("click","#wpm-wp-rocket-js-concatenation-disable",(function(t){t.preventDefault(),e({action:"environment_check_handler",set:"disable_wp_rocket_javascript_concatenation"})})),jQuery(document).on("click","#wpm-dismiss-wp-rocket-js-concatenation-error",(function(t){t.preventDefault(),e({action:"environment_check_handler",set:"dismiss_wp_rocket_javascript_concatenation_error"})})),jQuery(document).on("click","#wpm-litespeed-inline-js-dom-ready-disable",(function(t){t.preventDefault(),e({action:"environment_check_handler",set:"disable_litespeed_inline_js_dom_ready"})})),jQuery(document).on("click","#wpm-dismiss-litespeed-inline-js-dom-ready-error",(function(t){t.preventDefault(),e({action:"environment_check_handler",set:"dismiss_litespeed_inline_js_dom_ready"})})),jQuery(document).on("click","#wpm-paypal-standard-error-dismissal-button",(function(t){t.preventDefault(),e({action:"environment_check_handler",set:"dismiss_paypal_standard_warning"})}))}))},663:()=>{jQuery((function(){jQuery("#debug-info-button").click((function(){jQuery("#debug-info-textarea").select(),document.execCommand("copy")})),jQuery("#wpm_pro_version_demo").on("click",(function(){jQuery("#submit").click()}))}))},958:()=>{function e(){jQuery("#script-blocker-notice").hide()}e(),jQuery((function(){e()}))},966:()=>{function e(){const e=window.location.search,t=new URLSearchParams(e);return!!t.get("section")&&{section:t.get("section"),subsection:t.get("subsection")}}function t(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"";const i=window.location.search,s=new URLSearchParams(i);s.delete("section"),s.delete("subsection");let a="section="+e;a+=t?"&subsection="+t:"",history.pushState("","wpm"+e,document.location.pathname+"?page=wpm&"+a),jQuery('input[name ="_wp_http_referer"]').val(n()+"?page=wpm&"+a+"&settings-updated=true")}function n(){return new URL(jQuery("#wp-admin-canonical").attr("href")).pathname}jQuery((function(){let n=[],i={};if(jQuery(".section").closest("tr").hide(),jQuery(".section").each((function(){n.push({slug:jQuery(this).data("sectionSlug"),title:jQuery(this).data("sectionTitle")})})),jQuery(".subsection").each((function(){i[jQuery(this).data("sectionSlug")]=i[jQuery(this).data("sectionSlug")]||[],i[jQuery(this).data("sectionSlug")].push({title:jQuery(this).data("subsectionTitle"),slug:jQuery(this).data("subsectionSlug")})})),n.forEach((function(e){jQuery(".nav-tab-wrapper").append('<a href="#" class="nav-tab" data-section-slug="'+e.slug+'">'+e.title+"</a>")})),jQuery(".nav-tab-wrapper").after(function(e){let t=Object.keys(e),n="";return t.forEach((function(t){n+='<ul class="subnav-tabs" data-section-slug="'+t+'">',e[t].forEach((function(e){n+='<li class="subnav-li subnav-li-inactive" data-subsection-slug="'+e.slug+'">'+e.title+"</li>"})),n+="</ul>"})),n}(i)),jQuery(".nav-tab-wrapper a").on("click",(function(e){e.preventDefault(),jQuery(this).addClass("nav-tab-active").siblings().removeClass("nav-tab-active");let s=jQuery(this).data("section-slug");!function(e,n){jQuery("#wpm_settings_form > h2").nextUntil(".submit").andSelf().hide(),jQuery(".subnav-tabs").hide(),jQuery(".subnav-tabs[data-section-slug="+e+"]").show();let i=n.findIndex((t=>t.slug===e));jQuery("div[data-section-slug="+e+"]").closest("table").prevAll("h2:first").next().nextUntil("h2, .submit").andSelf().show(),t(n[i].slug)}(s,n),s in i&&jQuery("ul[data-section-slug="+s+"]").children(":first").trigger("click")})),jQuery(".subnav-li").on("click",(function(e){var n,i;e.preventDefault(),jQuery(this).addClass("subnav-li-active").removeClass("subnav-li-inactive").siblings().addClass("subnav-li-inactive").removeClass("subnav-li-active"),n=jQuery(this).parent().data("section-slug"),i=jQuery(this).data("subsection-slug"),jQuery("#wpm_settings_form > h2").nextUntil(".submit").andSelf().hide(),jQuery("[data-section-slug="+n+"][data-subsection-slug="+i+"]").closest("tr").siblings().andSelf().hide(),jQuery("[data-section-slug="+n+"][data-subsection-slug="+i+"]").closest("table").show(),jQuery("[data-section-slug="+n+"][data-subsection-slug="+i+"]").closest("tr").nextUntil(jQuery("[data-section-slug="+n+"][data-subsection-slug]").closest("tr")).show(),t(n,i)})),e()){let t=e();jQuery("a[data-section-slug="+t.section+"]").trigger("click"),!1!==t.subsection&&jQuery("ul[data-section-slug="+t.section+"]").children("[data-subsection-slug="+t.subsection+"]").trigger("click")}else jQuery("a[data-section-slug="+n[0].slug+"]").trigger("click")}))}},t={};function n(i){var s=t[i];if(void 0!==s)return s.exports;var a=t[i]={exports:{}};return e[i](a,a.exports,n),a.exports}n.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t},n.d=(e,t)=>{for(var i in t)n.o(t,i)&&!n.o(e,i)&&Object.defineProperty(e,i,{enumerable:!0,get:t[i]})},n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),(()=>{"use strict";n(684),n(940),n(663),n(958),n(966)})()})();
2
  //# sourceMappingURL=wpm-admin.p1.min.js.map
1
+ (()=>{var e={331:()=>{jQuery((function(){function e(e,t){e.preventDefault();let n={action:"wpm_dismissed_notice_handler",set:t};jQuery.post(ajaxurl,n,(function(e){})),jQuery(".wpm-rating-success-notice").remove()}jQuery(".wpm-rating-success-notice").show(),jQuery(document).on("click","#wpm-rate-it",(function(t){e(t,"rating_done"),window.open("https://wordpress.org/support/view/plugin-reviews/woocommerce-google-adwords-conversion-tracking-tag?rate=5#postform","_blank").focus()})),jQuery(document).on("click","#wpm-already-did",(function(t){e(t,"rating_done")})),jQuery(document).on("click","#wpm-maybe-later",(function(t){e(t,"later")}))}))},178:()=>{function e(e){jQuery.post(ajaxurl,e,(function(e){location.reload()}))}jQuery((function(){jQuery(document).on("click",".incompatible-plugin-error-dismissal-button",(function(t){t.preventDefault(),e({action:"environment_check_handler",disable_warning:jQuery(this).data("plugin-slug")})})),jQuery(document).on("click","#wpm-wp-rocket-js-concatenation-disable",(function(t){t.preventDefault(),e({action:"environment_check_handler",set:"disable_wp_rocket_javascript_concatenation"})})),jQuery(document).on("click","#wpm-dismiss-wp-rocket-js-concatenation-error",(function(t){t.preventDefault(),e({action:"environment_check_handler",set:"dismiss_wp_rocket_javascript_concatenation_error"})})),jQuery(document).on("click","#wpm-litespeed-inline-js-dom-ready-disable",(function(t){t.preventDefault(),e({action:"environment_check_handler",set:"disable_litespeed_inline_js_dom_ready"})})),jQuery(document).on("click","#wpm-dismiss-litespeed-inline-js-dom-ready-error",(function(t){t.preventDefault(),e({action:"environment_check_handler",set:"dismiss_litespeed_inline_js_dom_ready"})})),jQuery(document).on("click","#wpm-paypal-standard-error-dismissal-button",(function(t){t.preventDefault(),e({action:"environment_check_handler",set:"dismiss_paypal_standard_warning"})}))}))},649:()=>{jQuery((function(){jQuery("#debug-info-button").click((function(){jQuery("#debug-info-textarea").select(),document.execCommand("copy")})),jQuery("#wpm_pro_version_demo").on("click",(function(){jQuery("#submit").click()}))}))},740:()=>{function e(){jQuery("#script-blocker-notice").hide()}e(),jQuery((function(){e()}))},110:()=>{function e(){const e=window.location.search,t=new URLSearchParams(e);return!!t.get("section")&&{section:t.get("section"),subsection:t.get("subsection")}}function t(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"";const i=window.location.search,s=new URLSearchParams(i);s.delete("section"),s.delete("subsection");let a="section="+e;a+=t?"&subsection="+t:"",history.pushState("","wpm"+e,document.location.pathname+"?page=wpm&"+a),jQuery('input[name ="_wp_http_referer"]').val(n()+"?page=wpm&"+a+"&settings-updated=true")}function n(){return new URL(jQuery("#wp-admin-canonical").attr("href")).pathname}jQuery((function(){let n=[],i={};if(jQuery(".section").closest("tr").hide(),jQuery(".section").each((function(){n.push({slug:jQuery(this).data("sectionSlug"),title:jQuery(this).data("sectionTitle")})})),jQuery(".subsection").each((function(){i[jQuery(this).data("sectionSlug")]=i[jQuery(this).data("sectionSlug")]||[],i[jQuery(this).data("sectionSlug")].push({title:jQuery(this).data("subsectionTitle"),slug:jQuery(this).data("subsectionSlug")})})),n.forEach((function(e){jQuery(".nav-tab-wrapper").append('<a href="#" class="nav-tab" data-section-slug="'+e.slug+'">'+e.title+"</a>")})),jQuery(".nav-tab-wrapper").after(function(e){let t=Object.keys(e),n="";return t.forEach((function(t){n+='<ul class="subnav-tabs" data-section-slug="'+t+'">',e[t].forEach((function(e){n+='<li class="subnav-li subnav-li-inactive" data-subsection-slug="'+e.slug+'">'+e.title+"</li>"})),n+="</ul>"})),n}(i)),jQuery(".nav-tab-wrapper a").on("click",(function(e){e.preventDefault(),jQuery(this).addClass("nav-tab-active").siblings().removeClass("nav-tab-active");let s=jQuery(this).data("section-slug");!function(e,n){jQuery("#wpm_settings_form > h2").nextUntil(".submit").andSelf().hide(),jQuery(".subnav-tabs").hide(),jQuery(".subnav-tabs[data-section-slug="+e+"]").show();let i=n.findIndex((t=>t.slug===e));jQuery("div[data-section-slug="+e+"]").closest("table").prevAll("h2:first").next().nextUntil("h2, .submit").andSelf().show(),t(n[i].slug)}(s,n),s in i&&jQuery("ul[data-section-slug="+s+"]").children(":first").trigger("click")})),jQuery(".subnav-li").on("click",(function(e){var n,i;e.preventDefault(),jQuery(this).addClass("subnav-li-active").removeClass("subnav-li-inactive").siblings().addClass("subnav-li-inactive").removeClass("subnav-li-active"),n=jQuery(this).parent().data("section-slug"),i=jQuery(this).data("subsection-slug"),jQuery("#wpm_settings_form > h2").nextUntil(".submit").andSelf().hide(),jQuery("[data-section-slug="+n+"][data-subsection-slug="+i+"]").closest("tr").siblings().andSelf().hide(),jQuery("[data-section-slug="+n+"][data-subsection-slug="+i+"]").closest("table").show(),jQuery("[data-section-slug="+n+"][data-subsection-slug="+i+"]").closest("tr").nextUntil(jQuery("[data-section-slug="+n+"][data-subsection-slug]").closest("tr")).show(),t(n,i)})),e()){let t=e();jQuery("a[data-section-slug="+t.section+"]").trigger("click"),!1!==t.subsection&&jQuery("ul[data-section-slug="+t.section+"]").children("[data-subsection-slug="+t.subsection+"]").trigger("click")}else jQuery("a[data-section-slug="+n[0].slug+"]").trigger("click")}))}},t={};function n(i){var s=t[i];if(void 0!==s)return s.exports;var a=t[i]={exports:{}};return e[i](a,a.exports,n),a.exports}n.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t},n.d=(e,t)=>{for(var i in t)n.o(t,i)&&!n.o(e,i)&&Object.defineProperty(e,i,{enumerable:!0,get:t[i]})},n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),(()=>{"use strict";n(331),n(178),n(649),n(740),n(110)})()})();
2
  //# sourceMappingURL=wpm-admin.p1.min.js.map
js/public/facebook.js ADDED
@@ -0,0 +1,306 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /**
2
+ * Add functions for Facebook
3
+ * */
4
+
5
+ (function (wpm, $, undefined) {
6
+
7
+ let fBUserData
8
+
9
+ wpm.loadFacebookPixel = function () {
10
+
11
+ try {
12
+ wpmDataLayer.pixels.facebook.loaded = true
13
+
14
+ // @formatter:off
15
+ !function(f,b,e,v,n,t,s)
16
+ {if(f.fbq)return;n=f.fbq=function(){n.callMethod?
17
+ n.callMethod.apply(n,arguments):n.queue.push(arguments)};
18
+ if(!f._fbq)f._fbq=n;n.push=n;n.loaded=!0;n.version='2.0';
19
+ n.queue=[];t=b.createElement(e);t.async=!0;
20
+ t.src=v;s=b.getElementsByTagName(e)[0];
21
+ s.parentNode.insertBefore(t,s)}(window, document,'script',
22
+ 'https://connect.facebook.net/en_US/fbevents.js');
23
+ // @formatter:on
24
+
25
+ fbq("init", wpmDataLayer.pixels.facebook.pixel_id)
26
+ fbq("track", "PageView")
27
+
28
+ } catch (e) {
29
+ console.error(e)
30
+ }
31
+ }
32
+
33
+ wpm.getRandomEventId = function () {
34
+ return (Math.random() + 1).toString(36).substring(2)
35
+ }
36
+
37
+ wpm.getFbUserData = function () {
38
+ // We need the first one for InitiateCheckout
39
+ // where getting the user_data from the browser is too slow
40
+ // using wpm.getCookie(), so we cache the user_data earlier.
41
+ // And we need the second one because the ViewContent hit happens too fast
42
+ // after adding a variation to the cart because the function to cache
43
+ // the user_data is too slow. But we can get the user_data using wpm.getCookie()
44
+ // because we don't move away from the page and can wait for the browser
45
+ // to get it.
46
+ if (fBUserData) {
47
+ return fBUserData
48
+ } else {
49
+ return wpm.getFbUserDataFromBrowser()
50
+ }
51
+ }
52
+
53
+ wpm.setFbUserData = function () {
54
+ fBUserData = wpm.getFbUserDataFromBrowser()
55
+ }
56
+
57
+ wpm.getFbUserDataFromBrowser = function () {
58
+ return {
59
+ fbp : wpm.getCookie("_fbp"),
60
+ fbc : wpm.getCookie("_fbc"),
61
+ client_user_agent: navigator.userAgent,
62
+ }
63
+ }
64
+
65
+ wpm.fbViewContent = function (product) {
66
+
67
+ try {
68
+ if (!wpmDataLayer?.pixels?.facebook?.loaded) return
69
+
70
+ let eventId = wpm.getRandomEventId()
71
+
72
+ fbq("track", "ViewContent", {
73
+ content_type: "product",
74
+ content_name: product.name,
75
+ // content_category: product.category,
76
+ content_ids: product.dyn_r_ids[wpmDataLayer.pixels.facebook.dynamic_remarketing.id_type],
77
+ currency : wpmDataLayer.shop.currency,
78
+ value : product.price,
79
+ }, {
80
+ eventID: eventId,
81
+ })
82
+
83
+ product["currency"] = wpmDataLayer.shop.currency
84
+
85
+ jQuery(document).trigger("wpmFbCapiEvent", {
86
+ event_name : "ViewContent",
87
+ event_id : eventId,
88
+ user_data : wpm.getFbUserData(),
89
+ product_data : product,
90
+ product_id : product.dyn_r_ids[wpmDataLayer.pixels.facebook.dynamic_remarketing.id_type],
91
+ event_source_url: window.location.href,
92
+ })
93
+ } catch (e) {
94
+ console.error(e)
95
+ }
96
+ }
97
+
98
+ wpm.facebookContentIds = function () {
99
+ let prodIds = []
100
+
101
+ for (const [key, item] of Object.entries(wpmDataLayer.order.items)) {
102
+
103
+ if (wpmDataLayer?.general?.variationsOutput && 0 !== item.variation_id) {
104
+ prodIds.push(String(wpmDataLayer.products[item.variation_id].dyn_r_ids[wpmDataLayer.pixels.facebook.dynamic_remarketing.id_type]))
105
+ } else {
106
+ prodIds.push(String(wpmDataLayer.products[item.id].dyn_r_ids[wpmDataLayer.pixels.facebook.dynamic_remarketing.id_type]))
107
+ }
108
+ }
109
+
110
+ return prodIds
111
+ }
112
+
113
+ }(window.wpm = window.wpm || {}, jQuery));
114
+
115
+
116
+ /**
117
+ * Execute as soon as possible
118
+ * */
119
+
120
+ (function () {
121
+
122
+ jQuery(document).on("wpmLoadPixels", function () {
123
+
124
+ if (wpmDataLayer?.pixels?.facebook?.pixel_id && !wpmDataLayer?.pixels?.facebook?.loaded) {
125
+ if (wpm.canIFire("ads", "facebook-ads")) wpm.loadFacebookPixel()
126
+ }
127
+ })
128
+
129
+ })()
130
+
131
+
132
+ /**
133
+ * All event listeners
134
+ * */
135
+
136
+ // AddToCart event
137
+ jQuery(document).on("wpmAddToCart", function (event, product) {
138
+
139
+ try {
140
+ if (!wpmDataLayer?.pixels?.facebook?.loaded) return
141
+
142
+ let eventId = wpm.getRandomEventId()
143
+
144
+ // console.log('eventId: ' + eventId);
145
+
146
+ fbq("track", "AddToCart", {
147
+ content_type: "product",
148
+ content_name: product.name,
149
+ content_ids : product.dyn_r_ids[wpmDataLayer.pixels.facebook.dynamic_remarketing.id_type],
150
+ value : parseFloat(product.quantity * product.price),
151
+ currency : product.currency,
152
+ }, {
153
+ eventID: eventId,
154
+ })
155
+
156
+
157
+ product["currency"] = wpmDataLayer.shop.currency
158
+
159
+ jQuery(document).trigger("wpmFbCapiEvent", {
160
+ event_name : "AddToCart",
161
+ event_id : eventId,
162
+ user_data : wpm.getFbUserData(),
163
+ product_data : product,
164
+ product_id : product.dyn_r_ids[wpmDataLayer.pixels.facebook.dynamic_remarketing.id_type],
165
+ event_source_url: window.location.href,
166
+ })
167
+ } catch (e) {
168
+ console.error(e)
169
+ }
170
+ })
171
+
172
+ // InitiateCheckout event
173
+ jQuery(document).on("wpmBeginCheckout", function (event) {
174
+
175
+ try {
176
+ // console.log('firing facebook ads InitiateCheckout event');
177
+
178
+ if (!wpmDataLayer?.pixels?.facebook?.loaded) return
179
+
180
+ let eventId = wpm.getRandomEventId()
181
+
182
+ fbq("track", "InitiateCheckout", {}, {
183
+ eventID: eventId,
184
+ })
185
+
186
+ jQuery(document).trigger("wpmFbCapiEvent", {
187
+ event_name : "InitiateCheckout",
188
+ event_id : eventId,
189
+ user_data : wpm.getFbUserData(),
190
+ event_source_url: window.location.href,
191
+ })
192
+ } catch (e) {
193
+ console.error(e)
194
+ }
195
+ })
196
+
197
+ // AddToWishlist event
198
+ jQuery(document).on("wpmAddToWishlist", function (event, product) {
199
+
200
+ try {
201
+ // console.log('firing facebook ads AddToWishlist event');
202
+ // console.log(product);
203
+
204
+ if (!wpmDataLayer?.pixels?.facebook?.loaded) return
205
+
206
+ let eventId = wpm.getRandomEventId()
207
+
208
+ fbq("track", "AddToWishlist", {
209
+ content_type: "product",
210
+ content_name: product.name,
211
+ content_ids : product.dyn_r_ids[wpmDataLayer.pixels.facebook.dynamic_remarketing.id_type],
212
+ value : parseFloat(product.quantity * product.price),
213
+ currency : product.currency,
214
+ }, {
215
+ eventID: eventId,
216
+ })
217
+
218
+
219
+ product["currency"] = wpmDataLayer.shop.currency
220
+
221
+ jQuery(document).trigger("wpmFbCapiEvent", {
222
+ event_name : "AddToWishlist",
223
+ event_id : eventId,
224
+ user_data : wpm.getFbUserData(),
225
+ product_data : product,
226
+ product_id : product.dyn_r_ids[wpmDataLayer.pixels.facebook.dynamic_remarketing.id_type],
227
+ event_source_url: window.location.href,
228
+ })
229
+ } catch (e) {
230
+ console.error(e)
231
+ }
232
+ })
233
+
234
+ // ViewContent event
235
+ jQuery(document).on("wpmViewItem", function (event, product) {
236
+
237
+ try {
238
+ // console.log('firing facebook ads ViewContent event');
239
+ // console.log(product);
240
+
241
+ if (!wpmDataLayer?.pixels?.facebook?.loaded) return
242
+
243
+ wpm.fbViewContent(product)
244
+ } catch (e) {
245
+ console.error(e)
246
+ }
247
+ })
248
+
249
+ // view search event
250
+ jQuery(document).on("wpmSearch", function () {
251
+
252
+ try {
253
+ if (!wpmDataLayer?.pixels?.facebook?.loaded) return
254
+
255
+ let eventId = wpm.getRandomEventId()
256
+
257
+ fbq("track", "Search", {}, {
258
+ eventID: eventId,
259
+ })
260
+
261
+ jQuery(document).trigger("wpmFbCapiEvent", {
262
+ event_name : "Search",
263
+ event_id : eventId,
264
+ user_data : wpm.getFbUserData(),
265
+ event_source_url: window.location.href,
266
+ })
267
+ } catch (e) {
268
+ console.error(e)
269
+ }
270
+ })
271
+
272
+ // load always event
273
+ jQuery(document).on("wpmLoadAlways", function () {
274
+
275
+ try {
276
+ if (!wpmDataLayer?.pixels?.facebook?.loaded) return
277
+
278
+ wpm.setFbUserData()
279
+ } catch (e) {
280
+ console.error(e)
281
+ }
282
+ })
283
+
284
+ // view order received page event
285
+ // https://developers.pinterest.com/docs/tag/conversion/
286
+ jQuery(document).on("wpmOrderReceivedPage", function () {
287
+
288
+ try {
289
+ if (!wpmDataLayer?.pixels?.facebook?.loaded) return
290
+
291
+ fbq("track", "Purchase",
292
+ {
293
+ content_type: "product",
294
+ value : wpmDataLayer.order.value_filtered,
295
+ currency : wpmDataLayer.order.currency,
296
+ content_ids : wpm.facebookContentIds(),
297
+ },
298
+ {eventID: wpmDataLayer.order.id},
299
+ )
300
+
301
+
302
+ // console.log(wpm.facebookContentIds())
303
+ } catch (e) {
304
+ console.error(e)
305
+ }
306
+ })
js/public/google-ads.js ADDED
@@ -0,0 +1,305 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /**
2
+ * Add functions for Google Ads
3
+ * */
4
+
5
+ (function (wpm, $, undefined) {
6
+
7
+ let conversionIdentifiers = []
8
+
9
+ wpm.getGoogleAdsConversionIdentifiersWithLabel = function () {
10
+ for (const [key, item] of Object.entries(wpmDataLayer.pixels.google.ads.conversionIds)) {
11
+ conversionIdentifiers.push(key + "/" + item)
12
+ }
13
+ return conversionIdentifiers
14
+ }
15
+
16
+ wpm.getGoogleAdsConversionIdentifiers = function () {
17
+
18
+ let conversionIdentifiers = []
19
+ for (const [key, item] of Object.entries(wpmDataLayer.pixels.google.ads.conversionIds)) {
20
+ conversionIdentifiers.push(key)
21
+ }
22
+
23
+ return conversionIdentifiers
24
+ }
25
+
26
+ wpm.getGoogleAdsRegularOrderItems = function () {
27
+ // "id" : "gla_34",
28
+ // "quantity": 1,
29
+ // "price" : 45
30
+
31
+ let orderItems = []
32
+
33
+ for (const [key, item] of Object.entries(wpmDataLayer.order.items)) {
34
+
35
+ let orderItem
36
+
37
+ orderItem = {
38
+ quantity: item.quantity,
39
+ price : item.price,
40
+ }
41
+
42
+ if (wpmDataLayer?.general?.variationsOutput && 0 !== item.variation_id) {
43
+
44
+ orderItem.id = String(wpmDataLayer.products[item.variation_id].dyn_r_ids[wpmDataLayer.pixels.google.ads.dynamic_remarketing.id_type])
45
+ orderItems.push(orderItem)
46
+ } else {
47
+
48
+ orderItem.id = String(wpmDataLayer.products[item.id].dyn_r_ids[wpmDataLayer.pixels.google.ads.dynamic_remarketing.id_type])
49
+ orderItems.push(orderItem)
50
+ }
51
+ }
52
+
53
+ return orderItems
54
+ }
55
+
56
+ wpm.getGoogleAdsDynamicRemarketingOrderItems = function () {
57
+ // "id" : "gla_34",
58
+ // "quantity" : 1,
59
+ // "price" : 45,
60
+ // "google_business_vertical": "retail"
61
+
62
+ let orderItems = []
63
+
64
+ for (const [key, item] of Object.entries(wpmDataLayer.order.items)) {
65
+
66
+ let orderItem
67
+
68
+ orderItem = {
69
+ quantity : item.quantity,
70
+ price : item.price,
71
+ google_business_vertical: wpmDataLayer.pixels.google.ads.google_business_vertical,
72
+ }
73
+
74
+ if (wpmDataLayer?.general?.variationsOutput && 0 !== item.variation_id) {
75
+
76
+ orderItem.id = String(wpmDataLayer.products[item.variation_id].dyn_r_ids[wpmDataLayer.pixels.google.ads.dynamic_remarketing.id_type])
77
+ orderItems.push(orderItem)
78
+ } else {
79
+
80
+ orderItem.id = String(wpmDataLayer.products[item.id].dyn_r_ids[wpmDataLayer.pixels.google.ads.dynamic_remarketing.id_type])
81
+ orderItems.push(orderItem)
82
+ }
83
+ }
84
+
85
+ return orderItems
86
+ }
87
+
88
+ }(window.wpm = window.wpm || {}, jQuery))
89
+
90
+
91
+ /**
92
+ * All event listeners
93
+ * */
94
+
95
+ // view_item_list event
96
+ jQuery(document).on("wpmViewItemList", function (event, product) {
97
+
98
+ try {
99
+ if(jQuery.isEmptyObject(wpmDataLayer?.pixels?.google?.ads?.conversionIds)) return
100
+ if (!wpmDataLayer?.pixels?.google?.ads?.dynamic_remarketing?.status) return
101
+ if (!wpm.googleConfigConditionsMet("ads")) return
102
+
103
+
104
+ if (
105
+ wpmDataLayer?.general?.variationsOutput &&
106
+ product.isVariable &&
107
+ wpmDataLayer.pixels.google.ads.dynamic_remarketing.send_events_with_parent_ids === false
108
+ ) return
109
+
110
+ // try to prevent that WC sends cached hits to Google
111
+ if (!product) return
112
+
113
+ wpm.gtagLoaded().then(function () {
114
+ gtag("event", "view_item_list", {
115
+ send_to: wpm.getGoogleAdsConversionIdentifiers(),
116
+ items : [{
117
+ id : product.dyn_r_ids[wpmDataLayer.pixels.google.ads.dynamic_remarketing.id_type],
118
+ google_business_vertical: wpmDataLayer.pixels.google.ads.google_business_vertical,
119
+ }],
120
+ })
121
+ })
122
+ } catch (e) {
123
+ console.error(e)
124
+ }
125
+ })
126
+
127
+ // add_to_cart event
128
+ jQuery(document).on("wpmAddToCart", function (event, product) {
129
+
130
+ try {
131
+ if(jQuery.isEmptyObject(wpmDataLayer?.pixels?.google?.ads?.conversionIds)) return
132
+ if (!wpmDataLayer?.pixels?.google?.ads?.dynamic_remarketing?.status) return
133
+ if (!wpm.googleConfigConditionsMet("ads")) return
134
+
135
+ wpm.gtagLoaded().then(function () {
136
+ gtag("event", "add_to_cart", {
137
+ send_to: wpm.getGoogleAdsConversionIdentifiers(),
138
+ value : product.quantity * product.price,
139
+ items : [{
140
+ id : product.dyn_r_ids[wpmDataLayer.pixels.google.ads.dynamic_remarketing.id_type],
141
+ quantity : product.quantity,
142
+ price : product.price,
143
+ google_business_vertical: wpmDataLayer.pixels.google.ads.google_business_vertical,
144
+ }],
145
+ })
146
+ })
147
+ } catch (e) {
148
+ console.error(e)
149
+ }
150
+ })
151
+
152
+ // view_item event
153
+ jQuery(document).on("wpmViewItem", function (event, product) {
154
+
155
+ try {
156
+ if(jQuery.isEmptyObject(wpmDataLayer?.pixels?.google?.ads?.conversionIds)) return
157
+ if (!wpmDataLayer?.pixels?.google?.ads?.dynamic_remarketing?.status) return
158
+ if (!wpm.googleConfigConditionsMet("ads")) return
159
+
160
+
161
+ wpm.gtagLoaded().then(function () {
162
+ gtag("event", "view_item", {
163
+ send_to: wpm.getGoogleAdsConversionIdentifiers(),
164
+ value : (product.quantity ? product.quantity : 1) * product.price,
165
+ items : [{
166
+ id : product.dyn_r_ids[wpmDataLayer.pixels.google.ads.dynamic_remarketing.id_type],
167
+ quantity : (product.quantity ? product.quantity : 1),
168
+ price : product.price,
169
+ google_business_vertical: wpmDataLayer.pixels.google.ads.google_business_vertical,
170
+ }],
171
+ })
172
+ })
173
+ } catch (e) {
174
+ console.error(e)
175
+ }
176
+ })
177
+
178
+
179
+ // view search event
180
+ jQuery(document).on("wpmSearch", function () {
181
+
182
+ try {
183
+ if(jQuery.isEmptyObject(wpmDataLayer?.pixels?.google?.ads?.conversionIds)) return
184
+ if (!wpmDataLayer?.pixels?.google?.ads?.dynamic_remarketing?.status) return
185
+ if (!wpm.googleConfigConditionsMet("ads")) return
186
+
187
+
188
+ let products = []
189
+
190
+ for (const [key, product] of Object.entries(wpmDataLayer.products)) {
191
+
192
+ if (
193
+ wpmDataLayer?.general?.variationsOutput &&
194
+ product.isVariable &&
195
+ wpmDataLayer.pixels.google.ads.dynamic_remarketing.send_events_with_parent_ids === false
196
+ ) return
197
+
198
+ products.push({
199
+ id : product.dyn_r_ids[wpmDataLayer.pixels.google.ads.dynamic_remarketing.id_type],
200
+ google_business_vertical: wpmDataLayer.pixels.google.ads.google_business_vertical,
201
+ })
202
+ }
203
+
204
+ // console.log(products);
205
+
206
+ wpm.gtagLoaded().then(function () {
207
+ gtag("event", "view_search_results", {
208
+ send_to: wpm.getGoogleAdsConversionIdentifiers(),
209
+ // value : 1 * product.price,
210
+ items: products,
211
+ })
212
+ })
213
+ } catch (e) {
214
+ console.error(e)
215
+ }
216
+ })
217
+
218
+
219
+ // view order received page event
220
+ // TODO distinguish with or without cart data active
221
+ jQuery(document).on("wpmOrderReceivedPage", function () {
222
+
223
+ try {
224
+ if(jQuery.isEmptyObject(wpmDataLayer?.pixels?.google?.ads?.conversionIds)) return
225
+ if (!wpmDataLayer?.pixels?.google?.ads?.dynamic_remarketing?.status) return
226
+ if (!wpm.googleConfigConditionsMet("ads")) return
227
+
228
+ wpm.gtagLoaded().then(function () {
229
+ gtag("event", "purchase", {
230
+ send_to: wpm.getGoogleAdsConversionIdentifiers(),
231
+ value : wpmDataLayer.order.value_filtered,
232
+ items : wpm.getGoogleAdsDynamicRemarketingOrderItems(),
233
+ })
234
+ })
235
+
236
+ // console.log(wpm.getGoogleAdsDynamicRemarketingOrderItems())
237
+ } catch (e) {
238
+ console.error(e)
239
+ }
240
+ })
241
+
242
+ // user log in event
243
+ jQuery(document).on("wpmLogin", function () {
244
+
245
+ try {
246
+ if(jQuery.isEmptyObject(wpmDataLayer?.pixels?.google?.ads?.conversionIds)) return
247
+ if (!wpmDataLayer?.pixels?.google?.ads?.dynamic_remarketing?.status) return
248
+ if (!wpm.googleConfigConditionsMet("ads")) return
249
+
250
+
251
+ wpm.gtagLoaded().then(function () {
252
+ gtag("event", "login", {
253
+ send_to: wpm.getGoogleAdsConversionIdentifiers(),
254
+ })
255
+ })
256
+ } catch (e) {
257
+ console.error(e)
258
+ }
259
+ })
260
+
261
+ // view order received page event
262
+ // new_customer parameter: https://support.google.com/google-ads/answer/9917012
263
+ jQuery(document).on("wpmOrderReceivedPage", function () {
264
+
265
+ try {
266
+ if(jQuery.isEmptyObject(wpmDataLayer?.pixels?.google?.ads?.conversionIds)) return
267
+ if (!wpm.googleConfigConditionsMet("ads")) return
268
+
269
+ let data_basic = {}
270
+ let data_with_cart = {}
271
+
272
+ data_basic = {
273
+ send_to : wpm.getGoogleAdsConversionIdentifiersWithLabel(),
274
+ transaction_id: wpmDataLayer.order.number,
275
+ value : wpmDataLayer.order.value_filtered,
276
+ currency : wpmDataLayer.order.currency,
277
+ new_customer : wpmDataLayer.order.new_customer,
278
+ }
279
+
280
+ if (wpmDataLayer?.order?.aw_merchant_id) {
281
+ data_with_cart = {
282
+ discount : wpmDataLayer.order.discount,
283
+ aw_merchant_id : wpmDataLayer.order.aw_merchant_id,
284
+ aw_feed_country : wpmDataLayer.order.aw_feed_country,
285
+ aw_feed_language: wpmDataLayer.order.aw_feed_language,
286
+ items : wpm.getGoogleAdsRegularOrderItems(),
287
+ }
288
+ }
289
+
290
+ wpm.gtagLoaded().then(function () {
291
+ gtag("event", "conversion", {...data_basic, ...data_with_cart})
292
+ })
293
+
294
+ // console.log({...data_basic,...data_with_cart})
295
+
296
+ // console.log(wpm.getGoogleAdsOrderItems())
297
+ } catch (e) {
298
+ console.error(e)
299
+ }
300
+ })
301
+
302
+
303
+
304
+
305
+
js/public/google-ga-4.js ADDED
@@ -0,0 +1,83 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /**
2
+ * Add functions for Google Analytics 4
3
+ * */
4
+
5
+ (function (wpm, $, undefined) {
6
+
7
+ wpm.getGA4OrderItems = function () {
8
+
9
+ // "item_id" : "34",
10
+ // "item_name" : "Hoodie",
11
+ // "quantity" : 1,
12
+ // "item_brand" : "",
13
+ // "item_variant" : "Color: blue | Logo: yes",
14
+ // "price" : 45,
15
+ // "currency" : "CHF",
16
+ // "item_category": "Hoodies"
17
+
18
+
19
+ let orderItems = []
20
+
21
+ for (const [key, item] of Object.entries(wpmDataLayer.order.items)) {
22
+
23
+ let orderItem
24
+
25
+ orderItem = {
26
+ quantity : item.quantity,
27
+ price : item.price,
28
+ item_name : item.name,
29
+ currency : wpmDataLayer.order.currency,
30
+ item_category: wpmDataLayer.products[item.id].category.join("/"),
31
+ }
32
+
33
+ if (wpmDataLayer?.general?.variationsOutput && 0 !== item.variation_id) {
34
+
35
+ orderItem.item_id = String(wpmDataLayer.products[item.variation_id].dyn_r_ids[wpmDataLayer.pixels.google.analytics.id_type])
36
+ orderItem.item_variant = wpmDataLayer.products[item.variation_id].variant_name
37
+ orderItem.item_brand = wpmDataLayer.products[item.variation_id].brand
38
+ } else {
39
+
40
+ orderItem.item_id = String(wpmDataLayer.products[item.id].dyn_r_ids[wpmDataLayer.pixels.google.analytics.id_type])
41
+ orderItem.item_brand = wpmDataLayer.products[item.id].brand
42
+ }
43
+
44
+ orderItems.push(orderItem)
45
+ }
46
+
47
+ return orderItems
48
+ }
49
+
50
+ }(window.wpm = window.wpm || {}, jQuery))
51
+
52
+
53
+ /**
54
+ * All event listeners
55
+ * */
56
+
57
+
58
+ // view order received page event
59
+ jQuery(document).on("wpmOrderReceivedPage", function () {
60
+
61
+ try {
62
+ if (!wpmDataLayer?.pixels?.google?.analytics?.ga4?.measurement_id) return
63
+ if (wpmDataLayer?.pixels?.google?.analytics?.ga4?.mp_active) return
64
+ if (!wpm.googleConfigConditionsMet("analytics")) return
65
+
66
+ wpm.gtagLoaded().then(function () {
67
+ gtag("event", "purchase", {
68
+ send_to : [wpmDataLayer.pixels.google.analytics.ga4.measurement_id],
69
+ transaction_id: wpmDataLayer.order.number,
70
+ affiliation : wpmDataLayer.order.affiliation,
71
+ currency : wpmDataLayer.order.currency,
72
+ value : wpmDataLayer.order.value_regular,
73
+ discount : wpmDataLayer.order.discount,
74
+ tax : wpmDataLayer.order.tax,
75
+ shipping : wpmDataLayer.order.shipping,
76
+ coupon : wpmDataLayer.order.coupon,
77
+ items : wpm.getGA4OrderItems(),
78
+ })
79
+ })
80
+ } catch (e) {
81
+ console.error(e)
82
+ }
83
+ })
js/public/google-ga-ua.js ADDED
@@ -0,0 +1,88 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /**
2
+ * Add functions for Google Analytics Universal
3
+ * */
4
+
5
+ (function (wpm, $, undefined) {
6
+
7
+ wpm.getGAUAOrderItems = function () {
8
+
9
+ // "id" : "34",
10
+ // "name" : "Hoodie",
11
+ // "brand" : "",
12
+ // "category" : "Hoodies",
13
+ // "list_position": 1,
14
+ // "price" : 45,
15
+ // "quantity" : 1,
16
+ // "variant" : "Color: blue | Logo: yes"
17
+
18
+
19
+ let orderItems = [],
20
+ list_position = 1
21
+
22
+ for (const [key, item] of Object.entries(wpmDataLayer.order.items)) {
23
+
24
+ let orderItem
25
+
26
+ orderItem = {
27
+ quantity : item.quantity,
28
+ price : item.price,
29
+ name : item.name,
30
+ currency : wpmDataLayer.order.currency,
31
+ category : wpmDataLayer.products[item.id].category.join("/"),
32
+ list_position: list_position,
33
+ }
34
+
35
+ if (wpmDataLayer?.general?.variationsOutput && 0 !== item.variation_id) {
36
+
37
+ orderItem.id = String(wpmDataLayer.products[item.variation_id].dyn_r_ids[wpmDataLayer.pixels.google.analytics.id_type])
38
+ orderItem.variant = wpmDataLayer.products[item.variation_id].variant_name
39
+ orderItem.brand = wpmDataLayer.products[item.variation_id].brand
40
+ } else {
41
+
42
+ orderItem.id = String(wpmDataLayer.products[item.id].dyn_r_ids[wpmDataLayer.pixels.google.analytics.id_type])
43
+ orderItem.brand = wpmDataLayer.products[item.id].brand
44
+ }
45
+
46
+ orderItems.push(orderItem)
47
+ list_position++
48
+ }
49
+
50
+ return orderItems
51
+ }
52
+
53
+ }(window.wpm = window.wpm || {}, jQuery))
54
+
55
+
56
+ /**
57
+ * All event listeners
58
+ * */
59
+
60
+
61
+ // view order received page event
62
+ jQuery(document).on("wpmOrderReceivedPage", function () {
63
+
64
+ try {
65
+ if (!wpmDataLayer?.pixels?.google?.analytics?.universal?.property_id) return
66
+ if (wpmDataLayer?.pixels?.google?.analytics?.universal?.mp_active) return
67
+ if (!wpm.googleConfigConditionsMet("analytics")) return
68
+
69
+ wpm.gtagLoaded().then(function () {
70
+ gtag("event", "purchase", {
71
+ send_to : [wpmDataLayer.pixels.google.analytics.universal.property_id],
72
+ transaction_id: wpmDataLayer.order.number,
73
+ affiliation : wpmDataLayer.order.affiliation,
74
+ currency : wpmDataLayer.order.currency,
75
+ value : wpmDataLayer.order.value_regular,
76
+ discount : wpmDataLayer.order.discount,
77
+ tax : wpmDataLayer.order.tax,
78
+ shipping : wpmDataLayer.order.shipping,
79
+ coupon : wpmDataLayer.order.coupon,
80
+ items : wpm.getGAUAOrderItems(),
81
+ })
82
+ })
83
+
84
+ // console.log(wpm.getGAUAOrderItems())
85
+ } catch (e) {
86
+ console.error(e)
87
+ }
88
+ })
js/public/google-optimize.js ADDED
@@ -0,0 +1,33 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ (function (wpm, $, undefined) {
2
+
3
+ wpm.load_google_optimize_pixel = function () {
4
+
5
+ try {
6
+ wpmDataLayer.pixels.google.optimize.loaded = true
7
+
8
+ wpm.loadScriptAndCacheIt("https://www.googleoptimize.com/optimize.js?id=" + wpmDataLayer.pixels.google.optimize.container_id)
9
+ // .done(function (script, textStatus) {
10
+ // console.log('Google Optimize loaded')
11
+ // });
12
+
13
+ } catch (e) {
14
+ console.error(e)
15
+ }
16
+ }
17
+
18
+ }(window.wpm = window.wpm || {}, jQuery));
19
+
20
+
21
+ (function () {
22
+
23
+ jQuery(document).on("wpmLoadPixels", function () {
24
+
25
+ if (wpmDataLayer?.pixels?.google?.optimize?.container_id && !wpmDataLayer?.pixels?.google?.optimize?.loaded) {
26
+ if (wpm.canIFire("analytics", "google-optimize")) wpm.load_google_optimize_pixel()
27
+ }
28
+ })
29
+
30
+ })()
31
+
32
+
33
+
js/public/google.js ADDED
@@ -0,0 +1,304 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /**
2
+ * Add functions for Google
3
+ * */
4
+
5
+ (function (wpm, $, undefined) {
6
+
7
+ wpm.googleConfigConditionsMet = function (type) {
8
+ // always returns true if Google Consent Mode is active
9
+ if (wpmDataLayer?.pixels?.google?.consent_mode?.active) {
10
+ return true
11
+ } else if (wpm.getConsentValues().mode === "category") {
12
+ return wpm.getConsentValues().categories[type] === true
13
+ } else if (wpm.getConsentValues().mode === "pixel") {
14
+ return wpm.getConsentValues().pixels.includes("google-" + type)
15
+ } else {
16
+ return false
17
+ }
18
+ }
19
+
20
+ wpm.getVisitorConsentStatusAndUpdateGoogleConsentSettings = function (google_consent_settings) {
21
+
22
+ if (wpm.getConsentValues().mode === "category") {
23
+ if (wpm.getConsentValues().categories.analytics) google_consent_settings.analytics_storage = "granted"
24
+ if (wpm.getConsentValues().categories.ads) google_consent_settings.ad_storage = "granted"
25
+ } else if ((wpm.getConsentValues().mode === "pixel")) {
26
+ google_consent_settings.analytics_storage = wpm.getConsentValues().pixels.includes("google-analytics") ? "granted" : "denied"
27
+ google_consent_settings.ad_storage = wpm.getConsentValues().pixels.includes("google-ads") ? "granted" : "denied"
28
+ }
29
+
30
+ return google_consent_settings
31
+ }
32
+
33
+ wpm.updateGoogleConsentMode = function (analytics = true, ads = true) {
34
+
35
+ try {
36
+ if (
37
+ !window.gtag ||
38
+ !wpmDataLayer.shop.cookie_consent_mgmt.explicit_consent
39
+ ) return
40
+
41
+ gtag("consent", "update", {
42
+ analytics_storage: analytics ? "granted" : "denied",
43
+ ad_storage : ads ? "granted" : "denied",
44
+ })
45
+ } catch (e) {
46
+ console.error(e)
47
+ }
48
+ }
49
+
50
+ wpm.fireGtagGoogleAds = function () {
51
+ try {
52
+ wpmDataLayer.pixels.google.ads.state = "loading"
53
+
54
+ if (wpmDataLayer?.pixels?.google?.ads?.enhanced_conversions?.active) {
55
+ for (const [key, item] of Object.entries(wpmDataLayer.pixels.google.ads.conversionIds)) {
56
+ gtag("config", key, {"allow_enhanced_conversions": true})
57
+ }
58
+ } else {
59
+ for (const [key, item] of Object.entries(wpmDataLayer.pixels.google.ads.conversionIds)) {
60
+ gtag("config", key)
61
+ }
62
+ }
63
+
64
+ if (wpmDataLayer?.pixels?.google?.ads?.conversionIds && wpmDataLayer?.pixels?.google?.ads?.phone_conversion_label && wpmDataLayer?.pixels?.google?.ads?.phone_conversion_number) {
65
+ gtag("config", Object.keys(wpmDataLayer.pixels.google.ads.conversionIds)[0] + "/" + wpmDataLayer.pixels.google.ads.phone_conversion_label, {
66
+ phone_conversion_number: wpmDataLayer.pixels.google.ads.phone_conversion_number,
67
+ })
68
+ }
69
+
70
+ // ! enhanced_conversion_data needs to be var
71
+ // https://support.google.com/google-ads/answer/9888145#zippy=%2Cvalidate-your-implementation-using-chrome-developer-tools
72
+ if ("order_received_page" === wpmDataLayer.shop.page_type && wpmDataLayer?.order?.google?.ads?.enhanced_conversion_data) {
73
+ window.enhanced_conversion_data = wpmDataLayer.order.google.ads.enhanced_conversion_data
74
+ }
75
+
76
+ wpmDataLayer.pixels.google.ads.state = "ready"
77
+ } catch (e) {
78
+ console.error(e)
79
+ }
80
+ }
81
+
82
+ wpm.fireGtagGoogleAnalyticsUA = function () {
83
+ try {
84
+ wpmDataLayer.pixels.google.analytics.universal.state = "loading"
85
+
86
+ gtag("config", wpmDataLayer.pixels.google.analytics.universal.property_id, wpmDataLayer.pixels.google.analytics.universal.parameters)
87
+ wpmDataLayer.pixels.google.analytics.universal.state = "ready"
88
+ } catch (e) {
89
+ console.error(e)
90
+ }
91
+ }
92
+
93
+ wpm.fireGtagGoogleAnalyticsGA4 = function () {
94
+ try {
95
+ wpmDataLayer.pixels.google.analytics.ga4.state = "loading"
96
+
97
+ gtag("config", wpmDataLayer.pixels.google.analytics.ga4.measurement_id, wpmDataLayer.pixels.google.analytics.ga4.parameters)
98
+ wpmDataLayer.pixels.google.analytics.ga4.state = "ready"
99
+ } catch (e) {
100
+ console.error(e)
101
+ }
102
+ }
103
+
104
+ wpm.isGoogleActive = function () {
105
+ if (
106
+ wpmDataLayer?.pixels?.google?.analytics?.universal?.property_id ||
107
+ wpmDataLayer?.pixels?.google?.analytics?.ga4?.measurement_id ||
108
+ !jQuery.isEmptyObject(wpmDataLayer?.pixels?.google?.ads?.conversionIds)
109
+ ) {
110
+ return true
111
+ } else {
112
+ return false
113
+ }
114
+ }
115
+
116
+ wpm.getGoogleGtagId = function () {
117
+ if (wpmDataLayer?.pixels?.google?.analytics?.universal?.property_id) {
118
+ return wpmDataLayer.pixels.google.analytics.universal.property_id
119
+ } else if (wpmDataLayer?.pixels?.google?.analytics?.ga4?.measurement_id) {
120
+ return wpmDataLayer.pixels.google.analytics.ga4.measurement_id
121
+ } else {
122
+ return Object.keys(wpmDataLayer.pixels.google.ads.conversionIds)[0]
123
+ }
124
+ }
125
+
126
+ wpm.loadGoogle = function () {
127
+
128
+ if (wpm.isGoogleActive()) {
129
+
130
+ wpmDataLayer.pixels.google.state = "loading"
131
+
132
+ wpm.loadScriptAndCacheIt("https://www.googletagmanager.com/gtag/js?id=" + wpm.getGoogleGtagId())
133
+ .done(function (script, textStatus) {
134
+ try {
135
+ // console.log('Google Optimize loaded')
136
+ // alert('Google Optimize loaded')
137
+
138
+ // Initiate Google dataLayer and gtag
139
+ window.dataLayer = window.dataLayer || []
140
+ window.gtag = function gtag() {
141
+ dataLayer.push(arguments)
142
+ }
143
+
144
+ // Google Consent Mode
145
+ if (wpmDataLayer?.pixels?.google?.consent_mode?.active) {
146
+
147
+ let google_consent_settings = {
148
+ "ad_storage" : wpmDataLayer.pixels.google.consent_mode.ad_storage,
149
+ "analytics_storage": wpmDataLayer.pixels.google.consent_mode.analytics_storage,
150
+ "wait_for_update" : wpmDataLayer.pixels.google.consent_mode.wait_for_update,
151
+ }
152
+
153
+ if (wpmDataLayer?.pixels?.google?.consent_mode?.region) {
154
+ google_consent_settings.region = wpmDataLayer.pixels.google.consent_mode.region
155
+ }
156
+ google_consent_settings = wpm.getVisitorConsentStatusAndUpdateGoogleConsentSettings(google_consent_settings)
157
+
158
+ gtag("consent", "default", google_consent_settings)
159
+ gtag("set", "ads_data_redaction", wpmDataLayer.pixels.google.consent_mode.ads_data_redaction)
160
+ gtag("set", "url_passthrough", wpmDataLayer.pixels.google.consent_mode.url_passthrough)
161
+ }
162
+
163
+ // Google Linker
164
+ // https://developers.google.com/gtagjs/devguide/linker
165
+ if (wpmDataLayer?.pixels?.google?.linker?.settings) {
166
+ gtag("set", "linker", wpmDataLayer.pixels.google.linker.settings)
167
+ }
168
+
169
+ gtag("js", new Date())
170
+
171
+ // Google Ads loader
172
+ if (!jQuery.isEmptyObject(wpmDataLayer?.pixels?.google?.ads?.conversionIds)) { // Only run if the pixel has set up
173
+ if (wpm.googleConfigConditionsMet("ads")) { // Only run if cookie consent has been given
174
+ wpm.fireGtagGoogleAds()
175
+ } else {
176
+ wpm.logPreventedPixelLoading("google-ads", "ads")
177
+ }
178
+ }
179
+
180
+
181
+ // Google Universal Analytics loader
182
+ if (wpmDataLayer?.pixels?.google?.analytics?.universal?.property_id) { // Only run if the pixel has set up
183
+ if (wpm.googleConfigConditionsMet("analytics")) { // Only run if cookie consent has been given
184
+ wpm.fireGtagGoogleAnalyticsUA()
185
+ } else {
186
+ wpm.logPreventedPixelLoading("google-universal-analytics", "analytics")
187
+ }
188
+ }
189
+
190
+ // GA4 loader
191
+ if (wpmDataLayer?.pixels?.google?.analytics?.ga4?.measurement_id) { // Only run if the pixel has set up
192
+ if (wpm.googleConfigConditionsMet("analytics")) { // Only run if cookie consent has been given
193
+ wpm.fireGtagGoogleAnalyticsGA4()
194
+ } else {
195
+ wpm.logPreventedPixelLoading("ga4", "analytics")
196
+ }
197
+ }
198
+
199
+ wpmDataLayer.pixels.google.state = "ready"
200
+ } catch (e) {
201
+ console.error(e)
202
+ }
203
+ })
204
+ }
205
+ }
206
+
207
+ wpm.canGoogleLoad = function () {
208
+
209
+ if (wpmDataLayer?.pixels?.google?.consent_mode?.active) {
210
+ return true
211
+ } else if ("category" === wpm.getConsentValues().mode) {
212
+ return !!(wpm.getConsentValues().categories["ads"] || wpm.getConsentValues().categories["analytics"])
213
+ } else if ("pixel" === wpm.getConsentValues().mode) {
214
+ return wpm.getConsentValues().pixels.includes("google-ads") || wpm.getConsentValues().pixels.includes("google-analytics")
215
+ } else {
216
+ console.error("Couldn't find a valid load condition for Google mode in wpmConsentValues")
217
+ return false
218
+ }
219
+ }
220
+
221
+ wpm.gtagLoaded = function () {
222
+ return new Promise(function (resolve, reject) {
223
+
224
+ if (typeof wpmDataLayer?.pixels?.google?.state === "undefined") reject()
225
+
226
+ let startTime = 0
227
+ let timeout = 5000
228
+ let frequency = 200;
229
+
230
+ (function wait() {
231
+ if (wpmDataLayer?.pixels?.google?.state === "ready") return resolve()
232
+ if (startTime >= timeout) return reject()
233
+ startTime += frequency
234
+ setTimeout(wait, frequency)
235
+ })()
236
+ })
237
+ }
238
+
239
+ // wpm.gtagLoadednew = function () {
240
+ // return Promise.race([
241
+ // new Promise(function (resolve, reject) {
242
+ //
243
+ // if (typeof wpmDataLayer?.pixels?.google?.state === "undefined") reject();
244
+ //
245
+ //
246
+ // (function wait() {
247
+ // if (wpmDataLayer?.pixels?.google?.state === "ready") return resolve()
248
+ // if (to >= 1000) return reject()
249
+ // setTimeout(wait, 100)
250
+ // })()
251
+ // }),
252
+ // new Promise(function (resolve, reject) {
253
+ // setTimeout(() => reject(), 1000)
254
+ // }),
255
+ // ],
256
+ // )
257
+ // // .then((value) => {console.log("race then value: " + value)})
258
+ // .catch(
259
+ // (value) => {
260
+ // console.log("race catch value: " + value)
261
+ // return Promise.reject()
262
+ // })
263
+ // }
264
+
265
+
266
+ // const promise1 = new Promise((resolve, reject) => {
267
+ // setTimeout(resolve, 500, "one")
268
+ // })
269
+ //
270
+ // const promise2 = new Promise((resolve, reject) => {
271
+ // setTimeout(reject, 100, "two")
272
+ // })
273
+ //
274
+ // let onlyRunIfResolves = function () {
275
+ // return Promise.race([promise1, promise2])
276
+ // .catch(() => {
277
+ // })
278
+ // }
279
+ //
280
+ // onlyRunIfResolves()
281
+ // .then(() => {
282
+ // console.log("running function")
283
+ // })
284
+
285
+
286
+ }(window.wpm = window.wpm || {}, jQuery));
287
+
288
+
289
+ (function () {
290
+
291
+ jQuery(document).on("wpmLoadPixels", function () {
292
+
293
+ if (typeof wpmDataLayer?.pixels?.google?.state === "undefined") {
294
+ if (wpm.canGoogleLoad()) {
295
+ wpm.loadGoogle()
296
+ } else {
297
+ wpm.logPreventedPixelLoading("google", "analytics / ads")
298
+ }
299
+ }
300
+ })
301
+
302
+ // return wpmDataLayer?.pixels?.google?.state === "undefined";
303
+
304
+ })()
js/public/hotjar.js ADDED
@@ -0,0 +1,39 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ (function (wpm, $, undefined) {
2
+
3
+ wpm.load_hotjar_pixel = function () {
4
+
5
+ try {
6
+ wpmDataLayer.pixels.hotjar.loaded = true;
7
+
8
+ // @formatter:off
9
+ (function(h,o,t,j,a,r){
10
+ h.hj=h.hj||function(){(h.hj.q=h.hj.q||[]).push(arguments)};
11
+ h._hjSettings={hjid:wpmDataLayer.pixels.hotjar.site_id,hjsv:6};
12
+ a=o.getElementsByTagName('head')[0];
13
+ r=o.createElement('script');r.async=1;
14
+ r.src=t+h._hjSettings.hjid+j+h._hjSettings.hjsv;
15
+ a.appendChild(r);
16
+ })(window,document,'https://static.hotjar.com/c/hotjar-','.js?sv=');
17
+ // @formatter:on
18
+
19
+ } catch (e) {
20
+ console.error(e)
21
+ }
22
+ }
23
+
24
+ }(window.wpm = window.wpm || {}, jQuery));
25
+
26
+
27
+ (function () {
28
+
29
+ jQuery(document).on("wpmLoadPixels", function () {
30
+
31
+ if (wpmDataLayer?.pixels?.hotjar?.site_id && !wpmDataLayer?.pixels?.hotjar?.loaded) {
32
+ if (wpm.canIFire("analytics", "hotjar") && !wpmDataLayer?.pixels?.hotjar?.loaded) wpm.load_hotjar_pixel()
33
+ }
34
+ })
35
+
36
+ })()
37
+
38
+
39
+
js/public/main-free.js ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /**
2
+ * Load all free scripts first
3
+ */
4
+
5
+ require("./wpm")
6
+
7
+ /**
8
+ * Load all free scripts
9
+ */
10
+
11
+ require("./google")
12
+ require("./google-ga-ua")
13
+ require("./google-ga-4")
14
+ require("./google-ads")
15
+ require("./facebook")
16
+ require("./hotjar")
17
+ require("./google-optimize")
18
+
19
+ /**
20
+ * Execute the wpm loader. It makes sure that the script flow gets exectuded correctly, no matter how JS "optimizers" shuffle the code.
21
+ */
22
+
23
+ require("./wpm-loader")
24
+
25
+ // console.log('WooCommerce Pixel Manager free version')
26
+
27
+
js/public/main-premium.js ADDED
@@ -0,0 +1,57 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ // TODO Try using the webpack ignore plugin to remove premium imports during compilation
2
+ // https://webpack.js.org/plugins/ignore-plugin/
3
+ // https://stackoverflow.com/questions/65004054/webpack-ignoreplugin-on-multiple-modules
4
+ // https://stackoverflow.com/questions/61822069/conditional-import-import-if-exists
5
+ // https://stackoverflow.com/questions/36367532/how-can-i-conditionally-import-an-es6-module
6
+
7
+
8
+ // console.log(ENV)
9
+ // if (ENV.tier === 'pro') {
10
+ // console.log('tier')
11
+ // }
12
+
13
+ /**
14
+ * Load all essential scripts first
15
+ */
16
+
17
+ require("./wpm")
18
+ require("./wpm__premium_only")
19
+ require("./google__premium_only")
20
+
21
+ /**
22
+ * Load all free scripts
23
+ */
24
+
25
+ require("./google")
26
+ require("./google-ga-ua")
27
+ require("./google-ga-4")
28
+ require("./google-ads")
29
+ require("./facebook")
30
+ require("./hotjar")
31
+ require("./google-optimize")
32
+
33
+ /**
34
+ * Load all premium scripts
35
+ */
36
+
37
+ require("./google-ga-ua-eec__premium_only")
38
+ require("./google-ga-4-eec__premium_only")
39
+ require("./tiktok__premium_only")
40
+ require("./snapchat__premium_only")
41
+ require("./pinterest__premium_only")
42
+ require("./facebook__premium_only")
43
+ require("./microsoft-ads__premium_only.js")
44
+ require("./twitter__premium_only.js")
45
+ require("./google-ads__premium_only.js")
46
+
47
+
48
+ /**
49
+ * Execute the wpm loader. It makes sure that the script flow gets exectuded correctly, no matter how JS "optimizers" shuffle the code.
50
+ */
51
+
52
+ require("./wpm-loader")
53
+
54
+
55
+ // console.log('WooCommerce Pixel Manager premium version')
56
+
57
+
js/public/main.js ADDED
@@ -0,0 +1,33 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ // TODO Try using the webpack ignore plugin to remove premium imports during compilation
2
+ // https://webpack.js.org/plugins/ignore-plugin/
3
+ // https://stackoverflow.com/questions/65004054/webpack-ignoreplugin-on-multiple-modules
4
+ // https://stackoverflow.com/questions/61822069/conditional-import-import-if-exists
5
+ // https://stackoverflow.com/questions/36367532/how-can-i-conditionally-import-an-es6-module
6
+
7
+ // import wpm from "./wpm.js"
8
+ // import wpm_premium from "./wpm__premium_only.js"
9
+ // import google_premium from "./google__premium_only.js"
10
+
11
+ // require("./wpm.js")
12
+ require("./wpm__premium_only.js")
13
+ require("./google__premium_only.js")
14
+
15
+ // if (ENV.tier === 'pro') {
16
+ // console.log('Yo!')
17
+ //
18
+ // }
19
+
20
+ import google_ads from "./google-ads.js"
21
+ import facebook from "./facebook.js"
22
+ import hotjar from "./hotjar.js"
23
+ import google_optimize from "./google-optimize.js"
24
+
25
+ import google_ga_ua_eec_premium from "./google-ga-ua-eec__premium_only.js"
26
+ import google_ga_4_eec_premium from "./google-ga-4-eec__premium_only.js"
27
+ import tiktok_premium from "./tiktok__premium_only.js"
28
+ import snapchat_premium from "./snapchat__premium_only.js"
29
+ import pinterest_premium from "./pinterest__premium_only.js"
30
+ import facebook_premium from "./facebook__premium_only.js"
31
+
32
+
33
+ // console.log('WooCommerce Pixel Manager premium version')
js/public/wpm-loader.js ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /**
2
+ * After wpm is loaded
3
+ * we first check if wpmDataLayer is loaded,
4
+ * and as soon as it is, we load the pixels,
5
+ * and as soon as the page load is complete,
6
+ * we fire the wpmLoad event.
7
+ *
8
+ * @param {{pro:bool}} wpmDataLayer.version
9
+ *
10
+ * https://stackoverflow.com/a/25868457/4688612
11
+ * https://stackoverflow.com/a/44093516/4688612
12
+ */
13
+ wpm.wpmDataLayerExists()
14
+ .then(function () {
15
+ console.log("WooCommerce Pixel Manager: " + (wpmDataLayer.version.pro ? "Pro" : "Free") +" Version " + wpmDataLayer.version.number + " loaded")
16
+ jQuery(document).trigger("wpmPreLoadPixels", {})
17
+ })
18
+ .then(function () {
19
+ wpm.pageLoaded().then(function () {
20
+ jQuery(document).trigger("wpmLoad", {})
21
+ })
22
+ })
23
+
js/public/wpm-public.p1.min.js CHANGED
@@ -1,2 +1,2 @@
1
- (()=>{var e={164:()=>{jQuery(document).on("wpmLoadPixels",(function(){var e,t,o,a,r,n;null===(e=wpmDataLayer)||void 0===e||null===(t=e.pixels)||void 0===t||null===(o=t.facebook)||void 0===o||!o.pixel_id||null!==(a=wpmDataLayer)&&void 0!==a&&null!==(r=a.pixels)&&void 0!==r&&null!==(n=r.facebook)&&void 0!==n&&n.loaded||wpm.canIFire("ads","facebook-ads")&&wpm.loadFacebookPixel()})),jQuery(document).on("wpmAddToCart",(function(e,t){try{var o,a,r;if(null===(o=wpmDataLayer)||void 0===o||null===(a=o.pixels)||void 0===a||null===(r=a.facebook)||void 0===r||!r.loaded)return;let e=wpm.getRandomEventId();fbq("track","AddToCart",{content_type:"product",content_name:t.name,content_ids:t.dyn_r_ids[wpmDataLayer.pixels.facebook.dynamic_remarketing.id_type],value:parseFloat(t.quantity*t.price),currency:t.currency},{eventID:e}),t.currency=wpmDataLayer.shop.currency,jQuery(document).trigger("wpmFbCapiEvent",{event_name:"AddToCart",event_id:e,user_data:wpm.getFbUserData(),product_data:t,product_id:t.dyn_r_ids[wpmDataLayer.pixels.facebook.dynamic_remarketing.id_type],event_source_url:window.location.href})}catch(e){console.error(e)}})),jQuery(document).on("wpmBeginCheckout",(function(e){try{var t,o,a;if(null===(t=wpmDataLayer)||void 0===t||null===(o=t.pixels)||void 0===o||null===(a=o.facebook)||void 0===a||!a.loaded)return;let e=wpm.getRandomEventId();fbq("track","InitiateCheckout",{},{eventID:e}),jQuery(document).trigger("wpmFbCapiEvent",{event_name:"InitiateCheckout",event_id:e,user_data:wpm.getFbUserData(),event_source_url:window.location.href})}catch(e){console.error(e)}})),jQuery(document).on("wpmAddToWishlist",(function(e,t){try{var o,a,r;if(null===(o=wpmDataLayer)||void 0===o||null===(a=o.pixels)||void 0===a||null===(r=a.facebook)||void 0===r||!r.loaded)return;let e=wpm.getRandomEventId();fbq("track","AddToWishlist",{content_type:"product",content_name:t.name,content_ids:t.dyn_r_ids[wpmDataLayer.pixels.facebook.dynamic_remarketing.id_type],value:parseFloat(t.quantity*t.price),currency:t.currency},{eventID:e}),t.currency=wpmDataLayer.shop.currency,jQuery(document).trigger("wpmFbCapiEvent",{event_name:"AddToWishlist",event_id:e,user_data:wpm.getFbUserData(),product_data:t,product_id:t.dyn_r_ids[wpmDataLayer.pixels.facebook.dynamic_remarketing.id_type],event_source_url:window.location.href})}catch(e){console.error(e)}})),jQuery(document).on("wpmViewItem",(function(e,t){try{var o,a,r;if(null===(o=wpmDataLayer)||void 0===o||null===(a=o.pixels)||void 0===a||null===(r=a.facebook)||void 0===r||!r.loaded)return;wpm.fbViewContent(t)}catch(e){console.error(e)}})),jQuery(document).on("wpmSearch",(function(){try{var e,t,o;if(null===(e=wpmDataLayer)||void 0===e||null===(t=e.pixels)||void 0===t||null===(o=t.facebook)||void 0===o||!o.loaded)return;let a=wpm.getRandomEventId();fbq("track","Search",{},{eventID:a}),jQuery(document).trigger("wpmFbCapiEvent",{event_name:"Search",event_id:a,user_data:wpm.getFbUserData(),event_source_url:window.location.href})}catch(e){console.error(e)}})),jQuery(document).on("wpmLoadAlways",(function(){try{var e,t,o;if(null===(e=wpmDataLayer)||void 0===e||null===(t=e.pixels)||void 0===t||null===(o=t.facebook)||void 0===o||!o.loaded)return;wpm.setFbUserData()}catch(e){console.error(e)}})),jQuery(document).on("wpmOrderReceivedPage",(function(){try{var e,t,o;if(null===(e=wpmDataLayer)||void 0===e||null===(t=e.pixels)||void 0===t||null===(o=t.facebook)||void 0===o||!o.loaded)return;fbq("track","Purchase",{content_type:"product",value:wpmDataLayer.order.value_filtered,currency:wpmDataLayer.order.currency,content_ids:wpm.facebookContentIds()},{eventID:wpmDataLayer.order.id})}catch(e){console.error(e)}}))},1:()=>{!function(e,t,o){let a;e.loadFacebookPixel=function(){try{wpmDataLayer.pixels.facebook.loaded=!0,e=window,t=document,o="script",e.fbq||(a=e.fbq=function(){a.callMethod?a.callMethod.apply(a,arguments):a.queue.push(arguments)},e._fbq||(e._fbq=a),a.push=a,a.loaded=!0,a.version="2.0",a.queue=[],(r=t.createElement(o)).async=!0,r.src="https://connect.facebook.net/en_US/fbevents.js",(n=t.getElementsByTagName(o)[0]).parentNode.insertBefore(r,n)),fbq("init",wpmDataLayer.pixels.facebook.pixel_id),fbq("track","PageView")}catch(o){console.error(o)}var e,t,o,a,r,n},e.getRandomEventId=function(){return(Math.random()+1).toString(36).substring(2)},e.getFbUserData=function(){return a||e.getFbUserDataFromBrowser()},e.setFbUserData=function(){a=e.getFbUserDataFromBrowser()},e.getFbUserDataFromBrowser=function(){return{fbp:e.getCookie("_fbp"),fbc:e.getCookie("_fbc"),client_user_agent:navigator.userAgent}},e.fbViewContent=function(t){try{var o,a,r;if(null===(o=wpmDataLayer)||void 0===o||null===(a=o.pixels)||void 0===a||null===(r=a.facebook)||void 0===r||!r.loaded)return;let n=e.getRandomEventId();fbq("track","ViewContent",{content_type:"product",content_name:t.name,content_ids:t.dyn_r_ids[wpmDataLayer.pixels.facebook.dynamic_remarketing.id_type],currency:wpmDataLayer.shop.currency,value:t.price},{eventID:n}),t.currency=wpmDataLayer.shop.currency,jQuery(document).trigger("wpmFbCapiEvent",{event_name:"ViewContent",event_id:n,user_data:e.getFbUserData(),product_data:t,product_id:t.dyn_r_ids[wpmDataLayer.pixels.facebook.dynamic_remarketing.id_type],event_source_url:window.location.href})}catch(e){console.error(e)}},e.facebookContentIds=function(){let e=[];for(const[a,r]of Object.entries(wpmDataLayer.order.items)){var t,o;null!==(t=wpmDataLayer)&&void 0!==t&&null!==(o=t.general)&&void 0!==o&&o.variationsOutput&&0!==r.variation_id?e.push(String(wpmDataLayer.products[r.variation_id].dyn_r_ids[wpmDataLayer.pixels.facebook.dynamic_remarketing.id_type])):e.push(String(wpmDataLayer.products[r.id].dyn_r_ids[wpmDataLayer.pixels.facebook.dynamic_remarketing.id_type]))}return e}}(window.wpm=window.wpm||{},jQuery)},12:(e,t,o)=>{o(1),o(164)},165:()=>{jQuery(document).on("wpmViewItemList",(function(e,t){try{var o,a,r,n,i,s,d,l,c,u,p;if(jQuery.isEmptyObject(null===(o=wpmDataLayer)||void 0===o||null===(a=o.pixels)||void 0===a||null===(r=a.google)||void 0===r||null===(n=r.ads)||void 0===n?void 0:n.conversionIds))return;if(null===(i=wpmDataLayer)||void 0===i||null===(s=i.pixels)||void 0===s||null===(d=s.google)||void 0===d||null===(l=d.ads)||void 0===l||null===(c=l.dynamic_remarketing)||void 0===c||!c.status)return;if(!wpm.googleConfigConditionsMet("ads"))return;if(null!==(u=wpmDataLayer)&&void 0!==u&&null!==(p=u.general)&&void 0!==p&&p.variationsOutput&&t.isVariable&&!1===wpmDataLayer.pixels.google.ads.dynamic_remarketing.send_events_with_parent_ids)return;if(!t)return;wpm.gtagLoaded().then((function(){gtag("event","view_item_list",{send_to:wpm.getGoogleAdsConversionIdentifiers(),items:[{id:t.dyn_r_ids[wpmDataLayer.pixels.google.ads.dynamic_remarketing.id_type],google_business_vertical:wpmDataLayer.pixels.google.ads.google_business_vertical}]})}))}catch(e){console.error(e)}})),jQuery(document).on("wpmAddToCart",(function(e,t){try{var o,a,r,n,i,s,d,l,c;if(jQuery.isEmptyObject(null===(o=wpmDataLayer)||void 0===o||null===(a=o.pixels)||void 0===a||null===(r=a.google)||void 0===r||null===(n=r.ads)||void 0===n?void 0:n.conversionIds))return;if(null===(i=wpmDataLayer)||void 0===i||null===(s=i.pixels)||void 0===s||null===(d=s.google)||void 0===d||null===(l=d.ads)||void 0===l||null===(c=l.dynamic_remarketing)||void 0===c||!c.status)return;if(!wpm.googleConfigConditionsMet("ads"))return;wpm.gtagLoaded().then((function(){gtag("event","add_to_cart",{send_to:wpm.getGoogleAdsConversionIdentifiers(),value:t.quantity*t.price,items:[{id:t.dyn_r_ids[wpmDataLayer.pixels.google.ads.dynamic_remarketing.id_type],quantity:t.quantity,price:t.price,google_business_vertical:wpmDataLayer.pixels.google.ads.google_business_vertical}]})}))}catch(e){console.error(e)}})),jQuery(document).on("wpmViewItem",(function(e,t){try{var o,a,r,n,i,s,d,l,c;if(jQuery.isEmptyObject(null===(o=wpmDataLayer)||void 0===o||null===(a=o.pixels)||void 0===a||null===(r=a.google)||void 0===r||null===(n=r.ads)||void 0===n?void 0:n.conversionIds))return;if(null===(i=wpmDataLayer)||void 0===i||null===(s=i.pixels)||void 0===s||null===(d=s.google)||void 0===d||null===(l=d.ads)||void 0===l||null===(c=l.dynamic_remarketing)||void 0===c||!c.status)return;if(!wpm.googleConfigConditionsMet("ads"))return;wpm.gtagLoaded().then((function(){gtag("event","view_item",{send_to:wpm.getGoogleAdsConversionIdentifiers(),value:(t.quantity?t.quantity:1)*t.price,items:[{id:t.dyn_r_ids[wpmDataLayer.pixels.google.ads.dynamic_remarketing.id_type],quantity:t.quantity?t.quantity:1,price:t.price,google_business_vertical:wpmDataLayer.pixels.google.ads.google_business_vertical}]})}))}catch(e){console.error(e)}})),jQuery(document).on("wpmSearch",(function(){try{var e,t,o,a,r,n,i,s,d;if(jQuery.isEmptyObject(null===(e=wpmDataLayer)||void 0===e||null===(t=e.pixels)||void 0===t||null===(o=t.google)||void 0===o||null===(a=o.ads)||void 0===a?void 0:a.conversionIds))return;if(null===(r=wpmDataLayer)||void 0===r||null===(n=r.pixels)||void 0===n||null===(i=n.google)||void 0===i||null===(s=i.ads)||void 0===s||null===(d=s.dynamic_remarketing)||void 0===d||!d.status)return;if(!wpm.googleConfigConditionsMet("ads"))return;let u=[];for(const[e,t]of Object.entries(wpmDataLayer.products)){var l,c;if(null!==(l=wpmDataLayer)&&void 0!==l&&null!==(c=l.general)&&void 0!==c&&c.variationsOutput&&t.isVariable&&!1===wpmDataLayer.pixels.google.ads.dynamic_remarketing.send_events_with_parent_ids)return;u.push({id:t.dyn_r_ids[wpmDataLayer.pixels.google.ads.dynamic_remarketing.id_type],google_business_vertical:wpmDataLayer.pixels.google.ads.google_business_vertical})}wpm.gtagLoaded().then((function(){gtag("event","view_search_results",{send_to:wpm.getGoogleAdsConversionIdentifiers(),items:u})}))}catch(e){console.error(e)}})),jQuery(document).on("wpmOrderReceivedPage",(function(){try{var e,t,o,a,r,n,i,s,d;if(jQuery.isEmptyObject(null===(e=wpmDataLayer)||void 0===e||null===(t=e.pixels)||void 0===t||null===(o=t.google)||void 0===o||null===(a=o.ads)||void 0===a?void 0:a.conversionIds))return;if(null===(r=wpmDataLayer)||void 0===r||null===(n=r.pixels)||void 0===n||null===(i=n.google)||void 0===i||null===(s=i.ads)||void 0===s||null===(d=s.dynamic_remarketing)||void 0===d||!d.status)return;if(!wpm.googleConfigConditionsMet("ads"))return;wpm.gtagLoaded().then((function(){gtag("event","purchase",{send_to:wpm.getGoogleAdsConversionIdentifiers(),value:wpmDataLayer.order.value_filtered,items:wpm.getGoogleAdsDynamicRemarketingOrderItems()})}))}catch(e){console.error(e)}})),jQuery(document).on("wpmLogin",(function(){try{var e,t,o,a,r,n,i,s,d;if(jQuery.isEmptyObject(null===(e=wpmDataLayer)||void 0===e||null===(t=e.pixels)||void 0===t||null===(o=t.google)||void 0===o||null===(a=o.ads)||void 0===a?void 0:a.conversionIds))return;if(null===(r=wpmDataLayer)||void 0===r||null===(n=r.pixels)||void 0===n||null===(i=n.google)||void 0===i||null===(s=i.ads)||void 0===s||null===(d=s.dynamic_remarketing)||void 0===d||!d.status)return;if(!wpm.googleConfigConditionsMet("ads"))return;wpm.gtagLoaded().then((function(){gtag("event","login",{send_to:wpm.getGoogleAdsConversionIdentifiers()})}))}catch(e){console.error(e)}})),jQuery(document).on("wpmOrderReceivedPage",(function(){try{var e,t,o,a,r,n;if(jQuery.isEmptyObject(null===(e=wpmDataLayer)||void 0===e||null===(t=e.pixels)||void 0===t||null===(o=t.google)||void 0===o||null===(a=o.ads)||void 0===a?void 0:a.conversionIds))return;if(!wpm.googleConfigConditionsMet("ads"))return;let i={},s={};i={send_to:wpm.getGoogleAdsConversionIdentifiersWithLabel(),transaction_id:wpmDataLayer.order.number,value:wpmDataLayer.order.value_filtered,currency:wpmDataLayer.order.currency,new_customer:wpmDataLayer.order.new_customer},null!==(r=wpmDataLayer)&&void 0!==r&&null!==(n=r.order)&&void 0!==n&&n.aw_merchant_id&&(s={discount:wpmDataLayer.order.discount,aw_merchant_id:wpmDataLayer.order.aw_merchant_id,aw_feed_country:wpmDataLayer.order.aw_feed_country,aw_feed_language:wpmDataLayer.order.aw_feed_language,items:wpm.getGoogleAdsRegularOrderItems()}),wpm.gtagLoaded().then((function(){gtag("event","conversion",{...i,...s})}))}catch(e){console.error(e)}}))},42:()=>{!function(e,t,o){let a=[];e.getGoogleAdsConversionIdentifiersWithLabel=function(){for(const[e,t]of Object.entries(wpmDataLayer.pixels.google.ads.conversionIds))a.push(e+"/"+t);return a},e.getGoogleAdsConversionIdentifiers=function(){let e=[];for(const[t,o]of Object.entries(wpmDataLayer.pixels.google.ads.conversionIds))e.push(t);return e},e.getGoogleAdsRegularOrderItems=function(){let e=[];for(const[a,r]of Object.entries(wpmDataLayer.order.items)){var t,o;let a;a={quantity:r.quantity,price:r.price},null!==(t=wpmDataLayer)&&void 0!==t&&null!==(o=t.general)&&void 0!==o&&o.variationsOutput&&0!==r.variation_id?(a.id=String(wpmDataLayer.products[r.variation_id].dyn_r_ids[wpmDataLayer.pixels.google.ads.dynamic_remarketing.id_type]),e.push(a)):(a.id=String(wpmDataLayer.products[r.id].dyn_r_ids[wpmDataLayer.pixels.google.ads.dynamic_remarketing.id_type]),e.push(a))}return e},e.getGoogleAdsDynamicRemarketingOrderItems=function(){let e=[];for(const[a,r]of Object.entries(wpmDataLayer.order.items)){var t,o;let a;a={quantity:r.quantity,price:r.price,google_business_vertical:wpmDataLayer.pixels.google.ads.google_business_vertical},null!==(t=wpmDataLayer)&&void 0!==t&&null!==(o=t.general)&&void 0!==o&&o.variationsOutput&&0!==r.variation_id?(a.id=String(wpmDataLayer.products[r.variation_id].dyn_r_ids[wpmDataLayer.pixels.google.ads.dynamic_remarketing.id_type]),e.push(a)):(a.id=String(wpmDataLayer.products[r.id].dyn_r_ids[wpmDataLayer.pixels.google.ads.dynamic_remarketing.id_type]),e.push(a))}return e}}(window.wpm=window.wpm||{},jQuery)},190:(e,t,o)=>{o(42),o(165)},625:()=>{jQuery(document).on("wpmOrderReceivedPage",(function(){try{var e,t,o,a,r,n,i,s,d,l;if(null===(e=wpmDataLayer)||void 0===e||null===(t=e.pixels)||void 0===t||null===(o=t.google)||void 0===o||null===(a=o.analytics)||void 0===a||null===(r=a.universal)||void 0===r||!r.property_id)return;if(null!==(n=wpmDataLayer)&&void 0!==n&&null!==(i=n.pixels)&&void 0!==i&&null!==(s=i.google)&&void 0!==s&&null!==(d=s.analytics)&&void 0!==d&&null!==(l=d.universal)&&void 0!==l&&l.mp_active)return;if(!wpm.googleConfigConditionsMet("analytics"))return;wpm.gtagLoaded().then((function(){gtag("event","purchase",{send_to:[wpmDataLayer.pixels.google.analytics.universal.property_id],transaction_id:wpmDataLayer.order.number,affiliation:wpmDataLayer.order.affiliation,currency:wpmDataLayer.order.currency,value:wpmDataLayer.order.value_regular,discount:wpmDataLayer.order.discount,tax:wpmDataLayer.order.tax,shipping:wpmDataLayer.order.shipping,coupon:wpmDataLayer.order.coupon,items:wpm.getGAUAOrderItems()})}))}catch(e){console.error(e)}}))},19:()=>{!function(e,t,o){e.getGAUAOrderItems=function(){let e=[],t=1;for(const[r,n]of Object.entries(wpmDataLayer.order.items)){var o,a;let r;r={quantity:n.quantity,price:n.price,name:n.name,currency:wpmDataLayer.order.currency,category:wpmDataLayer.products[n.id].category.join("/"),list_position:t},null!==(o=wpmDataLayer)&&void 0!==o&&null!==(a=o.general)&&void 0!==a&&a.variationsOutput&&0!==n.variation_id?(r.id=String(wpmDataLayer.products[n.variation_id].dyn_r_ids[wpmDataLayer.pixels.google.analytics.id_type]),r.variant=wpmDataLayer.products[n.variation_id].variant_name,r.brand=wpmDataLayer.products[n.variation_id].brand):(r.id=String(wpmDataLayer.products[n.id].dyn_r_ids[wpmDataLayer.pixels.google.analytics.id_type]),r.brand=wpmDataLayer.products[n.id].brand),e.push(r),t++}return e}}(window.wpm=window.wpm||{},jQuery)},562:(e,t,o)=>{o(19),o(625)},572:()=>{jQuery(document).on("wpmOrderReceivedPage",(function(){try{var e,t,o,a,r,n,i,s,d,l;if(null===(e=wpmDataLayer)||void 0===e||null===(t=e.pixels)||void 0===t||null===(o=t.google)||void 0===o||null===(a=o.analytics)||void 0===a||null===(r=a.ga4)||void 0===r||!r.measurement_id)return;if(null!==(n=wpmDataLayer)&&void 0!==n&&null!==(i=n.pixels)&&void 0!==i&&null!==(s=i.google)&&void 0!==s&&null!==(d=s.analytics)&&void 0!==d&&null!==(l=d.ga4)&&void 0!==l&&l.mp_active)return;if(!wpm.googleConfigConditionsMet("analytics"))return;wpm.gtagLoaded().then((function(){gtag("event","purchase",{send_to:[wpmDataLayer.pixels.google.analytics.ga4.measurement_id],transaction_id:wpmDataLayer.order.number,affiliation:wpmDataLayer.order.affiliation,currency:wpmDataLayer.order.currency,value:wpmDataLayer.order.value_regular,discount:wpmDataLayer.order.discount,tax:wpmDataLayer.order.tax,shipping:wpmDataLayer.order.shipping,coupon:wpmDataLayer.order.coupon,items:wpm.getGA4OrderItems()})}))}catch(e){console.error(e)}}))},228:()=>{!function(e,t,o){e.getGA4OrderItems=function(){let e=[];for(const[a,r]of Object.entries(wpmDataLayer.order.items)){var t,o;let a;a={quantity:r.quantity,price:r.price,item_name:r.name,currency:wpmDataLayer.order.currency,item_category:wpmDataLayer.products[r.id].category.join("/")},null!==(t=wpmDataLayer)&&void 0!==t&&null!==(o=t.general)&&void 0!==o&&o.variationsOutput&&0!==r.variation_id?(a.item_id=String(wpmDataLayer.products[r.variation_id].dyn_r_ids[wpmDataLayer.pixels.google.analytics.id_type]),a.item_variant=wpmDataLayer.products[r.variation_id].variant_name,a.item_brand=wpmDataLayer.products[r.variation_id].brand):(a.item_id=String(wpmDataLayer.products[r.id].dyn_r_ids[wpmDataLayer.pixels.google.analytics.id_type]),a.item_brand=wpmDataLayer.products[r.id].brand),e.push(a)}return e}}(window.wpm=window.wpm||{},jQuery)},522:(e,t,o)=>{o(228),o(572)},774:(e,t,o)=>{o(562),o(522)},294:()=>{jQuery(document).on("wpmLoadPixels",(function(){var e,t,o;void 0===(null===(e=wpmDataLayer)||void 0===e||null===(t=e.pixels)||void 0===t||null===(o=t.google)||void 0===o?void 0:o.state)&&(wpm.canGoogleLoad()?wpm.loadGoogle():wpm.logPreventedPixelLoading("google","analytics / ads"))}))},860:()=>{!function(e,t,o){e.googleConfigConditionsMet=function(t){var o,a,r,n;return!(null===(o=wpmDataLayer)||void 0===o||null===(a=o.pixels)||void 0===a||null===(r=a.google)||void 0===r||null===(n=r.consent_mode)||void 0===n||!n.active)||("category"===e.getConsentValues().mode?!0===e.getConsentValues().categories[t]:"pixel"===e.getConsentValues().mode&&e.getConsentValues().pixels.includes("google-"+t))},e.getVisitorConsentStatusAndUpdateGoogleConsentSettings=function(t){return"category"===e.getConsentValues().mode?(e.getConsentValues().categories.analytics&&(t.analytics_storage="granted"),e.getConsentValues().categories.ads&&(t.ad_storage="granted")):"pixel"===e.getConsentValues().mode&&(t.analytics_storage=e.getConsentValues().pixels.includes("google-analytics")?"granted":"denied",t.ad_storage=e.getConsentValues().pixels.includes("google-ads")?"granted":"denied"),t},e.updateGoogleConsentMode=function(){let e=!(arguments.length>0&&arguments[0]!==o)||arguments[0],t=!(arguments.length>1&&arguments[1]!==o)||arguments[1];try{if(!window.gtag||!wpmDataLayer.shop.cookie_consent_mgmt.explicit_consent)return;gtag("consent","update",{analytics_storage:e?"granted":"denied",ad_storage:t?"granted":"denied"})}catch(e){console.error(e)}},e.fireGtagGoogleAds=function(){try{var e,t,o,a,r,n,i,s,d,l,c,u,p,g,m,y,w,v,f,_,h;if(wpmDataLayer.pixels.google.ads.state="loading",null!==(e=wpmDataLayer)&&void 0!==e&&null!==(t=e.pixels)&&void 0!==t&&null!==(o=t.google)&&void 0!==o&&null!==(a=o.ads)&&void 0!==a&&null!==(r=a.enhanced_conversions)&&void 0!==r&&r.active)for(const[e,t]of Object.entries(wpmDataLayer.pixels.google.ads.conversionIds))gtag("config",e,{allow_enhanced_conversions:!0});else for(const[e,t]of Object.entries(wpmDataLayer.pixels.google.ads.conversionIds))gtag("config",e);null!==(n=wpmDataLayer)&&void 0!==n&&null!==(i=n.pixels)&&void 0!==i&&null!==(s=i.google)&&void 0!==s&&null!==(d=s.ads)&&void 0!==d&&d.conversionIds&&null!==(l=wpmDataLayer)&&void 0!==l&&null!==(c=l.pixels)&&void 0!==c&&null!==(u=c.google)&&void 0!==u&&null!==(p=u.ads)&&void 0!==p&&p.phone_conversion_label&&null!==(g=wpmDataLayer)&&void 0!==g&&null!==(m=g.pixels)&&void 0!==m&&null!==(y=m.google)&&void 0!==y&&null!==(w=y.ads)&&void 0!==w&&w.phone_conversion_number&&gtag("config",Object.keys(wpmDataLayer.pixels.google.ads.conversionIds)[0]+"/"+wpmDataLayer.pixels.google.ads.phone_conversion_label,{phone_conversion_number:wpmDataLayer.pixels.google.ads.phone_conversion_number}),"order_received_page"===wpmDataLayer.shop.page_type&&null!==(v=wpmDataLayer)&&void 0!==v&&null!==(f=v.order)&&void 0!==f&&null!==(_=f.google)&&void 0!==_&&null!==(h=_.ads)&&void 0!==h&&h.enhanced_conversion_data&&(window.enhanced_conversion_data=wpmDataLayer.order.google.ads.enhanced_conversion_data),wpmDataLayer.pixels.google.ads.state="ready"}catch(e){console.error(e)}},e.fireGtagGoogleAnalyticsUA=function(){try{wpmDataLayer.pixels.google.analytics.universal.state="loading",gtag("config",wpmDataLayer.pixels.google.analytics.universal.property_id,wpmDataLayer.pixels.google.analytics.universal.parameters),wpmDataLayer.pixels.google.analytics.universal.state="ready"}catch(e){console.error(e)}},e.fireGtagGoogleAnalyticsGA4=function(){try{wpmDataLayer.pixels.google.analytics.ga4.state="loading",gtag("config",wpmDataLayer.pixels.google.analytics.ga4.measurement_id,wpmDataLayer.pixels.google.analytics.ga4.parameters),wpmDataLayer.pixels.google.analytics.ga4.state="ready"}catch(e){console.error(e)}},e.isGoogleActive=function(){var e,t,o,a,r,n,i,s,d,l,c,u,p,g;return!(!(null!==(e=wpmDataLayer)&&void 0!==e&&null!==(t=e.pixels)&&void 0!==t&&null!==(o=t.google)&&void 0!==o&&null!==(a=o.analytics)&&void 0!==a&&null!==(r=a.universal)&&void 0!==r&&r.property_id||null!==(n=wpmDataLayer)&&void 0!==n&&null!==(i=n.pixels)&&void 0!==i&&null!==(s=i.google)&&void 0!==s&&null!==(d=s.analytics)&&void 0!==d&&null!==(l=d.ga4)&&void 0!==l&&l.measurement_id)&&jQuery.isEmptyObject(null===(c=wpmDataLayer)||void 0===c||null===(u=c.pixels)||void 0===u||null===(p=u.google)||void 0===p||null===(g=p.ads)||void 0===g?void 0:g.conversionIds))},e.getGoogleGtagId=function(){var e,t,o,a,r,n,i,s,d,l;return null!==(e=wpmDataLayer)&&void 0!==e&&null!==(t=e.pixels)&&void 0!==t&&null!==(o=t.google)&&void 0!==o&&null!==(a=o.analytics)&&void 0!==a&&null!==(r=a.universal)&&void 0!==r&&r.property_id?wpmDataLayer.pixels.google.analytics.universal.property_id:null!==(n=wpmDataLayer)&&void 0!==n&&null!==(i=n.pixels)&&void 0!==i&&null!==(s=i.google)&&void 0!==s&&null!==(d=s.analytics)&&void 0!==d&&null!==(l=d.ga4)&&void 0!==l&&l.measurement_id?wpmDataLayer.pixels.google.analytics.ga4.measurement_id:Object.keys(wpmDataLayer.pixels.google.ads.conversionIds)[0]},e.loadGoogle=function(){e.isGoogleActive()&&(wpmDataLayer.pixels.google.state="loading",e.loadScriptAndCacheIt("https://www.googletagmanager.com/gtag/js?id="+e.getGoogleGtagId()).done((function(t,o){try{var a,r,n,i,s,d,l,c,u,p,g,m,y,w,v,f,_,h,L,D,C,b;if(window.dataLayer=window.dataLayer||[],window.gtag=function(){dataLayer.push(arguments)},null!==(a=wpmDataLayer)&&void 0!==a&&null!==(r=a.pixels)&&void 0!==r&&null!==(n=r.google)&&void 0!==n&&null!==(i=n.consent_mode)&&void 0!==i&&i.active){var x,j,k,I;let t={ad_storage:wpmDataLayer.pixels.google.consent_mode.ad_storage,analytics_storage:wpmDataLayer.pixels.google.consent_mode.analytics_storage,wait_for_update:wpmDataLayer.pixels.google.consent_mode.wait_for_update};null!==(x=wpmDataLayer)&&void 0!==x&&null!==(j=x.pixels)&&void 0!==j&&null!==(k=j.google)&&void 0!==k&&null!==(I=k.consent_mode)&&void 0!==I&&I.region&&(t.region=wpmDataLayer.pixels.google.consent_mode.region),t=e.getVisitorConsentStatusAndUpdateGoogleConsentSettings(t),gtag("consent","default",t),gtag("set","ads_data_redaction",wpmDataLayer.pixels.google.consent_mode.ads_data_redaction),gtag("set","url_passthrough",wpmDataLayer.pixels.google.consent_mode.url_passthrough)}null!==(s=wpmDataLayer)&&void 0!==s&&null!==(d=s.pixels)&&void 0!==d&&null!==(l=d.google)&&void 0!==l&&null!==(c=l.linker)&&void 0!==c&&c.settings&&gtag("set","linker",wpmDataLayer.pixels.google.linker.settings),gtag("js",new Date),jQuery.isEmptyObject(null===(u=wpmDataLayer)||void 0===u||null===(p=u.pixels)||void 0===p||null===(g=p.google)||void 0===g||null===(m=g.ads)||void 0===m?void 0:m.conversionIds)||(e.googleConfigConditionsMet("ads")?e.fireGtagGoogleAds():e.logPreventedPixelLoading("google-ads","ads")),null!==(y=wpmDataLayer)&&void 0!==y&&null!==(w=y.pixels)&&void 0!==w&&null!==(v=w.google)&&void 0!==v&&null!==(f=v.analytics)&&void 0!==f&&null!==(_=f.universal)&&void 0!==_&&_.property_id&&(e.googleConfigConditionsMet("analytics")?e.fireGtagGoogleAnalyticsUA():e.logPreventedPixelLoading("google-universal-analytics","analytics")),null!==(h=wpmDataLayer)&&void 0!==h&&null!==(L=h.pixels)&&void 0!==L&&null!==(D=L.google)&&void 0!==D&&null!==(C=D.analytics)&&void 0!==C&&null!==(b=C.ga4)&&void 0!==b&&b.measurement_id&&(e.googleConfigConditionsMet("analytics")?e.fireGtagGoogleAnalyticsGA4():e.logPreventedPixelLoading("ga4","analytics")),wpmDataLayer.pixels.google.state="ready"}catch(e){console.error(e)}})))},e.canGoogleLoad=function(){var t,o,a,r;return!(null===(t=wpmDataLayer)||void 0===t||null===(o=t.pixels)||void 0===o||null===(a=o.google)||void 0===a||null===(r=a.consent_mode)||void 0===r||!r.active)||("category"===e.getConsentValues().mode?!(!e.getConsentValues().categories.ads&&!e.getConsentValues().categories.analytics):"pixel"===e.getConsentValues().mode?e.getConsentValues().pixels.includes("google-ads")||e.getConsentValues().pixels.includes("google-analytics"):(console.error("Couldn't find a valid load condition for Google mode in wpmConsentValues"),!1))},e.gtagLoaded=function(){return new Promise((function(e,t){var o,a,r;void 0===(null===(o=wpmDataLayer)||void 0===o||null===(a=o.pixels)||void 0===a||null===(r=a.google)||void 0===r?void 0:r.state)&&t();let n=0;!function o(){var a,r,i;return"ready"===(null===(a=wpmDataLayer)||void 0===a||null===(r=a.pixels)||void 0===r||null===(i=r.google)||void 0===i?void 0:i.state)?e():n>=5e3?t():(n+=200,void setTimeout(o,200))}()}))}}(window.wpm=window.wpm||{},jQuery)},580:(e,t,o)=>{o(860),o(294)},69:(e,t,o)=>{o(580),o(190),o(774),o(463)},945:()=>{jQuery(document).on("wpmLoadPixels",(function(){var e,t,o,a,r,n,i,s;null===(e=wpmDataLayer)||void 0===e||null===(t=e.pixels)||void 0===t||null===(o=t.google)||void 0===o||null===(a=o.optimize)||void 0===a||!a.container_id||null!==(r=wpmDataLayer)&&void 0!==r&&null!==(n=r.pixels)&&void 0!==n&&null!==(i=n.google)&&void 0!==i&&null!==(s=i.optimize)&&void 0!==s&&s.loaded||wpm.canIFire("analytics","google-optimize")&&wpm.load_google_optimize_pixel()}))},962:()=>{!function(e,t,o){e.load_google_optimize_pixel=function(){try{wpmDataLayer.pixels.google.optimize.loaded=!0,e.loadScriptAndCacheIt("https://www.googleoptimize.com/optimize.js?id="+wpmDataLayer.pixels.google.optimize.container_id)}catch(e){console.error(e)}}}(window.wpm=window.wpm||{},jQuery)},463:(e,t,o)=>{o(962),o(945)},300:()=>{jQuery(document).on("wpmLoadPixels",(function(){var e,t,o,a,r,n,i,s,d;null===(e=wpmDataLayer)||void 0===e||null===(t=e.pixels)||void 0===t||null===(o=t.hotjar)||void 0===o||!o.site_id||null!==(a=wpmDataLayer)&&void 0!==a&&null!==(r=a.pixels)&&void 0!==r&&null!==(n=r.hotjar)&&void 0!==n&&n.loaded||!wpm.canIFire("analytics","hotjar")||null!==(i=wpmDataLayer)&&void 0!==i&&null!==(s=i.pixels)&&void 0!==s&&null!==(d=s.hotjar)&&void 0!==d&&d.loaded||wpm.load_hotjar_pixel()}))},376:()=>{!function(e,t,o){e.load_hotjar_pixel=function(){try{wpmDataLayer.pixels.hotjar.loaded=!0,e=window,t=document,e.hj=e.hj||function(){(e.hj.q=e.hj.q||[]).push(arguments)},e._hjSettings={hjid:wpmDataLayer.pixels.hotjar.site_id,hjsv:6},o=t.getElementsByTagName("head")[0],(a=t.createElement("script")).async=1,a.src="https://static.hotjar.com/c/hotjar-"+e._hjSettings.hjid+".js?sv="+e._hjSettings.hjsv,o.appendChild(a)}catch(e){console.error(e)}var e,t,o,a}}(window.wpm=window.wpm||{},jQuery)},787:(e,t,o)=>{o(376),o(300)},299:()=>{jQuery(document).on("click",".remove_from_cart_button, .remove",(function(){try{let e=new URL(jQuery(this).attr("href")),t=wpm.getProductIdByCartItemKeyUrl(e);wpm.removeProductFromCart(t)}catch(e){console.error(e)}})),jQuery(document).on("click",".add_to_cart_button:not(.product_type_variable), .ajax_add_to_cart, .single_add_to_cart_button",(function(){try{if("product"===wpmDataLayer.shop.page_type){if(void 0!==jQuery(this).attr("href")&&jQuery(this).attr("href").includes("add-to-cart")){let e=1,t=jQuery(this).data("product_id");wpm.addProductToCart(t,e)}else if("simple"===wpmDataLayer.shop.product_type){let e=Number(jQuery(".input-text.qty").val());e||0===e||(e=1);let t=jQuery(this).val();wpm.addProductToCart(t,e)}else if("variable"===wpmDataLayer.shop.product_type){let e=Number(jQuery(".input-text.qty").val());e||0===e||(e=1);let t=jQuery("[name='variation_id']").val();wpm.addProductToCart(t,e)}else if("grouped"===wpmDataLayer.shop.product_type)jQuery(".woocommerce-grouped-product-list-item").each((function(){let e=Number(jQuery(this).find(".input-text.qty").val());e||0===e||(e=1);let t=jQuery(this).attr("class"),o=wpm.getPostIdFromString(t);wpm.addProductToCart(o,e)}));else if("bundle"===wpmDataLayer.shop.product_type){let e=Number(jQuery(".input-text.qty").val());e||0===e||(e=1);let t=jQuery("input[name=add-to-cart]").val();wpm.addProductToCart(t,e)}}else{let e=1,t=jQuery(this).data("product_id");wpm.addProductToCart(t,e)}}catch(e){console.error(e)}})),jQuery(document).one("click","a:not(.add_to_cart_button, .ajax_add_to_cart, .single_add_to_cart_button)",(function(e){try{if(jQuery(e.target).closest("a").attr("href")){let t=jQuery(e.target).closest("a").attr("href");if(t.includes("add-to-cart=")){let e=t.match(/(add-to-cart=)(\d+)/);e&&wpm.addProductToCart(e[2],1)}}}catch(e){console.error(e)}})),jQuery(document).on("click",".woocommerce-LoopProduct-link, .wc-block-grid__product, .product, .product-small, .type-product",(function(){try{let e=jQuery(this).nextAll(".wpmProductId:first").data("id");if(e){if(e=getIdBasedOndVariationsOutputSetting(e),!e)throw Error("Wasn't able to retrieve a productId");if(wpmDataLayer.products&&wpmDataLayer.products[e]){let t=wpm.getProductDetailsFormattedForEvent(e);jQuery(document).trigger("wpmSelectContentGaUa",t),jQuery(document).trigger("wpmSelectItem",t)}}}catch(e){console.error(e)}})),jQuery(document).one("click",".checkout-button, .cart-checkout-button, .button.checkout",(function(){jQuery(document).trigger("wpmBeginCheckout")})),jQuery(document).on("input","#billing_email",(function(){wpm.isEmail(jQuery(this).val())&&(wpm.fireCheckoutProgress(2),wpm.emailSelected=!0)})),jQuery(document).on("click",".wc_payment_methods",(function(){!1===wpm.paymentMethodSelected&&wpm.fireCheckoutProgress(3),wpm.fireCheckoutOption(3,jQuery("input[name='payment_method']:checked").val()),wpm.paymentMethodSelected=!0})),jQuery(document).one("click","#place_order",(function(){!1===wpm.emailSelected&&wpm.fireCheckoutProgress(2),!1===wpm.paymentMethodSelected&&(wpm.fireCheckoutProgress(3),wpm.fireCheckoutOption(3,jQuery("input[name='payment_method']:checked").val())),wpm.fireCheckoutProgress(4)})),jQuery(document).on("click","[name='update_cart']",(function(){try{jQuery(".cart_item").each((function(){let e=new URL(jQuery(this).find(".product-remove").find("a").attr("href")),t=wpm.getProductIdByCartItemKeyUrl(e),o=jQuery(this).find(".qty").val();0===o?wpm.removeProductFromCart(t):o<wpmDataLayer.cart[t].quantity?wpm.removeProductFromCart(t,wpmDataLayer.cart[t].quantity-o):o>wpmDataLayer.cart[t].quantity&&wpm.addProductToCart(t,o-wpmDataLayer.cart[t].quantity)}))}catch(e){console.error(e),wpm.getCartItemsFromBackend()}})),jQuery(document).on("click",".add_to_wishlist, .wl-add-to",(function(){try{let e;if(jQuery(this).data("productid")?e=jQuery(this).data("productid"):jQuery(this).data("product-id")&&(e=jQuery(this).data("product-id")),!e)throw Error("Wasn't able to retrieve a productId");let t=wpm.getProductDetailsFormattedForEvent(e);jQuery(document).trigger("wpmAddToWishlist",t)}catch(e){console.error(e)}})),jQuery(document).on("updated_cart_totals",(function(){jQuery(document).trigger("wpmViewCart")})),jQuery(".single_variation_wrap").on("show_variation",(function(e,t){try{let e=getIdBasedOndVariationsOutputSetting(t.variation_id);if(!e)throw Error("Wasn't able to retrieve a productId");if(wpmDataLayer.products&&wpmDataLayer.products[e]){let t=wpm.getProductDetailsFormattedForEvent(e);jQuery(document).trigger("wpmViewItem",t)}}catch(e){console.error(e)}})),jQuery(".single_variation_wrap").on("hide_variation",(function(){try{var e,t;let o=jQuery("body").attr("class").match(/(postid-)(\d+)/)[2];if(!o)throw Error("Wasn't able to retrieve a productId");if("variable"===wpmDataLayer.shop.product_type&&null!==(e=wpmDataLayer)&&void 0!==e&&null!==(t=e.general)&&void 0!==t&&t.variationsOutput)for(const[e,t]of Object.entries(wpmDataLayer.products))if("parentId"in t){o=t.id;break}if(wpmDataLayer.products&&wpmDataLayer.products[o]){let e=wpm.getProductDetailsFormattedForEvent(o);jQuery(document).trigger("wpmViewItem",e)}}catch(e){console.error(e)}})),jQuery(window).on("wpmLoad",(function(){try{wpm.doesWooCommerceCartExist()&&wpm.getCartItems()}catch(e){console.error(e)}})),jQuery(window).on("wpmLoad",(function(){wpmDataLayer.products=wpmDataLayer.products||{};let e=wpm.getAddToCartLinkProductIds();wpm.getProductsFromBackend(e)})),jQuery(window).on("wpmLoad",(function(){if(!wpm.getCookie("wpmReferrer"))if(document.referrer){let e=new URL(document.referrer).hostname;e!==window.location.host?wpm.setCookie("wpmReferrer",e):wpm.setCookie("wpmReferrer","")}else wpm.setCookie("wpmReferrer","")})),jQuery(window).on("wpmLoad",(function(){try{var e;if("undefined"!=typeof wpmDataLayer&&(null===(e=wpmDataLayer)||void 0===e||!e.wpmLoadFired)){var t,o;if(jQuery(document).trigger("wpmLoadAlways"),"product"===wpmDataLayer.shop.page_type&&"variable"!==wpmDataLayer.shop.product_type&&wpm.getMainProductIdFromProductPage()){let e=wpm.getProductDataForViewItemEvent(wpm.getMainProductIdFromProductPage());jQuery(document).trigger("wpmViewItem",e)}else"product_category"===wpmDataLayer.shop.page_type?jQuery(document).trigger("wpmCategory"):"search"===wpmDataLayer.shop.page_type?jQuery(document).trigger("wpmSearch"):"cart"===wpmDataLayer.shop.page_type?jQuery(document).trigger("wpmViewCart"):"order_received_page"===wpmDataLayer.shop.page_type&&wpmDataLayer.order?wpm.isOrderIdStored(wpmDataLayer.order.id)||(jQuery(document).trigger("wpmOrderReceivedPage"),wpm.writeOrderIdToStorage(wpmDataLayer.order.id)):jQuery(document).trigger("wpmEverywhereElse");null!==(t=wpmDataLayer)&&void 0!==t&&null!==(o=t.user)&&void 0!==o&&o.id&&!wpm.hasLoginEventFired()&&(jQuery(document).trigger("wpmLogin"),wpm.setLoginEventFired()),wpmDataLayer.wpmLoadFired=!0}}catch(e){console.error(e)}})),jQuery(window).on("wpmPreLoadPixels",(function(){var e,t,o;null!==(e=wpmDataLayer)&&void 0!==e&&null!==(t=e.shop)&&void 0!==t&&null!==(o=t.cookie_consent_mgmt)&&void 0!==o&&o.explicit_consent&&wpm.updateConsentCookieValues(!0),jQuery(document).trigger("wpmLoadPixels",{})}))},584:()=>{!function(e,t,o){const a="_wpm_order_ids",r="_wpm_endpoint_available",n="/wp-json/";function i(){return""!==e.getCookie(a)}e.emailSelected=!1,e.paymentMethodSelected=!1,e.useRestEndpoint=function(){return e.isSessionStorageAvailable()&&e.isRestEndpointAvailable()&&e.isBelowRestErrorThreshold()},e.isBelowRestErrorThreshold=function(){return window.sessionStorage.getItem(0)<=10},e.isRestEndpointAvailable=function(){if(window.sessionStorage.getItem(r))return JSON.parse(window.sessionStorage.getItem(r));e.testEndpoint()},e.isSessionStorageAvailable=function(){return!!window.sessionStorage},e.testEndpoint=function(){let e=arguments.length>0&&arguments[0]!==o?arguments[0]:location.protocol+"//"+location.host+n,t=arguments.length>1&&arguments[1]!==o?arguments[1]:r;jQuery.ajax(e,{type:"HEAD",timeout:1e3,statusCode:{200:function(e){window.sessionStorage.setItem(t,JSON.stringify(!0))},404:function(e){window.sessionStorage.setItem(t,JSON.stringify(!1))},0:function(e){window.sessionStorage.setItem(t,JSON.stringify(!1))}}}).then((e=>{}))},e.isWpmRestEndpointAvailable=function(){let t=arguments.length>0&&arguments[0]!==o?arguments[0]:r;return!!e.getCookie(t)},e.writeOrderIdToStorage=function(t){if(window.Storage)if(null===localStorage.getItem(a)){let e=[];e.push(t),window.localStorage.setItem(a,JSON.stringify(e))}else{let e=JSON.parse(localStorage.getItem(a));e.includes(t)||(e.push(t),window.localStorage.setItem(a,JSON.stringify(e)))}else{let o=new Date;o.setDate(o.getDate()+365);let r=[];i()&&(r=JSON.parse(e.getCookie(a))),r.includes(t)||(r.push(t),document.cookie="_wpm_order_ids="+JSON.stringify(r)+";expires="+o.toUTCString())}"function"==typeof e.storeOrderIdOnServer&&wpmDataLayer.orderDeduplication&&e.storeOrderIdOnServer(t)},e.isOrderIdStored=function(t){return wpmDataLayer.orderDeduplication?window.Storage?null!==localStorage.getItem(a)&&JSON.parse(localStorage.getItem(a)).includes(t):!!i()&&JSON.parse(e.getCookie(a)).includes(t):(console.log("order duplication prevention: off"),!1)},e.isEmail=function(e){return/^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/.test(e)},e.removeProductFromCart=function(t){let a=arguments.length>1&&arguments[1]!==o?arguments[1]:null;try{if(!t)throw Error("Wasn't able to retrieve a productId");if(!(t=getIdBasedOndVariationsOutputSetting(t)))throw Error("Wasn't able to retrieve a productId");let o;if(o=null==a?wpmDataLayer.cart[t].quantity:a,wpmDataLayer.cart[t]){let r=e.getProductDetailsFormattedForEvent(t,o);jQuery(document).trigger("wpmRemoveFromCart",r),null==a||wpmDataLayer.cart[t].quantity===a?(delete wpmDataLayer.cart[t],sessionStorage&&sessionStorage.setItem("wpmDataLayerCart",JSON.stringify(wpmDataLayer.cart))):(wpmDataLayer.cart[t].quantity=wpmDataLayer.cart[t].quantity-o,sessionStorage&&sessionStorage.setItem("wpmDataLayerCart",JSON.stringify(wpmDataLayer.cart)))}}catch(e){console.error(e)}},getIdBasedOndVariationsOutputSetting=function(e){try{var t,o;return null!==(t=wpmDataLayer)&&void 0!==t&&null!==(o=t.general)&&void 0!==o&&o.variationsOutput?e:wpmDataLayer.products[e].isVariation?wpmDataLayer.products[e].parentId:e}catch(e){console.error(e)}},e.addProductToCart=function(t,o){try{var a;if(!t)throw Error("Wasn't able to retrieve a productId");if(!(t=getIdBasedOndVariationsOutputSetting(t)))throw Error("Wasn't able to retrieve a productId");if(null!==(a=wpmDataLayer)&&void 0!==a&&a.products[t]){var r;let a=e.getProductDetailsFormattedForEvent(t,o);jQuery(document).trigger("wpmAddToCart",a),null!==(r=wpmDataLayer)&&void 0!==r&&r.cart[t]?wpmDataLayer.cart[t].quantity=wpmDataLayer.cart[t].quantity+o:("cart"in wpmDataLayer||(wpmDataLayer.cart={}),wpmDataLayer.cart[t]=e.getProductDetailsFormattedForEvent(t,o)),sessionStorage&&sessionStorage.setItem("wpmDataLayerCart",JSON.stringify(wpmDataLayer.cart))}}catch(t){console.error(t),e.getCartItemsFromBackend()}},e.getCartItems=function(){sessionStorage?sessionStorage.getItem("wpmDataLayerCart")&&"order_received_page"!==wpmDataLayer.shop.page_type?e.saveCartObjectToDataLayer(JSON.parse(sessionStorage.getItem("wpmDataLayerCart"))):sessionStorage.setItem("wpmDataLayerCart",JSON.stringify({})):e.getCartItemsFromBackend()},e.getCartItemsFromBackend=function(){try{let t={action:"wpm_get_cart_items"};jQuery.ajax({type:"get",dataType:"json",url:e.ajax_url,data:t,success:function(t){t.cart||(t.cart={}),e.saveCartObjectToDataLayer(t.cart),sessionStorage&&sessionStorage.setItem("wpmDataLayerCart",JSON.stringify(t.cart))}})}catch(e){console.error(e)}},e.getProductsFromBackend=function(t){if((t=t.filter((e=>!wpmDataLayer.products.hasOwnProperty(e))))&&0!==t.length)try{let o={action:"wpm_get_product_ids",productIds:t};jQuery.ajax({type:"get",dataType:"json",url:e.ajax_url,data:o,success:function(e){wpmDataLayer.products=Object.assign({},wpmDataLayer.products,e)},error:function(e){console.log(e)}})}catch(e){console.error(e)}},e.saveCartObjectToDataLayer=function(e){wpmDataLayer.cart=e,wpmDataLayer.products=Object.assign({},wpmDataLayer.products,e)},e.fireCheckoutOption=function(e){let t=arguments.length>1&&arguments[1]!==o?arguments[1]:null,a=arguments.length>2&&arguments[2]!==o?arguments[2]:null,r={step:e,checkout_option:t,value:a};jQuery(document).trigger("wpmFireCheckoutOption",r)},e.fireCheckoutProgress=function(e){let t={step:e};jQuery(document).trigger("wpmFireCheckoutProgress",t)},e.getPostIdFromString=function(e){try{return e.match(/(post-)(\d+)/)[2]}catch(e){console.error(e)}},e.triggerViewItemList=function(t){if(!t)throw Error("Wasn't able to retrieve a productId");if(!(t=getIdBasedOndVariationsOutputSetting(t)))throw Error("Wasn't able to retrieve a productId");jQuery(document).trigger("wpmViewItemList",e.getProductDataForViewItemEvent(t))},e.getProductDataForViewItemEvent=function(t){if(!t)throw Error("Wasn't able to retrieve a productId");try{if(wpmDataLayer.products[t])return e.getProductDetailsFormattedForEvent(t)}catch(e){console.error(e)}},e.getMainProductIdFromProductPage=function(){try{return["simple","variable","grouped","composite","bundle"].indexOf(wpmDataLayer.shop.product_type)>=0&&jQuery(".wpmProductId:first").data("id")}catch(e){console.error(e)}},e.viewItemListTriggerTestMode=function(e){jQuery(e).css({position:"relative"}),jQuery(e).append('<div id="viewItemListTriggerOverlay"></div>'),jQuery(e).find("#viewItemListTriggerOverlay").css({"z-index":"10",display:"block",position:"absolute",height:"100%",top:"0",left:"0",right:"0",opacity:wpmDataLayer.viewItemListTrigger.opacity,"background-color":wpmDataLayer.viewItemListTrigger.backgroundColor})},e.getSearchTermFromUrl=function(){try{return new URLSearchParams(window.location.search).get("s")}catch(e){console.error(e)}};let s,d={};e.observerCallback=function(t,o){t.forEach((t=>{try{let a,r=jQuery(t.target).data("ioid");if(a=jQuery(t.target).next(".wpmProductId").length?jQuery(t.target).next(".wpmProductId").data("id"):jQuery(t.target).find(".wpmProductId").data("id"),!a)throw Error("wpmProductId element not found");t.isIntersecting?d[r]=setTimeout((()=>{e.triggerViewItemList(a),wpmDataLayer.viewItemListTrigger.testMode&&e.viewItemListTriggerTestMode(t.target),!1===wpmDataLayer.viewItemListTrigger.repeat&&o.unobserve(t.target)}),wpmDataLayer.viewItemListTrigger.timeout):(clearTimeout(d[r]),wpmDataLayer.viewItemListTrigger.testMode&&jQuery(t.target).find("#viewItemListTriggerOverlay").remove())}catch(e){console.error(e)}}))};let l,c=0;e.startIntersectionObserverToWatch=function(){try{e.urlHasParameter("vildemomode")&&(wpmDataLayer.viewItemListTrigger.testMode=!0),s=new IntersectionObserver(e.observerCallback,{threshold:wpmDataLayer.viewItemListTrigger.threshold}),l=jQuery(".wpmProductId").map((function(e,t){return jQuery(t).parent().hasClass("type-product")||jQuery(t).parent().hasClass("product")||jQuery(t).parent().hasClass("product-item-inner")?jQuery(t).parent():jQuery(t).prev().hasClass("wc-block-grid__product")||jQuery(t).prev().hasClass("product")||jQuery(t).prev().hasClass("product-small")||jQuery(t).prev().hasClass("woocommerce-LoopProduct-link")?jQuery(this).prev():jQuery(t).closest(".product").length?jQuery(t).closest(".product"):void 0})),l.each((function(e,t){jQuery(t[0]).data("ioid",c++),s.observe(t[0])}))}catch(e){console.error(e)}},e.startProductsMutationObserverToWatch=function(){try{let e=jQuery(".wpmProductId:eq(0)").parents().has(jQuery(".wpmProductId:eq(1)").parents()).first();e.length&&u.observe(e[0],{attributes:!0,childList:!0,characterData:!0})}catch(e){console.error(e)}};let u=new MutationObserver((function(e){e.forEach((function(e){let t=e.addedNodes;null!==t&&jQuery(t).each((function(){(jQuery(this).hasClass("type-product")||jQuery(this).hasClass("product-small")||jQuery(this).hasClass("wc-block-grid__product"))&&p(this)&&(jQuery(this).data("ioid",c++),s.observe(this))}))}))})),p=function(e){return!(!jQuery(e).find(".wpmProductId").length&&!jQuery(e).siblings(".wpmProductId").length)};e.setCookie=function(e){let t=arguments.length>1&&arguments[1]!==o?arguments[1]:"",a=arguments.length>2&&arguments[2]!==o?arguments[2]:null;if(a){let o=new Date;o.setTime(o.getTime()+24*a*60*60*1e3);let r="expires="+o.toUTCString();document.cookie=e+"="+t+";"+r+";path=/"}else document.cookie=e+"="+t+";path=/"},e.getCookie=function(e){let t=e+"=",o=decodeURIComponent(document.cookie).split(";");for(let e=0;e<o.length;e++){let a=o[e];for(;" "==a.charAt(0);)a=a.substring(1);if(0==a.indexOf(t))return a.substring(t.length,a.length)}return""},e.getWpmSessionData=function(){if(window.sessionStorage){let e=window.sessionStorage.getItem("_wpm");return null!==e?JSON.parse(e):{}}return{}},e.setWpmSessionData=function(e){window.sessionStorage&&window.sessionStorage.setItem("_wpm",JSON.stringify(e))},e.storeOrderIdOnServer=function(t){try{let o={action:"wpm_purchase_pixels_fired",order_id:t,nonce:e.nonce};jQuery.ajax({type:"post",dataType:"json",url:e.ajax_url,data:o,success:function(e){!1===e.success&&console.log(e)},error:function(e){console.log(e)}})}catch(e){console.error(e)}},e.getProductIdByCartItemKeyUrl=function(e){let t,o=new URLSearchParams(e.search).get("remove_item");return t=0===wpmDataLayer.cartItemKeys[o].variation_id?wpmDataLayer.cartItemKeys[o].product_id:wpmDataLayer.cartItemKeys[o].variation_id,t},e.getAddToCartLinkProductIds=function(){return jQuery("a").map((function(){let e=jQuery(this).attr("href");if(e&&e.includes("?add-to-cart=")){let t=e.match(/(add-to-cart=)(\d+)/);if(t)return t[2]}})).get()},e.getProductDetailsFormattedForEvent=function(e){let t=arguments.length>1&&arguments[1]!==o?arguments[1]:1,a={id:e.toString(),dyn_r_ids:wpmDataLayer.products[e].dyn_r_ids,name:wpmDataLayer.products[e].name,list_name:wpmDataLayer.shop.list_name,brand:wpmDataLayer.products[e].brand,category:wpmDataLayer.products[e].category,variant:wpmDataLayer.products[e].variant,list_position:wpmDataLayer.products[e].position,quantity:t,price:wpmDataLayer.products[e].price,currency:wpmDataLayer.shop.currency,isVariable:wpmDataLayer.products[e].isVariable,isVariation:wpmDataLayer.products[e].isVariation,parentId:wpmDataLayer.products[e].parentId};return a.isVariation&&(a.parentId_dyn_r_ids=wpmDataLayer.products[e].parentId_dyn_r_ids),a},e.setReferrerToCookie=function(){e.getCookie("wpmReferrer")||e.setCookie("wpmReferrer",document.referrer)},e.getReferrerFromCookie=function(){return e.getCookie("wpmReferrer")?e.getCookie("wpmReferrer"):null},e.getClidFromBrowser=function(){let t,a=arguments.length>0&&arguments[0]!==o?arguments[0]:"gclid";return t={gclid:"_gcl_aw",dclid:"_gcl_dc"},e.getCookie(t[a])?e.getCookie(t[a]).match(/(GCL.[\d]*.)(.*)/)[2]:""},e.getUserAgent=function(){return navigator.userAgent},e.getViewPort=function(){return{width:Math.max(document.documentElement.clientWidth||0,window.innerWidth||0),height:Math.max(document.documentElement.clientHeight||0,window.innerHeight||0)}};let g=function(){let t=e.getCookie("cmplz_statistics"),o=e.getCookie("cmplz_marketing");return!(!e.getCookie("cmplz_consent_status")&&!e.getCookie("cmplz_banner-status"))&&{analytics:"allow"===t,ads:"allow"===o,visitorHasChosen:!0}},m=function(){let t=e.getCookie("cookielawinfo-checkbox-analytics")||e.getCookie("cookielawinfo-checkbox-analytiques"),o=e.getCookie("cookielawinfo-checkbox-advertisement")||e.getCookie("cookielawinfo-checkbox-publicite"),a=e.getCookie("CookieLawInfoConsent");return!(!t&&!o)&&{analytics:"yes"===t,ads:"yes"===o,visitorHasChosen:!!a}},y={categories:{},pixels:[],mode:"category",visitorHasChosen:!1};e.getConsentValues=function(){return y},e.setConsentValueCategories=function(){let e=arguments.length>0&&arguments[0]!==o&&arguments[0],t=arguments.length>1&&arguments[1]!==o&&arguments[1];y.categories.analytics=e,y.categories.ads=t},e.updateConsentCookieValues=function(){let t,a=arguments.length>0&&arguments[0]!==o&&arguments[0];if(t=e.getCookie("CookieConsent"))t=decodeURI(t),y.categories.analytics=t.indexOf("statistics:true")>=0,y.categories.ads=t.indexOf("marketing:true")>=0,y.visitorHasChosen=!0;else if(t=e.getCookie("CookieScriptConsent"))t=JSON.parse(t),"reject"===t.action?(y.categories.analytics=!1,y.categories.ads=!1):2===t.categories.length?(y.categories.analytics=!0,y.categories.ads=!0):(y.categories.analytics=t.categories.indexOf("performance")>=0,y.categories.ads=t.categories.indexOf("targeting")>=0),y.visitorHasChosen=!0;else if(t=e.getCookie("borlabs-cookie")){var r,n,i,s,d,l,c,u;t=decodeURI(t),t=JSON.parse(t),y.categories.analytics=!(null===(r=t)||void 0===r||null===(n=r.consents)||void 0===n||!n.statistics),y.categories.ads=!(null===(i=t)||void 0===i||null===(s=i.consents)||void 0===s||!s.marketing),y.visitorHasChosen=!0,y.pixels=[...(null===(d=t)||void 0===d||null===(l=d.consents)||void 0===l?void 0:l.statistics)||[],...(null===(c=t)||void 0===c||null===(u=c.consents)||void 0===u?void 0:u.marketing)||[]],y.mode="pixel"}else(t=g())?(y.categories.analytics=!0===t.analytics,y.categories.ads=!0===t.ads,y.visitorHasChosen=t.visitorHasChosen):(t=e.getCookie("cookie_notice_accepted"))?(y.categories.analytics=!0,y.categories.ads=!0,y.visitorHasChosen=!0):(t=e.getCookie("hu-consent"))?(t=JSON.parse(t),y.categories.analytics=!!t.categories[3],y.categories.ads=!!t.categories[4],y.visitorHasChosen=!0):(t=m())?(y.categories.analytics=!0===t.analytics,y.categories.ads=!0===t.ads,y.visitorHasChosen=!0===t.visitorHasChosen):(t=e.getCookie("moove_gdpr_popup"))?(t=JSON.parse(t),y.categories.analytics="1"===t.thirdparty,y.categories.ads="1"===t.advanced,y.visitorHasChosen=!0):(y.categories.analytics=!a,y.categories.ads=!a)},e.updateConsentCookieValues(),e.setConsentDefaultValuesToExplicit=function(){y.categories={analytics:!1,ads:!1}},e.canIFire=function(t,o){let a;return"category"===y.mode?a=!!y.categories[t]:"pixel"===y.mode?a=y.pixels.includes(o):(console.error("Couldn't find a valid consent mode in wpmConsentValues"),a=!1),!!a||(e.logPreventedPixelLoading(o,t),!1)},e.logPreventedPixelLoading=function(e,t){var o,a,r;null!==(o=wpmDataLayer)&&void 0!==o&&null!==(a=o.shop)&&void 0!==a&&null!==(r=a.cookie_consent_mgmt)&&void 0!==r&&r.explicit_consent?console.log('WooCommerce Pixel Manager: The "'+e+" (category: "+t+')" pixel has not fired because you have not given consent for it yet. (WPM is in explicit consent mode.)'):console.log('WooCommerce Pixel Manager: The "'+e+" (category: "+t+')" pixel has not fired because you have removed consent for this pixel. (WPM is in implicit consent mode.)')},e.scriptTagObserver=new MutationObserver((o=>{o.forEach((o=>{let{addedNodes:a}=o;[...a].forEach((o=>{t(o).data("wpm-cookie-category")&&(e.shouldScriptBeActive(o)?e.unblockScript(o):e.blockScript(o))}))}))})),e.scriptTagObserver.observe(document.head,{childList:!0,subtree:!0}),window.addEventListener("DOMContentLoaded",(()=>e.scriptTagObserver.disconnect())),e.shouldScriptBeActive=function(e){var o,a,r,n;return!((wpmDataLayer.shop.cookie_consent_mgmt.explicit_consent||y.visitorHasChosen)&&("category"!==y.mode||!t(e).data("wpm-cookie-category").split(",").some((e=>y.categories[e])))&&("pixel"!==y.mode||!y.pixels.includes(t(e).data("wpm-pixel-name")))&&("pixel"!==y.mode||"google"!==t(e).data("wpm-pixel-name")||!["google-analytics","google-ads"].some((e=>y.pixels.includes(e))))&&(null===(o=wpmDataLayer)||void 0===o||null===(a=o.pixels)||void 0===a||null===(r=a.google)||void 0===r||null===(n=r.consent_mode)||void 0===n||!n.active||"google"!==t(e).data("wpm-pixel-name")))},e.unblockScript=function(e){let a=arguments.length>1&&arguments[1]!==o&&arguments[1];a&&t(e).remove();let r=t(e).data("wpm-src");r&&t(e).attr("src",r),e.type="text/javascript",a&&t(e).appendTo("head"),jQuery(document).trigger("wpmPreLoadPixels",{})},e.blockScript=function(e){let a=arguments.length>1&&arguments[1]!==o&&arguments[1];a&&t(e).remove(),t(e).attr("src")&&t(e).removeAttr("src"),e.type="blocked/javascript",a&&t(e).appendTo("head")},e.unblockAllScripts=function(){let a=!(arguments.length>0&&arguments[0]!==o)||arguments[0],r=!(arguments.length>1&&arguments[1]!==o)||arguments[1];t.each(t('script[type="blocked/javascript"]'),(function(o,n){(t(n).data("wpm-cookie-category").includes("analytics")&&a||t(n).data("wpm-cookie-category").includes("ads")&&r)&&e.unblockScript(n,!0)})),jQuery(document).trigger("wpmPreLoadPixels",{})},e.unblockSelectedPixels=function(){t.each(t('script[type="blocked/javascript"]'),(function(o,a){(y.pixels.includes(t(a).data("wpm-pixel-name"))||"google"===t(a).data("wpm-pixel-name")&&["google-analytics","google-ads"].some((e=>y.pixels.includes(e))))&&e.unblockScript(a,!0)})),jQuery(document).trigger("wpmPreLoadPixels",{})},window.addEventListener("borlabs-cookie-consent-saved",(function(){e.updateConsentCookieValues(),"pixel"===y.mode?(e.unblockSelectedPixels(),e.updateGoogleConsentMode(y.pixels.includes("google-analytics"),y.pixels.includes("google-ads"))):(e.unblockAllScripts(y.categories.analytics,y.categories.ads),e.updateGoogleConsentMode(y.categories.analytics,y.categories.ads))})),window.addEventListener("CookiebotOnAccept",(function(){Cookiebot.consent.statistics&&(y.categories.analytics=!0),Cookiebot.consent.marketing&&(y.categories.ads=!0),e.unblockAllScripts(y.categories.analytics,y.categories.ads),e.updateGoogleConsentMode(y.categories.analytics,y.categories.ads)}),!1),window.addEventListener("CookieScriptAccept",(function(t){t.detail.categories.includes("performance")&&(y.categories.analytics=!0),t.detail.categories.includes("targeting")&&(y.categories.ads=!0),e.unblockAllScripts(y.categories.analytics,y.categories.ads),e.updateGoogleConsentMode(y.categories.analytics,y.categories.ads)})),window.addEventListener("CookieScriptAcceptAll",(function(){e.unblockAllScripts(!0,!0),e.updateGoogleConsentMode(!0,!0)})),document.addEventListener("cmplzStatusChange",(function(){e.updateConsentCookieValues(),e.unblockAllScripts(y.categories.analytics,y.categories.ads),e.updateGoogleConsentMode(y.categories.analytics,y.categories.ads)})),document.addEventListener("setCookieNotice",(function(){e.updateConsentCookieValues(),e.unblockAllScripts(y.categories.analytics,y.categories.ads),e.updateGoogleConsentMode(y.categories.analytics,y.categories.ads)})),e.huObserver=new MutationObserver((function(t){t.forEach((t=>{let{addedNodes:o}=t;[...o].forEach((t=>{"hu"===t.id&&jQuery(".hu-cookies-save").on("click",(function(){e.updateConsentCookieValues(),e.unblockAllScripts(y.categories.analytics,y.categories.ads),e.updateGoogleConsentMode(y.categories.analytics,y.categories.ads)}))}))}))})),window.hu&&e.huObserver.observe(document.documentElement||document.body,{childList:!0,subtree:!0}),e.version=function(){console.log(wpmDataLayer.version)},e.loadScriptAndCacheIt=function(e,t){return t=jQuery.extend(t||{},{dataType:"script",cache:!0,url:e}),jQuery.ajax(t)},e.getOrderItemPrice=function(e){return(e.total+e.total_tax)/e.quantity},e.hasLoginEventFired=function(){let t=e.getWpmSessionData();return null==t?void 0:t.loginEventFired},e.setLoginEventFired=function(){let t=e.getWpmSessionData();t.loginEventFired=!0,e.setWpmSessionData(t)},e.wpmDataLayerExists=function(){return new Promise((function(e){!function t(){if("undefined"!=typeof wpmDataLayer)return e();setTimeout(t,50)}()}))},e.jQueryExists=function(){return new Promise((function(e){!function t(){if("undefined"!=typeof jQuery)return e();setTimeout(t,100)}()}))},e.pageLoaded=function(){return new Promise((function(e){!function t(){if("complete"===document.readyState)return e();setTimeout(t,50)}()}))},e.pageReady=function(){return new Promise((function(e){!function t(){if("interactive"===document.readyState||"complete"===document.readyState)return e();setTimeout(t,50)}()}))},e.isMiniCartActive=function(){if(window.sessionStorage){for(const[e,t]of Object.entries(window.sessionStorage))if(e.includes("wc_fragments"))return!0;return!1}return!1},e.doesWooCommerceCartExist=function(){return document.cookie.includes("woocommerce_items_in_cart")},e.urlHasParameter=function(e){return new URLSearchParams(window.location.search).has(e)},window.wpmLoaded={}}(window.wpm=window.wpm||{},jQuery)},534:(e,t,o)=>{o(584)},207:()=>{wpm.wpmDataLayerExists().then((function(){console.log("WooCommerce Pixel Manager: "+(wpmDataLayer.version.pro?"Pro":"Free")+" Version "+wpmDataLayer.version.number+" loaded"),jQuery(document).trigger("wpmPreLoadPixels",{})})).then((function(){wpm.pageLoaded().then((function(){jQuery(document).trigger("wpmLoad",{})}))})),wpm.pageReady().then((function(){wpm.wpmDataLayerExists().then((function(){wpm.startIntersectionObserverToWatch(),wpm.startProductsMutationObserverToWatch()}))}))}},t={};function o(a){var r=t[a];if(void 0!==r)return r.exports;var n=t[a]={exports:{}};return e[a](n,n.exports,o),n.exports}o(534),wpm.jQueryExists().then((function(){o(299),o(69),o(12),o(787),o(207)}))})();
2
  //# sourceMappingURL=wpm-public.p1.min.js.map
1
+ (()=>{var e={785:()=>{!function(e,t,o){let a;e.loadFacebookPixel=function(){try{wpmDataLayer.pixels.facebook.loaded=!0,e=window,t=document,o="script",e.fbq||(a=e.fbq=function(){a.callMethod?a.callMethod.apply(a,arguments):a.queue.push(arguments)},e._fbq||(e._fbq=a),a.push=a,a.loaded=!0,a.version="2.0",a.queue=[],(r=t.createElement(o)).async=!0,r.src="https://connect.facebook.net/en_US/fbevents.js",(n=t.getElementsByTagName(o)[0]).parentNode.insertBefore(r,n)),fbq("init",wpmDataLayer.pixels.facebook.pixel_id),fbq("track","PageView")}catch(o){console.error(o)}var e,t,o,a,r,n},e.getRandomEventId=function(){return(Math.random()+1).toString(36).substring(2)},e.getFbUserData=function(){return a||e.getFbUserDataFromBrowser()},e.setFbUserData=function(){a=e.getFbUserDataFromBrowser()},e.getFbUserDataFromBrowser=function(){return{fbp:e.getCookie("_fbp"),fbc:e.getCookie("_fbc"),client_user_agent:navigator.userAgent}},e.fbViewContent=function(t){try{var o,a,r;if(null===(o=wpmDataLayer)||void 0===o||null===(a=o.pixels)||void 0===a||null===(r=a.facebook)||void 0===r||!r.loaded)return;let n=e.getRandomEventId();fbq("track","ViewContent",{content_type:"product",content_name:t.name,content_ids:t.dyn_r_ids[wpmDataLayer.pixels.facebook.dynamic_remarketing.id_type],currency:wpmDataLayer.shop.currency,value:t.price},{eventID:n}),t.currency=wpmDataLayer.shop.currency,jQuery(document).trigger("wpmFbCapiEvent",{event_name:"ViewContent",event_id:n,user_data:e.getFbUserData(),product_data:t,product_id:t.dyn_r_ids[wpmDataLayer.pixels.facebook.dynamic_remarketing.id_type],event_source_url:window.location.href})}catch(e){console.error(e)}},e.facebookContentIds=function(){let e=[];for(const[a,r]of Object.entries(wpmDataLayer.order.items)){var t,o;null!==(t=wpmDataLayer)&&void 0!==t&&null!==(o=t.general)&&void 0!==o&&o.variationsOutput&&0!==r.variation_id?e.push(String(wpmDataLayer.products[r.variation_id].dyn_r_ids[wpmDataLayer.pixels.facebook.dynamic_remarketing.id_type])):e.push(String(wpmDataLayer.products[r.id].dyn_r_ids[wpmDataLayer.pixels.facebook.dynamic_remarketing.id_type]))}return e}}(window.wpm=window.wpm||{},jQuery),jQuery(document).on("wpmLoadPixels",(function(){var e,t,o,a,r,n;null===(e=wpmDataLayer)||void 0===e||null===(t=e.pixels)||void 0===t||null===(o=t.facebook)||void 0===o||!o.pixel_id||null!==(a=wpmDataLayer)&&void 0!==a&&null!==(r=a.pixels)&&void 0!==r&&null!==(n=r.facebook)&&void 0!==n&&n.loaded||wpm.canIFire("ads","facebook-ads")&&wpm.loadFacebookPixel()})),jQuery(document).on("wpmAddToCart",(function(e,t){try{var o,a,r;if(null===(o=wpmDataLayer)||void 0===o||null===(a=o.pixels)||void 0===a||null===(r=a.facebook)||void 0===r||!r.loaded)return;let e=wpm.getRandomEventId();fbq("track","AddToCart",{content_type:"product",content_name:t.name,content_ids:t.dyn_r_ids[wpmDataLayer.pixels.facebook.dynamic_remarketing.id_type],value:parseFloat(t.quantity*t.price),currency:t.currency},{eventID:e}),t.currency=wpmDataLayer.shop.currency,jQuery(document).trigger("wpmFbCapiEvent",{event_name:"AddToCart",event_id:e,user_data:wpm.getFbUserData(),product_data:t,product_id:t.dyn_r_ids[wpmDataLayer.pixels.facebook.dynamic_remarketing.id_type],event_source_url:window.location.href})}catch(e){console.error(e)}})),jQuery(document).on("wpmBeginCheckout",(function(e){try{var t,o,a;if(null===(t=wpmDataLayer)||void 0===t||null===(o=t.pixels)||void 0===o||null===(a=o.facebook)||void 0===a||!a.loaded)return;let e=wpm.getRandomEventId();fbq("track","InitiateCheckout",{},{eventID:e}),jQuery(document).trigger("wpmFbCapiEvent",{event_name:"InitiateCheckout",event_id:e,user_data:wpm.getFbUserData(),event_source_url:window.location.href})}catch(e){console.error(e)}})),jQuery(document).on("wpmAddToWishlist",(function(e,t){try{var o,a,r;if(null===(o=wpmDataLayer)||void 0===o||null===(a=o.pixels)||void 0===a||null===(r=a.facebook)||void 0===r||!r.loaded)return;let e=wpm.getRandomEventId();fbq("track","AddToWishlist",{content_type:"product",content_name:t.name,content_ids:t.dyn_r_ids[wpmDataLayer.pixels.facebook.dynamic_remarketing.id_type],value:parseFloat(t.quantity*t.price),currency:t.currency},{eventID:e}),t.currency=wpmDataLayer.shop.currency,jQuery(document).trigger("wpmFbCapiEvent",{event_name:"AddToWishlist",event_id:e,user_data:wpm.getFbUserData(),product_data:t,product_id:t.dyn_r_ids[wpmDataLayer.pixels.facebook.dynamic_remarketing.id_type],event_source_url:window.location.href})}catch(e){console.error(e)}})),jQuery(document).on("wpmViewItem",(function(e,t){try{var o,a,r;if(null===(o=wpmDataLayer)||void 0===o||null===(a=o.pixels)||void 0===a||null===(r=a.facebook)||void 0===r||!r.loaded)return;wpm.fbViewContent(t)}catch(e){console.error(e)}})),jQuery(document).on("wpmSearch",(function(){try{var e,t,o;if(null===(e=wpmDataLayer)||void 0===e||null===(t=e.pixels)||void 0===t||null===(o=t.facebook)||void 0===o||!o.loaded)return;let a=wpm.getRandomEventId();fbq("track","Search",{},{eventID:a}),jQuery(document).trigger("wpmFbCapiEvent",{event_name:"Search",event_id:a,user_data:wpm.getFbUserData(),event_source_url:window.location.href})}catch(e){console.error(e)}})),jQuery(document).on("wpmLoadAlways",(function(){try{var e,t,o;if(null===(e=wpmDataLayer)||void 0===e||null===(t=e.pixels)||void 0===t||null===(o=t.facebook)||void 0===o||!o.loaded)return;wpm.setFbUserData()}catch(e){console.error(e)}})),jQuery(document).on("wpmOrderReceivedPage",(function(){try{var e,t,o;if(null===(e=wpmDataLayer)||void 0===e||null===(t=e.pixels)||void 0===t||null===(o=t.facebook)||void 0===o||!o.loaded)return;fbq("track","Purchase",{content_type:"product",value:wpmDataLayer.order.value_filtered,currency:wpmDataLayer.order.currency,content_ids:wpm.facebookContentIds()},{eventID:wpmDataLayer.order.id})}catch(e){console.error(e)}}))},234:()=>{!function(e,t,o){let a=[];e.getGoogleAdsConversionIdentifiersWithLabel=function(){for(const[e,t]of Object.entries(wpmDataLayer.pixels.google.ads.conversionIds))a.push(e+"/"+t);return a},e.getGoogleAdsConversionIdentifiers=function(){let e=[];for(const[t,o]of Object.entries(wpmDataLayer.pixels.google.ads.conversionIds))e.push(t);return e},e.getGoogleAdsRegularOrderItems=function(){let e=[];for(const[a,r]of Object.entries(wpmDataLayer.order.items)){var t,o;let a;a={quantity:r.quantity,price:r.price},null!==(t=wpmDataLayer)&&void 0!==t&&null!==(o=t.general)&&void 0!==o&&o.variationsOutput&&0!==r.variation_id?(a.id=String(wpmDataLayer.products[r.variation_id].dyn_r_ids[wpmDataLayer.pixels.google.ads.dynamic_remarketing.id_type]),e.push(a)):(a.id=String(wpmDataLayer.products[r.id].dyn_r_ids[wpmDataLayer.pixels.google.ads.dynamic_remarketing.id_type]),e.push(a))}return e},e.getGoogleAdsDynamicRemarketingOrderItems=function(){let e=[];for(const[a,r]of Object.entries(wpmDataLayer.order.items)){var t,o;let a;a={quantity:r.quantity,price:r.price,google_business_vertical:wpmDataLayer.pixels.google.ads.google_business_vertical},null!==(t=wpmDataLayer)&&void 0!==t&&null!==(o=t.general)&&void 0!==o&&o.variationsOutput&&0!==r.variation_id?(a.id=String(wpmDataLayer.products[r.variation_id].dyn_r_ids[wpmDataLayer.pixels.google.ads.dynamic_remarketing.id_type]),e.push(a)):(a.id=String(wpmDataLayer.products[r.id].dyn_r_ids[wpmDataLayer.pixels.google.ads.dynamic_remarketing.id_type]),e.push(a))}return e}}(window.wpm=window.wpm||{},jQuery),jQuery(document).on("wpmViewItemList",(function(e,t){try{var o,a,r,n,i,s,d,l,c,u,p;if(jQuery.isEmptyObject(null===(o=wpmDataLayer)||void 0===o||null===(a=o.pixels)||void 0===a||null===(r=a.google)||void 0===r||null===(n=r.ads)||void 0===n?void 0:n.conversionIds))return;if(null===(i=wpmDataLayer)||void 0===i||null===(s=i.pixels)||void 0===s||null===(d=s.google)||void 0===d||null===(l=d.ads)||void 0===l||null===(c=l.dynamic_remarketing)||void 0===c||!c.status)return;if(!wpm.googleConfigConditionsMet("ads"))return;if(null!==(u=wpmDataLayer)&&void 0!==u&&null!==(p=u.general)&&void 0!==p&&p.variationsOutput&&t.isVariable&&!1===wpmDataLayer.pixels.google.ads.dynamic_remarketing.send_events_with_parent_ids)return;if(!t)return;wpm.gtagLoaded().then((function(){gtag("event","view_item_list",{send_to:wpm.getGoogleAdsConversionIdentifiers(),items:[{id:t.dyn_r_ids[wpmDataLayer.pixels.google.ads.dynamic_remarketing.id_type],google_business_vertical:wpmDataLayer.pixels.google.ads.google_business_vertical}]})}))}catch(e){console.error(e)}})),jQuery(document).on("wpmAddToCart",(function(e,t){try{var o,a,r,n,i,s,d,l,c;if(jQuery.isEmptyObject(null===(o=wpmDataLayer)||void 0===o||null===(a=o.pixels)||void 0===a||null===(r=a.google)||void 0===r||null===(n=r.ads)||void 0===n?void 0:n.conversionIds))return;if(null===(i=wpmDataLayer)||void 0===i||null===(s=i.pixels)||void 0===s||null===(d=s.google)||void 0===d||null===(l=d.ads)||void 0===l||null===(c=l.dynamic_remarketing)||void 0===c||!c.status)return;if(!wpm.googleConfigConditionsMet("ads"))return;wpm.gtagLoaded().then((function(){gtag("event","add_to_cart",{send_to:wpm.getGoogleAdsConversionIdentifiers(),value:t.quantity*t.price,items:[{id:t.dyn_r_ids[wpmDataLayer.pixels.google.ads.dynamic_remarketing.id_type],quantity:t.quantity,price:t.price,google_business_vertical:wpmDataLayer.pixels.google.ads.google_business_vertical}]})}))}catch(e){console.error(e)}})),jQuery(document).on("wpmViewItem",(function(e,t){try{var o,a,r,n,i,s,d,l,c;if(jQuery.isEmptyObject(null===(o=wpmDataLayer)||void 0===o||null===(a=o.pixels)||void 0===a||null===(r=a.google)||void 0===r||null===(n=r.ads)||void 0===n?void 0:n.conversionIds))return;if(null===(i=wpmDataLayer)||void 0===i||null===(s=i.pixels)||void 0===s||null===(d=s.google)||void 0===d||null===(l=d.ads)||void 0===l||null===(c=l.dynamic_remarketing)||void 0===c||!c.status)return;if(!wpm.googleConfigConditionsMet("ads"))return;wpm.gtagLoaded().then((function(){gtag("event","view_item",{send_to:wpm.getGoogleAdsConversionIdentifiers(),value:(t.quantity?t.quantity:1)*t.price,items:[{id:t.dyn_r_ids[wpmDataLayer.pixels.google.ads.dynamic_remarketing.id_type],quantity:t.quantity?t.quantity:1,price:t.price,google_business_vertical:wpmDataLayer.pixels.google.ads.google_business_vertical}]})}))}catch(e){console.error(e)}})),jQuery(document).on("wpmSearch",(function(){try{var e,t,o,a,r,n,i,s,d;if(jQuery.isEmptyObject(null===(e=wpmDataLayer)||void 0===e||null===(t=e.pixels)||void 0===t||null===(o=t.google)||void 0===o||null===(a=o.ads)||void 0===a?void 0:a.conversionIds))return;if(null===(r=wpmDataLayer)||void 0===r||null===(n=r.pixels)||void 0===n||null===(i=n.google)||void 0===i||null===(s=i.ads)||void 0===s||null===(d=s.dynamic_remarketing)||void 0===d||!d.status)return;if(!wpm.googleConfigConditionsMet("ads"))return;let u=[];for(const[e,t]of Object.entries(wpmDataLayer.products)){var l,c;if(null!==(l=wpmDataLayer)&&void 0!==l&&null!==(c=l.general)&&void 0!==c&&c.variationsOutput&&t.isVariable&&!1===wpmDataLayer.pixels.google.ads.dynamic_remarketing.send_events_with_parent_ids)return;u.push({id:t.dyn_r_ids[wpmDataLayer.pixels.google.ads.dynamic_remarketing.id_type],google_business_vertical:wpmDataLayer.pixels.google.ads.google_business_vertical})}wpm.gtagLoaded().then((function(){gtag("event","view_search_results",{send_to:wpm.getGoogleAdsConversionIdentifiers(),items:u})}))}catch(e){console.error(e)}})),jQuery(document).on("wpmOrderReceivedPage",(function(){try{var e,t,o,a,r,n,i,s,d;if(jQuery.isEmptyObject(null===(e=wpmDataLayer)||void 0===e||null===(t=e.pixels)||void 0===t||null===(o=t.google)||void 0===o||null===(a=o.ads)||void 0===a?void 0:a.conversionIds))return;if(null===(r=wpmDataLayer)||void 0===r||null===(n=r.pixels)||void 0===n||null===(i=n.google)||void 0===i||null===(s=i.ads)||void 0===s||null===(d=s.dynamic_remarketing)||void 0===d||!d.status)return;if(!wpm.googleConfigConditionsMet("ads"))return;wpm.gtagLoaded().then((function(){gtag("event","purchase",{send_to:wpm.getGoogleAdsConversionIdentifiers(),value:wpmDataLayer.order.value_filtered,items:wpm.getGoogleAdsDynamicRemarketingOrderItems()})}))}catch(e){console.error(e)}})),jQuery(document).on("wpmLogin",(function(){try{var e,t,o,a,r,n,i,s,d;if(jQuery.isEmptyObject(null===(e=wpmDataLayer)||void 0===e||null===(t=e.pixels)||void 0===t||null===(o=t.google)||void 0===o||null===(a=o.ads)||void 0===a?void 0:a.conversionIds))return;if(null===(r=wpmDataLayer)||void 0===r||null===(n=r.pixels)||void 0===n||null===(i=n.google)||void 0===i||null===(s=i.ads)||void 0===s||null===(d=s.dynamic_remarketing)||void 0===d||!d.status)return;if(!wpm.googleConfigConditionsMet("ads"))return;wpm.gtagLoaded().then((function(){gtag("event","login",{send_to:wpm.getGoogleAdsConversionIdentifiers()})}))}catch(e){console.error(e)}})),jQuery(document).on("wpmOrderReceivedPage",(function(){try{var e,t,o,a,r,n;if(jQuery.isEmptyObject(null===(e=wpmDataLayer)||void 0===e||null===(t=e.pixels)||void 0===t||null===(o=t.google)||void 0===o||null===(a=o.ads)||void 0===a?void 0:a.conversionIds))return;if(!wpm.googleConfigConditionsMet("ads"))return;let i={},s={};i={send_to:wpm.getGoogleAdsConversionIdentifiersWithLabel(),transaction_id:wpmDataLayer.order.number,value:wpmDataLayer.order.value_filtered,currency:wpmDataLayer.order.currency,new_customer:wpmDataLayer.order.new_customer},null!==(r=wpmDataLayer)&&void 0!==r&&null!==(n=r.order)&&void 0!==n&&n.aw_merchant_id&&(s={discount:wpmDataLayer.order.discount,aw_merchant_id:wpmDataLayer.order.aw_merchant_id,aw_feed_country:wpmDataLayer.order.aw_feed_country,aw_feed_language:wpmDataLayer.order.aw_feed_language,items:wpm.getGoogleAdsRegularOrderItems()}),wpm.gtagLoaded().then((function(){gtag("event","conversion",{...i,...s})}))}catch(e){console.error(e)}}))},464:()=>{!function(e,t,o){e.getGA4OrderItems=function(){let e=[];for(const[a,r]of Object.entries(wpmDataLayer.order.items)){var t,o;let a;a={quantity:r.quantity,price:r.price,item_name:r.name,currency:wpmDataLayer.order.currency,item_category:wpmDataLayer.products[r.id].category.join("/")},null!==(t=wpmDataLayer)&&void 0!==t&&null!==(o=t.general)&&void 0!==o&&o.variationsOutput&&0!==r.variation_id?(a.item_id=String(wpmDataLayer.products[r.variation_id].dyn_r_ids[wpmDataLayer.pixels.google.analytics.id_type]),a.item_variant=wpmDataLayer.products[r.variation_id].variant_name,a.item_brand=wpmDataLayer.products[r.variation_id].brand):(a.item_id=String(wpmDataLayer.products[r.id].dyn_r_ids[wpmDataLayer.pixels.google.analytics.id_type]),a.item_brand=wpmDataLayer.products[r.id].brand),e.push(a)}return e}}(window.wpm=window.wpm||{},jQuery),jQuery(document).on("wpmOrderReceivedPage",(function(){try{var e,t,o,a,r,n,i,s,d,l;if(null===(e=wpmDataLayer)||void 0===e||null===(t=e.pixels)||void 0===t||null===(o=t.google)||void 0===o||null===(a=o.analytics)||void 0===a||null===(r=a.ga4)||void 0===r||!r.measurement_id)return;if(null!==(n=wpmDataLayer)&&void 0!==n&&null!==(i=n.pixels)&&void 0!==i&&null!==(s=i.google)&&void 0!==s&&null!==(d=s.analytics)&&void 0!==d&&null!==(l=d.ga4)&&void 0!==l&&l.mp_active)return;if(!wpm.googleConfigConditionsMet("analytics"))return;wpm.gtagLoaded().then((function(){gtag("event","purchase",{send_to:[wpmDataLayer.pixels.google.analytics.ga4.measurement_id],transaction_id:wpmDataLayer.order.number,affiliation:wpmDataLayer.order.affiliation,currency:wpmDataLayer.order.currency,value:wpmDataLayer.order.value_regular,discount:wpmDataLayer.order.discount,tax:wpmDataLayer.order.tax,shipping:wpmDataLayer.order.shipping,coupon:wpmDataLayer.order.coupon,items:wpm.getGA4OrderItems()})}))}catch(e){console.error(e)}}))},354:()=>{!function(e,t,o){e.getGAUAOrderItems=function(){let e=[],t=1;for(const[r,n]of Object.entries(wpmDataLayer.order.items)){var o,a;let r;r={quantity:n.quantity,price:n.price,name:n.name,currency:wpmDataLayer.order.currency,category:wpmDataLayer.products[n.id].category.join("/"),list_position:t},null!==(o=wpmDataLayer)&&void 0!==o&&null!==(a=o.general)&&void 0!==a&&a.variationsOutput&&0!==n.variation_id?(r.id=String(wpmDataLayer.products[n.variation_id].dyn_r_ids[wpmDataLayer.pixels.google.analytics.id_type]),r.variant=wpmDataLayer.products[n.variation_id].variant_name,r.brand=wpmDataLayer.products[n.variation_id].brand):(r.id=String(wpmDataLayer.products[n.id].dyn_r_ids[wpmDataLayer.pixels.google.analytics.id_type]),r.brand=wpmDataLayer.products[n.id].brand),e.push(r),t++}return e}}(window.wpm=window.wpm||{},jQuery),jQuery(document).on("wpmOrderReceivedPage",(function(){try{var e,t,o,a,r,n,i,s,d,l;if(null===(e=wpmDataLayer)||void 0===e||null===(t=e.pixels)||void 0===t||null===(o=t.google)||void 0===o||null===(a=o.analytics)||void 0===a||null===(r=a.universal)||void 0===r||!r.property_id)return;if(null!==(n=wpmDataLayer)&&void 0!==n&&null!==(i=n.pixels)&&void 0!==i&&null!==(s=i.google)&&void 0!==s&&null!==(d=s.analytics)&&void 0!==d&&null!==(l=d.universal)&&void 0!==l&&l.mp_active)return;if(!wpm.googleConfigConditionsMet("analytics"))return;wpm.gtagLoaded().then((function(){gtag("event","purchase",{send_to:[wpmDataLayer.pixels.google.analytics.universal.property_id],transaction_id:wpmDataLayer.order.number,affiliation:wpmDataLayer.order.affiliation,currency:wpmDataLayer.order.currency,value:wpmDataLayer.order.value_regular,discount:wpmDataLayer.order.discount,tax:wpmDataLayer.order.tax,shipping:wpmDataLayer.order.shipping,coupon:wpmDataLayer.order.coupon,items:wpm.getGAUAOrderItems()})}))}catch(e){console.error(e)}}))},497:()=>{!function(e,t,o){e.load_google_optimize_pixel=function(){try{wpmDataLayer.pixels.google.optimize.loaded=!0,e.loadScriptAndCacheIt("https://www.googleoptimize.com/optimize.js?id="+wpmDataLayer.pixels.google.optimize.container_id)}catch(e){console.error(e)}}}(window.wpm=window.wpm||{},jQuery),jQuery(document).on("wpmLoadPixels",(function(){var e,t,o,a,r,n,i,s;null===(e=wpmDataLayer)||void 0===e||null===(t=e.pixels)||void 0===t||null===(o=t.google)||void 0===o||null===(a=o.optimize)||void 0===a||!a.container_id||null!==(r=wpmDataLayer)&&void 0!==r&&null!==(n=r.pixels)&&void 0!==n&&null!==(i=n.google)&&void 0!==i&&null!==(s=i.optimize)&&void 0!==s&&s.loaded||wpm.canIFire("analytics","google-optimize")&&wpm.load_google_optimize_pixel()}))},577:()=>{!function(e,t,o){e.googleConfigConditionsMet=function(t){var o,a,r,n;return!(null===(o=wpmDataLayer)||void 0===o||null===(a=o.pixels)||void 0===a||null===(r=a.google)||void 0===r||null===(n=r.consent_mode)||void 0===n||!n.active)||("category"===e.getConsentValues().mode?!0===e.getConsentValues().categories[t]:"pixel"===e.getConsentValues().mode&&e.getConsentValues().pixels.includes("google-"+t))},e.getVisitorConsentStatusAndUpdateGoogleConsentSettings=function(t){return"category"===e.getConsentValues().mode?(e.getConsentValues().categories.analytics&&(t.analytics_storage="granted"),e.getConsentValues().categories.ads&&(t.ad_storage="granted")):"pixel"===e.getConsentValues().mode&&(t.analytics_storage=e.getConsentValues().pixels.includes("google-analytics")?"granted":"denied",t.ad_storage=e.getConsentValues().pixels.includes("google-ads")?"granted":"denied"),t},e.updateGoogleConsentMode=function(){let e=!(arguments.length>0&&arguments[0]!==o)||arguments[0],t=!(arguments.length>1&&arguments[1]!==o)||arguments[1];try{if(!window.gtag||!wpmDataLayer.shop.cookie_consent_mgmt.explicit_consent)return;gtag("consent","update",{analytics_storage:e?"granted":"denied",ad_storage:t?"granted":"denied"})}catch(e){console.error(e)}},e.fireGtagGoogleAds=function(){try{var e,t,o,a,r,n,i,s,d,l,c,u,p,g,m,y,w,v,f,_,h;if(wpmDataLayer.pixels.google.ads.state="loading",null!==(e=wpmDataLayer)&&void 0!==e&&null!==(t=e.pixels)&&void 0!==t&&null!==(o=t.google)&&void 0!==o&&null!==(a=o.ads)&&void 0!==a&&null!==(r=a.enhanced_conversions)&&void 0!==r&&r.active)for(const[e,t]of Object.entries(wpmDataLayer.pixels.google.ads.conversionIds))gtag("config",e,{allow_enhanced_conversions:!0});else for(const[e,t]of Object.entries(wpmDataLayer.pixels.google.ads.conversionIds))gtag("config",e);null!==(n=wpmDataLayer)&&void 0!==n&&null!==(i=n.pixels)&&void 0!==i&&null!==(s=i.google)&&void 0!==s&&null!==(d=s.ads)&&void 0!==d&&d.conversionIds&&null!==(l=wpmDataLayer)&&void 0!==l&&null!==(c=l.pixels)&&void 0!==c&&null!==(u=c.google)&&void 0!==u&&null!==(p=u.ads)&&void 0!==p&&p.phone_conversion_label&&null!==(g=wpmDataLayer)&&void 0!==g&&null!==(m=g.pixels)&&void 0!==m&&null!==(y=m.google)&&void 0!==y&&null!==(w=y.ads)&&void 0!==w&&w.phone_conversion_number&&gtag("config",Object.keys(wpmDataLayer.pixels.google.ads.conversionIds)[0]+"/"+wpmDataLayer.pixels.google.ads.phone_conversion_label,{phone_conversion_number:wpmDataLayer.pixels.google.ads.phone_conversion_number}),"order_received_page"===wpmDataLayer.shop.page_type&&null!==(v=wpmDataLayer)&&void 0!==v&&null!==(f=v.order)&&void 0!==f&&null!==(_=f.google)&&void 0!==_&&null!==(h=_.ads)&&void 0!==h&&h.enhanced_conversion_data&&(window.enhanced_conversion_data=wpmDataLayer.order.google.ads.enhanced_conversion_data),wpmDataLayer.pixels.google.ads.state="ready"}catch(e){console.error(e)}},e.fireGtagGoogleAnalyticsUA=function(){try{wpmDataLayer.pixels.google.analytics.universal.state="loading",gtag("config",wpmDataLayer.pixels.google.analytics.universal.property_id,wpmDataLayer.pixels.google.analytics.universal.parameters),wpmDataLayer.pixels.google.analytics.universal.state="ready"}catch(e){console.error(e)}},e.fireGtagGoogleAnalyticsGA4=function(){try{wpmDataLayer.pixels.google.analytics.ga4.state="loading",gtag("config",wpmDataLayer.pixels.google.analytics.ga4.measurement_id,wpmDataLayer.pixels.google.analytics.ga4.parameters),wpmDataLayer.pixels.google.analytics.ga4.state="ready"}catch(e){console.error(e)}},e.isGoogleActive=function(){var e,t,o,a,r,n,i,s,d,l,c,u,p,g;return!(!(null!==(e=wpmDataLayer)&&void 0!==e&&null!==(t=e.pixels)&&void 0!==t&&null!==(o=t.google)&&void 0!==o&&null!==(a=o.analytics)&&void 0!==a&&null!==(r=a.universal)&&void 0!==r&&r.property_id||null!==(n=wpmDataLayer)&&void 0!==n&&null!==(i=n.pixels)&&void 0!==i&&null!==(s=i.google)&&void 0!==s&&null!==(d=s.analytics)&&void 0!==d&&null!==(l=d.ga4)&&void 0!==l&&l.measurement_id)&&jQuery.isEmptyObject(null===(c=wpmDataLayer)||void 0===c||null===(u=c.pixels)||void 0===u||null===(p=u.google)||void 0===p||null===(g=p.ads)||void 0===g?void 0:g.conversionIds))},e.getGoogleGtagId=function(){var e,t,o,a,r,n,i,s,d,l;return null!==(e=wpmDataLayer)&&void 0!==e&&null!==(t=e.pixels)&&void 0!==t&&null!==(o=t.google)&&void 0!==o&&null!==(a=o.analytics)&&void 0!==a&&null!==(r=a.universal)&&void 0!==r&&r.property_id?wpmDataLayer.pixels.google.analytics.universal.property_id:null!==(n=wpmDataLayer)&&void 0!==n&&null!==(i=n.pixels)&&void 0!==i&&null!==(s=i.google)&&void 0!==s&&null!==(d=s.analytics)&&void 0!==d&&null!==(l=d.ga4)&&void 0!==l&&l.measurement_id?wpmDataLayer.pixels.google.analytics.ga4.measurement_id:Object.keys(wpmDataLayer.pixels.google.ads.conversionIds)[0]},e.loadGoogle=function(){e.isGoogleActive()&&(wpmDataLayer.pixels.google.state="loading",e.loadScriptAndCacheIt("https://www.googletagmanager.com/gtag/js?id="+e.getGoogleGtagId()).done((function(t,o){try{var a,r,n,i,s,d,l,c,u,p,g,m,y,w,v,f,_,h,L,D,C,b;if(window.dataLayer=window.dataLayer||[],window.gtag=function(){dataLayer.push(arguments)},null!==(a=wpmDataLayer)&&void 0!==a&&null!==(r=a.pixels)&&void 0!==r&&null!==(n=r.google)&&void 0!==n&&null!==(i=n.consent_mode)&&void 0!==i&&i.active){var x,j,k,I;let t={ad_storage:wpmDataLayer.pixels.google.consent_mode.ad_storage,analytics_storage:wpmDataLayer.pixels.google.consent_mode.analytics_storage,wait_for_update:wpmDataLayer.pixels.google.consent_mode.wait_for_update};null!==(x=wpmDataLayer)&&void 0!==x&&null!==(j=x.pixels)&&void 0!==j&&null!==(k=j.google)&&void 0!==k&&null!==(I=k.consent_mode)&&void 0!==I&&I.region&&(t.region=wpmDataLayer.pixels.google.consent_mode.region),t=e.getVisitorConsentStatusAndUpdateGoogleConsentSettings(t),gtag("consent","default",t),gtag("set","ads_data_redaction",wpmDataLayer.pixels.google.consent_mode.ads_data_redaction),gtag("set","url_passthrough",wpmDataLayer.pixels.google.consent_mode.url_passthrough)}null!==(s=wpmDataLayer)&&void 0!==s&&null!==(d=s.pixels)&&void 0!==d&&null!==(l=d.google)&&void 0!==l&&null!==(c=l.linker)&&void 0!==c&&c.settings&&gtag("set","linker",wpmDataLayer.pixels.google.linker.settings),gtag("js",new Date),jQuery.isEmptyObject(null===(u=wpmDataLayer)||void 0===u||null===(p=u.pixels)||void 0===p||null===(g=p.google)||void 0===g||null===(m=g.ads)||void 0===m?void 0:m.conversionIds)||(e.googleConfigConditionsMet("ads")?e.fireGtagGoogleAds():e.logPreventedPixelLoading("google-ads","ads")),null!==(y=wpmDataLayer)&&void 0!==y&&null!==(w=y.pixels)&&void 0!==w&&null!==(v=w.google)&&void 0!==v&&null!==(f=v.analytics)&&void 0!==f&&null!==(_=f.universal)&&void 0!==_&&_.property_id&&(e.googleConfigConditionsMet("analytics")?e.fireGtagGoogleAnalyticsUA():e.logPreventedPixelLoading("google-universal-analytics","analytics")),null!==(h=wpmDataLayer)&&void 0!==h&&null!==(L=h.pixels)&&void 0!==L&&null!==(D=L.google)&&void 0!==D&&null!==(C=D.analytics)&&void 0!==C&&null!==(b=C.ga4)&&void 0!==b&&b.measurement_id&&(e.googleConfigConditionsMet("analytics")?e.fireGtagGoogleAnalyticsGA4():e.logPreventedPixelLoading("ga4","analytics")),wpmDataLayer.pixels.google.state="ready"}catch(e){console.error(e)}})))},e.canGoogleLoad=function(){var t,o,a,r;return!(null===(t=wpmDataLayer)||void 0===t||null===(o=t.pixels)||void 0===o||null===(a=o.google)||void 0===a||null===(r=a.consent_mode)||void 0===r||!r.active)||("category"===e.getConsentValues().mode?!(!e.getConsentValues().categories.ads&&!e.getConsentValues().categories.analytics):"pixel"===e.getConsentValues().mode?e.getConsentValues().pixels.includes("google-ads")||e.getConsentValues().pixels.includes("google-analytics"):(console.error("Couldn't find a valid load condition for Google mode in wpmConsentValues"),!1))},e.gtagLoaded=function(){return new Promise((function(e,t){var o,a,r;void 0===(null===(o=wpmDataLayer)||void 0===o||null===(a=o.pixels)||void 0===a||null===(r=a.google)||void 0===r?void 0:r.state)&&t();let n=0;!function o(){var a,r,i;return"ready"===(null===(a=wpmDataLayer)||void 0===a||null===(r=a.pixels)||void 0===r||null===(i=r.google)||void 0===i?void 0:i.state)?e():n>=5e3?t():(n+=200,void setTimeout(o,200))}()}))}}(window.wpm=window.wpm||{},jQuery),jQuery(document).on("wpmLoadPixels",(function(){var e,t,o;void 0===(null===(e=wpmDataLayer)||void 0===e||null===(t=e.pixels)||void 0===t||null===(o=t.google)||void 0===o?void 0:o.state)&&(wpm.canGoogleLoad()?wpm.loadGoogle():wpm.logPreventedPixelLoading("google","analytics / ads"))}))},570:()=>{!function(e,t,o){e.load_hotjar_pixel=function(){try{wpmDataLayer.pixels.hotjar.loaded=!0,e=window,t=document,e.hj=e.hj||function(){(e.hj.q=e.hj.q||[]).push(arguments)},e._hjSettings={hjid:wpmDataLayer.pixels.hotjar.site_id,hjsv:6},o=t.getElementsByTagName("head")[0],(a=t.createElement("script")).async=1,a.src="https://static.hotjar.com/c/hotjar-"+e._hjSettings.hjid+".js?sv="+e._hjSettings.hjsv,o.appendChild(a)}catch(e){console.error(e)}var e,t,o,a}}(window.wpm=window.wpm||{},jQuery),jQuery(document).on("wpmLoadPixels",(function(){var e,t,o,a,r,n,i,s,d;null===(e=wpmDataLayer)||void 0===e||null===(t=e.pixels)||void 0===t||null===(o=t.hotjar)||void 0===o||!o.site_id||null!==(a=wpmDataLayer)&&void 0!==a&&null!==(r=a.pixels)&&void 0!==r&&null!==(n=r.hotjar)&&void 0!==n&&n.loaded||!wpm.canIFire("analytics","hotjar")||null!==(i=wpmDataLayer)&&void 0!==i&&null!==(s=i.pixels)&&void 0!==s&&null!==(d=s.hotjar)&&void 0!==d&&d.loaded||wpm.load_hotjar_pixel()}))},560:()=>{wpm.wpmDataLayerExists().then((function(){console.log("WooCommerce Pixel Manager: "+(wpmDataLayer.version.pro?"Pro":"Free")+" Version "+wpmDataLayer.version.number+" loaded"),jQuery(document).trigger("wpmPreLoadPixels",{})})).then((function(){wpm.pageLoaded().then((function(){jQuery(document).trigger("wpmLoad",{})}))}))},230:()=>{!function(e,t,o){const a="_wpm_order_ids",r="_wpm_endpoint_available",n="/wp-json/";function i(){return""!==e.getCookie(a)}e.emailSelected=!1,e.paymentMethodSelected=!1,e.useRestEndpoint=function(){return e.isSessionStorageAvailable()&&e.isRestEndpointAvailable()&&e.isBelowRestErrorThreshold()},e.isBelowRestErrorThreshold=function(){return window.sessionStorage.getItem(0)<=10},e.isRestEndpointAvailable=function(){if(window.sessionStorage.getItem(r))return JSON.parse(window.sessionStorage.getItem(r));e.testEndpoint()},e.isSessionStorageAvailable=function(){return!!window.sessionStorage},e.testEndpoint=function(){let e=arguments.length>0&&arguments[0]!==o?arguments[0]:location.protocol+"//"+location.host+n,t=arguments.length>1&&arguments[1]!==o?arguments[1]:r;jQuery.ajax(e,{type:"HEAD",timeout:1e3,statusCode:{200:function(e){window.sessionStorage.setItem(t,JSON.stringify(!0))},404:function(e){window.sessionStorage.setItem(t,JSON.stringify(!1))},0:function(e){window.sessionStorage.setItem(t,JSON.stringify(!1))}}}).then((e=>{}))},e.isWpmRestEndpointAvailable=function(){let t=arguments.length>0&&arguments[0]!==o?arguments[0]:r;return!!e.getCookie(t)},e.writeOrderIdToStorage=function(t){if(window.Storage)if(null===localStorage.getItem(a)){let e=[];e.push(t),window.localStorage.setItem(a,JSON.stringify(e))}else{let e=JSON.parse(localStorage.getItem(a));e.includes(t)||(e.push(t),window.localStorage.setItem(a,JSON.stringify(e)))}else{let o=new Date;o.setDate(o.getDate()+365);let r=[];i()&&(r=JSON.parse(e.getCookie(a))),r.includes(t)||(r.push(t),document.cookie="_wpm_order_ids="+JSON.stringify(r)+";expires="+o.toUTCString())}"function"==typeof e.storeOrderIdOnServer&&wpmDataLayer.orderDeduplication&&e.storeOrderIdOnServer(t)},e.isOrderIdStored=function(t){return wpmDataLayer.orderDeduplication?window.Storage?null!==localStorage.getItem(a)&&JSON.parse(localStorage.getItem(a)).includes(t):!!i()&&JSON.parse(e.getCookie(a)).includes(t):(console.log("order duplication prevention: off"),!1)},e.isEmail=function(e){return/^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/.test(e)},e.removeProductFromCart=function(t){let a=arguments.length>1&&arguments[1]!==o?arguments[1]:null;try{if(!t)throw Error("Wasn't able to retrieve a productId");if(!(t=getIdBasedOndVariationsOutputSetting(t)))throw Error("Wasn't able to retrieve a productId");let o;if(o=null==a?wpmDataLayer.cart[t].quantity:a,wpmDataLayer.cart[t]){let r=e.getProductDetailsFormattedForEvent(t,o);jQuery(document).trigger("wpmRemoveFromCart",r),null==a||wpmDataLayer.cart[t].quantity===a?(delete wpmDataLayer.cart[t],sessionStorage&&sessionStorage.setItem("wpmDataLayerCart",JSON.stringify(wpmDataLayer.cart))):(wpmDataLayer.cart[t].quantity=wpmDataLayer.cart[t].quantity-o,sessionStorage&&sessionStorage.setItem("wpmDataLayerCart",JSON.stringify(wpmDataLayer.cart)))}}catch(e){console.error(e)}},getIdBasedOndVariationsOutputSetting=function(e){try{var t,o;return null!==(t=wpmDataLayer)&&void 0!==t&&null!==(o=t.general)&&void 0!==o&&o.variationsOutput?e:wpmDataLayer.products[e].isVariation?wpmDataLayer.products[e].parentId:e}catch(e){console.error(e)}},e.addProductToCart=function(t,o){try{var a;if(!t)throw Error("Wasn't able to retrieve a productId");if(!(t=getIdBasedOndVariationsOutputSetting(t)))throw Error("Wasn't able to retrieve a productId");if(null!==(a=wpmDataLayer)&&void 0!==a&&a.products[t]){var r;let a=e.getProductDetailsFormattedForEvent(t,o);jQuery(document).trigger("wpmAddToCart",a),null!==(r=wpmDataLayer)&&void 0!==r&&r.cart[t]?wpmDataLayer.cart[t].quantity=wpmDataLayer.cart[t].quantity+o:("cart"in wpmDataLayer||(wpmDataLayer.cart={}),wpmDataLayer.cart[t]=e.getProductDetailsFormattedForEvent(t,o)),sessionStorage&&sessionStorage.setItem("wpmDataLayerCart",JSON.stringify(wpmDataLayer.cart))}}catch(t){console.error(t),e.getCartItemsFromBackend()}},e.getCartItems=function(){sessionStorage?sessionStorage.getItem("wpmDataLayerCart")&&"order_received_page"!==wpmDataLayer.shop.page_type?e.saveCartObjectToDataLayer(JSON.parse(sessionStorage.getItem("wpmDataLayerCart"))):sessionStorage.setItem("wpmDataLayerCart",JSON.stringify({})):e.getCartItemsFromBackend()},e.getCartItemsFromBackend=function(){try{let t={action:"wpm_get_cart_items"};jQuery.ajax({type:"get",dataType:"json",url:e.ajax_url,data:t,success:function(t){t.cart||(t.cart={}),e.saveCartObjectToDataLayer(t.cart),sessionStorage&&sessionStorage.setItem("wpmDataLayerCart",JSON.stringify(t.cart))}})}catch(e){console.error(e)}},e.getProductsFromBackend=function(t){if((t=t.filter((e=>!wpmDataLayer.products.hasOwnProperty(e))))&&0!==t.length)try{let o={action:"wpm_get_product_ids",productIds:t};jQuery.ajax({type:"get",dataType:"json",url:e.ajax_url,data:o,success:function(e){wpmDataLayer.products=Object.assign({},wpmDataLayer.products,e)},error:function(e){console.log(e)}})}catch(e){console.error(e)}},e.saveCartObjectToDataLayer=function(e){wpmDataLayer.cart=e,wpmDataLayer.products=Object.assign({},wpmDataLayer.products,e)},e.fireCheckoutOption=function(e){let t=arguments.length>1&&arguments[1]!==o?arguments[1]:null,a=arguments.length>2&&arguments[2]!==o?arguments[2]:null,r={step:e,checkout_option:t,value:a};jQuery(document).trigger("wpmFireCheckoutOption",r)},e.fireCheckoutProgress=function(e){let t={step:e};jQuery(document).trigger("wpmFireCheckoutProgress",t)},e.getPostIdFromString=function(e){try{return e.match(/(post-)(\d+)/)[2]}catch(e){console.error(e)}},e.triggerViewItemList=function(t){if(!t)throw Error("Wasn't able to retrieve a productId");if(!(t=getIdBasedOndVariationsOutputSetting(t)))throw Error("Wasn't able to retrieve a productId");jQuery(document).trigger("wpmViewItemList",e.getProductDataForViewItemEvent(t))},e.getProductDataForViewItemEvent=function(t){if(!t)throw Error("Wasn't able to retrieve a productId");try{if(wpmDataLayer.products[t])return e.getProductDetailsFormattedForEvent(t)}catch(e){console.error(e)}},e.getMainProductIdFromProductPage=function(){try{return["simple","variable","grouped","composite","bundle"].indexOf(wpmDataLayer.shop.product_type)>=0&&jQuery(".wpmProductId:first").data("id")}catch(e){console.error(e)}},e.viewItemListTriggerTestMode=function(e){jQuery(e).css({position:"relative"}),jQuery(e).append('<div id="viewItemListTriggerOverlay"></div>'),jQuery(e).find("#viewItemListTriggerOverlay").css({"z-index":"10",display:"block",position:"absolute",height:"100%",top:"0",left:"0",right:"0",opacity:wpmDataLayer.viewItemListTrigger.opacity,"background-color":wpmDataLayer.viewItemListTrigger.backgroundColor})},e.getSearchTermFromUrl=function(){try{return new URLSearchParams(window.location.search).get("s")}catch(e){console.error(e)}};let s,d={};e.observerCallback=function(t,o){t.forEach((t=>{try{let a,r=jQuery(t.target).data("ioid");if(a=jQuery(t.target).next(".wpmProductId").length?jQuery(t.target).next(".wpmProductId").data("id"):jQuery(t.target).find(".wpmProductId").data("id"),!a)throw Error("wpmProductId element not found");t.isIntersecting?d[r]=setTimeout((()=>{e.triggerViewItemList(a),wpmDataLayer.viewItemListTrigger.testMode&&e.viewItemListTriggerTestMode(t.target),!1===wpmDataLayer.viewItemListTrigger.repeat&&o.unobserve(t.target)}),wpmDataLayer.viewItemListTrigger.timeout):(clearTimeout(d[r]),wpmDataLayer.viewItemListTrigger.testMode&&jQuery(t.target).find("#viewItemListTriggerOverlay").remove())}catch(e){console.error(e)}}))};let l,c=0;e.startIntersectionObserverToWatch=function(){try{e.urlHasParameter("vildemomode")&&(wpmDataLayer.viewItemListTrigger.testMode=!0),s=new IntersectionObserver(e.observerCallback,{threshold:wpmDataLayer.viewItemListTrigger.threshold}),l=jQuery(".wpmProductId").map((function(e,t){return jQuery(t).parent().hasClass("type-product")||jQuery(t).parent().hasClass("product")||jQuery(t).parent().hasClass("product-item-inner")?jQuery(t).parent():jQuery(t).prev().hasClass("wc-block-grid__product")||jQuery(t).prev().hasClass("product")||jQuery(t).prev().hasClass("product-small")||jQuery(t).prev().hasClass("woocommerce-LoopProduct-link")?jQuery(this).prev():jQuery(t).closest(".product").length?jQuery(t).closest(".product"):void 0})),l.each((function(e,t){jQuery(t[0]).data("ioid",c++),s.observe(t[0])}))}catch(e){console.error(e)}},e.startProductsMutationObserverToWatch=function(){try{let e=jQuery(".wpmProductId:eq(0)").parents().has(jQuery(".wpmProductId:eq(1)").parents()).first();e.length&&u.observe(e[0],{attributes:!0,childList:!0,characterData:!0})}catch(e){console.error(e)}};let u=new MutationObserver((function(e){e.forEach((function(e){let t=e.addedNodes;null!==t&&jQuery(t).each((function(){(jQuery(this).hasClass("type-product")||jQuery(this).hasClass("product-small")||jQuery(this).hasClass("wc-block-grid__product"))&&p(this)&&(jQuery(this).data("ioid",c++),s.observe(this))}))}))})),p=function(e){return!(!jQuery(e).find(".wpmProductId").length&&!jQuery(e).siblings(".wpmProductId").length)};e.setCookie=function(e){let t=arguments.length>1&&arguments[1]!==o?arguments[1]:"",a=arguments.length>2&&arguments[2]!==o?arguments[2]:null;if(a){let o=new Date;o.setTime(o.getTime()+24*a*60*60*1e3);let r="expires="+o.toUTCString();document.cookie=e+"="+t+";"+r+";path=/"}else document.cookie=e+"="+t+";path=/"},e.getCookie=function(e){let t=e+"=",o=decodeURIComponent(document.cookie).split(";");for(let e=0;e<o.length;e++){let a=o[e];for(;" "==a.charAt(0);)a=a.substring(1);if(0==a.indexOf(t))return a.substring(t.length,a.length)}return""},e.getWpmSessionData=function(){if(window.sessionStorage){let e=window.sessionStorage.getItem("_wpm");return null!==e?JSON.parse(e):{}}return{}},e.setWpmSessionData=function(e){window.sessionStorage&&window.sessionStorage.setItem("_wpm",JSON.stringify(e))},e.storeOrderIdOnServer=function(t){try{let o={action:"wpm_purchase_pixels_fired",order_id:t,nonce:e.nonce};jQuery.ajax({type:"post",dataType:"json",url:e.ajax_url,data:o,success:function(e){!1===e.success&&console.log(e)},error:function(e){console.log(e)}})}catch(e){console.error(e)}},e.getProductIdByCartItemKeyUrl=function(e){let t,o=new URLSearchParams(e.search).get("remove_item");return t=0===wpmDataLayer.cartItemKeys[o].variation_id?wpmDataLayer.cartItemKeys[o].product_id:wpmDataLayer.cartItemKeys[o].variation_id,t},e.getAddToCartLinkProductIds=function(){return jQuery("a").map((function(){let e=jQuery(this).attr("href");if(e&&e.includes("?add-to-cart=")){let t=e.match(/(add-to-cart=)(\d+)/);if(t)return t[2]}})).get()},e.getProductDetailsFormattedForEvent=function(e){let t=arguments.length>1&&arguments[1]!==o?arguments[1]:1,a={id:e.toString(),dyn_r_ids:wpmDataLayer.products[e].dyn_r_ids,name:wpmDataLayer.products[e].name,list_name:wpmDataLayer.shop.list_name,brand:wpmDataLayer.products[e].brand,category:wpmDataLayer.products[e].category,variant:wpmDataLayer.products[e].variant,list_position:wpmDataLayer.products[e].position,quantity:t,price:wpmDataLayer.products[e].price,currency:wpmDataLayer.shop.currency,isVariable:wpmDataLayer.products[e].isVariable,isVariation:wpmDataLayer.products[e].isVariation,parentId:wpmDataLayer.products[e].parentId};return a.isVariation&&(a.parentId_dyn_r_ids=wpmDataLayer.products[e].parentId_dyn_r_ids),a},e.setReferrerToCookie=function(){e.getCookie("wpmReferrer")||e.setCookie("wpmReferrer",document.referrer)},e.getReferrerFromCookie=function(){return e.getCookie("wpmReferrer")?e.getCookie("wpmReferrer"):null},e.getClidFromBrowser=function(){let t,a=arguments.length>0&&arguments[0]!==o?arguments[0]:"gclid";return t={gclid:"_gcl_aw",dclid:"_gcl_dc"},e.getCookie(t[a])?e.getCookie(t[a]).match(/(GCL.[\d]*.)(.*)/)[2]:""},e.getUserAgent=function(){return navigator.userAgent},e.getViewPort=function(){return{width:Math.max(document.documentElement.clientWidth||0,window.innerWidth||0),height:Math.max(document.documentElement.clientHeight||0,window.innerHeight||0)}};let g=function(){let t=e.getCookie("cmplz_statistics"),o=e.getCookie("cmplz_marketing");return!(!e.getCookie("cmplz_consent_status")&&!e.getCookie("cmplz_banner-status"))&&{analytics:"allow"===t,ads:"allow"===o,visitorHasChosen:!0}},m=function(){let t=e.getCookie("cookielawinfo-checkbox-analytics")||e.getCookie("cookielawinfo-checkbox-analytiques"),o=e.getCookie("cookielawinfo-checkbox-advertisement")||e.getCookie("cookielawinfo-checkbox-publicite"),a=e.getCookie("CookieLawInfoConsent");return!(!t&&!o)&&{analytics:"yes"===t,ads:"yes"===o,visitorHasChosen:!!a}},y={categories:{},pixels:[],mode:"category",visitorHasChosen:!1};e.getConsentValues=function(){return y},e.setConsentValueCategories=function(){let e=arguments.length>0&&arguments[0]!==o&&arguments[0],t=arguments.length>1&&arguments[1]!==o&&arguments[1];y.categories.analytics=e,y.categories.ads=t},e.updateConsentCookieValues=function(){let t,a=arguments.length>0&&arguments[0]!==o&&arguments[0];if(t=e.getCookie("CookieConsent"))t=decodeURI(t),y.categories.analytics=t.indexOf("statistics:true")>=0,y.categories.ads=t.indexOf("marketing:true")>=0,y.visitorHasChosen=!0;else if(t=e.getCookie("CookieScriptConsent"))t=JSON.parse(t),"reject"===t.action?(y.categories.analytics=!1,y.categories.ads=!1):2===t.categories.length?(y.categories.analytics=!0,y.categories.ads=!0):(y.categories.analytics=t.categories.indexOf("performance")>=0,y.categories.ads=t.categories.indexOf("targeting")>=0),y.visitorHasChosen=!0;else if(t=e.getCookie("borlabs-cookie")){var r,n,i,s,d,l,c,u;t=decodeURI(t),t=JSON.parse(t),y.categories.analytics=!(null===(r=t)||void 0===r||null===(n=r.consents)||void 0===n||!n.statistics),y.categories.ads=!(null===(i=t)||void 0===i||null===(s=i.consents)||void 0===s||!s.marketing),y.visitorHasChosen=!0,y.pixels=[...(null===(d=t)||void 0===d||null===(l=d.consents)||void 0===l?void 0:l.statistics)||[],...(null===(c=t)||void 0===c||null===(u=c.consents)||void 0===u?void 0:u.marketing)||[]],y.mode="pixel"}else(t=g())?(y.categories.analytics=!0===t.analytics,y.categories.ads=!0===t.ads,y.visitorHasChosen=t.visitorHasChosen):(t=e.getCookie("cookie_notice_accepted"))?(y.categories.analytics=!0,y.categories.ads=!0,y.visitorHasChosen=!0):(t=e.getCookie("hu-consent"))?(t=JSON.parse(t),y.categories.analytics=!!t.categories[3],y.categories.ads=!!t.categories[4],y.visitorHasChosen=!0):(t=m())?(y.categories.analytics=!0===t.analytics,y.categories.ads=!0===t.ads,y.visitorHasChosen=!0===t.visitorHasChosen):(t=e.getCookie("moove_gdpr_popup"))?(t=JSON.parse(t),y.categories.analytics="1"===t.thirdparty,y.categories.ads="1"===t.advanced,y.visitorHasChosen=!0):(y.categories.analytics=!a,y.categories.ads=!a)},e.updateConsentCookieValues(),e.setConsentDefaultValuesToExplicit=function(){y.categories={analytics:!1,ads:!1}},e.canIFire=function(t,o){let a;return"category"===y.mode?a=!!y.categories[t]:"pixel"===y.mode?a=y.pixels.includes(o):(console.error("Couldn't find a valid consent mode in wpmConsentValues"),a=!1),!!a||(e.logPreventedPixelLoading(o,t),!1)},e.logPreventedPixelLoading=function(e,t){var o,a,r;null!==(o=wpmDataLayer)&&void 0!==o&&null!==(a=o.shop)&&void 0!==a&&null!==(r=a.cookie_consent_mgmt)&&void 0!==r&&r.explicit_consent?console.log('WooCommerce Pixel Manager: The "'+e+" (category: "+t+')" pixel has not fired because you have not given consent for it yet. (WPM is in explicit consent mode.)'):console.log('WooCommerce Pixel Manager: The "'+e+" (category: "+t+')" pixel has not fired because you have removed consent for this pixel. (WPM is in implicit consent mode.)')},e.scriptTagObserver=new MutationObserver((o=>{o.forEach((o=>{let{addedNodes:a}=o;[...a].forEach((o=>{t(o).data("wpm-cookie-category")&&(e.shouldScriptBeActive(o)?e.unblockScript(o):e.blockScript(o))}))}))})),e.scriptTagObserver.observe(document.head,{childList:!0,subtree:!0}),window.addEventListener("DOMContentLoaded",(()=>e.scriptTagObserver.disconnect())),e.shouldScriptBeActive=function(e){var o,a,r,n;return!((wpmDataLayer.shop.cookie_consent_mgmt.explicit_consent||y.visitorHasChosen)&&("category"!==y.mode||!t(e).data("wpm-cookie-category").split(",").some((e=>y.categories[e])))&&("pixel"!==y.mode||!y.pixels.includes(t(e).data("wpm-pixel-name")))&&("pixel"!==y.mode||"google"!==t(e).data("wpm-pixel-name")||!["google-analytics","google-ads"].some((e=>y.pixels.includes(e))))&&(null===(o=wpmDataLayer)||void 0===o||null===(a=o.pixels)||void 0===a||null===(r=a.google)||void 0===r||null===(n=r.consent_mode)||void 0===n||!n.active||"google"!==t(e).data("wpm-pixel-name")))},e.unblockScript=function(e){let a=arguments.length>1&&arguments[1]!==o&&arguments[1];a&&t(e).remove();let r=t(e).data("wpm-src");r&&t(e).attr("src",r),e.type="text/javascript",a&&t(e).appendTo("head"),jQuery(document).trigger("wpmPreLoadPixels",{})},e.blockScript=function(e){let a=arguments.length>1&&arguments[1]!==o&&arguments[1];a&&t(e).remove(),t(e).attr("src")&&t(e).removeAttr("src"),e.type="blocked/javascript",a&&t(e).appendTo("head")},e.unblockAllScripts=function(){let a=!(arguments.length>0&&arguments[0]!==o)||arguments[0],r=!(arguments.length>1&&arguments[1]!==o)||arguments[1];t.each(t('script[type="blocked/javascript"]'),(function(o,n){(t(n).data("wpm-cookie-category").includes("analytics")&&a||t(n).data("wpm-cookie-category").includes("ads")&&r)&&e.unblockScript(n,!0)})),jQuery(document).trigger("wpmPreLoadPixels",{})},e.unblockSelectedPixels=function(){t.each(t('script[type="blocked/javascript"]'),(function(o,a){(y.pixels.includes(t(a).data("wpm-pixel-name"))||"google"===t(a).data("wpm-pixel-name")&&["google-analytics","google-ads"].some((e=>y.pixels.includes(e))))&&e.unblockScript(a,!0)})),jQuery(document).trigger("wpmPreLoadPixels",{})},window.addEventListener("borlabs-cookie-consent-saved",(function(){e.updateConsentCookieValues(),"pixel"===y.mode?(e.unblockSelectedPixels(),e.updateGoogleConsentMode(y.pixels.includes("google-analytics"),y.pixels.includes("google-ads"))):(e.unblockAllScripts(y.categories.analytics,y.categories.ads),e.updateGoogleConsentMode(y.categories.analytics,y.categories.ads))})),window.addEventListener("CookiebotOnAccept",(function(){Cookiebot.consent.statistics&&(y.categories.analytics=!0),Cookiebot.consent.marketing&&(y.categories.ads=!0),e.unblockAllScripts(y.categories.analytics,y.categories.ads),e.updateGoogleConsentMode(y.categories.analytics,y.categories.ads)}),!1),window.addEventListener("CookieScriptAccept",(function(t){t.detail.categories.includes("performance")&&(y.categories.analytics=!0),t.detail.categories.includes("targeting")&&(y.categories.ads=!0),e.unblockAllScripts(y.categories.analytics,y.categories.ads),e.updateGoogleConsentMode(y.categories.analytics,y.categories.ads)})),window.addEventListener("CookieScriptAcceptAll",(function(){e.unblockAllScripts(!0,!0),e.updateGoogleConsentMode(!0,!0)})),document.addEventListener("cmplzStatusChange",(function(){e.updateConsentCookieValues(),e.unblockAllScripts(y.categories.analytics,y.categories.ads),e.updateGoogleConsentMode(y.categories.analytics,y.categories.ads)})),document.addEventListener("setCookieNotice",(function(){e.updateConsentCookieValues(),e.unblockAllScripts(y.categories.analytics,y.categories.ads),e.updateGoogleConsentMode(y.categories.analytics,y.categories.ads)})),e.huObserver=new MutationObserver((function(t){t.forEach((t=>{let{addedNodes:o}=t;[...o].forEach((t=>{"hu"===t.id&&jQuery(".hu-cookies-save").on("click",(function(){e.updateConsentCookieValues(),e.unblockAllScripts(y.categories.analytics,y.categories.ads),e.updateGoogleConsentMode(y.categories.analytics,y.categories.ads)}))}))}))})),window.hu&&e.huObserver.observe(document.documentElement||document.body,{childList:!0,subtree:!0}),e.version=function(){console.log(wpmDataLayer.version)},e.loadScriptAndCacheIt=function(e,t){return t=jQuery.extend(t||{},{dataType:"script",cache:!0,url:e}),jQuery.ajax(t)},e.getOrderItemPrice=function(e){return(e.total+e.total_tax)/e.quantity},e.hasLoginEventFired=function(){let t=e.getWpmSessionData();return null==t?void 0:t.loginEventFired},e.setLoginEventFired=function(){let t=e.getWpmSessionData();t.loginEventFired=!0,e.setWpmSessionData(t)},e.wpmDataLayerExists=function(){return new Promise((function(e){!function t(){if("undefined"!=typeof wpmDataLayer)return e();setTimeout(t,50)}()}))},e.pageLoaded=function(){return new Promise((function(e){!function t(){if("complete"===document.readyState)return e();setTimeout(t,50)}()}))},e.pageReady=function(){return new Promise((function(e){!function t(){if("interactive"===document.readyState||"complete"===document.readyState)return e();setTimeout(t,50)}()}))},e.isMiniCartActive=function(){if(window.sessionStorage){for(const[e,t]of Object.entries(window.sessionStorage))if(e.includes("wc_fragments"))return!0;return!1}return!1},e.doesWooCommerceCartExist=function(){return document.cookie.includes("woocommerce_items_in_cart")},e.urlHasParameter=function(e){return new URLSearchParams(window.location.search).has(e)},window.wpmLoaded={}}(window.wpm=window.wpm||{},jQuery),wpm.pageReady().then((function(){wpm.wpmDataLayerExists().then((function(){wpm.startIntersectionObserverToWatch(),wpm.startProductsMutationObserverToWatch()})),jQuery(document).on("click",".remove_from_cart_button, .remove",(function(){try{let e=new URL(jQuery(this).attr("href")),t=wpm.getProductIdByCartItemKeyUrl(e);wpm.removeProductFromCart(t)}catch(e){console.error(e)}})),jQuery(document).on("click",".add_to_cart_button:not(.product_type_variable), .ajax_add_to_cart, .single_add_to_cart_button",(function(){try{if("product"===wpmDataLayer.shop.page_type){if(void 0!==jQuery(this).attr("href")&&jQuery(this).attr("href").includes("add-to-cart")){let e=1,t=jQuery(this).data("product_id");wpm.addProductToCart(t,e)}else if("simple"===wpmDataLayer.shop.product_type){let e=Number(jQuery(".input-text.qty").val());e||0===e||(e=1);let t=jQuery(this).val();wpm.addProductToCart(t,e)}else if("variable"===wpmDataLayer.shop.product_type){let e=Number(jQuery(".input-text.qty").val());e||0===e||(e=1);let t=jQuery("[name='variation_id']").val();wpm.addProductToCart(t,e)}else if("grouped"===wpmDataLayer.shop.product_type)jQuery(".woocommerce-grouped-product-list-item").each((function(){let e=Number(jQuery(this).find(".input-text.qty").val());e||0===e||(e=1);let t=jQuery(this).attr("class"),o=wpm.getPostIdFromString(t);wpm.addProductToCart(o,e)}));else if("bundle"===wpmDataLayer.shop.product_type){let e=Number(jQuery(".input-text.qty").val());e||0===e||(e=1);let t=jQuery("input[name=add-to-cart]").val();wpm.addProductToCart(t,e)}}else{let e=1,t=jQuery(this).data("product_id");wpm.addProductToCart(t,e)}}catch(e){console.error(e)}})),jQuery(document).one("click","a:not(.add_to_cart_button, .ajax_add_to_cart, .single_add_to_cart_button)",(function(e){try{if(jQuery(e.target).closest("a").attr("href")){let t=jQuery(e.target).closest("a").attr("href");if(t.includes("add-to-cart=")){let e=t.match(/(add-to-cart=)(\d+)/);e&&wpm.addProductToCart(e[2],1)}}}catch(e){console.error(e)}})),jQuery(document).on("click",".woocommerce-LoopProduct-link, .wc-block-grid__product, .product, .product-small, .type-product",(function(){try{let e=jQuery(this).nextAll(".wpmProductId:first").data("id");if(e){if(e=getIdBasedOndVariationsOutputSetting(e),!e)throw Error("Wasn't able to retrieve a productId");if(wpmDataLayer.products&&wpmDataLayer.products[e]){let t=wpm.getProductDetailsFormattedForEvent(e);jQuery(document).trigger("wpmSelectContentGaUa",t),jQuery(document).trigger("wpmSelectItem",t)}}}catch(e){console.error(e)}})),jQuery(document).one("click",".checkout-button, .cart-checkout-button, .button.checkout",(function(){jQuery(document).trigger("wpmBeginCheckout")})),jQuery(document).on("input","#billing_email",(function(){wpm.isEmail(jQuery(this).val())&&(wpm.fireCheckoutProgress(2),wpm.emailSelected=!0)})),jQuery(document).on("click",".wc_payment_methods",(function(){!1===wpm.paymentMethodSelected&&wpm.fireCheckoutProgress(3),wpm.fireCheckoutOption(3,jQuery("input[name='payment_method']:checked").val()),wpm.paymentMethodSelected=!0})),jQuery(document).one("click","#place_order",(function(){!1===wpm.emailSelected&&wpm.fireCheckoutProgress(2),!1===wpm.paymentMethodSelected&&(wpm.fireCheckoutProgress(3),wpm.fireCheckoutOption(3,jQuery("input[name='payment_method']:checked").val())),wpm.fireCheckoutProgress(4)})),jQuery(document).on("click","[name='update_cart']",(function(){try{jQuery(".cart_item").each((function(){let e=new URL(jQuery(this).find(".product-remove").find("a").attr("href")),t=wpm.getProductIdByCartItemKeyUrl(e),o=jQuery(this).find(".qty").val();0===o?wpm.removeProductFromCart(t):o<wpmDataLayer.cart[t].quantity?wpm.removeProductFromCart(t,wpmDataLayer.cart[t].quantity-o):o>wpmDataLayer.cart[t].quantity&&wpm.addProductToCart(t,o-wpmDataLayer.cart[t].quantity)}))}catch(e){console.error(e),wpm.getCartItemsFromBackend()}})),jQuery(document).on("click",".add_to_wishlist, .wl-add-to",(function(){try{let e;if(jQuery(this).data("productid")?e=jQuery(this).data("productid"):jQuery(this).data("product-id")&&(e=jQuery(this).data("product-id")),!e)throw Error("Wasn't able to retrieve a productId");let t=wpm.getProductDetailsFormattedForEvent(e);jQuery(document).trigger("wpmAddToWishlist",t)}catch(e){console.error(e)}})),jQuery(document).on("updated_cart_totals",(function(){jQuery(document).trigger("wpmViewCart")})),jQuery(".single_variation_wrap").on("show_variation",(function(e,t){try{let e=getIdBasedOndVariationsOutputSetting(t.variation_id);if(!e)throw Error("Wasn't able to retrieve a productId");if(wpmDataLayer.products&&wpmDataLayer.products[e]){let t=wpm.getProductDetailsFormattedForEvent(e);jQuery(document).trigger("wpmViewItem",t)}}catch(e){console.error(e)}})),jQuery(".single_variation_wrap").on("hide_variation",(function(){try{var e,t;let o=jQuery("body").attr("class").match(/(postid-)(\d+)/)[2];if(!o)throw Error("Wasn't able to retrieve a productId");if("variable"===wpmDataLayer.shop.product_type&&null!==(e=wpmDataLayer)&&void 0!==e&&null!==(t=e.general)&&void 0!==t&&t.variationsOutput)for(const[e,t]of Object.entries(wpmDataLayer.products))if("parentId"in t){o=t.id;break}if(wpmDataLayer.products&&wpmDataLayer.products[o]){let e=wpm.getProductDetailsFormattedForEvent(o);jQuery(document).trigger("wpmViewItem",e)}}catch(e){console.error(e)}}))})),jQuery(window).on("wpmLoad",(function(){try{wpm.doesWooCommerceCartExist()&&wpm.getCartItems()}catch(e){console.error(e)}})),jQuery(window).on("wpmLoad",(function(){wpmDataLayer.products=wpmDataLayer.products||{};let e=wpm.getAddToCartLinkProductIds();wpm.getProductsFromBackend(e)})),jQuery(window).on("wpmLoad",(function(){if(!wpm.getCookie("wpmReferrer"))if(document.referrer){let e=new URL(document.referrer).hostname;e!==window.location.host?wpm.setCookie("wpmReferrer",e):wpm.setCookie("wpmReferrer","")}else wpm.setCookie("wpmReferrer","")})),jQuery(window).on("wpmLoad",(function(){try{var e;if("undefined"!=typeof wpmDataLayer&&(null===(e=wpmDataLayer)||void 0===e||!e.wpmLoadFired)){var t,o;if(jQuery(document).trigger("wpmLoadAlways"),"product"===wpmDataLayer.shop.page_type&&"variable"!==wpmDataLayer.shop.product_type&&wpm.getMainProductIdFromProductPage()){let e=wpm.getProductDataForViewItemEvent(wpm.getMainProductIdFromProductPage());jQuery(document).trigger("wpmViewItem",e)}else"product_category"===wpmDataLayer.shop.page_type?jQuery(document).trigger("wpmCategory"):"search"===wpmDataLayer.shop.page_type?jQuery(document).trigger("wpmSearch"):"cart"===wpmDataLayer.shop.page_type?jQuery(document).trigger("wpmViewCart"):"order_received_page"===wpmDataLayer.shop.page_type&&wpmDataLayer.order?wpm.isOrderIdStored(wpmDataLayer.order.id)||(jQuery(document).trigger("wpmOrderReceivedPage"),wpm.writeOrderIdToStorage(wpmDataLayer.order.id)):jQuery(document).trigger("wpmEverywhereElse");null!==(t=wpmDataLayer)&&void 0!==t&&null!==(o=t.user)&&void 0!==o&&o.id&&!wpm.hasLoginEventFired()&&(jQuery(document).trigger("wpmLogin"),wpm.setLoginEventFired()),wpmDataLayer.wpmLoadFired=!0}}catch(e){console.error(e)}})),jQuery(window).on("wpmPreLoadPixels",(function(){var e,t,o;null!==(e=wpmDataLayer)&&void 0!==e&&null!==(t=e.shop)&&void 0!==t&&null!==(o=t.cookie_consent_mgmt)&&void 0!==o&&o.explicit_consent&&wpm.updateConsentCookieValues(!0),jQuery(document).trigger("wpmLoadPixels",{})}))}},t={};function o(a){var r=t[a];if(void 0!==r)return r.exports;var n=t[a]={exports:{}};return e[a](n,n.exports,o),n.exports}o(230),o(577),o(354),o(464),o(234),o(785),o(570),o(497),o(560)})();
2
  //# sourceMappingURL=wpm-public.p1.min.js.map
js/public/wpm-public.p1.min.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"wpm-public.p1.min.js","mappings":"sBAKAA,OAAOC,UAAUC,GAAG,iBAAiB,WAAY,gBAEhC,QAAZ,EAAAC,oBAAA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6G,IAOtB5a,OAAM,UAAgB,GAz1CtB,CAu2CCA,OAAO9B,IAAM8B,OAAO9B,KAAO,GAAIR,S,cCr2CjC6F,EAAQ,M,SCMRrF,IAAIkc,qBACFnW,MAAK,WACL7D,QAAQ6P,IAAI,+BAAiCpS,aAAa2D,QAAQqZ,IAAM,MAAQ,QAAS,YAAchd,aAAa2D,QAAQmD,OAAS,WACrIjH,OAAOC,UAAU6B,QAAQ,mBAAoB,OAE7CyE,MAAK,WACL/F,IAAIsc,aAAavW,MAAK,WACrBvG,OAAOC,UAAU6B,QAAQ,UAAW,UAWvCtB,IAAIwc,YAAYzW,MAAK,WAMpB/F,IAAIkc,qBACFnW,MAAK,WAEL/F,IAAI+U,mCAGJ/U,IAAI0V,+CC1CHkH,EAA2B,GAG/B,SAASC,EAAoBC,GAE5B,IAAIC,EAAeH,EAAyBE,GAC5C,QAAqBna,IAAjBoa,EACH,OAAOA,EAAaC,QAGrB,IAAIC,EAASL,EAAyBE,GAAY,CAGjDE,QAAS,IAOV,OAHAE,EAAoBJ,GAAUG,EAAQA,EAAOD,QAASH,GAG/CI,EAAOD,QCjBf3X,EAAQ,KAGRrF,IAAIoc,eAAerW,MAAK,WAEvBV,EAAQ,KAERA,EAAQ,IACRA,EAAQ,IACRA,EAAQ,KAuBRA,EAAQ,S","sources":["webpack://WooCommerce-Pixel-Manager/./src/js/public/facebook/event_listeners.js","webpack://WooCommerce-Pixel-Manager/./src/js/public/facebook/functions.js","webpack://WooCommerce-Pixel-Manager/./src/js/public/facebook/loader.js","webpack://WooCommerce-Pixel-Manager/./src/js/public/google/ads/event_listeners.js","webpack://WooCommerce-Pixel-Manager/./src/js/public/google/ads/functions.js","webpack://WooCommerce-Pixel-Manager/./src/js/public/google/ads/loader.js","webpack://WooCommerce-Pixel-Manager/./src/js/public/google/analytics/ga3/event_listeners.js","webpack://WooCommerce-Pixel-Manager/./src/js/public/google/analytics/ga3/functions.js","webpack://WooCommerce-Pixel-Manager/./src/js/public/google/analytics/ga3/loader.js","webpack://WooCommerce-Pixel-Manager/./src/js/public/google/analytics/ga4/event_listeners.js","webpack://WooCommerce-Pixel-Manager/./src/js/public/google/analytics/ga4/functions.js","webpack://WooCommerce-Pixel-Manager/./src/js/public/google/analytics/ga4/loader.js","webpack://WooCommerce-Pixel-Manager/./src/js/public/google/analytics/loader.js","webpack://WooCommerce-Pixel-Manager/./src/js/public/google/base/event_listeners.js","webpack://WooCommerce-Pixel-Manager/./src/js/public/google/base/functions.js","webpack://WooCommerce-Pixel-Manager/./src/js/public/google/base/loader.js","webpack://WooCommerce-Pixel-Manager/./src/js/public/google/loader.js","webpack://WooCommerce-Pixel-Manager/./src/js/public/google/optimize/event_listeners.js","webpack://WooCommerce-Pixel-Manager/./src/js/public/google/optimize/functions.js","webpack://WooCommerce-Pixel-Manager/./src/js/public/google/optimize/loader.js","webpack://WooCommerce-Pixel-Manager/./src/js/public/hotjar/event_listeners.js","webpack://WooCommerce-Pixel-Manager/./src/js/public/hotjar/functions.js","webpack://WooCommerce-Pixel-Manager/./src/js/public/hotjar/loader.js","webpack://WooCommerce-Pixel-Manager/./src/js/public/wpm/event_listeners.js","webpack://WooCommerce-Pixel-Manager/./src/js/public/wpm/functions.js","webpack://WooCommerce-Pixel-Manager/./src/js/public/wpm/functions_loader.js","webpack://WooCommerce-Pixel-Manager/./src/js/public/wpm/init.js","webpack://WooCommerce-Pixel-Manager/webpack/bootstrap","webpack://WooCommerce-Pixel-Manager/./src/js/public/main.js"],"sourcesContent":["/**\n * All event listeners\n * */\n\n// Load pixel event\njQuery(document).on(\"wpmLoadPixels\", function () {\n\n\tif (wpmDataLayer?.pixels?.facebook?.pixel_id && !wpmDataLayer?.pixels?.facebook?.loaded) {\n\t\tif (wpm.canIFire(\"ads\", \"facebook-ads\")) wpm.loadFacebookPixel()\n\t}\n})\n\n// AddToCart event\njQuery(document).on(\"wpmAddToCart\", function (event, product) {\n\n\ttry {\n\t\tif (!wpmDataLayer?.pixels?.facebook?.loaded) return\n\n\t\tlet eventId = wpm.getRandomEventId()\n\n\t\t// console.log('eventId: ' + eventId);\n\n\t\tfbq(\"track\", \"AddToCart\", {\n\t\t\tcontent_type: \"product\",\n\t\t\tcontent_name: product.name,\n\t\t\tcontent_ids : product.dyn_r_ids[wpmDataLayer.pixels.facebook.dynamic_remarketing.id_type],\n\t\t\tvalue : parseFloat(product.quantity * product.price),\n\t\t\tcurrency : product.currency,\n\t\t}, {\n\t\t\teventID: eventId,\n\t\t})\n\n\n\t\tproduct[\"currency\"] = wpmDataLayer.shop.currency\n\n\t\tjQuery(document).trigger(\"wpmFbCapiEvent\", {\n\t\t\tevent_name : \"AddToCart\",\n\t\t\tevent_id : eventId,\n\t\t\tuser_data : wpm.getFbUserData(),\n\t\t\tproduct_data : product,\n\t\t\tproduct_id : product.dyn_r_ids[wpmDataLayer.pixels.facebook.dynamic_remarketing.id_type],\n\t\t\tevent_source_url: window.location.href,\n\t\t})\n\t} catch (e) {\n\t\tconsole.error(e)\n\t}\n})\n\n// InitiateCheckout event\njQuery(document).on(\"wpmBeginCheckout\", function (event) {\n\n\ttry {\n\t\t// console.log('firing facebook ads InitiateCheckout event');\n\n\t\tif (!wpmDataLayer?.pixels?.facebook?.loaded) return\n\n\t\tlet eventId = wpm.getRandomEventId()\n\n\t\tfbq(\"track\", \"InitiateCheckout\", {}, {\n\t\t\teventID: eventId,\n\t\t})\n\n\t\tjQuery(document).trigger(\"wpmFbCapiEvent\", {\n\t\t\tevent_name : \"InitiateCheckout\",\n\t\t\tevent_id : eventId,\n\t\t\tuser_data : wpm.getFbUserData(),\n\t\t\tevent_source_url: window.location.href,\n\t\t})\n\t} catch (e) {\n\t\tconsole.error(e)\n\t}\n})\n\n// AddToWishlist event\njQuery(document).on(\"wpmAddToWishlist\", function (event, product) {\n\n\ttry {\n\t\t// console.log('firing facebook ads AddToWishlist event');\n\t\t// console.log(product);\n\n\t\tif (!wpmDataLayer?.pixels?.facebook?.loaded) return\n\n\t\tlet eventId = wpm.getRandomEventId()\n\n\t\tfbq(\"track\", \"AddToWishlist\", {\n\t\t\tcontent_type: \"product\",\n\t\t\tcontent_name: product.name,\n\t\t\tcontent_ids : product.dyn_r_ids[wpmDataLayer.pixels.facebook.dynamic_remarketing.id_type],\n\t\t\tvalue : parseFloat(product.quantity * product.price),\n\t\t\tcurrency : product.currency,\n\t\t}, {\n\t\t\teventID: eventId,\n\t\t})\n\n\n\t\tproduct[\"currency\"] = wpmDataLayer.shop.currency\n\n\t\tjQuery(document).trigger(\"wpmFbCapiEvent\", {\n\t\t\tevent_name : \"AddToWishlist\",\n\t\t\tevent_id : eventId,\n\t\t\tuser_data : wpm.getFbUserData(),\n\t\t\tproduct_data : product,\n\t\t\tproduct_id : product.dyn_r_ids[wpmDataLayer.pixels.facebook.dynamic_remarketing.id_type],\n\t\t\tevent_source_url: window.location.href,\n\t\t})\n\t} catch (e) {\n\t\tconsole.error(e)\n\t}\n})\n\n// ViewContent event\njQuery(document).on(\"wpmViewItem\", function (event, product) {\n\n\ttry {\n\t\t// console.log('firing facebook ads ViewContent event');\n\t\t// console.log(product);\n\n\t\tif (!wpmDataLayer?.pixels?.facebook?.loaded) return\n\n\t\twpm.fbViewContent(product)\n\t} catch (e) {\n\t\tconsole.error(e)\n\t}\n})\n\n// view search event\njQuery(document).on(\"wpmSearch\", function () {\n\n\ttry {\n\t\tif (!wpmDataLayer?.pixels?.facebook?.loaded) return\n\n\t\tlet eventId = wpm.getRandomEventId()\n\n\t\tfbq(\"track\", \"Search\", {}, {\n\t\t\teventID: eventId,\n\t\t})\n\n\t\tjQuery(document).trigger(\"wpmFbCapiEvent\", {\n\t\t\tevent_name : \"Search\",\n\t\t\tevent_id : eventId,\n\t\t\tuser_data : wpm.getFbUserData(),\n\t\t\tevent_source_url: window.location.href,\n\t\t})\n\t} catch (e) {\n\t\tconsole.error(e)\n\t}\n})\n\n// load always event\njQuery(document).on(\"wpmLoadAlways\", function () {\n\n\ttry {\n\t\tif (!wpmDataLayer?.pixels?.facebook?.loaded) return\n\n\t\twpm.setFbUserData()\n\t} catch (e) {\n\t\tconsole.error(e)\n\t}\n})\n\n// view order received page event\n// https://developers.pinterest.com/docs/tag/conversion/\njQuery(document).on(\"wpmOrderReceivedPage\", function () {\n\n\ttry {\n\t\tif (!wpmDataLayer?.pixels?.facebook?.loaded) return\n\n\t\tfbq(\"track\", \"Purchase\",\n\t\t\t{\n\t\t\t\tcontent_type: \"product\",\n\t\t\t\tvalue : wpmDataLayer.order.value_filtered,\n\t\t\t\tcurrency : wpmDataLayer.order.currency,\n\t\t\t\tcontent_ids : wpm.facebookContentIds(),\n\t\t\t},\n\t\t\t{eventID: wpmDataLayer.order.id},\n\t\t)\n\n\n\t\t// console.log(wpm.facebookContentIds())\n\t} catch (e) {\n\t\tconsole.error(e)\n\t}\n})\n","/**\n * Add functions for Facebook\n * */\n\n(function (wpm, $, undefined) {\n\n\tlet fBUserData\n\n\twpm.loadFacebookPixel = function () {\n\n\t\ttry {\n\t\t\twpmDataLayer.pixels.facebook.loaded = true\n\n\t\t\t// @formatter:off\n\t\t\t!function(f,b,e,v,n,t,s)\n\t\t\t{if(f.fbq)return;n=f.fbq=function(){n.callMethod?\n\t\t\t\tn.callMethod.apply(n,arguments):n.queue.push(arguments)};\n\t\t\t\tif(!f._fbq)f._fbq=n;n.push=n;n.loaded=!0;n.version='2.0';\n\t\t\t\tn.queue=[];t=b.createElement(e);t.async=!0;\n\t\t\t\tt.src=v;s=b.getElementsByTagName(e)[0];\n\t\t\t\ts.parentNode.insertBefore(t,s)}(window, document,'script',\n\t\t\t\t'https://connect.facebook.net/en_US/fbevents.js');\n\t\t\t// @formatter:on\n\n\t\t\tfbq(\"init\", wpmDataLayer.pixels.facebook.pixel_id)\n\t\t\tfbq(\"track\", \"PageView\")\n\n\t\t} catch (e) {\n\t\t\tconsole.error(e)\n\t\t}\n\t}\n\n\twpm.getRandomEventId = function () {\n\t\treturn (Math.random() + 1).toString(36).substring(2)\n\t}\n\n\twpm.getFbUserData = function () {\n\t\t// We need the first one for InitiateCheckout\n\t\t// where getting the user_data from the browser is too slow\n\t\t// using wpm.getCookie(), so we cache the user_data earlier.\n\t\t// And we need the second one because the ViewContent hit happens too fast\n\t\t// after adding a variation to the cart because the function to cache\n\t\t// the user_data is too slow. But we can get the user_data using wpm.getCookie()\n\t\t// because we don't move away from the page and can wait for the browser\n\t\t// to get it.\n\t\tif (fBUserData) {\n\t\t\treturn fBUserData\n\t\t} else {\n\t\t\treturn wpm.getFbUserDataFromBrowser()\n\t\t}\n\t}\n\n\twpm.setFbUserData = function () {\n\t\tfBUserData = wpm.getFbUserDataFromBrowser()\n\t}\n\n\twpm.getFbUserDataFromBrowser = function () {\n\t\treturn {\n\t\t\tfbp : wpm.getCookie(\"_fbp\"),\n\t\t\tfbc : wpm.getCookie(\"_fbc\"),\n\t\t\tclient_user_agent: navigator.userAgent,\n\t\t}\n\t}\n\n\twpm.fbViewContent = function (product) {\n\n\t\ttry {\n\t\t\tif (!wpmDataLayer?.pixels?.facebook?.loaded) return\n\n\t\t\tlet eventId = wpm.getRandomEventId()\n\n\t\t\tfbq(\"track\", \"ViewContent\", {\n\t\t\t\tcontent_type: \"product\",\n\t\t\t\tcontent_name: product.name,\n\t\t\t\t// content_category: product.category,\n\t\t\t\tcontent_ids: product.dyn_r_ids[wpmDataLayer.pixels.facebook.dynamic_remarketing.id_type],\n\t\t\t\tcurrency : wpmDataLayer.shop.currency,\n\t\t\t\tvalue : product.price,\n\t\t\t}, {\n\t\t\t\teventID: eventId,\n\t\t\t})\n\n\t\t\tproduct[\"currency\"] = wpmDataLayer.shop.currency\n\n\t\t\tjQuery(document).trigger(\"wpmFbCapiEvent\", {\n\t\t\t\tevent_name : \"ViewContent\",\n\t\t\t\tevent_id : eventId,\n\t\t\t\tuser_data : wpm.getFbUserData(),\n\t\t\t\tproduct_data : product,\n\t\t\t\tproduct_id : product.dyn_r_ids[wpmDataLayer.pixels.facebook.dynamic_remarketing.id_type],\n\t\t\t\tevent_source_url: window.location.href,\n\t\t\t})\n\t\t} catch (e) {\n\t\t\tconsole.error(e)\n\t\t}\n\t}\n\n\twpm.facebookContentIds = function () {\n\t\tlet prodIds = []\n\n\t\tfor (const [key, item] of Object.entries(wpmDataLayer.order.items)) {\n\n\t\t\tif (wpmDataLayer?.general?.variationsOutput && 0 !== item.variation_id) {\n\t\t\t\tprodIds.push(String(wpmDataLayer.products[item.variation_id].dyn_r_ids[wpmDataLayer.pixels.facebook.dynamic_remarketing.id_type]))\n\t\t\t} else {\n\t\t\t\tprodIds.push(String(wpmDataLayer.products[item.id].dyn_r_ids[wpmDataLayer.pixels.facebook.dynamic_remarketing.id_type]))\n\t\t\t}\n\t\t}\n\n\t\treturn prodIds\n\t}\n\n}(window.wpm = window.wpm || {}, jQuery));\n","/**\n * Facebook loader\n */\n\nrequire(\"./functions\")\nrequire(\"./event_listeners\")\n\n// #if process.env.TIER === 'premium'\n// require(\"./functions_premium\")\n// require(\"./event_listeners_premium\")\n// #endif\n\n","/**\n * Load Google Ads event listeners\n * */\n\n// view_item_list event\njQuery(document).on(\"wpmViewItemList\", function (event, product) {\n\n\ttry {\n\t\tif(jQuery.isEmptyObject(wpmDataLayer?.pixels?.google?.ads?.conversionIds)) return\n\t\tif (!wpmDataLayer?.pixels?.google?.ads?.dynamic_remarketing?.status) return\n\t\tif (!wpm.googleConfigConditionsMet(\"ads\")) return\n\n\n\t\tif (\n\t\t\twpmDataLayer?.general?.variationsOutput &&\n\t\t\tproduct.isVariable &&\n\t\t\twpmDataLayer.pixels.google.ads.dynamic_remarketing.send_events_with_parent_ids === false\n\t\t) return\n\n\t\t// try to prevent that WC sends cached hits to Google\n\t\tif (!product) return\n\n\t\twpm.gtagLoaded().then(function () {\n\t\t\tgtag(\"event\", \"view_item_list\", {\n\t\t\t\tsend_to: wpm.getGoogleAdsConversionIdentifiers(),\n\t\t\t\titems : [{\n\t\t\t\t\tid : product.dyn_r_ids[wpmDataLayer.pixels.google.ads.dynamic_remarketing.id_type],\n\t\t\t\t\tgoogle_business_vertical: wpmDataLayer.pixels.google.ads.google_business_vertical,\n\t\t\t\t}],\n\t\t\t})\n\t\t})\n\t} catch (e) {\n\t\tconsole.error(e)\n\t}\n})\n\n// add_to_cart event\njQuery(document).on(\"wpmAddToCart\", function (event, product) {\n\n\ttry {\n\t\tif(jQuery.isEmptyObject(wpmDataLayer?.pixels?.google?.ads?.conversionIds)) return\n\t\tif (!wpmDataLayer?.pixels?.google?.ads?.dynamic_remarketing?.status) return\n\t\tif (!wpm.googleConfigConditionsMet(\"ads\")) return\n\n\t\twpm.gtagLoaded().then(function () {\n\t\t\tgtag(\"event\", \"add_to_cart\", {\n\t\t\t\tsend_to: wpm.getGoogleAdsConversionIdentifiers(),\n\t\t\t\tvalue : product.quantity * product.price,\n\t\t\t\titems : [{\n\t\t\t\t\tid : product.dyn_r_ids[wpmDataLayer.pixels.google.ads.dynamic_remarketing.id_type],\n\t\t\t\t\tquantity : product.quantity,\n\t\t\t\t\tprice : product.price,\n\t\t\t\t\tgoogle_business_vertical: wpmDataLayer.pixels.google.ads.google_business_vertical,\n\t\t\t\t}],\n\t\t\t})\n\t\t})\n\t} catch (e) {\n\t\tconsole.error(e)\n\t}\n})\n\n// view_item event\njQuery(document).on(\"wpmViewItem\", function (event, product) {\n\n\ttry {\n\t\tif(jQuery.isEmptyObject(wpmDataLayer?.pixels?.google?.ads?.conversionIds)) return\n\t\tif (!wpmDataLayer?.pixels?.google?.ads?.dynamic_remarketing?.status) return\n\t\tif (!wpm.googleConfigConditionsMet(\"ads\")) return\n\n\n\t\twpm.gtagLoaded().then(function () {\n\t\t\tgtag(\"event\", \"view_item\", {\n\t\t\t\tsend_to: wpm.getGoogleAdsConversionIdentifiers(),\n\t\t\t\tvalue : (product.quantity ? product.quantity : 1) * product.price,\n\t\t\t\titems : [{\n\t\t\t\t\tid : product.dyn_r_ids[wpmDataLayer.pixels.google.ads.dynamic_remarketing.id_type],\n\t\t\t\t\tquantity : (product.quantity ? product.quantity : 1),\n\t\t\t\t\tprice : product.price,\n\t\t\t\t\tgoogle_business_vertical: wpmDataLayer.pixels.google.ads.google_business_vertical,\n\t\t\t\t}],\n\t\t\t})\n\t\t})\n\t} catch (e) {\n\t\tconsole.error(e)\n\t}\n})\n\n\n// view search event\njQuery(document).on(\"wpmSearch\", function () {\n\n\ttry {\n\t\tif(jQuery.isEmptyObject(wpmDataLayer?.pixels?.google?.ads?.conversionIds)) return\n\t\tif (!wpmDataLayer?.pixels?.google?.ads?.dynamic_remarketing?.status) return\n\t\tif (!wpm.googleConfigConditionsMet(\"ads\")) return\n\n\n\t\tlet products = []\n\n\t\tfor (const [key, product] of Object.entries(wpmDataLayer.products)) {\n\n\t\t\tif (\n\t\t\t\twpmDataLayer?.general?.variationsOutput &&\n\t\t\t\tproduct.isVariable &&\n\t\t\t\twpmDataLayer.pixels.google.ads.dynamic_remarketing.send_events_with_parent_ids === false\n\t\t\t) return\n\n\t\t\tproducts.push({\n\t\t\t\tid : product.dyn_r_ids[wpmDataLayer.pixels.google.ads.dynamic_remarketing.id_type],\n\t\t\t\tgoogle_business_vertical: wpmDataLayer.pixels.google.ads.google_business_vertical,\n\t\t\t})\n\t\t}\n\n\t\t// console.log(products);\n\n\t\twpm.gtagLoaded().then(function () {\n\t\t\tgtag(\"event\", \"view_search_results\", {\n\t\t\t\tsend_to: wpm.getGoogleAdsConversionIdentifiers(),\n\t\t\t\t// value : 1 * product.price,\n\t\t\t\titems: products,\n\t\t\t})\n\t\t})\n\t} catch (e) {\n\t\tconsole.error(e)\n\t}\n})\n\n\n// view order received page event\n// TODO distinguish with or without cart data active\njQuery(document).on(\"wpmOrderReceivedPage\", function () {\n\n\ttry {\n\t\tif(jQuery.isEmptyObject(wpmDataLayer?.pixels?.google?.ads?.conversionIds)) return\n\t\tif (!wpmDataLayer?.pixels?.google?.ads?.dynamic_remarketing?.status) return\n\t\tif (!wpm.googleConfigConditionsMet(\"ads\")) return\n\n\t\twpm.gtagLoaded().then(function () {\n\t\t\tgtag(\"event\", \"purchase\", {\n\t\t\t\tsend_to: wpm.getGoogleAdsConversionIdentifiers(),\n\t\t\t\tvalue : wpmDataLayer.order.value_filtered,\n\t\t\t\titems : wpm.getGoogleAdsDynamicRemarketingOrderItems(),\n\t\t\t})\n\t\t})\n\n\t\t// console.log(wpm.getGoogleAdsDynamicRemarketingOrderItems())\n\t} catch (e) {\n\t\tconsole.error(e)\n\t}\n})\n\n// user log in event\njQuery(document).on(\"wpmLogin\", function () {\n\n\ttry {\n\t\tif(jQuery.isEmptyObject(wpmDataLayer?.pixels?.google?.ads?.conversionIds)) return\n\t\tif (!wpmDataLayer?.pixels?.google?.ads?.dynamic_remarketing?.status) return\n\t\tif (!wpm.googleConfigConditionsMet(\"ads\")) return\n\n\n\t\twpm.gtagLoaded().then(function () {\n\t\t\tgtag(\"event\", \"login\", {\n\t\t\t\tsend_to: wpm.getGoogleAdsConversionIdentifiers(),\n\t\t\t})\n\t\t})\n\t} catch (e) {\n\t\tconsole.error(e)\n\t}\n})\n\n// view order received page event\n// new_customer parameter: https://support.google.com/google-ads/answer/9917012\njQuery(document).on(\"wpmOrderReceivedPage\", function () {\n\n\ttry {\n\t\tif(jQuery.isEmptyObject(wpmDataLayer?.pixels?.google?.ads?.conversionIds)) return\n\t\tif (!wpm.googleConfigConditionsMet(\"ads\")) return\n\n\t\tlet data_basic = {}\n\t\tlet data_with_cart = {}\n\n\t\tdata_basic = {\n\t\t\tsend_to : wpm.getGoogleAdsConversionIdentifiersWithLabel(),\n\t\t\ttransaction_id: wpmDataLayer.order.number,\n\t\t\tvalue : wpmDataLayer.order.value_filtered,\n\t\t\tcurrency : wpmDataLayer.order.currency,\n\t\t\tnew_customer : wpmDataLayer.order.new_customer,\n\t\t}\n\n\t\tif (wpmDataLayer?.order?.aw_merchant_id) {\n\t\t\tdata_with_cart = {\n\t\t\t\tdiscount : wpmDataLayer.order.discount,\n\t\t\t\taw_merchant_id : wpmDataLayer.order.aw_merchant_id,\n\t\t\t\taw_feed_country : wpmDataLayer.order.aw_feed_country,\n\t\t\t\taw_feed_language: wpmDataLayer.order.aw_feed_language,\n\t\t\t\titems : wpm.getGoogleAdsRegularOrderItems(),\n\t\t\t}\n\t\t}\n\n\t\twpm.gtagLoaded().then(function () {\n\t\t\tgtag(\"event\", \"conversion\", {...data_basic, ...data_with_cart})\n\t\t})\n\n\t\t// console.log({...data_basic,...data_with_cart})\n\n\t\t// console.log(wpm.getGoogleAdsOrderItems())\n\t} catch (e) {\n\t\tconsole.error(e)\n\t}\n})\n\n\n\n\n\n","/**\n * Load Google Ads functions\n * */\n\n(function (wpm, $, undefined) {\n\n\tlet conversionIdentifiers = []\n\n\twpm.getGoogleAdsConversionIdentifiersWithLabel = function () {\n\t\tfor (const [key, item] of Object.entries(wpmDataLayer.pixels.google.ads.conversionIds)) {\n\t\t\tconversionIdentifiers.push(key + \"/\" + item)\n\t\t}\n\t\treturn conversionIdentifiers\n\t}\n\n\twpm.getGoogleAdsConversionIdentifiers = function () {\n\n\t\tlet conversionIdentifiers = []\n\t\tfor (const [key, item] of Object.entries(wpmDataLayer.pixels.google.ads.conversionIds)) {\n\t\t\tconversionIdentifiers.push(key)\n\t\t}\n\n\t\treturn conversionIdentifiers\n\t}\n\n\twpm.getGoogleAdsRegularOrderItems = function () {\n\t\t// \"id\" : \"gla_34\",\n\t\t// \"quantity\": 1,\n\t\t// \"price\" : 45\n\n\t\tlet orderItems = []\n\n\t\tfor (const [key, item] of Object.entries(wpmDataLayer.order.items)) {\n\n\t\t\tlet orderItem\n\n\t\t\torderItem = {\n\t\t\t\tquantity: item.quantity,\n\t\t\t\tprice : item.price,\n\t\t\t}\n\n\t\t\tif (wpmDataLayer?.general?.variationsOutput && 0 !== item.variation_id) {\n\n\t\t\t\torderItem.id = String(wpmDataLayer.products[item.variation_id].dyn_r_ids[wpmDataLayer.pixels.google.ads.dynamic_remarketing.id_type])\n\t\t\t\torderItems.push(orderItem)\n\t\t\t} else {\n\n\t\t\t\torderItem.id = String(wpmDataLayer.products[item.id].dyn_r_ids[wpmDataLayer.pixels.google.ads.dynamic_remarketing.id_type])\n\t\t\t\torderItems.push(orderItem)\n\t\t\t}\n\t\t}\n\n\t\treturn orderItems\n\t}\n\n\twpm.getGoogleAdsDynamicRemarketingOrderItems = function () {\n\t\t// \"id\" : \"gla_34\",\n\t\t// \"quantity\" : 1,\n\t\t// \"price\" : 45,\n\t\t// \"google_business_vertical\": \"retail\"\n\n\t\tlet orderItems = []\n\n\t\tfor (const [key, item] of Object.entries(wpmDataLayer.order.items)) {\n\n\t\t\tlet orderItem\n\n\t\t\torderItem = {\n\t\t\t\tquantity : item.quantity,\n\t\t\t\tprice : item.price,\n\t\t\t\tgoogle_business_vertical: wpmDataLayer.pixels.google.ads.google_business_vertical,\n\t\t\t}\n\n\t\t\tif (wpmDataLayer?.general?.variationsOutput && 0 !== item.variation_id) {\n\n\t\t\t\torderItem.id = String(wpmDataLayer.products[item.variation_id].dyn_r_ids[wpmDataLayer.pixels.google.ads.dynamic_remarketing.id_type])\n\t\t\t\torderItems.push(orderItem)\n\t\t\t} else {\n\n\t\t\t\torderItem.id = String(wpmDataLayer.products[item.id].dyn_r_ids[wpmDataLayer.pixels.google.ads.dynamic_remarketing.id_type])\n\t\t\t\torderItems.push(orderItem)\n\t\t\t}\n\t\t}\n\n\t\treturn orderItems\n\t}\n\n}(window.wpm = window.wpm || {}, jQuery))\n","/**\n * Load Google Ads\n */\n\n\nrequire(\"./functions\")\nrequire(\"./event_listeners\")\n","/**\n * Load Google Universal Analytics (GA3) event listeners\n * */\n\n\n// view order received page event\njQuery(document).on(\"wpmOrderReceivedPage\", function () {\n\n\ttry {\n\t\tif (!wpmDataLayer?.pixels?.google?.analytics?.universal?.property_id) return\n\t\tif (wpmDataLayer?.pixels?.google?.analytics?.universal?.mp_active) return\n\t\tif (!wpm.googleConfigConditionsMet(\"analytics\")) return\n\n\t\twpm.gtagLoaded().then(function () {\n\t\t\tgtag(\"event\", \"purchase\", {\n\t\t\t\tsend_to : [wpmDataLayer.pixels.google.analytics.universal.property_id],\n\t\t\t\ttransaction_id: wpmDataLayer.order.number,\n\t\t\t\taffiliation : wpmDataLayer.order.affiliation,\n\t\t\t\tcurrency : wpmDataLayer.order.currency,\n\t\t\t\tvalue : wpmDataLayer.order.value_regular,\n\t\t\t\tdiscount : wpmDataLayer.order.discount,\n\t\t\t\ttax : wpmDataLayer.order.tax,\n\t\t\t\tshipping : wpmDataLayer.order.shipping,\n\t\t\t\tcoupon : wpmDataLayer.order.coupon,\n\t\t\t\titems : wpm.getGAUAOrderItems(),\n\t\t\t})\n\t\t})\n\n\t\t// console.log(wpm.getGAUAOrderItems())\n\t} catch (e) {\n\t\tconsole.error(e)\n\t}\n})\n","/**\n * Add functions for Google Analytics Universal\n * */\n\n(function (wpm, $, undefined) {\n\n\twpm.getGAUAOrderItems = function () {\n\n\t\t// \"id\" : \"34\",\n\t\t// \"name\" : \"Hoodie\",\n\t\t// \"brand\" : \"\",\n\t\t// \"category\" : \"Hoodies\",\n\t\t// \"list_position\": 1,\n\t\t// \"price\" : 45,\n\t\t// \"quantity\" : 1,\n\t\t// \"variant\" : \"Color: blue | Logo: yes\"\n\n\n\t\tlet orderItems = [],\n\t\t\tlist_position = 1\n\n\t\tfor (const [key, item] of Object.entries(wpmDataLayer.order.items)) {\n\n\t\t\tlet orderItem\n\n\t\t\torderItem = {\n\t\t\t\tquantity : item.quantity,\n\t\t\t\tprice : item.price,\n\t\t\t\tname : item.name,\n\t\t\t\tcurrency : wpmDataLayer.order.currency,\n\t\t\t\tcategory : wpmDataLayer.products[item.id].category.join(\"/\"),\n\t\t\t\tlist_position: list_position,\n\t\t\t}\n\n\t\t\tif (wpmDataLayer?.general?.variationsOutput && 0 !== item.variation_id) {\n\n\t\t\t\torderItem.id = String(wpmDataLayer.products[item.variation_id].dyn_r_ids[wpmDataLayer.pixels.google.analytics.id_type])\n\t\t\t\torderItem.variant = wpmDataLayer.products[item.variation_id].variant_name\n\t\t\t\torderItem.brand = wpmDataLayer.products[item.variation_id].brand\n\t\t\t} else {\n\n\t\t\t\torderItem.id = String(wpmDataLayer.products[item.id].dyn_r_ids[wpmDataLayer.pixels.google.analytics.id_type])\n\t\t\t\torderItem.brand = wpmDataLayer.products[item.id].brand\n\t\t\t}\n\n\t\t\torderItems.push(orderItem)\n\t\t\tlist_position++\n\t\t}\n\n\t\treturn orderItems\n\t}\n\n}(window.wpm = window.wpm || {}, jQuery))\n","/**\n * Google Universal Analytics (GA3) loader\n */\n\nrequire(\"./functions\")\nrequire(\"./event_listeners\")\n\n// #if process.env.TIER === 'premium'\n// require(\"./functions_premium\")\n// require(\"./event_listeners_premium\")\n// #endif\n","/**\n * Load GA4 event listeners\n * */\n\n\n// view order received page event\njQuery(document).on(\"wpmOrderReceivedPage\", function () {\n\n\ttry {\n\t\tif (!wpmDataLayer?.pixels?.google?.analytics?.ga4?.measurement_id) return\n\t\tif (wpmDataLayer?.pixels?.google?.analytics?.ga4?.mp_active) return\n\t\tif (!wpm.googleConfigConditionsMet(\"analytics\")) return\n\n\t\twpm.gtagLoaded().then(function () {\n\t\t\tgtag(\"event\", \"purchase\", {\n\t\t\t\tsend_to : [wpmDataLayer.pixels.google.analytics.ga4.measurement_id],\n\t\t\t\ttransaction_id: wpmDataLayer.order.number,\n\t\t\t\taffiliation : wpmDataLayer.order.affiliation,\n\t\t\t\tcurrency : wpmDataLayer.order.currency,\n\t\t\t\tvalue : wpmDataLayer.order.value_regular,\n\t\t\t\tdiscount : wpmDataLayer.order.discount,\n\t\t\t\ttax : wpmDataLayer.order.tax,\n\t\t\t\tshipping : wpmDataLayer.order.shipping,\n\t\t\t\tcoupon : wpmDataLayer.order.coupon,\n\t\t\t\titems : wpm.getGA4OrderItems(),\n\t\t\t})\n\t\t})\n\t} catch (e) {\n\t\tconsole.error(e)\n\t}\n})\n","/**\n * Load GA4 functions\n * */\n\n(function (wpm, $, undefined) {\n\n\twpm.getGA4OrderItems = function () {\n\n\t\t// \"item_id\" : \"34\",\n\t\t// \"item_name\" : \"Hoodie\",\n\t\t// \"quantity\" : 1,\n\t\t// \"item_brand\" : \"\",\n\t\t// \"item_variant\" : \"Color: blue | Logo: yes\",\n\t\t// \"price\" : 45,\n\t\t// \"currency\" : \"CHF\",\n\t\t// \"item_category\": \"Hoodies\"\n\n\n\t\tlet orderItems = []\n\n\t\tfor (const [key, item] of Object.entries(wpmDataLayer.order.items)) {\n\n\t\t\tlet orderItem\n\n\t\t\torderItem = {\n\t\t\t\tquantity : item.quantity,\n\t\t\t\tprice : item.price,\n\t\t\t\titem_name : item.name,\n\t\t\t\tcurrency : wpmDataLayer.order.currency,\n\t\t\t\titem_category: wpmDataLayer.products[item.id].category.join(\"/\"),\n\t\t\t}\n\n\t\t\tif (wpmDataLayer?.general?.variationsOutput && 0 !== item.variation_id) {\n\n\t\t\t\torderItem.item_id = String(wpmDataLayer.products[item.variation_id].dyn_r_ids[wpmDataLayer.pixels.google.analytics.id_type])\n\t\t\t\torderItem.item_variant = wpmDataLayer.products[item.variation_id].variant_name\n\t\t\t\torderItem.item_brand = wpmDataLayer.products[item.variation_id].brand\n\t\t\t} else {\n\n\t\t\t\torderItem.item_id = String(wpmDataLayer.products[item.id].dyn_r_ids[wpmDataLayer.pixels.google.analytics.id_type])\n\t\t\t\torderItem.item_brand = wpmDataLayer.products[item.id].brand\n\t\t\t}\n\n\t\t\torderItems.push(orderItem)\n\t\t}\n\n\t\treturn orderItems\n\t}\n\n}(window.wpm = window.wpm || {}, jQuery))\n","/**\n * GA4 loader\n */\n\nrequire(\"./functions\")\nrequire(\"./event_listeners\")\n\n// #if process.env.TIER === 'premium'\n// require(\"./functions_premium\")\n// require(\"./event_listeners_premium\")\n// #endif\n","/**\n * Google Analytics loader\n */\n\nrequire(\"./ga3/loader\")\nrequire(\"./ga4/loader\")\n","/**\n * Load Google base event listeners\n */\n\n// Pixel load event listener\njQuery(document).on(\"wpmLoadPixels\", function () {\n\n\tif (typeof wpmDataLayer?.pixels?.google?.state === \"undefined\") {\n\t\tif (wpm.canGoogleLoad()) {\n\t\t\twpm.loadGoogle()\n\t\t} else {\n\t\t\twpm.logPreventedPixelLoading(\"google\", \"analytics / ads\")\n\t\t}\n\t}\n})\n","/**\n * Load Google base functions\n */\n\n(function (wpm, $, undefined) {\n\n\twpm.googleConfigConditionsMet = function (type) {\n\t\t// always returns true if Google Consent Mode is active\n\t\tif (wpmDataLayer?.pixels?.google?.consent_mode?.active) {\n\t\t\treturn true\n\t\t} else if (wpm.getConsentValues().mode === \"category\") {\n\t\t\treturn wpm.getConsentValues().categories[type] === true\n\t\t} else if (wpm.getConsentValues().mode === \"pixel\") {\n\t\t\treturn wpm.getConsentValues().pixels.includes(\"google-\" + type)\n\t\t} else {\n\t\t\treturn false\n\t\t}\n\t}\n\n\twpm.getVisitorConsentStatusAndUpdateGoogleConsentSettings = function (google_consent_settings) {\n\n\t\tif (wpm.getConsentValues().mode === \"category\") {\n\t\t\tif (wpm.getConsentValues().categories.analytics) google_consent_settings.analytics_storage = \"granted\"\n\t\t\tif (wpm.getConsentValues().categories.ads) google_consent_settings.ad_storage = \"granted\"\n\t\t} else if ((wpm.getConsentValues().mode === \"pixel\")) {\n\t\t\tgoogle_consent_settings.analytics_storage = wpm.getConsentValues().pixels.includes(\"google-analytics\") ? \"granted\" : \"denied\"\n\t\t\tgoogle_consent_settings.ad_storage = wpm.getConsentValues().pixels.includes(\"google-ads\") ? \"granted\" : \"denied\"\n\t\t}\n\n\t\treturn google_consent_settings\n\t}\n\n\twpm.updateGoogleConsentMode = function (analytics = true, ads = true) {\n\n\t\ttry {\n\t\t\tif (\n\t\t\t\t!window.gtag ||\n\t\t\t\t!wpmDataLayer.shop.cookie_consent_mgmt.explicit_consent\n\t\t\t) return\n\n\t\t\tgtag(\"consent\", \"update\", {\n\t\t\t\tanalytics_storage: analytics ? \"granted\" : \"denied\",\n\t\t\t\tad_storage : ads ? \"granted\" : \"denied\",\n\t\t\t})\n\t\t} catch (e) {\n\t\t\tconsole.error(e)\n\t\t}\n\t}\n\n\twpm.fireGtagGoogleAds = function () {\n\t\ttry {\n\t\t\twpmDataLayer.pixels.google.ads.state = \"loading\"\n\n\t\t\tif (wpmDataLayer?.pixels?.google?.ads?.enhanced_conversions?.active) {\n\t\t\t\tfor (const [key, item] of Object.entries(wpmDataLayer.pixels.google.ads.conversionIds)) {\n\t\t\t\t\tgtag(\"config\", key, {\"allow_enhanced_conversions\": true})\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tfor (const [key, item] of Object.entries(wpmDataLayer.pixels.google.ads.conversionIds)) {\n\t\t\t\t\tgtag(\"config\", key)\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (wpmDataLayer?.pixels?.google?.ads?.conversionIds && wpmDataLayer?.pixels?.google?.ads?.phone_conversion_label && wpmDataLayer?.pixels?.google?.ads?.phone_conversion_number) {\n\t\t\t\tgtag(\"config\", Object.keys(wpmDataLayer.pixels.google.ads.conversionIds)[0] + \"/\" + wpmDataLayer.pixels.google.ads.phone_conversion_label, {\n\t\t\t\t\tphone_conversion_number: wpmDataLayer.pixels.google.ads.phone_conversion_number,\n\t\t\t\t})\n\t\t\t}\n\n\t\t\t// ! enhanced_conversion_data needs to be var\n\t\t\t// https://support.google.com/google-ads/answer/9888145#zippy=%2Cvalidate-your-implementation-using-chrome-developer-tools\n\t\t\tif (\"order_received_page\" === wpmDataLayer.shop.page_type && wpmDataLayer?.order?.google?.ads?.enhanced_conversion_data) {\n\t\t\t\twindow.enhanced_conversion_data = wpmDataLayer.order.google.ads.enhanced_conversion_data\n\t\t\t}\n\n\t\t\twpmDataLayer.pixels.google.ads.state = \"ready\"\n\t\t} catch (e) {\n\t\t\tconsole.error(e)\n\t\t}\n\t}\n\n\twpm.fireGtagGoogleAnalyticsUA = function () {\n\t\ttry {\n\t\t\twpmDataLayer.pixels.google.analytics.universal.state = \"loading\"\n\n\t\t\tgtag(\"config\", wpmDataLayer.pixels.google.analytics.universal.property_id, wpmDataLayer.pixels.google.analytics.universal.parameters)\n\t\t\twpmDataLayer.pixels.google.analytics.universal.state = \"ready\"\n\t\t} catch (e) {\n\t\t\tconsole.error(e)\n\t\t}\n\t}\n\n\twpm.fireGtagGoogleAnalyticsGA4 = function () {\n\t\ttry {\n\t\t\twpmDataLayer.pixels.google.analytics.ga4.state = \"loading\"\n\n\t\t\tgtag(\"config\", wpmDataLayer.pixels.google.analytics.ga4.measurement_id, wpmDataLayer.pixels.google.analytics.ga4.parameters)\n\t\t\twpmDataLayer.pixels.google.analytics.ga4.state = \"ready\"\n\t\t} catch (e) {\n\t\t\tconsole.error(e)\n\t\t}\n\t}\n\n\twpm.isGoogleActive = function () {\n\t\tif (\n\t\t\twpmDataLayer?.pixels?.google?.analytics?.universal?.property_id ||\n\t\t\twpmDataLayer?.pixels?.google?.analytics?.ga4?.measurement_id ||\n\t\t\t!jQuery.isEmptyObject(wpmDataLayer?.pixels?.google?.ads?.conversionIds)\n\t\t) {\n\t\t\treturn true\n\t\t} else {\n\t\t\treturn false\n\t\t}\n\t}\n\n\twpm.getGoogleGtagId = function () {\n\t\tif (wpmDataLayer?.pixels?.google?.analytics?.universal?.property_id) {\n\t\t\treturn wpmDataLayer.pixels.google.analytics.universal.property_id\n\t\t} else if (wpmDataLayer?.pixels?.google?.analytics?.ga4?.measurement_id) {\n\t\t\treturn wpmDataLayer.pixels.google.analytics.ga4.measurement_id\n\t\t} else {\n\t\t\treturn Object.keys(wpmDataLayer.pixels.google.ads.conversionIds)[0]\n\t\t}\n\t}\n\n\twpm.loadGoogle = function () {\n\n\t\tif (wpm.isGoogleActive()) {\n\n\t\t\twpmDataLayer.pixels.google.state = \"loading\"\n\n\t\t\twpm.loadScriptAndCacheIt(\"https://www.googletagmanager.com/gtag/js?id=\" + wpm.getGoogleGtagId())\n\t\t\t\t.done(function (script, textStatus) {\n\t\t\t\t\ttry {\n\t\t\t\t\t\t// console.log('Google Optimize loaded')\n\t\t\t\t\t\t// alert('Google Optimize loaded')\n\n\t\t\t\t\t\t// Initiate Google dataLayer and gtag\n\t\t\t\t\t\twindow.dataLayer = window.dataLayer || []\n\t\t\t\t\t\twindow.gtag = function gtag() {\n\t\t\t\t\t\t\tdataLayer.push(arguments)\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t// Google Consent Mode\n\t\t\t\t\t\tif (wpmDataLayer?.pixels?.google?.consent_mode?.active) {\n\n\t\t\t\t\t\t\tlet google_consent_settings = {\n\t\t\t\t\t\t\t\t\"ad_storage\" : wpmDataLayer.pixels.google.consent_mode.ad_storage,\n\t\t\t\t\t\t\t\t\"analytics_storage\": wpmDataLayer.pixels.google.consent_mode.analytics_storage,\n\t\t\t\t\t\t\t\t\"wait_for_update\" : wpmDataLayer.pixels.google.consent_mode.wait_for_update,\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\tif (wpmDataLayer?.pixels?.google?.consent_mode?.region) {\n\t\t\t\t\t\t\t\tgoogle_consent_settings.region = wpmDataLayer.pixels.google.consent_mode.region\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tgoogle_consent_settings = wpm.getVisitorConsentStatusAndUpdateGoogleConsentSettings(google_consent_settings)\n\n\t\t\t\t\t\t\tgtag(\"consent\", \"default\", google_consent_settings)\n\t\t\t\t\t\t\tgtag(\"set\", \"ads_data_redaction\", wpmDataLayer.pixels.google.consent_mode.ads_data_redaction)\n\t\t\t\t\t\t\tgtag(\"set\", \"url_passthrough\", wpmDataLayer.pixels.google.consent_mode.url_passthrough)\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t// Google Linker\n\t\t\t\t\t\t// https://developers.google.com/gtagjs/devguide/linker\n\t\t\t\t\t\tif (wpmDataLayer?.pixels?.google?.linker?.settings) {\n\t\t\t\t\t\t\tgtag(\"set\", \"linker\", wpmDataLayer.pixels.google.linker.settings)\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tgtag(\"js\", new Date())\n\n\t\t\t\t\t\t// Google Ads loader\n\t\t\t\t\t\tif (!jQuery.isEmptyObject(wpmDataLayer?.pixels?.google?.ads?.conversionIds)) { // Only run if the pixel has set up\n\t\t\t\t\t\t\tif (wpm.googleConfigConditionsMet(\"ads\")) { \t\t\t\t\t\t\t// Only run if cookie consent has been given\n\t\t\t\t\t\t\t\twpm.fireGtagGoogleAds()\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\twpm.logPreventedPixelLoading(\"google-ads\", \"ads\")\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\n\n\t\t\t\t\t\t// Google Universal Analytics loader\n\t\t\t\t\t\tif (wpmDataLayer?.pixels?.google?.analytics?.universal?.property_id) { \t\t// Only run if the pixel has set up\n\t\t\t\t\t\t\tif (wpm.googleConfigConditionsMet(\"analytics\")) {\t\t\t\t\t\t// Only run if cookie consent has been given\n\t\t\t\t\t\t\t\twpm.fireGtagGoogleAnalyticsUA()\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\twpm.logPreventedPixelLoading(\"google-universal-analytics\", \"analytics\")\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t// GA4 loader\n\t\t\t\t\t\tif (wpmDataLayer?.pixels?.google?.analytics?.ga4?.measurement_id) { \t\t\t// Only run if the pixel has set up\n\t\t\t\t\t\t\tif (wpm.googleConfigConditionsMet(\"analytics\")) {\t\t\t\t\t\t// Only run if cookie consent has been given\n\t\t\t\t\t\t\t\twpm.fireGtagGoogleAnalyticsGA4()\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\twpm.logPreventedPixelLoading(\"ga4\", \"analytics\")\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\twpmDataLayer.pixels.google.state = \"ready\"\n\t\t\t\t\t} catch (e) {\n\t\t\t\t\t\tconsole.error(e)\n\t\t\t\t\t}\n\t\t\t\t})\n\t\t}\n\t}\n\n\twpm.canGoogleLoad = function () {\n\n\t\tif (wpmDataLayer?.pixels?.google?.consent_mode?.active) {\n\t\t\treturn true\n\t\t} else if (\"category\" === wpm.getConsentValues().mode) {\n\t\t\treturn !!(wpm.getConsentValues().categories[\"ads\"] || wpm.getConsentValues().categories[\"analytics\"])\n\t\t} else if (\"pixel\" === wpm.getConsentValues().mode) {\n\t\t\treturn wpm.getConsentValues().pixels.includes(\"google-ads\") || wpm.getConsentValues().pixels.includes(\"google-analytics\")\n\t\t} else {\n\t\t\tconsole.error(\"Couldn't find a valid load condition for Google mode in wpmConsentValues\")\n\t\t\treturn false\n\t\t}\n\t}\n\n\twpm.gtagLoaded = function () {\n\t\treturn new Promise(function (resolve, reject) {\n\n\t\t\tif (typeof wpmDataLayer?.pixels?.google?.state === \"undefined\") reject()\n\n\t\t\tlet startTime = 0\n\t\t\tlet timeout = 5000\n\t\t\tlet frequency = 200;\n\n\t\t\t(function wait() {\n\t\t\t\tif (wpmDataLayer?.pixels?.google?.state === \"ready\") return resolve()\n\t\t\t\tif (startTime >= timeout) return reject()\n\t\t\t\tstartTime += frequency\n\t\t\t\tsetTimeout(wait, frequency)\n\t\t\t})()\n\t\t})\n\t}\n\n\t// wpm.gtagLoadednew = function () {\n\t// \treturn Promise.race([\n\t// \t\t\tnew Promise(function (resolve, reject) {\n\t//\n\t// \t\t\t\tif (typeof wpmDataLayer?.pixels?.google?.state === \"undefined\") reject();\n\t//\n\t//\n\t// \t\t\t\t(function wait() {\n\t// \t\t\t\t\tif (wpmDataLayer?.pixels?.google?.state === \"ready\") return resolve()\n\t// \t\t\t\t\tif (to >= 1000) return reject()\n\t// \t\t\t\t\tsetTimeout(wait, 100)\n\t// \t\t\t\t})()\n\t// \t\t\t}),\n\t// \t\t\tnew Promise(function (resolve, reject) {\n\t// \t\t\t\tsetTimeout(() => reject(), 1000)\n\t// \t\t\t}),\n\t// \t\t],\n\t// \t)\n\t// \t\t// .then((value) => {console.log(\"race then value: \" + value)})\n\t// \t\t.catch(\n\t// \t\t\t(value) => {\n\t// \t\t\t\tconsole.log(\"race catch value: \" + value)\n\t// \t\t\t\treturn Promise.reject()\n\t// \t\t\t})\n\t// }\n\n\n\t// const promise1 = new Promise((resolve, reject) => {\n\t// \tsetTimeout(resolve, 500, \"one\")\n\t// })\n\t//\n\t// const promise2 = new Promise((resolve, reject) => {\n\t// \tsetTimeout(reject, 100, \"two\")\n\t// })\n\t//\n\t// let onlyRunIfResolves = function () {\n\t// \treturn Promise.race([promise1, promise2])\n\t// \t\t.catch(() => {\n\t// \t\t})\n\t// }\n\t//\n\t// onlyRunIfResolves()\n\t// \t.then(() => {\n\t// \t\tconsole.log(\"running function\")\n\t// \t})\n\n\n}(window.wpm = window.wpm || {}, jQuery));\n","/**\n * Load Google base\n */\n\n// Load base\nrequire(\"./functions\")\nrequire(\"./event_listeners\")\n\n// #if process.env.TIER === 'premium'\n// require(\"./functions_premium\")\n// require(\"./event_listeners_premium\")\n// #endif\n","/**\n * Load Google\n */\n\n// Load base\nrequire(\"./base/loader\")\n\n//Load additional Google libraries\nrequire(\"./ads/loader\")\nrequire(\"./analytics/loader\")\nrequire(\"./optimize/loader\")\n\n\n","/**\n * Load Google Optimize event listeners\n */\n\njQuery(document).on(\"wpmLoadPixels\", function () {\n\n\tif (wpmDataLayer?.pixels?.google?.optimize?.container_id && !wpmDataLayer?.pixels?.google?.optimize?.loaded) {\n\t\tif (wpm.canIFire(\"analytics\", \"google-optimize\")) wpm.load_google_optimize_pixel()\n\t}\n})\n","/**\n * Load Google Optimize functions\n */\n\n\n(function (wpm, $, undefined) {\n\n\twpm.load_google_optimize_pixel = function () {\n\n\t\ttry {\n\t\t\twpmDataLayer.pixels.google.optimize.loaded = true\n\n\t\t\twpm.loadScriptAndCacheIt(\"https://www.googleoptimize.com/optimize.js?id=\" + wpmDataLayer.pixels.google.optimize.container_id)\n\t\t\t// .done(function (script, textStatus) {\n\t\t\t// \t\tconsole.log('Google Optimize loaded')\n\t\t\t// });\n\n\t\t} catch (e) {\n\t\t\tconsole.error(e)\n\t\t}\n\t}\n\n}(window.wpm = window.wpm || {}, jQuery));\n","/**\n * Load Google Optimize\n */\n\nrequire(\"./functions\")\nrequire(\"./event_listeners\")\n","/**\n * Load Hotjar event listeners\n */\n\n// Pixel load event listener\njQuery(document).on(\"wpmLoadPixels\", function () {\n\n\tif (wpmDataLayer?.pixels?.hotjar?.site_id && !wpmDataLayer?.pixels?.hotjar?.loaded) {\n\t\tif (wpm.canIFire(\"analytics\", \"hotjar\") && !wpmDataLayer?.pixels?.hotjar?.loaded) wpm.load_hotjar_pixel()\n\t}\n})\n","/**\n * Load Hotjar functions\n */\n\n(function (wpm, $, undefined) {\n\n\twpm.load_hotjar_pixel = function () {\n\n\t\ttry {\n\t\t\twpmDataLayer.pixels.hotjar.loaded = true;\n\n\t\t\t// @formatter:off\n\t\t\t(function(h,o,t,j,a,r){\n\t\t\t\th.hj=h.hj||function(){(h.hj.q=h.hj.q||[]).push(arguments)};\n\t\t\t\th._hjSettings={hjid:wpmDataLayer.pixels.hotjar.site_id,hjsv:6};\n\t\t\t\ta=o.getElementsByTagName('head')[0];\n\t\t\t\tr=o.createElement('script');r.async=1;\n\t\t\t\tr.src=t+h._hjSettings.hjid+j+h._hjSettings.hjsv;\n\t\t\t\ta.appendChild(r);\n\t\t\t})(window,document,'https://static.hotjar.com/c/hotjar-','.js?sv=');\n\t\t\t// @formatter:on\n\n\t\t} catch (e) {\n\t\t\tconsole.error(e)\n\t\t}\n\t}\n\n}(window.wpm = window.wpm || {}, jQuery));\n","/**\n * Hotjar loader\n */\n\nrequire(\"./functions\")\nrequire(\"./event_listeners\")\n","/**\n * Register event listeners\n */\n\n// remove_from_cart event\njQuery(document).on(\"click\", \".remove_from_cart_button, .remove\", function () {\n\t// jQuery('.remove_from_cart_button, .remove').on('click', function (e) {\n\n\ttry {\n\t\t// console.log('remove_from_cart: ' + jQuery(this).data('product_id'));\n\n\t\tlet url = new URL(jQuery(this).attr(\"href\"))\n\t\tlet productId = wpm.getProductIdByCartItemKeyUrl(url)\n\n\t\twpm.removeProductFromCart(productId)\n\n\t} catch (e) {\n\t\tconsole.error(e)\n\t}\n})\n\n\n// add_to_cart event\njQuery(document).on(\"click\", \".add_to_cart_button:not(.product_type_variable), .ajax_add_to_cart, .single_add_to_cart_button\", function () {\n\t// jQuery('.add_to_cart_button:not(.product_type_variable), .ajax_add_to_cart, .js-ajax-add-to-cart, .single_add_to_cart_button, .btn_color-2').on('click', function (e) {\n\n\ttry {\n\t\t// console.log('add_to_cart');\n\n\t\tif (wpmDataLayer.shop.page_type === \"product\") {\n\n\t\t\t// first process related and upsell products\n\t\t\tif (typeof jQuery(this).attr(\"href\") !== \"undefined\" && jQuery(this).attr(\"href\").includes(\"add-to-cart\")) {\n\t\t\t\t// console.log('add-to-cart on upsell and related products');\n\t\t\t\tlet quantity = 1\n\t\t\t\tlet productId = jQuery(this).data(\"product_id\")\n\t\t\t\t// console.log('productId: ' + productId);\n\t\t\t\twpm.addProductToCart(productId, quantity)\n\t\t\t} else {\n\n\t\t\t\tif (wpmDataLayer.shop.product_type === \"simple\") {\n\n\t\t\t\t\t// console.log('test');\n\t\t\t\t\tlet quantity = Number(jQuery(\".input-text.qty\").val())\n\n\t\t\t\t\tif (!quantity && quantity !== 0) quantity = 1\n\n\t\t\t\t\tlet productId = jQuery(this).val()\n\n\t\t\t\t\t// console.log('productId: ' + productId);\n\t\t\t\t\t// console.log('quantity: ' + quantity);\n\n\t\t\t\t\twpm.addProductToCart(productId, quantity)\n\n\t\t\t\t} else if (wpmDataLayer.shop.product_type === \"variable\") {\n\n\t\t\t\t\t// console.log('variable');\n\n\t\t\t\t\tlet quantity = Number(jQuery(\".input-text.qty\").val())\n\n\t\t\t\t\tif (!quantity && quantity !== 0) quantity = 1\n\n\t\t\t\t\tlet productId = jQuery(\"[name='variation_id']\").val()\n\n\t\t\t\t\t// console.log('productId: ' + productId);\n\t\t\t\t\t// console.log('quantity: ' + quantity);\n\n\t\t\t\t\twpm.addProductToCart(productId, quantity)\n\n\t\t\t\t} else if (wpmDataLayer.shop.product_type === \"grouped\") {\n\n\t\t\t\t\t// console.log('grouped');\n\n\t\t\t\t\tjQuery(\".woocommerce-grouped-product-list-item\").each(function () {\n\n\t\t\t\t\t\tlet quantity = Number(jQuery(this).find(\".input-text.qty\").val())\n\n\t\t\t\t\t\tif (!quantity && quantity !== 0) quantity = 1\n\n\t\t\t\t\t\tlet classes = jQuery(this).attr(\"class\")\n\t\t\t\t\t\tlet productId = wpm.getPostIdFromString(classes)\n\n\t\t\t\t\t\t// console.log('productId: ' + productId);\n\t\t\t\t\t\t// console.log('quantity: ' + quantity);\n\n\t\t\t\t\t\twpm.addProductToCart(productId, quantity)\n\t\t\t\t\t})\n\t\t\t\t} else if (wpmDataLayer.shop.product_type === \"bundle\") {\n\n\t\t\t\t\t// console.log('bundle');\n\n\t\t\t\t\tlet quantity = Number(jQuery(\".input-text.qty\").val())\n\n\t\t\t\t\tif (!quantity && quantity !== 0) quantity = 1\n\n\t\t\t\t\tlet productId = jQuery(\"input[name=add-to-cart]\").val()\n\n\t\t\t\t\t// console.log('productId: ' + productId);\n\t\t\t\t\t// console.log('quantity: ' + quantity);\n\n\t\t\t\t\twpm.addProductToCart(productId, quantity)\n\t\t\t\t}\n\t\t\t}\n\t\t} else {\n\n\t\t\t// console.log('non product page');\n\n\t\t\tlet quantity = 1\n\t\t\tlet productId = jQuery(this).data(\"product_id\")\n\t\t\t// console.log('productId: ' + productId);\n\t\t\twpm.addProductToCart(productId, quantity)\n\t\t}\n\t} catch (e) {\n\t\tconsole.error(e)\n\t}\n})\n\n// if someone clicks anywhere on a custom /?add-to-cart=123 link\n// trigger the add to cart event\n// body.one('click', function (e) {\n//\n// try {\n// if (jQuery(this)[0].URL) {\n//\n// let href = new URL(jQuery(this)[0].URL);\n// let searchParams = new URLSearchParams(href.search);\n//\n// if (searchParams.has('add-to-cart')) {\n// // console.log('non product page, /?add-to-cart=123 link');\n//\n// let productId = searchParams.get('add-to-cart');\n// wpm.addProductToCart(productId, 1);\n// }\n// }\n// } catch (e) {\n// console.error(e);\n// }\n// });\n\n\n/**\n * If someone clicks anywhere on a custom /?add-to-cart=123 link\n * trigger the add to cart event\n */\njQuery(document).one(\"click\", \"a:not(.add_to_cart_button, .ajax_add_to_cart, .single_add_to_cart_button)\", function (event) {\n\t// jQuery('a:not(.add_to_cart_button, .ajax_add_to_cart, .single_add_to_cart_button)').one('click', function (event) {\n\n\ttry {\n\t\tif (jQuery(event.target).closest(\"a\").attr(\"href\")) {\n\n\t\t\tlet href = jQuery(event.target).closest(\"a\").attr(\"href\")\n\n\t\t\tif (href.includes(\"add-to-cart=\")) {\n\t\t\t\tlet matches = href.match(/(add-to-cart=)(\\d+)/)\n\t\t\t\t// console.log('pid: ' + matches[2])\n\t\t\t\tif (matches) wpm.addProductToCart(matches[2], 1)\n\t\t\t}\n\t\t}\n\t} catch (e) {\n\t\tconsole.error(e)\n\t}\n})\n\n// select_content GA UA event\n// select_item GA 4 event\n// jQuery(document).on('click', '.woocommerce-LoopProduct-link, .wc-block-grid__product, .product-small.box', function (e) {\njQuery(document).on(\"click\", \".woocommerce-LoopProduct-link, .wc-block-grid__product, .product, .product-small, .type-product\", function () {\n\t// jQuery('.woocommerce-LoopProduct-link, .wc-block-grid__product, .product, .product-small, .type-product').on('click', function (e) {\n\n\ttry {\n\n\t\t/**\n\t\t *\n\t\t * On some pages the event fires multiple times, and on product pages\n\t\t * even on page load. Using e.stopPropagation helps to prevent this,\n\t\t * but I dont know why. We don't even have to use this, since only a real\n\t\t * product click yields a valid productId. So we filter the invalid click\n\t\t * events out later down the code. I'll keep it that way because this is\n\t\t * the most compatible way across shops.\n\t\t * e.stopPropagation();\n\t\t * */\n\n\t\t\t// console.log('select_content and select_item');\n\n\t\tlet productId = jQuery(this).nextAll(\".wpmProductId:first\").data(\"id\")\n\t\t// console.log('select_content and select_item: ' + productId);\n\n\n\t\t/**\n\t\t * On product pages, for some reason, the click event is triggered on the main product on page load.\n\t\t * In that case no ID is found. But we can discard it, since we only want to trigger the event on\n\t\t * related products, which are found below.\n\t\t */\n\n\t\tif (productId) {\n\n\t\t\t// console.log('select_content and select_item: ' + productId);\n\n\t\t\tproductId = getIdBasedOndVariationsOutputSetting(productId)\n\n\t\t\tif (!productId) throw Error(\"Wasn't able to retrieve a productId\")\n\n\t\t\t// console.log('prodid: ' + productId);\n\n\t\t\tif (wpmDataLayer.products && wpmDataLayer.products[productId]) {\n\n\t\t\t\tlet product = wpm.getProductDetailsFormattedForEvent(productId)\n\n\t\t\t\tjQuery(document).trigger(\"wpmSelectContentGaUa\", product)\n\t\t\t\tjQuery(document).trigger(\"wpmSelectItem\", product)\n\t\t\t}\n\t\t}\n\t} catch (e) {\n\t\tconsole.error(e)\n\t}\n})\n\n// begin_checkout event\njQuery(document).one(\"click\", \".checkout-button, .cart-checkout-button, .button.checkout\", function () {\n\t// jQuery('.checkout-button, .cart-checkout-button, .button.checkout').one('click', function (e) {\n\t// console.log('begin_checkout');\n\n\tjQuery(document).trigger(\"wpmBeginCheckout\")\n})\n\n\n// checkout_progress event\n// track checkout option event: entered valid billing email\njQuery(document).on(\"input\", \"#billing_email\", function () {\n\t// jQuery('#billing_email').on('input', function () {\n\n\tif (wpm.isEmail(jQuery(this).val())) {\n\t\t// wpm.fireCheckoutOption(2);\n\t\twpm.fireCheckoutProgress(2)\n\t\twpm.emailSelected = true\n\t}\n})\n\n// track checkout option event: purchase click\njQuery(document).on(\"click\", \".wc_payment_methods\", function () {\n\t// jQuery('.wc_payment_methods').on('click', function () {\n\n\tif (false === wpm.paymentMethodSelected) {\n\t\twpm.fireCheckoutProgress(3)\n\t}\n\n\twpm.fireCheckoutOption(3, jQuery(\"input[name='payment_method']:checked\").val())\n\twpm.paymentMethodSelected = true\n})\n\n// track checkout option event: purchase click\njQuery(document).one(\"click\", \"#place_order\", function () {\n\t// jQuery('#place_order').one('click', function () {\n\n\tif (false === wpm.emailSelected) {\n\t\twpm.fireCheckoutProgress(2)\n\t}\n\n\tif (false === wpm.paymentMethodSelected) {\n\t\twpm.fireCheckoutProgress(3)\n\t\twpm.fireCheckoutOption(3, jQuery(\"input[name='payment_method']:checked\").val())\n\t}\n\n\twpm.fireCheckoutProgress(4)\n})\n\n// update cart event\njQuery(document).on(\"click\", \"[name='update_cart']\", function () {\n\t// jQuery(\"[name='update_cart']\").on('click', function (e) {\n\n\ttry {\n\t\tjQuery(\".cart_item\").each(function () {\n\n\t\t\t// let productId = jQuery(this).find('[data-product_id]').data('product_id');\n\n\t\t\tlet url = new URL(jQuery(this).find(\".product-remove\").find(\"a\").attr(\"href\"))\n\t\t\tlet productId = wpm.getProductIdByCartItemKeyUrl(url)\n\n\n\t\t\tlet quantity = jQuery(this).find(\".qty\").val()\n\n\t\t\tif (quantity === 0) {\n\t\t\t\twpm.removeProductFromCart(productId)\n\t\t\t} else if (quantity < wpmDataLayer.cart[productId].quantity) {\n\t\t\t\twpm.removeProductFromCart(productId, wpmDataLayer.cart[productId].quantity - quantity)\n\t\t\t} else if (quantity > wpmDataLayer.cart[productId].quantity) {\n\t\t\t\twpm.addProductToCart(productId, quantity - wpmDataLayer.cart[productId].quantity)\n\t\t\t}\n\t\t})\n\t} catch (e) {\n\t\tconsole.error(e)\n\t\twpm.getCartItemsFromBackend()\n\t}\n})\n\n\n// add_to_wishlist\njQuery(document).on(\"click\", \".add_to_wishlist, .wl-add-to\", function () {\n\t// jQuery('.add_to_wishlist, .wl-add-to').on('click', function () {\n\n\ttry {\n\t\t// console.log('add_to_wishlist');\n\t\t// console.log('this:' + jQuery(this).data('product-id'));\n\n\t\tlet productId\n\n\t\tif (jQuery(this).data(\"productid\")) { // for the WooCommerce wishlist plugin\n\t\t\tproductId = jQuery(this).data(\"productid\")\n\t\t} else if (jQuery(this).data(\"product-id\")) { // for the YITH wishlist plugin\n\t\t\tproductId = jQuery(this).data(\"product-id\")\n\t\t}\n\n\t\tif (!productId) throw Error(\"Wasn't able to retrieve a productId\")\n\n\t\tlet product = wpm.getProductDetailsFormattedForEvent(productId)\n\n\t\t// console.log('add_to_wishlist');\n\t\t// console.log(product);\n\n\t\tjQuery(document).trigger(\"wpmAddToWishlist\", product)\n\t} catch (e) {\n\t\tconsole.error(e)\n\t}\n})\n\njQuery(document).on(\"updated_cart_totals\", function () {\n\tjQuery(document).trigger(\"wpmViewCart\")\n})\n\n\n/**\n * Called when the user selects all the required dropdowns / attributes\n *\n * Has to be hooked after document ready\n *\n * https://stackoverflow.com/a/27849208/4688612\n * https://stackoverflow.com/a/65065335/4688612\n */\njQuery(\".single_variation_wrap\").on(\"show_variation\", function (event, variation) {\n\n\ttry {\n\t\tlet productId = getIdBasedOndVariationsOutputSetting(variation.variation_id)\n\n\t\tif (!productId) throw Error(\"Wasn't able to retrieve a productId\")\n\n\t\tif (wpmDataLayer.products && wpmDataLayer.products[productId]) {\n\n\t\t\t// console.log('productId: ' + productId);\n\n\t\t\tlet product = wpm.getProductDetailsFormattedForEvent(productId)\n\n\t\t\tjQuery(document).trigger(\"wpmViewItem\", product)\n\t\t}\n\t} catch (e) {\n\t\tconsole.error(e)\n\t}\n})\n\n/**\n * Called on variable products when no selection has been done yet\n * or when the visitor deselects his choice.\n *\n * Has to be hooked after document ready\n */\n\njQuery(\".single_variation_wrap\").on(\"hide_variation\", function () {\n\n\ttry {\n\t\tlet classes = jQuery(\"body\").attr(\"class\")\n\t\tlet productId = classes.match(/(postid-)(\\d+)/)[2]\n\n\t\tif (!productId) throw Error(\"Wasn't able to retrieve a productId\")\n\n\t\t/**\n\t\t * If we have a variable product with no preset,\n\t\t * and variations output is enabled,\n\t\t * then we send a viewItem event with the first\n\t\t * variation we find for the parent.\n\t\t * If variations output is disabled,\n\t\t * we just send the parent ID.\n\t\t */\n\t\tif (\n\t\t\t\"variable\" === wpmDataLayer.shop.product_type &&\n\t\t\twpmDataLayer?.general?.variationsOutput\n\t\t) {\n\t\t\tfor (const [key, product] of Object.entries(wpmDataLayer.products)) {\n\t\t\t\tif (\"parentId\" in product) {\n\t\t\t\t\t// console.log('pid: ' + value.parentId)\n\t\t\t\t\tproductId = product.id\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tif (wpmDataLayer.products && wpmDataLayer.products[productId]) {\n\n\t\t\t// console.log('productId: ' + productId);\n\n\t\t\tlet product = wpm.getProductDetailsFormattedForEvent(productId)\n\n\t\t\tjQuery(document).trigger(\"wpmViewItem\", product)\n\t\t}\n\n\t} catch (e) {\n\t\tconsole.error(e)\n\t}\n})\n\n\n/**\n * Set up wpm events\n */\n\n\n// populate the wpmDataLayer with the cart items\njQuery(window).on(\"wpmLoad\", function () {\n\n\ttry {\n\t\t// When a new session is initiated there are no items in the cart,\n\t\t// so we can save the call to get the cart items\n\t\tif (wpm.doesWooCommerceCartExist()) wpm.getCartItems()\n\n\t} catch (e) {\n\t\tconsole.error(e)\n\t}\n})\n\n// get all add-to-cart= products from backend\njQuery(window).on(\"wpmLoad\", function () {\n\n\twpmDataLayer.products = wpmDataLayer.products || {}\n\n\t// scan page for add-to-cart= links\n\tlet productIds = wpm.getAddToCartLinkProductIds()\n\n\twpm.getProductsFromBackend(productIds)\n})\n\n/**\n * Save the referrer into a cookie\n */\n\njQuery(window).on(\"wpmLoad\", function () {\n\n\t// can't use session storage as we can't read it from the server\n\tif (!wpm.getCookie(\"wpmReferrer\")) {\n\n\t\tif (document.referrer) {\n\t\t\tlet referrerUrl = new URL(document.referrer)\n\t\t\tlet referrerHostname = referrerUrl.hostname\n\n\t\t\tif (referrerHostname !== window.location.host) {\n\t\t\t\twpm.setCookie(\"wpmReferrer\", referrerHostname)\n\t\t\t} else {\n\t\t\t\twpm.setCookie(\"wpmReferrer\", \"\")\n\t\t\t}\n\n\t\t} else {\n\t\t\twpm.setCookie(\"wpmReferrer\", \"\")\n\t\t}\n\t}\n})\n\n\n/**\n * Create our own load event in order to better handle script flow execution when JS \"optimizers\" shuffle the code.\n */\n\njQuery(window).on(\"wpmLoad\", function () {\n\ttry {\n\t\tif (typeof wpmDataLayer != \"undefined\" && !wpmDataLayer?.wpmLoadFired) {\n\n\t\t\tjQuery(document).trigger(\"wpmLoadAlways\")\n\n\t\t\tif (\"product\" === wpmDataLayer.shop.page_type && wpmDataLayer.shop.product_type !== \"variable\" && wpm.getMainProductIdFromProductPage()) {\n\n\t\t\t\tlet product = wpm.getProductDataForViewItemEvent(wpm.getMainProductIdFromProductPage())\n\t\t\t\tjQuery(document).trigger(\"wpmViewItem\", product)\n\n\t\t\t} else if (\"product_category\" === wpmDataLayer.shop.page_type) {\n\n\t\t\t\tjQuery(document).trigger(\"wpmCategory\")\n\n\t\t\t} else if (\"search\" === wpmDataLayer.shop.page_type) {\n\n\t\t\t\tjQuery(document).trigger(\"wpmSearch\")\n\n\t\t\t} else if (\"cart\" === wpmDataLayer.shop.page_type) {\n\n\t\t\t\tjQuery(document).trigger(\"wpmViewCart\")\n\n\t\t\t} else if (\"order_received_page\" === wpmDataLayer.shop.page_type && wpmDataLayer.order) {\n\n\t\t\t\tif (!wpm.isOrderIdStored(wpmDataLayer.order.id)) {\n\n\t\t\t\t\tjQuery(document).trigger(\"wpmOrderReceivedPage\")\n\t\t\t\t\twpm.writeOrderIdToStorage(wpmDataLayer.order.id)\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tjQuery(document).trigger(\"wpmEverywhereElse\")\n\t\t\t}\n\n\t\t\tif (wpmDataLayer?.user?.id && !wpm.hasLoginEventFired()) {\n\t\t\t\tjQuery(document).trigger(\"wpmLogin\")\n\t\t\t\twpm.setLoginEventFired()\n\t\t\t}\n\n\t\t\t// /**\n\t\t\t// * Load mini cart fragments into a wpm session storage key,\n\t\t\t// * after the document load event.\n\t\t\t// */\n\t\t\t// jQuery(document).ajaxSend(function (event, jqxhr, settings) {\n\t\t\t// \t// console.log('settings.url: ' + settings.url);\n\t\t\t//\n\t\t\t// \tif (settings.url.includes(\"get_refreshed_fragments\") && sessionStorage) {\n\t\t\t// \t\tif (!sessionStorage.getItem(\"wpmMiniCartActive\")) {\n\t\t\t// \t\t\tsessionStorage.setItem(\"wpmMiniCartActive\", JSON.stringify(true))\n\t\t\t// \t\t}\n\t\t\t// \t}\n\t\t\t// })\n\n\t\t\twpmDataLayer.wpmLoadFired = true\n\t\t}\n\n\t} catch (e) {\n\t\tconsole.error(e)\n\t}\n})\n\n// jQuery(window).on(\"load\", function () {\n// \tjQuery(document).trigger(\"wpmLoad\", {})\n// })\n\njQuery(window).on(\"wpmPreLoadPixels\", function () {\n\n\tif (wpmDataLayer?.shop?.cookie_consent_mgmt?.explicit_consent) {\n\t\twpm.updateConsentCookieValues(true)\n\t}\n\tjQuery(document).trigger(\"wpmLoadPixels\", {})\n})\n","/**\n * Create a wpm namespace under which all functions are declared\n */\n\n// https://stackoverflow.com/a/5947280/4688612\n(function (wpm, $, undefined) {\n\n\tconst wpmDeduper = {\n\t\tkeyName : \"_wpm_order_ids\",\n\t\tcookieExpiresDays: 365,\n\t}\n\n\tconst wpmRestSettings = {\n\t\t// cookiesAvailable : '_wpm_cookies_are_available',\n\t\tcookieWpmRestEndpointAvailable: \"_wpm_endpoint_available\",\n\t\trestEndpoint : \"/wp-json/\",\n\t\trestFails : 0,\n\t\trestFailsThreshold : 10,\n\t}\n\n\twpm.emailSelected = false\n\twpm.paymentMethodSelected = false\n\n\t// wpm.checkIfCookiesAvailable = function () {\n\t//\n\t// // read the cookie if previously set, if it is return true, otherwise continue\n\t// if (wpm.getCookie(wpmRestSettings.cookiesAvailable)) {\n\t// return true;\n\t// }\n\t//\n\t// // set the cookie for the session\n\t// Cookies.set(wpmRestSettings.cookiesAvailable, true);\n\t//\n\t// // read cookie, true if ok, false if not ok\n\t// return !!wpm.getCookie(wpmRestSettings.cookiesAvailable);\n\t// }\n\n\twpm.useRestEndpoint = function () {\n\n\t\t// only if sessionStorage is available\n\n\t\t// only if REST API endpoint is generally accessible\n\t\t// check in sessionStorage if we checked before and return answer\n\t\t// otherwise check if the endpoint is available, save answer in sessionStorage and return answer\n\n\t\t// only if not too many REST API errors happened\n\n\t\treturn wpm.isSessionStorageAvailable() &&\n\t\t\twpm.isRestEndpointAvailable() &&\n\t\t\twpm.isBelowRestErrorThreshold()\n\t}\n\n\twpm.isBelowRestErrorThreshold = function () {\n\t\treturn window.sessionStorage.getItem(wpmRestSettings.restFails) <= wpmRestSettings.restFailsThreshold\n\t}\n\n\twpm.isRestEndpointAvailable = function () {\n\n\t\tif (window.sessionStorage.getItem(wpmRestSettings.cookieWpmRestEndpointAvailable)) {\n\t\t\treturn JSON.parse(window.sessionStorage.getItem(wpmRestSettings.cookieWpmRestEndpointAvailable))\n\t\t} else {\n\t\t\t// return wpm.testEndpoint();\n\t\t\t// just set the value whenever possible in order not to wait or block the main thread\n\t\t\twpm.testEndpoint()\n\t\t}\n\t}\n\n\twpm.isSessionStorageAvailable = function () {\n\n\t\treturn !!window.sessionStorage\n\t}\n\n\twpm.testEndpoint = function (\n\t\turl = location.protocol + \"//\" + location.host + wpmRestSettings.restEndpoint,\n\t\tcookieName = wpmRestSettings.cookieWpmRestEndpointAvailable,\n\t) {\n\t\t// console.log('testing endpoint');\n\n\t\tjQuery.ajax(url, {\n\t\t\ttype : \"HEAD\",\n\t\t\ttimeout: 1000,\n\t\t\t// async: false,\n\t\t\tstatusCode: {\n\t\t\t\t200: function (response) {\n\t\t\t\t\t// Cookies.set(cookieName, true);\n\t\t\t\t\t// console.log('endpoint works');\n\t\t\t\t\twindow.sessionStorage.setItem(cookieName, JSON.stringify(true))\n\t\t\t\t},\n\t\t\t\t404: function (response) {\n\t\t\t\t\t// Cookies.set(cookieName, false);\n\t\t\t\t\t// console.log('endpoint doesn\\'t work');\n\t\t\t\t\twindow.sessionStorage.setItem(cookieName, JSON.stringify(false))\n\t\t\t\t},\n\t\t\t\t0 : function (response) {\n\t\t\t\t\t// Cookies.set(cookieName, false);\n\t\t\t\t\t// console.log('endpoint doesn\\'t work');\n\t\t\t\t\twindow.sessionStorage.setItem(cookieName, JSON.stringify(false))\n\t\t\t\t},\n\t\t\t},\n\t\t}).then(response => {\n\t\t\t// console.log('test done')\n\t\t\t// console.log('result: ' + JSON.parse(window.sessionStorage.getItem(cookieName)));\n\t\t\t// return JSON.parse(window.sessionStorage.getItem(cookieName));\n\t\t})\n\t}\n\n\twpm.isWpmRestEndpointAvailable = function (cookieName = wpmRestSettings.cookieWpmRestEndpointAvailable) {\n\n\t\treturn !!wpm.getCookie(cookieName)\n\t}\n\n\twpm.writeOrderIdToStorage = function (orderId, expireDays = 365) {\n\n\t\t// save the order ID in the browser storage\n\n\t\tif (!window.Storage) {\n\t\t\tlet expiresDate = new Date()\n\t\t\texpiresDate.setDate(expiresDate.getDate() + wpmDeduper.cookieExpiresDays)\n\n\t\t\tlet ids = []\n\t\t\tif (checkCookie()) {\n\t\t\t\tids = JSON.parse(wpm.getCookie(wpmDeduper.keyName))\n\t\t\t}\n\n\t\t\tif (!ids.includes(orderId)) {\n\t\t\t\tids.push(orderId)\n\t\t\t\tdocument.cookie = wpmDeduper.keyName + \"=\" + JSON.stringify(ids) + \";expires=\" + expiresDate.toUTCString()\n\t\t\t}\n\n\t\t} else {\n\t\t\tif (localStorage.getItem(wpmDeduper.keyName) === null) {\n\t\t\t\tlet ids = []\n\t\t\t\tids.push(orderId)\n\t\t\t\twindow.localStorage.setItem(wpmDeduper.keyName, JSON.stringify(ids))\n\n\t\t\t} else {\n\t\t\t\tlet ids = JSON.parse(localStorage.getItem(wpmDeduper.keyName))\n\t\t\t\tif (!ids.includes(orderId)) {\n\t\t\t\t\tids.push(orderId)\n\t\t\t\t\twindow.localStorage.setItem(wpmDeduper.keyName, JSON.stringify(ids))\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tif (typeof wpm.storeOrderIdOnServer === \"function\" && wpmDataLayer.orderDeduplication) {\n\t\t\twpm.storeOrderIdOnServer(orderId)\n\t\t}\n\t}\n\n\tfunction checkCookie() {\n\t\tlet key = wpm.getCookie(wpmDeduper.keyName)\n\t\treturn key !== \"\"\n\t}\n\n\twpm.isOrderIdStored = function (orderId) {\n\n\t\t// console.log('deduper: ' + wpmDataLayer.orderDeduplication);\n\t\tif (wpmDataLayer.orderDeduplication) {\n\t\t\t// console.log('order deduplication: on');\n\t\t\tif (!window.Storage) {\n\n\t\t\t\tif (checkCookie()) {\n\t\t\t\t\tlet ids = JSON.parse(wpm.getCookie(wpmDeduper.keyName))\n\t\t\t\t\treturn ids.includes(orderId)\n\t\t\t\t} else {\n\t\t\t\t\treturn false\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tif (localStorage.getItem(wpmDeduper.keyName) !== null) {\n\t\t\t\t\tlet ids = JSON.parse(localStorage.getItem(wpmDeduper.keyName))\n\t\t\t\t\treturn ids.includes(orderId)\n\t\t\t\t} else {\n\t\t\t\t\treturn false\n\t\t\t\t}\n\t\t\t}\n\t\t} else {\n\t\t\tconsole.log(\"order duplication prevention: off\")\n\t\t\treturn false\n\t\t}\n\t}\n\n\twpm.isEmail = function (email) {\n\t\t// https://emailregex.com/\n\t\tlet regex = /^(([^<>()\\[\\]\\\\.,;:\\s@\"]+(\\.[^<>()\\[\\]\\\\.,;:\\s@\"]+)*)|(\".+\"))@((\\[[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}])|(([a-zA-Z\\-0-9]+\\.)+[a-zA-Z]{2,}))$/\n\t\treturn regex.test(email)\n\t}\n\n\twpm.removeProductFromCart = function (productId, quantityToRemove = null) {\n\t\t// console.log('product_id: ' + productId + ' | quantityToRemove: ' + quantityToRemove);\n\n\t\ttry {\n\n\t\t\tif (!productId) throw Error(\"Wasn't able to retrieve a productId\")\n\n\t\t\tproductId = getIdBasedOndVariationsOutputSetting(productId)\n\n\t\t\tif (!productId) throw Error(\"Wasn't able to retrieve a productId\")\n\n\t\t\tlet quantity\n\n\t\t\tif (quantityToRemove == null) {\n\t\t\t\tquantity = wpmDataLayer.cart[productId].quantity\n\t\t\t} else {\n\t\t\t\tquantity = quantityToRemove\n\t\t\t}\n\n\t\t\t// console.log('product_id: ' + productId + ' | qty: ' + quantity);\n\t\t\t// console.log(productId);\n\t\t\t// console.log(wpmDataLayer.cart);\n\t\t\t// console.log(wpmDataLayer.cart[productId]);\n\n\t\t\tif (wpmDataLayer.cart[productId]) {\n\n\t\t\t\t// let product = {\n\t\t\t\t// id : productId.toString(),\n\t\t\t\t// dyn_r_ids: wpmDataLayer.cart[productId].dyn_r_ids,\n\t\t\t\t// name : wpmDataLayer.cart[productId].name,\n\t\t\t\t// // list_name: wpmDataLayer.shop.list_name, // doesn't make sense on mini_cart\n\t\t\t\t// brand : wpmDataLayer.cart[productId].brand,\n\t\t\t\t// category: wpmDataLayer.cart[productId].category,\n\t\t\t\t// variant : wpmDataLayer.cart[productId].variant,\n\t\t\t\t// // list_position: wpmDataLayer.cart[productId].position, // doesn't make sense on mini_cart\n\t\t\t\t// quantity : quantity,\n\t\t\t\t// price : wpmDataLayer.cart[productId].price,\n\t\t\t\t// isVariation: wpmDataLayer.products[productId].isVariation,\n\t\t\t\t// };\n\t\t\t\t//\n\t\t\t\t// if (product.isVariation) product['parentId_dyn_r_ids'] = wpmDataLayer.products[productId].parentId_dyn_r_ids;\n\n\t\t\t\tlet product = wpm.getProductDetailsFormattedForEvent(productId, quantity)\n\n\t\t\t\t// console.log('removing');\n\t\t\t\t// console.log(data);\n\n\t\t\t\tjQuery(document).trigger(\"wpmRemoveFromCart\", product)\n\n\t\t\t\tif (quantityToRemove == null || wpmDataLayer.cart[productId].quantity === quantityToRemove) {\n\t\t\t\t\tdelete wpmDataLayer.cart[productId]\n\t\t\t\t\tif (sessionStorage) sessionStorage.setItem(\"wpmDataLayerCart\", JSON.stringify(wpmDataLayer.cart))\n\t\t\t\t} else {\n\t\t\t\t\twpmDataLayer.cart[productId].quantity = wpmDataLayer.cart[productId].quantity - quantity\n\t\t\t\t\tif (sessionStorage) sessionStorage.setItem(\"wpmDataLayerCart\", JSON.stringify(wpmDataLayer.cart))\n\t\t\t\t}\n\t\t\t}\n\t\t} catch (e) {\n\t\t\tconsole.error(e)\n\t\t\t// console.log('getting cart from back end');\n\t\t\t// wpm.getCartItemsFromBackend();\n\t\t\t// console.log('getting cart from back end done');\n\n\t\t}\n\t}\n\n\tgetIdBasedOndVariationsOutputSetting = function (productId) {\n\n\t\ttry {\n\t\t\tif (wpmDataLayer?.general?.variationsOutput) {\n\t\t\t\t// console.log('test');\n\t\t\t\treturn productId\n\t\t\t} else {\n\t\t\t\tif (wpmDataLayer.products[productId].isVariation) {\n\t\t\t\t\treturn wpmDataLayer.products[productId].parentId\n\t\t\t\t} else {\n\t\t\t\t\treturn productId\n\t\t\t\t}\n\t\t\t}\n\t\t} catch (e) {\n\t\t\tconsole.error(e)\n\t\t}\n\t}\n\n\t// add_to_cart\n\twpm.addProductToCart = function (productId, quantity) {\n\n\t\ttry {\n\t\t\t// console.log('productId: ' + productId + ' | qty: ' + quantity);\n\t\t\t// console.log('productId: ' + productId + ' | variationId: ' + variationId + ' | qty: ' + quantity);\n\n\t\t\tif (!productId) throw Error(\"Wasn't able to retrieve a productId\")\n\n\t\t\tproductId = getIdBasedOndVariationsOutputSetting(productId)\n\n\t\t\tif (!productId) throw Error(\"Wasn't able to retrieve a productId\")\n\n\t\t\tif (wpmDataLayer?.products[productId]) {\n\n\t\t\t\tlet product = wpm.getProductDetailsFormattedForEvent(productId, quantity)\n\n\t\t\t\t// console.log(productId)\n\t\t\t\t// console.log(wpmDataLayer.cart)\n\n\t\t\t\tjQuery(document).trigger(\"wpmAddToCart\", product)\n\n\t\t\t\t// add product to cart wpmDataLayer['cart']\n\n\t\t\t\t// if the product already exists in the object, only add the additional quantity\n\t\t\t\t// otherwise create that product object in the wpmDataLayer['cart']\n\t\t\t\tif (wpmDataLayer?.cart[productId]) {\n\t\t\t\t\twpmDataLayer.cart[productId].quantity = wpmDataLayer.cart[productId].quantity + quantity\n\t\t\t\t} else {\n\n\t\t\t\t\tif (!(\"cart\" in wpmDataLayer)) wpmDataLayer.cart = {}\n\t\t\t\t\twpmDataLayer.cart[productId] = wpm.getProductDetailsFormattedForEvent(productId, quantity)\n\t\t\t\t}\n\n\t\t\t\tif (sessionStorage) sessionStorage.setItem(\"wpmDataLayerCart\", JSON.stringify(wpmDataLayer.cart))\n\t\t\t}\n\t\t} catch (e) {\n\t\t\tconsole.error(e)\n\n\t\t\t// fallback if wpmDataLayer.cart and wpmDataLayer.products got out of sync in case cart caching has an issue\n\t\t\twpm.getCartItemsFromBackend()\n\t\t}\n\t}\n\n\twpm.getCartItems = function () {\n\n\t\t// console.log('get cart items');\n\n\t\tif (sessionStorage) {\n\t\t\tif (!sessionStorage.getItem(\"wpmDataLayerCart\") || wpmDataLayer.shop.page_type === \"order_received_page\") {\n\t\t\t\tsessionStorage.setItem(\"wpmDataLayerCart\", JSON.stringify({}))\n\t\t\t} else {\n\t\t\t\twpm.saveCartObjectToDataLayer(JSON.parse(sessionStorage.getItem(\"wpmDataLayerCart\")))\n\t\t\t}\n\t\t} else {\n\t\t\twpm.getCartItemsFromBackend()\n\t\t}\n\t}\n\n\t// get all cart items from the backend\n\twpm.getCartItemsFromBackend = function () {\n\t\ttry {\n\t\t\tlet data = {\n\t\t\t\taction: \"wpm_get_cart_items\",\n\t\t\t}\n\n\t\t\tjQuery.ajax(\n\t\t\t\t{\n\t\t\t\t\ttype : \"get\",\n\t\t\t\t\tdataType: \"json\",\n\t\t\t\t\t// url : ajax_object.ajax_url,\n\t\t\t\t\turl : wpm.ajax_url,\n\t\t\t\t\tdata : data,\n\t\t\t\t\tsuccess: function (cartItems) {\n\n\t\t\t\t\t\t// save all cart items into wpmDataLayer\n\n\t\t\t\t\t\tif (!cartItems[\"cart\"]) cartItems[\"cart\"] = {}\n\n\t\t\t\t\t\twpm.saveCartObjectToDataLayer(cartItems[\"cart\"])\n\t\t\t\t\t\tif (sessionStorage) sessionStorage.setItem(\"wpmDataLayerCart\", JSON.stringify(cartItems[\"cart\"]))\n\t\t\t\t\t},\n\t\t\t\t})\n\t\t} catch (e) {\n\t\t\tconsole.error(e)\n\t\t}\n\t}\n\n\twpm.getProductsFromBackend = function (productIds) {\n\t\t// console.log('getting pids from back-end: ' + productIds)\n\t\t// get productIds from the backend\n\n\t\t// reduce productIds by products already in the dataLayer\n\t\tproductIds = productIds.filter(item => !wpmDataLayer.products.hasOwnProperty(item))\n\n\t\t// if no products IDs are in the object, don't try to get anything from the server\n\t\tif (!productIds || productIds.length === 0) return\n\n\t\ttry {\n\t\t\tlet data = {\n\t\t\t\taction : \"wpm_get_product_ids\",\n\t\t\t\tproductIds: productIds,\n\t\t\t}\n\n\t\t\tjQuery.ajax(\n\t\t\t\t{\n\t\t\t\t\ttype : \"get\",\n\t\t\t\t\tdataType: \"json\",\n\t\t\t\t\t// url : ajax_object.ajax_url,\n\t\t\t\t\turl : wpm.ajax_url,\n\t\t\t\t\tdata : data,\n\t\t\t\t\tsuccess: function (products) {\n\n\t\t\t\t\t\t// merge products into wpmDataLayer.products\n\t\t\t\t\t\twpmDataLayer.products = Object.assign({}, wpmDataLayer.products, products)\n\t\t\t\t\t},\n\t\t\t\t\terror : function (response) {\n\t\t\t\t\t\tconsole.log(response)\n\t\t\t\t\t},\n\t\t\t\t})\n\t\t} catch (e) {\n\t\t\tconsole.error(e)\n\t\t}\n\t}\n\n\twpm.saveCartObjectToDataLayer = function (cartObject) {\n\t\twpmDataLayer.cart = cartObject\n\t\twpmDataLayer.products = Object.assign({}, wpmDataLayer.products, cartObject)\n\t}\n\n\twpm.fireCheckoutOption = function (step, checkout_option = null, value = null) {\n\n\t\tlet data = {\n\t\t\tstep : step,\n\t\t\tcheckout_option: checkout_option,\n\t\t\tvalue : value,\n\t\t}\n\n\t\tjQuery(document).trigger(\"wpmFireCheckoutOption\", data)\n\t}\n\n\twpm.fireCheckoutProgress = function (step) {\n\n\t\tlet data = {\n\t\t\tstep: step,\n\t\t}\n\n\t\tjQuery(document).trigger(\"wpmFireCheckoutProgress\", data)\n\t}\n\n\twpm.getPostIdFromString = function (string) {\n\t\t// console.log(string);\n\t\ttry {\n\t\t\treturn string.match(/(post-)(\\d+)/)[2]\n\t\t} catch (e) {\n\t\t\tconsole.error(e)\n\t\t}\n\t}\n\n\twpm.triggerViewItemList = function (productId) {\n\n\t\t// productId = null;\n\n\t\tif (!productId) throw Error(\"Wasn't able to retrieve a productId\")\n\n\t\tproductId = getIdBasedOndVariationsOutputSetting(productId)\n\n\t\tif (!productId) throw Error(\"Wasn't able to retrieve a productId\")\n\n\t\tjQuery(document).trigger(\"wpmViewItemList\", wpm.getProductDataForViewItemEvent(productId))\n\t}\n\n\twpm.getProductDataForViewItemEvent = function (productId) {\n\n\t\tif (!productId) throw Error(\"Wasn't able to retrieve a productId\")\n\n\t\ttry {\n\t\t\tif (wpmDataLayer.products[productId]) {\n\n\t\t\t\treturn wpm.getProductDetailsFormattedForEvent(productId)\n\t\t\t}\n\t\t} catch (e) {\n\t\t\tconsole.error(e)\n\t\t}\n\t}\n\twpm.getMainProductIdFromProductPage = function () {\n\t\ttry {\n\t\t\tif ([\"simple\", \"variable\", \"grouped\", \"composite\", \"bundle\"].indexOf(wpmDataLayer.shop.product_type) >= 0) {\n\t\t\t\treturn jQuery(\".wpmProductId:first\").data(\"id\")\n\t\t\t} else {\n\t\t\t\treturn false\n\t\t\t}\n\t\t} catch (e) {\n\t\t\tconsole.error(e)\n\t\t}\n\t}\n\n\twpm.viewItemListTriggerTestMode = function (target) {\n\n\t\tjQuery(target).css({\"position\": \"relative\"})\n\t\tjQuery(target).append(\"<div id=\\\"viewItemListTriggerOverlay\\\"></div>\")\n\t\tjQuery(target).find(\"#viewItemListTriggerOverlay\").css({\n\t\t\t\"z-index\" : \"10\",\n\t\t\t\"display\" : \"block\",\n\t\t\t\"position\" : \"absolute\",\n\t\t\t\"height\" : \"100%\",\n\t\t\t\"top\" : \"0\",\n\t\t\t\"left\" : \"0\",\n\t\t\t\"right\" : \"0\",\n\t\t\t\"opacity\" : wpmDataLayer.viewItemListTrigger.opacity,\n\t\t\t\"background-color\": wpmDataLayer.viewItemListTrigger.backgroundColor,\n\t\t})\n\t}\n\n\twpm.getSearchTermFromUrl = function () {\n\t\ttry {\n\t\t\tlet urlParameters = new URLSearchParams(window.location.search)\n\t\t\treturn urlParameters.get(\"s\")\n\t\t} catch (e) {\n\t\t\tconsole.error(e)\n\t\t}\n\t}\n\n\t// we need this to track timeouts for intersection observers\n\tlet ioTimeouts = {}\n\n\twpm.observerCallback = function (entries, observer) {\n\n\t\tentries.forEach((entry) => {\n\n\t\t\ttry {\n\t\t\t\tlet productId\n\n\t\t\t\tlet elementId = jQuery(entry.target).data(\"ioid\")\n\n\t\t\t\t// Get the productId from next element, if wpmProductId is a sibling, like in Gutenberg blocks\n\t\t\t\t// otherwise go search in children, like in regular WC loop items\n\t\t\t\tif (jQuery(entry.target).next(\".wpmProductId\").length) {\n\t\t\t\t\t// console.log('test 1');\n\t\t\t\t\tproductId = jQuery(entry.target).next(\".wpmProductId\").data(\"id\")\n\t\t\t\t} else {\n\t\t\t\t\tproductId = jQuery(entry.target).find(\".wpmProductId\").data(\"id\")\n\t\t\t\t}\n\n\t\t\t\t// productId = null;\n\n\t\t\t\tif (!productId) throw Error(\"wpmProductId element not found\")\n\n\t\t\t\tif (entry.isIntersecting) {\n\n\t\t\t\t\t// console.log('prodid: ' + productId);\n\t\t\t\t\tioTimeouts[elementId] = setTimeout(() => {\n\t\t\t\t\t\t// console.log('prodid: ' + productId);\n\t\t\t\t\t\twpm.triggerViewItemList(productId)\n\t\t\t\t\t\tif (wpmDataLayer.viewItemListTrigger.testMode) wpm.viewItemListTriggerTestMode(entry.target)\n\t\t\t\t\t\tif (wpmDataLayer.viewItemListTrigger.repeat === false) observer.unobserve(entry.target)\n\t\t\t\t\t}, wpmDataLayer.viewItemListTrigger.timeout)\n\n\t\t\t\t} else {\n\n\t\t\t\t\tclearTimeout(ioTimeouts[elementId])\n\t\t\t\t\tif (wpmDataLayer.viewItemListTrigger.testMode) jQuery(entry.target).find(\"#viewItemListTriggerOverlay\").remove()\n\t\t\t\t}\n\t\t\t} catch (e) {\n\t\t\t\tconsole.error(e)\n\t\t\t}\n\t\t})\n\t}\n\n\t// fire view_item_list only on products that have become visible\n\tlet io\n\tlet ioid = 0\n\tlet allIoElementsToWatch\n\n\tlet getAllElementsToWatch = function () {\n\n\t\tallIoElementsToWatch = jQuery(\".wpmProductId\")\n\t\t\t.map(function (i, elem) {\n\t\t\t\t// console.log(elem);\n\t\t\t\tif (\n\t\t\t\t\tjQuery(elem).parent().hasClass(\"type-product\") ||\n\t\t\t\t\tjQuery(elem).parent().hasClass(\"product\") ||\n\t\t\t\t\tjQuery(elem).parent().hasClass(\"product-item-inner\")\n\t\t\t\t) {\n\t\t\t\t\t// console.log(elem);\n\t\t\t\t\treturn jQuery(elem).parent()\n\t\t\t\t} else if (\n\t\t\t\t\tjQuery(elem).prev().hasClass(\"wc-block-grid__product\") ||\n\t\t\t\t\tjQuery(elem).prev().hasClass(\"product\") ||\n\t\t\t\t\tjQuery(elem).prev().hasClass(\"product-small\") ||\n\t\t\t\t\tjQuery(elem).prev().hasClass(\"woocommerce-LoopProduct-link\")\n\t\t\t\t) {\n\t\t\t\t\treturn jQuery(this).prev()\n\t\t\t\t} else if (jQuery(elem).closest(\".product\").length) {\n\t\t\t\t\treturn jQuery(elem).closest(\".product\")\n\t\t\t\t}\n\t\t\t})\n\t}\n\n\twpm.startIntersectionObserverToWatch = function () {\n\n\t\ttry {\n\t\t\t// enable view_item_list test mode from browser\n\t\t\tif (wpm.urlHasParameter(\"vildemomode\")) wpmDataLayer.viewItemListTrigger.testMode = true\n\n\t\t\t// set up intersection observer\n\t\t\tio = new IntersectionObserver(wpm.observerCallback, {\n\t\t\t\tthreshold: wpmDataLayer.viewItemListTrigger.threshold,\n\t\t\t})\n\n\t\t\tgetAllElementsToWatch()\n\n\t\t\t// console.log(allElementsToWatch);\n\n\t\t\tallIoElementsToWatch.each(function (i, elem) {\n\t\t\t\t// console.log(elem[0]);\n\t\t\t\t// jQuery(elem[0]).attr('data-ioid', ioid++);\n\t\t\t\tjQuery(elem[0]).data(\"ioid\", ioid++)\n\n\t\t\t\tio.observe(elem[0])\n\t\t\t})\n\t\t} catch (e) {\n\t\t\tconsole.error(e)\n\t\t}\n\t}\n\n\t// watch DOM for new lazy loaded products and add them to the intersection observer\n\twpm.startProductsMutationObserverToWatch = function () {\n\n\t\ttry {\n\t\t\t// Pass in the target node, as well as the observer options\n\n\t\t\t// selects the most common parent node\n\t\t\t// https://stackoverflow.com/a/7648323/4688612\n\t\t\tlet productsNode = jQuery(\".wpmProductId:eq(0)\").parents().has(jQuery(\".wpmProductId:eq(1)\").parents()).first()\n\n\t\t\tif (productsNode.length) {\n\t\t\t\tproductsMutationObserver.observe(productsNode[0], {\n\t\t\t\t\tattributes : true,\n\t\t\t\t\tchildList : true,\n\t\t\t\t\tcharacterData: true,\n\t\t\t\t})\n\t\t\t}\n\t\t} catch (e) {\n\t\t\tconsole.error(e)\n\t\t}\n\t}\n\n\t// Create an observer instance\n\tlet productsMutationObserver = new MutationObserver(function (mutations) {\n\n\t\tmutations.forEach(function (mutation) {\n\t\t\tlet newNodes = mutation.addedNodes // DOM NodeList\n\t\t\tif (newNodes !== null) { // If there are new nodes added\n\t\t\t\tlet nodes = jQuery(newNodes) // jQuery set\n\t\t\t\tnodes.each(function () {\n\t\t\t\t\tif (\n\t\t\t\t\t\tjQuery(this).hasClass(\"type-product\") ||\n\t\t\t\t\t\tjQuery(this).hasClass(\"product-small\") ||\n\t\t\t\t\t\tjQuery(this).hasClass(\"wc-block-grid__product\")\n\t\t\t\t\t) {\n\t\t\t\t\t\t// check if the node has a child or sibling wpmProductId\n\t\t\t\t\t\t// if yes add it to the intersectionObserver\n\t\t\t\t\t\tif (hasWpmProductIdElement(this)) {\n\t\t\t\t\t\t\tjQuery(this).data(\"ioid\", ioid++)\n\t\t\t\t\t\t\tio.observe(this)\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t})\n\t\t\t}\n\t\t})\n\t})\n\n\tlet hasWpmProductIdElement = function (elem) {\n\t\treturn !!(jQuery(elem).find(\".wpmProductId\").length ||\n\t\t\tjQuery(elem).siblings(\".wpmProductId\").length)\n\t}\n\n\twpm.setCookie = function (cookieName, cookieValue = \"\", expiryDays = null) {\n\t\tif (expiryDays) {\n\t\t\tlet d = new Date()\n\t\t\td.setTime(d.getTime() + (expiryDays * 24 * 60 * 60 * 1000))\n\t\t\tlet expires = \"expires=\" + d.toUTCString()\n\t\t\tdocument.cookie = cookieName + \"=\" + cookieValue + \";\" + expires + \";path=/\"\n\t\t} else {\n\t\t\tdocument.cookie = cookieName + \"=\" + cookieValue + \";path=/\"\n\t\t}\n\t}\n\n\twpm.getCookie = function (cookieName) {\n\t\tlet name = cookieName + \"=\"\n\t\tlet decodedCookie = decodeURIComponent(document.cookie)\n\t\tlet ca = decodedCookie.split(\";\")\n\t\tfor (let i = 0; i < ca.length; i++) {\n\t\t\tlet c = ca[i]\n\t\t\twhile (c.charAt(0) == \" \") {\n\t\t\t\tc = c.substring(1)\n\t\t\t}\n\t\t\tif (c.indexOf(name) == 0) {\n\t\t\t\treturn c.substring(name.length, c.length)\n\t\t\t}\n\t\t}\n\t\treturn \"\"\n\t}\n\n\twpm.getWpmSessionData = function () {\n\t\tif (window.sessionStorage) {\n\n\t\t\tlet data = window.sessionStorage.getItem(\"_wpm\")\n\t\t\tif (data !== null) {\n\t\t\t\treturn JSON.parse(data)\n\t\t\t} else {\n\t\t\t\treturn {}\n\t\t\t}\n\t\t} else {\n\t\t\treturn {}\n\t\t}\n\t}\n\n\twpm.setWpmSessionData = function (data) {\n\t\tif (window.sessionStorage) {\n\t\t\twindow.sessionStorage.setItem(\"_wpm\", JSON.stringify(data))\n\t\t}\n\t}\n\n\twpm.storeOrderIdOnServer = function (orderId) {\n\n\t\t// console.log('saving wpm_purchase_pixels_fired');\n\n\t\t// console.log('url: ' + wpm_premium_only_ajax_object.ajax_url);\n\t\t// console.log('nonce: ' + wpm_premium_only_ajax_object.nonce);\n\t\t// console.log('url: ' + wpm.ajax_url);\n\t\t// console.log('nonce: ' + wpm.nonce);\n\n\t\ttry {\n\t\t\t// save the state in the database\n\t\t\tlet data = {\n\t\t\t\taction : \"wpm_purchase_pixels_fired\",\n\t\t\t\torder_id: orderId,\n\t\t\t\t// nonce : ajax_object.nonce,\n\t\t\t\tnonce: wpm.nonce,\n\t\t\t}\n\n\t\t\tjQuery.ajax(\n\t\t\t\t{\n\t\t\t\t\ttype : \"post\",\n\t\t\t\t\tdataType: \"json\",\n\t\t\t\t\t// url : ajax_object.ajax_url,\n\t\t\t\t\turl : wpm.ajax_url,\n\t\t\t\t\tdata : data,\n\t\t\t\t\tsuccess: function (response) {\n\t\t\t\t\t\tif (response.success === false) {\n\t\t\t\t\t\t\tconsole.log(response)\n\t\t\t\t\t\t}\n\t\t\t\t\t},\n\t\t\t\t\terror : function (response) {\n\t\t\t\t\t\tconsole.log(response)\n\t\t\t\t\t},\n\t\t\t\t})\n\t\t} catch (e) {\n\t\t\tconsole.error(e)\n\t\t}\n\t}\n\n\twpm.getProductIdByCartItemKeyUrl = function (url) {\n\t\tlet searchParams = new URLSearchParams(url.search)\n\t\tlet cartItemKey = searchParams.get(\"remove_item\")\n\n\t\tlet productId\n\n\t\tif (wpmDataLayer.cartItemKeys[cartItemKey][\"variation_id\"] === 0) {\n\t\t\tproductId = wpmDataLayer.cartItemKeys[cartItemKey][\"product_id\"]\n\t\t} else {\n\t\t\tproductId = wpmDataLayer.cartItemKeys[cartItemKey][\"variation_id\"]\n\t\t}\n\n\t\treturn productId\n\t}\n\n\twpm.getAddToCartLinkProductIds = function () {\n\t\treturn jQuery(\"a\").map(function () {\n\t\t\tlet href = jQuery(this).attr(\"href\")\n\n\t\t\tif (href && href.includes(\"?add-to-cart=\")) {\n\t\t\t\tlet matches = href.match(/(add-to-cart=)(\\d+)/)\n\t\t\t\tif (matches) return matches[2]\n\t\t\t}\n\t\t}).get()\n\t}\n\n\twpm.getProductDetailsFormattedForEvent = function (productId, quantity = 1) {\n\n\t\t// console.log(wpmDataLayer.products[productId].dyn_r_ids)\n\n\t\tlet product = {\n\t\t\tid : productId.toString(),\n\t\t\tdyn_r_ids : wpmDataLayer.products[productId].dyn_r_ids,\n\t\t\tname : wpmDataLayer.products[productId].name,\n\t\t\tlist_name : wpmDataLayer.shop.list_name,\n\t\t\tbrand : wpmDataLayer.products[productId].brand,\n\t\t\tcategory : wpmDataLayer.products[productId].category,\n\t\t\tvariant : wpmDataLayer.products[productId].variant,\n\t\t\tlist_position: wpmDataLayer.products[productId].position,\n\t\t\tquantity : quantity,\n\t\t\tprice : wpmDataLayer.products[productId].price,\n\t\t\tcurrency : wpmDataLayer.shop.currency,\n\t\t\tisVariable : wpmDataLayer.products[productId].isVariable,\n\t\t\tisVariation : wpmDataLayer.products[productId].isVariation,\n\t\t\tparentId : wpmDataLayer.products[productId].parentId,\n\t\t}\n\n\t\tif (product.isVariation) product[\"parentId_dyn_r_ids\"] = wpmDataLayer.products[productId].parentId_dyn_r_ids\n\n\t\treturn product\n\t}\n\n\twpm.setReferrerToCookie = function () {\n\t\t// can't use session storage as we can't read it from the server\n\t\tif (!wpm.getCookie(\"wpmReferrer\")) {\n\t\t\twpm.setCookie(\"wpmReferrer\", document.referrer)\n\t\t}\n\t}\n\n\twpm.getReferrerFromCookie = function () {\n\t\tif (wpm.getCookie(\"wpmReferrer\")) {\n\t\t\treturn wpm.getCookie(\"wpmReferrer\")\n\t\t} else {\n\t\t\treturn null\n\t\t}\n\t}\n\n\twpm.getClidFromBrowser = function (clidId = \"gclid\") {\n\n\t\tlet clidCookieId\n\n\t\tclidCookieId = {\n\t\t\tgclid: \"_gcl_aw\",\n\t\t\tdclid: \"_gcl_dc\",\n\t\t}\n\n\t\tif (wpm.getCookie(clidCookieId[clidId])) {\n\t\t\tlet clidCookie = wpm.getCookie(clidCookieId[clidId])\n\t\t\tlet matches = clidCookie.match(/(GCL.[\\d]*.)(.*)/)\n\t\t\treturn matches[2]\n\t\t} else {\n\t\t\treturn \"\"\n\t\t}\n\t}\n\n\twpm.getUserAgent = function () {\n\t\treturn navigator.userAgent\n\t}\n\n\twpm.getViewPort = function () {\n\t\treturn {\n\t\t\twidth : Math.max(document.documentElement.clientWidth || 0, window.innerWidth || 0),\n\t\t\theight: Math.max(document.documentElement.clientHeight || 0, window.innerHeight || 0),\n\t\t}\n\t}\n\n\t/*\n\t* Handle Cookie Management Platforms\n\t* */\n\n\tlet getComplianzCookies = function () {\n\n\t\tlet cmplz_statistics = wpm.getCookie(\"cmplz_statistics\")\n\t\tlet cmplz_marketing = wpm.getCookie(\"cmplz_marketing\")\n\t\tlet cmplz_consent_status = wpm.getCookie(\"cmplz_consent_status\") || wpm.getCookie(\"cmplz_banner-status\")\n\n\n\t\tif (cmplz_consent_status) {\n\t\t\treturn {\n\t\t\t\tanalytics : cmplz_statistics === \"allow\",\n\t\t\t\tads : cmplz_marketing === \"allow\",\n\t\t\t\tvisitorHasChosen: true,\n\t\t\t}\n\t\t} else {\n\t\t\treturn false\n\t\t}\n\t}\n\n\tlet getCookieLawInfoCookies = function () {\n\n\t\tlet analyticsCookie = wpm.getCookie(\"cookielawinfo-checkbox-analytics\") || wpm.getCookie(\"cookielawinfo-checkbox-analytiques\")\n\t\tlet adsCookie = wpm.getCookie(\"cookielawinfo-checkbox-advertisement\") || wpm.getCookie(\"cookielawinfo-checkbox-publicite\")\n\t\tlet visitorHasChosen = wpm.getCookie(\"CookieLawInfoConsent\")\n\n\t\tif (analyticsCookie || adsCookie) {\n\n\t\t\treturn {\n\t\t\t\tanalytics : analyticsCookie === \"yes\",\n\t\t\t\tads : adsCookie === \"yes\",\n\t\t\t\tvisitorHasChosen: !!visitorHasChosen,\n\t\t\t}\n\t\t} else {\n\t\t\treturn false\n\t\t}\n\t}\n\n\n\tlet\n\t\twpmConsentValues = {}\n\twpmConsentValues.categories = {}\n\twpmConsentValues.pixels = []\n\twpmConsentValues.mode = \"category\"\n\twpmConsentValues.visitorHasChosen = false\n\n\twpm.getConsentValues = function () {\n\t\treturn wpmConsentValues\n\t}\n\n\twpm.setConsentValueCategories = function (analytics = false, ads = false) {\n\t\twpmConsentValues.categories.analytics = analytics\n\t\twpmConsentValues.categories.ads = ads\n\t}\n\n\twpm.updateConsentCookieValues = function (explicitConsent = false) {\n\n\t\t// ad_storage\n\t\t// analytics_storage\n\t\t// functionality_storage\n\t\t// personalization_storage\n\t\t// security_storage\n\n\t\t// console.log('exp cons: ' + explicitConsent)\n\n\t\tlet cookie\n\n\t\tif (cookie = wpm.getCookie(\"CookieConsent\")) {\n\t\t\t// Cookiebot\n\t\t\t// https://wordpress.org/plugins/cookiebot/\n\t\t\tcookie = decodeURI(cookie)\n\n\t\t\t// console.log(cookie.indexOf('statistics:true'))\n\t\t\t// console.log(cookie.indexOf('marketing:true'))\n\n\t\t\twpmConsentValues.categories.analytics = cookie.indexOf(\"statistics:true\") >= 0\n\t\t\twpmConsentValues.categories.ads = cookie.indexOf(\"marketing:true\") >= 0\n\t\t\twpmConsentValues.visitorHasChosen = true\n\n\t\t} else if (cookie = wpm.getCookie(\"CookieScriptConsent\")) {\n\t\t\t// Cookie Script\n\t\t\t// https://wordpress.org/plugins/cookie-script-com/\n\n\t\t\tcookie = JSON.parse(cookie)\n\n\t\t\t// console.log(cookie)\n\t\t\t// console.log(cookie.action)\n\t\t\t// console.log('cat length: ' + cookie.categories.length)\n\t\t\t// console.log(cookie.categories.indexOf('performance'))\n\n\t\t\tif (cookie.action === \"reject\") {\n\t\t\t\twpmConsentValues.categories.analytics = false\n\t\t\t\twpmConsentValues.categories.ads = false\n\t\t\t} else if (cookie.categories.length === 2) {\n\t\t\t\twpmConsentValues.categories.analytics = true\n\t\t\t\twpmConsentValues.categories.ads = true\n\t\t\t} else {\n\t\t\t\twpmConsentValues.categories.analytics = cookie.categories.indexOf(\"performance\") >= 0\n\t\t\t\twpmConsentValues.categories.ads = cookie.categories.indexOf(\"targeting\") >= 0\n\t\t\t}\n\n\t\t\twpmConsentValues.visitorHasChosen = true\n\n\t\t\t// console.log(wpmConsentValues)\n\n\t\t} else if (cookie = wpm.getCookie(\"borlabs-cookie\")) {\n\t\t\t// Borlabs Cookie\n\t\t\t// https://borlabs.io/borlabs-cookie/\n\n\t\t\tcookie = decodeURI(cookie)\n\t\t\tcookie = JSON.parse(cookie)\n\n\t\t\twpmConsentValues.categories.analytics = !!cookie?.consents?.statistics\n\t\t\twpmConsentValues.categories.ads = !!cookie?.consents?.marketing\n\t\t\twpmConsentValues.visitorHasChosen = true\n\t\t\twpmConsentValues.pixels = [...cookie?.consents?.statistics || [], ...cookie?.consents?.marketing || []]\n\t\t\twpmConsentValues.mode = \"pixel\"\n\n\t\t} else if (cookie = getComplianzCookies()) {\n\t\t\t// Complianz Cookie\n\t\t\t// https://wordpress.org/plugins/complianz-gdpr/\n\n\t\t\t// console.log(cookie)\n\n\t\t\twpmConsentValues.categories.analytics = cookie.analytics === true\n\t\t\twpmConsentValues.categories.ads = cookie.ads === true\n\t\t\twpmConsentValues.visitorHasChosen = cookie.visitorHasChosen\n\n\t\t\t// console.log(wpmConsentValues)\n\n\t\t} else if (cookie = wpm.getCookie(\"cookie_notice_accepted\")) {\n\t\t\t// Cookie Compliance (free version)\n\t\t\t// https://wordpress.org/plugins/cookie-notice/\n\n\t\t\twpmConsentValues.categories.analytics = true\n\t\t\twpmConsentValues.categories.ads = true\n\t\t\twpmConsentValues.visitorHasChosen = true\n\n\t\t} else if (cookie = wpm.getCookie(\"hu-consent\")) {\n\t\t\t// Cookie Compliance (pro version)\n\t\t\t// https://wordpress.org/plugins/cookie-notice/\n\n\t\t\tcookie = JSON.parse(cookie)\n\n\t\t\twpmConsentValues.categories.analytics = !!cookie.categories[\"3\"]\n\t\t\twpmConsentValues.categories.ads = !!cookie.categories[\"4\"]\n\t\t\twpmConsentValues.visitorHasChosen = true\n\n\t\t} else if (cookie = getCookieLawInfoCookies()) {\n\t\t\t// CookieYes, GDPR Cookie Consent (Cookie Law Info)\n\t\t\t// https://wordpress.org/plugins/cookie-law-info/\n\n\t\t\twpmConsentValues.categories.analytics = cookie.analytics === true\n\t\t\twpmConsentValues.categories.ads = cookie.ads === true\n\t\t\twpmConsentValues.visitorHasChosen = cookie.visitorHasChosen === true\n\n\t\t} else if (cookie = wpm.getCookie(\"moove_gdpr_popup\")) {\n\t\t\t// GDPR Cookie Compliance Plugin by Moove Agency\n\t\t\t// https://wordpress.org/plugins/gdpr-cookie-compliance/\n\t\t\t// TODO write documentation on how to set up the plugin in order for this to work properly\n\n\t\t\tcookie = JSON.parse(cookie)\n\t\t\t// console.log('moove cookie thirdparty: ' + cookie.thirdparty)\n\t\t\t// console.log('moove cookie advanced: ' + cookie.advanced)\n\n\t\t\twpmConsentValues.categories.analytics = cookie.thirdparty === \"1\"\n\t\t\twpmConsentValues.categories.ads = cookie.advanced === \"1\"\n\t\t\twpmConsentValues.visitorHasChosen = true\n\n\t\t\t// console.log(wpmConsentValues)\n\n\t\t} else {\n\t\t\t// consentValues.categories.analytics = true\n\t\t\t// consentValues.categories.ads = true\n\n\t\t\twpmConsentValues.categories.analytics = !explicitConsent\n\t\t\twpmConsentValues.categories.ads = !explicitConsent\n\t\t}\n\t}\n\n\twpm.updateConsentCookieValues()\n\n\twpm.setConsentDefaultValuesToExplicit = function () {\n\t\twpmConsentValues.categories = {\n\t\t\tanalytics: false,\n\t\t\tads : false,\n\t\t}\n\t}\n\n\twpm.canIFire = function (category, pixelName) {\n\n\t\tlet canIFireMode\n\n\t\tif (\"category\" === wpmConsentValues.mode) {\n\t\t\tcanIFireMode = !!wpmConsentValues.categories[category]\n\t\t} else if (\"pixel\" === wpmConsentValues.mode) {\n\t\t\tcanIFireMode = wpmConsentValues.pixels.includes(pixelName)\n\t\t} else {\n\t\t\tconsole.error(\"Couldn't find a valid consent mode in wpmConsentValues\")\n\t\t\tcanIFireMode = false\n\t\t}\n\n\t\tif (canIFireMode) {\n\t\t\treturn true\n\t\t} else {\n\t\t\tif (true || wpm.urlHasParameter(\"debugConsentMode\")) {\n\t\t\t\twpm.logPreventedPixelLoading(pixelName, category)\n\t\t\t}\n\n\t\t\treturn false\n\t\t}\n\t}\n\n\twpm.logPreventedPixelLoading = function (pixelName, category) {\n\t\tif (wpmDataLayer?.shop?.cookie_consent_mgmt?.explicit_consent) {\n\t\t\tconsole.log(\"WooCommerce Pixel Manager: The \\\"\" + pixelName + \" (category: \" + category + \")\\\" pixel has not fired because you have not given consent for it yet. (WPM is in explicit consent mode.)\")\n\t\t} else {\n\t\t\tconsole.log(\"WooCommerce Pixel Manager: The \\\"\" + pixelName + \" (category: \" + category + \")\\\" pixel has not fired because you have removed consent for this pixel. (WPM is in implicit consent mode.)\")\n\t\t}\n\t}\n\n\t/**\n\t * Runs through each script in <head> and blocks / unblocks it according to the plugin settings\n\t * and user consent.\n\t */\n\n\t// https://stackoverflow.com/q/65453565/4688612\n\twpm.scriptTagObserver = new MutationObserver((mutations) => {\n\t\tmutations.forEach(({addedNodes}) => {\n\t\t\t[...addedNodes]\n\t\t\t\t.forEach(node => {\n\n\t\t\t\t\tif ($(node).data(\"wpm-cookie-category\")) {\n\n\t\t\t\t\t\t// console.log(node)\n\n\t\t\t\t\t\t// If the pixel category has been approved > unblock\n\t\t\t\t\t\t// If the pixel belongs to more than one category, then unblock if one of the categories has been approved\n\t\t\t\t\t\t// If no category has been approved, but the Google Consent Mode is active, then only unblock the Google scripts\n\n\t\t\t\t\t\tif (wpm.shouldScriptBeActive(node)) {\n\t\t\t\t\t\t\twpm.unblockScript(node)\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\twpm.blockScript(node)\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t})\n\t\t})\n\t})\n\n\twpm.scriptTagObserver.observe(document.head, {childList: true, subtree: true})\n\twindow.addEventListener(\"DOMContentLoaded\", () => wpm.scriptTagObserver.disconnect())\n\n\twpm.shouldScriptBeActive = function (node) {\n\n\t\tif (\n\t\t\twpmDataLayer.shop.cookie_consent_mgmt.explicit_consent ||\n\t\t\twpmConsentValues.visitorHasChosen\n\t\t) {\n\n\t\t\tif (wpmConsentValues.mode === \"category\" && $(node).data(\"wpm-cookie-category\").split(\",\").some(element => wpmConsentValues.categories[element])) {\n\t\t\t\treturn true\n\t\t\t} else if (wpmConsentValues.mode === \"pixel\" && wpmConsentValues.pixels.includes($(node).data(\"wpm-pixel-name\"))) {\n\t\t\t\treturn true\n\t\t\t} else if (wpmConsentValues.mode === \"pixel\" && $(node).data(\"wpm-pixel-name\") === \"google\" && [\"google-analytics\", \"google-ads\"].some(element => wpmConsentValues.pixels.includes(element))) {\n\t\t\t\treturn true\n\t\t\t} else if (wpmDataLayer?.pixels?.google?.consent_mode?.active && $(node).data(\"wpm-pixel-name\") === \"google\") {\n\t\t\t\treturn true\n\t\t\t} else {\n\t\t\t\treturn false\n\t\t\t}\n\t\t} else {\n\t\t\treturn true\n\t\t}\n\t}\n\n\n\twpm.unblockScript = function (scriptNode, removeAttach = false) {\n\n\t\tif (removeAttach) $(scriptNode).remove()\n\n\t\tlet wpmSrc = $(scriptNode).data(\"wpm-src\")\n\t\tif (wpmSrc) $(scriptNode).attr(\"src\", wpmSrc)\n\n\t\tscriptNode.type = \"text/javascript\"\n\n\t\tif (removeAttach) $(scriptNode).appendTo(\"head\")\n\n\t\tjQuery(document).trigger(\"wpmPreLoadPixels\", {})\n\t}\n\n\twpm.blockScript = function (scriptNode, removeAttach = false) {\n\n\t\tif (removeAttach) $(scriptNode).remove()\n\n\t\tif ($(scriptNode).attr(\"src\")) $(scriptNode).removeAttr(\"src\")\n\t\tscriptNode.type = \"blocked/javascript\"\n\n\t\tif (removeAttach) $(scriptNode).appendTo(\"head\")\n\t}\n\n\twpm.unblockAllScripts = function (analytics = true, ads = true) {\n\t\t// console.log('unblocking all scripts')\n\n\t\t$.each(\n\t\t\t$(\"script[type=\\\"blocked/javascript\\\"]\"), function (index, scriptNode) {\n\n\t\t\t\tif ($(scriptNode).data(\"wpm-cookie-category\").includes(\"analytics\") && analytics) {\n\t\t\t\t\twpm.unblockScript(scriptNode, true)\n\t\t\t\t} else if ($(scriptNode).data(\"wpm-cookie-category\").includes(\"ads\") && ads) {\n\t\t\t\t\twpm.unblockScript(scriptNode, true)\n\t\t\t\t}\n\t\t\t})\n\n\t\tjQuery(document).trigger(\"wpmPreLoadPixels\", {})\n\t}\n\n\twpm.unblockSelectedPixels = function () {\n\t\t$.each(\n\t\t\t$(\"script[type=\\\"blocked/javascript\\\"]\"), function (index, node) {\n\n\t\t\t\tif (wpmConsentValues.pixels.includes($(node).data(\"wpm-pixel-name\"))) {\n\t\t\t\t\twpm.unblockScript(node, true)\n\t\t\t\t} else if ($(node).data(\"wpm-pixel-name\") === \"google\" && [\"google-analytics\", \"google-ads\"].some(element => wpmConsentValues.pixels.includes(element))) {\n\t\t\t\t\twpm.unblockScript(node, true)\n\t\t\t\t}\n\t\t\t})\n\n\t\tjQuery(document).trigger(\"wpmPreLoadPixels\", {})\n\t}\n\n\n\t/**\n\t * Block or unblock scripts for each CMP immediately after cookie consent has been updated\n\t * by the visitor.\n\t */\n\n\t// Borlabs Cookie\n\t// If visitor accepts cookies in Borlabs Cookie unblock the scripts\n\twindow.addEventListener(\"borlabs-cookie-consent-saved\", function () {\n\n\t\twpm.updateConsentCookieValues()\n\n\t\tif (wpmConsentValues.mode === \"pixel\") {\n\n\t\t\twpm.unblockSelectedPixels()\n\t\t\twpm.updateGoogleConsentMode(wpmConsentValues.pixels.includes(\"google-analytics\"), wpmConsentValues.pixels.includes(\"google-ads\"))\n\t\t} else {\n\n\t\t\twpm.unblockAllScripts(wpmConsentValues.categories.analytics, wpmConsentValues.categories.ads)\n\t\t\twpm.updateGoogleConsentMode(wpmConsentValues.categories.analytics, wpmConsentValues.categories.ads)\n\t\t}\n\t})\n\n\t// Cookiebot\n\t// If visitor accepts cookies in Cookiebot unblock the scripts\n\t// https://www.cookiebot.com/en/developer/\n\twindow.addEventListener(\"CookiebotOnAccept\", function () {\n\t\tif (Cookiebot.consent.statistics) wpmConsentValues.categories.analytics = true\n\t\tif (Cookiebot.consent.marketing) wpmConsentValues.categories.ads = true\n\n\t\twpm.unblockAllScripts(wpmConsentValues.categories.analytics, wpmConsentValues.categories.ads)\n\t\twpm.updateGoogleConsentMode(wpmConsentValues.categories.analytics, wpmConsentValues.categories.ads)\n\n\t}, false)\n\n\t/**\n\t * Cookie Script\n\t * If visitor accepts cookies in Cookie Script unblock the scripts\n\t * https://support.cookie-script.com/article/20-custom-events\n\t */\n\twindow.addEventListener(\"CookieScriptAccept\", function (e) {\n\t\tif (e.detail.categories.includes(\"performance\")) wpmConsentValues.categories.analytics = true\n\t\tif (e.detail.categories.includes(\"targeting\")) wpmConsentValues.categories.ads = true\n\n\t\twpm.unblockAllScripts(wpmConsentValues.categories.analytics, wpmConsentValues.categories.ads)\n\t\twpm.updateGoogleConsentMode(wpmConsentValues.categories.analytics, wpmConsentValues.categories.ads)\n\t})\n\n\t/**\n\t * Cookie Script\n\t * If visitor accepts cookies in Cookie Script unblock the scripts\n\t * https://support.cookie-script.com/\n\t */\n\twindow.addEventListener(\"CookieScriptAcceptAll\", function () {\n\t\twpm.unblockAllScripts(true, true)\n\t\twpm.updateGoogleConsentMode(true, true)\n\t})\n\n\t// Complianz Cookie\n\t// If visitor accepts cookies in Complianz unblock the scripts\n\tdocument.addEventListener(\"cmplzStatusChange\", function () {\n\n\t\twpm.updateConsentCookieValues()\n\n\t\t// console.log(wpmConsentValues)\n\n\t\twpm.unblockAllScripts(wpmConsentValues.categories.analytics, wpmConsentValues.categories.ads)\n\t\twpm.updateGoogleConsentMode(wpmConsentValues.categories.analytics, wpmConsentValues.categories.ads)\n\t})\n\n\t// Cookie Compliance by hu-manity.co (free and pro)\n\t// If visitor accepts cookies in Cookie Notice by hu-manity.co unblock the scripts (free version)\n\t// https://wordpress.org/support/topic/events-on-consent-change/#post-15202792\n\tdocument.addEventListener(\"setCookieNotice\", function () {\n\n\t\twpm.updateConsentCookieValues()\n\n\t\t// console.log(wpmConsentValues)\n\n\t\twpm.unblockAllScripts(wpmConsentValues.categories.analytics, wpmConsentValues.categories.ads)\n\t\twpm.updateGoogleConsentMode(wpmConsentValues.categories.analytics, wpmConsentValues.categories.ads)\n\t})\n\n\t/**\n\t * Cookie Compliance by hu-manity.co (free and pro)\n\t * If visitor accepts cookies in Cookie Notice by hu-manity.co unblock the scripts (pro version)\n\t * https://wordpress.org/support/topic/events-on-consent-change/#post-15202792\n\t * Because Cookie Notice has no documented API or event that is being triggered on consent save or update\n\t * we have to solve this by using a mutation observer.\n\t *\n\t * @type {MutationObserver}\n\t */\n\n\twpm.huObserver = new MutationObserver(function (mutations) {\n\t\tmutations.forEach(({addedNodes}) => {\n\t\t\t[...addedNodes]\n\t\t\t\t.forEach(node => {\n\n\t\t\t\t\tif (node.id === \"hu\") {\n\n\t\t\t\t\t\tjQuery(\".hu-cookies-save\").on(\"click\", function () {\n\t\t\t\t\t\t\twpm.updateConsentCookieValues()\n\t\t\t\t\t\t\twpm.unblockAllScripts(wpmConsentValues.categories.analytics, wpmConsentValues.categories.ads)\n\t\t\t\t\t\t\twpm.updateGoogleConsentMode(wpmConsentValues.categories.analytics, wpmConsentValues.categories.ads)\n\t\t\t\t\t\t})\n\t\t\t\t\t}\n\t\t\t\t})\n\t\t})\n\t})\n\n\tif (window.hu) {\n\t\twpm.huObserver.observe(document.documentElement || document.body, {childList: true, subtree: true})\n\t}\n\n\twpm.version = function () {\n\t\tconsole.log(wpmDataLayer.version)\n\t}\n\n\t// https://api.jquery.com/jquery.getscript/\n\twpm.loadScriptAndCacheIt = function (url, options) {\n\n\t\t// Allow user to set any option except for dataType, cache, and url\n\t\toptions = jQuery.extend(options || {}, {\n\t\t\tdataType: \"script\",\n\t\t\tcache : true,\n\t\t\turl : url,\n\t\t})\n\n\t\t// Use $.ajax() since it is more flexible than $.getScript\n\t\t// Return the jqXHR object so we can chain callbacks\n\t\treturn jQuery.ajax(options)\n\t}\n\n\twpm.getOrderItemPrice = function (orderItem) {\n\t\treturn (orderItem.total + orderItem.total_tax) / orderItem.quantity\n\t}\n\n\twpm.hasLoginEventFired = function () {\n\t\tlet data = wpm.getWpmSessionData()\n\t\treturn data?.loginEventFired\n\t}\n\n\twpm.setLoginEventFired = function () {\n\t\tlet data = wpm.getWpmSessionData()\n\t\tdata[\"loginEventFired\"] = true\n\t\twpm.setWpmSessionData(data)\n\t}\n\n\twpm.wpmDataLayerExists = function () {\n\t\treturn new Promise(function (resolve) {\n\t\t\t(function waitForVar() {\n\t\t\t\tif (typeof wpmDataLayer !== \"undefined\") return resolve()\n\t\t\t\tsetTimeout(waitForVar, 50)\n\t\t\t})()\n\t\t})\n\t}\n\n\twpm.jQueryExists = function () {\n\t\treturn new Promise(function (resolve) {\n\t\t\t(function waitForjQuery() {\n\t\t\t\tif (typeof jQuery !== \"undefined\") return resolve()\n\t\t\t\tsetTimeout(waitForjQuery, 100)\n\t\t\t})()\n\t\t})\n\t}\n\n\twpm.pageLoaded = function () {\n\t\treturn new Promise(function (resolve) {\n\t\t\t(function waitForVar() {\n\t\t\t\tif (\"complete\" === document.readyState) return resolve()\n\t\t\t\tsetTimeout(waitForVar, 50)\n\t\t\t})()\n\t\t})\n\t}\n\n\twpm.pageReady = function () {\n\t\treturn new Promise(function (resolve) {\n\t\t\t(function waitForVar() {\n\t\t\t\tif (\"interactive\" === document.readyState || \"complete\" === document.readyState) return resolve()\n\t\t\t\tsetTimeout(waitForVar, 50)\n\t\t\t})()\n\t\t})\n\t}\n\n\twpm.isMiniCartActive = function () {\n\t\tif (window.sessionStorage) {\n\t\t\tfor (const [key, value] of Object.entries(window.sessionStorage)) {\n\t\t\t\tif (key.includes(\"wc_fragments\")) {\n\t\t\t\t\treturn true\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn false\n\t\t} else {\n\t\t\treturn false\n\t\t}\n\t}\n\n\twpm.doesWooCommerceCartExist = function () {\n\t\treturn document.cookie.includes(\"woocommerce_items_in_cart\")\n\t}\n\n\twpm.urlHasParameter = function (parameter) {\n\t\tlet urlParams = new URLSearchParams(window.location.search)\n\t\treturn urlParams.has(parameter)\n\t}\n\n\t// wpm['load'] = {\n\t// base: true\n\t// };\n\n\twindow[\"wpmLoaded\"] = {}\n\n\t// return {\n\t// writeOrderIdToStorage : writeOrderIdToStorage,\n\t// isOrderIdStored : isOrderIdStored,\n\t// isEmail : isEmail,\n\t// removeProductFromCart : removeProductFromCart,\n\t// getViewItemProducts : getViewItemProducts,\n\t// addProductToCart : addProductToCart,\n\t// getCartItemsFromBackEnd: getCartItemsFromBackEnd,\n\t// fireCheckoutOption : fireCheckoutOption,\n\t// getCartItems : getCartItems\n\t// }\n\n}(window.wpm = window.wpm || {}, jQuery))\n","/**\n * Load all WPM functions\n *\n * Ignore event listeners. They need to be loaded after\n * we made sure that jQuery has been loaded.\n */\n\nrequire(\"./functions\")\n\n// #if process.env.TIER === 'premium'\n// require(\"./functions_premium\")\n// #endif\n","/**\n * After wpm is loaded\n * we first check if wpmDataLayer is loaded,\n * and as soon as it is, we load the pixels,\n * and as soon as the page load is complete,\n * we fire the wpmLoad event.\n *\n * @param {{pro:bool}} wpmDataLayer.version\n *\n * https://stackoverflow.com/a/25868457/4688612\n * https://stackoverflow.com/a/44093516/4688612\n */\n\nwpm.wpmDataLayerExists()\n\t.then(function () {\n\t\tconsole.log(\"WooCommerce Pixel Manager: \" + (wpmDataLayer.version.pro ? \"Pro\" : \"Free\") +\" Version \" + wpmDataLayer.version.number + \" loaded\")\n\t\tjQuery(document).trigger(\"wpmPreLoadPixels\", {})\n\t})\n\t.then(function () {\n\t\twpm.pageLoaded().then(function () {\n\t\t\tjQuery(document).trigger(\"wpmLoad\", {})\n\t\t})\n\t})\n\n\n\n/**\n * Run when page is ready\n *\n */\n\nwpm.pageReady().then(function () {\n\n\t/**\n\t * Run as soon as wpm namespace is loaded\n\t */\n\n\twpm.wpmDataLayerExists()\n\t\t.then(function () {\n\t\t\t// watch for products visible in viewport\n\t\t\twpm.startIntersectionObserverToWatch()\n\n\t\t\t// watch for lazy loaded products\n\t\t\twpm.startProductsMutationObserverToWatch()\n\t\t})\n})\n\n","// The module cache\nvar __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tvar cachedModule = __webpack_module_cache__[moduleId];\n\tif (cachedModule !== undefined) {\n\t\treturn cachedModule.exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\t// no module.id needed\n\t\t// no module.loaded needed\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId](module, module.exports, __webpack_require__);\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n","/**\n * Load all essential scripts first\n */\n\nrequire(\"./wpm/functions_loader\")\n\n// Only load the event listeners after jQuery has been loaded for sure\nwpm.jQueryExists().then(function () {\n\n\trequire(\"./wpm/event_listeners\")\n\n\trequire(\"./google/loader\")\n\trequire(\"./facebook/loader\")\n\trequire(\"./hotjar/loader\")\n\n\n\t/**\n\t * Load all premium scripts\n\t */\n\n\t// #if process.env.TIER === 'premium'\n// \trequire(\"./microsoft-ads/loader\")\n// \trequire(\"./pinterest/loader\")\n// \trequire(\"./snapchat/loader\")\n// \trequire(\"./tiktok/loader\")\n// \trequire(\"./twitter/loader\")\n\t// #endif\n\n\n\t/**\n\t * Initiate WPM.\n\t *\n\t * It makes sure that the script flow gets executed correctly,\n\t * no matter how JS \"optimizers\" shuffle the code.\n\t */\n\n\trequire(\"./wpm/init\")\n})\n\n"],"names":["jQuery","document","on","wpmDataLayer","pixels","facebook","pixel_id","loaded","wpm","canIFire","loadFacebookPixel","event","product","eventId","getRandomEventId","fbq","content_type","content_name","name","content_ids","dyn_r_ids","dynamic_remarketing","id_type","value","parseFloat","quantity","price","currency","eventID","shop","trigger","event_name","event_id","user_data","getFbUserData","product_data","product_id","event_source_url","window","location","href","e","console","error","fbViewContent","setFbUserData","order","value_filtered","facebookContentIds","id","$","undefined","fBUserData","f","b","n","callMethod","apply","arguments","queue","push","_fbq","version","t","createElement","async","src","s","getElementsByTagName","parentNode","insertBefore","Math","random","toString","substring","getFbUserDataFromBrowser","fbp","getCookie","fbc","client_user_agent","navigator","userAgent","prodIds","key","item","Object","entries","items","general","variationsOutput","variation_id","String","products","require","isEmptyObject","google","ads","conversionIds","status","googleConfigConditionsMet","isVariable","send_events_with_parent_ids","gtagLoaded","then","gtag","send_to","getGoogleAdsConversionIdentifiers","google_business_vertical","getGoogleAdsDynamicRemarketingOrderItems","data_basic","data_with_cart","getGoogleAdsConversionIdentifiersWithLabel","transaction_id","number","new_customer","aw_merchant_id","discount","aw_feed_country","aw_feed_language","getGoogleAdsRegularOrderItems","conversionIdentifiers","orderItems","orderItem","analytics","universal","property_id","mp_active","affiliation","value_regular","tax","shipping","coupon","getGAUAOrderItems","list_position","category","join","variant","variant_name","brand","ga4","measurement_id","getGA4OrderItems","item_name","item_category","item_id","item_variant","item_brand","state","canGoogleLoad","loadGoogle","logPreventedPixelLoading","type","consent_mode","active","getConsentValues","mode","categories","includes","getVisitorConsentStatusAndUpdateGoogleConsentSettings","google_consent_settings","analytics_storage","ad_storage","updateGoogleConsentMode","cookie_consent_mgmt","explicit_consent","fireGtagGoogleAds","enhanced_conversions","phone_conversion_label","phone_conversion_number","keys","page_type","enhanced_conversion_data","fireGtagGoogleAnalyticsUA","parameters","fireGtagGoogleAnalyticsGA4","isGoogleActive","getGoogleGtagId","loadScriptAndCacheIt","done","script","textStatus","dataLayer","wait_for_update","region","ads_data_redaction","url_passthrough","linker","settings","Date","Promise","resolve","reject","startTime","wait","setTimeout","optimize","container_id","load_google_optimize_pixel","hotjar","site_id","load_hotjar_pixel","h","o","hj","q","_hjSettings","hjid","hjsv","a","r","appendChild","url","URL","this","attr","productId","getProductIdByCartItemKeyUrl","removeProductFromCart","data","addProductToCart","product_type","Number","val","each","find","classes","getPostIdFromString","one","target","closest","matches","match","nextAll","getIdBasedOndVariationsOutputSetting","Error","getProductDetailsFormattedForEvent","isEmail","fireCheckoutProgress","emailSelected","paymentMethodSelected","fireCheckoutOption","cart","getCartItemsFromBackend","variation","doesWooCommerceCartExist","getCartItems","productIds","getAddToCartLinkProductIds","getProductsFromBackend","referrer","referrerHostname","hostname","host","setCookie","wpmLoadFired","getMainProductIdFromProductPage","getProductDataForViewItemEvent","isOrderIdStored","writeOrderIdToStorage","user","hasLoginEventFired","setLoginEventFired","updateConsentCookieValues","wpmDeduper","wpmRestSettings","checkCookie","useRestEndpoint","isSessionStorageAvailable","isRestEndpointAvailable","isBelowRestErrorThreshold","sessionStorage","getItem","JSON","parse","testEndpoint","protocol","cookieName","ajax","timeout","statusCode","response","setItem","stringify","isWpmRestEndpointAvailable","orderId","Storage","localStorage","ids","expiresDate","setDate","getDate","cookie","toUTCString","storeOrderIdOnServer","orderDeduplication","log","email","test","quantityToRemove","isVariation","parentId","saveCartObjectToDataLayer","action","dataType","ajax_url","success","cartItems","filter","hasOwnProperty","length","assign","cartObject","step","checkout_option","string","triggerViewItemList","indexOf","viewItemListTriggerTestMode","css","append","viewItemListTrigger","opacity","backgroundColor","getSearchTermFromUrl","URLSearchParams","search","get","io","ioTimeouts","observerCallback","observer","forEach","entry","elementId","next","isIntersecting","testMode","repeat","unobserve","clearTimeout","remove","allIoElementsToWatch","ioid","startIntersectionObserverToWatch","urlHasParameter","IntersectionObserver","threshold","map","i","elem","parent","hasClass","prev","observe","startProductsMutationObserverToWatch","productsNode","parents","has","first","productsMutationObserver","attributes","childList","characterData","MutationObserver","mutations","mutation","newNodes","addedNodes","hasWpmProductIdElement","siblings","cookieValue","expiryDays","d","setTime","getTime","expires","ca","decodeURIComponent","split","c","charAt","getWpmSessionData","setWpmSessionData","order_id","nonce","cartItemKey","cartItemKeys","list_name","position","parentId_dyn_r_ids","setReferrerToCookie","getReferrerFromCookie","getClidFromBrowser","clidCookieId","clidId","gclid","dclid","getUserAgent","getViewPort","width","max","documentElement","clientWidth","innerWidth","height","clientHeight","innerHeight","getComplianzCookies","cmplz_statistics","cmplz_marketing","visitorHasChosen","getCookieLawInfoCookies","analyticsCookie","adsCookie","wpmConsentValues","setConsentValueCategories","explicitConsent","decodeURI","consents","statistics","marketing","thirdparty","advanced","setConsentDefaultValuesToExplicit","pixelName","canIFireMode","scriptTagObserver","node","shouldScriptBeActive","unblockScript","blockScript","head","subtree","addEventListener","disconnect","some","element","scriptNode","removeAttach","wpmSrc","appendTo","removeAttr","unblockAllScripts","index","unblockSelectedPixels","Cookiebot","consent","detail","huObserver","hu","body","options","extend","cache","getOrderItemPrice","total","total_tax","loginEventFired","wpmDataLayerExists","waitForVar","jQueryExists","waitForjQuery","pageLoaded","readyState","pageReady","isMiniCartActive","parameter","pro","__webpack_module_cache__","__webpack_require__","moduleId","cachedModule","exports","module","__webpack_modules__"],"sourceRoot":""}
1
+ {"version":3,"file":"wpm-public.p1.min.js","mappings":"uBAIC,SAAUA,EAAKC,EAAGC,GAElB,IAAIC,EAEJH,EAAII,kBAAoB,WAEvB,IACCC,aAAaC,OAAOC,SAASC,QAAS,EAG5BC,EAMuBC,OANrBC,EAM6BC,SAN3BC,EAMoC,SAL9CJ,EAAEK,MAAWC,EAAEN,EAAEK,IAAI,WAAWC,EAAEC,WACrCD,EAAEC,WAAWC,MAAMF,EAAEG,WAAWH,EAAEI,MAAMC,KAAKF,YACzCT,EAAEY,OAAKZ,EAAEY,KAAKN,GAAEA,EAAEK,KAAKL,EAAEA,EAAEP,QAAO,EAAGO,EAAEO,QAAQ,MACnDP,EAAEI,MAAM,IAAGI,EAAEZ,EAAEa,cAAcX,IAAKY,OAAM,EACxCF,EAAEG,IAEF,kDAFQC,EAAEhB,EAAEiB,qBAAqBf,GAAG,IAClCgB,WAAWC,aAAaP,EAAEI,IAI7Bb,IAAI,OAAQT,aAAaC,OAAOC,SAASwB,UACzCjB,IAAI,QAAS,YAEZ,MAAOD,GACRmB,QAAQC,MAAMpB,GAdb,IAASJ,EAAEE,EAAEE,EAAIE,EAAEQ,EAAEI,GAkBxB3B,EAAIkC,iBAAmB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,eAEf,WAAa3D,aAAasD,KAAK+G,UAEzC3G,OAAOnD,UAAUoD,QAAQ,aAEf,SAAW3D,aAAasD,KAAK+G,UAEvC3G,OAAOnD,UAAUoD,QAAQ,eAEf,wBAA0B3D,aAAasD,KAAK+G,WAAarK,aAAa0E,MAE3E/E,IAAI2P,gBAAgBtP,aAAa0E,MAAMO,MAE3CvB,OAAOnD,UAAUoD,QAAQ,wBACzBhE,IAAI+O,sBAAsB1O,aAAa0E,MAAMO,KAG9CvB,OAAOnD,UAAUoD,QAAQ,qBAGV,QAAZ,EAAA3D,oBAAA,mBAAc2c,YAAd,SAAoB1X,KAAOtF,IAAI6b,uBAClC9X,OAAOnD,UAAUoD,QAAQ,YACzBhE,IAAI+b,sBAiBL1b,aAAa0c,cAAe,GAG5B,MAAOlc,GACRmB,QAAQC,MAAMpB,OAQhBkD,OAAOrD,QAAQ6E,GAAG,oBAAoB,WAAY,UAEjD,UAAIlF,oBAAJ,iBAAI,EAAcsD,YAAlB,iBAAI,EAAoBuG,2BAAxB,OAAI,EAAyCC,kBAC5CnK,IAAImZ,2BAA0B,GAE/BpV,OAAOnD,UAAUoD,QAAQ,gBAAiB,SCn5DvCiZ,EAA2B,GAG/B,SAASC,EAAoBC,GAE5B,IAAIC,EAAeH,EAAyBE,GAC5C,QAAqBjd,IAAjBkd,EACH,OAAOA,EAAaC,QAGrB,IAAIC,EAASL,EAAyBE,GAAY,CAGjDE,QAAS,IAOV,OAHAE,EAAoBJ,GAAUG,EAAQA,EAAOD,QAASH,GAG/CI,EAAOD,QCjBfG,EAAQ,KAMRA,EAAQ,KACRA,EAAQ,KACRA,EAAQ,KACRA,EAAQ,KACRA,EAAQ,KACRA,EAAQ,KACRA,EAAQ,KAMRA,EAAQ,M","sources":["webpack://WooCommerce-Pixel-Manager/./src/js/public/facebook.js","webpack://WooCommerce-Pixel-Manager/./src/js/public/google-ads.js","webpack://WooCommerce-Pixel-Manager/./src/js/public/google-ga-4.js","webpack://WooCommerce-Pixel-Manager/./src/js/public/google-ga-ua.js","webpack://WooCommerce-Pixel-Manager/./src/js/public/google-optimize.js","webpack://WooCommerce-Pixel-Manager/./src/js/public/google.js","webpack://WooCommerce-Pixel-Manager/./src/js/public/hotjar.js","webpack://WooCommerce-Pixel-Manager/./src/js/public/wpm-loader.js","webpack://WooCommerce-Pixel-Manager/./src/js/public/wpm.js","webpack://WooCommerce-Pixel-Manager/webpack/bootstrap","webpack://WooCommerce-Pixel-Manager/./src/js/public/main-free.js"],"sourcesContent":["/**\n * Add functions for Facebook\n * */\n\n(function (wpm, $, undefined) {\n\n\tlet fBUserData\n\n\twpm.loadFacebookPixel = function () {\n\n\t\ttry {\n\t\t\twpmDataLayer.pixels.facebook.loaded = true\n\n\t\t\t// @formatter:off\n\t\t\t!function(f,b,e,v,n,t,s)\n\t\t\t{if(f.fbq)return;n=f.fbq=function(){n.callMethod?\n\t\t\t\tn.callMethod.apply(n,arguments):n.queue.push(arguments)};\n\t\t\t\tif(!f._fbq)f._fbq=n;n.push=n;n.loaded=!0;n.version='2.0';\n\t\t\t\tn.queue=[];t=b.createElement(e);t.async=!0;\n\t\t\t\tt.src=v;s=b.getElementsByTagName(e)[0];\n\t\t\t\ts.parentNode.insertBefore(t,s)}(window, document,'script',\n\t\t\t\t'https://connect.facebook.net/en_US/fbevents.js');\n\t\t\t// @formatter:on\n\n\t\t\tfbq(\"init\", wpmDataLayer.pixels.facebook.pixel_id)\n\t\t\tfbq(\"track\", \"PageView\")\n\n\t\t} catch (e) {\n\t\t\tconsole.error(e)\n\t\t}\n\t}\n\n\twpm.getRandomEventId = function () {\n\t\treturn (Math.random() + 1).toString(36).substring(2)\n\t}\n\n\twpm.getFbUserData = function () {\n\t\t// We need the first one for InitiateCheckout\n\t\t// where getting the user_data from the browser is too slow\n\t\t// using wpm.getCookie(), so we cache the user_data earlier.\n\t\t// And we need the second one because the ViewContent hit happens too fast\n\t\t// after adding a variation to the cart because the function to cache\n\t\t// the user_data is too slow. But we can get the user_data using wpm.getCookie()\n\t\t// because we don't move away from the page and can wait for the browser\n\t\t// to get it.\n\t\tif (fBUserData) {\n\t\t\treturn fBUserData\n\t\t} else {\n\t\t\treturn wpm.getFbUserDataFromBrowser()\n\t\t}\n\t}\n\n\twpm.setFbUserData = function () {\n\t\tfBUserData = wpm.getFbUserDataFromBrowser()\n\t}\n\n\twpm.getFbUserDataFromBrowser = function () {\n\t\treturn {\n\t\t\tfbp : wpm.getCookie(\"_fbp\"),\n\t\t\tfbc : wpm.getCookie(\"_fbc\"),\n\t\t\tclient_user_agent: navigator.userAgent,\n\t\t}\n\t}\n\n\twpm.fbViewContent = function (product) {\n\n\t\ttry {\n\t\t\tif (!wpmDataLayer?.pixels?.facebook?.loaded) return\n\n\t\t\tlet eventId = wpm.getRandomEventId()\n\n\t\t\tfbq(\"track\", \"ViewContent\", {\n\t\t\t\tcontent_type: \"product\",\n\t\t\t\tcontent_name: product.name,\n\t\t\t\t// content_category: product.category,\n\t\t\t\tcontent_ids: product.dyn_r_ids[wpmDataLayer.pixels.facebook.dynamic_remarketing.id_type],\n\t\t\t\tcurrency : wpmDataLayer.shop.currency,\n\t\t\t\tvalue : product.price,\n\t\t\t}, {\n\t\t\t\teventID: eventId,\n\t\t\t})\n\n\t\t\tproduct[\"currency\"] = wpmDataLayer.shop.currency\n\n\t\t\tjQuery(document).trigger(\"wpmFbCapiEvent\", {\n\t\t\t\tevent_name : \"ViewContent\",\n\t\t\t\tevent_id : eventId,\n\t\t\t\tuser_data : wpm.getFbUserData(),\n\t\t\t\tproduct_data : product,\n\t\t\t\tproduct_id : product.dyn_r_ids[wpmDataLayer.pixels.facebook.dynamic_remarketing.id_type],\n\t\t\t\tevent_source_url: window.location.href,\n\t\t\t})\n\t\t} catch (e) {\n\t\t\tconsole.error(e)\n\t\t}\n\t}\n\n\twpm.facebookContentIds = function () {\n\t\tlet prodIds = []\n\n\t\tfor (const [key, item] of Object.entries(wpmDataLayer.order.items)) {\n\n\t\t\tif (wpmDataLayer?.general?.variationsOutput && 0 !== item.variation_id) {\n\t\t\t\tprodIds.push(String(wpmDataLayer.products[item.variation_id].dyn_r_ids[wpmDataLayer.pixels.facebook.dynamic_remarketing.id_type]))\n\t\t\t} else {\n\t\t\t\tprodIds.push(String(wpmDataLayer.products[item.id].dyn_r_ids[wpmDataLayer.pixels.facebook.dynamic_remarketing.id_type]))\n\t\t\t}\n\t\t}\n\n\t\treturn prodIds\n\t}\n\n}(window.wpm = window.wpm || {}, jQuery));\n\n\n/**\n * Execute as soon as possible\n * */\n\n(function () {\n\n\tjQuery(document).on(\"wpmLoadPixels\", function () {\n\n\t\tif (wpmDataLayer?.pixels?.facebook?.pixel_id && !wpmDataLayer?.pixels?.facebook?.loaded) {\n\t\t\tif (wpm.canIFire(\"ads\", \"facebook-ads\")) wpm.loadFacebookPixel()\n\t\t}\n\t})\n\n})()\n\n\n/**\n * All event listeners\n * */\n\n// AddToCart event\njQuery(document).on(\"wpmAddToCart\", function (event, product) {\n\n\ttry {\n\t\tif (!wpmDataLayer?.pixels?.facebook?.loaded) return\n\n\t\tlet eventId = wpm.getRandomEventId()\n\n\t\t// console.log('eventId: ' + eventId);\n\n\t\tfbq(\"track\", \"AddToCart\", {\n\t\t\tcontent_type: \"product\",\n\t\t\tcontent_name: product.name,\n\t\t\tcontent_ids : product.dyn_r_ids[wpmDataLayer.pixels.facebook.dynamic_remarketing.id_type],\n\t\t\tvalue : parseFloat(product.quantity * product.price),\n\t\t\tcurrency : product.currency,\n\t\t}, {\n\t\t\teventID: eventId,\n\t\t})\n\n\n\t\tproduct[\"currency\"] = wpmDataLayer.shop.currency\n\n\t\tjQuery(document).trigger(\"wpmFbCapiEvent\", {\n\t\t\tevent_name : \"AddToCart\",\n\t\t\tevent_id : eventId,\n\t\t\tuser_data : wpm.getFbUserData(),\n\t\t\tproduct_data : product,\n\t\t\tproduct_id : product.dyn_r_ids[wpmDataLayer.pixels.facebook.dynamic_remarketing.id_type],\n\t\t\tevent_source_url: window.location.href,\n\t\t})\n\t} catch (e) {\n\t\tconsole.error(e)\n\t}\n})\n\n// InitiateCheckout event\njQuery(document).on(\"wpmBeginCheckout\", function (event) {\n\n\ttry {\n\t\t// console.log('firing facebook ads InitiateCheckout event');\n\n\t\tif (!wpmDataLayer?.pixels?.facebook?.loaded) return\n\n\t\tlet eventId = wpm.getRandomEventId()\n\n\t\tfbq(\"track\", \"InitiateCheckout\", {}, {\n\t\t\teventID: eventId,\n\t\t})\n\n\t\tjQuery(document).trigger(\"wpmFbCapiEvent\", {\n\t\t\tevent_name : \"InitiateCheckout\",\n\t\t\tevent_id : eventId,\n\t\t\tuser_data : wpm.getFbUserData(),\n\t\t\tevent_source_url: window.location.href,\n\t\t})\n\t} catch (e) {\n\t\tconsole.error(e)\n\t}\n})\n\n// AddToWishlist event\njQuery(document).on(\"wpmAddToWishlist\", function (event, product) {\n\n\ttry {\n\t\t// console.log('firing facebook ads AddToWishlist event');\n\t\t// console.log(product);\n\n\t\tif (!wpmDataLayer?.pixels?.facebook?.loaded) return\n\n\t\tlet eventId = wpm.getRandomEventId()\n\n\t\tfbq(\"track\", \"AddToWishlist\", {\n\t\t\tcontent_type: \"product\",\n\t\t\tcontent_name: product.name,\n\t\t\tcontent_ids : product.dyn_r_ids[wpmDataLayer.pixels.facebook.dynamic_remarketing.id_type],\n\t\t\tvalue : parseFloat(product.quantity * product.price),\n\t\t\tcurrency : product.currency,\n\t\t}, {\n\t\t\teventID: eventId,\n\t\t})\n\n\n\t\tproduct[\"currency\"] = wpmDataLayer.shop.currency\n\n\t\tjQuery(document).trigger(\"wpmFbCapiEvent\", {\n\t\t\tevent_name : \"AddToWishlist\",\n\t\t\tevent_id : eventId,\n\t\t\tuser_data : wpm.getFbUserData(),\n\t\t\tproduct_data : product,\n\t\t\tproduct_id : product.dyn_r_ids[wpmDataLayer.pixels.facebook.dynamic_remarketing.id_type],\n\t\t\tevent_source_url: window.location.href,\n\t\t})\n\t} catch (e) {\n\t\tconsole.error(e)\n\t}\n})\n\n// ViewContent event\njQuery(document).on(\"wpmViewItem\", function (event, product) {\n\n\ttry {\n\t\t// console.log('firing facebook ads ViewContent event');\n\t\t// console.log(product);\n\n\t\tif (!wpmDataLayer?.pixels?.facebook?.loaded) return\n\n\t\twpm.fbViewContent(product)\n\t} catch (e) {\n\t\tconsole.error(e)\n\t}\n})\n\n// view search event\njQuery(document).on(\"wpmSearch\", function () {\n\n\ttry {\n\t\tif (!wpmDataLayer?.pixels?.facebook?.loaded) return\n\n\t\tlet eventId = wpm.getRandomEventId()\n\n\t\tfbq(\"track\", \"Search\", {}, {\n\t\t\teventID: eventId,\n\t\t})\n\n\t\tjQuery(document).trigger(\"wpmFbCapiEvent\", {\n\t\t\tevent_name : \"Search\",\n\t\t\tevent_id : eventId,\n\t\t\tuser_data : wpm.getFbUserData(),\n\t\t\tevent_source_url: window.location.href,\n\t\t})\n\t} catch (e) {\n\t\tconsole.error(e)\n\t}\n})\n\n// load always event\njQuery(document).on(\"wpmLoadAlways\", function () {\n\n\ttry {\n\t\tif (!wpmDataLayer?.pixels?.facebook?.loaded) return\n\n\t\twpm.setFbUserData()\n\t} catch (e) {\n\t\tconsole.error(e)\n\t}\n})\n\n// view order received page event\n// https://developers.pinterest.com/docs/tag/conversion/\njQuery(document).on(\"wpmOrderReceivedPage\", function () {\n\n\ttry {\n\t\tif (!wpmDataLayer?.pixels?.facebook?.loaded) return\n\n\t\tfbq(\"track\", \"Purchase\",\n\t\t\t{\n\t\t\t\tcontent_type: \"product\",\n\t\t\t\tvalue : wpmDataLayer.order.value_filtered,\n\t\t\t\tcurrency : wpmDataLayer.order.currency,\n\t\t\t\tcontent_ids : wpm.facebookContentIds(),\n\t\t\t},\n\t\t\t{eventID: wpmDataLayer.order.id},\n\t\t)\n\n\n\t\t// console.log(wpm.facebookContentIds())\n\t} catch (e) {\n\t\tconsole.error(e)\n\t}\n})\n","/**\n * Add functions for Google Ads\n * */\n\n(function (wpm, $, undefined) {\n\n\tlet conversionIdentifiers = []\n\n\twpm.getGoogleAdsConversionIdentifiersWithLabel = function () {\n\t\tfor (const [key, item] of Object.entries(wpmDataLayer.pixels.google.ads.conversionIds)) {\n\t\t\tconversionIdentifiers.push(key + \"/\" + item)\n\t\t}\n\t\treturn conversionIdentifiers\n\t}\n\n\twpm.getGoogleAdsConversionIdentifiers = function () {\n\n\t\tlet conversionIdentifiers = []\n\t\tfor (const [key, item] of Object.entries(wpmDataLayer.pixels.google.ads.conversionIds)) {\n\t\t\tconversionIdentifiers.push(key)\n\t\t}\n\n\t\treturn conversionIdentifiers\n\t}\n\n\twpm.getGoogleAdsRegularOrderItems = function () {\n\t\t// \"id\" : \"gla_34\",\n\t\t// \"quantity\": 1,\n\t\t// \"price\" : 45\n\n\t\tlet orderItems = []\n\n\t\tfor (const [key, item] of Object.entries(wpmDataLayer.order.items)) {\n\n\t\t\tlet orderItem\n\n\t\t\torderItem = {\n\t\t\t\tquantity: item.quantity,\n\t\t\t\tprice : item.price,\n\t\t\t}\n\n\t\t\tif (wpmDataLayer?.general?.variationsOutput && 0 !== item.variation_id) {\n\n\t\t\t\torderItem.id = String(wpmDataLayer.products[item.variation_id].dyn_r_ids[wpmDataLayer.pixels.google.ads.dynamic_remarketing.id_type])\n\t\t\t\torderItems.push(orderItem)\n\t\t\t} else {\n\n\t\t\t\torderItem.id = String(wpmDataLayer.products[item.id].dyn_r_ids[wpmDataLayer.pixels.google.ads.dynamic_remarketing.id_type])\n\t\t\t\torderItems.push(orderItem)\n\t\t\t}\n\t\t}\n\n\t\treturn orderItems\n\t}\n\n\twpm.getGoogleAdsDynamicRemarketingOrderItems = function () {\n\t\t// \"id\" : \"gla_34\",\n\t\t// \"quantity\" : 1,\n\t\t// \"price\" : 45,\n\t\t// \"google_business_vertical\": \"retail\"\n\n\t\tlet orderItems = []\n\n\t\tfor (const [key, item] of Object.entries(wpmDataLayer.order.items)) {\n\n\t\t\tlet orderItem\n\n\t\t\torderItem = {\n\t\t\t\tquantity : item.quantity,\n\t\t\t\tprice : item.price,\n\t\t\t\tgoogle_business_vertical: wpmDataLayer.pixels.google.ads.google_business_vertical,\n\t\t\t}\n\n\t\t\tif (wpmDataLayer?.general?.variationsOutput && 0 !== item.variation_id) {\n\n\t\t\t\torderItem.id = String(wpmDataLayer.products[item.variation_id].dyn_r_ids[wpmDataLayer.pixels.google.ads.dynamic_remarketing.id_type])\n\t\t\t\torderItems.push(orderItem)\n\t\t\t} else {\n\n\t\t\t\torderItem.id = String(wpmDataLayer.products[item.id].dyn_r_ids[wpmDataLayer.pixels.google.ads.dynamic_remarketing.id_type])\n\t\t\t\torderItems.push(orderItem)\n\t\t\t}\n\t\t}\n\n\t\treturn orderItems\n\t}\n\n}(window.wpm = window.wpm || {}, jQuery))\n\n\n/**\n * All event listeners\n * */\n\n// view_item_list event\njQuery(document).on(\"wpmViewItemList\", function (event, product) {\n\n\ttry {\n\t\tif(jQuery.isEmptyObject(wpmDataLayer?.pixels?.google?.ads?.conversionIds)) return\n\t\tif (!wpmDataLayer?.pixels?.google?.ads?.dynamic_remarketing?.status) return\n\t\tif (!wpm.googleConfigConditionsMet(\"ads\")) return\n\n\n\t\tif (\n\t\t\twpmDataLayer?.general?.variationsOutput &&\n\t\t\tproduct.isVariable &&\n\t\t\twpmDataLayer.pixels.google.ads.dynamic_remarketing.send_events_with_parent_ids === false\n\t\t) return\n\n\t\t// try to prevent that WC sends cached hits to Google\n\t\tif (!product) return\n\n\t\twpm.gtagLoaded().then(function () {\n\t\t gtag(\"event\", \"view_item_list\", {\n \t\t\tsend_to: wpm.getGoogleAdsConversionIdentifiers(),\n \t\t\titems : [{\n \t\t\t\tid : product.dyn_r_ids[wpmDataLayer.pixels.google.ads.dynamic_remarketing.id_type],\n \t\t\t\tgoogle_business_vertical: wpmDataLayer.pixels.google.ads.google_business_vertical,\n \t\t\t}],\n \t\t})\n\t\t})\n\t} catch (e) {\n\t\tconsole.error(e)\n\t}\n})\n\n// add_to_cart event\njQuery(document).on(\"wpmAddToCart\", function (event, product) {\n\n\ttry {\n\t\tif(jQuery.isEmptyObject(wpmDataLayer?.pixels?.google?.ads?.conversionIds)) return\n\t\tif (!wpmDataLayer?.pixels?.google?.ads?.dynamic_remarketing?.status) return\n\t\tif (!wpm.googleConfigConditionsMet(\"ads\")) return\n\n\t\twpm.gtagLoaded().then(function () {\n\t\t gtag(\"event\", \"add_to_cart\", {\n \t\t\tsend_to: wpm.getGoogleAdsConversionIdentifiers(),\n \t\t\tvalue : product.quantity * product.price,\n \t\t\titems : [{\n \t\t\t\tid : product.dyn_r_ids[wpmDataLayer.pixels.google.ads.dynamic_remarketing.id_type],\n \t\t\t\tquantity : product.quantity,\n \t\t\t\tprice : product.price,\n \t\t\t\tgoogle_business_vertical: wpmDataLayer.pixels.google.ads.google_business_vertical,\n \t\t\t}],\n \t\t})\n\t\t})\n\t} catch (e) {\n\t\tconsole.error(e)\n\t}\n})\n\n// view_item event\njQuery(document).on(\"wpmViewItem\", function (event, product) {\n\n\ttry {\n\t\tif(jQuery.isEmptyObject(wpmDataLayer?.pixels?.google?.ads?.conversionIds)) return\n\t\tif (!wpmDataLayer?.pixels?.google?.ads?.dynamic_remarketing?.status) return\n\t\tif (!wpm.googleConfigConditionsMet(\"ads\")) return\n\n\n\t\twpm.gtagLoaded().then(function () {\n\t\t gtag(\"event\", \"view_item\", {\n \t\t\tsend_to: wpm.getGoogleAdsConversionIdentifiers(),\n \t\t\tvalue : (product.quantity ? product.quantity : 1) * product.price,\n \t\t\titems : [{\n \t\t\t\tid : product.dyn_r_ids[wpmDataLayer.pixels.google.ads.dynamic_remarketing.id_type],\n \t\t\t\tquantity : (product.quantity ? product.quantity : 1),\n \t\t\t\tprice : product.price,\n \t\t\t\tgoogle_business_vertical: wpmDataLayer.pixels.google.ads.google_business_vertical,\n \t\t\t}],\n \t\t})\n\t\t})\n\t} catch (e) {\n\t\tconsole.error(e)\n\t}\n})\n\n\n// view search event\njQuery(document).on(\"wpmSearch\", function () {\n\n\ttry {\n\t\tif(jQuery.isEmptyObject(wpmDataLayer?.pixels?.google?.ads?.conversionIds)) return\n\t\tif (!wpmDataLayer?.pixels?.google?.ads?.dynamic_remarketing?.status) return\n\t\tif (!wpm.googleConfigConditionsMet(\"ads\")) return\n\n\n\t\tlet products = []\n\n\t\tfor (const [key, product] of Object.entries(wpmDataLayer.products)) {\n\n\t\t\tif (\n\t\t\t\twpmDataLayer?.general?.variationsOutput &&\n\t\t\t\tproduct.isVariable &&\n\t\t\t\twpmDataLayer.pixels.google.ads.dynamic_remarketing.send_events_with_parent_ids === false\n\t\t\t) return\n\n\t\t\tproducts.push({\n\t\t\t\tid : product.dyn_r_ids[wpmDataLayer.pixels.google.ads.dynamic_remarketing.id_type],\n\t\t\t\tgoogle_business_vertical: wpmDataLayer.pixels.google.ads.google_business_vertical,\n\t\t\t})\n\t\t}\n\n\t\t// console.log(products);\n\n\t\twpm.gtagLoaded().then(function () {\n\t\t\tgtag(\"event\", \"view_search_results\", {\n \t\t\tsend_to: wpm.getGoogleAdsConversionIdentifiers(),\n \t\t\t// value : 1 * product.price,\n \t\t\titems: products,\n \t\t})\n\t\t})\n\t} catch (e) {\n\t\tconsole.error(e)\n\t}\n})\n\n\n// view order received page event\n// TODO distinguish with or without cart data active\njQuery(document).on(\"wpmOrderReceivedPage\", function () {\n\n\ttry {\n\t\tif(jQuery.isEmptyObject(wpmDataLayer?.pixels?.google?.ads?.conversionIds)) return\n\t\tif (!wpmDataLayer?.pixels?.google?.ads?.dynamic_remarketing?.status) return\n\t\tif (!wpm.googleConfigConditionsMet(\"ads\")) return\n\n\t\twpm.gtagLoaded().then(function () {\n\t\t gtag(\"event\", \"purchase\", {\n \t\t\tsend_to: wpm.getGoogleAdsConversionIdentifiers(),\n \t\t\tvalue : wpmDataLayer.order.value_filtered,\n \t\t\titems : wpm.getGoogleAdsDynamicRemarketingOrderItems(),\n \t\t})\n\t\t})\n\n\t\t// console.log(wpm.getGoogleAdsDynamicRemarketingOrderItems())\n\t} catch (e) {\n\t\tconsole.error(e)\n\t}\n})\n\n// user log in event\njQuery(document).on(\"wpmLogin\", function () {\n\n\ttry {\n\t\tif(jQuery.isEmptyObject(wpmDataLayer?.pixels?.google?.ads?.conversionIds)) return\n\t\tif (!wpmDataLayer?.pixels?.google?.ads?.dynamic_remarketing?.status) return\n\t\tif (!wpm.googleConfigConditionsMet(\"ads\")) return\n\n\n\t\twpm.gtagLoaded().then(function () {\n\t\t gtag(\"event\", \"login\", {\n \t\t\tsend_to: wpm.getGoogleAdsConversionIdentifiers(),\n \t\t})\n\t\t})\n\t} catch (e) {\n\t\tconsole.error(e)\n\t}\n})\n\n// view order received page event\n// new_customer parameter: https://support.google.com/google-ads/answer/9917012\njQuery(document).on(\"wpmOrderReceivedPage\", function () {\n\n\ttry {\n\t\tif(jQuery.isEmptyObject(wpmDataLayer?.pixels?.google?.ads?.conversionIds)) return\n\t\tif (!wpm.googleConfigConditionsMet(\"ads\")) return\n\n\t\tlet data_basic = {}\n\t\tlet data_with_cart = {}\n\n\t\tdata_basic = {\n\t\t\tsend_to : wpm.getGoogleAdsConversionIdentifiersWithLabel(),\n\t\t\ttransaction_id: wpmDataLayer.order.number,\n\t\t\tvalue : wpmDataLayer.order.value_filtered,\n\t\t\tcurrency : wpmDataLayer.order.currency,\n\t\t\tnew_customer : wpmDataLayer.order.new_customer,\n\t\t}\n\n\t\tif (wpmDataLayer?.order?.aw_merchant_id) {\n\t\t\tdata_with_cart = {\n\t\t\t\tdiscount : wpmDataLayer.order.discount,\n\t\t\t\taw_merchant_id : wpmDataLayer.order.aw_merchant_id,\n\t\t\t\taw_feed_country : wpmDataLayer.order.aw_feed_country,\n\t\t\t\taw_feed_language: wpmDataLayer.order.aw_feed_language,\n\t\t\t\titems : wpm.getGoogleAdsRegularOrderItems(),\n\t\t\t}\n\t\t}\n\n\t\twpm.gtagLoaded().then(function () {\n\t\t\tgtag(\"event\", \"conversion\", {...data_basic, ...data_with_cart})\n\t\t})\n\n\t\t// console.log({...data_basic,...data_with_cart})\n\n\t\t// console.log(wpm.getGoogleAdsOrderItems())\n\t} catch (e) {\n\t\tconsole.error(e)\n\t}\n})\n\n\n\n\n\n","/**\n * Add functions for Google Analytics 4\n * */\n\n(function (wpm, $, undefined) {\n\n\twpm.getGA4OrderItems = function () {\n\n\t\t// \"item_id\" : \"34\",\n\t\t// \"item_name\" : \"Hoodie\",\n\t\t// \"quantity\" : 1,\n\t\t// \"item_brand\" : \"\",\n\t\t// \"item_variant\" : \"Color: blue | Logo: yes\",\n\t\t// \"price\" : 45,\n\t\t// \"currency\" : \"CHF\",\n\t\t// \"item_category\": \"Hoodies\"\n\n\n\t\tlet orderItems = []\n\n\t\tfor (const [key, item] of Object.entries(wpmDataLayer.order.items)) {\n\n\t\t\tlet orderItem\n\n\t\t\torderItem = {\n\t\t\t\tquantity : item.quantity,\n\t\t\t\tprice : item.price,\n\t\t\t\titem_name : item.name,\n\t\t\t\tcurrency : wpmDataLayer.order.currency,\n\t\t\t\titem_category: wpmDataLayer.products[item.id].category.join(\"/\"),\n\t\t\t}\n\n\t\t\tif (wpmDataLayer?.general?.variationsOutput && 0 !== item.variation_id) {\n\n\t\t\t\torderItem.item_id = String(wpmDataLayer.products[item.variation_id].dyn_r_ids[wpmDataLayer.pixels.google.analytics.id_type])\n\t\t\t\torderItem.item_variant = wpmDataLayer.products[item.variation_id].variant_name\n\t\t\t\torderItem.item_brand = wpmDataLayer.products[item.variation_id].brand\n\t\t\t} else {\n\n\t\t\t\torderItem.item_id = String(wpmDataLayer.products[item.id].dyn_r_ids[wpmDataLayer.pixels.google.analytics.id_type])\n\t\t\t\torderItem.item_brand = wpmDataLayer.products[item.id].brand\n\t\t\t}\n\n\t\t\torderItems.push(orderItem)\n\t\t}\n\n\t\treturn orderItems\n\t}\n\n}(window.wpm = window.wpm || {}, jQuery))\n\n\n/**\n * All event listeners\n * */\n\n\n// view order received page event\njQuery(document).on(\"wpmOrderReceivedPage\", function () {\n\n\ttry {\n\t\tif (!wpmDataLayer?.pixels?.google?.analytics?.ga4?.measurement_id) return\n\t\tif (wpmDataLayer?.pixels?.google?.analytics?.ga4?.mp_active) return\n\t\tif (!wpm.googleConfigConditionsMet(\"analytics\")) return\n\n\t\twpm.gtagLoaded().then(function () {\n\t\t\tgtag(\"event\", \"purchase\", {\n\t\t\t\tsend_to : [wpmDataLayer.pixels.google.analytics.ga4.measurement_id],\n\t\t\t\ttransaction_id: wpmDataLayer.order.number,\n\t\t\t\taffiliation : wpmDataLayer.order.affiliation,\n\t\t\t\tcurrency : wpmDataLayer.order.currency,\n\t\t\t\tvalue : wpmDataLayer.order.value_regular,\n\t\t\t\tdiscount : wpmDataLayer.order.discount,\n\t\t\t\ttax : wpmDataLayer.order.tax,\n\t\t\t\tshipping : wpmDataLayer.order.shipping,\n\t\t\t\tcoupon : wpmDataLayer.order.coupon,\n\t\t\t\titems : wpm.getGA4OrderItems(),\n\t\t\t})\n\t\t})\n\t} catch (e) {\n\t\tconsole.error(e)\n\t}\n})\n","/**\n * Add functions for Google Analytics Universal\n * */\n\n(function (wpm, $, undefined) {\n\n\twpm.getGAUAOrderItems = function () {\n\n\t\t// \"id\" : \"34\",\n\t\t// \"name\" : \"Hoodie\",\n\t\t// \"brand\" : \"\",\n\t\t// \"category\" : \"Hoodies\",\n\t\t// \"list_position\": 1,\n\t\t// \"price\" : 45,\n\t\t// \"quantity\" : 1,\n\t\t// \"variant\" : \"Color: blue | Logo: yes\"\n\n\n\t\tlet orderItems = [],\n\t\t\tlist_position = 1\n\n\t\tfor (const [key, item] of Object.entries(wpmDataLayer.order.items)) {\n\n\t\t\tlet orderItem\n\n\t\t\torderItem = {\n\t\t\t\tquantity : item.quantity,\n\t\t\t\tprice : item.price,\n\t\t\t\tname : item.name,\n\t\t\t\tcurrency : wpmDataLayer.order.currency,\n\t\t\t\tcategory : wpmDataLayer.products[item.id].category.join(\"/\"),\n\t\t\t\tlist_position: list_position,\n\t\t\t}\n\n\t\t\tif (wpmDataLayer?.general?.variationsOutput && 0 !== item.variation_id) {\n\n\t\t\t\torderItem.id = String(wpmDataLayer.products[item.variation_id].dyn_r_ids[wpmDataLayer.pixels.google.analytics.id_type])\n\t\t\t\torderItem.variant = wpmDataLayer.products[item.variation_id].variant_name\n\t\t\t\torderItem.brand = wpmDataLayer.products[item.variation_id].brand\n\t\t\t} else {\n\n\t\t\t\torderItem.id = String(wpmDataLayer.products[item.id].dyn_r_ids[wpmDataLayer.pixels.google.analytics.id_type])\n\t\t\t\torderItem.brand = wpmDataLayer.products[item.id].brand\n\t\t\t}\n\n\t\t\torderItems.push(orderItem)\n\t\t\tlist_position++\n\t\t}\n\n\t\treturn orderItems\n\t}\n\n}(window.wpm = window.wpm || {}, jQuery))\n\n\n/**\n * All event listeners\n * */\n\n\n// view order received page event\njQuery(document).on(\"wpmOrderReceivedPage\", function () {\n\n\ttry {\n\t\tif (!wpmDataLayer?.pixels?.google?.analytics?.universal?.property_id) return\n\t\tif (wpmDataLayer?.pixels?.google?.analytics?.universal?.mp_active) return\n\t\tif (!wpm.googleConfigConditionsMet(\"analytics\")) return\n\n\t\twpm.gtagLoaded().then(function () {\n\t\t\tgtag(\"event\", \"purchase\", {\n\t\t\t\tsend_to : [wpmDataLayer.pixels.google.analytics.universal.property_id],\n\t\t\t\ttransaction_id: wpmDataLayer.order.number,\n\t\t\t\taffiliation : wpmDataLayer.order.affiliation,\n\t\t\t\tcurrency : wpmDataLayer.order.currency,\n\t\t\t\tvalue : wpmDataLayer.order.value_regular,\n\t\t\t\tdiscount : wpmDataLayer.order.discount,\n\t\t\t\ttax : wpmDataLayer.order.tax,\n\t\t\t\tshipping : wpmDataLayer.order.shipping,\n\t\t\t\tcoupon : wpmDataLayer.order.coupon,\n\t\t\t\titems : wpm.getGAUAOrderItems(),\n\t\t\t})\n\t\t})\n\n\t\t// console.log(wpm.getGAUAOrderItems())\n\t} catch (e) {\n\t\tconsole.error(e)\n\t}\n})\n","(function (wpm, $, undefined) {\n\n\twpm.load_google_optimize_pixel = function () {\n\n\t\ttry {\n\t\t\twpmDataLayer.pixels.google.optimize.loaded = true\n\n\t\t\twpm.loadScriptAndCacheIt(\"https://www.googleoptimize.com/optimize.js?id=\" + wpmDataLayer.pixels.google.optimize.container_id)\n\t\t\t// .done(function (script, textStatus) {\n\t\t\t// \t\tconsole.log('Google Optimize loaded')\n\t\t\t// });\n\n\t\t} catch (e) {\n\t\t\tconsole.error(e)\n\t\t}\n\t}\n\n}(window.wpm = window.wpm || {}, jQuery));\n\n\n(function () {\n\n\tjQuery(document).on(\"wpmLoadPixels\", function () {\n\n\t\tif (wpmDataLayer?.pixels?.google?.optimize?.container_id && !wpmDataLayer?.pixels?.google?.optimize?.loaded) {\n\t\t\tif (wpm.canIFire(\"analytics\", \"google-optimize\")) wpm.load_google_optimize_pixel()\n\t\t}\n\t})\n\n})()\n\n\n\n","/**\n * Add functions for Google\n * */\n\n(function (wpm, $, undefined) {\n\n\twpm.googleConfigConditionsMet = function (type) {\n\t\t// always returns true if Google Consent Mode is active\n\t\tif (wpmDataLayer?.pixels?.google?.consent_mode?.active) {\n\t\t\treturn true\n\t\t} else if (wpm.getConsentValues().mode === \"category\") {\n\t\t\treturn wpm.getConsentValues().categories[type] === true\n\t\t} else if (wpm.getConsentValues().mode === \"pixel\") {\n\t\t\treturn wpm.getConsentValues().pixels.includes(\"google-\" + type)\n\t\t} else {\n\t\t\treturn false\n\t\t}\n\t}\n\n\twpm.getVisitorConsentStatusAndUpdateGoogleConsentSettings = function (google_consent_settings) {\n\n\t\tif (wpm.getConsentValues().mode === \"category\") {\n\t\t\tif (wpm.getConsentValues().categories.analytics) google_consent_settings.analytics_storage = \"granted\"\n\t\t\tif (wpm.getConsentValues().categories.ads) google_consent_settings.ad_storage = \"granted\"\n\t\t} else if ((wpm.getConsentValues().mode === \"pixel\")) {\n\t\t\tgoogle_consent_settings.analytics_storage = wpm.getConsentValues().pixels.includes(\"google-analytics\") ? \"granted\" : \"denied\"\n\t\t\tgoogle_consent_settings.ad_storage = wpm.getConsentValues().pixels.includes(\"google-ads\") ? \"granted\" : \"denied\"\n\t\t}\n\n\t\treturn google_consent_settings\n\t}\n\n\twpm.updateGoogleConsentMode = function (analytics = true, ads = true) {\n\n\t\ttry {\n\t\t\tif (\n\t\t\t\t!window.gtag ||\n\t\t\t\t!wpmDataLayer.shop.cookie_consent_mgmt.explicit_consent\n\t\t\t) return\n\n\t\t\tgtag(\"consent\", \"update\", {\n\t\t\t\tanalytics_storage: analytics ? \"granted\" : \"denied\",\n\t\t\t\tad_storage : ads ? \"granted\" : \"denied\",\n\t\t\t})\n\t\t} catch (e) {\n\t\t\tconsole.error(e)\n\t\t}\n\t}\n\n\twpm.fireGtagGoogleAds = function () {\n\t\ttry {\n\t\t\twpmDataLayer.pixels.google.ads.state = \"loading\"\n\n\t\t\tif (wpmDataLayer?.pixels?.google?.ads?.enhanced_conversions?.active) {\n\t\t\t\tfor (const [key, item] of Object.entries(wpmDataLayer.pixels.google.ads.conversionIds)) {\n\t\t\t\t\tgtag(\"config\", key, {\"allow_enhanced_conversions\": true})\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tfor (const [key, item] of Object.entries(wpmDataLayer.pixels.google.ads.conversionIds)) {\n\t\t\t\t\tgtag(\"config\", key)\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (wpmDataLayer?.pixels?.google?.ads?.conversionIds && wpmDataLayer?.pixels?.google?.ads?.phone_conversion_label && wpmDataLayer?.pixels?.google?.ads?.phone_conversion_number) {\n\t\t\t\tgtag(\"config\", Object.keys(wpmDataLayer.pixels.google.ads.conversionIds)[0] + \"/\" + wpmDataLayer.pixels.google.ads.phone_conversion_label, {\n\t\t\t\t\tphone_conversion_number: wpmDataLayer.pixels.google.ads.phone_conversion_number,\n\t\t\t\t})\n\t\t\t}\n\n\t\t\t// ! enhanced_conversion_data needs to be var\n\t\t\t// https://support.google.com/google-ads/answer/9888145#zippy=%2Cvalidate-your-implementation-using-chrome-developer-tools\n\t\t\tif (\"order_received_page\" === wpmDataLayer.shop.page_type && wpmDataLayer?.order?.google?.ads?.enhanced_conversion_data) {\n\t\t\t\twindow.enhanced_conversion_data = wpmDataLayer.order.google.ads.enhanced_conversion_data\n\t\t\t}\n\n\t\t\twpmDataLayer.pixels.google.ads.state = \"ready\"\n\t\t} catch (e) {\n\t\t\tconsole.error(e)\n\t\t}\n\t}\n\n\twpm.fireGtagGoogleAnalyticsUA = function () {\n\t\ttry {\n\t\t\twpmDataLayer.pixels.google.analytics.universal.state = \"loading\"\n\n\t\t\tgtag(\"config\", wpmDataLayer.pixels.google.analytics.universal.property_id, wpmDataLayer.pixels.google.analytics.universal.parameters)\n\t\t\twpmDataLayer.pixels.google.analytics.universal.state = \"ready\"\n\t\t} catch (e) {\n\t\t\tconsole.error(e)\n\t\t}\n\t}\n\n\twpm.fireGtagGoogleAnalyticsGA4 = function () {\n\t\ttry {\n\t\t\twpmDataLayer.pixels.google.analytics.ga4.state = \"loading\"\n\n\t\t\tgtag(\"config\", wpmDataLayer.pixels.google.analytics.ga4.measurement_id, wpmDataLayer.pixels.google.analytics.ga4.parameters)\n\t\t\twpmDataLayer.pixels.google.analytics.ga4.state = \"ready\"\n\t\t} catch (e) {\n\t\t\tconsole.error(e)\n\t\t}\n\t}\n\n\twpm.isGoogleActive = function () {\n\t\tif (\n\t\t\twpmDataLayer?.pixels?.google?.analytics?.universal?.property_id ||\n\t\t\twpmDataLayer?.pixels?.google?.analytics?.ga4?.measurement_id ||\n\t\t\t!jQuery.isEmptyObject(wpmDataLayer?.pixels?.google?.ads?.conversionIds)\n\t\t) {\n\t\t\treturn true\n\t\t} else {\n\t\t\treturn false\n\t\t}\n\t}\n\n\twpm.getGoogleGtagId = function () {\n\t\tif (wpmDataLayer?.pixels?.google?.analytics?.universal?.property_id) {\n\t\t\treturn wpmDataLayer.pixels.google.analytics.universal.property_id\n\t\t} else if (wpmDataLayer?.pixels?.google?.analytics?.ga4?.measurement_id) {\n\t\t\treturn wpmDataLayer.pixels.google.analytics.ga4.measurement_id\n\t\t} else {\n\t\t\treturn Object.keys(wpmDataLayer.pixels.google.ads.conversionIds)[0]\n\t\t}\n\t}\n\n\twpm.loadGoogle = function () {\n\n\t\tif (wpm.isGoogleActive()) {\n\n\t\t\twpmDataLayer.pixels.google.state = \"loading\"\n\n\t\t\twpm.loadScriptAndCacheIt(\"https://www.googletagmanager.com/gtag/js?id=\" + wpm.getGoogleGtagId())\n\t\t\t\t.done(function (script, textStatus) {\n\t\t\t\t\ttry {\n\t\t\t\t\t\t// console.log('Google Optimize loaded')\n\t\t\t\t\t\t// alert('Google Optimize loaded')\n\n\t\t\t\t\t\t// Initiate Google dataLayer and gtag\n\t\t\t\t\t\twindow.dataLayer = window.dataLayer || []\n\t\t\t\t\t\twindow.gtag = function gtag() {\n\t\t\t\t\t\t\tdataLayer.push(arguments)\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t// Google Consent Mode\n\t\t\t\t\t\tif (wpmDataLayer?.pixels?.google?.consent_mode?.active) {\n\n\t\t\t\t\t\t\tlet google_consent_settings = {\n\t\t\t\t\t\t\t\t\"ad_storage\" : wpmDataLayer.pixels.google.consent_mode.ad_storage,\n\t\t\t\t\t\t\t\t\"analytics_storage\": wpmDataLayer.pixels.google.consent_mode.analytics_storage,\n\t\t\t\t\t\t\t\t\"wait_for_update\" : wpmDataLayer.pixels.google.consent_mode.wait_for_update,\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\tif (wpmDataLayer?.pixels?.google?.consent_mode?.region) {\n\t\t\t\t\t\t\t\tgoogle_consent_settings.region = wpmDataLayer.pixels.google.consent_mode.region\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tgoogle_consent_settings = wpm.getVisitorConsentStatusAndUpdateGoogleConsentSettings(google_consent_settings)\n\n\t\t\t\t\t\t\tgtag(\"consent\", \"default\", google_consent_settings)\n\t\t\t\t\t\t\tgtag(\"set\", \"ads_data_redaction\", wpmDataLayer.pixels.google.consent_mode.ads_data_redaction)\n\t\t\t\t\t\t\tgtag(\"set\", \"url_passthrough\", wpmDataLayer.pixels.google.consent_mode.url_passthrough)\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t// Google Linker\n\t\t\t\t\t\t// https://developers.google.com/gtagjs/devguide/linker\n\t\t\t\t\t\tif (wpmDataLayer?.pixels?.google?.linker?.settings) {\n\t\t\t\t\t\t\tgtag(\"set\", \"linker\", wpmDataLayer.pixels.google.linker.settings)\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tgtag(\"js\", new Date())\n\n\t\t\t\t\t\t// Google Ads loader\n\t\t\t\t\t\tif (!jQuery.isEmptyObject(wpmDataLayer?.pixels?.google?.ads?.conversionIds)) { // Only run if the pixel has set up\n\t\t\t\t\t\t\tif (wpm.googleConfigConditionsMet(\"ads\")) { \t\t\t\t\t\t\t// Only run if cookie consent has been given\n\t\t\t\t\t\t\t\twpm.fireGtagGoogleAds()\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\twpm.logPreventedPixelLoading(\"google-ads\", \"ads\")\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\n\n\t\t\t\t\t\t// Google Universal Analytics loader\n\t\t\t\t\t\tif (wpmDataLayer?.pixels?.google?.analytics?.universal?.property_id) { \t\t// Only run if the pixel has set up\n\t\t\t\t\t\t\tif (wpm.googleConfigConditionsMet(\"analytics\")) {\t\t\t\t\t\t// Only run if cookie consent has been given\n\t\t\t\t\t\t\t\twpm.fireGtagGoogleAnalyticsUA()\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\twpm.logPreventedPixelLoading(\"google-universal-analytics\", \"analytics\")\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t// GA4 loader\n\t\t\t\t\t\tif (wpmDataLayer?.pixels?.google?.analytics?.ga4?.measurement_id) { \t\t\t// Only run if the pixel has set up\n\t\t\t\t\t\t\tif (wpm.googleConfigConditionsMet(\"analytics\")) {\t\t\t\t\t\t// Only run if cookie consent has been given\n\t\t\t\t\t\t\t\twpm.fireGtagGoogleAnalyticsGA4()\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\twpm.logPreventedPixelLoading(\"ga4\", \"analytics\")\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\twpmDataLayer.pixels.google.state = \"ready\"\n\t\t\t\t\t} catch (e) {\n\t\t\t\t\t\tconsole.error(e)\n\t\t\t\t\t}\n\t\t\t\t})\n\t\t}\n\t}\n\n\twpm.canGoogleLoad = function () {\n\n\t\tif (wpmDataLayer?.pixels?.google?.consent_mode?.active) {\n\t\t\treturn true\n\t\t} else if (\"category\" === wpm.getConsentValues().mode) {\n\t\t\treturn !!(wpm.getConsentValues().categories[\"ads\"] || wpm.getConsentValues().categories[\"analytics\"])\n\t\t} else if (\"pixel\" === wpm.getConsentValues().mode) {\n\t\t\treturn wpm.getConsentValues().pixels.includes(\"google-ads\") || wpm.getConsentValues().pixels.includes(\"google-analytics\")\n\t\t} else {\n\t\t\tconsole.error(\"Couldn't find a valid load condition for Google mode in wpmConsentValues\")\n\t\t\treturn false\n\t\t}\n\t}\n\n\twpm.gtagLoaded = function () {\n\t\treturn new Promise(function (resolve, reject) {\n\n\t\t\tif (typeof wpmDataLayer?.pixels?.google?.state === \"undefined\") reject()\n\n\t\t\tlet startTime = 0\n\t\t\tlet timeout = 5000\n\t\t\tlet frequency = 200;\n\n\t\t\t(function wait() {\n\t\t\t\tif (wpmDataLayer?.pixels?.google?.state === \"ready\") return resolve()\n\t\t\t\tif (startTime >= timeout) return reject()\n\t\t\t\tstartTime += frequency\n\t\t\t\tsetTimeout(wait, frequency)\n\t\t\t})()\n\t\t})\n\t}\n\n\t// wpm.gtagLoadednew = function () {\n\t// \treturn Promise.race([\n\t// \t\t\tnew Promise(function (resolve, reject) {\n\t//\n\t// \t\t\t\tif (typeof wpmDataLayer?.pixels?.google?.state === \"undefined\") reject();\n\t//\n\t//\n\t// \t\t\t\t(function wait() {\n\t// \t\t\t\t\tif (wpmDataLayer?.pixels?.google?.state === \"ready\") return resolve()\n\t// \t\t\t\t\tif (to >= 1000) return reject()\n\t// \t\t\t\t\tsetTimeout(wait, 100)\n\t// \t\t\t\t})()\n\t// \t\t\t}),\n\t// \t\t\tnew Promise(function (resolve, reject) {\n\t// \t\t\t\tsetTimeout(() => reject(), 1000)\n\t// \t\t\t}),\n\t// \t\t],\n\t// \t)\n\t// \t\t// .then((value) => {console.log(\"race then value: \" + value)})\n\t// \t\t.catch(\n\t// \t\t\t(value) => {\n\t// \t\t\t\tconsole.log(\"race catch value: \" + value)\n\t// \t\t\t\treturn Promise.reject()\n\t// \t\t\t})\n\t// }\n\n\n\t// const promise1 = new Promise((resolve, reject) => {\n\t// \tsetTimeout(resolve, 500, \"one\")\n\t// })\n\t//\n\t// const promise2 = new Promise((resolve, reject) => {\n\t// \tsetTimeout(reject, 100, \"two\")\n\t// })\n\t//\n\t// let onlyRunIfResolves = function () {\n\t// \treturn Promise.race([promise1, promise2])\n\t// \t\t.catch(() => {\n\t// \t\t})\n\t// }\n\t//\n\t// onlyRunIfResolves()\n\t// \t.then(() => {\n\t// \t\tconsole.log(\"running function\")\n\t// \t})\n\n\n}(window.wpm = window.wpm || {}, jQuery));\n\n\n(function () {\n\n\tjQuery(document).on(\"wpmLoadPixels\", function () {\n\n\t\tif (typeof wpmDataLayer?.pixels?.google?.state === \"undefined\") {\n\t\t\tif (wpm.canGoogleLoad()) {\n\t\t\t\twpm.loadGoogle()\n\t\t\t} else {\n\t\t\t\twpm.logPreventedPixelLoading(\"google\", \"analytics / ads\")\n\t\t\t}\n\t\t}\n\t})\n\n\t// return wpmDataLayer?.pixels?.google?.state === \"undefined\";\n\n})()\n","(function (wpm, $, undefined) {\n\n\twpm.load_hotjar_pixel = function () {\n\n\t\ttry {\n\t\t\twpmDataLayer.pixels.hotjar.loaded = true;\n\n\t\t\t// @formatter:off\n\t\t\t(function(h,o,t,j,a,r){\n\t\t\t\th.hj=h.hj||function(){(h.hj.q=h.hj.q||[]).push(arguments)};\n\t\t\t\th._hjSettings={hjid:wpmDataLayer.pixels.hotjar.site_id,hjsv:6};\n\t\t\t\ta=o.getElementsByTagName('head')[0];\n\t\t\t\tr=o.createElement('script');r.async=1;\n\t\t\t\tr.src=t+h._hjSettings.hjid+j+h._hjSettings.hjsv;\n\t\t\t\ta.appendChild(r);\n\t\t\t})(window,document,'https://static.hotjar.com/c/hotjar-','.js?sv=');\n\t\t\t// @formatter:on\n\n\t\t} catch (e) {\n\t\t\tconsole.error(e)\n\t\t}\n\t}\n\n}(window.wpm = window.wpm || {}, jQuery));\n\n\n(function () {\n\n\tjQuery(document).on(\"wpmLoadPixels\", function () {\n\n\t\tif (wpmDataLayer?.pixels?.hotjar?.site_id && !wpmDataLayer?.pixels?.hotjar?.loaded) {\n\t\t\tif (wpm.canIFire(\"analytics\", \"hotjar\") && !wpmDataLayer?.pixels?.hotjar?.loaded) wpm.load_hotjar_pixel()\n\t\t}\n\t})\n\n})()\n\n\n\n","/**\n * After wpm is loaded\n * we first check if wpmDataLayer is loaded,\n * and as soon as it is, we load the pixels,\n * and as soon as the page load is complete,\n * we fire the wpmLoad event.\n *\n * @param {{pro:bool}} wpmDataLayer.version\n *\n * https://stackoverflow.com/a/25868457/4688612\n * https://stackoverflow.com/a/44093516/4688612\n */\nwpm.wpmDataLayerExists()\n\t.then(function () {\n\t\tconsole.log(\"WooCommerce Pixel Manager: \" + (wpmDataLayer.version.pro ? \"Pro\" : \"Free\") +\" Version \" + wpmDataLayer.version.number + \" loaded\")\n\t\tjQuery(document).trigger(\"wpmPreLoadPixels\", {})\n\t})\n\t.then(function () {\n\t\twpm.pageLoaded().then(function () {\n\t\t\tjQuery(document).trigger(\"wpmLoad\", {})\n\t\t})\n\t})\n\n","/**\n * Create a wpm namespace under which all functions are declared\n */\n\n// https://stackoverflow.com/a/5947280/4688612\n(function (wpm, $, undefined) {\n\n\tconst wpmDeduper = {\n\t\tkeyName : \"_wpm_order_ids\",\n\t\tcookieExpiresDays: 365,\n\t}\n\n\tconst wpmRestSettings = {\n\t\t// cookiesAvailable : '_wpm_cookies_are_available',\n\t\tcookieWpmRestEndpointAvailable: \"_wpm_endpoint_available\",\n\t\trestEndpoint : \"/wp-json/\",\n\t\trestFails : 0,\n\t\trestFailsThreshold : 10,\n\t}\n\n\twpm.emailSelected = false\n\twpm.paymentMethodSelected = false\n\n\t// wpm.checkIfCookiesAvailable = function () {\n\t//\n\t// // read the cookie if previously set, if it is return true, otherwise continue\n\t// if (wpm.getCookie(wpmRestSettings.cookiesAvailable)) {\n\t// return true;\n\t// }\n\t//\n\t// // set the cookie for the session\n\t// Cookies.set(wpmRestSettings.cookiesAvailable, true);\n\t//\n\t// // read cookie, true if ok, false if not ok\n\t// return !!wpm.getCookie(wpmRestSettings.cookiesAvailable);\n\t// }\n\n\twpm.useRestEndpoint = function () {\n\n\t\t// only if sessionStorage is available\n\n\t\t// only if REST API endpoint is generally accessible\n\t\t// check in sessionStorage if we checked before and return answer\n\t\t// otherwise check if the endpoint is available, save answer in sessionStorage and return answer\n\n\t\t// only if not too many REST API errors happened\n\n\t\treturn wpm.isSessionStorageAvailable() &&\n\t\t\twpm.isRestEndpointAvailable() &&\n\t\t\twpm.isBelowRestErrorThreshold()\n\t}\n\n\twpm.isBelowRestErrorThreshold = function () {\n\t\treturn window.sessionStorage.getItem(wpmRestSettings.restFails) <= wpmRestSettings.restFailsThreshold\n\t}\n\n\twpm.isRestEndpointAvailable = function () {\n\n\t\tif (window.sessionStorage.getItem(wpmRestSettings.cookieWpmRestEndpointAvailable)) {\n\t\t\treturn JSON.parse(window.sessionStorage.getItem(wpmRestSettings.cookieWpmRestEndpointAvailable))\n\t\t} else {\n\t\t\t// return wpm.testEndpoint();\n\t\t\t// just set the value whenever possible in order not to wait or block the main thread\n\t\t\twpm.testEndpoint()\n\t\t}\n\t}\n\n\twpm.isSessionStorageAvailable = function () {\n\n\t\treturn !!window.sessionStorage\n\t}\n\n\twpm.testEndpoint = function (\n\t\turl = location.protocol + \"//\" + location.host + wpmRestSettings.restEndpoint,\n\t\tcookieName = wpmRestSettings.cookieWpmRestEndpointAvailable,\n\t) {\n\t\t// console.log('testing endpoint');\n\n\t\tjQuery.ajax(url, {\n\t\t\ttype : \"HEAD\",\n\t\t\ttimeout: 1000,\n\t\t\t// async: false,\n\t\t\tstatusCode: {\n\t\t\t\t200: function (response) {\n\t\t\t\t\t// Cookies.set(cookieName, true);\n\t\t\t\t\t// console.log('endpoint works');\n\t\t\t\t\twindow.sessionStorage.setItem(cookieName, JSON.stringify(true))\n\t\t\t\t},\n\t\t\t\t404: function (response) {\n\t\t\t\t\t// Cookies.set(cookieName, false);\n\t\t\t\t\t// console.log('endpoint doesn\\'t work');\n\t\t\t\t\twindow.sessionStorage.setItem(cookieName, JSON.stringify(false))\n\t\t\t\t},\n\t\t\t\t0 : function (response) {\n\t\t\t\t\t// Cookies.set(cookieName, false);\n\t\t\t\t\t// console.log('endpoint doesn\\'t work');\n\t\t\t\t\twindow.sessionStorage.setItem(cookieName, JSON.stringify(false))\n\t\t\t\t},\n\t\t\t},\n\t\t}).then(response => {\n\t\t\t// console.log('test done')\n\t\t\t// console.log('result: ' + JSON.parse(window.sessionStorage.getItem(cookieName)));\n\t\t\t// return JSON.parse(window.sessionStorage.getItem(cookieName));\n\t\t})\n\t}\n\n\twpm.isWpmRestEndpointAvailable = function (cookieName = wpmRestSettings.cookieWpmRestEndpointAvailable) {\n\n\t\treturn !!wpm.getCookie(cookieName)\n\t}\n\n\twpm.writeOrderIdToStorage = function (orderId, expireDays = 365) {\n\n\t\t// save the order ID in the browser storage\n\n\t\tif (!window.Storage) {\n\t\t\tlet expiresDate = new Date()\n\t\t\texpiresDate.setDate(expiresDate.getDate() + wpmDeduper.cookieExpiresDays)\n\n\t\t\tlet ids = []\n\t\t\tif (checkCookie()) {\n\t\t\t\tids = JSON.parse(wpm.getCookie(wpmDeduper.keyName))\n\t\t\t}\n\n\t\t\tif (!ids.includes(orderId)) {\n\t\t\t\tids.push(orderId)\n\t\t\t\tdocument.cookie = wpmDeduper.keyName + \"=\" + JSON.stringify(ids) + \";expires=\" + expiresDate.toUTCString()\n\t\t\t}\n\n\t\t} else {\n\t\t\tif (localStorage.getItem(wpmDeduper.keyName) === null) {\n\t\t\t\tlet ids = []\n\t\t\t\tids.push(orderId)\n\t\t\t\twindow.localStorage.setItem(wpmDeduper.keyName, JSON.stringify(ids))\n\n\t\t\t} else {\n\t\t\t\tlet ids = JSON.parse(localStorage.getItem(wpmDeduper.keyName))\n\t\t\t\tif (!ids.includes(orderId)) {\n\t\t\t\t\tids.push(orderId)\n\t\t\t\t\twindow.localStorage.setItem(wpmDeduper.keyName, JSON.stringify(ids))\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tif (typeof wpm.storeOrderIdOnServer === \"function\" && wpmDataLayer.orderDeduplication) {\n\t\t\twpm.storeOrderIdOnServer(orderId)\n\t\t}\n\t}\n\n\tfunction checkCookie() {\n\t\tlet key = wpm.getCookie(wpmDeduper.keyName)\n\t\treturn key !== \"\"\n\t}\n\n\twpm.isOrderIdStored = function (orderId) {\n\n\t\t// console.log('deduper: ' + wpmDataLayer.orderDeduplication);\n\t\tif (wpmDataLayer.orderDeduplication) {\n\t\t\t// console.log('order deduplication: on');\n\t\t\tif (!window.Storage) {\n\n\t\t\t\tif (checkCookie()) {\n\t\t\t\t\tlet ids = JSON.parse(wpm.getCookie(wpmDeduper.keyName))\n\t\t\t\t\treturn ids.includes(orderId)\n\t\t\t\t} else {\n\t\t\t\t\treturn false\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tif (localStorage.getItem(wpmDeduper.keyName) !== null) {\n\t\t\t\t\tlet ids = JSON.parse(localStorage.getItem(wpmDeduper.keyName))\n\t\t\t\t\treturn ids.includes(orderId)\n\t\t\t\t} else {\n\t\t\t\t\treturn false\n\t\t\t\t}\n\t\t\t}\n\t\t} else {\n\t\t\tconsole.log(\"order duplication prevention: off\")\n\t\t\treturn false\n\t\t}\n\t}\n\n\twpm.isEmail = function (email) {\n\t\t// https://emailregex.com/\n\t\tlet regex = /^(([^<>()\\[\\]\\\\.,;:\\s@\"]+(\\.[^<>()\\[\\]\\\\.,;:\\s@\"]+)*)|(\".+\"))@((\\[[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}])|(([a-zA-Z\\-0-9]+\\.)+[a-zA-Z]{2,}))$/\n\t\treturn regex.test(email)\n\t}\n\n\twpm.removeProductFromCart = function (productId, quantityToRemove = null) {\n\t\t// console.log('product_id: ' + productId + ' | quantityToRemove: ' + quantityToRemove);\n\n\t\ttry {\n\n\t\t\tif (!productId) throw Error(\"Wasn't able to retrieve a productId\")\n\n\t\t\tproductId = getIdBasedOndVariationsOutputSetting(productId)\n\n\t\t\tif (!productId) throw Error(\"Wasn't able to retrieve a productId\")\n\n\t\t\tlet quantity\n\n\t\t\tif (quantityToRemove == null) {\n\t\t\t\tquantity = wpmDataLayer.cart[productId].quantity\n\t\t\t} else {\n\t\t\t\tquantity = quantityToRemove\n\t\t\t}\n\n\t\t\t// console.log('product_id: ' + productId + ' | qty: ' + quantity);\n\t\t\t// console.log(productId);\n\t\t\t// console.log(wpmDataLayer.cart);\n\t\t\t// console.log(wpmDataLayer.cart[productId]);\n\n\t\t\tif (wpmDataLayer.cart[productId]) {\n\n\t\t\t\t// let product = {\n\t\t\t\t// id : productId.toString(),\n\t\t\t\t// dyn_r_ids: wpmDataLayer.cart[productId].dyn_r_ids,\n\t\t\t\t// name : wpmDataLayer.cart[productId].name,\n\t\t\t\t// // list_name: wpmDataLayer.shop.list_name, // doesn't make sense on mini_cart\n\t\t\t\t// brand : wpmDataLayer.cart[productId].brand,\n\t\t\t\t// category: wpmDataLayer.cart[productId].category,\n\t\t\t\t// variant : wpmDataLayer.cart[productId].variant,\n\t\t\t\t// // list_position: wpmDataLayer.cart[productId].position, // doesn't make sense on mini_cart\n\t\t\t\t// quantity : quantity,\n\t\t\t\t// price : wpmDataLayer.cart[productId].price,\n\t\t\t\t// isVariation: wpmDataLayer.products[productId].isVariation,\n\t\t\t\t// };\n\t\t\t\t//\n\t\t\t\t// if (product.isVariation) product['parentId_dyn_r_ids'] = wpmDataLayer.products[productId].parentId_dyn_r_ids;\n\n\t\t\t\tlet product = wpm.getProductDetailsFormattedForEvent(productId, quantity)\n\n\t\t\t\t// console.log('removing');\n\t\t\t\t// console.log(data);\n\n\t\t\t\tjQuery(document).trigger(\"wpmRemoveFromCart\", product)\n\n\t\t\t\tif (quantityToRemove == null || wpmDataLayer.cart[productId].quantity === quantityToRemove) {\n\t\t\t\t\tdelete wpmDataLayer.cart[productId]\n\t\t\t\t\tif (sessionStorage) sessionStorage.setItem(\"wpmDataLayerCart\", JSON.stringify(wpmDataLayer.cart))\n\t\t\t\t} else {\n\t\t\t\t\twpmDataLayer.cart[productId].quantity = wpmDataLayer.cart[productId].quantity - quantity\n\t\t\t\t\tif (sessionStorage) sessionStorage.setItem(\"wpmDataLayerCart\", JSON.stringify(wpmDataLayer.cart))\n\t\t\t\t}\n\t\t\t}\n\t\t} catch (e) {\n\t\t\tconsole.error(e)\n\t\t\t// console.log('getting cart from back end');\n\t\t\t// wpm.getCartItemsFromBackend();\n\t\t\t// console.log('getting cart from back end done');\n\n\t\t}\n\t}\n\n\tgetIdBasedOndVariationsOutputSetting = function (productId) {\n\n\t\ttry {\n\t\t\tif (wpmDataLayer?.general?.variationsOutput) {\n\t\t\t\t// console.log('test');\n\t\t\t\treturn productId\n\t\t\t} else {\n\t\t\t\tif (wpmDataLayer.products[productId].isVariation) {\n\t\t\t\t\treturn wpmDataLayer.products[productId].parentId\n\t\t\t\t} else {\n\t\t\t\t\treturn productId\n\t\t\t\t}\n\t\t\t}\n\t\t} catch (e) {\n\t\t\tconsole.error(e)\n\t\t}\n\t}\n\n\t// add_to_cart\n\twpm.addProductToCart = function (productId, quantity) {\n\n\t\ttry {\n\t\t\t// console.log('productId: ' + productId + ' | qty: ' + quantity);\n\t\t\t// console.log('productId: ' + productId + ' | variationId: ' + variationId + ' | qty: ' + quantity);\n\n\t\t\tif (!productId) throw Error(\"Wasn't able to retrieve a productId\")\n\n\t\t\tproductId = getIdBasedOndVariationsOutputSetting(productId)\n\n\t\t\tif (!productId) throw Error(\"Wasn't able to retrieve a productId\")\n\n\t\t\tif (wpmDataLayer?.products[productId]) {\n\n\t\t\t\tlet product = wpm.getProductDetailsFormattedForEvent(productId, quantity)\n\n\t\t\t\t// console.log(productId)\n\t\t\t\t// console.log(wpmDataLayer.cart)\n\n\t\t\t\tjQuery(document).trigger(\"wpmAddToCart\", product)\n\n\t\t\t\t// add product to cart wpmDataLayer['cart']\n\n\t\t\t\t// if the product already exists in the object, only add the additional quantity\n\t\t\t\t// otherwise create that product object in the wpmDataLayer['cart']\n\t\t\t\tif (wpmDataLayer?.cart[productId]) {\n\t\t\t\t\twpmDataLayer.cart[productId].quantity = wpmDataLayer.cart[productId].quantity + quantity\n\t\t\t\t} else {\n\n\t\t\t\t\tif (!(\"cart\" in wpmDataLayer)) wpmDataLayer.cart = {}\n\t\t\t\t\twpmDataLayer.cart[productId] = wpm.getProductDetailsFormattedForEvent(productId, quantity)\n\t\t\t\t}\n\n\t\t\t\tif (sessionStorage) sessionStorage.setItem(\"wpmDataLayerCart\", JSON.stringify(wpmDataLayer.cart))\n\t\t\t}\n\t\t} catch (e) {\n\t\t\tconsole.error(e)\n\n\t\t\t// fallback if wpmDataLayer.cart and wpmDataLayer.products got out of sync in case cart caching has an issue\n\t\t\twpm.getCartItemsFromBackend()\n\t\t}\n\t}\n\n\twpm.getCartItems = function () {\n\n\t\t// console.log('get cart items');\n\n\t\tif (sessionStorage) {\n\t\t\tif (!sessionStorage.getItem(\"wpmDataLayerCart\") || wpmDataLayer.shop.page_type === \"order_received_page\") {\n\t\t\t\tsessionStorage.setItem(\"wpmDataLayerCart\", JSON.stringify({}))\n\t\t\t} else {\n\t\t\t\twpm.saveCartObjectToDataLayer(JSON.parse(sessionStorage.getItem(\"wpmDataLayerCart\")))\n\t\t\t}\n\t\t} else {\n\t\t\twpm.getCartItemsFromBackend()\n\t\t}\n\t}\n\n\t// get all cart items from the backend\n\twpm.getCartItemsFromBackend = function () {\n\t\ttry {\n\t\t\tlet data = {\n\t\t\t\taction: \"wpm_get_cart_items\",\n\t\t\t}\n\n\t\t\tjQuery.ajax(\n\t\t\t\t{\n\t\t\t\t\ttype : \"get\",\n\t\t\t\t\tdataType: \"json\",\n\t\t\t\t\t// url : ajax_object.ajax_url,\n\t\t\t\t\turl : wpm.ajax_url,\n\t\t\t\t\tdata : data,\n\t\t\t\t\tsuccess: function (cartItems) {\n\n\t\t\t\t\t\t// save all cart items into wpmDataLayer\n\n\t\t\t\t\t\tif (!cartItems[\"cart\"]) cartItems[\"cart\"] = {}\n\n\t\t\t\t\t\twpm.saveCartObjectToDataLayer(cartItems[\"cart\"])\n\t\t\t\t\t\tif (sessionStorage) sessionStorage.setItem(\"wpmDataLayerCart\", JSON.stringify(cartItems[\"cart\"]))\n\t\t\t\t\t},\n\t\t\t\t})\n\t\t} catch (e) {\n\t\t\tconsole.error(e)\n\t\t}\n\t}\n\n\twpm.getProductsFromBackend = function (productIds) {\n\t\t// console.log('getting pids from back-end: ' + productIds)\n\t\t// get productIds from the backend\n\n\t\t// reduce productIds by products already in the dataLayer\n\t\tproductIds = productIds.filter(item => !wpmDataLayer.products.hasOwnProperty(item))\n\n\t\t// if no products IDs are in the object, don't try to get anything from the server\n\t\tif (!productIds || productIds.length === 0) return\n\n\t\ttry {\n\t\t\tlet data = {\n\t\t\t\taction : \"wpm_get_product_ids\",\n\t\t\t\tproductIds: productIds,\n\t\t\t}\n\n\t\t\tjQuery.ajax(\n\t\t\t\t{\n\t\t\t\t\ttype : \"get\",\n\t\t\t\t\tdataType: \"json\",\n\t\t\t\t\t// url : ajax_object.ajax_url,\n\t\t\t\t\turl : wpm.ajax_url,\n\t\t\t\t\tdata : data,\n\t\t\t\t\tsuccess: function (products) {\n\n\t\t\t\t\t\t// merge products into wpmDataLayer.products\n\t\t\t\t\t\twpmDataLayer.products = Object.assign({}, wpmDataLayer.products, products)\n\t\t\t\t\t},\n\t\t\t\t\terror : function (response) {\n\t\t\t\t\t\tconsole.log(response)\n\t\t\t\t\t},\n\t\t\t\t})\n\t\t} catch (e) {\n\t\t\tconsole.error(e)\n\t\t}\n\t}\n\n\twpm.saveCartObjectToDataLayer = function (cartObject) {\n\t\twpmDataLayer.cart = cartObject\n\t\twpmDataLayer.products = Object.assign({}, wpmDataLayer.products, cartObject)\n\t}\n\n\twpm.fireCheckoutOption = function (step, checkout_option = null, value = null) {\n\n\t\tlet data = {\n\t\t\tstep : step,\n\t\t\tcheckout_option: checkout_option,\n\t\t\tvalue : value,\n\t\t}\n\n\t\tjQuery(document).trigger(\"wpmFireCheckoutOption\", data)\n\t}\n\n\twpm.fireCheckoutProgress = function (step) {\n\n\t\tlet data = {\n\t\t\tstep: step,\n\t\t}\n\n\t\tjQuery(document).trigger(\"wpmFireCheckoutProgress\", data)\n\t}\n\n\twpm.getPostIdFromString = function (string) {\n\t\t// console.log(string);\n\t\ttry {\n\t\t\treturn string.match(/(post-)(\\d+)/)[2]\n\t\t} catch (e) {\n\t\t\tconsole.error(e)\n\t\t}\n\t}\n\n\twpm.triggerViewItemList = function (productId) {\n\n\t\t// productId = null;\n\n\t\tif (!productId) throw Error(\"Wasn't able to retrieve a productId\")\n\n\t\tproductId = getIdBasedOndVariationsOutputSetting(productId)\n\n\t\tif (!productId) throw Error(\"Wasn't able to retrieve a productId\")\n\n\t\tjQuery(document).trigger(\"wpmViewItemList\", wpm.getProductDataForViewItemEvent(productId))\n\t}\n\n\twpm.getProductDataForViewItemEvent = function (productId) {\n\n\t\tif (!productId) throw Error(\"Wasn't able to retrieve a productId\")\n\n\t\ttry {\n\t\t\tif (wpmDataLayer.products[productId]) {\n\n\t\t\t\treturn wpm.getProductDetailsFormattedForEvent(productId)\n\t\t\t}\n\t\t} catch (e) {\n\t\t\tconsole.error(e)\n\t\t}\n\t}\n\twpm.getMainProductIdFromProductPage = function () {\n\t\ttry {\n\t\t\tif ([\"simple\", \"variable\", \"grouped\", \"composite\", \"bundle\"].indexOf(wpmDataLayer.shop.product_type) >= 0) {\n\t\t\t\treturn jQuery(\".wpmProductId:first\").data(\"id\")\n\t\t\t} else {\n\t\t\t\treturn false\n\t\t\t}\n\t\t} catch (e) {\n\t\t\tconsole.error(e)\n\t\t}\n\t}\n\n\twpm.viewItemListTriggerTestMode = function (target) {\n\n\t\tjQuery(target).css({\"position\": \"relative\"})\n\t\tjQuery(target).append(\"<div id=\\\"viewItemListTriggerOverlay\\\"></div>\")\n\t\tjQuery(target).find(\"#viewItemListTriggerOverlay\").css({\n\t\t\t\"z-index\" : \"10\",\n\t\t\t\"display\" : \"block\",\n\t\t\t\"position\" : \"absolute\",\n\t\t\t\"height\" : \"100%\",\n\t\t\t\"top\" : \"0\",\n\t\t\t\"left\" : \"0\",\n\t\t\t\"right\" : \"0\",\n\t\t\t\"opacity\" : wpmDataLayer.viewItemListTrigger.opacity,\n\t\t\t\"background-color\": wpmDataLayer.viewItemListTrigger.backgroundColor,\n\t\t})\n\t}\n\n\twpm.getSearchTermFromUrl = function () {\n\t\ttry {\n\t\t\tlet urlParameters = new URLSearchParams(window.location.search)\n\t\t\treturn urlParameters.get(\"s\")\n\t\t} catch (e) {\n\t\t\tconsole.error(e)\n\t\t}\n\t}\n\n\t// we need this to track timeouts for intersection observers\n\tlet ioTimeouts = {}\n\n\twpm.observerCallback = function (entries, observer) {\n\n\t\tentries.forEach((entry) => {\n\n\t\t\ttry {\n\t\t\t\tlet productId\n\n\t\t\t\tlet elementId = jQuery(entry.target).data(\"ioid\")\n\n\t\t\t\t// Get the productId from next element, if wpmProductId is a sibling, like in Gutenberg blocks\n\t\t\t\t// otherwise go search in children, like in regular WC loop items\n\t\t\t\tif (jQuery(entry.target).next(\".wpmProductId\").length) {\n\t\t\t\t\t// console.log('test 1');\n\t\t\t\t\tproductId = jQuery(entry.target).next(\".wpmProductId\").data(\"id\")\n\t\t\t\t} else {\n\t\t\t\t\tproductId = jQuery(entry.target).find(\".wpmProductId\").data(\"id\")\n\t\t\t\t}\n\n\t\t\t\t// productId = null;\n\n\t\t\t\tif (!productId) throw Error(\"wpmProductId element not found\")\n\n\t\t\t\tif (entry.isIntersecting) {\n\n\t\t\t\t\t// console.log('prodid: ' + productId);\n\t\t\t\t\tioTimeouts[elementId] = setTimeout(() => {\n\t\t\t\t\t\t// console.log('prodid: ' + productId);\n\t\t\t\t\t\twpm.triggerViewItemList(productId)\n\t\t\t\t\t\tif (wpmDataLayer.viewItemListTrigger.testMode) wpm.viewItemListTriggerTestMode(entry.target)\n\t\t\t\t\t\tif (wpmDataLayer.viewItemListTrigger.repeat === false) observer.unobserve(entry.target)\n\t\t\t\t\t}, wpmDataLayer.viewItemListTrigger.timeout)\n\n\t\t\t\t} else {\n\n\t\t\t\t\tclearTimeout(ioTimeouts[elementId])\n\t\t\t\t\tif (wpmDataLayer.viewItemListTrigger.testMode) jQuery(entry.target).find(\"#viewItemListTriggerOverlay\").remove()\n\t\t\t\t}\n\t\t\t} catch (e) {\n\t\t\t\tconsole.error(e)\n\t\t\t}\n\t\t})\n\t}\n\n\t// fire view_item_list only on products that have become visible\n\tlet io\n\tlet ioid = 0\n\tlet allIoElementsToWatch\n\n\tlet getAllElementsToWatch = function () {\n\n\t\tallIoElementsToWatch = jQuery(\".wpmProductId\")\n\t\t\t.map(function (i, elem) {\n\t\t\t\t// console.log(elem);\n\t\t\t\tif (\n\t\t\t\t\tjQuery(elem).parent().hasClass(\"type-product\") ||\n\t\t\t\t\tjQuery(elem).parent().hasClass(\"product\") ||\n\t\t\t\t\tjQuery(elem).parent().hasClass(\"product-item-inner\")\n\t\t\t\t) {\n\t\t\t\t\t// console.log(elem);\n\t\t\t\t\treturn jQuery(elem).parent()\n\t\t\t\t} else if (\n\t\t\t\t\tjQuery(elem).prev().hasClass(\"wc-block-grid__product\") ||\n\t\t\t\t\tjQuery(elem).prev().hasClass(\"product\") ||\n\t\t\t\t\tjQuery(elem).prev().hasClass(\"product-small\") ||\n\t\t\t\t\tjQuery(elem).prev().hasClass(\"woocommerce-LoopProduct-link\")\n\t\t\t\t) {\n\t\t\t\t\treturn jQuery(this).prev()\n\t\t\t\t} else if (jQuery(elem).closest(\".product\").length) {\n\t\t\t\t\treturn jQuery(elem).closest(\".product\")\n\t\t\t\t}\n\t\t\t})\n\t}\n\n\twpm.startIntersectionObserverToWatch = function () {\n\n\t\ttry {\n\t\t\t// enable view_item_list test mode from browser\n\t\t\tif (wpm.urlHasParameter(\"vildemomode\")) wpmDataLayer.viewItemListTrigger.testMode = true\n\n\t\t\t// set up intersection observer\n\t\t\tio = new IntersectionObserver(wpm.observerCallback, {\n\t\t\t\tthreshold: wpmDataLayer.viewItemListTrigger.threshold,\n\t\t\t})\n\n\t\t\tgetAllElementsToWatch()\n\n\t\t\t// console.log(allElementsToWatch);\n\n\t\t\tallIoElementsToWatch.each(function (i, elem) {\n\t\t\t\t// console.log(elem[0]);\n\t\t\t\t// jQuery(elem[0]).attr('data-ioid', ioid++);\n\t\t\t\tjQuery(elem[0]).data(\"ioid\", ioid++)\n\n\t\t\t\tio.observe(elem[0])\n\t\t\t})\n\t\t} catch (e) {\n\t\t\tconsole.error(e)\n\t\t}\n\t}\n\n\t// watch DOM for new lazy loaded products and add them to the intersection observer\n\twpm.startProductsMutationObserverToWatch = function () {\n\n\t\ttry {\n\t\t\t// Pass in the target node, as well as the observer options\n\n\t\t\t// selects the most common parent node\n\t\t\t// https://stackoverflow.com/a/7648323/4688612\n\t\t\tlet productsNode = jQuery(\".wpmProductId:eq(0)\").parents().has(jQuery(\".wpmProductId:eq(1)\").parents()).first()\n\n\t\t\tif (productsNode.length) {\n\t\t\t\tproductsMutationObserver.observe(productsNode[0], {\n\t\t\t\t\tattributes : true,\n\t\t\t\t\tchildList : true,\n\t\t\t\t\tcharacterData: true,\n\t\t\t\t})\n\t\t\t}\n\t\t} catch (e) {\n\t\t\tconsole.error(e)\n\t\t}\n\t}\n\n\t// Create an observer instance\n\tlet productsMutationObserver = new MutationObserver(function (mutations) {\n\n\t\tmutations.forEach(function (mutation) {\n\t\t\tlet newNodes = mutation.addedNodes // DOM NodeList\n\t\t\tif (newNodes !== null) { // If there are new nodes added\n\t\t\t\tlet nodes = jQuery(newNodes) // jQuery set\n\t\t\t\tnodes.each(function () {\n\t\t\t\t\tif (\n\t\t\t\t\t\tjQuery(this).hasClass(\"type-product\") ||\n\t\t\t\t\t\tjQuery(this).hasClass(\"product-small\") ||\n\t\t\t\t\t\tjQuery(this).hasClass(\"wc-block-grid__product\")\n\t\t\t\t\t) {\n\t\t\t\t\t\t// check if the node has a child or sibling wpmProductId\n\t\t\t\t\t\t// if yes add it to the intersectionObserver\n\t\t\t\t\t\tif (hasWpmProductIdElement(this)) {\n\t\t\t\t\t\t\tjQuery(this).data(\"ioid\", ioid++)\n\t\t\t\t\t\t\tio.observe(this)\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t})\n\t\t\t}\n\t\t})\n\t})\n\n\tlet hasWpmProductIdElement = function (elem) {\n\t\treturn !!(jQuery(elem).find(\".wpmProductId\").length ||\n\t\t\tjQuery(elem).siblings(\".wpmProductId\").length)\n\t}\n\n\twpm.setCookie = function (cookieName, cookieValue = \"\", expiryDays = null) {\n\t\tif (expiryDays) {\n\t\t\tlet d = new Date()\n\t\t\td.setTime(d.getTime() + (expiryDays * 24 * 60 * 60 * 1000))\n\t\t\tlet expires = \"expires=\" + d.toUTCString()\n\t\t\tdocument.cookie = cookieName + \"=\" + cookieValue + \";\" + expires + \";path=/\"\n\t\t} else {\n\t\t\tdocument.cookie = cookieName + \"=\" + cookieValue + \";path=/\"\n\t\t}\n\t}\n\n\twpm.getCookie = function (cookieName) {\n\t\tlet name = cookieName + \"=\"\n\t\tlet decodedCookie = decodeURIComponent(document.cookie)\n\t\tlet ca = decodedCookie.split(\";\")\n\t\tfor (let i = 0; i < ca.length; i++) {\n\t\t\tlet c = ca[i]\n\t\t\twhile (c.charAt(0) == \" \") {\n\t\t\t\tc = c.substring(1)\n\t\t\t}\n\t\t\tif (c.indexOf(name) == 0) {\n\t\t\t\treturn c.substring(name.length, c.length)\n\t\t\t}\n\t\t}\n\t\treturn \"\"\n\t}\n\n\twpm.getWpmSessionData = function () {\n\t\tif (window.sessionStorage) {\n\n\t\t\tlet data = window.sessionStorage.getItem(\"_wpm\")\n\t\t\tif (data !== null) {\n\t\t\t\treturn JSON.parse(data)\n\t\t\t} else {\n\t\t\t\treturn {}\n\t\t\t}\n\t\t} else {\n\t\t\treturn {}\n\t\t}\n\t}\n\n\twpm.setWpmSessionData = function (data) {\n\t\tif (window.sessionStorage) {\n\t\t\twindow.sessionStorage.setItem(\"_wpm\", JSON.stringify(data))\n\t\t}\n\t}\n\n\twpm.storeOrderIdOnServer = function (orderId) {\n\n\t\t// console.log('saving wpm_purchase_pixels_fired');\n\n\t\t// console.log('url: ' + wpm_premium_only_ajax_object.ajax_url);\n\t\t// console.log('nonce: ' + wpm_premium_only_ajax_object.nonce);\n\t\t// console.log('url: ' + wpm.ajax_url);\n\t\t// console.log('nonce: ' + wpm.nonce);\n\n\t\ttry {\n\t\t\t// save the state in the database\n\t\t\tlet data = {\n\t\t\t\taction : \"wpm_purchase_pixels_fired\",\n\t\t\t\torder_id: orderId,\n\t\t\t\t// nonce : ajax_object.nonce,\n\t\t\t\tnonce: wpm.nonce,\n\t\t\t}\n\n\t\t\tjQuery.ajax(\n\t\t\t\t{\n\t\t\t\t\ttype : \"post\",\n\t\t\t\t\tdataType: \"json\",\n\t\t\t\t\t// url : ajax_object.ajax_url,\n\t\t\t\t\turl : wpm.ajax_url,\n\t\t\t\t\tdata : data,\n\t\t\t\t\tsuccess: function (response) {\n\t\t\t\t\t\tif (response.success === false) {\n\t\t\t\t\t\t\tconsole.log(response)\n\t\t\t\t\t\t}\n\t\t\t\t\t},\n\t\t\t\t\terror : function (response) {\n\t\t\t\t\t\tconsole.log(response)\n\t\t\t\t\t},\n\t\t\t\t})\n\t\t} catch (e) {\n\t\t\tconsole.error(e)\n\t\t}\n\t}\n\n\twpm.getProductIdByCartItemKeyUrl = function (url) {\n\t\tlet searchParams = new URLSearchParams(url.search)\n\t\tlet cartItemKey = searchParams.get(\"remove_item\")\n\n\t\tlet productId\n\n\t\tif (wpmDataLayer.cartItemKeys[cartItemKey][\"variation_id\"] === 0) {\n\t\t\tproductId = wpmDataLayer.cartItemKeys[cartItemKey][\"product_id\"]\n\t\t} else {\n\t\t\tproductId = wpmDataLayer.cartItemKeys[cartItemKey][\"variation_id\"]\n\t\t}\n\n\t\treturn productId\n\t}\n\n\twpm.getAddToCartLinkProductIds = function () {\n\t\treturn jQuery(\"a\").map(function () {\n\t\t\tlet href = jQuery(this).attr(\"href\")\n\n\t\t\tif (href && href.includes(\"?add-to-cart=\")) {\n\t\t\t\tlet matches = href.match(/(add-to-cart=)(\\d+)/)\n\t\t\t\tif (matches) return matches[2]\n\t\t\t}\n\t\t}).get()\n\t}\n\n\twpm.getProductDetailsFormattedForEvent = function (productId, quantity = 1) {\n\n\t\t// console.log(wpmDataLayer.products[productId].dyn_r_ids)\n\n\t\tlet product = {\n\t\t\tid : productId.toString(),\n\t\t\tdyn_r_ids : wpmDataLayer.products[productId].dyn_r_ids,\n\t\t\tname : wpmDataLayer.products[productId].name,\n\t\t\tlist_name : wpmDataLayer.shop.list_name,\n\t\t\tbrand : wpmDataLayer.products[productId].brand,\n\t\t\tcategory : wpmDataLayer.products[productId].category,\n\t\t\tvariant : wpmDataLayer.products[productId].variant,\n\t\t\tlist_position: wpmDataLayer.products[productId].position,\n\t\t\tquantity : quantity,\n\t\t\tprice : wpmDataLayer.products[productId].price,\n\t\t\tcurrency : wpmDataLayer.shop.currency,\n\t\t\tisVariable : wpmDataLayer.products[productId].isVariable,\n\t\t\tisVariation : wpmDataLayer.products[productId].isVariation,\n\t\t\tparentId : wpmDataLayer.products[productId].parentId,\n\t\t}\n\n\t\tif (product.isVariation) product[\"parentId_dyn_r_ids\"] = wpmDataLayer.products[productId].parentId_dyn_r_ids\n\n\t\treturn product\n\t}\n\n\twpm.setReferrerToCookie = function () {\n\t\t// can't use session storage as we can't read it from the server\n\t\tif (!wpm.getCookie(\"wpmReferrer\")) {\n\t\t\twpm.setCookie(\"wpmReferrer\", document.referrer)\n\t\t}\n\t}\n\n\twpm.getReferrerFromCookie = function () {\n\t\tif (wpm.getCookie(\"wpmReferrer\")) {\n\t\t\treturn wpm.getCookie(\"wpmReferrer\")\n\t\t} else {\n\t\t\treturn null\n\t\t}\n\t}\n\n\twpm.getClidFromBrowser = function (clidId = \"gclid\") {\n\n\t\tlet clidCookieId\n\n\t\tclidCookieId = {\n\t\t\tgclid: \"_gcl_aw\",\n\t\t\tdclid: \"_gcl_dc\",\n\t\t}\n\n\t\tif (wpm.getCookie(clidCookieId[clidId])) {\n\t\t\tlet clidCookie = wpm.getCookie(clidCookieId[clidId])\n\t\t\tlet matches = clidCookie.match(/(GCL.[\\d]*.)(.*)/)\n\t\t\treturn matches[2]\n\t\t} else {\n\t\t\treturn \"\"\n\t\t}\n\t}\n\n\twpm.getUserAgent = function () {\n\t\treturn navigator.userAgent\n\t}\n\n\twpm.getViewPort = function () {\n\t\treturn {\n\t\t\twidth : Math.max(document.documentElement.clientWidth || 0, window.innerWidth || 0),\n\t\t\theight: Math.max(document.documentElement.clientHeight || 0, window.innerHeight || 0),\n\t\t}\n\t}\n\n\t/*\n\t* Handle Cookie Management Platforms\n\t* */\n\n\tlet getComplianzCookies = function () {\n\n\t\tlet cmplz_statistics = wpm.getCookie(\"cmplz_statistics\")\n\t\tlet cmplz_marketing = wpm.getCookie(\"cmplz_marketing\")\n\t\tlet cmplz_consent_status = wpm.getCookie(\"cmplz_consent_status\") || wpm.getCookie(\"cmplz_banner-status\")\n\n\n\t\tif (cmplz_consent_status) {\n\t\t\treturn {\n\t\t\t\tanalytics : cmplz_statistics === \"allow\",\n\t\t\t\tads : cmplz_marketing === \"allow\",\n\t\t\t\tvisitorHasChosen: true,\n\t\t\t}\n\t\t} else {\n\t\t\treturn false\n\t\t}\n\t}\n\n\tlet getCookieLawInfoCookies = function () {\n\n\t\tlet analyticsCookie = wpm.getCookie(\"cookielawinfo-checkbox-analytics\") || wpm.getCookie(\"cookielawinfo-checkbox-analytiques\")\n\t\tlet adsCookie = wpm.getCookie(\"cookielawinfo-checkbox-advertisement\") || wpm.getCookie(\"cookielawinfo-checkbox-publicite\")\n\t\tlet visitorHasChosen = wpm.getCookie(\"CookieLawInfoConsent\")\n\n\t\tif (analyticsCookie || adsCookie) {\n\n\t\t\treturn {\n\t\t\t\tanalytics : analyticsCookie === \"yes\",\n\t\t\t\tads : adsCookie === \"yes\",\n\t\t\t\tvisitorHasChosen: !!visitorHasChosen,\n\t\t\t}\n\t\t} else {\n\t\t\treturn false\n\t\t}\n\t}\n\n\n\tlet\n\t\twpmConsentValues = {}\n\twpmConsentValues.categories = {}\n\twpmConsentValues.pixels = []\n\twpmConsentValues.mode = \"category\"\n\twpmConsentValues.visitorHasChosen = false\n\n\twpm.getConsentValues = function () {\n\t\treturn wpmConsentValues\n\t}\n\n\twpm.setConsentValueCategories = function (analytics = false, ads = false) {\n\t\twpmConsentValues.categories.analytics = analytics\n\t\twpmConsentValues.categories.ads = ads\n\t}\n\n\twpm.updateConsentCookieValues = function (explicitConsent = false) {\n\n\t\t// ad_storage\n\t\t// analytics_storage\n\t\t// functionality_storage\n\t\t// personalization_storage\n\t\t// security_storage\n\n\t\t// console.log('exp cons: ' + explicitConsent)\n\n\t\tlet cookie\n\n\t\tif (cookie = wpm.getCookie(\"CookieConsent\")) {\n\t\t\t// Cookiebot\n\t\t\t// https://wordpress.org/plugins/cookiebot/\n\t\t\tcookie = decodeURI(cookie)\n\n\t\t\t// console.log(cookie.indexOf('statistics:true'))\n\t\t\t// console.log(cookie.indexOf('marketing:true'))\n\n\t\t\twpmConsentValues.categories.analytics = cookie.indexOf(\"statistics:true\") >= 0\n\t\t\twpmConsentValues.categories.ads = cookie.indexOf(\"marketing:true\") >= 0\n\t\t\twpmConsentValues.visitorHasChosen = true\n\n\t\t} else if (cookie = wpm.getCookie(\"CookieScriptConsent\")) {\n\t\t\t// Cookie Script\n\t\t\t// https://wordpress.org/plugins/cookie-script-com/\n\n\t\t\tcookie = JSON.parse(cookie)\n\n\t\t\t// console.log(cookie)\n\t\t\t// console.log(cookie.action)\n\t\t\t// console.log('cat length: ' + cookie.categories.length)\n\t\t\t// console.log(cookie.categories.indexOf('performance'))\n\n\t\t\tif (cookie.action === \"reject\") {\n\t\t\t\twpmConsentValues.categories.analytics = false\n\t\t\t\twpmConsentValues.categories.ads = false\n\t\t\t} else if (cookie.categories.length === 2) {\n\t\t\t\twpmConsentValues.categories.analytics = true\n\t\t\t\twpmConsentValues.categories.ads = true\n\t\t\t} else {\n\t\t\t\twpmConsentValues.categories.analytics = cookie.categories.indexOf(\"performance\") >= 0\n\t\t\t\twpmConsentValues.categories.ads = cookie.categories.indexOf(\"targeting\") >= 0\n\t\t\t}\n\n\t\t\twpmConsentValues.visitorHasChosen = true\n\n\t\t\t// console.log(wpmConsentValues)\n\n\t\t} else if (cookie = wpm.getCookie(\"borlabs-cookie\")) {\n\t\t\t// Borlabs Cookie\n\t\t\t// https://borlabs.io/borlabs-cookie/\n\n\t\t\tcookie = decodeURI(cookie)\n\t\t\tcookie = JSON.parse(cookie)\n\n\t\t\twpmConsentValues.categories.analytics = !!cookie?.consents?.statistics\n\t\t\twpmConsentValues.categories.ads = !!cookie?.consents?.marketing\n\t\t\twpmConsentValues.visitorHasChosen = true\n\t\t\twpmConsentValues.pixels = [...cookie?.consents?.statistics || [], ...cookie?.consents?.marketing || []]\n\t\t\twpmConsentValues.mode = \"pixel\"\n\n\t\t} else if (cookie = getComplianzCookies()) {\n\t\t\t// Complianz Cookie\n\t\t\t// https://wordpress.org/plugins/complianz-gdpr/\n\n\t\t\t// console.log(cookie)\n\n\t\t\twpmConsentValues.categories.analytics = cookie.analytics === true\n\t\t\twpmConsentValues.categories.ads = cookie.ads === true\n\t\t\twpmConsentValues.visitorHasChosen = cookie.visitorHasChosen\n\n\t\t\t// console.log(wpmConsentValues)\n\n\t\t} else if (cookie = wpm.getCookie(\"cookie_notice_accepted\")) {\n\t\t\t// Cookie Compliance (free version)\n\t\t\t// https://wordpress.org/plugins/cookie-notice/\n\n\t\t\twpmConsentValues.categories.analytics = true\n\t\t\twpmConsentValues.categories.ads = true\n\t\t\twpmConsentValues.visitorHasChosen = true\n\n\t\t} else if (cookie = wpm.getCookie(\"hu-consent\")) {\n\t\t\t// Cookie Compliance (pro version)\n\t\t\t// https://wordpress.org/plugins/cookie-notice/\n\n\t\t\tcookie = JSON.parse(cookie)\n\n\t\t\twpmConsentValues.categories.analytics = !!cookie.categories[\"3\"]\n\t\t\twpmConsentValues.categories.ads = !!cookie.categories[\"4\"]\n\t\t\twpmConsentValues.visitorHasChosen = true\n\n\t\t} else if (cookie = getCookieLawInfoCookies()) {\n\t\t\t// CookieYes, GDPR Cookie Consent (Cookie Law Info)\n\t\t\t// https://wordpress.org/plugins/cookie-law-info/\n\n\t\t\twpmConsentValues.categories.analytics = cookie.analytics === true\n\t\t\twpmConsentValues.categories.ads = cookie.ads === true\n\t\t\twpmConsentValues.visitorHasChosen = cookie.visitorHasChosen === true\n\n\t\t} else if (cookie = wpm.getCookie(\"moove_gdpr_popup\")) {\n\t\t\t// GDPR Cookie Compliance Plugin by Moove Agency\n\t\t\t// https://wordpress.org/plugins/gdpr-cookie-compliance/\n\t\t\t// TODO write documentation on how to set up the plugin in order for this to work properly\n\n\t\t\tcookie = JSON.parse(cookie)\n\t\t\t// console.log('moove cookie thirdparty: ' + cookie.thirdparty)\n\t\t\t// console.log('moove cookie advanced: ' + cookie.advanced)\n\n\t\t\twpmConsentValues.categories.analytics = cookie.thirdparty === \"1\"\n\t\t\twpmConsentValues.categories.ads = cookie.advanced === \"1\"\n\t\t\twpmConsentValues.visitorHasChosen = true\n\n\t\t\t// console.log(wpmConsentValues)\n\n\t\t} else {\n\t\t\t// consentValues.categories.analytics = true\n\t\t\t// consentValues.categories.ads = true\n\n\t\t\twpmConsentValues.categories.analytics = !explicitConsent\n\t\t\twpmConsentValues.categories.ads = !explicitConsent\n\t\t}\n\t}\n\n\twpm.updateConsentCookieValues()\n\n\twpm.setConsentDefaultValuesToExplicit = function () {\n\t\twpmConsentValues.categories = {\n\t\t\tanalytics: false,\n\t\t\tads : false,\n\t\t}\n\t}\n\n\twpm.canIFire = function (category, pixelName) {\n\n\t\tlet canIFireMode\n\n\t\tif (\"category\" === wpmConsentValues.mode) {\n\t\t\tcanIFireMode = !!wpmConsentValues.categories[category]\n\t\t} else if (\"pixel\" === wpmConsentValues.mode) {\n\t\t\tcanIFireMode = wpmConsentValues.pixels.includes(pixelName)\n\t\t} else {\n\t\t\tconsole.error(\"Couldn't find a valid consent mode in wpmConsentValues\")\n\t\t\tcanIFireMode = false\n\t\t}\n\n\t\tif (canIFireMode) {\n\t\t\treturn true\n\t\t} else {\n\t\t\tif (true || wpm.urlHasParameter(\"debugConsentMode\")) {\n\t\t\t\twpm.logPreventedPixelLoading(pixelName, category)\n\t\t\t}\n\n\t\t\treturn false\n\t\t}\n\t}\n\n\twpm.logPreventedPixelLoading = function (pixelName, category) {\n\t\tif (wpmDataLayer?.shop?.cookie_consent_mgmt?.explicit_consent) {\n\t\t\tconsole.log(\"WooCommerce Pixel Manager: The \\\"\" + pixelName + \" (category: \" + category + \")\\\" pixel has not fired because you have not given consent for it yet. (WPM is in explicit consent mode.)\")\n\t\t} else {\n\t\t\tconsole.log(\"WooCommerce Pixel Manager: The \\\"\" + pixelName + \" (category: \" + category + \")\\\" pixel has not fired because you have removed consent for this pixel. (WPM is in implicit consent mode.)\")\n\t\t}\n\t}\n\n\t/**\n\t * Runs through each script in <head> and blocks / unblocks it according to the plugin settings\n\t * and user consent.\n\t */\n\n\t// https://stackoverflow.com/q/65453565/4688612\n\twpm.scriptTagObserver = new MutationObserver((mutations) => {\n\t\tmutations.forEach(({addedNodes}) => {\n\t\t\t[...addedNodes]\n\t\t\t\t.forEach(node => {\n\n\t\t\t\t\tif ($(node).data(\"wpm-cookie-category\")) {\n\n\t\t\t\t\t\t// console.log(node)\n\n\t\t\t\t\t\t// If the pixel category has been approved > unblock\n\t\t\t\t\t\t// If the pixel belongs to more than one category, then unblock if one of the categories has been approved\n\t\t\t\t\t\t// If no category has been approved, but the Google Consent Mode is active, then only unblock the Google scripts\n\n\t\t\t\t\t\tif (wpm.shouldScriptBeActive(node)) {\n\t\t\t\t\t\t\twpm.unblockScript(node)\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\twpm.blockScript(node)\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t})\n\t\t})\n\t})\n\n\twpm.scriptTagObserver.observe(document.head, {childList: true, subtree: true})\n\twindow.addEventListener(\"DOMContentLoaded\", () => wpm.scriptTagObserver.disconnect())\n\n\twpm.shouldScriptBeActive = function (node) {\n\n\t\tif (\n\t\t\twpmDataLayer.shop.cookie_consent_mgmt.explicit_consent ||\n\t\t\twpmConsentValues.visitorHasChosen\n\t\t) {\n\n\t\t\tif (wpmConsentValues.mode === \"category\" && $(node).data(\"wpm-cookie-category\").split(\",\").some(element => wpmConsentValues.categories[element])) {\n\t\t\t\treturn true\n\t\t\t} else if (wpmConsentValues.mode === \"pixel\" && wpmConsentValues.pixels.includes($(node).data(\"wpm-pixel-name\"))) {\n\t\t\t\treturn true\n\t\t\t} else if (wpmConsentValues.mode === \"pixel\" && $(node).data(\"wpm-pixel-name\") === \"google\" && [\"google-analytics\", \"google-ads\"].some(element => wpmConsentValues.pixels.includes(element))) {\n\t\t\t\treturn true\n\t\t\t} else if (wpmDataLayer?.pixels?.google?.consent_mode?.active && $(node).data(\"wpm-pixel-name\") === \"google\") {\n\t\t\t\treturn true\n\t\t\t} else {\n\t\t\t\treturn false\n\t\t\t}\n\t\t} else {\n\t\t\treturn true\n\t\t}\n\t}\n\n\n\twpm.unblockScript = function (scriptNode, removeAttach = false) {\n\n\t\tif (removeAttach) $(scriptNode).remove()\n\n\t\tlet wpmSrc = $(scriptNode).data(\"wpm-src\")\n\t\tif (wpmSrc) $(scriptNode).attr(\"src\", wpmSrc)\n\n\t\tscriptNode.type = \"text/javascript\"\n\n\t\tif (removeAttach) $(scriptNode).appendTo(\"head\")\n\n\t\tjQuery(document).trigger(\"wpmPreLoadPixels\", {})\n\t}\n\n\twpm.blockScript = function (scriptNode, removeAttach = false) {\n\n\t\tif (removeAttach) $(scriptNode).remove()\n\n\t\tif ($(scriptNode).attr(\"src\")) $(scriptNode).removeAttr(\"src\")\n\t\tscriptNode.type = \"blocked/javascript\"\n\n\t\tif (removeAttach) $(scriptNode).appendTo(\"head\")\n\t}\n\n\twpm.unblockAllScripts = function (analytics = true, ads = true) {\n\t\t// console.log('unblocking all scripts')\n\n\t\t$.each(\n\t\t\t$(\"script[type=\\\"blocked/javascript\\\"]\"), function (index, scriptNode) {\n\n\t\t\t\tif ($(scriptNode).data(\"wpm-cookie-category\").includes(\"analytics\") && analytics) {\n\t\t\t\t\twpm.unblockScript(scriptNode, true)\n\t\t\t\t} else if ($(scriptNode).data(\"wpm-cookie-category\").includes(\"ads\") && ads) {\n\t\t\t\t\twpm.unblockScript(scriptNode, true)\n\t\t\t\t}\n\t\t\t})\n\n\t\tjQuery(document).trigger(\"wpmPreLoadPixels\", {})\n\t}\n\n\twpm.unblockSelectedPixels = function () {\n\t\t$.each(\n\t\t\t$(\"script[type=\\\"blocked/javascript\\\"]\"), function (index, node) {\n\n\t\t\t\tif (wpmConsentValues.pixels.includes($(node).data(\"wpm-pixel-name\"))) {\n\t\t\t\t\twpm.unblockScript(node, true)\n\t\t\t\t} else if ($(node).data(\"wpm-pixel-name\") === \"google\" && [\"google-analytics\", \"google-ads\"].some(element => wpmConsentValues.pixels.includes(element))) {\n\t\t\t\t\twpm.unblockScript(node, true)\n\t\t\t\t}\n\t\t\t})\n\n\t\tjQuery(document).trigger(\"wpmPreLoadPixels\", {})\n\t}\n\n\n\t/**\n\t * Block or unblock scripts for each CMP immediately after cookie consent has been updated\n\t * by the visitor.\n\t */\n\n\t// Borlabs Cookie\n\t// If visitor accepts cookies in Borlabs Cookie unblock the scripts\n\twindow.addEventListener(\"borlabs-cookie-consent-saved\", function () {\n\n\t\twpm.updateConsentCookieValues()\n\n\t\tif (wpmConsentValues.mode === \"pixel\") {\n\n\t\t\twpm.unblockSelectedPixels()\n\t\t\twpm.updateGoogleConsentMode(wpmConsentValues.pixels.includes(\"google-analytics\"), wpmConsentValues.pixels.includes(\"google-ads\"))\n\t\t} else {\n\n\t\t\twpm.unblockAllScripts(wpmConsentValues.categories.analytics, wpmConsentValues.categories.ads)\n\t\t\twpm.updateGoogleConsentMode(wpmConsentValues.categories.analytics, wpmConsentValues.categories.ads)\n\t\t}\n\t})\n\n\t// Cookiebot\n\t// If visitor accepts cookies in Cookiebot unblock the scripts\n\t// https://www.cookiebot.com/en/developer/\n\twindow.addEventListener(\"CookiebotOnAccept\", function () {\n\t\tif (Cookiebot.consent.statistics) wpmConsentValues.categories.analytics = true\n\t\tif (Cookiebot.consent.marketing) wpmConsentValues.categories.ads = true\n\n\t\twpm.unblockAllScripts(wpmConsentValues.categories.analytics, wpmConsentValues.categories.ads)\n\t\twpm.updateGoogleConsentMode(wpmConsentValues.categories.analytics, wpmConsentValues.categories.ads)\n\n\t}, false)\n\n\t/**\n\t * Cookie Script\n\t * If visitor accepts cookies in Cookie Script unblock the scripts\n\t * https://support.cookie-script.com/article/20-custom-events\n\t */\n\twindow.addEventListener(\"CookieScriptAccept\", function (e) {\n\t\tif (e.detail.categories.includes(\"performance\")) wpmConsentValues.categories.analytics = true\n\t\tif (e.detail.categories.includes(\"targeting\")) wpmConsentValues.categories.ads = true\n\n\t\twpm.unblockAllScripts(wpmConsentValues.categories.analytics, wpmConsentValues.categories.ads)\n\t\twpm.updateGoogleConsentMode(wpmConsentValues.categories.analytics, wpmConsentValues.categories.ads)\n\t})\n\n\t/**\n\t * Cookie Script\n\t * If visitor accepts cookies in Cookie Script unblock the scripts\n\t * https://support.cookie-script.com/\n\t */\n\twindow.addEventListener(\"CookieScriptAcceptAll\", function () {\n\t\twpm.unblockAllScripts(true, true)\n\t\twpm.updateGoogleConsentMode(true, true)\n\t})\n\n\t// Complianz Cookie\n\t// If visitor accepts cookies in Complianz unblock the scripts\n\tdocument.addEventListener(\"cmplzStatusChange\", function () {\n\n\t\twpm.updateConsentCookieValues()\n\n\t\t// console.log(wpmConsentValues)\n\n\t\twpm.unblockAllScripts(wpmConsentValues.categories.analytics, wpmConsentValues.categories.ads)\n\t\twpm.updateGoogleConsentMode(wpmConsentValues.categories.analytics, wpmConsentValues.categories.ads)\n\t})\n\n\t// Cookie Compliance by hu-manity.co (free and pro)\n\t// If visitor accepts cookies in Cookie Notice by hu-manity.co unblock the scripts (free version)\n\t// https://wordpress.org/support/topic/events-on-consent-change/#post-15202792\n\tdocument.addEventListener(\"setCookieNotice\", function () {\n\n\t\twpm.updateConsentCookieValues()\n\n\t\t// console.log(wpmConsentValues)\n\n\t\twpm.unblockAllScripts(wpmConsentValues.categories.analytics, wpmConsentValues.categories.ads)\n\t\twpm.updateGoogleConsentMode(wpmConsentValues.categories.analytics, wpmConsentValues.categories.ads)\n\t})\n\n\t/**\n\t * Cookie Compliance by hu-manity.co (free and pro)\n\t * If visitor accepts cookies in Cookie Notice by hu-manity.co unblock the scripts (pro version)\n\t * https://wordpress.org/support/topic/events-on-consent-change/#post-15202792\n\t * Because Cookie Notice has no documented API or event that is being triggered on consent save or update\n\t * we have to solve this by using a mutation observer.\n\t *\n\t * @type {MutationObserver}\n\t */\n\n\twpm.huObserver = new MutationObserver(function (mutations) {\n\t\tmutations.forEach(({addedNodes}) => {\n\t\t\t[...addedNodes]\n\t\t\t\t.forEach(node => {\n\n\t\t\t\t\tif (node.id === \"hu\") {\n\n\t\t\t\t\t\tjQuery(\".hu-cookies-save\").on(\"click\", function () {\n\t\t\t\t\t\t\twpm.updateConsentCookieValues()\n\t\t\t\t\t\t\twpm.unblockAllScripts(wpmConsentValues.categories.analytics, wpmConsentValues.categories.ads)\n\t\t\t\t\t\t\twpm.updateGoogleConsentMode(wpmConsentValues.categories.analytics, wpmConsentValues.categories.ads)\n\t\t\t\t\t\t})\n\t\t\t\t\t}\n\t\t\t\t})\n\t\t})\n\t})\n\n\tif (window.hu) {\n\t\twpm.huObserver.observe(document.documentElement || document.body, {childList: true, subtree: true})\n\t}\n\n\twpm.version = function () {\n\t\tconsole.log(wpmDataLayer.version)\n\t}\n\n\t// https://api.jquery.com/jquery.getscript/\n\twpm.loadScriptAndCacheIt = function (url, options) {\n\n\t\t// Allow user to set any option except for dataType, cache, and url\n\t\toptions = jQuery.extend(options || {}, {\n\t\t\tdataType: \"script\",\n\t\t\tcache : true,\n\t\t\turl : url,\n\t\t})\n\n\t\t// Use $.ajax() since it is more flexible than $.getScript\n\t\t// Return the jqXHR object so we can chain callbacks\n\t\treturn jQuery.ajax(options)\n\t}\n\n\twpm.getOrderItemPrice = function (orderItem) {\n\t\treturn (orderItem.total + orderItem.total_tax) / orderItem.quantity\n\t}\n\n\twpm.hasLoginEventFired = function () {\n\t\tlet data = wpm.getWpmSessionData()\n\t\treturn data?.loginEventFired\n\t}\n\n\twpm.setLoginEventFired = function () {\n\t\tlet data = wpm.getWpmSessionData()\n\t\tdata[\"loginEventFired\"] = true\n\t\twpm.setWpmSessionData(data)\n\t}\n\n\twpm.wpmDataLayerExists = function () {\n\t\treturn new Promise(function (resolve) {\n\t\t\t(function waitForVar() {\n\t\t\t\tif (typeof wpmDataLayer !== \"undefined\") return resolve()\n\t\t\t\tsetTimeout(waitForVar, 50)\n\t\t\t})()\n\t\t})\n\t}\n\n\twpm.pageLoaded = function () {\n\t\treturn new Promise(function (resolve) {\n\t\t\t(function waitForVar() {\n\t\t\t\tif (\"complete\" === document.readyState) return resolve()\n\t\t\t\tsetTimeout(waitForVar, 50)\n\t\t\t})()\n\t\t})\n\t}\n\n\twpm.pageReady = function () {\n\t\treturn new Promise(function (resolve) {\n\t\t\t(function waitForVar() {\n\t\t\t\tif (\"interactive\" === document.readyState || \"complete\" === document.readyState) return resolve()\n\t\t\t\tsetTimeout(waitForVar, 50)\n\t\t\t})()\n\t\t})\n\t}\n\n\twpm.isMiniCartActive = function () {\n\t\tif (window.sessionStorage) {\n\t\t\tfor (const [key, value] of Object.entries(window.sessionStorage)) {\n\t\t\t\tif (key.includes(\"wc_fragments\")) {\n\t\t\t\t\treturn true\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn false\n\t\t} else {\n\t\t\treturn false\n\t\t}\n\t}\n\n\twpm.doesWooCommerceCartExist = function () {\n\t\treturn document.cookie.includes(\"woocommerce_items_in_cart\")\n\t}\n\n\twpm.urlHasParameter = function (parameter) {\n\t\tlet urlParams = new URLSearchParams(window.location.search)\n\t\treturn urlParams.has(parameter)\n\t}\n\n\t// wpm['load'] = {\n\t// base: true\n\t// };\n\n\twindow[\"wpmLoaded\"] = {}\n\n\t// return {\n\t// writeOrderIdToStorage : writeOrderIdToStorage,\n\t// isOrderIdStored : isOrderIdStored,\n\t// isEmail : isEmail,\n\t// removeProductFromCart : removeProductFromCart,\n\t// getViewItemProducts : getViewItemProducts,\n\t// addProductToCart : addProductToCart,\n\t// getCartItemsFromBackEnd: getCartItemsFromBackEnd,\n\t// fireCheckoutOption : fireCheckoutOption,\n\t// getCartItems : getCartItems\n\t// }\n\n}(window.wpm = window.wpm || {}, jQuery))\n\n\n/**\n * Run when page is ready\n * */\n\nwpm.pageReady().then(function () {\n\n\n\t/**\n\t * Run as soon as wpm namespace is loaded\n\t */\n\n\twpm.wpmDataLayerExists()\n\t\t.then(function () {\n\t\t\t// watch for products visible in viewport\n\t\t\twpm.startIntersectionObserverToWatch()\n\n\t\t\t// watch for lazy loaded products\n\t\t\twpm.startProductsMutationObserverToWatch()\n\t\t})\n\n\t// let products = jQuery(\".products, .product\")\n\n\n\t// remove_from_cart event\n\tjQuery(document).on(\"click\", \".remove_from_cart_button, .remove\", function () {\n\t\t// jQuery('.remove_from_cart_button, .remove').on('click', function (e) {\n\n\t\ttry {\n\t\t\t// console.log('remove_from_cart: ' + jQuery(this).data('product_id'));\n\n\t\t\tlet url = new URL(jQuery(this).attr(\"href\"))\n\t\t\tlet productId = wpm.getProductIdByCartItemKeyUrl(url)\n\n\t\t\twpm.removeProductFromCart(productId)\n\n\t\t} catch (e) {\n\t\t\tconsole.error(e)\n\t\t}\n\t})\n\n\n\t// add_to_cart event\n\tjQuery(document).on(\"click\", \".add_to_cart_button:not(.product_type_variable), .ajax_add_to_cart, .single_add_to_cart_button\", function () {\n\t\t// jQuery('.add_to_cart_button:not(.product_type_variable), .ajax_add_to_cart, .js-ajax-add-to-cart, .single_add_to_cart_button, .btn_color-2').on('click', function (e) {\n\n\t\ttry {\n\t\t\t// console.log('add_to_cart');\n\n\t\t\tif (wpmDataLayer.shop.page_type === \"product\") {\n\n\t\t\t\t// first process related and upsell products\n\t\t\t\tif (typeof jQuery(this).attr(\"href\") !== \"undefined\" && jQuery(this).attr(\"href\").includes(\"add-to-cart\")) {\n\t\t\t\t\t// console.log('add-to-cart on upsell and related products');\n\t\t\t\t\tlet quantity = 1\n\t\t\t\t\tlet productId = jQuery(this).data(\"product_id\")\n\t\t\t\t\t// console.log('productId: ' + productId);\n\t\t\t\t\twpm.addProductToCart(productId, quantity)\n\t\t\t\t} else {\n\n\t\t\t\t\tif (wpmDataLayer.shop.product_type === \"simple\") {\n\n\t\t\t\t\t\t// console.log('test');\n\t\t\t\t\t\tlet quantity = Number(jQuery(\".input-text.qty\").val())\n\n\t\t\t\t\t\tif (!quantity && quantity !== 0) quantity = 1\n\n\t\t\t\t\t\tlet productId = jQuery(this).val()\n\n\t\t\t\t\t\t// console.log('productId: ' + productId);\n\t\t\t\t\t\t// console.log('quantity: ' + quantity);\n\n\t\t\t\t\t\twpm.addProductToCart(productId, quantity)\n\n\t\t\t\t\t} else if (wpmDataLayer.shop.product_type === \"variable\") {\n\n\t\t\t\t\t\t// console.log('variable');\n\n\t\t\t\t\t\tlet quantity = Number(jQuery(\".input-text.qty\").val())\n\n\t\t\t\t\t\tif (!quantity && quantity !== 0) quantity = 1\n\n\t\t\t\t\t\tlet productId = jQuery(\"[name='variation_id']\").val()\n\n\t\t\t\t\t\t// console.log('productId: ' + productId);\n\t\t\t\t\t\t// console.log('quantity: ' + quantity);\n\n\t\t\t\t\t\twpm.addProductToCart(productId, quantity)\n\n\t\t\t\t\t} else if (wpmDataLayer.shop.product_type === \"grouped\") {\n\n\t\t\t\t\t\t// console.log('grouped');\n\n\t\t\t\t\t\tjQuery(\".woocommerce-grouped-product-list-item\").each(function () {\n\n\t\t\t\t\t\t\tlet quantity = Number(jQuery(this).find(\".input-text.qty\").val())\n\n\t\t\t\t\t\t\tif (!quantity && quantity !== 0) quantity = 1\n\n\t\t\t\t\t\t\tlet classes = jQuery(this).attr(\"class\")\n\t\t\t\t\t\t\tlet productId = wpm.getPostIdFromString(classes)\n\n\t\t\t\t\t\t\t// console.log('productId: ' + productId);\n\t\t\t\t\t\t\t// console.log('quantity: ' + quantity);\n\n\t\t\t\t\t\t\twpm.addProductToCart(productId, quantity)\n\t\t\t\t\t\t})\n\t\t\t\t\t} else if (wpmDataLayer.shop.product_type === \"bundle\") {\n\n\t\t\t\t\t\t// console.log('bundle');\n\n\t\t\t\t\t\tlet quantity = Number(jQuery(\".input-text.qty\").val())\n\n\t\t\t\t\t\tif (!quantity && quantity !== 0) quantity = 1\n\n\t\t\t\t\t\tlet productId = jQuery(\"input[name=add-to-cart]\").val()\n\n\t\t\t\t\t\t// console.log('productId: ' + productId);\n\t\t\t\t\t\t// console.log('quantity: ' + quantity);\n\n\t\t\t\t\t\twpm.addProductToCart(productId, quantity)\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t} else {\n\n\t\t\t\t// console.log('non product page');\n\n\t\t\t\tlet quantity = 1\n\t\t\t\tlet productId = jQuery(this).data(\"product_id\")\n\t\t\t\t// console.log('productId: ' + productId);\n\t\t\t\twpm.addProductToCart(productId, quantity)\n\t\t\t}\n\t\t} catch (e) {\n\t\t\tconsole.error(e)\n\t\t}\n\t})\n\n\t// if someone clicks anywhere on a custom /?add-to-cart=123 link\n\t// trigger the add to cart event\n\t// body.one('click', function (e) {\n\t//\n\t// try {\n\t// if (jQuery(this)[0].URL) {\n\t//\n\t// let href = new URL(jQuery(this)[0].URL);\n\t// let searchParams = new URLSearchParams(href.search);\n\t//\n\t// if (searchParams.has('add-to-cart')) {\n\t// // console.log('non product page, /?add-to-cart=123 link');\n\t//\n\t// let productId = searchParams.get('add-to-cart');\n\t// wpm.addProductToCart(productId, 1);\n\t// }\n\t// }\n\t// } catch (e) {\n\t// console.error(e);\n\t// }\n\t// });\n\n\n\t/**\n\t * If someone clicks anywhere on a custom /?add-to-cart=123 link\n\t * trigger the add to cart event\n\t */\n\tjQuery(document).one(\"click\", \"a:not(.add_to_cart_button, .ajax_add_to_cart, .single_add_to_cart_button)\", function (event) {\n\t\t// jQuery('a:not(.add_to_cart_button, .ajax_add_to_cart, .single_add_to_cart_button)').one('click', function (event) {\n\n\t\ttry {\n\t\t\tif (jQuery(event.target).closest(\"a\").attr(\"href\")) {\n\n\t\t\t\tlet href = jQuery(event.target).closest(\"a\").attr(\"href\")\n\n\t\t\t\tif (href.includes(\"add-to-cart=\")) {\n\t\t\t\t\tlet matches = href.match(/(add-to-cart=)(\\d+)/)\n\t\t\t\t\t// console.log('pid: ' + matches[2])\n\t\t\t\t\tif (matches) wpm.addProductToCart(matches[2], 1)\n\t\t\t\t}\n\t\t\t}\n\t\t} catch (e) {\n\t\t\tconsole.error(e)\n\t\t}\n\t})\n\n\t// select_content GA UA event\n\t// select_item GA 4 event\n\t// jQuery(document).on('click', '.woocommerce-LoopProduct-link, .wc-block-grid__product, .product-small.box', function (e) {\n\tjQuery(document).on(\"click\", \".woocommerce-LoopProduct-link, .wc-block-grid__product, .product, .product-small, .type-product\", function () {\n\t\t// jQuery('.woocommerce-LoopProduct-link, .wc-block-grid__product, .product, .product-small, .type-product').on('click', function (e) {\n\n\t\ttry {\n\n\t\t\t/**\n\t\t\t *\n\t\t\t * On some pages the event fires multiple times, and on product pages\n\t\t\t * even on page load. Using e.stopPropagation helps to prevent this,\n\t\t\t * but I dont know why. We don't even have to use this, since only a real\n\t\t\t * product click yields a valid productId. So we filter the invalid click\n\t\t\t * events out later down the code. I'll keep it that way because this is\n\t\t\t * the most compatible way across shops.\n\t\t\t * e.stopPropagation();\n\t\t\t * */\n\n\t\t\t\t// console.log('select_content and select_item');\n\n\t\t\tlet productId = jQuery(this).nextAll(\".wpmProductId:first\").data(\"id\")\n\t\t\t// console.log('select_content and select_item: ' + productId);\n\n\n\t\t\t/**\n\t\t\t * On product pages, for some reason, the click event is triggered on the main product on page load.\n\t\t\t * In that case no ID is found. But we can discard it, since we only want to trigger the event on\n\t\t\t * related products, which are found below.\n\t\t\t */\n\n\t\t\tif (productId) {\n\n\t\t\t\t// console.log('select_content and select_item: ' + productId);\n\n\t\t\t\tproductId = getIdBasedOndVariationsOutputSetting(productId)\n\n\t\t\t\tif (!productId) throw Error(\"Wasn't able to retrieve a productId\")\n\n\t\t\t\t// console.log('prodid: ' + productId);\n\n\t\t\t\tif (wpmDataLayer.products && wpmDataLayer.products[productId]) {\n\n\t\t\t\t\tlet product = wpm.getProductDetailsFormattedForEvent(productId)\n\n\t\t\t\t\tjQuery(document).trigger(\"wpmSelectContentGaUa\", product)\n\t\t\t\t\tjQuery(document).trigger(\"wpmSelectItem\", product)\n\t\t\t\t}\n\t\t\t}\n\t\t} catch (e) {\n\t\t\tconsole.error(e)\n\t\t}\n\t})\n\n\t// begin_checkout event\n\tjQuery(document).one(\"click\", \".checkout-button, .cart-checkout-button, .button.checkout\", function () {\n\t\t// jQuery('.checkout-button, .cart-checkout-button, .button.checkout').one('click', function (e) {\n\t\t// console.log('begin_checkout');\n\n\t\tjQuery(document).trigger(\"wpmBeginCheckout\")\n\t})\n\n\n\t// checkout_progress event\n\t// track checkout option event: entered valid billing email\n\tjQuery(document).on(\"input\", \"#billing_email\", function () {\n\t\t// jQuery('#billing_email').on('input', function () {\n\n\t\tif (wpm.isEmail(jQuery(this).val())) {\n\t\t\t// wpm.fireCheckoutOption(2);\n\t\t\twpm.fireCheckoutProgress(2)\n\t\t\twpm.emailSelected = true\n\t\t}\n\t})\n\n\t// track checkout option event: purchase click\n\tjQuery(document).on(\"click\", \".wc_payment_methods\", function () {\n\t\t// jQuery('.wc_payment_methods').on('click', function () {\n\n\t\tif (false === wpm.paymentMethodSelected) {\n\t\t\twpm.fireCheckoutProgress(3)\n\t\t}\n\n\t\twpm.fireCheckoutOption(3, jQuery(\"input[name='payment_method']:checked\").val())\n\t\twpm.paymentMethodSelected = true\n\t})\n\n\t// track checkout option event: purchase click\n\tjQuery(document).one(\"click\", \"#place_order\", function () {\n\t\t// jQuery('#place_order').one('click', function () {\n\n\t\tif (false === wpm.emailSelected) {\n\t\t\twpm.fireCheckoutProgress(2)\n\t\t}\n\n\t\tif (false === wpm.paymentMethodSelected) {\n\t\t\twpm.fireCheckoutProgress(3)\n\t\t\twpm.fireCheckoutOption(3, jQuery(\"input[name='payment_method']:checked\").val())\n\t\t}\n\n\t\twpm.fireCheckoutProgress(4)\n\t})\n\n\t// update cart event\n\tjQuery(document).on(\"click\", \"[name='update_cart']\", function () {\n\t\t// jQuery(\"[name='update_cart']\").on('click', function (e) {\n\n\t\ttry {\n\t\t\tjQuery(\".cart_item\").each(function () {\n\n\t\t\t\t// let productId = jQuery(this).find('[data-product_id]').data('product_id');\n\n\t\t\t\tlet url = new URL(jQuery(this).find(\".product-remove\").find(\"a\").attr(\"href\"))\n\t\t\t\tlet productId = wpm.getProductIdByCartItemKeyUrl(url)\n\n\n\t\t\t\tlet quantity = jQuery(this).find(\".qty\").val()\n\n\t\t\t\tif (quantity === 0) {\n\t\t\t\t\twpm.removeProductFromCart(productId)\n\t\t\t\t} else if (quantity < wpmDataLayer.cart[productId].quantity) {\n\t\t\t\t\twpm.removeProductFromCart(productId, wpmDataLayer.cart[productId].quantity - quantity)\n\t\t\t\t} else if (quantity > wpmDataLayer.cart[productId].quantity) {\n\t\t\t\t\twpm.addProductToCart(productId, quantity - wpmDataLayer.cart[productId].quantity)\n\t\t\t\t}\n\t\t\t})\n\t\t} catch (e) {\n\t\t\tconsole.error(e)\n\t\t\twpm.getCartItemsFromBackend()\n\t\t}\n\t})\n\n\n\t// add_to_wishlist\n\tjQuery(document).on(\"click\", \".add_to_wishlist, .wl-add-to\", function () {\n\t\t// jQuery('.add_to_wishlist, .wl-add-to').on('click', function () {\n\n\t\ttry {\n\t\t\t// console.log('add_to_wishlist');\n\t\t\t// console.log('this:' + jQuery(this).data('product-id'));\n\n\t\t\tlet productId\n\n\t\t\tif (jQuery(this).data(\"productid\")) { // for the WooCommerce wishlist plugin\n\t\t\t\tproductId = jQuery(this).data(\"productid\")\n\t\t\t} else if (jQuery(this).data(\"product-id\")) { // for the YITH wishlist plugin\n\t\t\t\tproductId = jQuery(this).data(\"product-id\")\n\t\t\t}\n\n\t\t\tif (!productId) throw Error(\"Wasn't able to retrieve a productId\")\n\n\t\t\tlet product = wpm.getProductDetailsFormattedForEvent(productId)\n\n\t\t\t// console.log('add_to_wishlist');\n\t\t\t// console.log(product);\n\n\t\t\tjQuery(document).trigger(\"wpmAddToWishlist\", product)\n\t\t} catch (e) {\n\t\t\tconsole.error(e)\n\t\t}\n\t})\n\n\tjQuery(document).on(\"updated_cart_totals\", function () {\n\t\tjQuery(document).trigger(\"wpmViewCart\")\n\t})\n\n\n\t/**\n\t * Called when the user selects all the required dropdowns / attributes\n\t *\n\t * Has to be hooked after document ready\n\t *\n\t * https://stackoverflow.com/a/27849208/4688612\n\t * https://stackoverflow.com/a/65065335/4688612\n\t */\n\tjQuery(\".single_variation_wrap\").on(\"show_variation\", function (event, variation) {\n\n\t\ttry {\n\t\t\tlet productId = getIdBasedOndVariationsOutputSetting(variation.variation_id)\n\n\t\t\tif (!productId) throw Error(\"Wasn't able to retrieve a productId\")\n\n\t\t\tif (wpmDataLayer.products && wpmDataLayer.products[productId]) {\n\n\t\t\t\t// console.log('productId: ' + productId);\n\n\t\t\t\tlet product = wpm.getProductDetailsFormattedForEvent(productId)\n\n\t\t\t\tjQuery(document).trigger(\"wpmViewItem\", product)\n\t\t\t}\n\t\t} catch (e) {\n\t\t\tconsole.error(e)\n\t\t}\n\t})\n\n\t/**\n\t * Called on variable products when no selection has been done yet\n\t * or when the visitor deselects his choice.\n\t *\n\t * Has to be hooked after document ready\n\t */\n\n\tjQuery(\".single_variation_wrap\").on(\"hide_variation\", function () {\n\n\t\ttry {\n\t\t\tlet classes = jQuery(\"body\").attr(\"class\")\n\t\t\tlet productId = classes.match(/(postid-)(\\d+)/)[2]\n\n\t\t\tif (!productId) throw Error(\"Wasn't able to retrieve a productId\")\n\n\t\t\t/**\n\t\t\t * If we have a variable product with no preset,\n\t\t\t * and variations output is enabled,\n\t\t\t * then we send a viewItem event with the first\n\t\t\t * variation we find for the parent.\n\t\t\t * If variations output is disabled,\n\t\t\t * we just send the parent ID.\n\t\t\t */\n\t\t\tif (\n\t\t\t\t\"variable\" === wpmDataLayer.shop.product_type &&\n\t\t\t\twpmDataLayer?.general?.variationsOutput\n\t\t\t) {\n\t\t\t\tfor (const [key, product] of Object.entries(wpmDataLayer.products)) {\n\t\t\t\t\tif (\"parentId\" in product) {\n\t\t\t\t\t\t// console.log('pid: ' + value.parentId)\n\t\t\t\t\t\tproductId = product.id\n\t\t\t\t\t\tbreak\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (wpmDataLayer.products && wpmDataLayer.products[productId]) {\n\n\t\t\t\t// console.log('productId: ' + productId);\n\n\t\t\t\tlet product = wpm.getProductDetailsFormattedForEvent(productId)\n\n\t\t\t\tjQuery(document).trigger(\"wpmViewItem\", product)\n\t\t\t}\n\n\t\t} catch (e) {\n\t\t\tconsole.error(e)\n\t\t}\n\t})\n\n}) // End document ready wrap\n\n/**\n * Set up wpm events\n */\n\n\n// populate the wpmDataLayer with the cart items\njQuery(window).on(\"wpmLoad\", function () {\n\n\ttry {\n\t\t// When a new session is initiated there are no items in the cart,\n\t\t// so we can save the call to get the cart items\n\t\tif (wpm.doesWooCommerceCartExist()) wpm.getCartItems()\n\n\t} catch (e) {\n\t\tconsole.error(e)\n\t}\n})\n\n// get all add-to-cart= products from backend\njQuery(window).on(\"wpmLoad\", function () {\n\n\twpmDataLayer.products = wpmDataLayer.products || {}\n\n\t// scan page for add-to-cart= links\n\tlet productIds = wpm.getAddToCartLinkProductIds()\n\n\twpm.getProductsFromBackend(productIds)\n})\n\n/**\n * Save the referrer into a cookie\n */\n\njQuery(window).on(\"wpmLoad\", function () {\n\n\t// can't use session storage as we can't read it from the server\n\tif (!wpm.getCookie(\"wpmReferrer\")) {\n\n\t\tif (document.referrer) {\n\t\t\tlet referrerUrl = new URL(document.referrer)\n\t\t\tlet referrerHostname = referrerUrl.hostname\n\n\t\t\tif (referrerHostname !== window.location.host) {\n\t\t\t\twpm.setCookie(\"wpmReferrer\", referrerHostname)\n\t\t\t} else {\n\t\t\t\twpm.setCookie(\"wpmReferrer\", \"\")\n\t\t\t}\n\n\t\t} else {\n\t\t\twpm.setCookie(\"wpmReferrer\", \"\")\n\t\t}\n\t}\n})\n\n\n/**\n * Create our own load event in order to better handle script flow execution when JS \"optimizers\" shuffle the code.\n */\n\njQuery(window).on(\"wpmLoad\", function () {\n\ttry {\n\t\tif (typeof wpmDataLayer != \"undefined\" && !wpmDataLayer?.wpmLoadFired) {\n\n\t\t\tjQuery(document).trigger(\"wpmLoadAlways\")\n\n\t\t\tif (\"product\" === wpmDataLayer.shop.page_type && wpmDataLayer.shop.product_type !== \"variable\" && wpm.getMainProductIdFromProductPage()) {\n\n\t\t\t\tlet product = wpm.getProductDataForViewItemEvent(wpm.getMainProductIdFromProductPage())\n\t\t\t\tjQuery(document).trigger(\"wpmViewItem\", product)\n\n\t\t\t} else if (\"product_category\" === wpmDataLayer.shop.page_type) {\n\n\t\t\t\tjQuery(document).trigger(\"wpmCategory\")\n\n\t\t\t} else if (\"search\" === wpmDataLayer.shop.page_type) {\n\n\t\t\t\tjQuery(document).trigger(\"wpmSearch\")\n\n\t\t\t} else if (\"cart\" === wpmDataLayer.shop.page_type) {\n\n\t\t\t\tjQuery(document).trigger(\"wpmViewCart\")\n\n\t\t\t} else if (\"order_received_page\" === wpmDataLayer.shop.page_type && wpmDataLayer.order) {\n\n\t\t\t\tif (!wpm.isOrderIdStored(wpmDataLayer.order.id)) {\n\n\t\t\t\t\tjQuery(document).trigger(\"wpmOrderReceivedPage\")\n\t\t\t\t\twpm.writeOrderIdToStorage(wpmDataLayer.order.id)\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tjQuery(document).trigger(\"wpmEverywhereElse\")\n\t\t\t}\n\n\t\t\tif (wpmDataLayer?.user?.id && !wpm.hasLoginEventFired()) {\n\t\t\t\tjQuery(document).trigger(\"wpmLogin\")\n\t\t\t\twpm.setLoginEventFired()\n\t\t\t}\n\n\t\t\t// /**\n\t\t\t// * Load mini cart fragments into a wpm session storage key,\n\t\t\t// * after the document load event.\n\t\t\t// */\n\t\t\t// jQuery(document).ajaxSend(function (event, jqxhr, settings) {\n\t\t\t// \t// console.log('settings.url: ' + settings.url);\n\t\t\t//\n\t\t\t// \tif (settings.url.includes(\"get_refreshed_fragments\") && sessionStorage) {\n\t\t\t// \t\tif (!sessionStorage.getItem(\"wpmMiniCartActive\")) {\n\t\t\t// \t\t\tsessionStorage.setItem(\"wpmMiniCartActive\", JSON.stringify(true))\n\t\t\t// \t\t}\n\t\t\t// \t}\n\t\t\t// })\n\n\t\t\twpmDataLayer.wpmLoadFired = true\n\t\t}\n\n\t} catch (e) {\n\t\tconsole.error(e)\n\t}\n})\n\n// jQuery(window).on(\"load\", function () {\n// \tjQuery(document).trigger(\"wpmLoad\", {})\n// })\n\njQuery(window).on(\"wpmPreLoadPixels\", function () {\n\n\tif (wpmDataLayer?.shop?.cookie_consent_mgmt?.explicit_consent) {\n\t\twpm.updateConsentCookieValues(true)\n\t}\n\tjQuery(document).trigger(\"wpmLoadPixels\", {})\n})\n","// The module cache\nvar __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tvar cachedModule = __webpack_module_cache__[moduleId];\n\tif (cachedModule !== undefined) {\n\t\treturn cachedModule.exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\t// no module.id needed\n\t\t// no module.loaded needed\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId](module, module.exports, __webpack_require__);\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n","/**\n * Load all free scripts first\n */\n\nrequire(\"./wpm\")\n\n/**\n * Load all free scripts\n */\n\nrequire(\"./google\")\nrequire(\"./google-ga-ua\")\nrequire(\"./google-ga-4\")\nrequire(\"./google-ads\")\nrequire(\"./facebook\")\nrequire(\"./hotjar\")\nrequire(\"./google-optimize\")\n\n/**\n * Execute the wpm loader. It makes sure that the script flow gets exectuded correctly, no matter how JS \"optimizers\" shuffle the code.\n */\n\nrequire(\"./wpm-loader\")\n\n// console.log('WooCommerce Pixel Manager free version')\n\n\n"],"names":["wpm","$","undefined","fBUserData","loadFacebookPixel","wpmDataLayer","pixels","facebook","loaded","f","window","b","document","e","fbq","n","callMethod","apply","arguments","queue","push","_fbq","version","t","createElement","async","src","s","getElementsByTagName","parentNode","insertBefore","pixel_id","console","error","getRandomEventId","Math","random","toString","substring","getFbUserData","getFbUserDataFromBrowser","setFbUserData","fbp","getCookie","fbc","client_user_agent","navigator","userAgent","fbViewContent","product","eventId","content_type","content_name","name","content_ids","dyn_r_ids","dynamic_remarketing","id_type","currency","shop","value","price","eventID","jQuery","trigger","event_name","event_id","user_data","product_data","product_id","event_source_url","location","href","facebookContentIds","prodIds","key","item","Object","entries","order","items","general","variationsOutput","variation_id","String","products","id","on","canIFire","event","parseFloat","quantity","value_filtered","conversionIdentifiers","getGoogleAdsConversionIdentifiersWithLabel","google","ads","conversionIds","getGoogleAdsConversionIdentifiers","getGoogleAdsRegularOrderItems","orderItems","orderItem","getGoogleAdsDynamicRemarketingOrderItems","google_business_vertical","isEmptyObject","status","googleConfigConditionsMet","isVariable","send_events_with_parent_ids","gtagLoaded","then","gtag","send_to","data_basic","data_with_cart","transaction_id","number","new_customer","aw_merchant_id","discount","aw_feed_country","aw_feed_language","getGA4OrderItems","item_name","item_category","category","join","item_id","analytics","item_variant","variant_name","item_brand","brand","ga4","measurement_id","mp_active","affiliation","value_regular","tax","shipping","coupon","getGAUAOrderItems","list_position","variant","universal","property_id","load_google_optimize_pixel","optimize","loadScriptAndCacheIt","container_id","type","consent_mode","active","getConsentValues","mode","categories","includes","getVisitorConsentStatusAndUpdateGoogleConsentSettings","google_consent_settings","analytics_storage","ad_storage","updateGoogleConsentMode","cookie_consent_mgmt","explicit_consent","fireGtagGoogleAds","state","enhanced_conversions","phone_conversion_label","phone_conversion_number","keys","page_type","enhanced_conversion_data","fireGtagGoogleAnalyticsUA","parameters","fireGtagGoogleAnalyticsGA4","isGoogleActive","getGoogleGtagId","loadGoogle","done","script","textStatus","dataLayer","wait_for_update","region","ads_data_redaction","url_passthrough","linker","settings","Date","logPreventedPixelLoading","canGoogleLoad","Promise","resolve","reject","startTime","wait","setTimeout","load_hotjar_pixel","hotjar","h","o","hj","q","_hjSettings","hjid","site_id","hjsv","a","r","appendChild","wpmDataLayerExists","log","pro","pageLoaded","wpmDeduper","wpmRestSettings","checkCookie","emailSelected","paymentMethodSelected","useRestEndpoint","isSessionStorageAvailable","isRestEndpointAvailable","isBelowRestErrorThreshold","sessionStorage","getItem","JSON","parse","testEndpoint","url","protocol","host","cookieName","ajax","timeout","statusCode","response","setItem","stringify","isWpmRestEndpointAvailable","writeOrderIdToStorage","orderId","Storage","localStorage","ids","expiresDate","setDate","getDate","cookie","toUTCString","storeOrderIdOnServer","orderDeduplication","isOrderIdStored","isEmail","email","test","removeProductFromCart","productId","quantityToRemove","Error","getIdBasedOndVariationsOutputSetting","cart","getProductDetailsFormattedForEvent","isVariation","parentId","addProductToCart","getCartItemsFromBackend","getCartItems","saveCartObjectToDataLayer","data","action","dataType","ajax_url","success","cartItems","getProductsFromBackend","productIds","filter","hasOwnProperty","length","assign","cartObject","fireCheckoutOption","step","checkout_option","fireCheckoutProgress","getPostIdFromString","string","match","triggerViewItemList","getProductDataForViewItemEvent","getMainProductIdFromProductPage","indexOf","product_type","viewItemListTriggerTestMode","target","css","append","find","viewItemListTrigger","opacity","backgroundColor","getSearchTermFromUrl","URLSearchParams","search","get","io","ioTimeouts","observerCallback","observer","forEach","entry","elementId","next","isIntersecting","testMode","repeat","unobserve","clearTimeout","remove","allIoElementsToWatch","ioid","startIntersectionObserverToWatch","urlHasParameter","IntersectionObserver","threshold","map","i","elem","parent","hasClass","prev","this","closest","each","observe","startProductsMutationObserverToWatch","productsNode","parents","has","first","productsMutationObserver","attributes","childList","characterData","MutationObserver","mutations","mutation","newNodes","addedNodes","hasWpmProductIdElement","siblings","setCookie","cookieValue","expiryDays","d","setTime","getTime","expires","ca","decodeURIComponent","split","c","charAt","getWpmSessionData","setWpmSessionData","order_id","nonce","getProductIdByCartItemKeyUrl","cartItemKey","cartItemKeys","getAddToCartLinkProductIds","attr","matches","list_name","position","parentId_dyn_r_ids","setReferrerToCookie","referrer","getReferrerFromCookie","getClidFromBrowser","clidCookieId","clidId","gclid","dclid","getUserAgent","getViewPort","width","max","documentElement","clientWidth","innerWidth","height","clientHeight","innerHeight","getComplianzCookies","cmplz_statistics","cmplz_marketing","visitorHasChosen","getCookieLawInfoCookies","analyticsCookie","adsCookie","wpmConsentValues","setConsentValueCategories","updateConsentCookieValues","explicitConsent","decodeURI","consents","statistics","marketing","thirdparty","advanced","setConsentDefaultValuesToExplicit","pixelName","canIFireMode","scriptTagObserver","node","shouldScriptBeActive","unblockScript","blockScript","head","subtree","addEventListener","disconnect","some","element","scriptNode","removeAttach","wpmSrc","appendTo","removeAttr","unblockAllScripts","index","unblockSelectedPixels","Cookiebot","consent","detail","huObserver","hu","body","options","extend","cache","getOrderItemPrice","total","total_tax","hasLoginEventFired","loginEventFired","setLoginEventFired","waitForVar","readyState","pageReady","isMiniCartActive","doesWooCommerceCartExist","parameter","URL","Number","val","classes","one","nextAll","variation","referrerHostname","hostname","wpmLoadFired","user","__webpack_module_cache__","__webpack_require__","moduleId","cachedModule","exports","module","__webpack_modules__","require"],"sourceRoot":""}
js/public/wpm-public__premium_only.p1.min.js ADDED
@@ -0,0 +1,2 @@
 
 
1
+ (()=>{var e={785:()=>{!function(e,t,a){let o;e.loadFacebookPixel=function(){try{wpmDataLayer.pixels.facebook.loaded=!0,e=window,t=document,a="script",e.fbq||(o=e.fbq=function(){o.callMethod?o.callMethod.apply(o,arguments):o.queue.push(arguments)},e._fbq||(e._fbq=o),o.push=o,o.loaded=!0,o.version="2.0",o.queue=[],(r=t.createElement(a)).async=!0,r.src="https://connect.facebook.net/en_US/fbevents.js",(i=t.getElementsByTagName(a)[0]).parentNode.insertBefore(r,i)),fbq("init",wpmDataLayer.pixels.facebook.pixel_id),fbq("track","PageView")}catch(a){console.error(a)}var e,t,a,o,r,i},e.getRandomEventId=function(){return(Math.random()+1).toString(36).substring(2)},e.getFbUserData=function(){return o||e.getFbUserDataFromBrowser()},e.setFbUserData=function(){o=e.getFbUserDataFromBrowser()},e.getFbUserDataFromBrowser=function(){return{fbp:e.getCookie("_fbp"),fbc:e.getCookie("_fbc"),client_user_agent:navigator.userAgent}},e.fbViewContent=function(t){try{var a,o,r;if(null===(a=wpmDataLayer)||void 0===a||null===(o=a.pixels)||void 0===o||null===(r=o.facebook)||void 0===r||!r.loaded)return;let i=e.getRandomEventId();fbq("track","ViewContent",{content_type:"product",content_name:t.name,content_ids:t.dyn_r_ids[wpmDataLayer.pixels.facebook.dynamic_remarketing.id_type],currency:wpmDataLayer.shop.currency,value:t.price},{eventID:i}),t.currency=wpmDataLayer.shop.currency,jQuery(document).trigger("wpmFbCapiEvent",{event_name:"ViewContent",event_id:i,user_data:e.getFbUserData(),product_data:t,product_id:t.dyn_r_ids[wpmDataLayer.pixels.facebook.dynamic_remarketing.id_type],event_source_url:window.location.href})}catch(e){console.error(e)}},e.facebookContentIds=function(){let e=[];for(const[o,r]of Object.entries(wpmDataLayer.order.items)){var t,a;null!==(t=wpmDataLayer)&&void 0!==t&&null!==(a=t.general)&&void 0!==a&&a.variationsOutput&&0!==r.variation_id?e.push(String(wpmDataLayer.products[r.variation_id].dyn_r_ids[wpmDataLayer.pixels.facebook.dynamic_remarketing.id_type])):e.push(String(wpmDataLayer.products[r.id].dyn_r_ids[wpmDataLayer.pixels.facebook.dynamic_remarketing.id_type]))}return e}}(window.wpm=window.wpm||{},jQuery),jQuery(document).on("wpmLoadPixels",(function(){var e,t,a,o,r,i;null===(e=wpmDataLayer)||void 0===e||null===(t=e.pixels)||void 0===t||null===(a=t.facebook)||void 0===a||!a.pixel_id||null!==(o=wpmDataLayer)&&void 0!==o&&null!==(r=o.pixels)&&void 0!==r&&null!==(i=r.facebook)&&void 0!==i&&i.loaded||wpm.canIFire("ads","facebook-ads")&&wpm.loadFacebookPixel()})),jQuery(document).on("wpmAddToCart",(function(e,t){try{var a,o,r;if(null===(a=wpmDataLayer)||void 0===a||null===(o=a.pixels)||void 0===o||null===(r=o.facebook)||void 0===r||!r.loaded)return;let e=wpm.getRandomEventId();fbq("track","AddToCart",{content_type:"product",content_name:t.name,content_ids:t.dyn_r_ids[wpmDataLayer.pixels.facebook.dynamic_remarketing.id_type],value:parseFloat(t.quantity*t.price),currency:t.currency},{eventID:e}),t.currency=wpmDataLayer.shop.currency,jQuery(document).trigger("wpmFbCapiEvent",{event_name:"AddToCart",event_id:e,user_data:wpm.getFbUserData(),product_data:t,product_id:t.dyn_r_ids[wpmDataLayer.pixels.facebook.dynamic_remarketing.id_type],event_source_url:window.location.href})}catch(e){console.error(e)}})),jQuery(document).on("wpmBeginCheckout",(function(e){try{var t,a,o;if(null===(t=wpmDataLayer)||void 0===t||null===(a=t.pixels)||void 0===a||null===(o=a.facebook)||void 0===o||!o.loaded)return;let e=wpm.getRandomEventId();fbq("track","InitiateCheckout",{},{eventID:e}),jQuery(document).trigger("wpmFbCapiEvent",{event_name:"InitiateCheckout",event_id:e,user_data:wpm.getFbUserData(),event_source_url:window.location.href})}catch(e){console.error(e)}})),jQuery(document).on("wpmAddToWishlist",(function(e,t){try{var a,o,r;if(null===(a=wpmDataLayer)||void 0===a||null===(o=a.pixels)||void 0===o||null===(r=o.facebook)||void 0===r||!r.loaded)return;let e=wpm.getRandomEventId();fbq("track","AddToWishlist",{content_type:"product",content_name:t.name,content_ids:t.dyn_r_ids[wpmDataLayer.pixels.facebook.dynamic_remarketing.id_type],value:parseFloat(t.quantity*t.price),currency:t.currency},{eventID:e}),t.currency=wpmDataLayer.shop.currency,jQuery(document).trigger("wpmFbCapiEvent",{event_name:"AddToWishlist",event_id:e,user_data:wpm.getFbUserData(),product_data:t,product_id:t.dyn_r_ids[wpmDataLayer.pixels.facebook.dynamic_remarketing.id_type],event_source_url:window.location.href})}catch(e){console.error(e)}})),jQuery(document).on("wpmViewItem",(function(e,t){try{var a,o,r;if(null===(a=wpmDataLayer)||void 0===a||null===(o=a.pixels)||void 0===o||null===(r=o.facebook)||void 0===r||!r.loaded)return;wpm.fbViewContent(t)}catch(e){console.error(e)}})),jQuery(document).on("wpmSearch",(function(){try{var e,t,a;if(null===(e=wpmDataLayer)||void 0===e||null===(t=e.pixels)||void 0===t||null===(a=t.facebook)||void 0===a||!a.loaded)return;let o=wpm.getRandomEventId();fbq("track","Search",{},{eventID:o}),jQuery(document).trigger("wpmFbCapiEvent",{event_name:"Search",event_id:o,user_data:wpm.getFbUserData(),event_source_url:window.location.href})}catch(e){console.error(e)}})),jQuery(document).on("wpmLoadAlways",(function(){try{var e,t,a;if(null===(e=wpmDataLayer)||void 0===e||null===(t=e.pixels)||void 0===t||null===(a=t.facebook)||void 0===a||!a.loaded)return;wpm.setFbUserData()}catch(e){console.error(e)}})),jQuery(document).on("wpmOrderReceivedPage",(function(){try{var e,t,a;if(null===(e=wpmDataLayer)||void 0===e||null===(t=e.pixels)||void 0===t||null===(a=t.facebook)||void 0===a||!a.loaded)return;fbq("track","Purchase",{content_type:"product",value:wpmDataLayer.order.value_filtered,currency:wpmDataLayer.order.currency,content_ids:wpm.facebookContentIds()},{eventID:wpmDataLayer.order.id})}catch(e){console.error(e)}}))},317:()=>{!function(e,t,a){e.setFacebookIdentifiersOnServer=function(){try{let t={action:"wpm_facebook_set_session_identifiers",nonce:e.nonce,fbp:e.getCookie("_fbp"),fbc:e.getCookie("_fbc")};if(t.fbp&&window.sessionStorage&&window.sessionStorage.getItem("wpm_fb_session_id_"+t.fbp+"_set"))return;jQuery.ajax({type:"post",dataType:"json",url:e.ajax_url,data:t,success:function(e){window.sessionStorage&&!0===e.success&&window.sessionStorage.setItem("wpm_fb_session_id_"+t.fbp+"_set",JSON.stringify(!0))},error:function(e){}})}catch(e){console.error(e)}}}(window.wpm=window.wpm||{},jQuery),jQuery(document).on("wpmAddToWishlist",(function(e,t){try{var a,o,r;if(null===(a=wpmDataLayer)||void 0===a||null===(o=a.pixels)||void 0===o||null===(r=o.facebook)||void 0===r||!r.loaded)return;fbq("track","AddToWishlist",{content_name:t.name,content_category:t.category,content_ids:t.dyn_r_ids[wpmDataLayer.pixels.facebook.dynamic_remarketing.id_type],currency:t.currency,value:t.price})}catch(e){console.error(e)}})),jQuery(document).on("wpmFbCapiEvent",(function(e,t){try{if(!wpmDataLayer.pixels.facebook.capi)return;let e={action:"wpm_facebook_capi_event",data:t,nonce:wpm.nonce};jQuery.ajax({type:"post",dataType:"json",url:wpm.ajax_url,data:e,success:function(e){},error:function(e){}})}catch(e){console.error(e)}})),jQuery(window).on("wpmLoadAlways",(function(){try{var e,t,a;null!==(e=wpmDataLayer)&&void 0!==e&&null!==(t=e.pixels)&&void 0!==t&&null!==(a=t.facebook)&&void 0!==a&&a.pixel_id&&wpmDataLayer.pixels.facebook.capi&&["cart","checkout"].indexOf(wpmDataLayer.shop.page_type)>=0&&wpm.setFacebookIdentifiersOnServer()}catch(e){console.error(e)}}))},234:()=>{!function(e,t,a){let o=[];e.getGoogleAdsConversionIdentifiersWithLabel=function(){for(const[e,t]of Object.entries(wpmDataLayer.pixels.google.ads.conversionIds))o.push(e+"/"+t);return o},e.getGoogleAdsConversionIdentifiers=function(){let e=[];for(const[t,a]of Object.entries(wpmDataLayer.pixels.google.ads.conversionIds))e.push(t);return e},e.getGoogleAdsRegularOrderItems=function(){let e=[];for(const[o,r]of Object.entries(wpmDataLayer.order.items)){var t,a;let o;o={quantity:r.quantity,price:r.price},null!==(t=wpmDataLayer)&&void 0!==t&&null!==(a=t.general)&&void 0!==a&&a.variationsOutput&&0!==r.variation_id?(o.id=String(wpmDataLayer.products[r.variation_id].dyn_r_ids[wpmDataLayer.pixels.google.ads.dynamic_remarketing.id_type]),e.push(o)):(o.id=String(wpmDataLayer.products[r.id].dyn_r_ids[wpmDataLayer.pixels.google.ads.dynamic_remarketing.id_type]),e.push(o))}return e},e.getGoogleAdsDynamicRemarketingOrderItems=function(){let e=[];for(const[o,r]of Object.entries(wpmDataLayer.order.items)){var t,a;let o;o={quantity:r.quantity,price:r.price,google_business_vertical:wpmDataLayer.pixels.google.ads.google_business_vertical},null!==(t=wpmDataLayer)&&void 0!==t&&null!==(a=t.general)&&void 0!==a&&a.variationsOutput&&0!==r.variation_id?(o.id=String(wpmDataLayer.products[r.variation_id].dyn_r_ids[wpmDataLayer.pixels.google.ads.dynamic_remarketing.id_type]),e.push(o)):(o.id=String(wpmDataLayer.products[r.id].dyn_r_ids[wpmDataLayer.pixels.google.ads.dynamic_remarketing.id_type]),e.push(o))}return e}}(window.wpm=window.wpm||{},jQuery),jQuery(document).on("wpmViewItemList",(function(e,t){try{var a,o,r,i,n,l,d,s,c,u,p;if(jQuery.isEmptyObject(null===(a=wpmDataLayer)||void 0===a||null===(o=a.pixels)||void 0===o||null===(r=o.google)||void 0===r||null===(i=r.ads)||void 0===i?void 0:i.conversionIds))return;if(null===(n=wpmDataLayer)||void 0===n||null===(l=n.pixels)||void 0===l||null===(d=l.google)||void 0===d||null===(s=d.ads)||void 0===s||null===(c=s.dynamic_remarketing)||void 0===c||!c.status)return;if(!wpm.googleConfigConditionsMet("ads"))return;if(null!==(u=wpmDataLayer)&&void 0!==u&&null!==(p=u.general)&&void 0!==p&&p.variationsOutput&&t.isVariable&&!1===wpmDataLayer.pixels.google.ads.dynamic_remarketing.send_events_with_parent_ids)return;if(!t)return;wpm.gtagLoaded().then((function(){gtag("event","view_item_list",{send_to:wpm.getGoogleAdsConversionIdentifiers(),items:[{id:t.dyn_r_ids[wpmDataLayer.pixels.google.ads.dynamic_remarketing.id_type],google_business_vertical:wpmDataLayer.pixels.google.ads.google_business_vertical}]})}))}catch(e){console.error(e)}})),jQuery(document).on("wpmAddToCart",(function(e,t){try{var a,o,r,i,n,l,d,s,c;if(jQuery.isEmptyObject(null===(a=wpmDataLayer)||void 0===a||null===(o=a.pixels)||void 0===o||null===(r=o.google)||void 0===r||null===(i=r.ads)||void 0===i?void 0:i.conversionIds))return;if(null===(n=wpmDataLayer)||void 0===n||null===(l=n.pixels)||void 0===l||null===(d=l.google)||void 0===d||null===(s=d.ads)||void 0===s||null===(c=s.dynamic_remarketing)||void 0===c||!c.status)return;if(!wpm.googleConfigConditionsMet("ads"))return;wpm.gtagLoaded().then((function(){gtag("event","add_to_cart",{send_to:wpm.getGoogleAdsConversionIdentifiers(),value:t.quantity*t.price,items:[{id:t.dyn_r_ids[wpmDataLayer.pixels.google.ads.dynamic_remarketing.id_type],quantity:t.quantity,price:t.price,google_business_vertical:wpmDataLayer.pixels.google.ads.google_business_vertical}]})}))}catch(e){console.error(e)}})),jQuery(document).on("wpmViewItem",(function(e,t){try{var a,o,r,i,n,l,d,s,c;if(jQuery.isEmptyObject(null===(a=wpmDataLayer)||void 0===a||null===(o=a.pixels)||void 0===o||null===(r=o.google)||void 0===r||null===(i=r.ads)||void 0===i?void 0:i.conversionIds))return;if(null===(n=wpmDataLayer)||void 0===n||null===(l=n.pixels)||void 0===l||null===(d=l.google)||void 0===d||null===(s=d.ads)||void 0===s||null===(c=s.dynamic_remarketing)||void 0===c||!c.status)return;if(!wpm.googleConfigConditionsMet("ads"))return;wpm.gtagLoaded().then((function(){gtag("event","view_item",{send_to:wpm.getGoogleAdsConversionIdentifiers(),value:(t.quantity?t.quantity:1)*t.price,items:[{id:t.dyn_r_ids[wpmDataLayer.pixels.google.ads.dynamic_remarketing.id_type],quantity:t.quantity?t.quantity:1,price:t.price,google_business_vertical:wpmDataLayer.pixels.google.ads.google_business_vertical}]})}))}catch(e){console.error(e)}})),jQuery(document).on("wpmSearch",(function(){try{var e,t,a,o,r,i,n,l,d;if(jQuery.isEmptyObject(null===(e=wpmDataLayer)||void 0===e||null===(t=e.pixels)||void 0===t||null===(a=t.google)||void 0===a||null===(o=a.ads)||void 0===o?void 0:o.conversionIds))return;if(null===(r=wpmDataLayer)||void 0===r||null===(i=r.pixels)||void 0===i||null===(n=i.google)||void 0===n||null===(l=n.ads)||void 0===l||null===(d=l.dynamic_remarketing)||void 0===d||!d.status)return;if(!wpm.googleConfigConditionsMet("ads"))return;let u=[];for(const[e,t]of Object.entries(wpmDataLayer.products)){var s,c;if(null!==(s=wpmDataLayer)&&void 0!==s&&null!==(c=s.general)&&void 0!==c&&c.variationsOutput&&t.isVariable&&!1===wpmDataLayer.pixels.google.ads.dynamic_remarketing.send_events_with_parent_ids)return;u.push({id:t.dyn_r_ids[wpmDataLayer.pixels.google.ads.dynamic_remarketing.id_type],google_business_vertical:wpmDataLayer.pixels.google.ads.google_business_vertical})}wpm.gtagLoaded().then((function(){gtag("event","view_search_results",{send_to:wpm.getGoogleAdsConversionIdentifiers(),items:u})}))}catch(e){console.error(e)}})),jQuery(document).on("wpmOrderReceivedPage",(function(){try{var e,t,a,o,r,i,n,l,d;if(jQuery.isEmptyObject(null===(e=wpmDataLayer)||void 0===e||null===(t=e.pixels)||void 0===t||null===(a=t.google)||void 0===a||null===(o=a.ads)||void 0===o?void 0:o.conversionIds))return;if(null===(r=wpmDataLayer)||void 0===r||null===(i=r.pixels)||void 0===i||null===(n=i.google)||void 0===n||null===(l=n.ads)||void 0===l||null===(d=l.dynamic_remarketing)||void 0===d||!d.status)return;if(!wpm.googleConfigConditionsMet("ads"))return;wpm.gtagLoaded().then((function(){gtag("event","purchase",{send_to:wpm.getGoogleAdsConversionIdentifiers(),value:wpmDataLayer.order.value_filtered,items:wpm.getGoogleAdsDynamicRemarketingOrderItems()})}))}catch(e){console.error(e)}})),jQuery(document).on("wpmLogin",(function(){try{var e,t,a,o,r,i,n,l,d;if(jQuery.isEmptyObject(null===(e=wpmDataLayer)||void 0===e||null===(t=e.pixels)||void 0===t||null===(a=t.google)||void 0===a||null===(o=a.ads)||void 0===o?void 0:o.conversionIds))return;if(null===(r=wpmDataLayer)||void 0===r||null===(i=r.pixels)||void 0===i||null===(n=i.google)||void 0===n||null===(l=n.ads)||void 0===l||null===(d=l.dynamic_remarketing)||void 0===d||!d.status)return;if(!wpm.googleConfigConditionsMet("ads"))return;wpm.gtagLoaded().then((function(){gtag("event","login",{send_to:wpm.getGoogleAdsConversionIdentifiers()})}))}catch(e){console.error(e)}})),jQuery(document).on("wpmOrderReceivedPage",(function(){try{var e,t,a,o,r,i;if(jQuery.isEmptyObject(null===(e=wpmDataLayer)||void 0===e||null===(t=e.pixels)||void 0===t||null===(a=t.google)||void 0===a||null===(o=a.ads)||void 0===o?void 0:o.conversionIds))return;if(!wpm.googleConfigConditionsMet("ads"))return;let n={},l={};n={send_to:wpm.getGoogleAdsConversionIdentifiersWithLabel(),transaction_id:wpmDataLayer.order.number,value:wpmDataLayer.order.value_filtered,currency:wpmDataLayer.order.currency,new_customer:wpmDataLayer.order.new_customer},null!==(r=wpmDataLayer)&&void 0!==r&&null!==(i=r.order)&&void 0!==i&&i.aw_merchant_id&&(l={discount:wpmDataLayer.order.discount,aw_merchant_id:wpmDataLayer.order.aw_merchant_id,aw_feed_country:wpmDataLayer.order.aw_feed_country,aw_feed_language:wpmDataLayer.order.aw_feed_language,items:wpm.getGoogleAdsRegularOrderItems()}),wpm.gtagLoaded().then((function(){gtag("event","conversion",{...n,...l})}))}catch(e){console.error(e)}}))},403:()=>{window.wpm=window.wpm||{},jQuery},172:()=>{!function(e,t,a){e.getCartItemsGa4=function(){let t=[];for(const[a,o]of Object.entries(wpmDataLayer.cart)){let a={item_id:o.dyn_r_ids[wpmDataLayer.pixels.google.analytics.id_type],item_name:o.name,quantity:o.quantity,item_brand:o.brand,item_variant:o.variant,price:o.price,currency:wpmDataLayer.shop.currency};a=e.getFormattedGA4Categories(a,o.category),t.push(a)}return t}}(window.wpm=window.wpm||{},jQuery),jQuery(document).on("wpmViewItemList",(function(e,t){try{var a,o,r,i,n,l,d,s,c;if(null===(a=wpmDataLayer)||void 0===a||null===(o=a.pixels)||void 0===o||null===(r=o.google)||void 0===r||null===(i=r.analytics)||void 0===i||!i.eec)return;if(null===(n=wpmDataLayer)||void 0===n||null===(l=n.pixels)||void 0===l||null===(d=l.google)||void 0===d||null===(s=d.analytics)||void 0===s||null===(c=s.ga4)||void 0===c||!c.measurement_id)return;if(!wpm.googleConfigConditionsMet("analytics"))return;let e={item_id:t.dyn_r_ids[wpmDataLayer.pixels.google.analytics.id_type],item_name:t.name,index:t.list_position,item_list_name:wpmDataLayer.shop.list_name,item_list_id:wpmDataLayer.shop.list_id,item_brand:t.brand,item_variant:t.variant,price:t.price,currency:wpmDataLayer.shop.currency,quantity:t.quantity};e=wpm.getFormattedGA4Categories(e,t.category),wpm.gtagLoaded().then((function(){gtag("event","view_item_list",{send_to:wpmDataLayer.pixels.google.analytics.ga4.measurement_id,items:[e],item_list_name:wpmDataLayer.shop.list_name,item_list_id:wpmDataLayer.shop.list_id})}))}catch(e){console.error(e)}})),jQuery(document).on("wpmSelectItem",(function(e,t){try{var a,o,r,i,n,l,d,s,c;if(null===(a=wpmDataLayer)||void 0===a||null===(o=a.pixels)||void 0===o||null===(r=o.google)||void 0===r||null===(i=r.analytics)||void 0===i||!i.eec)return;if(null===(n=wpmDataLayer)||void 0===n||null===(l=n.pixels)||void 0===l||null===(d=l.google)||void 0===d||null===(s=d.analytics)||void 0===s||null===(c=s.ga4)||void 0===c||!c.measurement_id)return;if(!wpm.googleConfigConditionsMet("analytics"))return;let e={item_id:t.dyn_r_ids[wpmDataLayer.pixels.google.analytics.id_type],item_name:t.name,index:t.list_position,item_list_name:wpmDataLayer.shop.list_name,item_list_id:wpmDataLayer.shop.list_id,item_brand:t.brand,item_variant:t.variant,price:t.price,currency:wpmDataLayer.shop.currency,quantity:t.quantity};e=wpm.getFormattedGA4Categories(e,t.category),wpm.gtagLoaded().then((function(){gtag("event","select_item",{send_to:wpmDataLayer.pixels.google.analytics.ga4.measurement_id,items:[e]})}))}catch(e){console.error(e)}})),jQuery(document).on("wpmAddToCart",(function(e,t){try{var a,o,r,i,n,l,d,s,c;if(null===(a=wpmDataLayer)||void 0===a||null===(o=a.pixels)||void 0===o||null===(r=o.google)||void 0===r||null===(i=r.analytics)||void 0===i||!i.eec)return;if(null===(n=wpmDataLayer)||void 0===n||null===(l=n.pixels)||void 0===l||null===(d=l.google)||void 0===d||null===(s=d.analytics)||void 0===s||null===(c=s.ga4)||void 0===c||!c.measurement_id)return;if(!wpm.googleConfigConditionsMet("analytics"))return;let e={item_name:t.name,item_id:t.dyn_r_ids[wpmDataLayer.pixels.google.analytics.id_type],item_list_name:wpmDataLayer.shop.list_name,item_list_id:wpmDataLayer.shop.list_id,item_brand:t.brand,item_variant:t.variant,price:t.price,currency:wpmDataLayer.shop.currency,quantity:t.quantity};e=wpm.getFormattedGA4Categories(e,t.category),wpm.gtagLoaded().then((function(){gtag("event","add_to_cart",{send_to:wpmDataLayer.pixels.google.analytics.ga4.measurement_id,currency:wpmDataLayer.shop.currency,items:[e]})}))}catch(e){console.error(e)}})),jQuery(document).on("wpmViewItem",(function(e,t){try{var a,o,r,i,n,l,d,s,c;if(null===(a=wpmDataLayer)||void 0===a||null===(o=a.pixels)||void 0===o||null===(r=o.google)||void 0===r||null===(i=r.analytics)||void 0===i||!i.eec)return;if(null===(n=wpmDataLayer)||void 0===n||null===(l=n.pixels)||void 0===l||null===(d=l.google)||void 0===d||null===(s=d.analytics)||void 0===s||null===(c=s.ga4)||void 0===c||!c.measurement_id)return;if(!wpm.googleConfigConditionsMet("analytics"))return;let e={item_id:t.dyn_r_ids[wpmDataLayer.pixels.google.analytics.id_type],item_name:t.name,item_brand:t.brand,item_variant:t.variant,price:t.price,currency:wpmDataLayer.shop.currency,quantity:1,item_list_name:wpmDataLayer.shop.list_name,item_list_id:wpmDataLayer.shop.list_id};e=wpm.getFormattedGA4Categories(e,t.category),wpm.gtagLoaded().then((function(){gtag("event","view_item",{send_to:wpmDataLayer.pixels.google.analytics.ga4.measurement_id,currency:wpmDataLayer.shop.currency,items:[e]})}))}catch(e){console.error(e)}})),jQuery(document).on("wpmAddToWishlist",(function(e,t){try{var a,o,r,i,n,l,d,s,c;if(null===(a=wpmDataLayer)||void 0===a||null===(o=a.pixels)||void 0===o||null===(r=o.google)||void 0===r||null===(i=r.analytics)||void 0===i||!i.eec)return;if(null===(n=wpmDataLayer)||void 0===n||null===(l=n.pixels)||void 0===l||null===(d=l.google)||void 0===d||null===(s=d.analytics)||void 0===s||null===(c=s.ga4)||void 0===c||!c.measurement_id)return;if(!wpm.googleConfigConditionsMet("analytics"))return;let e={item_id:t.dyn_r_ids[wpmDataLayer.pixels.google.analytics.id_type],item_name:t.name,quantity:1,item_brand:t.brand,item_variant:t.variant,price:t.price,currency:wpmDataLayer.shop.currency};e=wpm.getFormattedGA4Categories(e,t.category),wpm.gtagLoaded().then((function(){gtag("event","add_to_wishlist",{send_to:wpmDataLayer.pixels.google.analytics.ga4.measurement_id,currency:wpmDataLayer.shop.currency,items:[e]})}))}catch(e){console.error(e)}})),jQuery(document).on("wpmRemoveFromCart",(function(e,t){try{var a,o,r,i,n,l,d,s,c;if(null===(a=wpmDataLayer)||void 0===a||null===(o=a.pixels)||void 0===o||null===(r=o.google)||void 0===r||null===(i=r.analytics)||void 0===i||!i.eec)return;if(null===(n=wpmDataLayer)||void 0===n||null===(l=n.pixels)||void 0===l||null===(d=l.google)||void 0===d||null===(s=d.analytics)||void 0===s||null===(c=s.ga4)||void 0===c||!c.measurement_id)return;if(!wpm.googleConfigConditionsMet("analytics"))return;let e={item_id:t.dyn_r_ids[wpmDataLayer.pixels.google.analytics.id_type],item_name:t.name,item_brand:t.brand,item_variant:t.variant,price:t.price,currency:wpmDataLayer.shop.currency,quantity:t.quantity};e=wpm.getFormattedGA4Categories(e,t.category),wpm.gtagLoaded().then((function(){gtag("event","remove_from_cart",{send_to:wpmDataLayer.pixels.google.analytics.ga4.measurement_id,currency:wpmDataLayer.shop.currency,items:[e]})}))}catch(e){console.error(e)}})),jQuery(document).on("wpmBeginCheckout",(function(e){try{var t,a,o,r,i,n,l,d,s;if(null===(t=wpmDataLayer)||void 0===t||null===(a=t.pixels)||void 0===a||null===(o=a.google)||void 0===o||null===(r=o.analytics)||void 0===r||!r.eec)return;if(null===(i=wpmDataLayer)||void 0===i||null===(n=i.pixels)||void 0===n||null===(l=n.google)||void 0===l||null===(d=l.analytics)||void 0===d||null===(s=d.ga4)||void 0===s||!s.measurement_id)return;if(!wpm.googleConfigConditionsMet("analytics"))return;wpm.gtagLoaded().then((function(){gtag("event","begin_checkout",{send_to:wpmDataLayer.pixels.google.analytics.ga4.measurement_id,currency:wpmDataLayer.shop.currency,items:wpm.getCartItemsGa4()})}))}catch(e){console.error(e)}})),jQuery(document).on("wpmViewCart",(function(e){try{var t,a,o,r,i,n,l,d,s;if(null===(t=wpmDataLayer)||void 0===t||null===(a=t.pixels)||void 0===a||null===(o=a.google)||void 0===o||null===(r=o.analytics)||void 0===r||!r.eec)return;if(null===(i=wpmDataLayer)||void 0===i||null===(n=i.pixels)||void 0===n||null===(l=n.google)||void 0===l||null===(d=l.analytics)||void 0===d||null===(s=d.ga4)||void 0===s||!s.measurement_id)return;if(!wpm.googleConfigConditionsMet("analytics"))return;if(jQuery.isEmptyObject(wpmDataLayer.cart))return;let e=[],c=null;for(const[t,a]of Object.entries(wpmDataLayer.cart)){let t={item_id:a.dyn_r_ids[wpmDataLayer.pixels.google.analytics.id_type],item_name:a.name,quantity:a.quantity,item_brand:a.brand,item_list_name:wpmDataLayer.shop.list_name,item_list_id:wpmDataLayer.shop.list_id,item_variant:a.variant,price:a.price,currency:wpmDataLayer.shop.currency};t=wpm.getFormattedGA4Categories(t,a.category),e.push(t),c+=a.quantity*a.price}wpm.gtagLoaded().then((function(){gtag("event","view_cart",{send_to:wpmDataLayer.pixels.google.analytics.ga4.measurement_id,currency:wpmDataLayer.shop.currency,value:c.toFixed(2),items:e})}))}catch(e){console.error(e)}})),jQuery(document).on("wpmSearch",(function(){try{var e,t,a,o,r,i,n,l,d;if(null===(e=wpmDataLayer)||void 0===e||null===(t=e.pixels)||void 0===t||null===(a=t.google)||void 0===a||null===(o=a.analytics)||void 0===o||!o.eec)return;if(null===(r=wpmDataLayer)||void 0===r||null===(i=r.pixels)||void 0===i||null===(n=i.google)||void 0===n||null===(l=n.analytics)||void 0===l||null===(d=l.ga4)||void 0===d||!d.measurement_id)return;if(!wpm.googleConfigConditionsMet("analytics"))return;let s=[];for(const[e,t]of Object.entries(wpmDataLayer.products)){let e={item_id:t.dyn_r_ids[wpmDataLayer.pixels.google.analytics.id_type],item_name:t.name,quantity:1,index:t.position,item_brand:t.brand,item_list_name:wpmDataLayer.shop.list_name,item_list_id:wpmDataLayer.shop.list_id,item_variant:t.variant,price:t.price,currency:wpmDataLayer.shop.currency};e=wpm.getFormattedGA4Categories(e,t.category),s.push(e)}wpm.gtagLoaded().then((function(){gtag("event","view_search_results",{send_to:wpmDataLayer.pixels.google.analytics.ga4.measurement_id,search_term:wpm.getSearchTermFromUrl(),items:s})}))}catch(e){console.error(e)}})),jQuery(document).on("wpmLogin",(function(){try{var e,t,a,o,r,i,n,l,d;if(null===(e=wpmDataLayer)||void 0===e||null===(t=e.pixels)||void 0===t||null===(a=t.google)||void 0===a||null===(o=a.analytics)||void 0===o||!o.eec)return;if(null===(r=wpmDataLayer)||void 0===r||null===(i=r.pixels)||void 0===i||null===(n=i.google)||void 0===n||null===(l=n.analytics)||void 0===l||null===(d=l.ga4)||void 0===d||!d.measurement_id)return;if(!wpm.googleConfigConditionsMet("analytics"))return;wpm.gtagLoaded().then((function(){gtag("event","login",{send_to:wpmDataLayer.pixels.google.analytics.ga4.measurement_id})}))}catch(e){console.error(e)}}))},464:()=>{!function(e,t,a){e.getGA4OrderItems=function(){let e=[];for(const[o,r]of Object.entries(wpmDataLayer.order.items)){var t,a;let o;o={quantity:r.quantity,price:r.price,item_name:r.name,currency:wpmDataLayer.order.currency,item_category:wpmDataLayer.products[r.id].category.join("/")},null!==(t=wpmDataLayer)&&void 0!==t&&null!==(a=t.general)&&void 0!==a&&a.variationsOutput&&0!==r.variation_id?(o.item_id=String(wpmDataLayer.products[r.variation_id].dyn_r_ids[wpmDataLayer.pixels.google.analytics.id_type]),o.item_variant=wpmDataLayer.products[r.variation_id].variant_name,o.item_brand=wpmDataLayer.products[r.variation_id].brand):(o.item_id=String(wpmDataLayer.products[r.id].dyn_r_ids[wpmDataLayer.pixels.google.analytics.id_type]),o.item_brand=wpmDataLayer.products[r.id].brand),e.push(o)}return e}}(window.wpm=window.wpm||{},jQuery),jQuery(document).on("wpmOrderReceivedPage",(function(){try{var e,t,a,o,r,i,n,l,d,s;if(null===(e=wpmDataLayer)||void 0===e||null===(t=e.pixels)||void 0===t||null===(a=t.google)||void 0===a||null===(o=a.analytics)||void 0===o||null===(r=o.ga4)||void 0===r||!r.measurement_id)return;if(null!==(i=wpmDataLayer)&&void 0!==i&&null!==(n=i.pixels)&&void 0!==n&&null!==(l=n.google)&&void 0!==l&&null!==(d=l.analytics)&&void 0!==d&&null!==(s=d.ga4)&&void 0!==s&&s.mp_active)return;if(!wpm.googleConfigConditionsMet("analytics"))return;wpm.gtagLoaded().then((function(){gtag("event","purchase",{send_to:[wpmDataLayer.pixels.google.analytics.ga4.measurement_id],transaction_id:wpmDataLayer.order.number,affiliation:wpmDataLayer.order.affiliation,currency:wpmDataLayer.order.currency,value:wpmDataLayer.order.value_regular,discount:wpmDataLayer.order.discount,tax:wpmDataLayer.order.tax,shipping:wpmDataLayer.order.shipping,coupon:wpmDataLayer.order.coupon,items:wpm.getGA4OrderItems()})}))}catch(e){console.error(e)}}))},271:()=>{!function(e,t,a){e.getCartItemsGaUa=function(){let e=[];for(const[t,a]of Object.entries(wpmDataLayer.cart))e.push({id:a.dyn_r_ids[wpmDataLayer.pixels.google.analytics.id_type],name:a.name,brand:a.brand,category:a.category.join(","),price:a.price,quantity:a.quantity,variant:a.variant});return e}}(window.wpm=window.wpm||{},jQuery),jQuery(document).on("wpmViewItemList",(function(e,t){try{var a,o,r,i,n,l,d,s,c;if(null===(a=wpmDataLayer)||void 0===a||null===(o=a.pixels)||void 0===o||null===(r=o.google)||void 0===r||null===(i=r.analytics)||void 0===i||!i.eec)return;if(null===(n=wpmDataLayer)||void 0===n||null===(l=n.pixels)||void 0===l||null===(d=l.google)||void 0===d||null===(s=d.analytics)||void 0===s||null===(c=s.universal)||void 0===c||!c.property_id)return;if(!wpm.googleConfigConditionsMet("analytics"))return;wpm.gtagLoaded().then((function(){gtag("event","view_item_list",{send_to:wpmDataLayer.pixels.google.analytics.universal.property_id,items:[{id:t.dyn_r_ids[wpmDataLayer.pixels.google.analytics.id_type],name:t.name,brand:t.brand,category:t.category.join(","),list_name:wpmDataLayer.shop.list_name,list_position:t.list_position,price:t.price,quantity:t.quantity,variant:t.variant}]})}))}catch(e){console.error(e)}})),jQuery(document).on("wpmSelectContentGaUa",(function(e,t){try{var a,o,r,i,n,l,d,s,c;if(null===(a=wpmDataLayer)||void 0===a||null===(o=a.pixels)||void 0===o||null===(r=o.google)||void 0===r||null===(i=r.analytics)||void 0===i||!i.eec)return;if(null===(n=wpmDataLayer)||void 0===n||null===(l=n.pixels)||void 0===l||null===(d=l.google)||void 0===d||null===(s=d.analytics)||void 0===s||null===(c=s.universal)||void 0===c||!c.property_id)return;if(!wpm.googleConfigConditionsMet("analytics"))return;wpm.gtagLoaded().then((function(){gtag("event","select_content",{send_to:wpmDataLayer.pixels.google.analytics.universal.property_id,content_type:"product",items:[{id:t.dyn_r_ids[wpmDataLayer.pixels.google.analytics.id_type],name:t.name,list_name:wpmDataLayer.shop.list_name,brand:t.brand,category:t.category.join(","),variant:t.variant,list_position:t.list_position,quantity:t.quantity,price:t.price}]})}))}catch(e){console.error(e)}})),jQuery(document).on("wpmAddToCart",(function(e,t){try{var a,o,r,i,n,l,d,s,c;if(null===(a=wpmDataLayer)||void 0===a||null===(o=a.pixels)||void 0===o||null===(r=o.google)||void 0===r||null===(i=r.analytics)||void 0===i||!i.eec)return;if(null===(n=wpmDataLayer)||void 0===n||null===(l=n.pixels)||void 0===l||null===(d=l.google)||void 0===d||null===(s=d.analytics)||void 0===s||null===(c=s.universal)||void 0===c||!c.property_id)return;if(!wpm.googleConfigConditionsMet("analytics"))return;wpm.gtagLoaded().then((function(){gtag("event","add_to_cart",{send_to:wpmDataLayer.pixels.google.analytics.universal.property_id,currency:wpmDataLayer.shop.currency,items:[{id:t.dyn_r_ids[wpmDataLayer.pixels.google.analytics.id_type],name:t.name,list_name:wpmDataLayer.shop.list_name,brand:t.brand,category:t.category.join(","),variant:t.variant,list_position:t.list_position,quantity:t.quantity,price:t.price}]})}))}catch(e){console.error(e)}})),jQuery(document).on("wpmViewItem",(function(e,t){try{var a,o,r,i,n,l,d,s,c;if(null===(a=wpmDataLayer)||void 0===a||null===(o=a.pixels)||void 0===o||null===(r=o.google)||void 0===r||null===(i=r.analytics)||void 0===i||!i.eec)return;if(null===(n=wpmDataLayer)||void 0===n||null===(l=n.pixels)||void 0===l||null===(d=l.google)||void 0===d||null===(s=d.analytics)||void 0===s||null===(c=s.universal)||void 0===c||!c.property_id)return;if(!wpm.googleConfigConditionsMet("analytics"))return;wpm.gtagLoaded().then((function(){gtag("event","view_item",{send_to:wpmDataLayer.pixels.google.analytics.universal.property_id,items:[{id:t.dyn_r_ids[wpmDataLayer.pixels.google.analytics.id_type],name:t.name,list_name:wpmDataLayer.shop.list_name,brand:t.brand,category:t.category.join(","),variant:t.variant,list_position:1,quantity:1,price:t.price}]})}))}catch(e){console.error(e)}})),jQuery(document).on("wpmAddToWishlist",(function(e,t){try{var a,o,r,i,n,l,d,s,c;if(null===(a=wpmDataLayer)||void 0===a||null===(o=a.pixels)||void 0===o||null===(r=o.google)||void 0===r||null===(i=r.analytics)||void 0===i||!i.eec)return;if(null===(n=wpmDataLayer)||void 0===n||null===(l=n.pixels)||void 0===l||null===(d=l.google)||void 0===d||null===(s=d.analytics)||void 0===s||null===(c=s.universal)||void 0===c||!c.property_id)return;if(!wpm.googleConfigConditionsMet("analytics"))return;wpm.gtagLoaded().then((function(){gtag("event","add_to_wishlist",{send_to:wpmDataLayer.pixels.google.analytics.universal.property_id,items:[{id:t.dyn_r_ids[wpmDataLayer.pixels.google.analytics.id_type],name:t.name,brand:t.brand,category:t.category.join(","),list_name:wpmDataLayer.shop.list_name,list_position:t.position,price:t.price,quantity:1,variant:t.variant}]})}))}catch(e){console.error(e)}})),jQuery(document).on("wpmRemoveFromCart",(function(e,t){try{var a,o,r,i,n,l,d,s,c;if(null===(a=wpmDataLayer)||void 0===a||null===(o=a.pixels)||void 0===o||null===(r=o.google)||void 0===r||null===(i=r.analytics)||void 0===i||!i.eec)return;if(null===(n=wpmDataLayer)||void 0===n||null===(l=n.pixels)||void 0===l||null===(d=l.google)||void 0===d||null===(s=d.analytics)||void 0===s||null===(c=s.universal)||void 0===c||!c.property_id)return;if(!wpm.googleConfigConditionsMet("analytics"))return;wpm.gtagLoaded().then((function(){gtag("event","remove_from_cart",{send_to:wpmDataLayer.pixels.google.analytics.universal.property_id,currency:wpmDataLayer.shop.currency,items:[{id:t.dyn_r_ids[wpmDataLayer.pixels.google.analytics.id_type],name:t.name,list_name:wpmDataLayer.shop.list_name,brand:t.brand,category:t.category.join(","),variant:t.variant,quantity:t.quantity,price:t.price}]})}))}catch(e){console.error(e)}})),jQuery(document).on("wpmBeginCheckout",(function(e){try{var t,a,o,r,i,n,l,d,s;if(null===(t=wpmDataLayer)||void 0===t||null===(a=t.pixels)||void 0===a||null===(o=a.google)||void 0===o||null===(r=o.analytics)||void 0===r||!r.eec)return;if(null===(i=wpmDataLayer)||void 0===i||null===(n=i.pixels)||void 0===n||null===(l=n.google)||void 0===l||null===(d=l.analytics)||void 0===d||null===(s=d.universal)||void 0===s||!s.property_id)return;if(!wpm.googleConfigConditionsMet("analytics"))return;wpm.gtagLoaded().then((function(){gtag("event","begin_checkout",{send_to:wpmDataLayer.pixels.google.analytics.universal.property_id,currency:wpmDataLayer.shop.currency,items:wpm.getCartItemsGaUa()})}))}catch(e){console.error(e)}})),jQuery(document).on("wpmFireCheckoutOption",(function(e,t){try{var a,o,r,i,n,l,d,s,c;if(null===(a=wpmDataLayer)||void 0===a||null===(o=a.pixels)||void 0===o||null===(r=o.google)||void 0===r||null===(i=r.analytics)||void 0===i||!i.eec)return;if(null===(n=wpmDataLayer)||void 0===n||null===(l=n.pixels)||void 0===l||null===(d=l.google)||void 0===d||null===(s=d.analytics)||void 0===s||null===(c=s.universal)||void 0===c||!c.property_id)return;if(!wpm.googleConfigConditionsMet("analytics"))return;wpm.gtagLoaded().then((function(){gtag("event","set_checkout_option",{send_to:wpmDataLayer.pixels.google.analytics.universal.property_id,checkout_step:t.step,checkout_option:t.checkout_option,value:t.value})}))}catch(e){console.error(e)}})),jQuery(document).on("wpmFireCheckoutProgress",(function(e,t){try{var a,o,r,i,n,l,d,s,c;if(null===(a=wpmDataLayer)||void 0===a||null===(o=a.pixels)||void 0===o||null===(r=o.google)||void 0===r||null===(i=r.analytics)||void 0===i||!i.eec)return;if(null===(n=wpmDataLayer)||void 0===n||null===(l=n.pixels)||void 0===l||null===(d=l.google)||void 0===d||null===(s=d.analytics)||void 0===s||null===(c=s.universal)||void 0===c||!c.property_id)return;if(!wpm.googleConfigConditionsMet("analytics"))return;wpm.gtagLoaded().then((function(){gtag("event","checkout_progress",{send_to:wpmDataLayer.pixels.google.analytics.universal.property_id,checkout_step:t.step})}))}catch(e){console.error(e)}})),jQuery(document).on("wpmSearch",(function(){try{var e,t,a,o,r,i,n,l,d;if(null===(e=wpmDataLayer)||void 0===e||null===(t=e.pixels)||void 0===t||null===(a=t.google)||void 0===a||null===(o=a.analytics)||void 0===o||!o.eec)return;if(null===(r=wpmDataLayer)||void 0===r||null===(i=r.pixels)||void 0===i||null===(n=i.google)||void 0===n||null===(l=n.analytics)||void 0===l||null===(d=l.universal)||void 0===d||!d.property_id)return;if(!wpm.googleConfigConditionsMet("analytics"))return;let s=[];for(const[e,t]of Object.entries(wpmDataLayer.products))s.push({id:t.dyn_r_ids[wpmDataLayer.pixels.google.analytics.id_type],name:t.name,quantity:1,list_position:t.position,brand:t.brand,category:t.category.join(","),list_name:wpmDataLayer.shop.list_name,variant:t.variant,price:t.price});wpm.gtagLoaded().then((function(){gtag("event","view_search_results",{send_to:wpmDataLayer.pixels.google.analytics.universal.property_id,search_term:wpm.getSearchTermFromUrl(),items:s})}))}catch(e){console.error(e)}})),jQuery(document).on("wpmLogin",(function(){try{var e,t,a,o,r,i,n,l,d;if(null===(e=wpmDataLayer)||void 0===e||null===(t=e.pixels)||void 0===t||null===(a=t.google)||void 0===a||null===(o=a.analytics)||void 0===o||!o.eec)return;if(null===(r=wpmDataLayer)||void 0===r||null===(i=r.pixels)||void 0===i||null===(n=i.google)||void 0===n||null===(l=n.analytics)||void 0===l||null===(d=l.universal)||void 0===d||!d.property_id)return;if(!wpm.googleConfigConditionsMet("analytics"))return;wpm.gtagLoaded().then((function(){gtag("event","login",{send_to:wpmDataLayer.pixels.google.analytics.universal.property_id})}))}catch(e){console.error(e)}}))},354:()=>{!function(e,t,a){e.getGAUAOrderItems=function(){let e=[],t=1;for(const[r,i]of Object.entries(wpmDataLayer.order.items)){var a,o;let r;r={quantity:i.quantity,price:i.price,name:i.name,currency:wpmDataLayer.order.currency,category:wpmDataLayer.products[i.id].category.join("/"),list_position:t},null!==(a=wpmDataLayer)&&void 0!==a&&null!==(o=a.general)&&void 0!==o&&o.variationsOutput&&0!==i.variation_id?(r.id=String(wpmDataLayer.products[i.variation_id].dyn_r_ids[wpmDataLayer.pixels.google.analytics.id_type]),r.variant=wpmDataLayer.products[i.variation_id].variant_name,r.brand=wpmDataLayer.products[i.variation_id].brand):(r.id=String(wpmDataLayer.products[i.id].dyn_r_ids[wpmDataLayer.pixels.google.analytics.id_type]),r.brand=wpmDataLayer.products[i.id].brand),e.push(r),t++}return e}}(window.wpm=window.wpm||{},jQuery),jQuery(document).on("wpmOrderReceivedPage",(function(){try{var e,t,a,o,r,i,n,l,d,s;if(null===(e=wpmDataLayer)||void 0===e||null===(t=e.pixels)||void 0===t||null===(a=t.google)||void 0===a||null===(o=a.analytics)||void 0===o||null===(r=o.universal)||void 0===r||!r.property_id)return;if(null!==(i=wpmDataLayer)&&void 0!==i&&null!==(n=i.pixels)&&void 0!==n&&null!==(l=n.google)&&void 0!==l&&null!==(d=l.analytics)&&void 0!==d&&null!==(s=d.universal)&&void 0!==s&&s.mp_active)return;if(!wpm.googleConfigConditionsMet("analytics"))return;wpm.gtagLoaded().then((function(){gtag("event","purchase",{send_to:[wpmDataLayer.pixels.google.analytics.universal.property_id],transaction_id:wpmDataLayer.order.number,affiliation:wpmDataLayer.order.affiliation,currency:wpmDataLayer.order.currency,value:wpmDataLayer.order.value_regular,discount:wpmDataLayer.order.discount,tax:wpmDataLayer.order.tax,shipping:wpmDataLayer.order.shipping,coupon:wpmDataLayer.order.coupon,items:wpm.getGAUAOrderItems()})}))}catch(e){console.error(e)}}))},497:()=>{!function(e,t,a){e.load_google_optimize_pixel=function(){try{wpmDataLayer.pixels.google.optimize.loaded=!0,e.loadScriptAndCacheIt("https://www.googleoptimize.com/optimize.js?id="+wpmDataLayer.pixels.google.optimize.container_id)}catch(e){console.error(e)}}}(window.wpm=window.wpm||{},jQuery),jQuery(document).on("wpmLoadPixels",(function(){var e,t,a,o,r,i,n,l;null===(e=wpmDataLayer)||void 0===e||null===(t=e.pixels)||void 0===t||null===(a=t.google)||void 0===a||null===(o=a.optimize)||void 0===o||!o.container_id||null!==(r=wpmDataLayer)&&void 0!==r&&null!==(i=r.pixels)&&void 0!==i&&null!==(n=i.google)&&void 0!==n&&null!==(l=n.optimize)&&void 0!==l&&l.loaded||wpm.canIFire("analytics","google-optimize")&&wpm.load_google_optimize_pixel()}))},577:()=>{!function(e,t,a){e.googleConfigConditionsMet=function(t){var a,o,r,i;return!(null===(a=wpmDataLayer)||void 0===a||null===(o=a.pixels)||void 0===o||null===(r=o.google)||void 0===r||null===(i=r.consent_mode)||void 0===i||!i.active)||("category"===e.getConsentValues().mode?!0===e.getConsentValues().categories[t]:"pixel"===e.getConsentValues().mode&&e.getConsentValues().pixels.includes("google-"+t))},e.getVisitorConsentStatusAndUpdateGoogleConsentSettings=function(t){return"category"===e.getConsentValues().mode?(e.getConsentValues().categories.analytics&&(t.analytics_storage="granted"),e.getConsentValues().categories.ads&&(t.ad_storage="granted")):"pixel"===e.getConsentValues().mode&&(t.analytics_storage=e.getConsentValues().pixels.includes("google-analytics")?"granted":"denied",t.ad_storage=e.getConsentValues().pixels.includes("google-ads")?"granted":"denied"),t},e.updateGoogleConsentMode=function(){let e=!(arguments.length>0&&arguments[0]!==a)||arguments[0],t=!(arguments.length>1&&arguments[1]!==a)||arguments[1];try{if(!window.gtag||!wpmDataLayer.shop.cookie_consent_mgmt.explicit_consent)return;gtag("consent","update",{analytics_storage:e?"granted":"denied",ad_storage:t?"granted":"denied"})}catch(e){console.error(e)}},e.fireGtagGoogleAds=function(){try{var e,t,a,o,r,i,n,l,d,s,c,u,p,m,y,g,w,v,_,f,L;if(wpmDataLayer.pixels.google.ads.state="loading",null!==(e=wpmDataLayer)&&void 0!==e&&null!==(t=e.pixels)&&void 0!==t&&null!==(a=t.google)&&void 0!==a&&null!==(o=a.ads)&&void 0!==o&&null!==(r=o.enhanced_conversions)&&void 0!==r&&r.active)for(const[e,t]of Object.entries(wpmDataLayer.pixels.google.ads.conversionIds))gtag("config",e,{allow_enhanced_conversions:!0});else for(const[e,t]of Object.entries(wpmDataLayer.pixels.google.ads.conversionIds))gtag("config",e);null!==(i=wpmDataLayer)&&void 0!==i&&null!==(n=i.pixels)&&void 0!==n&&null!==(l=n.google)&&void 0!==l&&null!==(d=l.ads)&&void 0!==d&&d.conversionIds&&null!==(s=wpmDataLayer)&&void 0!==s&&null!==(c=s.pixels)&&void 0!==c&&null!==(u=c.google)&&void 0!==u&&null!==(p=u.ads)&&void 0!==p&&p.phone_conversion_label&&null!==(m=wpmDataLayer)&&void 0!==m&&null!==(y=m.pixels)&&void 0!==y&&null!==(g=y.google)&&void 0!==g&&null!==(w=g.ads)&&void 0!==w&&w.phone_conversion_number&&gtag("config",Object.keys(wpmDataLayer.pixels.google.ads.conversionIds)[0]+"/"+wpmDataLayer.pixels.google.ads.phone_conversion_label,{phone_conversion_number:wpmDataLayer.pixels.google.ads.phone_conversion_number}),"order_received_page"===wpmDataLayer.shop.page_type&&null!==(v=wpmDataLayer)&&void 0!==v&&null!==(_=v.order)&&void 0!==_&&null!==(f=_.google)&&void 0!==f&&null!==(L=f.ads)&&void 0!==L&&L.enhanced_conversion_data&&(window.enhanced_conversion_data=wpmDataLayer.order.google.ads.enhanced_conversion_data),wpmDataLayer.pixels.google.ads.state="ready"}catch(e){console.error(e)}},e.fireGtagGoogleAnalyticsUA=function(){try{wpmDataLayer.pixels.google.analytics.universal.state="loading",gtag("config",wpmDataLayer.pixels.google.analytics.universal.property_id,wpmDataLayer.pixels.google.analytics.universal.parameters),wpmDataLayer.pixels.google.analytics.universal.state="ready"}catch(e){console.error(e)}},e.fireGtagGoogleAnalyticsGA4=function(){try{wpmDataLayer.pixels.google.analytics.ga4.state="loading",gtag("config",wpmDataLayer.pixels.google.analytics.ga4.measurement_id,wpmDataLayer.pixels.google.analytics.ga4.parameters),wpmDataLayer.pixels.google.analytics.ga4.state="ready"}catch(e){console.error(e)}},e.isGoogleActive=function(){var e,t,a,o,r,i,n,l,d,s,c,u,p,m;return!(!(null!==(e=wpmDataLayer)&&void 0!==e&&null!==(t=e.pixels)&&void 0!==t&&null!==(a=t.google)&&void 0!==a&&null!==(o=a.analytics)&&void 0!==o&&null!==(r=o.universal)&&void 0!==r&&r.property_id||null!==(i=wpmDataLayer)&&void 0!==i&&null!==(n=i.pixels)&&void 0!==n&&null!==(l=n.google)&&void 0!==l&&null!==(d=l.analytics)&&void 0!==d&&null!==(s=d.ga4)&&void 0!==s&&s.measurement_id)&&jQuery.isEmptyObject(null===(c=wpmDataLayer)||void 0===c||null===(u=c.pixels)||void 0===u||null===(p=u.google)||void 0===p||null===(m=p.ads)||void 0===m?void 0:m.conversionIds))},e.getGoogleGtagId=function(){var e,t,a,o,r,i,n,l,d,s;return null!==(e=wpmDataLayer)&&void 0!==e&&null!==(t=e.pixels)&&void 0!==t&&null!==(a=t.google)&&void 0!==a&&null!==(o=a.analytics)&&void 0!==o&&null!==(r=o.universal)&&void 0!==r&&r.property_id?wpmDataLayer.pixels.google.analytics.universal.property_id:null!==(i=wpmDataLayer)&&void 0!==i&&null!==(n=i.pixels)&&void 0!==n&&null!==(l=n.google)&&void 0!==l&&null!==(d=l.analytics)&&void 0!==d&&null!==(s=d.ga4)&&void 0!==s&&s.measurement_id?wpmDataLayer.pixels.google.analytics.ga4.measurement_id:Object.keys(wpmDataLayer.pixels.google.ads.conversionIds)[0]},e.loadGoogle=function(){e.isGoogleActive()&&(wpmDataLayer.pixels.google.state="loading",e.loadScriptAndCacheIt("https://www.googletagmanager.com/gtag/js?id="+e.getGoogleGtagId()).done((function(t,a){try{var o,r,i,n,l,d,s,c,u,p,m,y,g,w,v,_,f,L,h,D,x,k;if(window.dataLayer=window.dataLayer||[],window.gtag=function(){dataLayer.push(arguments)},null!==(o=wpmDataLayer)&&void 0!==o&&null!==(r=o.pixels)&&void 0!==r&&null!==(i=r.google)&&void 0!==i&&null!==(n=i.consent_mode)&&void 0!==n&&n.active){var C,b,j,Q;let t={ad_storage:wpmDataLayer.pixels.google.consent_mode.ad_storage,analytics_storage:wpmDataLayer.pixels.google.consent_mode.analytics_storage,wait_for_update:wpmDataLayer.pixels.google.consent_mode.wait_for_update};null!==(C=wpmDataLayer)&&void 0!==C&&null!==(b=C.pixels)&&void 0!==b&&null!==(j=b.google)&&void 0!==j&&null!==(Q=j.consent_mode)&&void 0!==Q&&Q.region&&(t.region=wpmDataLayer.pixels.google.consent_mode.region),t=e.getVisitorConsentStatusAndUpdateGoogleConsentSettings(t),gtag("consent","default",t),gtag("set","ads_data_redaction",wpmDataLayer.pixels.google.consent_mode.ads_data_redaction),gtag("set","url_passthrough",wpmDataLayer.pixels.google.consent_mode.url_passthrough)}null!==(l=wpmDataLayer)&&void 0!==l&&null!==(d=l.pixels)&&void 0!==d&&null!==(s=d.google)&&void 0!==s&&null!==(c=s.linker)&&void 0!==c&&c.settings&&gtag("set","linker",wpmDataLayer.pixels.google.linker.settings),gtag("js",new Date),jQuery.isEmptyObject(null===(u=wpmDataLayer)||void 0===u||null===(p=u.pixels)||void 0===p||null===(m=p.google)||void 0===m||null===(y=m.ads)||void 0===y?void 0:y.conversionIds)||(e.googleConfigConditionsMet("ads")?e.fireGtagGoogleAds():e.logPreventedPixelLoading("google-ads","ads")),null!==(g=wpmDataLayer)&&void 0!==g&&null!==(w=g.pixels)&&void 0!==w&&null!==(v=w.google)&&void 0!==v&&null!==(_=v.analytics)&&void 0!==_&&null!==(f=_.universal)&&void 0!==f&&f.property_id&&(e.googleConfigConditionsMet("analytics")?e.fireGtagGoogleAnalyticsUA():e.logPreventedPixelLoading("google-universal-analytics","analytics")),null!==(L=wpmDataLayer)&&void 0!==L&&null!==(h=L.pixels)&&void 0!==h&&null!==(D=h.google)&&void 0!==D&&null!==(x=D.analytics)&&void 0!==x&&null!==(k=x.ga4)&&void 0!==k&&k.measurement_id&&(e.googleConfigConditionsMet("analytics")?e.fireGtagGoogleAnalyticsGA4():e.logPreventedPixelLoading("ga4","analytics")),wpmDataLayer.pixels.google.state="ready"}catch(e){console.error(e)}})))},e.canGoogleLoad=function(){var t,a,o,r;return!(null===(t=wpmDataLayer)||void 0===t||null===(a=t.pixels)||void 0===a||null===(o=a.google)||void 0===o||null===(r=o.consent_mode)||void 0===r||!r.active)||("category"===e.getConsentValues().mode?!(!e.getConsentValues().categories.ads&&!e.getConsentValues().categories.analytics):"pixel"===e.getConsentValues().mode?e.getConsentValues().pixels.includes("google-ads")||e.getConsentValues().pixels.includes("google-analytics"):(console.error("Couldn't find a valid load condition for Google mode in wpmConsentValues"),!1))},e.gtagLoaded=function(){return new Promise((function(e,t){var a,o,r;void 0===(null===(a=wpmDataLayer)||void 0===a||null===(o=a.pixels)||void 0===o||null===(r=o.google)||void 0===r?void 0:r.state)&&t();let i=0;!function a(){var o,r,n;return"ready"===(null===(o=wpmDataLayer)||void 0===o||null===(r=o.pixels)||void 0===r||null===(n=r.google)||void 0===n?void 0:n.state)?e():i>=5e3?t():(i+=200,void setTimeout(a,200))}()}))}}(window.wpm=window.wpm||{},jQuery),jQuery(document).on("wpmLoadPixels",(function(){var e,t,a;void 0===(null===(e=wpmDataLayer)||void 0===e||null===(t=e.pixels)||void 0===t||null===(a=t.google)||void 0===a?void 0:a.state)&&(wpm.canGoogleLoad()?wpm.loadGoogle():wpm.logPreventedPixelLoading("google","analytics / ads"))}))},385:()=>{!function(e,t,a){e.getFormattedGA4Categories=function(e,t){if(t=Array.from(new Set(t)),Array.isArray(t)&&t.length){e.item_category=t[0];let a=t.length>5?5:t.length;for(let o=1;o<a;o++)e["item_category"+(o+1)]=t[o]}return e},e.setGoogleCidOnServer=function(){try{var t,a,o,r,i,n,l,d,s,c;let u=[];null!==(t=wpmDataLayer)&&void 0!==t&&null!==(a=t.pixels)&&void 0!==a&&null!==(o=a.google)&&void 0!==o&&null!==(r=o.analytics)&&void 0!==r&&null!==(i=r.ga4)&&void 0!==i&&i.measurement_id&&u.push(wpmDataLayer.pixels.google.analytics.ga4.measurement_id),null!==(n=wpmDataLayer)&&void 0!==n&&null!==(l=n.pixels)&&void 0!==l&&null!==(d=l.google)&&void 0!==d&&null!==(s=d.analytics)&&void 0!==s&&null!==(c=s.universal)&&void 0!==c&&c.property_id&&u.push(wpmDataLayer.pixels.google.analytics.universal.property_id),e.gtagLoaded().then((function(){gtag("get",u[0],"client_id",(t=>{let a={action:"wpm_google_analytics_set_session_data",target_ids:u,client_id:t,referrer:e.getReferrerFromCookie(),gclid:e.getClidFromBrowser("gclid"),userAgent:e.getUserAgent(),viewPortWidth:e.getViewPort().width,viewPortHeight:e.getViewPort().height};jQuery.ajax({type:"post",dataType:"json",url:e.ajax_url,data:a,success:function(a){!0===a.success&&(window.sessionStorage?u.forEach((e=>{window.sessionStorage.setItem("_wpm_ga_cid_set",JSON.stringify(!0)),window.sessionStorage.setItem("wpm_cid_"+e+"_"+t+"_set",JSON.stringify(!0))})):u.forEach((a=>{e.setCookie("wpm_cid_"+a+"_"+t+"_set",!0)})))},error:function(e){console.error(e)}})}))}))}catch(e){console.error(e)}}}(window.wpm=window.wpm||{},jQuery),jQuery(window).on("wpmLoadAlways",(function(){try{var e,t,a,o,r,i,n,l,d,s,c,u,p,m,y,g;null===(e=wpmDataLayer)||void 0===e||null===(t=e.pixels)||void 0===t||null===(a=t.google)||void 0===a||null===(o=a.analytics)||void 0===o||!o.eec||null!==(r=window)&&void 0!==r&&null!==(i=r.sessionStorage)&&void 0!==i&&i.getItem("_wpm_ga_cid_set",JSON.parse(!0))||!(null!==(n=wpmDataLayer)&&void 0!==n&&null!==(l=n.pixels)&&void 0!==l&&null!==(d=l.google)&&void 0!==d&&null!==(s=d.analytics)&&void 0!==s&&null!==(c=s.universal)&&void 0!==c&&c.property_id||null!==(u=wpmDataLayer)&&void 0!==u&&null!==(p=u.pixels)&&void 0!==p&&null!==(m=p.google)&&void 0!==m&&null!==(y=m.analytics)&&void 0!==y&&null!==(g=y.ga4)&&void 0!==g&&g.measurement_id)||["cart","checkout"].indexOf(wpmDataLayer.shop.page_type)>=0&&wpm.setGoogleCidOnServer()}catch(e){console.error(e)}}))},570:()=>{!function(e,t,a){e.load_hotjar_pixel=function(){try{wpmDataLayer.pixels.hotjar.loaded=!0,function(e,t,a,o,r,i){e.hj=e.hj||function(){(e.hj.q=e.hj.q||[]).push(arguments)},e._hjSettings={hjid:wpmDataLayer.pixels.hotjar.site_id,hjsv:6},r=t.getElementsByTagName("head")[0],(i=t.createElement("script")).async=1,i.src="https://static.hotjar.com/c/hotjar-"+e._hjSettings.hjid+".js?sv="+e._hjSettings.hjsv,r.appendChild(i)}(window,document)}catch(e){console.error(e)}}}(window.wpm=window.wpm||{},jQuery),jQuery(document).on("wpmLoadPixels",(function(){var e,t,a,o,r,i,n,l,d;null===(e=wpmDataLayer)||void 0===e||null===(t=e.pixels)||void 0===t||null===(a=t.hotjar)||void 0===a||!a.site_id||null!==(o=wpmDataLayer)&&void 0!==o&&null!==(r=o.pixels)&&void 0!==r&&null!==(i=r.hotjar)&&void 0!==i&&i.loaded||!wpm.canIFire("analytics","hotjar")||null!==(n=wpmDataLayer)&&void 0!==n&&null!==(l=n.pixels)&&void 0!==l&&null!==(d=l.hotjar)&&void 0!==d&&d.loaded||wpm.load_hotjar_pixel()}))},623:()=>{!function(e,t,a){e.load_bing_pixel=function(){try{wpmDataLayer.pixels.bing.loaded=!0,window.uetq=window.uetq||[],e=window,t=document,a="script",e[o="uetq"]=e[o]||[],r=function(){var t={ti:wpmDataLayer.pixels.bing.uet_tag_id};t.q=e[o],e[o]=new UET(t),e[o].push("pageLoad")},(i=t.createElement(a)).src="//bat.bing.com/bat.js",i.async=1,i.onload=i.onreadystatechange=function(){var e=this.readyState;e&&"loaded"!==e&&"complete"!==e||(r(),i.onload=i.onreadystatechange=null)},(n=t.getElementsByTagName(a)[0]).parentNode.insertBefore(i,n)}catch(e){console.error(e)}var e,t,a,o,r,i,n},e.bing_purchase_ecomm_prodids=function(){let e=[];for(const[o,r]of Object.entries(wpmDataLayer.order.items)){var t,a;null!==(t=wpmDataLayer)&&void 0!==t&&null!==(a=t.general)&&void 0!==a&&a.variationsOutput&&0!==r.variation_id?e.push(String(wpmDataLayer.products[r.variation_id].dyn_r_ids[wpmDataLayer.pixels.bing.dynamic_remarketing.id_type])):e.push(String(wpmDataLayer.products[r.id].dyn_r_ids[wpmDataLayer.pixels.bing.dynamic_remarketing.id_type]))}return e},e.bing_purchase_items=function(){let e=[];for(const[o,r]of Object.entries(wpmDataLayer.order.items)){var t,a;let o;o={quantity:r.quantity,price:r.price},null!==(t=wpmDataLayer)&&void 0!==t&&null!==(a=t.general)&&void 0!==a&&a.variationsOutput&&0!==r.variation_id?(o.id=String(wpmDataLayer.products[r.variation_id].dyn_r_ids[wpmDataLayer.pixels.bing.dynamic_remarketing.id_type]),e.push(o)):(o.id=String(wpmDataLayer.products[r.id].dyn_r_ids[wpmDataLayer.pixels.bing.dynamic_remarketing.id_type]),e.push(o))}return e}}(window.wpm=window.wpm||{},jQuery),jQuery(document).on("wpmLoadPixels",(function(){var e,t,a,o,r,i;null===(e=wpmDataLayer)||void 0===e||null===(t=e.pixels)||void 0===t||null===(a=t.bing)||void 0===a||!a.uet_tag_id||null!==(o=wpmDataLayer)&&void 0!==o&&null!==(r=o.pixels)&&void 0!==r&&null!==(i=r.bing)&&void 0!==i&&i.loaded||wpm.canIFire("ads","bing-ads")&&wpm.load_bing_pixel()})),jQuery(document).on("wpmAddToCart",(function(e,t){try{var a,o,r;if(null===(a=wpmDataLayer)||void 0===a||null===(o=a.pixels)||void 0===o||null===(r=o.bing)||void 0===r||!r.loaded)return;window.uetq.push("event","",{ecomm_pagetype:"cart",ecomm_prodid:t.dyn_r_ids[wpmDataLayer.pixels.bing.dynamic_remarketing.id_type]})}catch(e){console.error(e)}})),jQuery(document).on("wpmViewItem",(function(e,t){try{var a,o,r;if(null===(a=wpmDataLayer)||void 0===a||null===(o=a.pixels)||void 0===o||null===(r=o.bing)||void 0===r||!r.loaded)return;window.uetq.push("event","",{ecomm_pagetype:"product",ecomm_prodid:t.dyn_r_ids[wpmDataLayer.pixels.bing.dynamic_remarketing.id_type]})}catch(e){console.error(e)}})),jQuery(document).on("wpmCategory",(function(){try{var e,t,a;if(null===(e=wpmDataLayer)||void 0===e||null===(t=e.pixels)||void 0===t||null===(a=t.bing)||void 0===a||!a.loaded)return;window.uetq.push("event","",{ecomm_pagetype:"category"})}catch(e){console.error(e)}})),jQuery(document).on("wpmSearch",(function(){try{var e,t,a;if(null===(e=wpmDataLayer)||void 0===e||null===(t=e.pixels)||void 0===t||null===(a=t.bing)||void 0===a||!a.loaded)return;window.uetq.push("event","",{ecomm_pagetype:"searchresults"})}catch(e){console.error(e)}})),jQuery(document).on("wpmOrderReceivedPage",(function(){try{var e,t,a;if(null===(e=wpmDataLayer)||void 0===e||null===(t=e.pixels)||void 0===t||null===(a=t.bing)||void 0===a||!a.loaded)return;window.uetq.push("event","purchase",{ecomm_pagetype:"purchase",ecomm_prodid:wpm.bing_purchase_ecomm_prodids(),revenue_value:wpmDataLayer.order.value_filtered,currency:wpmDataLayer.order.currency,items:wpm.bing_purchase_items()})}catch(e){console.error(e)}}))},699:()=>{!function(e,t,a){e.getPinterestProductData=function(e){return e.isVariation?{product_name:e.name,product_variant_id:e.dyn_r_ids[wpmDataLayer.pixels.pinterest.dynamic_remarketing.id_type],product_id:e.parentId_dyn_r_ids[wpmDataLayer.pixels.pinterest.dynamic_remarketing.id_type],product_category:e.category,product_variant:e.variant,product_price:e.price,product_quantity:e.quantity,product_brand:e.brand}:{product_name:e.name,product_id:e.dyn_r_ids[wpmDataLayer.pixels.pinterest.dynamic_remarketing.id_type],product_category:e.category,product_price:e.price,product_quantity:e.quantity,product_brand:e.brand}},e.pinterestFormattedOrderItems=function(){let e=[];for(const[o,r]of Object.entries(wpmDataLayer.order.items)){var t,a;let i;i={product_category:wpmDataLayer.products[o].category.join(","),product_quantity:r.quantity,product_price:r.price},null!==(t=wpmDataLayer)&&void 0!==t&&null!==(a=t.general)&&void 0!==a&&a.variationsOutput&&0!==r.variation_id?(i.product_id=String(wpmDataLayer.products[r.variation_id].dyn_r_ids[wpmDataLayer.pixels.pinterest.dynamic_remarketing.id_type]),i.product_name=wpmDataLayer.products[r.variation_id].name,e.push(i)):(i.product_id=String(wpmDataLayer.products[r.id].dyn_r_ids[wpmDataLayer.pixels.pinterest.dynamic_remarketing.id_type]),i.product_name=wpmDataLayer.products[r.id].name,e.push(i))}return e},e.loadPinterestPixel=function(){try{wpmDataLayer.pixels.pinterest.loaded=!0,function(e){if(!window.pintrk){window.pintrk=function(){window.pintrk.queue.push(Array.prototype.slice.call(arguments))};var t=window.pintrk;t.queue=[],t.version="3.0";var a=document.createElement("script");a.async=!0,a.src="https://s.pinimg.com/ct/core.js";var o=document.getElementsByTagName("script")[0];o.parentNode.insertBefore(a,o)}}(),e.pinterestLoadEvent(),pintrk("page")}catch(e){console.error(e)}},e.pinterestLoadEvent=function(){try{var e,t,a;(wpmDataLayer.general.userLoggedIn||"order_received_page"===wpmDataLayer.shop.page_type)&&null!==(e=wpmDataLayer)&&void 0!==e&&null!==(t=e.pixels)&&void 0!==t&&null!==(a=t.pinterest)&&void 0!==a&&a.enhanced_match?pintrk("load",wpmDataLayer.pixels.pinterest.pixel_id,{em:wpmDataLayer.pixels.pinterest.enhanced_match_email}):pintrk("load",wpmDataLayer.pixels.pinterest.pixel_id)}catch(e){console.error(e)}}}(window.wpm=window.wpm||{},jQuery),jQuery(document).on("wpmLoadPixels",(function(){var e,t,a,o,r,i;null===(e=wpmDataLayer)||void 0===e||null===(t=e.pixels)||void 0===t||null===(a=t.pinterest)||void 0===a||!a.pixel_id||null!==(o=wpmDataLayer)&&void 0!==o&&null!==(r=o.pixels)&&void 0!==r&&null!==(i=r.pinterest)&&void 0!==i&&i.loaded||wpm.canIFire("ads","pinterest-ads")&&wpm.loadPinterestPixel()})),jQuery(document).on("wpmAddToCart",(function(e,t){try{var a,o,r;if(null===(a=wpmDataLayer)||void 0===a||null===(o=a.pixels)||void 0===o||null===(r=o.pinterest)||void 0===r||!r.loaded)return;pintrk("track","addtocart",{value:parseFloat(t.quantity*t.price),currency:t.currency,line_items:[wpm.getPinterestProductData(t)]})}catch(e){console.error(e)}})),jQuery(document).on("wpmViewItem",(function(e,t){try{var a,o,r;if(null===(a=wpmDataLayer)||void 0===a||null===(o=a.pixels)||void 0===o||null===(r=o.pinterest)||void 0===r||!r.loaded)return;pintrk("track","pagevisit",{currency:t.currency,line_items:[wpm.getPinterestProductData(t)]})}catch(e){console.error(e)}})),jQuery(document).on("wpmViewItem",(function(e,t){try{var a,o,r;if(null===(a=wpmDataLayer)||void 0===a||null===(o=a.pixels)||void 0===o||null===(r=o.pinterest)||void 0===r||!r.loaded)return;let e=wpm.getPinterestProductData(t);pintrk("track","pagevisit",{currency:t.currency,line_items:[e]})}catch(e){console.error(e)}})),jQuery(document).on("wpmSearch",(function(){try{var e,t,a;if(null===(e=wpmDataLayer)||void 0===e||null===(t=e.pixels)||void 0===t||null===(a=t.pinterest)||void 0===a||!a.loaded)return;let o=new URLSearchParams(window.location.search);pintrk("track","search",{search_query:o.get("s")})}catch(e){console.error(e)}})),jQuery(document).on("wpmCategory",(function(){try{var e,t,a;if(null===(e=wpmDataLayer)||void 0===e||null===(t=e.pixels)||void 0===t||null===(a=t.pinterest)||void 0===a||!a.loaded)return;pintrk("track","viewcategory")}catch(e){console.error(e)}})),jQuery(document).on("wpmOrderReceivedPage",(function(){try{var e,t,a;if(null===(e=wpmDataLayer)||void 0===e||null===(t=e.pixels)||void 0===t||null===(a=t.pinterest)||void 0===a||!a.loaded)return;pintrk("track","checkout",{value:wpmDataLayer.order.value_filtered,order_quantity:wpmDataLayer.order.quantity,currency:wpmDataLayer.order.currency,order_id:wpmDataLayer.order.id,line_items:wpm.pinterestFormattedOrderItems()})}catch(e){console.error(e)}}))},986:()=>{!function(e,t,a){e.snapchatGetEmail=function(){var e,t;let a={};var o;return null!==(e=wpmDataLayer)&&void 0!==e&&null!==(t=e.user)&&void 0!==t&&t.email_sha256&&(a.user_hashed_email=null===(o=wpmDataLayer.user)||void 0===o?void 0:o.email_sha256),a},e.loadSnapchatPixel=function(){try{wpmDataLayer.pixels.snapchat.loaded=!0,function(e,t,a){if(!e.snaptr){var o=e.snaptr=function(){o.handleRequest?o.handleRequest.apply(o,arguments):o.queue.push(arguments)};o.queue=[];var i="script";r=t.createElement(i),r.async=!0,r.src="https://sc-static.net/scevent.min.js";var n=t.getElementsByTagName(i)[0];n.parentNode.insertBefore(r,n)}}(window,document),snaptr("init",wpmDataLayer.pixels.snapchat.pixel_id,e.snapchatGetEmail()),snaptr("track","PAGE_VIEW")}catch(e){console.error(e)}},e.getSnapchatOrderItemIds=function(){let e=[];for(const[o,r]of Object.entries(wpmDataLayer.order.items)){var t,a;null!==(t=wpmDataLayer)&&void 0!==t&&null!==(a=t.general)&&void 0!==a&&a.variationsOutput&&0!==r.variation_id?e.push(String(wpmDataLayer.products[r.variation_id].dyn_r_ids[wpmDataLayer.pixels.snapchat.dynamic_remarketing.id_type])):e.push(String(wpmDataLayer.products[r.id].dyn_r_ids[wpmDataLayer.pixels.snapchat.dynamic_remarketing.id_type]))}return e}}(window.wpm=window.wpm||{},jQuery),jQuery(document).on("wpmLoadPixels",(function(){var e,t,a,o,r,i;null===(e=wpmDataLayer)||void 0===e||null===(t=e.pixels)||void 0===t||null===(a=t.snapchat)||void 0===a||!a.pixel_id||null!==(o=wpmDataLayer)&&void 0!==o&&null!==(r=o.pixels)&&void 0!==r&&null!==(i=r.snapchat)&&void 0!==i&&i.loaded||wpm.canIFire("ads","snapchat-ads")&&wpm.loadSnapchatPixel()})),jQuery(document).on("wpmAddToCart",(function(e,t){try{var a,o,r;if(null===(a=wpmDataLayer)||void 0===a||null===(o=a.pixels)||void 0===o||null===(r=o.snapchat)||void 0===r||!r.loaded)return;snaptr("track","ADD_CART",{item_ids:[t.dyn_r_ids[wpmDataLayer.pixels.snapchat.dynamic_remarketing.id_type]]})}catch(e){console.error(e)}})),jQuery(document).on("wpmViewItem",(function(e,t){try{var a,o,r;if(null===(a=wpmDataLayer)||void 0===a||null===(o=a.pixels)||void 0===o||null===(r=o.snapchat)||void 0===r||!r.loaded)return;snaptr("track","VIEW_CONTENT",{item_ids:[t.dyn_r_ids[wpmDataLayer.pixels.snapchat.dynamic_remarketing.id_type]]})}catch(e){console.error(e)}})),jQuery(document).on("wpmOrderReceivedPage",(function(){try{var e,t,a;if(null===(e=wpmDataLayer)||void 0===e||null===(t=e.pixels)||void 0===t||null===(a=t.snapchat)||void 0===a||!a.loaded)return;snaptr("track","PURCHASE",{currency:wpmDataLayer.order.currency,price:wpmDataLayer.order.value_filtered,transaction_id:wpmDataLayer.order.id,item_ids:wpm.getSnapchatOrderItemIds()})}catch(e){console.error(e)}}))},657:()=>{!function(e,t,a){e.loadTikTokPixel=function(){try{wpmDataLayer.pixels.tiktok.loaded=!0,function(e,t,a){e.TiktokAnalyticsObject=a;var o=e[a]=e[a]||[];o.methods=["page","track","identify","instances","debug","on","off","once","ready","alias","group","enableCookie","disableCookie"],o.setAndDefer=function(e,t){e[t]=function(){e.push([t].concat(Array.prototype.slice.call(arguments,0)))}};for(var r=0;r<o.methods.length;r++)o.setAndDefer(o,o.methods[r]);o.instance=function(e){for(var t=o._i[e]||[],a=0;a<o.methods.length;a++)o.setAndDefer(t,o.methods[a]);return t},o.load=function(e,t){var r="https://analytics.tiktok.com/i18n/pixel/events.js";o._i=o._i||{},o._i[e]=[],o._i[e]._u=r,o._t=o._t||{},o._t[e]=+new Date,o._o=o._o||{},o._o[e]=t||{};var i=document.createElement("script");i.type="text/javascript",i.async=!0,i.src=r+"?sdkid="+e+"&lib="+a;var n=document.getElementsByTagName("script")[0];n.parentNode.insertBefore(i,n)},o.load(wpmDataLayer.pixels.tiktok.pixel_id),o.page()}(window,document,"ttq"),ttq.track("Browse")}catch(e){console.error(e)}},e.getTikTokOrderItemIds=function(){let e=[];for(const[o,r]of Object.entries(wpmDataLayer.order.items)){var t,a;let o;o={content_type:"product",quantity:r.quantity,price:r.price},null!==(t=wpmDataLayer)&&void 0!==t&&null!==(a=t.general)&&void 0!==a&&a.variationsOutput&&0!==r.variation_id?(o.content_id=String(wpmDataLayer.products[r.variation_id].dyn_r_ids[wpmDataLayer.pixels.bing.dynamic_remarketing.id_type]),o.content_name=wpmDataLayer.products[r.variation_id].name,e.push(o)):(o.content_id=String(wpmDataLayer.products[r.id].dyn_r_ids[wpmDataLayer.pixels.bing.dynamic_remarketing.id_type]),o.content_name=wpmDataLayer.products[r.id].name,e.push(o))}return e}}(window.wpm=window.wpm||{},jQuery),jQuery(document).on("wpmLoadPixels",(function(){var e,t,a,o,r,i;null===(e=wpmDataLayer)||void 0===e||null===(t=e.pixels)||void 0===t||null===(a=t.tiktok)||void 0===a||!a.pixel_id||null!==(o=wpmDataLayer)&&void 0!==o&&null!==(r=o.pixels)&&void 0!==r&&null!==(i=r.tiktok)&&void 0!==i&&i.loaded||wpm.canIFire("ads","tiktok-ads")&&wpm.loadTikTokPixel()})),jQuery(document).on("wpmAddToCart",(function(e,t){try{var a,o,r;if(null===(a=wpmDataLayer)||void 0===a||null===(o=a.pixels)||void 0===o||null===(r=o.tiktok)||void 0===r||!r.loaded)return;ttq.track("AddToCart",{content_id:t.dyn_r_ids[wpmDataLayer.pixels.tiktok.dynamic_remarketing.id_type],content_type:"product",content_name:t.name,quantity:t.quantity,value:t.price,currency:t.currency})}catch(e){console.error(e)}})),jQuery(document).on("wpmBeginCheckout",(function(e){try{var t,a,o;if(null===(t=wpmDataLayer)||void 0===t||null===(a=t.pixels)||void 0===a||null===(o=a.tiktok)||void 0===o||!o.loaded)return;ttq.track("InitiateCheckout")}catch(e){console.error(e)}})),jQuery(document).on("wpmViewItem",(function(e,t){try{var a,o,r;if(null===(a=wpmDataLayer)||void 0===a||null===(o=a.pixels)||void 0===o||null===(r=o.tiktok)||void 0===r||!r.loaded)return;ttq.track("ViewContent",{content_id:t.dyn_r_ids[wpmDataLayer.pixels.tiktok.dynamic_remarketing.id_type],content_type:"product",content_name:t.name,quantity:t.quantity,value:t.price,currency:t.currency})}catch(e){console.error(e)}})),jQuery(document).on("wpmAddToWishlist",(function(e,t){try{var a,o,r;if(null===(a=wpmDataLayer)||void 0===a||null===(o=a.pixels)||void 0===o||null===(r=o.tiktok)||void 0===r||!r.loaded)return;ttq.track("AddToWishlist",{content_id:t.dyn_r_ids[wpmDataLayer.pixels.tiktok.dynamic_remarketing.id_type],content_type:"product",content_name:t.name,quantity:t.quantity,value:t.price,currency:t.currency})}catch(e){console.error(e)}})),jQuery(document).on("wpmSearch",(function(){try{var e,t,a;if(null===(e=wpmDataLayer)||void 0===e||null===(t=e.pixels)||void 0===t||null===(a=t.tiktok)||void 0===a||!a.loaded)return;ttq.track("Search")}catch(e){console.error(e)}})),jQuery(document).on("wpmOrderReceivedPage",(function(){try{var e,t,a;if(null===(e=wpmDataLayer)||void 0===e||null===(t=e.pixels)||void 0===t||null===(a=t.tiktok)||void 0===a||!a.loaded)return;ttq.track(wpmDataLayer.pixels.tiktok.purchase_event_name,{value:wpmDataLayer.order.value_filtered,currency:wpmDataLayer.order.currency,contents:wpm.getTikTokOrderItemIds()})}catch(e){console.error(e)}}))},574:()=>{!function(e,t,a){e.loadTwitterPixel=function(){try{wpmDataLayer.pixels.twitter.loaded=!0,e=window,t=document,a="script",e.twq||(o=e.twq=function(){o.exe?o.exe.apply(o,arguments):o.queue.push(arguments)},o.version="1.1",o.queue=[],(r=t.createElement(a)).async=!0,r.src="//static.ads-twitter.com/uwt.js",(i=t.getElementsByTagName(a)[0]).parentNode.insertBefore(r,i)),twq("init",wpmDataLayer.pixels.twitter.pixel_id),twq("track","PageView")}catch(e){console.error(e)}var e,t,a,o,r,i},e.twitterGetOrderContentIds=function(){let e=[];for(const[o,r]of Object.entries(wpmDataLayer.order.items)){var t,a;null!==(t=wpmDataLayer)&&void 0!==t&&null!==(a=t.general)&&void 0!==a&&a.variationsOutput&&0!==r.variation_id?e.push(String(wpmDataLayer.products[r.variation_id].dyn_r_ids[wpmDataLayer.pixels.twitter.dynamic_remarketing.id_type])):e.push(String(wpmDataLayer.products[r.id].dyn_r_ids[wpmDataLayer.pixels.twitter.dynamic_remarketing.id_type]))}return e}}(window.wpm=window.wpm||{},jQuery),jQuery(document).on("wpmLoadPixels",(function(){var e,t,a,o,r,i;null===(e=wpmDataLayer)||void 0===e||null===(t=e.pixels)||void 0===t||null===(a=t.twitter)||void 0===a||!a.pixel_id||null!==(o=wpmDataLayer)&&void 0!==o&&null!==(r=o.pixels)&&void 0!==r&&null!==(i=r.twitter)&&void 0!==i&&i.loaded||wpm.canIFire("ads","twitter-ads")&&wpm.loadTwitterPixel()})),jQuery(document).on("wpmAddToCart",(function(e,t){try{var a,o,r;if(null===(a=wpmDataLayer)||void 0===a||null===(o=a.pixels)||void 0===o||null===(r=o.twitter)||void 0===r||!r.loaded)return;twq("track","AddToCart")}catch(e){console.error(e)}})),jQuery(document).on("wpmViewItem",(function(e,t){try{var a,o,r;if(null===(a=wpmDataLayer)||void 0===a||null===(o=a.pixels)||void 0===o||null===(r=o.twitter)||void 0===r||!r.loaded)return;twq("track","ViewContent")}catch(e){console.error(e)}})),jQuery(document).on("wpmAddToWishlist",(function(e,t){try{var a,o,r;if(null===(a=wpmDataLayer)||void 0===a||null===(o=a.pixels)||void 0===o||null===(r=o.twitter)||void 0===r||!r.loaded)return;twq("track","AddToWishlist")}catch(e){console.error(e)}})),jQuery(document).on("wpmBeginCheckout",(function(e,t){try{var a,o,r;if(null===(a=wpmDataLayer)||void 0===a||null===(o=a.pixels)||void 0===o||null===(r=o.twitter)||void 0===r||!r.loaded)return;twq("track","InitiateCheckout")}catch(e){console.error(e)}})),jQuery(document).on("wpmSearch",(function(){try{var e,t,a;if(null===(e=wpmDataLayer)||void 0===e||null===(t=e.pixels)||void 0===t||null===(a=t.twitter)||void 0===a||!a.loaded)return;twq("track","Search")}catch(e){console.error(e)}})),jQuery(document).on("wpmOrderReceivedPage",(function(){try{var e,t,a;if(null===(e=wpmDataLayer)||void 0===e||null===(t=e.pixels)||void 0===t||null===(a=t.twitter)||void 0===a||!a.loaded)return;twq("track","Purchase",{order_id:wpmDataLayer.order.id,value:wpmDataLayer.order.value_filtered,currency:wpmDataLayer.order.currency,num_items:wpmDataLayer.order.quantity,content_ids:wpm.twitterGetOrderContentIds()})}catch(e){console.error(e)}}))},560:()=>{wpm.wpmDataLayerExists().then((function(){console.log("WooCommerce Pixel Manager: "+(wpmDataLayer.version.pro?"Pro":"Free")+" Version "+wpmDataLayer.version.number+" loaded"),jQuery(document).trigger("wpmPreLoadPixels",{})})).then((function(){wpm.pageLoaded().then((function(){jQuery(document).trigger("wpmLoad",{})}))}))},230:()=>{!function(e,t,a){const o="_wpm_order_ids",r="_wpm_endpoint_available",i="/wp-json/";function n(){return""!==e.getCookie(o)}e.emailSelected=!1,e.paymentMethodSelected=!1,e.useRestEndpoint=function(){return e.isSessionStorageAvailable()&&e.isRestEndpointAvailable()&&e.isBelowRestErrorThreshold()},e.isBelowRestErrorThreshold=function(){return window.sessionStorage.getItem(0)<=10},e.isRestEndpointAvailable=function(){if(window.sessionStorage.getItem(r))return JSON.parse(window.sessionStorage.getItem(r));e.testEndpoint()},e.isSessionStorageAvailable=function(){return!!window.sessionStorage},e.testEndpoint=function(){let e=arguments.length>0&&arguments[0]!==a?arguments[0]:location.protocol+"//"+location.host+i,t=arguments.length>1&&arguments[1]!==a?arguments[1]:r;jQuery.ajax(e,{type:"HEAD",timeout:1e3,statusCode:{200:function(e){window.sessionStorage.setItem(t,JSON.stringify(!0))},404:function(e){window.sessionStorage.setItem(t,JSON.stringify(!1))},0:function(e){window.sessionStorage.setItem(t,JSON.stringify(!1))}}}).then((e=>{}))},e.isWpmRestEndpointAvailable=function(){let t=arguments.length>0&&arguments[0]!==a?arguments[0]:r;return!!e.getCookie(t)},e.writeOrderIdToStorage=function(t){if(window.Storage)if(null===localStorage.getItem(o)){let e=[];e.push(t),window.localStorage.setItem(o,JSON.stringify(e))}else{let e=JSON.parse(localStorage.getItem(o));e.includes(t)||(e.push(t),window.localStorage.setItem(o,JSON.stringify(e)))}else{let a=new Date;a.setDate(a.getDate()+365);let r=[];n()&&(r=JSON.parse(e.getCookie(o))),r.includes(t)||(r.push(t),document.cookie="_wpm_order_ids="+JSON.stringify(r)+";expires="+a.toUTCString())}"function"==typeof e.storeOrderIdOnServer&&wpmDataLayer.orderDeduplication&&e.storeOrderIdOnServer(t)},e.isOrderIdStored=function(t){return wpmDataLayer.orderDeduplication?window.Storage?null!==localStorage.getItem(o)&&JSON.parse(localStorage.getItem(o)).includes(t):!!n()&&JSON.parse(e.getCookie(o)).includes(t):(console.log("order duplication prevention: off"),!1)},e.isEmail=function(e){return/^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/.test(e)},e.removeProductFromCart=function(t){let o=arguments.length>1&&arguments[1]!==a?arguments[1]:null;try{if(!t)throw Error("Wasn't able to retrieve a productId");if(!(t=getIdBasedOndVariationsOutputSetting(t)))throw Error("Wasn't able to retrieve a productId");let a;if(a=null==o?wpmDataLayer.cart[t].quantity:o,wpmDataLayer.cart[t]){let r=e.getProductDetailsFormattedForEvent(t,a);jQuery(document).trigger("wpmRemoveFromCart",r),null==o||wpmDataLayer.cart[t].quantity===o?(delete wpmDataLayer.cart[t],sessionStorage&&sessionStorage.setItem("wpmDataLayerCart",JSON.stringify(wpmDataLayer.cart))):(wpmDataLayer.cart[t].quantity=wpmDataLayer.cart[t].quantity-a,sessionStorage&&sessionStorage.setItem("wpmDataLayerCart",JSON.stringify(wpmDataLayer.cart)))}}catch(e){console.error(e)}},getIdBasedOndVariationsOutputSetting=function(e){try{var t,a;return null!==(t=wpmDataLayer)&&void 0!==t&&null!==(a=t.general)&&void 0!==a&&a.variationsOutput?e:wpmDataLayer.products[e].isVariation?wpmDataLayer.products[e].parentId:e}catch(e){console.error(e)}},e.addProductToCart=function(t,a){try{var o;if(!t)throw Error("Wasn't able to retrieve a productId");if(!(t=getIdBasedOndVariationsOutputSetting(t)))throw Error("Wasn't able to retrieve a productId");if(null!==(o=wpmDataLayer)&&void 0!==o&&o.products[t]){var r;let o=e.getProductDetailsFormattedForEvent(t,a);jQuery(document).trigger("wpmAddToCart",o),null!==(r=wpmDataLayer)&&void 0!==r&&r.cart[t]?wpmDataLayer.cart[t].quantity=wpmDataLayer.cart[t].quantity+a:("cart"in wpmDataLayer||(wpmDataLayer.cart={}),wpmDataLayer.cart[t]=e.getProductDetailsFormattedForEvent(t,a)),sessionStorage&&sessionStorage.setItem("wpmDataLayerCart",JSON.stringify(wpmDataLayer.cart))}}catch(t){console.error(t),e.getCartItemsFromBackend()}},e.getCartItems=function(){sessionStorage?sessionStorage.getItem("wpmDataLayerCart")&&"order_received_page"!==wpmDataLayer.shop.page_type?e.saveCartObjectToDataLayer(JSON.parse(sessionStorage.getItem("wpmDataLayerCart"))):sessionStorage.setItem("wpmDataLayerCart",JSON.stringify({})):e.getCartItemsFromBackend()},e.getCartItemsFromBackend=function(){try{let t={action:"wpm_get_cart_items"};jQuery.ajax({type:"get",dataType:"json",url:e.ajax_url,data:t,success:function(t){t.cart||(t.cart={}),e.saveCartObjectToDataLayer(t.cart),sessionStorage&&sessionStorage.setItem("wpmDataLayerCart",JSON.stringify(t.cart))}})}catch(e){console.error(e)}},e.getProductsFromBackend=function(t){if((t=t.filter((e=>!wpmDataLayer.products.hasOwnProperty(e))))&&0!==t.length)try{let a={action:"wpm_get_product_ids",productIds:t};jQuery.ajax({type:"get",dataType:"json",url:e.ajax_url,data:a,success:function(e){wpmDataLayer.products=Object.assign({},wpmDataLayer.products,e)},error:function(e){console.log(e)}})}catch(e){console.error(e)}},e.saveCartObjectToDataLayer=function(e){wpmDataLayer.cart=e,wpmDataLayer.products=Object.assign({},wpmDataLayer.products,e)},e.fireCheckoutOption=function(e){let t=arguments.length>1&&arguments[1]!==a?arguments[1]:null,o=arguments.length>2&&arguments[2]!==a?arguments[2]:null,r={step:e,checkout_option:t,value:o};jQuery(document).trigger("wpmFireCheckoutOption",r)},e.fireCheckoutProgress=function(e){let t={step:e};jQuery(document).trigger("wpmFireCheckoutProgress",t)},e.getPostIdFromString=function(e){try{return e.match(/(post-)(\d+)/)[2]}catch(e){console.error(e)}},e.triggerViewItemList=function(t){if(!t)throw Error("Wasn't able to retrieve a productId");if(!(t=getIdBasedOndVariationsOutputSetting(t)))throw Error("Wasn't able to retrieve a productId");jQuery(document).trigger("wpmViewItemList",e.getProductDataForViewItemEvent(t))},e.getProductDataForViewItemEvent=function(t){if(!t)throw Error("Wasn't able to retrieve a productId");try{if(wpmDataLayer.products[t])return e.getProductDetailsFormattedForEvent(t)}catch(e){console.error(e)}},e.getMainProductIdFromProductPage=function(){try{return["simple","variable","grouped","composite","bundle"].indexOf(wpmDataLayer.shop.product_type)>=0&&jQuery(".wpmProductId:first").data("id")}catch(e){console.error(e)}},e.viewItemListTriggerTestMode=function(e){jQuery(e).css({position:"relative"}),jQuery(e).append('<div id="viewItemListTriggerOverlay"></div>'),jQuery(e).find("#viewItemListTriggerOverlay").css({"z-index":"10",display:"block",position:"absolute",height:"100%",top:"0",left:"0",right:"0",opacity:wpmDataLayer.viewItemListTrigger.opacity,"background-color":wpmDataLayer.viewItemListTrigger.backgroundColor})},e.getSearchTermFromUrl=function(){try{return new URLSearchParams(window.location.search).get("s")}catch(e){console.error(e)}};let l,d={};e.observerCallback=function(t,a){t.forEach((t=>{try{let o,r=jQuery(t.target).data("ioid");if(o=jQuery(t.target).next(".wpmProductId").length?jQuery(t.target).next(".wpmProductId").data("id"):jQuery(t.target).find(".wpmProductId").data("id"),!o)throw Error("wpmProductId element not found");t.isIntersecting?d[r]=setTimeout((()=>{e.triggerViewItemList(o),wpmDataLayer.viewItemListTrigger.testMode&&e.viewItemListTriggerTestMode(t.target),!1===wpmDataLayer.viewItemListTrigger.repeat&&a.unobserve(t.target)}),wpmDataLayer.viewItemListTrigger.timeout):(clearTimeout(d[r]),wpmDataLayer.viewItemListTrigger.testMode&&jQuery(t.target).find("#viewItemListTriggerOverlay").remove())}catch(e){console.error(e)}}))};let s,c=0;e.startIntersectionObserverToWatch=function(){try{e.urlHasParameter("vildemomode")&&(wpmDataLayer.viewItemListTrigger.testMode=!0),l=new IntersectionObserver(e.observerCallback,{threshold:wpmDataLayer.viewItemListTrigger.threshold}),s=jQuery(".wpmProductId").map((function(e,t){return jQuery(t).parent().hasClass("type-product")||jQuery(t).parent().hasClass("product")||jQuery(t).parent().hasClass("product-item-inner")?jQuery(t).parent():jQuery(t).prev().hasClass("wc-block-grid__product")||jQuery(t).prev().hasClass("product")||jQuery(t).prev().hasClass("product-small")||jQuery(t).prev().hasClass("woocommerce-LoopProduct-link")?jQuery(this).prev():jQuery(t).closest(".product").length?jQuery(t).closest(".product"):void 0})),s.each((function(e,t){jQuery(t[0]).data("ioid",c++),l.observe(t[0])}))}catch(e){console.error(e)}},e.startProductsMutationObserverToWatch=function(){try{let e=jQuery(".wpmProductId:eq(0)").parents().has(jQuery(".wpmProductId:eq(1)").parents()).first();e.length&&u.observe(e[0],{attributes:!0,childList:!0,characterData:!0})}catch(e){console.error(e)}};let u=new MutationObserver((function(e){e.forEach((function(e){let t=e.addedNodes;null!==t&&jQuery(t).each((function(){(jQuery(this).hasClass("type-product")||jQuery(this).hasClass("product-small")||jQuery(this).hasClass("wc-block-grid__product"))&&p(this)&&(jQuery(this).data("ioid",c++),l.observe(this))}))}))})),p=function(e){return!(!jQuery(e).find(".wpmProductId").length&&!jQuery(e).siblings(".wpmProductId").length)};e.setCookie=function(e){let t=arguments.length>1&&arguments[1]!==a?arguments[1]:"",o=arguments.length>2&&arguments[2]!==a?arguments[2]:null;if(o){let a=new Date;a.setTime(a.getTime()+24*o*60*60*1e3);let r="expires="+a.toUTCString();document.cookie=e+"="+t+";"+r+";path=/"}else document.cookie=e+"="+t+";path=/"},e.getCookie=function(e){let t=e+"=",a=decodeURIComponent(document.cookie).split(";");for(let e=0;e<a.length;e++){let o=a[e];for(;" "==o.charAt(0);)o=o.substring(1);if(0==o.indexOf(t))return o.substring(t.length,o.length)}return""},e.getWpmSessionData=function(){if(window.sessionStorage){let e=window.sessionStorage.getItem("_wpm");return null!==e?JSON.parse(e):{}}return{}},e.setWpmSessionData=function(e){window.sessionStorage&&window.sessionStorage.setItem("_wpm",JSON.stringify(e))},e.storeOrderIdOnServer=function(t){try{let a={action:"wpm_purchase_pixels_fired",order_id:t,nonce:e.nonce};jQuery.ajax({type:"post",dataType:"json",url:e.ajax_url,data:a,success:function(e){!1===e.success&&console.log(e)},error:function(e){console.log(e)}})}catch(e){console.error(e)}},e.getProductIdByCartItemKeyUrl=function(e){let t,a=new URLSearchParams(e.search).get("remove_item");return t=0===wpmDataLayer.cartItemKeys[a].variation_id?wpmDataLayer.cartItemKeys[a].product_id:wpmDataLayer.cartItemKeys[a].variation_id,t},e.getAddToCartLinkProductIds=function(){return jQuery("a").map((function(){let e=jQuery(this).attr("href");if(e&&e.includes("?add-to-cart=")){let t=e.match(/(add-to-cart=)(\d+)/);if(t)return t[2]}})).get()},e.getProductDetailsFormattedForEvent=function(e){let t=arguments.length>1&&arguments[1]!==a?arguments[1]:1,o={id:e.toString(),dyn_r_ids:wpmDataLayer.products[e].dyn_r_ids,name:wpmDataLayer.products[e].name,list_name:wpmDataLayer.shop.list_name,brand:wpmDataLayer.products[e].brand,category:wpmDataLayer.products[e].category,variant:wpmDataLayer.products[e].variant,list_position:wpmDataLayer.products[e].position,quantity:t,price:wpmDataLayer.products[e].price,currency:wpmDataLayer.shop.currency,isVariable:wpmDataLayer.products[e].isVariable,isVariation:wpmDataLayer.products[e].isVariation,parentId:wpmDataLayer.products[e].parentId};return o.isVariation&&(o.parentId_dyn_r_ids=wpmDataLayer.products[e].parentId_dyn_r_ids),o},e.setReferrerToCookie=function(){e.getCookie("wpmReferrer")||e.setCookie("wpmReferrer",document.referrer)},e.getReferrerFromCookie=function(){return e.getCookie("wpmReferrer")?e.getCookie("wpmReferrer"):null},e.getClidFromBrowser=function(){let t,o=arguments.length>0&&arguments[0]!==a?arguments[0]:"gclid";return t={gclid:"_gcl_aw",dclid:"_gcl_dc"},e.getCookie(t[o])?e.getCookie(t[o]).match(/(GCL.[\d]*.)(.*)/)[2]:""},e.getUserAgent=function(){return navigator.userAgent},e.getViewPort=function(){return{width:Math.max(document.documentElement.clientWidth||0,window.innerWidth||0),height:Math.max(document.documentElement.clientHeight||0,window.innerHeight||0)}};let m=function(){let t=e.getCookie("cmplz_statistics"),a=e.getCookie("cmplz_marketing");return!(!e.getCookie("cmplz_consent_status")&&!e.getCookie("cmplz_banner-status"))&&{analytics:"allow"===t,ads:"allow"===a,visitorHasChosen:!0}},y=function(){let t=e.getCookie("cookielawinfo-checkbox-analytics")||e.getCookie("cookielawinfo-checkbox-analytiques"),a=e.getCookie("cookielawinfo-checkbox-advertisement")||e.getCookie("cookielawinfo-checkbox-publicite"),o=e.getCookie("CookieLawInfoConsent");return!(!t&&!a)&&{analytics:"yes"===t,ads:"yes"===a,visitorHasChosen:!!o}},g={categories:{},pixels:[],mode:"category",visitorHasChosen:!1};e.getConsentValues=function(){return g},e.setConsentValueCategories=function(){let e=arguments.length>0&&arguments[0]!==a&&arguments[0],t=arguments.length>1&&arguments[1]!==a&&arguments[1];g.categories.analytics=e,g.categories.ads=t},e.updateConsentCookieValues=function(){let t,o=arguments.length>0&&arguments[0]!==a&&arguments[0];if(t=e.getCookie("CookieConsent"))t=decodeURI(t),g.categories.analytics=t.indexOf("statistics:true")>=0,g.categories.ads=t.indexOf("marketing:true")>=0,g.visitorHasChosen=!0;else if(t=e.getCookie("CookieScriptConsent"))t=JSON.parse(t),"reject"===t.action?(g.categories.analytics=!1,g.categories.ads=!1):2===t.categories.length?(g.categories.analytics=!0,g.categories.ads=!0):(g.categories.analytics=t.categories.indexOf("performance")>=0,g.categories.ads=t.categories.indexOf("targeting")>=0),g.visitorHasChosen=!0;else if(t=e.getCookie("borlabs-cookie")){var r,i,n,l,d,s,c,u;t=decodeURI(t),t=JSON.parse(t),g.categories.analytics=!(null===(r=t)||void 0===r||null===(i=r.consents)||void 0===i||!i.statistics),g.categories.ads=!(null===(n=t)||void 0===n||null===(l=n.consents)||void 0===l||!l.marketing),g.visitorHasChosen=!0,g.pixels=[...(null===(d=t)||void 0===d||null===(s=d.consents)||void 0===s?void 0:s.statistics)||[],...(null===(c=t)||void 0===c||null===(u=c.consents)||void 0===u?void 0:u.marketing)||[]],g.mode="pixel"}else(t=m())?(g.categories.analytics=!0===t.analytics,g.categories.ads=!0===t.ads,g.visitorHasChosen=t.visitorHasChosen):(t=e.getCookie("cookie_notice_accepted"))?(g.categories.analytics=!0,g.categories.ads=!0,g.visitorHasChosen=!0):(t=e.getCookie("hu-consent"))?(t=JSON.parse(t),g.categories.analytics=!!t.categories[3],g.categories.ads=!!t.categories[4],g.visitorHasChosen=!0):(t=y())?(g.categories.analytics=!0===t.analytics,g.categories.ads=!0===t.ads,g.visitorHasChosen=!0===t.visitorHasChosen):(t=e.getCookie("moove_gdpr_popup"))?(t=JSON.parse(t),g.categories.analytics="1"===t.thirdparty,g.categories.ads="1"===t.advanced,g.visitorHasChosen=!0):(g.categories.analytics=!o,g.categories.ads=!o)},e.updateConsentCookieValues(),e.setConsentDefaultValuesToExplicit=function(){g.categories={analytics:!1,ads:!1}},e.canIFire=function(t,a){let o;return"category"===g.mode?o=!!g.categories[t]:"pixel"===g.mode?o=g.pixels.includes(a):(console.error("Couldn't find a valid consent mode in wpmConsentValues"),o=!1),!!o||(e.logPreventedPixelLoading(a,t),!1)},e.logPreventedPixelLoading=function(e,t){var a,o,r;null!==(a=wpmDataLayer)&&void 0!==a&&null!==(o=a.shop)&&void 0!==o&&null!==(r=o.cookie_consent_mgmt)&&void 0!==r&&r.explicit_consent?console.log('WooCommerce Pixel Manager: The "'+e+" (category: "+t+')" pixel has not fired because you have not given consent for it yet. (WPM is in explicit consent mode.)'):console.log('WooCommerce Pixel Manager: The "'+e+" (category: "+t+')" pixel has not fired because you have removed consent for this pixel. (WPM is in implicit consent mode.)')},e.scriptTagObserver=new MutationObserver((a=>{a.forEach((a=>{let{addedNodes:o}=a;[...o].forEach((a=>{t(a).data("wpm-cookie-category")&&(e.shouldScriptBeActive(a)?e.unblockScript(a):e.blockScript(a))}))}))})),e.scriptTagObserver.observe(document.head,{childList:!0,subtree:!0}),window.addEventListener("DOMContentLoaded",(()=>e.scriptTagObserver.disconnect())),e.shouldScriptBeActive=function(e){var a,o,r,i;return!((wpmDataLayer.shop.cookie_consent_mgmt.explicit_consent||g.visitorHasChosen)&&("category"!==g.mode||!t(e).data("wpm-cookie-category").split(",").some((e=>g.categories[e])))&&("pixel"!==g.mode||!g.pixels.includes(t(e).data("wpm-pixel-name")))&&("pixel"!==g.mode||"google"!==t(e).data("wpm-pixel-name")||!["google-analytics","google-ads"].some((e=>g.pixels.includes(e))))&&(null===(a=wpmDataLayer)||void 0===a||null===(o=a.pixels)||void 0===o||null===(r=o.google)||void 0===r||null===(i=r.consent_mode)||void 0===i||!i.active||"google"!==t(e).data("wpm-pixel-name")))},e.unblockScript=function(e){let o=arguments.length>1&&arguments[1]!==a&&arguments[1];o&&t(e).remove();let r=t(e).data("wpm-src");r&&t(e).attr("src",r),e.type="text/javascript",o&&t(e).appendTo("head"),jQuery(document).trigger("wpmPreLoadPixels",{})},e.blockScript=function(e){let o=arguments.length>1&&arguments[1]!==a&&arguments[1];o&&t(e).remove(),t(e).attr("src")&&t(e).removeAttr("src"),e.type="blocked/javascript",o&&t(e).appendTo("head")},e.unblockAllScripts=function(){let o=!(arguments.length>0&&arguments[0]!==a)||arguments[0],r=!(arguments.length>1&&arguments[1]!==a)||arguments[1];t.each(t('script[type="blocked/javascript"]'),(function(a,i){(t(i).data("wpm-cookie-category").includes("analytics")&&o||t(i).data("wpm-cookie-category").includes("ads")&&r)&&e.unblockScript(i,!0)})),jQuery(document).trigger("wpmPreLoadPixels",{})},e.unblockSelectedPixels=function(){t.each(t('script[type="blocked/javascript"]'),(function(a,o){(g.pixels.includes(t(o).data("wpm-pixel-name"))||"google"===t(o).data("wpm-pixel-name")&&["google-analytics","google-ads"].some((e=>g.pixels.includes(e))))&&e.unblockScript(o,!0)})),jQuery(document).trigger("wpmPreLoadPixels",{})},window.addEventListener("borlabs-cookie-consent-saved",(function(){e.updateConsentCookieValues(),"pixel"===g.mode?(e.unblockSelectedPixels(),e.updateGoogleConsentMode(g.pixels.includes("google-analytics"),g.pixels.includes("google-ads"))):(e.unblockAllScripts(g.categories.analytics,g.categories.ads),e.updateGoogleConsentMode(g.categories.analytics,g.categories.ads))})),window.addEventListener("CookiebotOnAccept",(function(){Cookiebot.consent.statistics&&(g.categories.analytics=!0),Cookiebot.consent.marketing&&(g.categories.ads=!0),e.unblockAllScripts(g.categories.analytics,g.categories.ads),e.updateGoogleConsentMode(g.categories.analytics,g.categories.ads)}),!1),window.addEventListener("CookieScriptAccept",(function(t){t.detail.categories.includes("performance")&&(g.categories.analytics=!0),t.detail.categories.includes("targeting")&&(g.categories.ads=!0),e.unblockAllScripts(g.categories.analytics,g.categories.ads),e.updateGoogleConsentMode(g.categories.analytics,g.categories.ads)})),window.addEventListener("CookieScriptAcceptAll",(function(){e.unblockAllScripts(!0,!0),e.updateGoogleConsentMode(!0,!0)})),document.addEventListener("cmplzStatusChange",(function(){e.updateConsentCookieValues(),e.unblockAllScripts(g.categories.analytics,g.categories.ads),e.updateGoogleConsentMode(g.categories.analytics,g.categories.ads)})),document.addEventListener("setCookieNotice",(function(){e.updateConsentCookieValues(),e.unblockAllScripts(g.categories.analytics,g.categories.ads),e.updateGoogleConsentMode(g.categories.analytics,g.categories.ads)})),e.huObserver=new MutationObserver((function(t){t.forEach((t=>{let{addedNodes:a}=t;[...a].forEach((t=>{"hu"===t.id&&jQuery(".hu-cookies-save").on("click",(function(){e.updateConsentCookieValues(),e.unblockAllScripts(g.categories.analytics,g.categories.ads),e.updateGoogleConsentMode(g.categories.analytics,g.categories.ads)}))}))}))})),window.hu&&e.huObserver.observe(document.documentElement||document.body,{childList:!0,subtree:!0}),e.version=function(){console.log(wpmDataLayer.version)},e.loadScriptAndCacheIt=function(e,t){return t=jQuery.extend(t||{},{dataType:"script",cache:!0,url:e}),jQuery.ajax(t)},e.getOrderItemPrice=function(e){return(e.total+e.total_tax)/e.quantity},e.hasLoginEventFired=function(){let t=e.getWpmSessionData();return null==t?void 0:t.loginEventFired},e.setLoginEventFired=function(){let t=e.getWpmSessionData();t.loginEventFired=!0,e.setWpmSessionData(t)},e.wpmDataLayerExists=function(){return new Promise((function(e){!function t(){if("undefined"!=typeof wpmDataLayer)return e();setTimeout(t,50)}()}))},e.pageLoaded=function(){return new Promise((function(e){!function t(){if("complete"===document.readyState)return e();setTimeout(t,50)}()}))},e.pageReady=function(){return new Promise((function(e){!function t(){if("interactive"===document.readyState||"complete"===document.readyState)return e();setTimeout(t,50)}()}))},e.isMiniCartActive=function(){if(window.sessionStorage){for(const[e,t]of Object.entries(window.sessionStorage))if(e.includes("wc_fragments"))return!0;return!1}return!1},e.doesWooCommerceCartExist=function(){return document.cookie.includes("woocommerce_items_in_cart")},e.urlHasParameter=function(e){return new URLSearchParams(window.location.search).has(e)},window.wpmLoaded={}}(window.wpm=window.wpm||{},jQuery),wpm.pageReady().then((function(){wpm.wpmDataLayerExists().then((function(){wpm.startIntersectionObserverToWatch(),wpm.startProductsMutationObserverToWatch()})),jQuery(document).on("click",".remove_from_cart_button, .remove",(function(){try{let e=new URL(jQuery(this).attr("href")),t=wpm.getProductIdByCartItemKeyUrl(e);wpm.removeProductFromCart(t)}catch(e){console.error(e)}})),jQuery(document).on("click",".add_to_cart_button:not(.product_type_variable), .ajax_add_to_cart, .single_add_to_cart_button",(function(){try{if("product"===wpmDataLayer.shop.page_type){if(void 0!==jQuery(this).attr("href")&&jQuery(this).attr("href").includes("add-to-cart")){let e=1,t=jQuery(this).data("product_id");wpm.addProductToCart(t,e)}else if("simple"===wpmDataLayer.shop.product_type){let e=Number(jQuery(".input-text.qty").val());e||0===e||(e=1);let t=jQuery(this).val();wpm.addProductToCart(t,e)}else if("variable"===wpmDataLayer.shop.product_type){let e=Number(jQuery(".input-text.qty").val());e||0===e||(e=1);let t=jQuery("[name='variation_id']").val();wpm.addProductToCart(t,e)}else if("grouped"===wpmDataLayer.shop.product_type)jQuery(".woocommerce-grouped-product-list-item").each((function(){let e=Number(jQuery(this).find(".input-text.qty").val());e||0===e||(e=1);let t=jQuery(this).attr("class"),a=wpm.getPostIdFromString(t);wpm.addProductToCart(a,e)}));else if("bundle"===wpmDataLayer.shop.product_type){let e=Number(jQuery(".input-text.qty").val());e||0===e||(e=1);let t=jQuery("input[name=add-to-cart]").val();wpm.addProductToCart(t,e)}}else{let e=1,t=jQuery(this).data("product_id");wpm.addProductToCart(t,e)}}catch(e){console.error(e)}})),jQuery(document).one("click","a:not(.add_to_cart_button, .ajax_add_to_cart, .single_add_to_cart_button)",(function(e){try{if(jQuery(e.target).closest("a").attr("href")){let t=jQuery(e.target).closest("a").attr("href");if(t.includes("add-to-cart=")){let e=t.match(/(add-to-cart=)(\d+)/);e&&wpm.addProductToCart(e[2],1)}}}catch(e){console.error(e)}})),jQuery(document).on("click",".woocommerce-LoopProduct-link, .wc-block-grid__product, .product, .product-small, .type-product",(function(){try{let e=jQuery(this).nextAll(".wpmProductId:first").data("id");if(e){if(e=getIdBasedOndVariationsOutputSetting(e),!e)throw Error("Wasn't able to retrieve a productId");if(wpmDataLayer.products&&wpmDataLayer.products[e]){let t=wpm.getProductDetailsFormattedForEvent(e);jQuery(document).trigger("wpmSelectContentGaUa",t),jQuery(document).trigger("wpmSelectItem",t)}}}catch(e){console.error(e)}})),jQuery(document).one("click",".checkout-button, .cart-checkout-button, .button.checkout",(function(){jQuery(document).trigger("wpmBeginCheckout")})),jQuery(document).on("input","#billing_email",(function(){wpm.isEmail(jQuery(this).val())&&(wpm.fireCheckoutProgress(2),wpm.emailSelected=!0)})),jQuery(document).on("click",".wc_payment_methods",(function(){!1===wpm.paymentMethodSelected&&wpm.fireCheckoutProgress(3),wpm.fireCheckoutOption(3,jQuery("input[name='payment_method']:checked").val()),wpm.paymentMethodSelected=!0})),jQuery(document).one("click","#place_order",(function(){!1===wpm.emailSelected&&wpm.fireCheckoutProgress(2),!1===wpm.paymentMethodSelected&&(wpm.fireCheckoutProgress(3),wpm.fireCheckoutOption(3,jQuery("input[name='payment_method']:checked").val())),wpm.fireCheckoutProgress(4)})),jQuery(document).on("click","[name='update_cart']",(function(){try{jQuery(".cart_item").each((function(){let e=new URL(jQuery(this).find(".product-remove").find("a").attr("href")),t=wpm.getProductIdByCartItemKeyUrl(e),a=jQuery(this).find(".qty").val();0===a?wpm.removeProductFromCart(t):a<wpmDataLayer.cart[t].quantity?wpm.removeProductFromCart(t,wpmDataLayer.cart[t].quantity-a):a>wpmDataLayer.cart[t].quantity&&wpm.addProductToCart(t,a-wpmDataLayer.cart[t].quantity)}))}catch(e){console.error(e),wpm.getCartItemsFromBackend()}})),jQuery(document).on("click",".add_to_wishlist, .wl-add-to",(function(){try{let e;if(jQuery(this).data("productid")?e=jQuery(this).data("productid"):jQuery(this).data("product-id")&&(e=jQuery(this).data("product-id")),!e)throw Error("Wasn't able to retrieve a productId");let t=wpm.getProductDetailsFormattedForEvent(e);jQuery(document).trigger("wpmAddToWishlist",t)}catch(e){console.error(e)}})),jQuery(document).on("updated_cart_totals",(function(){jQuery(document).trigger("wpmViewCart")})),jQuery(".single_variation_wrap").on("show_variation",(function(e,t){try{let e=getIdBasedOndVariationsOutputSetting(t.variation_id);if(!e)throw Error("Wasn't able to retrieve a productId");if(wpmDataLayer.products&&wpmDataLayer.products[e]){let t=wpm.getProductDetailsFormattedForEvent(e);jQuery(document).trigger("wpmViewItem",t)}}catch(e){console.error(e)}})),jQuery(".single_variation_wrap").on("hide_variation",(function(){try{var e,t;let a=jQuery("body").attr("class").match(/(postid-)(\d+)/)[2];if(!a)throw Error("Wasn't able to retrieve a productId");if("variable"===wpmDataLayer.shop.product_type&&null!==(e=wpmDataLayer)&&void 0!==e&&null!==(t=e.general)&&void 0!==t&&t.variationsOutput)for(const[e,t]of Object.entries(wpmDataLayer.products))if("parentId"in t){a=t.id;break}if(wpmDataLayer.products&&wpmDataLayer.products[a]){let e=wpm.getProductDetailsFormattedForEvent(a);jQuery(document).trigger("wpmViewItem",e)}}catch(e){console.error(e)}}))})),jQuery(window).on("wpmLoad",(function(){try{wpm.doesWooCommerceCartExist()&&wpm.getCartItems()}catch(e){console.error(e)}})),jQuery(window).on("wpmLoad",(function(){wpmDataLayer.products=wpmDataLayer.products||{};let e=wpm.getAddToCartLinkProductIds();wpm.getProductsFromBackend(e)})),jQuery(window).on("wpmLoad",(function(){if(!wpm.getCookie("wpmReferrer"))if(document.referrer){let e=new URL(document.referrer).hostname;e!==window.location.host?wpm.setCookie("wpmReferrer",e):wpm.setCookie("wpmReferrer","")}else wpm.setCookie("wpmReferrer","")})),jQuery(window).on("wpmLoad",(function(){try{var e;if("undefined"!=typeof wpmDataLayer&&(null===(e=wpmDataLayer)||void 0===e||!e.wpmLoadFired)){var t,a;if(jQuery(document).trigger("wpmLoadAlways"),"product"===wpmDataLayer.shop.page_type&&"variable"!==wpmDataLayer.shop.product_type&&wpm.getMainProductIdFromProductPage()){let e=wpm.getProductDataForViewItemEvent(wpm.getMainProductIdFromProductPage());jQuery(document).trigger("wpmViewItem",e)}else"product_category"===wpmDataLayer.shop.page_type?jQuery(document).trigger("wpmCategory"):"search"===wpmDataLayer.shop.page_type?jQuery(document).trigger("wpmSearch"):"cart"===wpmDataLayer.shop.page_type?jQuery(document).trigger("wpmViewCart"):"order_received_page"===wpmDataLayer.shop.page_type&&wpmDataLayer.order?wpm.isOrderIdStored(wpmDataLayer.order.id)||(jQuery(document).trigger("wpmOrderReceivedPage"),wpm.writeOrderIdToStorage(wpmDataLayer.order.id)):jQuery(document).trigger("wpmEverywhereElse");null!==(t=wpmDataLayer)&&void 0!==t&&null!==(a=t.user)&&void 0!==a&&a.id&&!wpm.hasLoginEventFired()&&(jQuery(document).trigger("wpmLogin"),wpm.setLoginEventFired()),wpmDataLayer.wpmLoadFired=!0}}catch(e){console.error(e)}})),jQuery(window).on("wpmPreLoadPixels",(function(){var e,t,a;null!==(e=wpmDataLayer)&&void 0!==e&&null!==(t=e.shop)&&void 0!==t&&null!==(a=t.cookie_consent_mgmt)&&void 0!==a&&a.explicit_consent&&wpm.updateConsentCookieValues(!0),jQuery(document).trigger("wpmLoadPixels",{})}))},514:()=>{window.wpm=window.wpm||{},jQuery}},t={};function a(o){var r=t[o];if(void 0!==r)return r.exports;var i=t[o]={exports:{}};return e[o](i,i.exports,a),i.exports}a(230),a(514),a(385),a(577),a(354),a(464),a(234),a(785),a(570),a(497),a(271),a(172),a(657),a(986),a(699),a(317),a(623),a(574),a(403),a(560)})();
2
+ //# sourceMappingURL=wpm-public__premium_only.p1.min.js.map
js/public/wpm-public__premium_only.p1.min.js.map ADDED
@@ -0,0 +1 @@
 
1
+ {"version":3,"file":"wpm-public__premium_only.p1.min.js","mappings":"uBAIC,SAAUA,EAAKC,EAAGC,GAElB,IAAIC,EAEJH,EAAII,kBAAoB,WAEvB,IACCC,aAAaC,OAAOC,SAASC,QAAS,EAG5BC,EAMuBC,OANrBC,EAM6BC,SAN3BC,EAMoC,SAL9CJ,EAAEK,MAAWC,EAAEN,EAAEK,IAAI,WAAWC,EAAEC,WACrCD,EAAEC,WAAWC,MAAMF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J,2BAAxB,OAAI,EAAyCC,kBAC5C5M,IAAIggB,2BAA0B,GAE/Bjc,OAAOnD,UAAUoD,QAAQ,gBAAiB,Q,SCh5DzCtD,OAAOV,IAAMU,OAAOV,KAAO,GAAI+D,SCH7B4f,EAA2B,GAG/B,SAASC,EAAoBC,GAE5B,IAAIC,EAAeH,EAAyBE,GAC5C,QAAqB3jB,IAAjB4jB,EACH,OAAOA,EAAaC,QAGrB,IAAIC,EAASL,EAAyBE,GAAY,CAGjDE,QAAS,IAOV,OAHAE,EAAoBJ,GAAUG,EAAQA,EAAOD,QAASH,GAG/CI,EAAOD,QCLfG,EAAQ,KACRA,EAAQ,KACRA,EAAQ,KAMRA,EAAQ,KACRA,EAAQ,KACRA,EAAQ,KACRA,EAAQ,KACRA,EAAQ,KACRA,EAAQ,KACRA,EAAQ,KAMRA,EAAQ,KACRA,EAAQ,KACRA,EAAQ,KACRA,EAAQ,KACRA,EAAQ,KACRA,EAAQ,KACRA,EAAQ,KACRA,EAAQ,KACRA,EAAQ,KAORA,EAAQ,M","sources":["webpack://WooCommerce-Pixel-Manager/./src/js/public/facebook.js","webpack://WooCommerce-Pixel-Manager/./src/js/public/facebook__premium_only.js","webpack://WooCommerce-Pixel-Manager/./src/js/public/google-ads.js","webpack://WooCommerce-Pixel-Manager/./src/js/public/google-ads__premium_only.js","webpack://WooCommerce-Pixel-Manager/./src/js/public/google-ga-4-eec__premium_only.js","webpack://WooCommerce-Pixel-Manager/./src/js/public/google-ga-4.js","webpack://WooCommerce-Pixel-Manager/./src/js/public/google-ga-ua-eec__premium_only.js","webpack://WooCommerce-Pixel-Manager/./src/js/public/google-ga-ua.js","webpack://WooCommerce-Pixel-Manager/./src/js/public/google-optimize.js","webpack://WooCommerce-Pixel-Manager/./src/js/public/google.js","webpack://WooCommerce-Pixel-Manager/./src/js/public/google__premium_only.js","webpack://WooCommerce-Pixel-Manager/./src/js/public/hotjar.js","webpack://WooCommerce-Pixel-Manager/./src/js/public/microsoft-ads__premium_only.js","webpack://WooCommerce-Pixel-Manager/./src/js/public/pinterest__premium_only.js","webpack://WooCommerce-Pixel-Manager/./src/js/public/snapchat__premium_only.js","webpack://WooCommerce-Pixel-Manager/./src/js/public/tiktok__premium_only.js","webpack://WooCommerce-Pixel-Manager/./src/js/public/twitter__premium_only.js","webpack://WooCommerce-Pixel-Manager/./src/js/public/wpm-loader.js","webpack://WooCommerce-Pixel-Manager/./src/js/public/wpm.js","webpack://WooCommerce-Pixel-Manager/./src/js/public/wpm__premium_only.js","webpack://WooCommerce-Pixel-Manager/webpack/bootstrap","webpack://WooCommerce-Pixel-Manager/./src/js/public/main-premium.js"],"sourcesContent":["/**\n * Add functions for Facebook\n * */\n\n(function (wpm, $, undefined) {\n\n\tlet fBUserData\n\n\twpm.loadFacebookPixel = function () {\n\n\t\ttry {\n\t\t\twpmDataLayer.pixels.facebook.loaded = true\n\n\t\t\t// @formatter:off\n\t\t\t!function(f,b,e,v,n,t,s)\n\t\t\t{if(f.fbq)return;n=f.fbq=function(){n.callMethod?\n\t\t\t\tn.callMethod.apply(n,arguments):n.queue.push(arguments)};\n\t\t\t\tif(!f._fbq)f._fbq=n;n.push=n;n.loaded=!0;n.version='2.0';\n\t\t\t\tn.queue=[];t=b.createElement(e);t.async=!0;\n\t\t\t\tt.src=v;s=b.getElementsByTagName(e)[0];\n\t\t\t\ts.parentNode.insertBefore(t,s)}(window, document,'script',\n\t\t\t\t'https://connect.facebook.net/en_US/fbevents.js');\n\t\t\t// @formatter:on\n\n\t\t\tfbq(\"init\", wpmDataLayer.pixels.facebook.pixel_id)\n\t\t\tfbq(\"track\", \"PageView\")\n\n\t\t} catch (e) {\n\t\t\tconsole.error(e)\n\t\t}\n\t}\n\n\twpm.getRandomEventId = function () {\n\t\treturn (Math.random() + 1).toString(36).substring(2)\n\t}\n\n\twpm.getFbUserData = function () {\n\t\t// We need the first one for InitiateCheckout\n\t\t// where getting the user_data from the browser is too slow\n\t\t// using wpm.getCookie(), so we cache the user_data earlier.\n\t\t// And we need the second one because the ViewContent hit happens too fast\n\t\t// after adding a variation to the cart because the function to cache\n\t\t// the user_data is too slow. But we can get the user_data using wpm.getCookie()\n\t\t// because we don't move away from the page and can wait for the browser\n\t\t// to get it.\n\t\tif (fBUserData) {\n\t\t\treturn fBUserData\n\t\t} else {\n\t\t\treturn wpm.getFbUserDataFromBrowser()\n\t\t}\n\t}\n\n\twpm.setFbUserData = function () {\n\t\tfBUserData = wpm.getFbUserDataFromBrowser()\n\t}\n\n\twpm.getFbUserDataFromBrowser = function () {\n\t\treturn {\n\t\t\tfbp : wpm.getCookie(\"_fbp\"),\n\t\t\tfbc : wpm.getCookie(\"_fbc\"),\n\t\t\tclient_user_agent: navigator.userAgent,\n\t\t}\n\t}\n\n\twpm.fbViewContent = function (product) {\n\n\t\ttry {\n\t\t\tif (!wpmDataLayer?.pixels?.facebook?.loaded) return\n\n\t\t\tlet eventId = wpm.getRandomEventId()\n\n\t\t\tfbq(\"track\", \"ViewContent\", {\n\t\t\t\tcontent_type: \"product\",\n\t\t\t\tcontent_name: product.name,\n\t\t\t\t// content_category: product.category,\n\t\t\t\tcontent_ids: product.dyn_r_ids[wpmDataLayer.pixels.facebook.dynamic_remarketing.id_type],\n\t\t\t\tcurrency : wpmDataLayer.shop.currency,\n\t\t\t\tvalue : product.price,\n\t\t\t}, {\n\t\t\t\teventID: eventId,\n\t\t\t})\n\n\t\t\tproduct[\"currency\"] = wpmDataLayer.shop.currency\n\n\t\t\tjQuery(document).trigger(\"wpmFbCapiEvent\", {\n\t\t\t\tevent_name : \"ViewContent\",\n\t\t\t\tevent_id : eventId,\n\t\t\t\tuser_data : wpm.getFbUserData(),\n\t\t\t\tproduct_data : product,\n\t\t\t\tproduct_id : product.dyn_r_ids[wpmDataLayer.pixels.facebook.dynamic_remarketing.id_type],\n\t\t\t\tevent_source_url: window.location.href,\n\t\t\t})\n\t\t} catch (e) {\n\t\t\tconsole.error(e)\n\t\t}\n\t}\n\n\twpm.facebookContentIds = function () {\n\t\tlet prodIds = []\n\n\t\tfor (const [key, item] of Object.entries(wpmDataLayer.order.items)) {\n\n\t\t\tif (wpmDataLayer?.general?.variationsOutput && 0 !== item.variation_id) {\n\t\t\t\tprodIds.push(String(wpmDataLayer.products[item.variation_id].dyn_r_ids[wpmDataLayer.pixels.facebook.dynamic_remarketing.id_type]))\n\t\t\t} else {\n\t\t\t\tprodIds.push(String(wpmDataLayer.products[item.id].dyn_r_ids[wpmDataLayer.pixels.facebook.dynamic_remarketing.id_type]))\n\t\t\t}\n\t\t}\n\n\t\treturn prodIds\n\t}\n\n}(window.wpm = window.wpm || {}, jQuery));\n\n\n/**\n * Execute as soon as possible\n * */\n\n(function () {\n\n\tjQuery(document).on(\"wpmLoadPixels\", function () {\n\n\t\tif (wpmDataLayer?.pixels?.facebook?.pixel_id && !wpmDataLayer?.pixels?.facebook?.loaded) {\n\t\t\tif (wpm.canIFire(\"ads\", \"facebook-ads\")) wpm.loadFacebookPixel()\n\t\t}\n\t})\n\n})()\n\n\n/**\n * All event listeners\n * */\n\n// AddToCart event\njQuery(document).on(\"wpmAddToCart\", function (event, product) {\n\n\ttry {\n\t\tif (!wpmDataLayer?.pixels?.facebook?.loaded) return\n\n\t\tlet eventId = wpm.getRandomEventId()\n\n\t\t// console.log('eventId: ' + eventId);\n\n\t\tfbq(\"track\", \"AddToCart\", {\n\t\t\tcontent_type: \"product\",\n\t\t\tcontent_name: product.name,\n\t\t\tcontent_ids : product.dyn_r_ids[wpmDataLayer.pixels.facebook.dynamic_remarketing.id_type],\n\t\t\tvalue : parseFloat(product.quantity * product.price),\n\t\t\tcurrency : product.currency,\n\t\t}, {\n\t\t\teventID: eventId,\n\t\t})\n\n\n\t\tproduct[\"currency\"] = wpmDataLayer.shop.currency\n\n\t\tjQuery(document).trigger(\"wpmFbCapiEvent\", {\n\t\t\tevent_name : \"AddToCart\",\n\t\t\tevent_id : eventId,\n\t\t\tuser_data : wpm.getFbUserData(),\n\t\t\tproduct_data : product,\n\t\t\tproduct_id : product.dyn_r_ids[wpmDataLayer.pixels.facebook.dynamic_remarketing.id_type],\n\t\t\tevent_source_url: window.location.href,\n\t\t})\n\t} catch (e) {\n\t\tconsole.error(e)\n\t}\n})\n\n// InitiateCheckout event\njQuery(document).on(\"wpmBeginCheckout\", function (event) {\n\n\ttry {\n\t\t// console.log('firing facebook ads InitiateCheckout event');\n\n\t\tif (!wpmDataLayer?.pixels?.facebook?.loaded) return\n\n\t\tlet eventId = wpm.getRandomEventId()\n\n\t\tfbq(\"track\", \"InitiateCheckout\", {}, {\n\t\t\teventID: eventId,\n\t\t})\n\n\t\tjQuery(document).trigger(\"wpmFbCapiEvent\", {\n\t\t\tevent_name : \"InitiateCheckout\",\n\t\t\tevent_id : eventId,\n\t\t\tuser_data : wpm.getFbUserData(),\n\t\t\tevent_source_url: window.location.href,\n\t\t})\n\t} catch (e) {\n\t\tconsole.error(e)\n\t}\n})\n\n// AddToWishlist event\njQuery(document).on(\"wpmAddToWishlist\", function (event, product) {\n\n\ttry {\n\t\t// console.log('firing facebook ads AddToWishlist event');\n\t\t// console.log(product);\n\n\t\tif (!wpmDataLayer?.pixels?.facebook?.loaded) return\n\n\t\tlet eventId = wpm.getRandomEventId()\n\n\t\tfbq(\"track\", \"AddToWishlist\", {\n\t\t\tcontent_type: \"product\",\n\t\t\tcontent_name: product.name,\n\t\t\tcontent_ids : product.dyn_r_ids[wpmDataLayer.pixels.facebook.dynamic_remarketing.id_type],\n\t\t\tvalue : parseFloat(product.quantity * product.price),\n\t\t\tcurrency : product.currency,\n\t\t}, {\n\t\t\teventID: eventId,\n\t\t})\n\n\n\t\tproduct[\"currency\"] = wpmDataLayer.shop.currency\n\n\t\tjQuery(document).trigger(\"wpmFbCapiEvent\", {\n\t\t\tevent_name : \"AddToWishlist\",\n\t\t\tevent_id : eventId,\n\t\t\tuser_data : wpm.getFbUserData(),\n\t\t\tproduct_data : product,\n\t\t\tproduct_id : product.dyn_r_ids[wpmDataLayer.pixels.facebook.dynamic_remarketing.id_type],\n\t\t\tevent_source_url: window.location.href,\n\t\t})\n\t} catch (e) {\n\t\tconsole.error(e)\n\t}\n})\n\n// ViewContent event\njQuery(document).on(\"wpmViewItem\", function (event, product) {\n\n\ttry {\n\t\t// console.log('firing facebook ads ViewContent event');\n\t\t// console.log(product);\n\n\t\tif (!wpmDataLayer?.pixels?.facebook?.loaded) return\n\n\t\twpm.fbViewContent(product)\n\t} catch (e) {\n\t\tconsole.error(e)\n\t}\n})\n\n// view search event\njQuery(document).on(\"wpmSearch\", function () {\n\n\ttry {\n\t\tif (!wpmDataLayer?.pixels?.facebook?.loaded) return\n\n\t\tlet eventId = wpm.getRandomEventId()\n\n\t\tfbq(\"track\", \"Search\", {}, {\n\t\t\teventID: eventId,\n\t\t})\n\n\t\tjQuery(document).trigger(\"wpmFbCapiEvent\", {\n\t\t\tevent_name : \"Search\",\n\t\t\tevent_id : eventId,\n\t\t\tuser_data : wpm.getFbUserData(),\n\t\t\tevent_source_url: window.location.href,\n\t\t})\n\t} catch (e) {\n\t\tconsole.error(e)\n\t}\n})\n\n// load always event\njQuery(document).on(\"wpmLoadAlways\", function () {\n\n\ttry {\n\t\tif (!wpmDataLayer?.pixels?.facebook?.loaded) return\n\n\t\twpm.setFbUserData()\n\t} catch (e) {\n\t\tconsole.error(e)\n\t}\n})\n\n// view order received page event\n// https://developers.pinterest.com/docs/tag/conversion/\njQuery(document).on(\"wpmOrderReceivedPage\", function () {\n\n\ttry {\n\t\tif (!wpmDataLayer?.pixels?.facebook?.loaded) return\n\n\t\tfbq(\"track\", \"Purchase\",\n\t\t\t{\n\t\t\t\tcontent_type: \"product\",\n\t\t\t\tvalue : wpmDataLayer.order.value_filtered,\n\t\t\t\tcurrency : wpmDataLayer.order.currency,\n\t\t\t\tcontent_ids : wpm.facebookContentIds(),\n\t\t\t},\n\t\t\t{eventID: wpmDataLayer.order.id},\n\t\t)\n\n\n\t\t// console.log(wpm.facebookContentIds())\n\t} catch (e) {\n\t\tconsole.error(e)\n\t}\n})\n","/**\n * Add functions for Facebook (pro)\n * */\n\n(function (wpm, $, undefined) {\n\n\twpm.setFacebookIdentifiersOnServer = function () {\n\n\t\ttry {\n\n\t\t\t// get first party cookies fbp and fbc\n\n\t\t\t// send the cookies to the server in order to save them on the session\n\n\t\t\tlet data = {\n\t\t\t\taction: \"wpm_facebook_set_session_identifiers\",\n\t\t\t\t// nonce : wpm_facebook_premium_only_ajax_object.nonce,\n\t\t\t\tnonce: wpm.nonce,\n\t\t\t\tfbp : wpm.getCookie(\"_fbp\"),\n\t\t\t\tfbc : wpm.getCookie(\"_fbc\"),\n\t\t\t}\n\n\t\t\tif (data.fbp && window.sessionStorage && window.sessionStorage.getItem(\"wpm_fb_session_id_\" + data.fbp + \"_set\")) {\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\tjQuery.ajax(\n\t\t\t\t{\n\t\t\t\t\ttype : \"post\",\n\t\t\t\t\tdataType: \"json\",\n\t\t\t\t\t// url : wpm_facebook_premium_only_ajax_object.ajax_url,\n\t\t\t\t\turl : wpm.ajax_url,\n\t\t\t\t\tdata : data,\n\t\t\t\t\tsuccess: function (response) {\n\t\t\t\t\t\t// console.log(response);\n\n\t\t\t\t\t\tif (window.sessionStorage && response[\"success\"] === true) {\n\t\t\t\t\t\t\t// console.log('setting session storage');\n\t\t\t\t\t\t\twindow.sessionStorage.setItem(\"wpm_fb_session_id_\" + data.fbp + \"_set\", JSON.stringify(true))\n\t\t\t\t\t\t}\n\t\t\t\t\t},\n\t\t\t\t\terror : function (response) {\n\t\t\t\t\t\t// console.log(response);\n\t\t\t\t\t},\n\t\t\t\t})\n\n\t\t} catch (e) {\n\t\t\tconsole.error(e)\n\t\t}\n\t}\n\n}(window.wpm = window.wpm || {}, jQuery))\n\n\n/**\n * All event listeners\n * */\n\n\n// add_to_cart event\njQuery(document).on(\"wpmAddToWishlist\", function (event, product) {\n\n\ttry {\n\t\tif (!wpmDataLayer?.pixels?.facebook?.loaded) return\n\n\t\tfbq(\"track\", \"AddToWishlist\", {\n\t\t\tcontent_name : product.name,\n\t\t\tcontent_category: product.category,\n\t\t\tcontent_ids : product.dyn_r_ids[wpmDataLayer.pixels.facebook.dynamic_remarketing.id_type],\n\t\t\t// contents : \"\",\n\t\t\tcurrency: product.currency,\n\t\t\tvalue : product.price,\n\t\t})\n\t} catch (e) {\n\t\tconsole.error(e)\n\t}\n})\n\njQuery(document).on(\"wpmFbCapiEvent\", function (event, eventData) {\n\n\ttry {\n\t\tif (!wpmDataLayer.pixels.facebook.capi) return\n\n\t\t// save the state in the database\n\t\tlet data = {\n\t\t\taction: \"wpm_facebook_capi_event\",\n\t\t\tdata : eventData,\n\t\t\t// nonce : wpm_facebook_premium_only_ajax_object.nonce,\n\t\t\tnonce: wpm.nonce,\n\t\t}\n\n\t\tjQuery.ajax(\n\t\t\t{\n\t\t\t\ttype : \"post\",\n\t\t\t\tdataType: \"json\",\n\t\t\t\t// url : wpm_facebook_premium_only_ajax_object.ajax_url,\n\t\t\t\turl : wpm.ajax_url,\n\t\t\t\tdata : data,\n\t\t\t\tsuccess: function (msg) {\n\t\t\t\t\t// console.log(msg);\n\t\t\t\t},\n\t\t\t\terror : function (msg) {\n\t\t\t\t\t// console.log(msg);\n\t\t\t\t},\n\t\t\t})\n\t} catch (e) {\n\t\tconsole.error(e)\n\t}\n})\n\n\njQuery(window).on(\"wpmLoadAlways\", function () {\n\n\ttry {\n\t\tif (wpmDataLayer?.pixels?.facebook?.pixel_id && wpmDataLayer.pixels.facebook.capi) {\n\n\t\t\t// We need to be sure that we capture the cid early enough, because the\n\t\t\t// shop might be using a one click checkout button as early as on the product page.\n\t\t\tif ([\"cart\", \"checkout\"].indexOf(wpmDataLayer.shop.page_type) >= 0) {\n\n\t\t\t\twpm.setFacebookIdentifiersOnServer()\n\t\t\t}\n\t\t}\n\t} catch (e) {\n\t\tconsole.error(e)\n\t}\n})\n","/**\n * Add functions for Google Ads\n * */\n\n(function (wpm, $, undefined) {\n\n\tlet conversionIdentifiers = []\n\n\twpm.getGoogleAdsConversionIdentifiersWithLabel = function () {\n\t\tfor (const [key, item] of Object.entries(wpmDataLayer.pixels.google.ads.conversionIds)) {\n\t\t\tconversionIdentifiers.push(key + \"/\" + item)\n\t\t}\n\t\treturn conversionIdentifiers\n\t}\n\n\twpm.getGoogleAdsConversionIdentifiers = function () {\n\n\t\tlet conversionIdentifiers = []\n\t\tfor (const [key, item] of Object.entries(wpmDataLayer.pixels.google.ads.conversionIds)) {\n\t\t\tconversionIdentifiers.push(key)\n\t\t}\n\n\t\treturn conversionIdentifiers\n\t}\n\n\twpm.getGoogleAdsRegularOrderItems = function () {\n\t\t// \"id\" : \"gla_34\",\n\t\t// \"quantity\": 1,\n\t\t// \"price\" : 45\n\n\t\tlet orderItems = []\n\n\t\tfor (const [key, item] of Object.entries(wpmDataLayer.order.items)) {\n\n\t\t\tlet orderItem\n\n\t\t\torderItem = {\n\t\t\t\tquantity: item.quantity,\n\t\t\t\tprice : item.price,\n\t\t\t}\n\n\t\t\tif (wpmDataLayer?.general?.variationsOutput && 0 !== item.variation_id) {\n\n\t\t\t\torderItem.id = String(wpmDataLayer.products[item.variation_id].dyn_r_ids[wpmDataLayer.pixels.google.ads.dynamic_remarketing.id_type])\n\t\t\t\torderItems.push(orderItem)\n\t\t\t} else {\n\n\t\t\t\torderItem.id = String(wpmDataLayer.products[item.id].dyn_r_ids[wpmDataLayer.pixels.google.ads.dynamic_remarketing.id_type])\n\t\t\t\torderItems.push(orderItem)\n\t\t\t}\n\t\t}\n\n\t\treturn orderItems\n\t}\n\n\twpm.getGoogleAdsDynamicRemarketingOrderItems = function () {\n\t\t// \"id\" : \"gla_34\",\n\t\t// \"quantity\" : 1,\n\t\t// \"price\" : 45,\n\t\t// \"google_business_vertical\": \"retail\"\n\n\t\tlet orderItems = []\n\n\t\tfor (const [key, item] of Object.entries(wpmDataLayer.order.items)) {\n\n\t\t\tlet orderItem\n\n\t\t\torderItem = {\n\t\t\t\tquantity : item.quantity,\n\t\t\t\tprice : item.price,\n\t\t\t\tgoogle_business_vertical: wpmDataLayer.pixels.google.ads.google_business_vertical,\n\t\t\t}\n\n\t\t\tif (wpmDataLayer?.general?.variationsOutput && 0 !== item.variation_id) {\n\n\t\t\t\torderItem.id = String(wpmDataLayer.products[item.variation_id].dyn_r_ids[wpmDataLayer.pixels.google.ads.dynamic_remarketing.id_type])\n\t\t\t\torderItems.push(orderItem)\n\t\t\t} else {\n\n\t\t\t\torderItem.id = String(wpmDataLayer.products[item.id].dyn_r_ids[wpmDataLayer.pixels.google.ads.dynamic_remarketing.id_type])\n\t\t\t\torderItems.push(orderItem)\n\t\t\t}\n\t\t}\n\n\t\treturn orderItems\n\t}\n\n}(window.wpm = window.wpm || {}, jQuery))\n\n\n/**\n * All event listeners\n * */\n\n// view_item_list event\njQuery(document).on(\"wpmViewItemList\", function (event, product) {\n\n\ttry {\n\t\tif(jQuery.isEmptyObject(wpmDataLayer?.pixels?.google?.ads?.conversionIds)) return\n\t\tif (!wpmDataLayer?.pixels?.google?.ads?.dynamic_remarketing?.status) return\n\t\tif (!wpm.googleConfigConditionsMet(\"ads\")) return\n\n\n\t\tif (\n\t\t\twpmDataLayer?.general?.variationsOutput &&\n\t\t\tproduct.isVariable &&\n\t\t\twpmDataLayer.pixels.google.ads.dynamic_remarketing.send_events_with_parent_ids === false\n\t\t) return\n\n\t\t// try to prevent that WC sends cached hits to Google\n\t\tif (!product) return\n\n\t\twpm.gtagLoaded().then(function () {\n\t\t gtag(\"event\", \"view_item_list\", {\n \t\t\tsend_to: wpm.getGoogleAdsConversionIdentifiers(),\n \t\t\titems : [{\n \t\t\t\tid : product.dyn_r_ids[wpmDataLayer.pixels.google.ads.dynamic_remarketing.id_type],\n \t\t\t\tgoogle_business_vertical: wpmDataLayer.pixels.google.ads.google_business_vertical,\n \t\t\t}],\n \t\t})\n\t\t})\n\t} catch (e) {\n\t\tconsole.error(e)\n\t}\n})\n\n// add_to_cart event\njQuery(document).on(\"wpmAddToCart\", function (event, product) {\n\n\ttry {\n\t\tif(jQuery.isEmptyObject(wpmDataLayer?.pixels?.google?.ads?.conversionIds)) return\n\t\tif (!wpmDataLayer?.pixels?.google?.ads?.dynamic_remarketing?.status) return\n\t\tif (!wpm.googleConfigConditionsMet(\"ads\")) return\n\n\t\twpm.gtagLoaded().then(function () {\n\t\t gtag(\"event\", \"add_to_cart\", {\n \t\t\tsend_to: wpm.getGoogleAdsConversionIdentifiers(),\n \t\t\tvalue : product.quantity * product.price,\n \t\t\titems : [{\n \t\t\t\tid : product.dyn_r_ids[wpmDataLayer.pixels.google.ads.dynamic_remarketing.id_type],\n \t\t\t\tquantity : product.quantity,\n \t\t\t\tprice : product.price,\n \t\t\t\tgoogle_business_vertical: wpmDataLayer.pixels.google.ads.google_business_vertical,\n \t\t\t}],\n \t\t})\n\t\t})\n\t} catch (e) {\n\t\tconsole.error(e)\n\t}\n})\n\n// view_item event\njQuery(document).on(\"wpmViewItem\", function (event, product) {\n\n\ttry {\n\t\tif(jQuery.isEmptyObject(wpmDataLayer?.pixels?.google?.ads?.conversionIds)) return\n\t\tif (!wpmDataLayer?.pixels?.google?.ads?.dynamic_remarketing?.status) return\n\t\tif (!wpm.googleConfigConditionsMet(\"ads\")) return\n\n\n\t\twpm.gtagLoaded().then(function () {\n\t\t gtag(\"event\", \"view_item\", {\n \t\t\tsend_to: wpm.getGoogleAdsConversionIdentifiers(),\n \t\t\tvalue : (product.quantity ? product.quantity : 1) * product.price,\n \t\t\titems : [{\n \t\t\t\tid : product.dyn_r_ids[wpmDataLayer.pixels.google.ads.dynamic_remarketing.id_type],\n \t\t\t\tquantity : (product.quantity ? product.quantity : 1),\n \t\t\t\tprice : product.price,\n \t\t\t\tgoogle_business_vertical: wpmDataLayer.pixels.google.ads.google_business_vertical,\n \t\t\t}],\n \t\t})\n\t\t})\n\t} catch (e) {\n\t\tconsole.error(e)\n\t}\n})\n\n\n// view search event\njQuery(document).on(\"wpmSearch\", function () {\n\n\ttry {\n\t\tif(jQuery.isEmptyObject(wpmDataLayer?.pixels?.google?.ads?.conversionIds)) return\n\t\tif (!wpmDataLayer?.pixels?.google?.ads?.dynamic_remarketing?.status) return\n\t\tif (!wpm.googleConfigConditionsMet(\"ads\")) return\n\n\n\t\tlet products = []\n\n\t\tfor (const [key, product] of Object.entries(wpmDataLayer.products)) {\n\n\t\t\tif (\n\t\t\t\twpmDataLayer?.general?.variationsOutput &&\n\t\t\t\tproduct.isVariable &&\n\t\t\t\twpmDataLayer.pixels.google.ads.dynamic_remarketing.send_events_with_parent_ids === false\n\t\t\t) return\n\n\t\t\tproducts.push({\n\t\t\t\tid : product.dyn_r_ids[wpmDataLayer.pixels.google.ads.dynamic_remarketing.id_type],\n\t\t\t\tgoogle_business_vertical: wpmDataLayer.pixels.google.ads.google_business_vertical,\n\t\t\t})\n\t\t}\n\n\t\t// console.log(products);\n\n\t\twpm.gtagLoaded().then(function () {\n\t\t\tgtag(\"event\", \"view_search_results\", {\n \t\t\tsend_to: wpm.getGoogleAdsConversionIdentifiers(),\n \t\t\t// value : 1 * product.price,\n \t\t\titems: products,\n \t\t})\n\t\t})\n\t} catch (e) {\n\t\tconsole.error(e)\n\t}\n})\n\n\n// view order received page event\n// TODO distinguish with or without cart data active\njQuery(document).on(\"wpmOrderReceivedPage\", function () {\n\n\ttry {\n\t\tif(jQuery.isEmptyObject(wpmDataLayer?.pixels?.google?.ads?.conversionIds)) return\n\t\tif (!wpmDataLayer?.pixels?.google?.ads?.dynamic_remarketing?.status) return\n\t\tif (!wpm.googleConfigConditionsMet(\"ads\")) return\n\n\t\twpm.gtagLoaded().then(function () {\n\t\t gtag(\"event\", \"purchase\", {\n \t\t\tsend_to: wpm.getGoogleAdsConversionIdentifiers(),\n \t\t\tvalue : wpmDataLayer.order.value_filtered,\n \t\t\titems : wpm.getGoogleAdsDynamicRemarketingOrderItems(),\n \t\t})\n\t\t})\n\n\t\t// console.log(wpm.getGoogleAdsDynamicRemarketingOrderItems())\n\t} catch (e) {\n\t\tconsole.error(e)\n\t}\n})\n\n// user log in event\njQuery(document).on(\"wpmLogin\", function () {\n\n\ttry {\n\t\tif(jQuery.isEmptyObject(wpmDataLayer?.pixels?.google?.ads?.conversionIds)) return\n\t\tif (!wpmDataLayer?.pixels?.google?.ads?.dynamic_remarketing?.status) return\n\t\tif (!wpm.googleConfigConditionsMet(\"ads\")) return\n\n\n\t\twpm.gtagLoaded().then(function () {\n\t\t gtag(\"event\", \"login\", {\n \t\t\tsend_to: wpm.getGoogleAdsConversionIdentifiers(),\n \t\t})\n\t\t})\n\t} catch (e) {\n\t\tconsole.error(e)\n\t}\n})\n\n// view order received page event\n// new_customer parameter: https://support.google.com/google-ads/answer/9917012\njQuery(document).on(\"wpmOrderReceivedPage\", function () {\n\n\ttry {\n\t\tif(jQuery.isEmptyObject(wpmDataLayer?.pixels?.google?.ads?.conversionIds)) return\n\t\tif (!wpm.googleConfigConditionsMet(\"ads\")) return\n\n\t\tlet data_basic = {}\n\t\tlet data_with_cart = {}\n\n\t\tdata_basic = {\n\t\t\tsend_to : wpm.getGoogleAdsConversionIdentifiersWithLabel(),\n\t\t\ttransaction_id: wpmDataLayer.order.number,\n\t\t\tvalue : wpmDataLayer.order.value_filtered,\n\t\t\tcurrency : wpmDataLayer.order.currency,\n\t\t\tnew_customer : wpmDataLayer.order.new_customer,\n\t\t}\n\n\t\tif (wpmDataLayer?.order?.aw_merchant_id) {\n\t\t\tdata_with_cart = {\n\t\t\t\tdiscount : wpmDataLayer.order.discount,\n\t\t\t\taw_merchant_id : wpmDataLayer.order.aw_merchant_id,\n\t\t\t\taw_feed_country : wpmDataLayer.order.aw_feed_country,\n\t\t\t\taw_feed_language: wpmDataLayer.order.aw_feed_language,\n\t\t\t\titems : wpm.getGoogleAdsRegularOrderItems(),\n\t\t\t}\n\t\t}\n\n\t\twpm.gtagLoaded().then(function () {\n\t\t\tgtag(\"event\", \"conversion\", {...data_basic, ...data_with_cart})\n\t\t})\n\n\t\t// console.log({...data_basic,...data_with_cart})\n\n\t\t// console.log(wpm.getGoogleAdsOrderItems())\n\t} catch (e) {\n\t\tconsole.error(e)\n\t}\n})\n\n\n\n\n\n","// TODO check all events and add more if there are any\n\n/**\n * Add functions for Snapchat Ads\n * */\n\n(function (wpm, $, undefined) {\n\n\n}(window.wpm = window.wpm || {}, jQuery));\n\n/**\n * Execute as soon as possible\n * */\n\n(function () {\n\t//\n\t//\n\t// if ('order_received_page' === wpmDataLayer.shop.page_type && wpmDataLayer?.order?.google?.ads?.enhanced_conversion_data) {\n\t// \tvar enhanced_conversion_data_2 = wpmDataLayer.order.google.ads.enhanced_conversion_data;\n\t// }\n\n})()\n\n","/**\n * Add functions for Google\n * */\n\n\n(function (wpm, $, undefined) {\n\n\twpm.getCartItemsGa4 = function () {\n\n\t\tlet data = []\n\n\t\tfor (const [productId, product] of Object.entries(wpmDataLayer.cart)) {\n\n\t\t\tlet productItems = {\n\t\t\t\titem_id : product.dyn_r_ids[wpmDataLayer.pixels.google.analytics.id_type],\n\t\t\t\titem_name: product.name,\n\t\t\t\tquantity : product.quantity,\n\t\t\t\t// affiliation : '',\n\t\t\t\t// coupon : '',\n\t\t\t\t// discount : 0,\n\t\t\t\titem_brand : product.brand,\n\t\t\t\titem_variant: product.variant,\n\t\t\t\tprice : product.price,\n\t\t\t\tcurrency : wpmDataLayer.shop.currency,\n\t\t\t}\n\n\t\t\tproductItems = wpm.getFormattedGA4Categories(productItems, product.category)\n\n\t\t\tdata.push(productItems)\n\t\t}\n\n\t\treturn data\n\t}\n\n}(window.wpm = window.wpm || {}, jQuery))\n\n\n/**\n * All event listeners\n * */\n\n// view_item_list event\n// https://developers.google.com/analytics/devguides/collection/ga4/ecommerce?client_type=gtag#view_item_list\njQuery(document).on(\"wpmViewItemList\", function (event, product) {\n\n\ttry {\n\t\tif (!wpmDataLayer?.pixels?.google?.analytics?.eec) return\n\t\tif (!wpmDataLayer?.pixels?.google?.analytics?.ga4?.measurement_id) return\n\t\tif (!wpm.googleConfigConditionsMet(\"analytics\")) return\n\n\t\tlet productItems = {\n\t\t\titem_id : product.dyn_r_ids[wpmDataLayer.pixels.google.analytics.id_type],\n\t\t\titem_name: product.name,\n\t\t\t// coupon : \"\",\n\t\t\t// discount: 0,\n\t\t\tindex : product.list_position, // doesn't make sense on mini_cart\n\t\t\titem_list_name: wpmDataLayer.shop.list_name,\n\t\t\titem_list_id : wpmDataLayer.shop.list_id,\n\t\t\t// affiliation: \"\",\n\t\t\titem_brand : product.brand,\n\t\t\titem_variant: product.variant,\n\t\t\tprice : product.price,\n\t\t\tcurrency : wpmDataLayer.shop.currency,\n\t\t\tquantity : product.quantity,\n\t\t}\n\n\t\tproductItems = wpm.getFormattedGA4Categories(productItems, product.category)\n\n\t\twpm.gtagLoaded().then(function () {\n\t\t gtag(\"event\", \"view_item_list\", {\n \t\t\tsend_to : wpmDataLayer.pixels.google.analytics.ga4.measurement_id,\n \t\t\titems : [productItems],\n \t\t\titem_list_name: wpmDataLayer.shop.list_name, // doesn't make sense on mini_cart\n \t\t\titem_list_id : wpmDataLayer.shop.list_id, // doesn't make sense on mini_cart\n \t\t})\n\t\t})\n\t} catch (e) {\n\t\tconsole.error(e)\n\t}\n})\n\n// select_item event\n// https://developers.google.com/analytics/devguides/collection/ga4/ecommerce?client_type=gtag#select_item\njQuery(document).on(\"wpmSelectItem\", function (event, product) {\n\n\ttry {\n\t\tif (!wpmDataLayer?.pixels?.google?.analytics?.eec) return\n\t\tif (!wpmDataLayer?.pixels?.google?.analytics?.ga4?.measurement_id) return\n\t\tif (!wpm.googleConfigConditionsMet(\"analytics\")) return\n\n\t\tlet productItems = {\n\t\t\titem_id : product.dyn_r_ids[wpmDataLayer.pixels.google.analytics.id_type],\n\t\t\titem_name: product.name,\n\t\t\t// coupon : \"\",\n\t\t\t// discount: 0,\n\t\t\tindex : product.list_position, // doesn't make sense on mini_cart\n\t\t\titem_list_name: wpmDataLayer.shop.list_name,\n\t\t\titem_list_id : wpmDataLayer.shop.list_id,\n\t\t\t// affiliation: \"\",\n\t\t\titem_brand : product.brand,\n\t\t\titem_variant: product.variant,\n\t\t\tprice : product.price,\n\t\t\tcurrency : wpmDataLayer.shop.currency,\n\t\t\tquantity : product.quantity,\n\t\t}\n\n\t\tproductItems = wpm.getFormattedGA4Categories(productItems, product.category)\n\n\t\twpm.gtagLoaded().then(function () {\n\t\t gtag(\"event\", \"select_item\", {\n \t\t\tsend_to: wpmDataLayer.pixels.google.analytics.ga4.measurement_id,\n \t\t\titems : [productItems],\n \t\t})\n\t\t})\n\t} catch (e) {\n\t\tconsole.error(e)\n\t}\n})\n\n// add_to_cart event\n// https://developers.google.com/analytics/devguides/collection/ga4/ecommerce?client_type=gtag#add_to_cart\njQuery(document).on(\"wpmAddToCart\", function (event, product) {\n\n\ttry {\n\t\tif (!wpmDataLayer?.pixels?.google?.analytics?.eec) return\n\t\tif (!wpmDataLayer?.pixels?.google?.analytics?.ga4?.measurement_id) return\n\t\tif (!wpm.googleConfigConditionsMet(\"analytics\")) return\n\n\t\tlet productItems = {\n\t\t\titem_name : product.name,\n\t\t\titem_id : product.dyn_r_ids[wpmDataLayer.pixels.google.analytics.id_type],\n\t\t\titem_list_name: wpmDataLayer.shop.list_name,\n\t\t\titem_list_id : wpmDataLayer.shop.list_id,\n\t\t\t// coupon: \"\",\n\t\t\t// discount: 0,\n\t\t\t// affiliation: \"\",\n\t\t\titem_brand : product.brand,\n\t\t\titem_variant: product.variant,\n\t\t\tprice : product.price,\n\t\t\tcurrency : wpmDataLayer.shop.currency,\n\t\t\tquantity : product.quantity,\n\t\t}\n\n\t\tproductItems = wpm.getFormattedGA4Categories(productItems, product.category)\n\n\t\twpm.gtagLoaded().then(function () {\n\t\t gtag(\"event\", \"add_to_cart\", {\n \t\t\tsend_to : wpmDataLayer.pixels.google.analytics.ga4.measurement_id,\n \t\t\tcurrency: wpmDataLayer.shop.currency,\n \t\t\t// value: 0,\n \t\t\titems: [productItems],\n \t\t})\n\t\t})\n\t} catch (e) {\n\t\tconsole.error(e)\n\t}\n})\n\n// view_item event\n// https://developers.google.com/analytics/devguides/collection/ga4/ecommerce?client_type=gtag#view_item\njQuery(document).on(\"wpmViewItem\", function (event, product) {\n\n\ttry {\n\t\tif (!wpmDataLayer?.pixels?.google?.analytics?.eec) return\n\t\tif (!wpmDataLayer?.pixels?.google?.analytics?.ga4?.measurement_id) return\n\t\tif (!wpm.googleConfigConditionsMet(\"analytics\")) return\n\n\t\tlet productItems = {\n\t\t\titem_id : product.dyn_r_ids[wpmDataLayer.pixels.google.analytics.id_type],\n\t\t\titem_name: product.name,\n\t\t\t// coupon: \"\",\n\t\t\t// discount: 0,\n\t\t\t// affiliation: \"\",\n\t\t\titem_brand : product.brand,\n\t\t\titem_variant : product.variant,\n\t\t\tprice : product.price,\n\t\t\tcurrency : wpmDataLayer.shop.currency,\n\t\t\tquantity : 1,\n\t\t\titem_list_name: wpmDataLayer.shop.list_name,\n\t\t\titem_list_id : wpmDataLayer.shop.list_id,\n\t\t}\n\n\t\tproductItems = wpm.getFormattedGA4Categories(productItems, product.category)\n\n\t\twpm.gtagLoaded().then(function () {\n\t\t gtag(\"event\", \"view_item\", {\n \t\t\tsend_to : wpmDataLayer.pixels.google.analytics.ga4.measurement_id,\n \t\t\tcurrency: wpmDataLayer.shop.currency,\n \t\t\t// value: 0,\n \t\t\titems: [productItems],\n \t\t})\n\t\t})\n\t} catch (e) {\n\t\tconsole.error(e)\n\t}\n})\n\n// add_to_wishlist event\n// https://developers.google.com/analytics/devguides/collection/ga4/ecommerce?client_type=gtag#add_to_wishlist\njQuery(document).on(\"wpmAddToWishlist\", function (event, product) {\n\n\ttry {\n\t\tif (!wpmDataLayer?.pixels?.google?.analytics?.eec) return\n\t\tif (!wpmDataLayer?.pixels?.google?.analytics?.ga4?.measurement_id) return\n\t\tif (!wpm.googleConfigConditionsMet(\"analytics\")) return\n\n\t\tlet productItems = {\n\t\t\titem_id : product.dyn_r_ids[wpmDataLayer.pixels.google.analytics.id_type],\n\t\t\titem_name: product.name,\n\t\t\tquantity : 1,\n\t\t\t// affiliation: \"\",\n\t\t\t// coupon: \"\",\n\t\t\t// discount: 0,\n\t\t\titem_brand : product.brand,\n\t\t\titem_variant: product.variant,\n\t\t\tprice : product.price,\n\t\t\tcurrency : wpmDataLayer.shop.currency,\n\t\t}\n\n\t\tproductItems = wpm.getFormattedGA4Categories(productItems, product.category)\n\n\t\twpm.gtagLoaded().then(function () {\n\t\t gtag(\"event\", \"add_to_wishlist\", {\n \t\t\tsend_to : wpmDataLayer.pixels.google.analytics.ga4.measurement_id,\n \t\t\tcurrency: wpmDataLayer.shop.currency,\n \t\t\t// value: 0,\n \t\t\titems: [productItems],\n \t\t})\n\t\t})\n\t} catch (e) {\n\t\tconsole.error(e)\n\t}\n})\n\n// remove_from_cart event\n// https://developers.google.com/analytics/devguides/collection/ga4/ecommerce?client_type=gtag#remove_from_cart\njQuery(document).on(\"wpmRemoveFromCart\", function (event, product) {\n\n\ttry {\n\t\tif (!wpmDataLayer?.pixels?.google?.analytics?.eec) return\n\t\tif (!wpmDataLayer?.pixels?.google?.analytics?.ga4?.measurement_id) return\n\t\tif (!wpm.googleConfigConditionsMet(\"analytics\")) return\n\n\t\tlet productItems = {\n\t\t\titem_id : product.dyn_r_ids[wpmDataLayer.pixels.google.analytics.id_type],\n\t\t\titem_name: product.name,\n\t\t\t// coupon: \"\",\n\t\t\t// discount: 0,\n\t\t\t// affiliation: \"\",\n\t\t\titem_brand : product.brand,\n\t\t\titem_variant: product.variant,\n\t\t\tprice : product.price,\n\t\t\tcurrency : wpmDataLayer.shop.currency,\n\t\t\tquantity : product.quantity,\n\t\t}\n\n\t\tproductItems = wpm.getFormattedGA4Categories(productItems, product.category)\n\n\t\twpm.gtagLoaded().then(function () {\n\t\t gtag(\"event\", \"remove_from_cart\", {\n \t\t\tsend_to : wpmDataLayer.pixels.google.analytics.ga4.measurement_id,\n \t\t\tcurrency: wpmDataLayer.shop.currency,\n \t\t\t// value: 0,\n \t\t\titems: [productItems],\n \t\t})\n\t\t})\n\t} catch (e) {\n\t\tconsole.error(e)\n\t}\n})\n\n// begin_checkout event\n// https://developers.google.com/analytics/devguides/collection/ga4/ecommerce?client_type=gtag#begin_checkout\njQuery(document).on(\"wpmBeginCheckout\", function (event) {\n\n\ttry {\n\t\tif (!wpmDataLayer?.pixels?.google?.analytics?.eec) return\n\t\tif (!wpmDataLayer?.pixels?.google?.analytics?.ga4?.measurement_id) return\n\t\tif (!wpm.googleConfigConditionsMet(\"analytics\")) return\n\n\t\twpm.gtagLoaded().then(function () {\n\t\t gtag(\"event\", \"begin_checkout\", {\n \t\t\tsend_to: wpmDataLayer.pixels.google.analytics.ga4.measurement_id,\n \t\t\t// coupon: \"\",\n \t\t\tcurrency: wpmDataLayer.shop.currency,\n \t\t\t// value: 0,\n \t\t\titems: wpm.getCartItemsGa4(),\n \t\t})\n\t\t})\n\t} catch (e) {\n\t\tconsole.error(e)\n\t}\n})\n\n// view_cart event\n// https://developers.google.com/analytics/devguides/collection/ga4/ecommerce?client_type=gtag#view_cart\njQuery(document).on(\"wpmViewCart\", function (event) {\n\n\ttry {\n\t\tif (!wpmDataLayer?.pixels?.google?.analytics?.eec) return\n\t\tif (!wpmDataLayer?.pixels?.google?.analytics?.ga4?.measurement_id) return\n\t\tif (!wpm.googleConfigConditionsMet(\"analytics\")) return\n\n\t\tif (jQuery.isEmptyObject(wpmDataLayer.cart)) return\n\n\t\tlet products = []\n\t\tlet cartValue = null\n\n\t\tfor (const [key, product] of Object.entries(wpmDataLayer.cart)) {\n\t\t\t// console.log(`${key}: ${value}`);\n\n\t\t\tlet productItems = {\n\t\t\t\titem_id : product.dyn_r_ids[wpmDataLayer.pixels.google.analytics.id_type],\n\t\t\t\titem_name: product.name,\n\t\t\t\tquantity : product.quantity,\n\t\t\t\t// affiliation: \"\",\n\t\t\t\t// coupon: \"\",\n\t\t\t\t// discount: 0,\n\t\t\t\t// index : product.position,\n\t\t\t\titem_brand : product.brand,\n\t\t\t\titem_list_name: wpmDataLayer.shop.list_name,\n\t\t\t\titem_list_id : wpmDataLayer.shop.list_id,\n\t\t\t\titem_variant : product.variant,\n\t\t\t\tprice : product.price,\n\t\t\t\tcurrency : wpmDataLayer.shop.currency,\n\t\t\t}\n\n\t\t\tproductItems = wpm.getFormattedGA4Categories(productItems, product.category)\n\n\t\t\tproducts.push(productItems)\n\n\t\t\tcartValue = cartValue + product.quantity * product.price\n\t\t}\n\n\t\t// console.log(products)\n\t\t// console.log('cart value: ' + cartValue.toFixed(2))\n\n\t\twpm.gtagLoaded().then(function () {\n\t\t\tgtag(\"event\", \"view_cart\", {\n\t\t\t\tsend_to : wpmDataLayer.pixels.google.analytics.ga4.measurement_id,\n\t\t\t\tcurrency: wpmDataLayer.shop.currency,\n\t\t\t\tvalue : cartValue.toFixed(2),\n\t\t\t\titems : products,\n\t\t\t})\n\t\t})\n\t} catch (e) {\n\t\tconsole.error(e)\n\t}\n})\n\n\n// view search event\njQuery(document).on(\"wpmSearch\", function () {\n\n\ttry {\n\t\tif (!wpmDataLayer?.pixels?.google?.analytics?.eec) return\n\t\tif (!wpmDataLayer?.pixels?.google?.analytics?.ga4?.measurement_id) return\n\t\tif (!wpm.googleConfigConditionsMet(\"analytics\")) return\n\n\t\tlet products = []\n\n\t\tfor (const [key, product] of Object.entries(wpmDataLayer.products)) {\n\t\t\t// console.log(`${key}: ${value}`);\n\n\t\t\tlet productItems = {\n\t\t\t\titem_id : product.dyn_r_ids[wpmDataLayer.pixels.google.analytics.id_type],\n\t\t\t\titem_name: product.name,\n\t\t\t\tquantity : 1,\n\t\t\t\t// \"affiliation\": \"\",\n\t\t\t\t// \"coupon\": \"\",\n\t\t\t\t// \"discount\": 0,\n\t\t\t\tindex : product.position,\n\t\t\t\titem_brand : product.brand,\n\t\t\t\titem_list_name: wpmDataLayer.shop.list_name,\n\t\t\t\titem_list_id : wpmDataLayer.shop.list_id,\n\t\t\t\titem_variant : product.variant,\n\t\t\t\tprice : product.price,\n\t\t\t\tcurrency : wpmDataLayer.shop.currency,\n\t\t\t}\n\n\t\t\tproductItems = wpm.getFormattedGA4Categories(productItems, product.category)\n\n\t\t\tproducts.push(productItems)\n\t\t}\n\n\t\twpm.gtagLoaded().then(function () {\n\t\t\tgtag(\"event\", \"view_search_results\", {\n\t\t\t\tsend_to : wpmDataLayer.pixels.google.analytics.ga4.measurement_id,\n\t\t\t\tsearch_term: wpm.getSearchTermFromUrl(),\n\t\t\t\titems : products,\n\t\t\t})\n\n\t\t})\n\n\n\t} catch (e) {\n\t\tconsole.error(e)\n\t}\n})\n\n// user log in event\njQuery(document).on(\"wpmLogin\", function () {\n\n\ttry {\n\t\tif (!wpmDataLayer?.pixels?.google?.analytics?.eec) return\n\t\tif (!wpmDataLayer?.pixels?.google?.analytics?.ga4?.measurement_id) return\n\t\tif (!wpm.googleConfigConditionsMet(\"analytics\")) return\n\n\n\t\twpm.gtagLoaded().then(function () {\n\t\t\tgtag(\"event\", \"login\", {\n\t\t\t\tsend_to: wpmDataLayer.pixels.google.analytics.ga4.measurement_id,\n\t\t\t})\n\t\t})\n\t} catch (e) {\n\t\tconsole.error(e)\n\t}\n})\n\n\n","/**\n * Add functions for Google Analytics 4\n * */\n\n(function (wpm, $, undefined) {\n\n\twpm.getGA4OrderItems = function () {\n\n\t\t// \"item_id\" : \"34\",\n\t\t// \"item_name\" : \"Hoodie\",\n\t\t// \"quantity\" : 1,\n\t\t// \"item_brand\" : \"\",\n\t\t// \"item_variant\" : \"Color: blue | Logo: yes\",\n\t\t// \"price\" : 45,\n\t\t// \"currency\" : \"CHF\",\n\t\t// \"item_category\": \"Hoodies\"\n\n\n\t\tlet orderItems = []\n\n\t\tfor (const [key, item] of Object.entries(wpmDataLayer.order.items)) {\n\n\t\t\tlet orderItem\n\n\t\t\torderItem = {\n\t\t\t\tquantity : item.quantity,\n\t\t\t\tprice : item.price,\n\t\t\t\titem_name : item.name,\n\t\t\t\tcurrency : wpmDataLayer.order.currency,\n\t\t\t\titem_category: wpmDataLayer.products[item.id].category.join(\"/\"),\n\t\t\t}\n\n\t\t\tif (wpmDataLayer?.general?.variationsOutput && 0 !== item.variation_id) {\n\n\t\t\t\torderItem.item_id = String(wpmDataLayer.products[item.variation_id].dyn_r_ids[wpmDataLayer.pixels.google.analytics.id_type])\n\t\t\t\torderItem.item_variant = wpmDataLayer.products[item.variation_id].variant_name\n\t\t\t\torderItem.item_brand = wpmDataLayer.products[item.variation_id].brand\n\t\t\t} else {\n\n\t\t\t\torderItem.item_id = String(wpmDataLayer.products[item.id].dyn_r_ids[wpmDataLayer.pixels.google.analytics.id_type])\n\t\t\t\torderItem.item_brand = wpmDataLayer.products[item.id].brand\n\t\t\t}\n\n\t\t\torderItems.push(orderItem)\n\t\t}\n\n\t\treturn orderItems\n\t}\n\n}(window.wpm = window.wpm || {}, jQuery))\n\n\n/**\n * All event listeners\n * */\n\n\n// view order received page event\njQuery(document).on(\"wpmOrderReceivedPage\", function () {\n\n\ttry {\n\t\tif (!wpmDataLayer?.pixels?.google?.analytics?.ga4?.measurement_id) return\n\t\tif (wpmDataLayer?.pixels?.google?.analytics?.ga4?.mp_active) return\n\t\tif (!wpm.googleConfigConditionsMet(\"analytics\")) return\n\n\t\twpm.gtagLoaded().then(function () {\n\t\t\tgtag(\"event\", \"purchase\", {\n\t\t\t\tsend_to : [wpmDataLayer.pixels.google.analytics.ga4.measurement_id],\n\t\t\t\ttransaction_id: wpmDataLayer.order.number,\n\t\t\t\taffiliation : wpmDataLayer.order.affiliation,\n\t\t\t\tcurrency : wpmDataLayer.order.currency,\n\t\t\t\tvalue : wpmDataLayer.order.value_regular,\n\t\t\t\tdiscount : wpmDataLayer.order.discount,\n\t\t\t\ttax : wpmDataLayer.order.tax,\n\t\t\t\tshipping : wpmDataLayer.order.shipping,\n\t\t\t\tcoupon : wpmDataLayer.order.coupon,\n\t\t\t\titems : wpm.getGA4OrderItems(),\n\t\t\t})\n\t\t})\n\t} catch (e) {\n\t\tconsole.error(e)\n\t}\n})\n","/**\n * Add functions for Google\n * */\n\n(function (wpm, $, undefined) {\n\n\twpm.getCartItemsGaUa = function () {\n\n\t\t// console.log('test')\n\n\t\tlet data = []\n\n\t\tfor (const [productId, product] of Object.entries(wpmDataLayer.cart)) {\n\n\t\t\tdata.push({\n\t\t\t\tid : product.dyn_r_ids[wpmDataLayer.pixels.google.analytics.id_type],\n\t\t\t\tname : product.name,\n\t\t\t\tbrand : product.brand,\n\t\t\t\tcategory: product.category.join(\",\"),\n\t\t\t\t// coupon: '',\n\t\t\t\t// list_name: '',\n\t\t\t\t// list_position: 1,\n\t\t\t\tprice : product.price,\n\t\t\t\tquantity: product.quantity,\n\t\t\t\tvariant : product.variant,\n\t\t\t})\n\t\t}\n\n\t\treturn data\n\t}\n\n}(window.wpm = window.wpm || {}, jQuery))\n\n\n/**\n * All event listeners\n * */\n\n// view_item_list event\njQuery(document).on(\"wpmViewItemList\", function (event, product) {\n\n\ttry {\n\t\tif (!wpmDataLayer?.pixels?.google?.analytics?.eec) return\n\t\tif (!wpmDataLayer?.pixels?.google?.analytics?.universal?.property_id) return\n\t\tif (!wpm.googleConfigConditionsMet(\"analytics\")) return\n\n\t\twpm.gtagLoaded().then(function () {\n\t\t gtag(\"event\", \"view_item_list\", {\n \t\t\tsend_to: wpmDataLayer.pixels.google.analytics.universal.property_id,\n \t\t\titems : [{\n \t\t\t\tid : product.dyn_r_ids[wpmDataLayer.pixels.google.analytics.id_type],\n \t\t\t\tname : product.name,\n \t\t\t\tbrand : product.brand,\n \t\t\t\tcategory: product.category.join(\",\"),\n \t\t\t\t// coupon : \"\",\n \t\t\t\tlist_name : wpmDataLayer.shop.list_name,\n \t\t\t\tlist_position: product.list_position, // doesn't make sense on mini_cart\n \t\t\t\tprice : product.price,\n \t\t\t\tquantity : product.quantity,\n \t\t\t\tvariant : product.variant,\n \t\t\t}],\n \t\t})\n\t\t})\n\t} catch (e) {\n\t\tconsole.error(e)\n\t}\n})\n\n// select_content event\njQuery(document).on(\"wpmSelectContentGaUa\", function (event, product) {\n\n\ttry {\n\t\tif (!wpmDataLayer?.pixels?.google?.analytics?.eec) return\n\t\tif (!wpmDataLayer?.pixels?.google?.analytics?.universal?.property_id) return\n\t\tif (!wpm.googleConfigConditionsMet(\"analytics\")) return\n\n\t\twpm.gtagLoaded().then(function () {\n\t\t gtag(\"event\", \"select_content\", {\n \t\t\tsend_to : wpmDataLayer.pixels.google.analytics.universal.property_id,\n \t\t\tcontent_type: \"product\",\n \t\t\titems : [\n \t\t\t\t{\n \t\t\t\t\tid : product.dyn_r_ids[wpmDataLayer.pixels.google.analytics.id_type],\n \t\t\t\t\tname : product.name,\n \t\t\t\t\tlist_name : wpmDataLayer.shop.list_name,\n \t\t\t\t\tbrand : product.brand,\n \t\t\t\t\tcategory : product.category.join(\",\"),\n \t\t\t\t\tvariant : product.variant,\n \t\t\t\t\tlist_position: product.list_position, // doesn't make sense on mini_cart\n \t\t\t\t\tquantity : product.quantity,\n \t\t\t\t\tprice : product.price,\n \t\t\t\t},\n \t\t\t],\n \t\t})\n\t\t})\n\t} catch (e) {\n\t\tconsole.error(e)\n\t}\n})\n\n// add_to_cart event\njQuery(document).on(\"wpmAddToCart\", function (event, product) {\n\n\ttry {\n\t\tif (!wpmDataLayer?.pixels?.google?.analytics?.eec) return\n\t\tif (!wpmDataLayer?.pixels?.google?.analytics?.universal?.property_id) return\n\t\tif (!wpm.googleConfigConditionsMet(\"analytics\")) return\n\n\t\twpm.gtagLoaded().then(function () {\n\t\t gtag(\"event\", \"add_to_cart\", {\n \t\t\tsend_to : wpmDataLayer.pixels.google.analytics.universal.property_id,\n \t\t\tcurrency: wpmDataLayer.shop.currency,\n \t\t\titems : [\n \t\t\t\t{\n \t\t\t\t\tid : product.dyn_r_ids[wpmDataLayer.pixels.google.analytics.id_type],\n \t\t\t\t\tname : product.name,\n \t\t\t\t\tlist_name : wpmDataLayer.shop.list_name,\n \t\t\t\t\tbrand : product.brand,\n \t\t\t\t\tcategory : product.category.join(\",\"),\n \t\t\t\t\tvariant : product.variant,\n \t\t\t\t\tlist_position: product.list_position, // doesn't make sense on mini_cart\n \t\t\t\t\tquantity : product.quantity,\n \t\t\t\t\tprice : product.price,\n \t\t\t\t},\n \t\t\t],\n \t\t})\n\t\t})\n\t} catch (e) {\n\t\tconsole.error(e)\n\t}\n})\n\n// view_item event\njQuery(document).on(\"wpmViewItem\", function (event, product) {\n\n\ttry {\n\t\tif (!wpmDataLayer?.pixels?.google?.analytics?.eec) return\n\t\tif (!wpmDataLayer?.pixels?.google?.analytics?.universal?.property_id) return\n\t\tif (!wpm.googleConfigConditionsMet(\"analytics\")) return\n\n\t\twpm.gtagLoaded().then(function () {\n\t\t gtag(\"event\", \"view_item\", {\n \t\t\tsend_to: wpmDataLayer.pixels.google.analytics.universal.property_id,\n \t\t\titems : [{\n \t\t\t\tid : product.dyn_r_ids[wpmDataLayer.pixels.google.analytics.id_type],\n \t\t\t\tname : product.name,\n \t\t\t\tlist_name : wpmDataLayer.shop.list_name, // doesn't make sense on mini_cart\n \t\t\t\tbrand : product.brand,\n \t\t\t\tcategory : product.category.join(\",\"),\n \t\t\t\tvariant : product.variant,\n \t\t\t\tlist_position: 1,\n \t\t\t\tquantity : 1,\n \t\t\t\tprice : product.price,\n \t\t\t}],\n \t\t})\n\t\t})\n\t} catch (e) {\n\t\tconsole.error(e)\n\t}\n})\n\n// add_to_wishlist event\njQuery(document).on(\"wpmAddToWishlist\", function (event, product) {\n\n\ttry {\n\t\tif (!wpmDataLayer?.pixels?.google?.analytics?.eec) return\n\t\tif (!wpmDataLayer?.pixels?.google?.analytics?.universal?.property_id) return\n\t\tif (!wpm.googleConfigConditionsMet(\"analytics\")) return\n\n\t\twpm.gtagLoaded().then(function () {\n\t\t gtag(\"event\", \"add_to_wishlist\", {\n \t\t\tsend_to: wpmDataLayer.pixels.google.analytics.universal.property_id,\n \t\t\titems : [\n \t\t\t\t{\n \t\t\t\t\tid : product.dyn_r_ids[wpmDataLayer.pixels.google.analytics.id_type],\n \t\t\t\t\tname : product.name,\n \t\t\t\t\tbrand : product.brand,\n \t\t\t\t\tcategory: product.category.join(\",\"),\n \t\t\t\t\t// coupon : \"\",\n \t\t\t\t\tlist_name : wpmDataLayer.shop.list_name, // doesn't make sense on mini_cart\n \t\t\t\t\tlist_position: product.position,\n \t\t\t\t\tprice : product.price,\n \t\t\t\t\tquantity : 1,\n \t\t\t\t\tvariant : product.variant,\n \t\t\t\t},\n \t\t\t],\n \t\t})\n\t\t})\n\t} catch (e) {\n\t\tconsole.error(e)\n\t}\n})\n\n// remove_from_cart event\njQuery(document).on(\"wpmRemoveFromCart\", function (event, product) {\n\n\ttry {\n\t\tif (!wpmDataLayer?.pixels?.google?.analytics?.eec) return\n\t\tif (!wpmDataLayer?.pixels?.google?.analytics?.universal?.property_id) return\n\t\tif (!wpm.googleConfigConditionsMet(\"analytics\")) return\n\n\t\twpm.gtagLoaded().then(function () {\n\t\t gtag(\"event\", \"remove_from_cart\", {\n \t\t\tsend_to : wpmDataLayer.pixels.google.analytics.universal.property_id,\n \t\t\tcurrency: wpmDataLayer.shop.currency,\n \t\t\titems : [\n \t\t\t\t{\n \t\t\t\t\tid : product.dyn_r_ids[wpmDataLayer.pixels.google.analytics.id_type],\n \t\t\t\t\tname : product.name,\n \t\t\t\t\tlist_name: wpmDataLayer.shop.list_name,\n \t\t\t\t\tbrand : product.brand,\n \t\t\t\t\tcategory : product.category.join(\",\"),\n \t\t\t\t\tvariant : product.variant,\n \t\t\t\t\t// list_position: product.list_position, // doesn't make sense on mini_cart\n \t\t\t\t\tquantity: product.quantity,\n \t\t\t\t\tprice : product.price,\n \t\t\t\t},\n \t\t\t],\n \t\t})\n\t\t})\n\t} catch (e) {\n\t\tconsole.error(e)\n\t}\n})\n\n// begin_checkout event\njQuery(document).on(\"wpmBeginCheckout\", function (event) {\n\n\ttry {\n\t\tif (!wpmDataLayer?.pixels?.google?.analytics?.eec) return\n\t\tif (!wpmDataLayer?.pixels?.google?.analytics?.universal?.property_id) return\n\t\tif (!wpm.googleConfigConditionsMet(\"analytics\")) return\n\n\t\twpm.gtagLoaded().then(function () {\n\t\t gtag(\"event\", \"begin_checkout\", {\n \t\t\tsend_to : wpmDataLayer.pixels.google.analytics.universal.property_id,\n \t\t\tcurrency: wpmDataLayer.shop.currency,\n \t\t\titems : wpm.getCartItemsGaUa(),\n \t\t})\n\t\t})\n\t} catch (e) {\n\t\tconsole.error(e)\n\t}\n})\n\n// set_checkout_option event\njQuery(document).on(\"wpmFireCheckoutOption\", function (event, data) {\n\n\ttry {\n\t\tif (!wpmDataLayer?.pixels?.google?.analytics?.eec) return\n\t\tif (!wpmDataLayer?.pixels?.google?.analytics?.universal?.property_id) return\n\t\tif (!wpm.googleConfigConditionsMet(\"analytics\")) return\n\n\t\twpm.gtagLoaded().then(function () {\n\t\t gtag(\"event\", \"set_checkout_option\", {\n \t\t\tsend_to : wpmDataLayer.pixels.google.analytics.universal.property_id,\n \t\t\tcheckout_step : data.step,\n \t\t\tcheckout_option: data.checkout_option,\n \t\t\tvalue : data.value,\n \t\t})\n\t\t})\n\t} catch (e) {\n\t\tconsole.error(e)\n\t}\n})\n\n// checkout_progress event\njQuery(document).on(\"wpmFireCheckoutProgress\", function (event, data) {\n\n\ttry {\n\t\tif (!wpmDataLayer?.pixels?.google?.analytics?.eec) return\n\t\tif (!wpmDataLayer?.pixels?.google?.analytics?.universal?.property_id) return\n\t\tif (!wpm.googleConfigConditionsMet(\"analytics\")) return\n\n\t\twpm.gtagLoaded().then(function () {\n\t\t gtag(\"event\", \"checkout_progress\", {\n \t\t\tsend_to : wpmDataLayer.pixels.google.analytics.universal.property_id,\n \t\t\tcheckout_step: data.step,\n \t\t})\n\t\t})\n\t} catch (e) {\n\t\tconsole.error(e)\n\t}\n})\n\n// view search event\njQuery(document).on(\"wpmSearch\", function () {\n\n\ttry {\n\t\tif (!wpmDataLayer?.pixels?.google?.analytics?.eec) return\n\t\tif (!wpmDataLayer?.pixels?.google?.analytics?.universal?.property_id) return\n\t\tif (!wpm.googleConfigConditionsMet(\"analytics\")) return\n\n\t\tlet products = []\n\n\t\tfor (const [key, product] of Object.entries(wpmDataLayer.products)) {\n\t\t\t// console.log(`${key}: ${value}`);\n\n\t\t\tproducts.push({\n\t\t\t\tid : product.dyn_r_ids[wpmDataLayer.pixels.google.analytics.id_type],\n\t\t\t\tname : product.name,\n\t\t\t\tquantity: 1,\n\t\t\t\t// affiliation: \"\",\n\t\t\t\t// coupon: \"\",\n\t\t\t\t// discount: 0,\n\t\t\t\tlist_position: product.position,\n\t\t\t\tbrand : product.brand,\n\t\t\t\tcategory : product.category.join(\",\"),\n\t\t\t\tlist_name : wpmDataLayer.shop.list_name,\n\t\t\t\tvariant : product.variant,\n\t\t\t\tprice : product.price,\n\t\t\t})\n\t\t}\n\n\t\twpm.gtagLoaded().then(function () {\n\t\t\tgtag(\"event\", \"view_search_results\", {\n\t\t\t\tsend_to : wpmDataLayer.pixels.google.analytics.universal.property_id,\n\t\t\t\tsearch_term: wpm.getSearchTermFromUrl(),\n\t\t\t\titems : products,\n\t\t\t})\n\t\t})\n\t} catch (e) {\n\t\tconsole.error(e)\n\t}\n})\n\n// user log in event\njQuery(document).on(\"wpmLogin\", function () {\n\n\ttry {\n\t\tif (!wpmDataLayer?.pixels?.google?.analytics?.eec) return\n\t\tif (!wpmDataLayer?.pixels?.google?.analytics?.universal?.property_id) return\n\t\tif (!wpm.googleConfigConditionsMet(\"analytics\")) return\n\n\n\t\twpm.gtagLoaded().then(function () {\n\t\t gtag(\"event\", \"login\", {\n \t\t\tsend_to: wpmDataLayer.pixels.google.analytics.universal.property_id,\n \t\t})\n\t\t})\n\t} catch (e) {\n\t\tconsole.error(e)\n\t}\n})\n\n","/**\n * Add functions for Google Analytics Universal\n * */\n\n(function (wpm, $, undefined) {\n\n\twpm.getGAUAOrderItems = function () {\n\n\t\t// \"id\" : \"34\",\n\t\t// \"name\" : \"Hoodie\",\n\t\t// \"brand\" : \"\",\n\t\t// \"category\" : \"Hoodies\",\n\t\t// \"list_position\": 1,\n\t\t// \"price\" : 45,\n\t\t// \"quantity\" : 1,\n\t\t// \"variant\" : \"Color: blue | Logo: yes\"\n\n\n\t\tlet orderItems = [],\n\t\t\tlist_position = 1\n\n\t\tfor (const [key, item] of Object.entries(wpmDataLayer.order.items)) {\n\n\t\t\tlet orderItem\n\n\t\t\torderItem = {\n\t\t\t\tquantity : item.quantity,\n\t\t\t\tprice : item.price,\n\t\t\t\tname : item.name,\n\t\t\t\tcurrency : wpmDataLayer.order.currency,\n\t\t\t\tcategory : wpmDataLayer.products[item.id].category.join(\"/\"),\n\t\t\t\tlist_position: list_position,\n\t\t\t}\n\n\t\t\tif (wpmDataLayer?.general?.variationsOutput && 0 !== item.variation_id) {\n\n\t\t\t\torderItem.id = String(wpmDataLayer.products[item.variation_id].dyn_r_ids[wpmDataLayer.pixels.google.analytics.id_type])\n\t\t\t\torderItem.variant = wpmDataLayer.products[item.variation_id].variant_name\n\t\t\t\torderItem.brand = wpmDataLayer.products[item.variation_id].brand\n\t\t\t} else {\n\n\t\t\t\torderItem.id = String(wpmDataLayer.products[item.id].dyn_r_ids[wpmDataLayer.pixels.google.analytics.id_type])\n\t\t\t\torderItem.brand = wpmDataLayer.products[item.id].brand\n\t\t\t}\n\n\t\t\torderItems.push(orderItem)\n\t\t\tlist_position++\n\t\t}\n\n\t\treturn orderItems\n\t}\n\n}(window.wpm = window.wpm || {}, jQuery))\n\n\n/**\n * All event listeners\n * */\n\n\n// view order received page event\njQuery(document).on(\"wpmOrderReceivedPage\", function () {\n\n\ttry {\n\t\tif (!wpmDataLayer?.pixels?.google?.analytics?.universal?.property_id) return\n\t\tif (wpmDataLayer?.pixels?.google?.analytics?.universal?.mp_active) return\n\t\tif (!wpm.googleConfigConditionsMet(\"analytics\")) return\n\n\t\twpm.gtagLoaded().then(function () {\n\t\t\tgtag(\"event\", \"purchase\", {\n\t\t\t\tsend_to : [wpmDataLayer.pixels.google.analytics.universal.property_id],\n\t\t\t\ttransaction_id: wpmDataLayer.order.number,\n\t\t\t\taffiliation : wpmDataLayer.order.affiliation,\n\t\t\t\tcurrency : wpmDataLayer.order.currency,\n\t\t\t\tvalue : wpmDataLayer.order.value_regular,\n\t\t\t\tdiscount : wpmDataLayer.order.discount,\n\t\t\t\ttax : wpmDataLayer.order.tax,\n\t\t\t\tshipping : wpmDataLayer.order.shipping,\n\t\t\t\tcoupon : wpmDataLayer.order.coupon,\n\t\t\t\titems : wpm.getGAUAOrderItems(),\n\t\t\t})\n\t\t})\n\n\t\t// console.log(wpm.getGAUAOrderItems())\n\t} catch (e) {\n\t\tconsole.error(e)\n\t}\n})\n","(function (wpm, $, undefined) {\n\n\twpm.load_google_optimize_pixel = function () {\n\n\t\ttry {\n\t\t\twpmDataLayer.pixels.google.optimize.loaded = true\n\n\t\t\twpm.loadScriptAndCacheIt(\"https://www.googleoptimize.com/optimize.js?id=\" + wpmDataLayer.pixels.google.optimize.container_id)\n\t\t\t// .done(function (script, textStatus) {\n\t\t\t// \t\tconsole.log('Google Optimize loaded')\n\t\t\t// });\n\n\t\t} catch (e) {\n\t\t\tconsole.error(e)\n\t\t}\n\t}\n\n}(window.wpm = window.wpm || {}, jQuery));\n\n\n(function () {\n\n\tjQuery(document).on(\"wpmLoadPixels\", function () {\n\n\t\tif (wpmDataLayer?.pixels?.google?.optimize?.container_id && !wpmDataLayer?.pixels?.google?.optimize?.loaded) {\n\t\t\tif (wpm.canIFire(\"analytics\", \"google-optimize\")) wpm.load_google_optimize_pixel()\n\t\t}\n\t})\n\n})()\n\n\n\n","/**\n * Add functions for Google\n * */\n\n(function (wpm, $, undefined) {\n\n\twpm.googleConfigConditionsMet = function (type) {\n\t\t// always returns true if Google Consent Mode is active\n\t\tif (wpmDataLayer?.pixels?.google?.consent_mode?.active) {\n\t\t\treturn true\n\t\t} else if (wpm.getConsentValues().mode === \"category\") {\n\t\t\treturn wpm.getConsentValues().categories[type] === true\n\t\t} else if (wpm.getConsentValues().mode === \"pixel\") {\n\t\t\treturn wpm.getConsentValues().pixels.includes(\"google-\" + type)\n\t\t} else {\n\t\t\treturn false\n\t\t}\n\t}\n\n\twpm.getVisitorConsentStatusAndUpdateGoogleConsentSettings = function (google_consent_settings) {\n\n\t\tif (wpm.getConsentValues().mode === \"category\") {\n\t\t\tif (wpm.getConsentValues().categories.analytics) google_consent_settings.analytics_storage = \"granted\"\n\t\t\tif (wpm.getConsentValues().categories.ads) google_consent_settings.ad_storage = \"granted\"\n\t\t} else if ((wpm.getConsentValues().mode === \"pixel\")) {\n\t\t\tgoogle_consent_settings.analytics_storage = wpm.getConsentValues().pixels.includes(\"google-analytics\") ? \"granted\" : \"denied\"\n\t\t\tgoogle_consent_settings.ad_storage = wpm.getConsentValues().pixels.includes(\"google-ads\") ? \"granted\" : \"denied\"\n\t\t}\n\n\t\treturn google_consent_settings\n\t}\n\n\twpm.updateGoogleConsentMode = function (analytics = true, ads = true) {\n\n\t\ttry {\n\t\t\tif (\n\t\t\t\t!window.gtag ||\n\t\t\t\t!wpmDataLayer.shop.cookie_consent_mgmt.explicit_consent\n\t\t\t) return\n\n\t\t\tgtag(\"consent\", \"update\", {\n\t\t\t\tanalytics_storage: analytics ? \"granted\" : \"denied\",\n\t\t\t\tad_storage : ads ? \"granted\" : \"denied\",\n\t\t\t})\n\t\t} catch (e) {\n\t\t\tconsole.error(e)\n\t\t}\n\t}\n\n\twpm.fireGtagGoogleAds = function () {\n\t\ttry {\n\t\t\twpmDataLayer.pixels.google.ads.state = \"loading\"\n\n\t\t\tif (wpmDataLayer?.pixels?.google?.ads?.enhanced_conversions?.active) {\n\t\t\t\tfor (const [key, item] of Object.entries(wpmDataLayer.pixels.google.ads.conversionIds)) {\n\t\t\t\t\tgtag(\"config\", key, {\"allow_enhanced_conversions\": true})\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tfor (const [key, item] of Object.entries(wpmDataLayer.pixels.google.ads.conversionIds)) {\n\t\t\t\t\tgtag(\"config\", key)\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (wpmDataLayer?.pixels?.google?.ads?.conversionIds && wpmDataLayer?.pixels?.google?.ads?.phone_conversion_label && wpmDataLayer?.pixels?.google?.ads?.phone_conversion_number) {\n\t\t\t\tgtag(\"config\", Object.keys(wpmDataLayer.pixels.google.ads.conversionIds)[0] + \"/\" + wpmDataLayer.pixels.google.ads.phone_conversion_label, {\n\t\t\t\t\tphone_conversion_number: wpmDataLayer.pixels.google.ads.phone_conversion_number,\n\t\t\t\t})\n\t\t\t}\n\n\t\t\t// ! enhanced_conversion_data needs to be var\n\t\t\t// https://support.google.com/google-ads/answer/9888145#zippy=%2Cvalidate-your-implementation-using-chrome-developer-tools\n\t\t\tif (\"order_received_page\" === wpmDataLayer.shop.page_type && wpmDataLayer?.order?.google?.ads?.enhanced_conversion_data) {\n\t\t\t\twindow.enhanced_conversion_data = wpmDataLayer.order.google.ads.enhanced_conversion_data\n\t\t\t}\n\n\t\t\twpmDataLayer.pixels.google.ads.state = \"ready\"\n\t\t} catch (e) {\n\t\t\tconsole.error(e)\n\t\t}\n\t}\n\n\twpm.fireGtagGoogleAnalyticsUA = function () {\n\t\ttry {\n\t\t\twpmDataLayer.pixels.google.analytics.universal.state = \"loading\"\n\n\t\t\tgtag(\"config\", wpmDataLayer.pixels.google.analytics.universal.property_id, wpmDataLayer.pixels.google.analytics.universal.parameters)\n\t\t\twpmDataLayer.pixels.google.analytics.universal.state = \"ready\"\n\t\t} catch (e) {\n\t\t\tconsole.error(e)\n\t\t}\n\t}\n\n\twpm.fireGtagGoogleAnalyticsGA4 = function () {\n\t\ttry {\n\t\t\twpmDataLayer.pixels.google.analytics.ga4.state = \"loading\"\n\n\t\t\tgtag(\"config\", wpmDataLayer.pixels.google.analytics.ga4.measurement_id, wpmDataLayer.pixels.google.analytics.ga4.parameters)\n\t\t\twpmDataLayer.pixels.google.analytics.ga4.state = \"ready\"\n\t\t} catch (e) {\n\t\t\tconsole.error(e)\n\t\t}\n\t}\n\n\twpm.isGoogleActive = function () {\n\t\tif (\n\t\t\twpmDataLayer?.pixels?.google?.analytics?.universal?.property_id ||\n\t\t\twpmDataLayer?.pixels?.google?.analytics?.ga4?.measurement_id ||\n\t\t\t!jQuery.isEmptyObject(wpmDataLayer?.pixels?.google?.ads?.conversionIds)\n\t\t) {\n\t\t\treturn true\n\t\t} else {\n\t\t\treturn false\n\t\t}\n\t}\n\n\twpm.getGoogleGtagId = function () {\n\t\tif (wpmDataLayer?.pixels?.google?.analytics?.universal?.property_id) {\n\t\t\treturn wpmDataLayer.pixels.google.analytics.universal.property_id\n\t\t} else if (wpmDataLayer?.pixels?.google?.analytics?.ga4?.measurement_id) {\n\t\t\treturn wpmDataLayer.pixels.google.analytics.ga4.measurement_id\n\t\t} else {\n\t\t\treturn Object.keys(wpmDataLayer.pixels.google.ads.conversionIds)[0]\n\t\t}\n\t}\n\n\twpm.loadGoogle = function () {\n\n\t\tif (wpm.isGoogleActive()) {\n\n\t\t\twpmDataLayer.pixels.google.state = \"loading\"\n\n\t\t\twpm.loadScriptAndCacheIt(\"https://www.googletagmanager.com/gtag/js?id=\" + wpm.getGoogleGtagId())\n\t\t\t\t.done(function (script, textStatus) {\n\t\t\t\t\ttry {\n\t\t\t\t\t\t// console.log('Google Optimize loaded')\n\t\t\t\t\t\t// alert('Google Optimize loaded')\n\n\t\t\t\t\t\t// Initiate Google dataLayer and gtag\n\t\t\t\t\t\twindow.dataLayer = window.dataLayer || []\n\t\t\t\t\t\twindow.gtag = function gtag() {\n\t\t\t\t\t\t\tdataLayer.push(arguments)\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t// Google Consent Mode\n\t\t\t\t\t\tif (wpmDataLayer?.pixels?.google?.consent_mode?.active) {\n\n\t\t\t\t\t\t\tlet google_consent_settings = {\n\t\t\t\t\t\t\t\t\"ad_storage\" : wpmDataLayer.pixels.google.consent_mode.ad_storage,\n\t\t\t\t\t\t\t\t\"analytics_storage\": wpmDataLayer.pixels.google.consent_mode.analytics_storage,\n\t\t\t\t\t\t\t\t\"wait_for_update\" : wpmDataLayer.pixels.google.consent_mode.wait_for_update,\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\tif (wpmDataLayer?.pixels?.google?.consent_mode?.region) {\n\t\t\t\t\t\t\t\tgoogle_consent_settings.region = wpmDataLayer.pixels.google.consent_mode.region\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tgoogle_consent_settings = wpm.getVisitorConsentStatusAndUpdateGoogleConsentSettings(google_consent_settings)\n\n\t\t\t\t\t\t\tgtag(\"consent\", \"default\", google_consent_settings)\n\t\t\t\t\t\t\tgtag(\"set\", \"ads_data_redaction\", wpmDataLayer.pixels.google.consent_mode.ads_data_redaction)\n\t\t\t\t\t\t\tgtag(\"set\", \"url_passthrough\", wpmDataLayer.pixels.google.consent_mode.url_passthrough)\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t// Google Linker\n\t\t\t\t\t\t// https://developers.google.com/gtagjs/devguide/linker\n\t\t\t\t\t\tif (wpmDataLayer?.pixels?.google?.linker?.settings) {\n\t\t\t\t\t\t\tgtag(\"set\", \"linker\", wpmDataLayer.pixels.google.linker.settings)\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tgtag(\"js\", new Date())\n\n\t\t\t\t\t\t// Google Ads loader\n\t\t\t\t\t\tif (!jQuery.isEmptyObject(wpmDataLayer?.pixels?.google?.ads?.conversionIds)) { // Only run if the pixel has set up\n\t\t\t\t\t\t\tif (wpm.googleConfigConditionsMet(\"ads\")) { \t\t\t\t\t\t\t// Only run if cookie consent has been given\n\t\t\t\t\t\t\t\twpm.fireGtagGoogleAds()\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\twpm.logPreventedPixelLoading(\"google-ads\", \"ads\")\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\n\n\t\t\t\t\t\t// Google Universal Analytics loader\n\t\t\t\t\t\tif (wpmDataLayer?.pixels?.google?.analytics?.universal?.property_id) { \t\t// Only run if the pixel has set up\n\t\t\t\t\t\t\tif (wpm.googleConfigConditionsMet(\"analytics\")) {\t\t\t\t\t\t// Only run if cookie consent has been given\n\t\t\t\t\t\t\t\twpm.fireGtagGoogleAnalyticsUA()\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\twpm.logPreventedPixelLoading(\"google-universal-analytics\", \"analytics\")\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t// GA4 loader\n\t\t\t\t\t\tif (wpmDataLayer?.pixels?.google?.analytics?.ga4?.measurement_id) { \t\t\t// Only run if the pixel has set up\n\t\t\t\t\t\t\tif (wpm.googleConfigConditionsMet(\"analytics\")) {\t\t\t\t\t\t// Only run if cookie consent has been given\n\t\t\t\t\t\t\t\twpm.fireGtagGoogleAnalyticsGA4()\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\twpm.logPreventedPixelLoading(\"ga4\", \"analytics\")\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\twpmDataLayer.pixels.google.state = \"ready\"\n\t\t\t\t\t} catch (e) {\n\t\t\t\t\t\tconsole.error(e)\n\t\t\t\t\t}\n\t\t\t\t})\n\t\t}\n\t}\n\n\twpm.canGoogleLoad = function () {\n\n\t\tif (wpmDataLayer?.pixels?.google?.consent_mode?.active) {\n\t\t\treturn true\n\t\t} else if (\"category\" === wpm.getConsentValues().mode) {\n\t\t\treturn !!(wpm.getConsentValues().categories[\"ads\"] || wpm.getConsentValues().categories[\"analytics\"])\n\t\t} else if (\"pixel\" === wpm.getConsentValues().mode) {\n\t\t\treturn wpm.getConsentValues().pixels.includes(\"google-ads\") || wpm.getConsentValues().pixels.includes(\"google-analytics\")\n\t\t} else {\n\t\t\tconsole.error(\"Couldn't find a valid load condition for Google mode in wpmConsentValues\")\n\t\t\treturn false\n\t\t}\n\t}\n\n\twpm.gtagLoaded = function () {\n\t\treturn new Promise(function (resolve, reject) {\n\n\t\t\tif (typeof wpmDataLayer?.pixels?.google?.state === \"undefined\") reject()\n\n\t\t\tlet startTime = 0\n\t\t\tlet timeout = 5000\n\t\t\tlet frequency = 200;\n\n\t\t\t(function wait() {\n\t\t\t\tif (wpmDataLayer?.pixels?.google?.state === \"ready\") return resolve()\n\t\t\t\tif (startTime >= timeout) return reject()\n\t\t\t\tstartTime += frequency\n\t\t\t\tsetTimeout(wait, frequency)\n\t\t\t})()\n\t\t})\n\t}\n\n\t// wpm.gtagLoadednew = function () {\n\t// \treturn Promise.race([\n\t// \t\t\tnew Promise(function (resolve, reject) {\n\t//\n\t// \t\t\t\tif (typeof wpmDataLayer?.pixels?.google?.state === \"undefined\") reject();\n\t//\n\t//\n\t// \t\t\t\t(function wait() {\n\t// \t\t\t\t\tif (wpmDataLayer?.pixels?.google?.state === \"ready\") return resolve()\n\t// \t\t\t\t\tif (to >= 1000) return reject()\n\t// \t\t\t\t\tsetTimeout(wait, 100)\n\t// \t\t\t\t})()\n\t// \t\t\t}),\n\t// \t\t\tnew Promise(function (resolve, reject) {\n\t// \t\t\t\tsetTimeout(() => reject(), 1000)\n\t// \t\t\t}),\n\t// \t\t],\n\t// \t)\n\t// \t\t// .then((value) => {console.log(\"race then value: \" + value)})\n\t// \t\t.catch(\n\t// \t\t\t(value) => {\n\t// \t\t\t\tconsole.log(\"race catch value: \" + value)\n\t// \t\t\t\treturn Promise.reject()\n\t// \t\t\t})\n\t// }\n\n\n\t// const promise1 = new Promise((resolve, reject) => {\n\t// \tsetTimeout(resolve, 500, \"one\")\n\t// })\n\t//\n\t// const promise2 = new Promise((resolve, reject) => {\n\t// \tsetTimeout(reject, 100, \"two\")\n\t// })\n\t//\n\t// let onlyRunIfResolves = function () {\n\t// \treturn Promise.race([promise1, promise2])\n\t// \t\t.catch(() => {\n\t// \t\t})\n\t// }\n\t//\n\t// onlyRunIfResolves()\n\t// \t.then(() => {\n\t// \t\tconsole.log(\"running function\")\n\t// \t})\n\n\n}(window.wpm = window.wpm || {}, jQuery));\n\n\n(function () {\n\n\tjQuery(document).on(\"wpmLoadPixels\", function () {\n\n\t\tif (typeof wpmDataLayer?.pixels?.google?.state === \"undefined\") {\n\t\t\tif (wpm.canGoogleLoad()) {\n\t\t\t\twpm.loadGoogle()\n\t\t\t} else {\n\t\t\t\twpm.logPreventedPixelLoading(\"google\", \"analytics / ads\")\n\t\t\t}\n\t\t}\n\t})\n\n\t// return wpmDataLayer?.pixels?.google?.state === \"undefined\";\n\n})()\n","(function (wpm, $, undefined) {\n\n\twpm.getFormattedGA4Categories = function (productItems, categories) {\n\n\t\tlet maxCategories = 5\n\n\t\t// remove categories with equal names from array\n\t\tcategories = Array.from(new Set(categories))\n\n\t\tif (Array.isArray(categories) && categories.length) {\n\n\t\t\tproductItems[\"item_category\"] = categories[0]\n\n\t\t\tlet max = categories.length > maxCategories ? maxCategories : categories.length\n\n\t\t\tfor (let i = 1; i < max; i++) {\n\t\t\t\tproductItems[\"item_category\" + (i + 1)] = categories[i]\n\t\t\t}\n\t\t}\n\n\t\treturn productItems\n\t}\n\n\twpm.setGoogleCidOnServer = function () {\n\n\t\ttry {\n\n\t\t\tlet targetIDs = []\n\n\t\t\tif (wpmDataLayer?.pixels?.google?.analytics?.ga4?.measurement_id) targetIDs.push(wpmDataLayer.pixels.google.analytics.ga4.measurement_id)\n\t\t\tif (wpmDataLayer?.pixels?.google?.analytics?.universal?.property_id) targetIDs.push(wpmDataLayer.pixels.google.analytics.universal.property_id)\n\n\n\t\t\twpm.gtagLoaded().then(function () {\n\t\t\t gtag(\"get\", targetIDs[0], \"client_id\", (clientID) => {\n\n \t\t\t\t// save the state in the database\n \t\t\t\tlet data = {\n \t\t\t\t\taction: \"wpm_google_analytics_set_session_data\",\n \t\t\t\t\t// 'nonce' : wpm_google_premium_only_ajax_object.nonce,\n \t\t\t\t\t// 'nonce' : wpm.nonce,\n \t\t\t\t\ttarget_ids: targetIDs,\n \t\t\t\t\tclient_id : clientID,\n \t\t\t\t\treferrer : wpm.getReferrerFromCookie(),\n \t\t\t\t\tgclid : wpm.getClidFromBrowser(\"gclid\"),\n \t\t\t\t\t// dclid : wpm.getClidFromBrowser('dclid'),\n \t\t\t\t\tuserAgent : wpm.getUserAgent(),\n \t\t\t\t\tviewPortWidth : wpm.getViewPort().width,\n \t\t\t\t\tviewPortHeight: wpm.getViewPort().height,\n \t\t\t\t}\n\n \t\t\t\tjQuery.ajax(\n \t\t\t\t\t{\n \t\t\t\t\t\ttype : \"post\",\n \t\t\t\t\t\tdataType: \"json\",\n \t\t\t\t\t\t// url : wpm_google_premium_only_ajax_object.ajax_url,\n \t\t\t\t\t\turl : wpm.ajax_url,\n \t\t\t\t\t\tdata : data,\n \t\t\t\t\t\tsuccess: function (response) {\n\n \t\t\t\t\t\t\tif (response[\"success\"] === true) {\n \t\t\t\t\t\t\t\tif (window.sessionStorage) {\n \t\t\t\t\t\t\t\t\ttargetIDs.forEach((targetId) => {\n \t\t\t\t\t\t\t\t\t\twindow.sessionStorage.setItem('_wpm_ga_cid_set', JSON.stringify(true))\n \t\t\t\t\t\t\t\t\t\twindow.sessionStorage.setItem(\"wpm_cid_\" + targetId + \"_\" + clientID + \"_set\", JSON.stringify(true))\n \t\t\t\t\t\t\t\t\t})\n \t\t\t\t\t\t\t\t} else {\n \t\t\t\t\t\t\t\t\ttargetIDs.forEach((targetId) => {\n \t\t\t\t\t\t\t\t\t\twpm.setCookie(\"wpm_cid_\" + targetId + \"_\" + clientID + \"_set\", true)\n \t\t\t\t\t\t\t\t\t})\n \t\t\t\t\t\t\t\t}\n \t\t\t\t\t\t\t}\n \t\t\t\t\t\t},\n \t\t\t\t\t\terror : function (response) {\n \t\t\t\t\t\t\tconsole.error(response)\n \t\t\t\t\t\t},\n \t\t\t\t\t})\n\n \t\t\t\t// wp.ajax.post('wpm_google_analytics_set_session_data', data)\n \t\t\t\t// .done(function (response) {\n \t\t\t\t//\n \t\t\t\t// // console.log(response);\n \t\t\t\t//\n \t\t\t\t// if (response === 'success') {\n \t\t\t\t// if (window.sessionStorage) {\n \t\t\t\t// // console.log('setting session storage');\n \t\t\t\t// window.sessionStorage.setItem(cidSetOnServerCookie, JSON.stringify(true));\n \t\t\t\t// } else {\n \t\t\t\t// // console.log('not setting session storage');\n \t\t\t\t//\n \t\t\t\t// wpm.setCookie(cidSetOnServerCookie, true);\n \t\t\t\t// }\n \t\t\t\t// }\n \t\t\t\t// })\n \t\t\t\t// .fail(function (response) {\n \t\t\t\t// console.log(response);\n \t\t\t\t// });\n \t\t\t})\n\t\t\t})\n\n\t\t} catch (e) {\n\t\t\tconsole.error(e)\n\t\t}\n\t}\n\n}(window.wpm = window.wpm || {}, jQuery))\n\n\njQuery(window).on(\"wpmLoadAlways\", function () {\n\n\ttry {\n\t\tif (\n\t\t\twpmDataLayer?.pixels?.google?.analytics?.eec &&\n\t\t\t!window?.sessionStorage?.getItem('_wpm_ga_cid_set', JSON.parse(true)) &&\n\t\t\t(\n\t\t\t\twpmDataLayer?.pixels?.google?.analytics?.universal?.property_id ||\n\t\t\t\twpmDataLayer?.pixels?.google?.analytics?.ga4?.measurement_id\n\t\t\t)\n\t\t) {\n\t\t\t// We need to be sure that we capture the cid early enough, because the\n\t\t\t// shop might be using a one click checkout button as early as on the product page.\n\t\t\tif ([\"cart\", \"checkout\"].indexOf(wpmDataLayer.shop.page_type) >= 0) {\n\t\t\t\twpm.setGoogleCidOnServer()\n\t\t\t}\n\t\t}\n\t} catch (e) {\n\t\tconsole.error(e)\n\t}\n})\n\n","(function (wpm, $, undefined) {\n\n\twpm.load_hotjar_pixel = function () {\n\n\t\ttry {\n\t\t\twpmDataLayer.pixels.hotjar.loaded = true;\n\n\t\t\t// @formatter:off\n\t\t\t(function(h,o,t,j,a,r){\n\t\t\t\th.hj=h.hj||function(){(h.hj.q=h.hj.q||[]).push(arguments)};\n\t\t\t\th._hjSettings={hjid:wpmDataLayer.pixels.hotjar.site_id,hjsv:6};\n\t\t\t\ta=o.getElementsByTagName('head')[0];\n\t\t\t\tr=o.createElement('script');r.async=1;\n\t\t\t\tr.src=t+h._hjSettings.hjid+j+h._hjSettings.hjsv;\n\t\t\t\ta.appendChild(r);\n\t\t\t})(window,document,'https://static.hotjar.com/c/hotjar-','.js?sv=');\n\t\t\t// @formatter:on\n\n\t\t} catch (e) {\n\t\t\tconsole.error(e)\n\t\t}\n\t}\n\n}(window.wpm = window.wpm || {}, jQuery));\n\n\n(function () {\n\n\tjQuery(document).on(\"wpmLoadPixels\", function () {\n\n\t\tif (wpmDataLayer?.pixels?.hotjar?.site_id && !wpmDataLayer?.pixels?.hotjar?.loaded) {\n\t\t\tif (wpm.canIFire(\"analytics\", \"hotjar\") && !wpmDataLayer?.pixels?.hotjar?.loaded) wpm.load_hotjar_pixel()\n\t\t}\n\t})\n\n})()\n\n\n\n","/**\n * Add functions for Microsoft Ads\n * */\n\n(function (wpm, $, undefined) {\n\n\twpm.load_bing_pixel = function () {\n\n\t\ttry {\n\t\t\twpmDataLayer.pixels.bing.loaded = true\n\n\t\t\t// @formatter:off\n\t\t\twindow.uetq = window.uetq || [];\n\n\t\t\t(function(w,d,t,r,u){var f,n,i;w[u]=w[u]||[],f=function(){var o={ti:wpmDataLayer.pixels.bing.uet_tag_id};o.q=w[u],w[u]=new UET(o),w[u].push(\"pageLoad\")},n=d.createElement(t),n.src=r,n.async=1,n.onload=n.onreadystatechange=function(){var s=this.readyState;s&&s!==\"loaded\"&&s!==\"complete\"||(f(),n.onload=n.onreadystatechange=null)},i=d.getElementsByTagName(t)[0],i.parentNode.insertBefore(n,i)})(window,document,\"script\",\"//bat.bing.com/bat.js\",\"uetq\");\n\t\t\t// @formatter:on\n\t\t\t\n\t\t} catch (e) {\n\t\t\tconsole.error(e)\n\t\t}\n\t}\n\n\twpm.bing_purchase_ecomm_prodids = function () {\n\n\t\tlet prodIds = []\n\n\t\tfor (const [key, orderItem] of Object.entries(wpmDataLayer.order.items)) {\n\n\t\t\tif (wpmDataLayer?.general?.variationsOutput && 0 !== orderItem.variation_id) {\n\t\t\t\tprodIds.push(String(wpmDataLayer.products[orderItem.variation_id].dyn_r_ids[wpmDataLayer.pixels.bing.dynamic_remarketing.id_type]))\n\t\t\t} else {\n\t\t\t\tprodIds.push(String(wpmDataLayer.products[orderItem.id].dyn_r_ids[wpmDataLayer.pixels.bing.dynamic_remarketing.id_type]))\n\t\t\t}\n\t\t}\n\n\t\treturn prodIds\n\t}\n\n\twpm.bing_purchase_items = function () {\n\n\t\tlet orderItems = []\n\n\t\tfor (const [key, item] of Object.entries(wpmDataLayer.order.items)) {\n\n\t\t\tlet orderItem\n\n\t\t\torderItem = {\n\t\t\t\tquantity: item.quantity,\n\t\t\t\tprice : item.price,\n\t\t\t}\n\n\t\t\tif (wpmDataLayer?.general?.variationsOutput && 0 !== item.variation_id) {\n\n\t\t\t\torderItem.id = String(wpmDataLayer.products[item.variation_id].dyn_r_ids[wpmDataLayer.pixels.bing.dynamic_remarketing.id_type])\n\t\t\t\torderItems.push(orderItem)\n\t\t\t} else {\n\n\t\t\t\torderItem.id = String(wpmDataLayer.products[item.id].dyn_r_ids[wpmDataLayer.pixels.bing.dynamic_remarketing.id_type])\n\t\t\t\torderItems.push(orderItem)\n\t\t\t}\n\t\t}\n\n\t\treturn orderItems\n\t}\n\n}(window.wpm = window.wpm || {}, jQuery));\n\n\n/**\n * Execute as soon as possible\n * */\n\n(function () {\n\n\tjQuery(document).on(\"wpmLoadPixels\", function () {\n\n\t\tif (wpmDataLayer?.pixels?.bing?.uet_tag_id && !wpmDataLayer?.pixels?.bing?.loaded) {\n\t\t\tif (wpm.canIFire(\"ads\", \"bing-ads\")) wpm.load_bing_pixel()\n\t\t}\n\t})\n\n})()\n\n\n/**\n * All event listeners\n * */\n\n// add-to-cart event\njQuery(document).on(\"wpmAddToCart\", function (event, product) {\n\n\ttry {\n\t\tif (!wpmDataLayer?.pixels?.bing?.loaded) return\n\n\t\twindow.uetq.push(\"event\", \"\", {\n\t\t\tecomm_pagetype: \"cart\",\n\t\t\tecomm_prodid : product.dyn_r_ids[wpmDataLayer.pixels.bing.dynamic_remarketing.id_type],\n\t\t})\n\t} catch (e) {\n\t\tconsole.error(e)\n\t}\n})\n\n// view product event\njQuery(document).on(\"wpmViewItem\", function (event, product) {\n\n\ttry {\n\t\tif (!wpmDataLayer?.pixels?.bing?.loaded) return\n\n\t\twindow.uetq.push(\"event\", \"\", {\n\t\t\tecomm_pagetype: \"product\",\n\t\t\tecomm_prodid : product.dyn_r_ids[wpmDataLayer.pixels.bing.dynamic_remarketing.id_type],\n\t\t})\n\t} catch (e) {\n\t\tconsole.error(e)\n\t}\n})\n\n// view category event\njQuery(document).on(\"wpmCategory\", function () {\n\n\ttry {\n\t\tif (!wpmDataLayer?.pixels?.bing?.loaded) return\n\n\t\twindow.uetq.push(\"event\", \"\", {\n\t\t\tecomm_pagetype: \"category\",\n\t\t})\n\t} catch (e) {\n\t\tconsole.error(e)\n\t}\n})\n\n// view search event\njQuery(document).on(\"wpmSearch\", function () {\n\n\ttry {\n\t\tif (!wpmDataLayer?.pixels?.bing?.loaded) return\n\n\t\twindow.uetq.push(\"event\", \"\", {\n\t\t\tecomm_pagetype: \"searchresults\",\n\t\t})\n\t} catch (e) {\n\t\tconsole.error(e)\n\t}\n})\n\n// view order received page event\n// https://help.ads.microsoft.com/#apex/ads/en/60118/-1\njQuery(document).on(\"wpmOrderReceivedPage\", function () {\n\n\ttry {\n\t\tif (!wpmDataLayer?.pixels?.bing?.loaded) return\n\n\t\twindow.uetq.push(\"event\", \"purchase\", {\n\t\t\tecomm_pagetype: \"purchase\",\n\t\t\tecomm_prodid : wpm.bing_purchase_ecomm_prodids(),\n\t\t\trevenue_value : wpmDataLayer.order.value_filtered,\n\t\t\tcurrency : wpmDataLayer.order.currency,\n\t\t\titems : wpm.bing_purchase_items(),\n\t\t})\n\n\t\t// console.log('test')\n\t\t// console.log(wpm.bing_purchase_ecomm_prodids())\n\t\t// console.log(wpm.bing_purchase_items())\n\t} catch (e) {\n\t\tconsole.error(e)\n\t}\n})\n\n","// TODO add enhanced match email hash to uncached pages like cart and purchase confirmation page\n// TODO check if more values can be passed to product and category pages\n// TODO look into how Pinterest handles variants separately https://developers.pinterest.com/docs/tag/conversion/\n\n/**\n * Add functions for Pinterest\n * */\n\n(function (wpm, $, undefined) {\n\n\twpm.getPinterestProductData = function (product) {\n\n\t\t// console.log(product)\n\n\t\tif (product.isVariation) {\n\t\t\treturn {\n\t\t\t\tproduct_name : product.name,\n\t\t\t\tproduct_variant_id: product.dyn_r_ids[wpmDataLayer.pixels.pinterest.dynamic_remarketing.id_type],\n\t\t\t\t// product_id : wpmDataLayer.products[product.parentId].dyn_r_ids[wpmDataLayer.pixels.pinterest.dynamic_remarketing.id_type],\n\t\t\t\tproduct_id : product.parentId_dyn_r_ids[wpmDataLayer.pixels.pinterest.dynamic_remarketing.id_type],\n\t\t\t\tproduct_category: product.category,\n\t\t\t\tproduct_variant : product.variant,\n\t\t\t\tproduct_price : product.price,\n\t\t\t\tproduct_quantity: product.quantity,\n\t\t\t\tproduct_brand : product.brand,\n\t\t\t}\n\t\t} else {\n\t\t\treturn {\n\t\t\t\tproduct_name : product.name,\n\t\t\t\tproduct_id : product.dyn_r_ids[wpmDataLayer.pixels.pinterest.dynamic_remarketing.id_type],\n\t\t\t\tproduct_category: product.category,\n\t\t\t\tproduct_price : product.price,\n\t\t\t\tproduct_quantity: product.quantity,\n\t\t\t\tproduct_brand : product.brand,\n\t\t\t}\n\t\t}\n\t}\n\n\twpm.pinterestFormattedOrderItems = function () {\n\n\t\tlet orderItems = []\n\n\t\tfor (const [key, item] of Object.entries(wpmDataLayer.order.items)) {\n\n\t\t\tlet orderItem\n\n\t\t\torderItem = {\n\t\t\t\tproduct_category: wpmDataLayer.products[key].category.join(\",\"),\n\t\t\t\t// product_brand : wpmDataLayer.products[key].brand,\n\t\t\t\tproduct_quantity: item.quantity,\n\t\t\t\tproduct_price : item.price,\n\t\t\t}\n\n\t\t\tif (wpmDataLayer?.general?.variationsOutput && 0 !== item.variation_id) {\n\n\t\t\t\torderItem.product_id = String(wpmDataLayer.products[item.variation_id].dyn_r_ids[wpmDataLayer.pixels.pinterest.dynamic_remarketing.id_type])\n\t\t\t\torderItem.product_name = wpmDataLayer.products[item.variation_id].name\n\t\t\t\torderItems.push(orderItem)\n\t\t\t} else {\n\n\t\t\t\torderItem.product_id = String(wpmDataLayer.products[item.id].dyn_r_ids[wpmDataLayer.pixels.pinterest.dynamic_remarketing.id_type])\n\t\t\t\torderItem.product_name = wpmDataLayer.products[item.id].name\n\t\t\t\torderItems.push(orderItem)\n\t\t\t}\n\t\t}\n\n\t\treturn orderItems\n\t}\n\n\t// https://developers.pinterest.com/docs/tag/conversion/\n\twpm.loadPinterestPixel = function () {\n\n\t\ttry {\n\t\t\twpmDataLayer.pixels.pinterest.loaded = true\n\n\t\t\t// @formatter:off\n\t\t\t!function(e){if(!window.pintrk){window.pintrk=function(){window.pintrk.queue.push(\n\t\t\t\tArray.prototype.slice.call(arguments))};var\n\t\t\t\tn=window.pintrk;n.queue=[],n.version=\"3.0\";var\n\t\t\t\tt=document.createElement(\"script\");t.async=!0,t.src=e;var\n\t\t\t\tr=document.getElementsByTagName(\"script\")[0];r.parentNode.insertBefore(t,r)}}(\"https://s.pinimg.com/ct/core.js\");\n\n\t\t\twpm.pinterestLoadEvent();\n\t\t\tpintrk('page');\n\t\t\t// @formatter:on\n\n\t\t} catch (e) {\n\t\t\tconsole.error(e)\n\t\t}\n\t}\n\n\twpm.pinterestLoadEvent = function () {\n\t\ttry {\n\t\t\tif (\n\t\t\t\t(\n\t\t\t\t\twpmDataLayer.general.userLoggedIn ||\n\t\t\t\t\t\"order_received_page\" === wpmDataLayer.shop.page_type\n\t\t\t\t)\n\t\t\t\t&& wpmDataLayer?.pixels?.pinterest?.enhanced_match\n\t\t\t) {\n\t\t\t\tpintrk(\"load\", wpmDataLayer.pixels.pinterest.pixel_id, {em: wpmDataLayer.pixels.pinterest.enhanced_match_email})\n\t\t\t} else {\n\t\t\t\tpintrk(\"load\", wpmDataLayer.pixels.pinterest.pixel_id)\n\t\t\t}\n\t\t} catch (e) {\n\t\t\tconsole.error(e)\n\t\t}\n\t}\n\n}(window.wpm = window.wpm || {}, jQuery));\n\n/**\n * Execute as soon as possible\n * */\n\n(function () {\n\n\tjQuery(document).on(\"wpmLoadPixels\", function () {\n\n\t\tif (wpmDataLayer?.pixels?.pinterest?.pixel_id && !wpmDataLayer?.pixels?.pinterest?.loaded) {\n\t\t\tif (wpm.canIFire(\"ads\", \"pinterest-ads\")) wpm.loadPinterestPixel()\n\t\t}\n\t})\n\n})()\n\n\n/**\n * All event listeners\n * */\n\n// https://help.pinterest.com/en/business/article/add-event-codes\n\n// AddToCart event\njQuery(document).on(\"wpmAddToCart\", function (event, product) {\n\n\ttry {\n\t\tif (!wpmDataLayer?.pixels?.pinterest?.loaded) return\n\n\t\t// console.log('firing Pinterest ads AddToCart event');\n\t\t// console.log(product);\n\n\t\tpintrk(\"track\", \"addtocart\", {\n\t\t\tvalue : parseFloat(product.quantity * product.price),\n\t\t\tcurrency : product.currency,\n\t\t\tline_items: [wpm.getPinterestProductData(product)],\n\t\t})\n\t} catch (e) {\n\t\tconsole.error(e)\n\t}\n})\n\n// pageview event\njQuery(document).on(\"wpmViewItem\", function (event, product) {\n\n\ttry {\n\t\tif (!wpmDataLayer?.pixels?.pinterest?.loaded) return\n\n\t\t// console.log('firing Pinterest pageview event');\n\t\t// console.log(product);\n\n\t\tpintrk(\"track\", \"pagevisit\", {\n\t\t\tcurrency : product.currency,\n\t\t\tline_items: [wpm.getPinterestProductData(product)],\n\t\t})\n\t} catch (e) {\n\t\tconsole.error(e)\n\t}\n})\n\n// view product event\njQuery(document).on(\"wpmViewItem\", function (event, product) {\n\n\ttry {\n\t\tif (!wpmDataLayer?.pixels?.pinterest?.loaded) return\n\n\t\tlet productData = wpm.getPinterestProductData(product)\n\n\t\tpintrk(\"track\", \"pagevisit\", {\n\t\t\tcurrency : product.currency,\n\t\t\tline_items: [productData],\n\t\t})\n\t} catch (e) {\n\t\tconsole.error(e)\n\t}\n})\n\n// view search event\njQuery(document).on(\"wpmSearch\", function () {\n\n\ttry {\n\t\tif (!wpmDataLayer?.pixels?.pinterest?.loaded) return\n\n\t\tlet urlParams = new URLSearchParams(window.location.search)\n\n\t\tpintrk(\"track\", \"search\", {\n\t\t\tsearch_query: urlParams.get(\"s\"),\n\t\t})\n\t} catch (e) {\n\t\tconsole.error(e)\n\t}\n})\n\n// view category event\njQuery(document).on(\"wpmCategory\", function () {\n\n\ttry {\n\t\tif (!wpmDataLayer?.pixels?.pinterest?.loaded) return\n\n\t\tpintrk(\"track\", \"viewcategory\")\n\t} catch (e) {\n\t\tconsole.error(e)\n\t}\n})\n\n\n// view order received page event\n// https://developers.pinterest.com/docs/tag/conversion/\njQuery(document).on(\"wpmOrderReceivedPage\", function () {\n\n\ttry {\n\t\tif (!wpmDataLayer?.pixels?.pinterest?.loaded) return\n\n\t\tpintrk(\"track\", \"checkout\", {\n\t\t\tvalue : wpmDataLayer.order.value_filtered,\n\t\t\torder_quantity: wpmDataLayer.order.quantity,\n\t\t\tcurrency : wpmDataLayer.order.currency,\n\t\t\torder_id : wpmDataLayer.order.id,\n\t\t\tline_items : wpm.pinterestFormattedOrderItems(),\n\t\t})\n\n\t\t// console.log(wpm.pinterestFormattedOrderItems())\n\t} catch (e) {\n\t\tconsole.error(e)\n\t}\n})\n","// TODO check all events and add more if there are any\n\n/**\n * Add functions for Snapchat Ads\n * */\n\n(function (wpm, $, undefined) {\n\n\twpm.snapchatGetEmail = function () {\n\t\tlet userInfo = {}\n\n\t\tif (wpmDataLayer?.user?.email_sha256) {\n\t\t\tuserInfo.user_hashed_email = wpmDataLayer.user?.email_sha256\n\t\t}\n\t\t// console.log(userInfo)\n\t\treturn userInfo\n\t}\n\n\twpm.loadSnapchatPixel = function () {\n\n\t\ttry {\n\t\t\twpmDataLayer.pixels.snapchat.loaded = true;\n\n\t\t\t// @formatter:off\n\t\t\t(function(e,t,n){if(e.snaptr)return;var a=e.snaptr=function()\n\t\t\t{a.handleRequest?a.handleRequest.apply(a,arguments):a.queue.push(arguments)};\n\t\t\t\ta.queue=[];var s='script';r=t.createElement(s);r.async=!0;\n\t\t\t\tr.src=n;var u=t.getElementsByTagName(s)[0];\n\t\t\t\tu.parentNode.insertBefore(r,u);})(window,document,\n\t\t\t\t'https://sc-static.net/scevent.min.js');\n\t\t\t// @formatter:on\n\n\t\t\tsnaptr(\"init\", wpmDataLayer.pixels.snapchat.pixel_id, wpm.snapchatGetEmail())\n\t\t\tsnaptr(\"track\", \"PAGE_VIEW\")\n\n\t\t} catch (e) {\n\t\t\tconsole.error(e)\n\t\t}\n\t}\n\n\twpm.getSnapchatOrderItemIds = function () {\n\t\tlet contentIds = []\n\n\t\tfor (const [key, item] of Object.entries(wpmDataLayer.order.items)) {\n\n\t\t\tif (wpmDataLayer?.general?.variationsOutput && 0 !== item.variation_id) {\n\t\t\t\tcontentIds.push(String(wpmDataLayer.products[item.variation_id].dyn_r_ids[wpmDataLayer.pixels.snapchat.dynamic_remarketing.id_type]))\n\t\t\t} else {\n\t\t\t\tcontentIds.push(String(wpmDataLayer.products[item.id].dyn_r_ids[wpmDataLayer.pixels.snapchat.dynamic_remarketing.id_type]))\n\t\t\t}\n\t\t}\n\n\t\treturn contentIds\n\t}\n\n}(window.wpm = window.wpm || {}, jQuery));\n\n/**\n * Execute as soon as possible\n * */\n\n(function () {\n\n\tjQuery(document).on(\"wpmLoadPixels\", function () {\n\n\t\tif (wpmDataLayer?.pixels?.snapchat?.pixel_id && !wpmDataLayer?.pixels?.snapchat?.loaded) {\n\t\t\tif (wpm.canIFire(\"ads\", \"snapchat-ads\")) wpm.loadSnapchatPixel()\n\t\t}\n\t})\n\n})()\n\n\n/**\n * All event listeners\n * */\n\n// AddToCart event\njQuery(document).on(\"wpmAddToCart\", function (event, product) {\n\n\ttry {\n\t\tif (!wpmDataLayer?.pixels?.snapchat?.loaded) return\n\n\t\tsnaptr(\"track\", \"ADD_CART\", {\n\t\t\titem_ids: [product.dyn_r_ids[wpmDataLayer.pixels.snapchat.dynamic_remarketing.id_type]],\n\t\t})\n\t} catch (e) {\n\t\tconsole.error(e)\n\t}\n})\n\n// VIEW_CONTENT event\njQuery(document).on(\"wpmViewItem\", function (event, product) {\n\n\ttry {\n\t\tif (!wpmDataLayer?.pixels?.snapchat?.loaded) return\n\n\t\tsnaptr(\"track\", \"VIEW_CONTENT\", {\n\t\t\titem_ids: [product.dyn_r_ids[wpmDataLayer.pixels.snapchat.dynamic_remarketing.id_type]],\n\t\t})\n\t} catch (e) {\n\t\tconsole.error(e)\n\t}\n})\n\n\n// view order received page event\njQuery(document).on(\"wpmOrderReceivedPage\", function () {\n\n\ttry {\n\t\tif (!wpmDataLayer?.pixels?.snapchat?.loaded) return\n\n\t\tsnaptr(\"track\", \"PURCHASE\", {\n\t\t\tcurrency : wpmDataLayer.order.currency,\n\t\t\tprice : wpmDataLayer.order.value_filtered,\n\t\t\ttransaction_id: wpmDataLayer.order.id,\n\t\t\titem_ids : wpm.getSnapchatOrderItemIds(),\n\t\t})\n\n\t\t// console.log(wpm.getSnapchatOrderItemIds())\n\t\t// console.log({price: wpmDataLayer.order.value_filtered})\n\t\t// console.log({transaction_id: wpmDataLayer.order.id})\n\t} catch (e) {\n\t\tconsole.error(e)\n\t}\n})\n","// https://ads.tiktok.com/help/article?aid=10028\n\n// TODO check all events and add more if there are any\n\n\n/**\n * Add functions for TikTok Ads\n * */\n\n(function (wpm, $, undefined) {\n\n\twpm.loadTikTokPixel = function () {\n\n\t\ttry {\n\t\t\twpmDataLayer.pixels.tiktok.loaded = true\n\n\t\t\t// @formatter:off\n\t\t\t!function (w, d, t) {\n\t\t\t\tw.TiktokAnalyticsObject=t;var ttq=w[t]=w[t]||[];ttq.methods=[\"page\",\"track\",\"identify\",\"instances\",\"debug\",\"on\",\"off\",\"once\",\"ready\",\"alias\",\"group\",\"enableCookie\",\"disableCookie\"],ttq.setAndDefer=function(t,e){t[e]=function(){t.push([e].concat(Array.prototype.slice.call(arguments,0)))}};for(var i=0;i<ttq.methods.length;i++)ttq.setAndDefer(ttq,ttq.methods[i]);ttq.instance=function(t){for(var e=ttq._i[t]||[],n=0;n<ttq.methods.length;n++)ttq.setAndDefer(e,ttq.methods[n]);return e},ttq.load=function(e,n){var i=\"https://analytics.tiktok.com/i18n/pixel/events.js\";ttq._i=ttq._i||{},ttq._i[e]=[],ttq._i[e]._u=i,ttq._t=ttq._t||{},ttq._t[e]=+new Date,ttq._o=ttq._o||{},ttq._o[e]=n||{};var o=document.createElement(\"script\");o.type=\"text/javascript\",o.async=!0,o.src=i+\"?sdkid=\"+e+\"&lib=\"+t;var a=document.getElementsByTagName(\"script\")[0];a.parentNode.insertBefore(o,a)};\n\t\t\t\tttq.load(wpmDataLayer.pixels.tiktok.pixel_id);\n\t\t\t\tttq.page();\n\t\t\t}(window, document, 'ttq');\n\t\t\t// @formatter:on\n\n\t\t\tttq.track(\"Browse\")\n\n\t\t} catch (e) {\n\t\t\tconsole.error(e)\n\t\t}\n\t}\n\n\twpm.getTikTokOrderItemIds = function () {\n\n\t\tlet orderItems = []\n\n\t\tfor (const [key, item] of Object.entries(wpmDataLayer.order.items)) {\n\n\t\t\tlet orderItem\n\n\t\t\torderItem = {\n\t\t\t\tcontent_type: \"product\",\n\t\t\t\tquantity : item.quantity,\n\t\t\t\tprice : item.price,\n\t\t\t}\n\n\t\t\tif (wpmDataLayer?.general?.variationsOutput && 0 !== item.variation_id) {\n\n\t\t\t\torderItem.content_id = String(wpmDataLayer.products[item.variation_id].dyn_r_ids[wpmDataLayer.pixels.bing.dynamic_remarketing.id_type])\n\t\t\t\torderItem.content_name = wpmDataLayer.products[item.variation_id].name\n\t\t\t\torderItems.push(orderItem)\n\t\t\t} else {\n\n\t\t\t\torderItem.content_id = String(wpmDataLayer.products[item.id].dyn_r_ids[wpmDataLayer.pixels.bing.dynamic_remarketing.id_type])\n\t\t\t\torderItem.content_name = wpmDataLayer.products[item.id].name\n\t\t\t\torderItems.push(orderItem)\n\t\t\t}\n\t\t}\n\n\t\treturn orderItems\n\t}\n\n}(window.wpm = window.wpm || {}, jQuery));\n\n/**\n * Execute as soon as possible\n * */\n\n(function () {\n\n\tjQuery(document).on(\"wpmLoadPixels\", function () {\n\n\t\tif (wpmDataLayer?.pixels?.tiktok?.pixel_id && !wpmDataLayer?.pixels?.tiktok?.loaded) {\n\t\t\tif (wpm.canIFire(\"ads\", \"tiktok-ads\")) wpm.loadTikTokPixel()\n\t\t}\n\t})\n\n})()\n\n/**\n * All event listeners\n * */\n\n// AddToCart event\njQuery(document).on(\"wpmAddToCart\", function (event, product) {\n\n\ttry {\n\t\tif (!wpmDataLayer?.pixels?.tiktok?.loaded) return\n\n\t\tttq.track(\"AddToCart\", {\n\t\t\tcontent_id : product.dyn_r_ids[wpmDataLayer.pixels.tiktok.dynamic_remarketing.id_type],\n\t\t\tcontent_type: \"product\",\n\t\t\tcontent_name: product.name,\n\t\t\tquantity : product.quantity,\n\t\t\tvalue : product.price,\n\t\t\tcurrency : product.currency,\n\t\t})\n\t} catch (e) {\n\t\tconsole.error(e)\n\t}\n})\n\n// InitiateCheckout event\njQuery(document).on(\"wpmBeginCheckout\", function (event) {\n\n\ttry {\n\t\tif (!wpmDataLayer?.pixels?.tiktok?.loaded) return\n\n\t\tttq.track(\"InitiateCheckout\")\n\t} catch (e) {\n\t\tconsole.error(e)\n\t}\n})\n\n// ViewContent event\njQuery(document).on(\"wpmViewItem\", function (event, product) {\n\n\ttry {\n\t\tif (!wpmDataLayer?.pixels?.tiktok?.loaded) return\n\n\t\tttq.track(\"ViewContent\", {\n\t\t\tcontent_id : product.dyn_r_ids[wpmDataLayer.pixels.tiktok.dynamic_remarketing.id_type],\n\t\t\tcontent_type: \"product\",\n\t\t\tcontent_name: product.name,\n\t\t\tquantity : product.quantity,\n\t\t\tvalue : product.price,\n\t\t\tcurrency : product.currency,\n\t\t})\n\t} catch (e) {\n\t\tconsole.error(e)\n\t}\n})\n\n// AddToWishlist event\njQuery(document).on(\"wpmAddToWishlist\", function (event, product) {\n\n\ttry {\n\t\tif (!wpmDataLayer?.pixels?.tiktok?.loaded) return\n\n\t\tttq.track(\"AddToWishlist\", {\n\t\t\tcontent_id : product.dyn_r_ids[wpmDataLayer.pixels.tiktok.dynamic_remarketing.id_type],\n\t\t\tcontent_type: \"product\",\n\t\t\tcontent_name: product.name,\n\t\t\tquantity : product.quantity,\n\t\t\tvalue : product.price,\n\t\t\tcurrency : product.currency,\n\t\t})\n\t} catch (e) {\n\t\tconsole.error(e)\n\t}\n})\n\n// search event\njQuery(document).on(\"wpmSearch\", function () {\n\n\ttry {\n\t\tif (!wpmDataLayer?.pixels?.tiktok?.loaded) return\n\n\t\tttq.track(\"Search\")\n\t} catch (e) {\n\t\tconsole.error(e)\n\t}\n\n})\n\n\n// view order received page event\njQuery(document).on(\"wpmOrderReceivedPage\", function () {\n\n\ttry {\n\t\tif (!wpmDataLayer?.pixels?.tiktok?.loaded) return\n\n\t\tttq.track(wpmDataLayer.pixels.tiktok.purchase_event_name, {\n\t\t\tvalue : wpmDataLayer.order.value_filtered,\n\t\t\tcurrency: wpmDataLayer.order.currency,\n\t\t\tcontents: wpm.getTikTokOrderItemIds(),\n\t\t})\n\n\t\t// console.log(wpm.getTikTokOrderItemIds())\n\t} catch (e) {\n\t\tconsole.error(e)\n\t}\n})\n","// TODO implement AddPaymentInfo event\n// TODO check if more values can be passed to product and cart pages\n\n// https://business.twitter.com/en/help/campaign-measurement-and-analytics/conversion-tracking-for-websites.html\n\n/**\n * Add functions for Twitter Ads\n * */\n\n(function (wpm, $, undefined) {\n\n\twpm.loadTwitterPixel = function () {\n\n\t\ttry {\n\t\t\twpmDataLayer.pixels.twitter.loaded = true\n\n\t\t\t// @formatter:off\n\t\t\t!function(e,t,n,s,u,a){e.twq||(s=e.twq=function(){s.exe?s.exe.apply(s,arguments):s.queue.push(arguments);\n\t\t\t},s.version='1.1',s.queue=[],u=t.createElement(n),u.async=!0,u.src='//static.ads-twitter.com/uwt.js',\n\t\t\t\ta=t.getElementsByTagName(n)[0],a.parentNode.insertBefore(u,a))}(window,document,'script');\n\n\t\t\ttwq('init', wpmDataLayer.pixels.twitter.pixel_id);\n\t\t\t// @formatter:on\n\n\t\t\ttwq(\"track\", \"PageView\")\n\n\t\t} catch (e) {\n\t\t\tconsole.error(e)\n\t\t}\n\t}\n\n\twpm.twitterGetOrderContentIds = function () {\n\t\tlet contentIds = []\n\n\t\tfor (const [key, item] of Object.entries(wpmDataLayer.order.items)) {\n\n\t\t\tif (wpmDataLayer?.general?.variationsOutput && 0 !== item.variation_id) {\n\t\t\t\tcontentIds.push(String(wpmDataLayer.products[item.variation_id].dyn_r_ids[wpmDataLayer.pixels.twitter.dynamic_remarketing.id_type]))\n\t\t\t} else {\n\t\t\t\tcontentIds.push(String(wpmDataLayer.products[item.id].dyn_r_ids[wpmDataLayer.pixels.twitter.dynamic_remarketing.id_type]))\n\t\t\t}\n\t\t}\n\n\t\treturn contentIds\n\t}\n\n}(window.wpm = window.wpm || {}, jQuery));\n\n\n/**\n * Execute as soon as possible\n * */\n\n(function () {\n\n\tjQuery(document).on(\"wpmLoadPixels\", function () {\n\n\t\tif (wpmDataLayer?.pixels?.twitter?.pixel_id && !wpmDataLayer?.pixels?.twitter?.loaded) {\n\t\t\tif (wpm.canIFire(\"ads\", \"twitter-ads\")) wpm.loadTwitterPixel()\n\t\t}\n\t})\n\n})()\n\n\n/**\n * All event listeners\n * */\n\n// add-to-cart event\njQuery(document).on(\"wpmAddToCart\", function (event, product) {\n\n\ttry {\n\t\tif (!wpmDataLayer?.pixels?.twitter?.loaded) return\n\n\t\ttwq(\"track\", \"AddToCart\")\n\t} catch (e) {\n\t\tconsole.error(e)\n\t}\n})\n\n// view product event\njQuery(document).on(\"wpmViewItem\", function (event, product) {\n\n\ttry {\n\t\tif (!wpmDataLayer?.pixels?.twitter?.loaded) return\n\n\t\ttwq(\"track\", \"ViewContent\")\n\t} catch (e) {\n\t\tconsole.error(e)\n\t}\n})\n\n// // view category event\n// jQuery(document).on('wpmCategory', function () {\n//\n// \tif (!wpmDataLayer?.pixels?.twitter?.loaded) return;\n//\n// \t// twq('track', 'AddToWishlist');\n// });\n\n// add-to-wishlist event\njQuery(document).on(\"wpmAddToWishlist\", function (event, product) {\n\n\ttry {\n\t\tif (!wpmDataLayer?.pixels?.twitter?.loaded) return\n\n\t\ttwq(\"track\", \"AddToWishlist\")\n\t} catch (e) {\n\t\tconsole.error(e)\n\t}\n})\n\n// start checkout event\njQuery(document).on(\"wpmBeginCheckout\", function (event, product) {\n\n\ttry {\n\t\tif (!wpmDataLayer?.pixels?.twitter?.loaded) return\n\n\t\ttwq(\"track\", \"InitiateCheckout\")\n\t} catch (e) {\n\t\tconsole.error(e)\n\t}\n})\n\n// view search event\njQuery(document).on(\"wpmSearch\", function () {\n\n\ttry {\n\t\tif (!wpmDataLayer?.pixels?.twitter?.loaded) return\n\n\t\ttwq(\"track\", \"Search\")\n\t} catch (e) {\n\t\tconsole.error(e)\n\t}\n})\n\n\n// view order received page event\n// TODO find out under which circumstances to use different values in content_type\njQuery(document).on(\"wpmOrderReceivedPage\", function () {\n\n\ttry {\n\t\tif (!wpmDataLayer?.pixels?.twitter?.loaded) return\n\n\t\ttwq(\"track\", \"Purchase\", {\n\t\t\torder_id: wpmDataLayer.order.id,\n\t\t\t// content_type: 'product',\n\t\t\tvalue : wpmDataLayer.order.value_filtered,\n\t\t\tcurrency : wpmDataLayer.order.currency,\n\t\t\tnum_items : wpmDataLayer.order.quantity,\n\t\t\tcontent_ids: wpm.twitterGetOrderContentIds(),\n\t\t})\n\n\t\t// console.log(wpm.twitterGetOrderContentIds())\n\t} catch (e) {\n\t\tconsole.error(e)\n\t}\n})\n\n","/**\n * After wpm is loaded\n * we first check if wpmDataLayer is loaded,\n * and as soon as it is, we load the pixels,\n * and as soon as the page load is complete,\n * we fire the wpmLoad event.\n *\n * @param {{pro:bool}} wpmDataLayer.version\n *\n * https://stackoverflow.com/a/25868457/4688612\n * https://stackoverflow.com/a/44093516/4688612\n */\nwpm.wpmDataLayerExists()\n\t.then(function () {\n\t\tconsole.log(\"WooCommerce Pixel Manager: \" + (wpmDataLayer.version.pro ? \"Pro\" : \"Free\") +\" Version \" + wpmDataLayer.version.number + \" loaded\")\n\t\tjQuery(document).trigger(\"wpmPreLoadPixels\", {})\n\t})\n\t.then(function () {\n\t\twpm.pageLoaded().then(function () {\n\t\t\tjQuery(document).trigger(\"wpmLoad\", {})\n\t\t})\n\t})\n\n","/**\n * Create a wpm namespace under which all functions are declared\n */\n\n// https://stackoverflow.com/a/5947280/4688612\n(function (wpm, $, undefined) {\n\n\tconst wpmDeduper = {\n\t\tkeyName : \"_wpm_order_ids\",\n\t\tcookieExpiresDays: 365,\n\t}\n\n\tconst wpmRestSettings = {\n\t\t// cookiesAvailable : '_wpm_cookies_are_available',\n\t\tcookieWpmRestEndpointAvailable: \"_wpm_endpoint_available\",\n\t\trestEndpoint : \"/wp-json/\",\n\t\trestFails : 0,\n\t\trestFailsThreshold : 10,\n\t}\n\n\twpm.emailSelected = false\n\twpm.paymentMethodSelected = false\n\n\t// wpm.checkIfCookiesAvailable = function () {\n\t//\n\t// // read the cookie if previously set, if it is return true, otherwise continue\n\t// if (wpm.getCookie(wpmRestSettings.cookiesAvailable)) {\n\t// return true;\n\t// }\n\t//\n\t// // set the cookie for the session\n\t// Cookies.set(wpmRestSettings.cookiesAvailable, true);\n\t//\n\t// // read cookie, true if ok, false if not ok\n\t// return !!wpm.getCookie(wpmRestSettings.cookiesAvailable);\n\t// }\n\n\twpm.useRestEndpoint = function () {\n\n\t\t// only if sessionStorage is available\n\n\t\t// only if REST API endpoint is generally accessible\n\t\t// check in sessionStorage if we checked before and return answer\n\t\t// otherwise check if the endpoint is available, save answer in sessionStorage and return answer\n\n\t\t// only if not too many REST API errors happened\n\n\t\treturn wpm.isSessionStorageAvailable() &&\n\t\t\twpm.isRestEndpointAvailable() &&\n\t\t\twpm.isBelowRestErrorThreshold()\n\t}\n\n\twpm.isBelowRestErrorThreshold = function () {\n\t\treturn window.sessionStorage.getItem(wpmRestSettings.restFails) <= wpmRestSettings.restFailsThreshold\n\t}\n\n\twpm.isRestEndpointAvailable = function () {\n\n\t\tif (window.sessionStorage.getItem(wpmRestSettings.cookieWpmRestEndpointAvailable)) {\n\t\t\treturn JSON.parse(window.sessionStorage.getItem(wpmRestSettings.cookieWpmRestEndpointAvailable))\n\t\t} else {\n\t\t\t// return wpm.testEndpoint();\n\t\t\t// just set the value whenever possible in order not to wait or block the main thread\n\t\t\twpm.testEndpoint()\n\t\t}\n\t}\n\n\twpm.isSessionStorageAvailable = function () {\n\n\t\treturn !!window.sessionStorage\n\t}\n\n\twpm.testEndpoint = function (\n\t\turl = location.protocol + \"//\" + location.host + wpmRestSettings.restEndpoint,\n\t\tcookieName = wpmRestSettings.cookieWpmRestEndpointAvailable,\n\t) {\n\t\t// console.log('testing endpoint');\n\n\t\tjQuery.ajax(url, {\n\t\t\ttype : \"HEAD\",\n\t\t\ttimeout: 1000,\n\t\t\t// async: false,\n\t\t\tstatusCode: {\n\t\t\t\t200: function (response) {\n\t\t\t\t\t// Cookies.set(cookieName, true);\n\t\t\t\t\t// console.log('endpoint works');\n\t\t\t\t\twindow.sessionStorage.setItem(cookieName, JSON.stringify(true))\n\t\t\t\t},\n\t\t\t\t404: function (response) {\n\t\t\t\t\t// Cookies.set(cookieName, false);\n\t\t\t\t\t// console.log('endpoint doesn\\'t work');\n\t\t\t\t\twindow.sessionStorage.setItem(cookieName, JSON.stringify(false))\n\t\t\t\t},\n\t\t\t\t0 : function (response) {\n\t\t\t\t\t// Cookies.set(cookieName, false);\n\t\t\t\t\t// console.log('endpoint doesn\\'t work');\n\t\t\t\t\twindow.sessionStorage.setItem(cookieName, JSON.stringify(false))\n\t\t\t\t},\n\t\t\t},\n\t\t}).then(response => {\n\t\t\t// console.log('test done')\n\t\t\t// console.log('result: ' + JSON.parse(window.sessionStorage.getItem(cookieName)));\n\t\t\t// return JSON.parse(window.sessionStorage.getItem(cookieName));\n\t\t})\n\t}\n\n\twpm.isWpmRestEndpointAvailable = function (cookieName = wpmRestSettings.cookieWpmRestEndpointAvailable) {\n\n\t\treturn !!wpm.getCookie(cookieName)\n\t}\n\n\twpm.writeOrderIdToStorage = function (orderId, expireDays = 365) {\n\n\t\t// save the order ID in the browser storage\n\n\t\tif (!window.Storage) {\n\t\t\tlet expiresDate = new Date()\n\t\t\texpiresDate.setDate(expiresDate.getDate() + wpmDeduper.cookieExpiresDays)\n\n\t\t\tlet ids = []\n\t\t\tif (checkCookie()) {\n\t\t\t\tids = JSON.parse(wpm.getCookie(wpmDeduper.keyName))\n\t\t\t}\n\n\t\t\tif (!ids.includes(orderId)) {\n\t\t\t\tids.push(orderId)\n\t\t\t\tdocument.cookie = wpmDeduper.keyName + \"=\" + JSON.stringify(ids) + \";expires=\" + expiresDate.toUTCString()\n\t\t\t}\n\n\t\t} else {\n\t\t\tif (localStorage.getItem(wpmDeduper.keyName) === null) {\n\t\t\t\tlet ids = []\n\t\t\t\tids.push(orderId)\n\t\t\t\twindow.localStorage.setItem(wpmDeduper.keyName, JSON.stringify(ids))\n\n\t\t\t} else {\n\t\t\t\tlet ids = JSON.parse(localStorage.getItem(wpmDeduper.keyName))\n\t\t\t\tif (!ids.includes(orderId)) {\n\t\t\t\t\tids.push(orderId)\n\t\t\t\t\twindow.localStorage.setItem(wpmDeduper.keyName, JSON.stringify(ids))\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tif (typeof wpm.storeOrderIdOnServer === \"function\" && wpmDataLayer.orderDeduplication) {\n\t\t\twpm.storeOrderIdOnServer(orderId)\n\t\t}\n\t}\n\n\tfunction checkCookie() {\n\t\tlet key = wpm.getCookie(wpmDeduper.keyName)\n\t\treturn key !== \"\"\n\t}\n\n\twpm.isOrderIdStored = function (orderId) {\n\n\t\t// console.log('deduper: ' + wpmDataLayer.orderDeduplication);\n\t\tif (wpmDataLayer.orderDeduplication) {\n\t\t\t// console.log('order deduplication: on');\n\t\t\tif (!window.Storage) {\n\n\t\t\t\tif (checkCookie()) {\n\t\t\t\t\tlet ids = JSON.parse(wpm.getCookie(wpmDeduper.keyName))\n\t\t\t\t\treturn ids.includes(orderId)\n\t\t\t\t} else {\n\t\t\t\t\treturn false\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tif (localStorage.getItem(wpmDeduper.keyName) !== null) {\n\t\t\t\t\tlet ids = JSON.parse(localStorage.getItem(wpmDeduper.keyName))\n\t\t\t\t\treturn ids.includes(orderId)\n\t\t\t\t} else {\n\t\t\t\t\treturn false\n\t\t\t\t}\n\t\t\t}\n\t\t} else {\n\t\t\tconsole.log(\"order duplication prevention: off\")\n\t\t\treturn false\n\t\t}\n\t}\n\n\twpm.isEmail = function (email) {\n\t\t// https://emailregex.com/\n\t\tlet regex = /^(([^<>()\\[\\]\\\\.,;:\\s@\"]+(\\.[^<>()\\[\\]\\\\.,;:\\s@\"]+)*)|(\".+\"))@((\\[[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}])|(([a-zA-Z\\-0-9]+\\.)+[a-zA-Z]{2,}))$/\n\t\treturn regex.test(email)\n\t}\n\n\twpm.removeProductFromCart = function (productId, quantityToRemove = null) {\n\t\t// console.log('product_id: ' + productId + ' | quantityToRemove: ' + quantityToRemove);\n\n\t\ttry {\n\n\t\t\tif (!productId) throw Error(\"Wasn't able to retrieve a productId\")\n\n\t\t\tproductId = getIdBasedOndVariationsOutputSetting(productId)\n\n\t\t\tif (!productId) throw Error(\"Wasn't able to retrieve a productId\")\n\n\t\t\tlet quantity\n\n\t\t\tif (quantityToRemove == null) {\n\t\t\t\tquantity = wpmDataLayer.cart[productId].quantity\n\t\t\t} else {\n\t\t\t\tquantity = quantityToRemove\n\t\t\t}\n\n\t\t\t// console.log('product_id: ' + productId + ' | qty: ' + quantity);\n\t\t\t// console.log(productId);\n\t\t\t// console.log(wpmDataLayer.cart);\n\t\t\t// console.log(wpmDataLayer.cart[productId]);\n\n\t\t\tif (wpmDataLayer.cart[productId]) {\n\n\t\t\t\t// let product = {\n\t\t\t\t// id : productId.toString(),\n\t\t\t\t// dyn_r_ids: wpmDataLayer.cart[productId].dyn_r_ids,\n\t\t\t\t// name : wpmDataLayer.cart[productId].name,\n\t\t\t\t// // list_name: wpmDataLayer.shop.list_name, // doesn't make sense on mini_cart\n\t\t\t\t// brand : wpmDataLayer.cart[productId].brand,\n\t\t\t\t// category: wpmDataLayer.cart[productId].category,\n\t\t\t\t// variant : wpmDataLayer.cart[productId].variant,\n\t\t\t\t// // list_position: wpmDataLayer.cart[productId].position, // doesn't make sense on mini_cart\n\t\t\t\t// quantity : quantity,\n\t\t\t\t// price : wpmDataLayer.cart[productId].price,\n\t\t\t\t// isVariation: wpmDataLayer.products[productId].isVariation,\n\t\t\t\t// };\n\t\t\t\t//\n\t\t\t\t// if (product.isVariation) product['parentId_dyn_r_ids'] = wpmDataLayer.products[productId].parentId_dyn_r_ids;\n\n\t\t\t\tlet product = wpm.getProductDetailsFormattedForEvent(productId, quantity)\n\n\t\t\t\t// console.log('removing');\n\t\t\t\t// console.log(data);\n\n\t\t\t\tjQuery(document).trigger(\"wpmRemoveFromCart\", product)\n\n\t\t\t\tif (quantityToRemove == null || wpmDataLayer.cart[productId].quantity === quantityToRemove) {\n\t\t\t\t\tdelete wpmDataLayer.cart[productId]\n\t\t\t\t\tif (sessionStorage) sessionStorage.setItem(\"wpmDataLayerCart\", JSON.stringify(wpmDataLayer.cart))\n\t\t\t\t} else {\n\t\t\t\t\twpmDataLayer.cart[productId].quantity = wpmDataLayer.cart[productId].quantity - quantity\n\t\t\t\t\tif (sessionStorage) sessionStorage.setItem(\"wpmDataLayerCart\", JSON.stringify(wpmDataLayer.cart))\n\t\t\t\t}\n\t\t\t}\n\t\t} catch (e) {\n\t\t\tconsole.error(e)\n\t\t\t// console.log('getting cart from back end');\n\t\t\t// wpm.getCartItemsFromBackend();\n\t\t\t// console.log('getting cart from back end done');\n\n\t\t}\n\t}\n\n\tgetIdBasedOndVariationsOutputSetting = function (productId) {\n\n\t\ttry {\n\t\t\tif (wpmDataLayer?.general?.variationsOutput) {\n\t\t\t\t// console.log('test');\n\t\t\t\treturn productId\n\t\t\t} else {\n\t\t\t\tif (wpmDataLayer.products[productId].isVariation) {\n\t\t\t\t\treturn wpmDataLayer.products[productId].parentId\n\t\t\t\t} else {\n\t\t\t\t\treturn productId\n\t\t\t\t}\n\t\t\t}\n\t\t} catch (e) {\n\t\t\tconsole.error(e)\n\t\t}\n\t}\n\n\t// add_to_cart\n\twpm.addProductToCart = function (productId, quantity) {\n\n\t\ttry {\n\t\t\t// console.log('productId: ' + productId + ' | qty: ' + quantity);\n\t\t\t// console.log('productId: ' + productId + ' | variationId: ' + variationId + ' | qty: ' + quantity);\n\n\t\t\tif (!productId) throw Error(\"Wasn't able to retrieve a productId\")\n\n\t\t\tproductId = getIdBasedOndVariationsOutputSetting(productId)\n\n\t\t\tif (!productId) throw Error(\"Wasn't able to retrieve a productId\")\n\n\t\t\tif (wpmDataLayer?.products[productId]) {\n\n\t\t\t\tlet product = wpm.getProductDetailsFormattedForEvent(productId, quantity)\n\n\t\t\t\t// console.log(productId)\n\t\t\t\t// console.log(wpmDataLayer.cart)\n\n\t\t\t\tjQuery(document).trigger(\"wpmAddToCart\", product)\n\n\t\t\t\t// add product to cart wpmDataLayer['cart']\n\n\t\t\t\t// if the product already exists in the object, only add the additional quantity\n\t\t\t\t// otherwise create that product object in the wpmDataLayer['cart']\n\t\t\t\tif (wpmDataLayer?.cart[productId]) {\n\t\t\t\t\twpmDataLayer.cart[productId].quantity = wpmDataLayer.cart[productId].quantity + quantity\n\t\t\t\t} else {\n\n\t\t\t\t\tif (!(\"cart\" in wpmDataLayer)) wpmDataLayer.cart = {}\n\t\t\t\t\twpmDataLayer.cart[productId] = wpm.getProductDetailsFormattedForEvent(productId, quantity)\n\t\t\t\t}\n\n\t\t\t\tif (sessionStorage) sessionStorage.setItem(\"wpmDataLayerCart\", JSON.stringify(wpmDataLayer.cart))\n\t\t\t}\n\t\t} catch (e) {\n\t\t\tconsole.error(e)\n\n\t\t\t// fallback if wpmDataLayer.cart and wpmDataLayer.products got out of sync in case cart caching has an issue\n\t\t\twpm.getCartItemsFromBackend()\n\t\t}\n\t}\n\n\twpm.getCartItems = function () {\n\n\t\t// console.log('get cart items');\n\n\t\tif (sessionStorage) {\n\t\t\tif (!sessionStorage.getItem(\"wpmDataLayerCart\") || wpmDataLayer.shop.page_type === \"order_received_page\") {\n\t\t\t\tsessionStorage.setItem(\"wpmDataLayerCart\", JSON.stringify({}))\n\t\t\t} else {\n\t\t\t\twpm.saveCartObjectToDataLayer(JSON.parse(sessionStorage.getItem(\"wpmDataLayerCart\")))\n\t\t\t}\n\t\t} else {\n\t\t\twpm.getCartItemsFromBackend()\n\t\t}\n\t}\n\n\t// get all cart items from the backend\n\twpm.getCartItemsFromBackend = function () {\n\t\ttry {\n\t\t\tlet data = {\n\t\t\t\taction: \"wpm_get_cart_items\",\n\t\t\t}\n\n\t\t\tjQuery.ajax(\n\t\t\t\t{\n\t\t\t\t\ttype : \"get\",\n\t\t\t\t\tdataType: \"json\",\n\t\t\t\t\t// url : ajax_object.ajax_url,\n\t\t\t\t\turl : wpm.ajax_url,\n\t\t\t\t\tdata : data,\n\t\t\t\t\tsuccess: function (cartItems) {\n\n\t\t\t\t\t\t// save all cart items into wpmDataLayer\n\n\t\t\t\t\t\tif (!cartItems[\"cart\"]) cartItems[\"cart\"] = {}\n\n\t\t\t\t\t\twpm.saveCartObjectToDataLayer(cartItems[\"cart\"])\n\t\t\t\t\t\tif (sessionStorage) sessionStorage.setItem(\"wpmDataLayerCart\", JSON.stringify(cartItems[\"cart\"]))\n\t\t\t\t\t},\n\t\t\t\t})\n\t\t} catch (e) {\n\t\t\tconsole.error(e)\n\t\t}\n\t}\n\n\twpm.getProductsFromBackend = function (productIds) {\n\t\t// console.log('getting pids from back-end: ' + productIds)\n\t\t// get productIds from the backend\n\n\t\t// reduce productIds by products already in the dataLayer\n\t\tproductIds = productIds.filter(item => !wpmDataLayer.products.hasOwnProperty(item))\n\n\t\t// if no products IDs are in the object, don't try to get anything from the server\n\t\tif (!productIds || productIds.length === 0) return\n\n\t\ttry {\n\t\t\tlet data = {\n\t\t\t\taction : \"wpm_get_product_ids\",\n\t\t\t\tproductIds: productIds,\n\t\t\t}\n\n\t\t\tjQuery.ajax(\n\t\t\t\t{\n\t\t\t\t\ttype : \"get\",\n\t\t\t\t\tdataType: \"json\",\n\t\t\t\t\t// url : ajax_object.ajax_url,\n\t\t\t\t\turl : wpm.ajax_url,\n\t\t\t\t\tdata : data,\n\t\t\t\t\tsuccess: function (products) {\n\n\t\t\t\t\t\t// merge products into wpmDataLayer.products\n\t\t\t\t\t\twpmDataLayer.products = Object.assign({}, wpmDataLayer.products, products)\n\t\t\t\t\t},\n\t\t\t\t\terror : function (response) {\n\t\t\t\t\t\tconsole.log(response)\n\t\t\t\t\t},\n\t\t\t\t})\n\t\t} catch (e) {\n\t\t\tconsole.error(e)\n\t\t}\n\t}\n\n\twpm.saveCartObjectToDataLayer = function (cartObject) {\n\t\twpmDataLayer.cart = cartObject\n\t\twpmDataLayer.products = Object.assign({}, wpmDataLayer.products, cartObject)\n\t}\n\n\twpm.fireCheckoutOption = function (step, checkout_option = null, value = null) {\n\n\t\tlet data = {\n\t\t\tstep : step,\n\t\t\tcheckout_option: checkout_option,\n\t\t\tvalue : value,\n\t\t}\n\n\t\tjQuery(document).trigger(\"wpmFireCheckoutOption\", data)\n\t}\n\n\twpm.fireCheckoutProgress = function (step) {\n\n\t\tlet data = {\n\t\t\tstep: step,\n\t\t}\n\n\t\tjQuery(document).trigger(\"wpmFireCheckoutProgress\", data)\n\t}\n\n\twpm.getPostIdFromString = function (string) {\n\t\t// console.log(string);\n\t\ttry {\n\t\t\treturn string.match(/(post-)(\\d+)/)[2]\n\t\t} catch (e) {\n\t\t\tconsole.error(e)\n\t\t}\n\t}\n\n\twpm.triggerViewItemList = function (productId) {\n\n\t\t// productId = null;\n\n\t\tif (!productId) throw Error(\"Wasn't able to retrieve a productId\")\n\n\t\tproductId = getIdBasedOndVariationsOutputSetting(productId)\n\n\t\tif (!productId) throw Error(\"Wasn't able to retrieve a productId\")\n\n\t\tjQuery(document).trigger(\"wpmViewItemList\", wpm.getProductDataForViewItemEvent(productId))\n\t}\n\n\twpm.getProductDataForViewItemEvent = function (productId) {\n\n\t\tif (!productId) throw Error(\"Wasn't able to retrieve a productId\")\n\n\t\ttry {\n\t\t\tif (wpmDataLayer.products[productId]) {\n\n\t\t\t\treturn wpm.getProductDetailsFormattedForEvent(productId)\n\t\t\t}\n\t\t} catch (e) {\n\t\t\tconsole.error(e)\n\t\t}\n\t}\n\twpm.getMainProductIdFromProductPage = function () {\n\t\ttry {\n\t\t\tif ([\"simple\", \"variable\", \"grouped\", \"composite\", \"bundle\"].indexOf(wpmDataLayer.shop.product_type) >= 0) {\n\t\t\t\treturn jQuery(\".wpmProductId:first\").data(\"id\")\n\t\t\t} else {\n\t\t\t\treturn false\n\t\t\t}\n\t\t} catch (e) {\n\t\t\tconsole.error(e)\n\t\t}\n\t}\n\n\twpm.viewItemListTriggerTestMode = function (target) {\n\n\t\tjQuery(target).css({\"position\": \"relative\"})\n\t\tjQuery(target).append(\"<div id=\\\"viewItemListTriggerOverlay\\\"></div>\")\n\t\tjQuery(target).find(\"#viewItemListTriggerOverlay\").css({\n\t\t\t\"z-index\" : \"10\",\n\t\t\t\"display\" : \"block\",\n\t\t\t\"position\" : \"absolute\",\n\t\t\t\"height\" : \"100%\",\n\t\t\t\"top\" : \"0\",\n\t\t\t\"left\" : \"0\",\n\t\t\t\"right\" : \"0\",\n\t\t\t\"opacity\" : wpmDataLayer.viewItemListTrigger.opacity,\n\t\t\t\"background-color\": wpmDataLayer.viewItemListTrigger.backgroundColor,\n\t\t})\n\t}\n\n\twpm.getSearchTermFromUrl = function () {\n\t\ttry {\n\t\t\tlet urlParameters = new URLSearchParams(window.location.search)\n\t\t\treturn urlParameters.get(\"s\")\n\t\t} catch (e) {\n\t\t\tconsole.error(e)\n\t\t}\n\t}\n\n\t// we need this to track timeouts for intersection observers\n\tlet ioTimeouts = {}\n\n\twpm.observerCallback = function (entries, observer) {\n\n\t\tentries.forEach((entry) => {\n\n\t\t\ttry {\n\t\t\t\tlet productId\n\n\t\t\t\tlet elementId = jQuery(entry.target).data(\"ioid\")\n\n\t\t\t\t// Get the productId from next element, if wpmProductId is a sibling, like in Gutenberg blocks\n\t\t\t\t// otherwise go search in children, like in regular WC loop items\n\t\t\t\tif (jQuery(entry.target).next(\".wpmProductId\").length) {\n\t\t\t\t\t// console.log('test 1');\n\t\t\t\t\tproductId = jQuery(entry.target).next(\".wpmProductId\").data(\"id\")\n\t\t\t\t} else {\n\t\t\t\t\tproductId = jQuery(entry.target).find(\".wpmProductId\").data(\"id\")\n\t\t\t\t}\n\n\t\t\t\t// productId = null;\n\n\t\t\t\tif (!productId) throw Error(\"wpmProductId element not found\")\n\n\t\t\t\tif (entry.isIntersecting) {\n\n\t\t\t\t\t// console.log('prodid: ' + productId);\n\t\t\t\t\tioTimeouts[elementId] = setTimeout(() => {\n\t\t\t\t\t\t// console.log('prodid: ' + productId);\n\t\t\t\t\t\twpm.triggerViewItemList(productId)\n\t\t\t\t\t\tif (wpmDataLayer.viewItemListTrigger.testMode) wpm.viewItemListTriggerTestMode(entry.target)\n\t\t\t\t\t\tif (wpmDataLayer.viewItemListTrigger.repeat === false) observer.unobserve(entry.target)\n\t\t\t\t\t}, wpmDataLayer.viewItemListTrigger.timeout)\n\n\t\t\t\t} else {\n\n\t\t\t\t\tclearTimeout(ioTimeouts[elementId])\n\t\t\t\t\tif (wpmDataLayer.viewItemListTrigger.testMode) jQuery(entry.target).find(\"#viewItemListTriggerOverlay\").remove()\n\t\t\t\t}\n\t\t\t} catch (e) {\n\t\t\t\tconsole.error(e)\n\t\t\t}\n\t\t})\n\t}\n\n\t// fire view_item_list only on products that have become visible\n\tlet io\n\tlet ioid = 0\n\tlet allIoElementsToWatch\n\n\tlet getAllElementsToWatch = function () {\n\n\t\tallIoElementsToWatch = jQuery(\".wpmProductId\")\n\t\t\t.map(function (i, elem) {\n\t\t\t\t// console.log(elem);\n\t\t\t\tif (\n\t\t\t\t\tjQuery(elem).parent().hasClass(\"type-product\") ||\n\t\t\t\t\tjQuery(elem).parent().hasClass(\"product\") ||\n\t\t\t\t\tjQuery(elem).parent().hasClass(\"product-item-inner\")\n\t\t\t\t) {\n\t\t\t\t\t// console.log(elem);\n\t\t\t\t\treturn jQuery(elem).parent()\n\t\t\t\t} else if (\n\t\t\t\t\tjQuery(elem).prev().hasClass(\"wc-block-grid__product\") ||\n\t\t\t\t\tjQuery(elem).prev().hasClass(\"product\") ||\n\t\t\t\t\tjQuery(elem).prev().hasClass(\"product-small\") ||\n\t\t\t\t\tjQuery(elem).prev().hasClass(\"woocommerce-LoopProduct-link\")\n\t\t\t\t) {\n\t\t\t\t\treturn jQuery(this).prev()\n\t\t\t\t} else if (jQuery(elem).closest(\".product\").length) {\n\t\t\t\t\treturn jQuery(elem).closest(\".product\")\n\t\t\t\t}\n\t\t\t})\n\t}\n\n\twpm.startIntersectionObserverToWatch = function () {\n\n\t\ttry {\n\t\t\t// enable view_item_list test mode from browser\n\t\t\tif (wpm.urlHasParameter(\"vildemomode\")) wpmDataLayer.viewItemListTrigger.testMode = true\n\n\t\t\t// set up intersection observer\n\t\t\tio = new IntersectionObserver(wpm.observerCallback, {\n\t\t\t\tthreshold: wpmDataLayer.viewItemListTrigger.threshold,\n\t\t\t})\n\n\t\t\tgetAllElementsToWatch()\n\n\t\t\t// console.log(allElementsToWatch);\n\n\t\t\tallIoElementsToWatch.each(function (i, elem) {\n\t\t\t\t// console.log(elem[0]);\n\t\t\t\t// jQuery(elem[0]).attr('data-ioid', ioid++);\n\t\t\t\tjQuery(elem[0]).data(\"ioid\", ioid++)\n\n\t\t\t\tio.observe(elem[0])\n\t\t\t})\n\t\t} catch (e) {\n\t\t\tconsole.error(e)\n\t\t}\n\t}\n\n\t// watch DOM for new lazy loaded products and add them to the intersection observer\n\twpm.startProductsMutationObserverToWatch = function () {\n\n\t\ttry {\n\t\t\t// Pass in the target node, as well as the observer options\n\n\t\t\t// selects the most common parent node\n\t\t\t// https://stackoverflow.com/a/7648323/4688612\n\t\t\tlet productsNode = jQuery(\".wpmProductId:eq(0)\").parents().has(jQuery(\".wpmProductId:eq(1)\").parents()).first()\n\n\t\t\tif (productsNode.length) {\n\t\t\t\tproductsMutationObserver.observe(productsNode[0], {\n\t\t\t\t\tattributes : true,\n\t\t\t\t\tchildList : true,\n\t\t\t\t\tcharacterData: true,\n\t\t\t\t})\n\t\t\t}\n\t\t} catch (e) {\n\t\t\tconsole.error(e)\n\t\t}\n\t}\n\n\t// Create an observer instance\n\tlet productsMutationObserver = new MutationObserver(function (mutations) {\n\n\t\tmutations.forEach(function (mutation) {\n\t\t\tlet newNodes = mutation.addedNodes // DOM NodeList\n\t\t\tif (newNodes !== null) { // If there are new nodes added\n\t\t\t\tlet nodes = jQuery(newNodes) // jQuery set\n\t\t\t\tnodes.each(function () {\n\t\t\t\t\tif (\n\t\t\t\t\t\tjQuery(this).hasClass(\"type-product\") ||\n\t\t\t\t\t\tjQuery(this).hasClass(\"product-small\") ||\n\t\t\t\t\t\tjQuery(this).hasClass(\"wc-block-grid__product\")\n\t\t\t\t\t) {\n\t\t\t\t\t\t// check if the node has a child or sibling wpmProductId\n\t\t\t\t\t\t// if yes add it to the intersectionObserver\n\t\t\t\t\t\tif (hasWpmProductIdElement(this)) {\n\t\t\t\t\t\t\tjQuery(this).data(\"ioid\", ioid++)\n\t\t\t\t\t\t\tio.observe(this)\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t})\n\t\t\t}\n\t\t})\n\t})\n\n\tlet hasWpmProductIdElement = function (elem) {\n\t\treturn !!(jQuery(elem).find(\".wpmProductId\").length ||\n\t\t\tjQuery(elem).siblings(\".wpmProductId\").length)\n\t}\n\n\twpm.setCookie = function (cookieName, cookieValue = \"\", expiryDays = null) {\n\t\tif (expiryDays) {\n\t\t\tlet d = new Date()\n\t\t\td.setTime(d.getTime() + (expiryDays * 24 * 60 * 60 * 1000))\n\t\t\tlet expires = \"expires=\" + d.toUTCString()\n\t\t\tdocument.cookie = cookieName + \"=\" + cookieValue + \";\" + expires + \";path=/\"\n\t\t} else {\n\t\t\tdocument.cookie = cookieName + \"=\" + cookieValue + \";path=/\"\n\t\t}\n\t}\n\n\twpm.getCookie = function (cookieName) {\n\t\tlet name = cookieName + \"=\"\n\t\tlet decodedCookie = decodeURIComponent(document.cookie)\n\t\tlet ca = decodedCookie.split(\";\")\n\t\tfor (let i = 0; i < ca.length; i++) {\n\t\t\tlet c = ca[i]\n\t\t\twhile (c.charAt(0) == \" \") {\n\t\t\t\tc = c.substring(1)\n\t\t\t}\n\t\t\tif (c.indexOf(name) == 0) {\n\t\t\t\treturn c.substring(name.length, c.length)\n\t\t\t}\n\t\t}\n\t\treturn \"\"\n\t}\n\n\twpm.getWpmSessionData = function () {\n\t\tif (window.sessionStorage) {\n\n\t\t\tlet data = window.sessionStorage.getItem(\"_wpm\")\n\t\t\tif (data !== null) {\n\t\t\t\treturn JSON.parse(data)\n\t\t\t} else {\n\t\t\t\treturn {}\n\t\t\t}\n\t\t} else {\n\t\t\treturn {}\n\t\t}\n\t}\n\n\twpm.setWpmSessionData = function (data) {\n\t\tif (window.sessionStorage) {\n\t\t\twindow.sessionStorage.setItem(\"_wpm\", JSON.stringify(data))\n\t\t}\n\t}\n\n\twpm.storeOrderIdOnServer = function (orderId) {\n\n\t\t// console.log('saving wpm_purchase_pixels_fired');\n\n\t\t// console.log('url: ' + wpm_premium_only_ajax_object.ajax_url);\n\t\t// console.log('nonce: ' + wpm_premium_only_ajax_object.nonce);\n\t\t// console.log('url: ' + wpm.ajax_url);\n\t\t// console.log('nonce: ' + wpm.nonce);\n\n\t\ttry {\n\t\t\t// save the state in the database\n\t\t\tlet data = {\n\t\t\t\taction : \"wpm_purchase_pixels_fired\",\n\t\t\t\torder_id: orderId,\n\t\t\t\t// nonce : ajax_object.nonce,\n\t\t\t\tnonce: wpm.nonce,\n\t\t\t}\n\n\t\t\tjQuery.ajax(\n\t\t\t\t{\n\t\t\t\t\ttype : \"post\",\n\t\t\t\t\tdataType: \"json\",\n\t\t\t\t\t// url : ajax_object.ajax_url,\n\t\t\t\t\turl : wpm.ajax_url,\n\t\t\t\t\tdata : data,\n\t\t\t\t\tsuccess: function (response) {\n\t\t\t\t\t\tif (response.success === false) {\n\t\t\t\t\t\t\tconsole.log(response)\n\t\t\t\t\t\t}\n\t\t\t\t\t},\n\t\t\t\t\terror : function (response) {\n\t\t\t\t\t\tconsole.log(response)\n\t\t\t\t\t},\n\t\t\t\t})\n\t\t} catch (e) {\n\t\t\tconsole.error(e)\n\t\t}\n\t}\n\n\twpm.getProductIdByCartItemKeyUrl = function (url) {\n\t\tlet searchParams = new URLSearchParams(url.search)\n\t\tlet cartItemKey = searchParams.get(\"remove_item\")\n\n\t\tlet productId\n\n\t\tif (wpmDataLayer.cartItemKeys[cartItemKey][\"variation_id\"] === 0) {\n\t\t\tproductId = wpmDataLayer.cartItemKeys[cartItemKey][\"product_id\"]\n\t\t} else {\n\t\t\tproductId = wpmDataLayer.cartItemKeys[cartItemKey][\"variation_id\"]\n\t\t}\n\n\t\treturn productId\n\t}\n\n\twpm.getAddToCartLinkProductIds = function () {\n\t\treturn jQuery(\"a\").map(function () {\n\t\t\tlet href = jQuery(this).attr(\"href\")\n\n\t\t\tif (href && href.includes(\"?add-to-cart=\")) {\n\t\t\t\tlet matches = href.match(/(add-to-cart=)(\\d+)/)\n\t\t\t\tif (matches) return matches[2]\n\t\t\t}\n\t\t}).get()\n\t}\n\n\twpm.getProductDetailsFormattedForEvent = function (productId, quantity = 1) {\n\n\t\t// console.log(wpmDataLayer.products[productId].dyn_r_ids)\n\n\t\tlet product = {\n\t\t\tid : productId.toString(),\n\t\t\tdyn_r_ids : wpmDataLayer.products[productId].dyn_r_ids,\n\t\t\tname : wpmDataLayer.products[productId].name,\n\t\t\tlist_name : wpmDataLayer.shop.list_name,\n\t\t\tbrand : wpmDataLayer.products[productId].brand,\n\t\t\tcategory : wpmDataLayer.products[productId].category,\n\t\t\tvariant : wpmDataLayer.products[productId].variant,\n\t\t\tlist_position: wpmDataLayer.products[productId].position,\n\t\t\tquantity : quantity,\n\t\t\tprice : wpmDataLayer.products[productId].price,\n\t\t\tcurrency : wpmDataLayer.shop.currency,\n\t\t\tisVariable : wpmDataLayer.products[productId].isVariable,\n\t\t\tisVariation : wpmDataLayer.products[productId].isVariation,\n\t\t\tparentId : wpmDataLayer.products[productId].parentId,\n\t\t}\n\n\t\tif (product.isVariation) product[\"parentId_dyn_r_ids\"] = wpmDataLayer.products[productId].parentId_dyn_r_ids\n\n\t\treturn product\n\t}\n\n\twpm.setReferrerToCookie = function () {\n\t\t// can't use session storage as we can't read it from the server\n\t\tif (!wpm.getCookie(\"wpmReferrer\")) {\n\t\t\twpm.setCookie(\"wpmReferrer\", document.referrer)\n\t\t}\n\t}\n\n\twpm.getReferrerFromCookie = function () {\n\t\tif (wpm.getCookie(\"wpmReferrer\")) {\n\t\t\treturn wpm.getCookie(\"wpmReferrer\")\n\t\t} else {\n\t\t\treturn null\n\t\t}\n\t}\n\n\twpm.getClidFromBrowser = function (clidId = \"gclid\") {\n\n\t\tlet clidCookieId\n\n\t\tclidCookieId = {\n\t\t\tgclid: \"_gcl_aw\",\n\t\t\tdclid: \"_gcl_dc\",\n\t\t}\n\n\t\tif (wpm.getCookie(clidCookieId[clidId])) {\n\t\t\tlet clidCookie = wpm.getCookie(clidCookieId[clidId])\n\t\t\tlet matches = clidCookie.match(/(GCL.[\\d]*.)(.*)/)\n\t\t\treturn matches[2]\n\t\t} else {\n\t\t\treturn \"\"\n\t\t}\n\t}\n\n\twpm.getUserAgent = function () {\n\t\treturn navigator.userAgent\n\t}\n\n\twpm.getViewPort = function () {\n\t\treturn {\n\t\t\twidth : Math.max(document.documentElement.clientWidth || 0, window.innerWidth || 0),\n\t\t\theight: Math.max(document.documentElement.clientHeight || 0, window.innerHeight || 0),\n\t\t}\n\t}\n\n\t/*\n\t* Handle Cookie Management Platforms\n\t* */\n\n\tlet getComplianzCookies = function () {\n\n\t\tlet cmplz_statistics = wpm.getCookie(\"cmplz_statistics\")\n\t\tlet cmplz_marketing = wpm.getCookie(\"cmplz_marketing\")\n\t\tlet cmplz_consent_status = wpm.getCookie(\"cmplz_consent_status\") || wpm.getCookie(\"cmplz_banner-status\")\n\n\n\t\tif (cmplz_consent_status) {\n\t\t\treturn {\n\t\t\t\tanalytics : cmplz_statistics === \"allow\",\n\t\t\t\tads : cmplz_marketing === \"allow\",\n\t\t\t\tvisitorHasChosen: true,\n\t\t\t}\n\t\t} else {\n\t\t\treturn false\n\t\t}\n\t}\n\n\tlet getCookieLawInfoCookies = function () {\n\n\t\tlet analyticsCookie = wpm.getCookie(\"cookielawinfo-checkbox-analytics\") || wpm.getCookie(\"cookielawinfo-checkbox-analytiques\")\n\t\tlet adsCookie = wpm.getCookie(\"cookielawinfo-checkbox-advertisement\") || wpm.getCookie(\"cookielawinfo-checkbox-publicite\")\n\t\tlet visitorHasChosen = wpm.getCookie(\"CookieLawInfoConsent\")\n\n\t\tif (analyticsCookie || adsCookie) {\n\n\t\t\treturn {\n\t\t\t\tanalytics : analyticsCookie === \"yes\",\n\t\t\t\tads : adsCookie === \"yes\",\n\t\t\t\tvisitorHasChosen: !!visitorHasChosen,\n\t\t\t}\n\t\t} else {\n\t\t\treturn false\n\t\t}\n\t}\n\n\n\tlet\n\t\twpmConsentValues = {}\n\twpmConsentValues.categories = {}\n\twpmConsentValues.pixels = []\n\twpmConsentValues.mode = \"category\"\n\twpmConsentValues.visitorHasChosen = false\n\n\twpm.getConsentValues = function () {\n\t\treturn wpmConsentValues\n\t}\n\n\twpm.setConsentValueCategories = function (analytics = false, ads = false) {\n\t\twpmConsentValues.categories.analytics = analytics\n\t\twpmConsentValues.categories.ads = ads\n\t}\n\n\twpm.updateConsentCookieValues = function (explicitConsent = false) {\n\n\t\t// ad_storage\n\t\t// analytics_storage\n\t\t// functionality_storage\n\t\t// personalization_storage\n\t\t// security_storage\n\n\t\t// console.log('exp cons: ' + explicitConsent)\n\n\t\tlet cookie\n\n\t\tif (cookie = wpm.getCookie(\"CookieConsent\")) {\n\t\t\t// Cookiebot\n\t\t\t// https://wordpress.org/plugins/cookiebot/\n\t\t\tcookie = decodeURI(cookie)\n\n\t\t\t// console.log(cookie.indexOf('statistics:true'))\n\t\t\t// console.log(cookie.indexOf('marketing:true'))\n\n\t\t\twpmConsentValues.categories.analytics = cookie.indexOf(\"statistics:true\") >= 0\n\t\t\twpmConsentValues.categories.ads = cookie.indexOf(\"marketing:true\") >= 0\n\t\t\twpmConsentValues.visitorHasChosen = true\n\n\t\t} else if (cookie = wpm.getCookie(\"CookieScriptConsent\")) {\n\t\t\t// Cookie Script\n\t\t\t// https://wordpress.org/plugins/cookie-script-com/\n\n\t\t\tcookie = JSON.parse(cookie)\n\n\t\t\t// console.log(cookie)\n\t\t\t// console.log(cookie.action)\n\t\t\t// console.log('cat length: ' + cookie.categories.length)\n\t\t\t// console.log(cookie.categories.indexOf('performance'))\n\n\t\t\tif (cookie.action === \"reject\") {\n\t\t\t\twpmConsentValues.categories.analytics = false\n\t\t\t\twpmConsentValues.categories.ads = false\n\t\t\t} else if (cookie.categories.length === 2) {\n\t\t\t\twpmConsentValues.categories.analytics = true\n\t\t\t\twpmConsentValues.categories.ads = true\n\t\t\t} else {\n\t\t\t\twpmConsentValues.categories.analytics = cookie.categories.indexOf(\"performance\") >= 0\n\t\t\t\twpmConsentValues.categories.ads = cookie.categories.indexOf(\"targeting\") >= 0\n\t\t\t}\n\n\t\t\twpmConsentValues.visitorHasChosen = true\n\n\t\t\t// console.log(wpmConsentValues)\n\n\t\t} else if (cookie = wpm.getCookie(\"borlabs-cookie\")) {\n\t\t\t// Borlabs Cookie\n\t\t\t// https://borlabs.io/borlabs-cookie/\n\n\t\t\tcookie = decodeURI(cookie)\n\t\t\tcookie = JSON.parse(cookie)\n\n\t\t\twpmConsentValues.categories.analytics = !!cookie?.consents?.statistics\n\t\t\twpmConsentValues.categories.ads = !!cookie?.consents?.marketing\n\t\t\twpmConsentValues.visitorHasChosen = true\n\t\t\twpmConsentValues.pixels = [...cookie?.consents?.statistics || [], ...cookie?.consents?.marketing || []]\n\t\t\twpmConsentValues.mode = \"pixel\"\n\n\t\t} else if (cookie = getComplianzCookies()) {\n\t\t\t// Complianz Cookie\n\t\t\t// https://wordpress.org/plugins/complianz-gdpr/\n\n\t\t\t// console.log(cookie)\n\n\t\t\twpmConsentValues.categories.analytics = cookie.analytics === true\n\t\t\twpmConsentValues.categories.ads = cookie.ads === true\n\t\t\twpmConsentValues.visitorHasChosen = cookie.visitorHasChosen\n\n\t\t\t// console.log(wpmConsentValues)\n\n\t\t} else if (cookie = wpm.getCookie(\"cookie_notice_accepted\")) {\n\t\t\t// Cookie Compliance (free version)\n\t\t\t// https://wordpress.org/plugins/cookie-notice/\n\n\t\t\twpmConsentValues.categories.analytics = true\n\t\t\twpmConsentValues.categories.ads = true\n\t\t\twpmConsentValues.visitorHasChosen = true\n\n\t\t} else if (cookie = wpm.getCookie(\"hu-consent\")) {\n\t\t\t// Cookie Compliance (pro version)\n\t\t\t// https://wordpress.org/plugins/cookie-notice/\n\n\t\t\tcookie = JSON.parse(cookie)\n\n\t\t\twpmConsentValues.categories.analytics = !!cookie.categories[\"3\"]\n\t\t\twpmConsentValues.categories.ads = !!cookie.categories[\"4\"]\n\t\t\twpmConsentValues.visitorHasChosen = true\n\n\t\t} else if (cookie = getCookieLawInfoCookies()) {\n\t\t\t// CookieYes, GDPR Cookie Consent (Cookie Law Info)\n\t\t\t// https://wordpress.org/plugins/cookie-law-info/\n\n\t\t\twpmConsentValues.categories.analytics = cookie.analytics === true\n\t\t\twpmConsentValues.categories.ads = cookie.ads === true\n\t\t\twpmConsentValues.visitorHasChosen = cookie.visitorHasChosen === true\n\n\t\t} else if (cookie = wpm.getCookie(\"moove_gdpr_popup\")) {\n\t\t\t// GDPR Cookie Compliance Plugin by Moove Agency\n\t\t\t// https://wordpress.org/plugins/gdpr-cookie-compliance/\n\t\t\t// TODO write documentation on how to set up the plugin in order for this to work properly\n\n\t\t\tcookie = JSON.parse(cookie)\n\t\t\t// console.log('moove cookie thirdparty: ' + cookie.thirdparty)\n\t\t\t// console.log('moove cookie advanced: ' + cookie.advanced)\n\n\t\t\twpmConsentValues.categories.analytics = cookie.thirdparty === \"1\"\n\t\t\twpmConsentValues.categories.ads = cookie.advanced === \"1\"\n\t\t\twpmConsentValues.visitorHasChosen = true\n\n\t\t\t// console.log(wpmConsentValues)\n\n\t\t} else {\n\t\t\t// consentValues.categories.analytics = true\n\t\t\t// consentValues.categories.ads = true\n\n\t\t\twpmConsentValues.categories.analytics = !explicitConsent\n\t\t\twpmConsentValues.categories.ads = !explicitConsent\n\t\t}\n\t}\n\n\twpm.updateConsentCookieValues()\n\n\twpm.setConsentDefaultValuesToExplicit = function () {\n\t\twpmConsentValues.categories = {\n\t\t\tanalytics: false,\n\t\t\tads : false,\n\t\t}\n\t}\n\n\twpm.canIFire = function (category, pixelName) {\n\n\t\tlet canIFireMode\n\n\t\tif (\"category\" === wpmConsentValues.mode) {\n\t\t\tcanIFireMode = !!wpmConsentValues.categories[category]\n\t\t} else if (\"pixel\" === wpmConsentValues.mode) {\n\t\t\tcanIFireMode = wpmConsentValues.pixels.includes(pixelName)\n\t\t} else {\n\t\t\tconsole.error(\"Couldn't find a valid consent mode in wpmConsentValues\")\n\t\t\tcanIFireMode = false\n\t\t}\n\n\t\tif (canIFireMode) {\n\t\t\treturn true\n\t\t} else {\n\t\t\tif (true || wpm.urlHasParameter(\"debugConsentMode\")) {\n\t\t\t\twpm.logPreventedPixelLoading(pixelName, category)\n\t\t\t}\n\n\t\t\treturn false\n\t\t}\n\t}\n\n\twpm.logPreventedPixelLoading = function (pixelName, category) {\n\t\tif (wpmDataLayer?.shop?.cookie_consent_mgmt?.explicit_consent) {\n\t\t\tconsole.log(\"WooCommerce Pixel Manager: The \\\"\" + pixelName + \" (category: \" + category + \")\\\" pixel has not fired because you have not given consent for it yet. (WPM is in explicit consent mode.)\")\n\t\t} else {\n\t\t\tconsole.log(\"WooCommerce Pixel Manager: The \\\"\" + pixelName + \" (category: \" + category + \")\\\" pixel has not fired because you have removed consent for this pixel. (WPM is in implicit consent mode.)\")\n\t\t}\n\t}\n\n\t/**\n\t * Runs through each script in <head> and blocks / unblocks it according to the plugin settings\n\t * and user consent.\n\t */\n\n\t// https://stackoverflow.com/q/65453565/4688612\n\twpm.scriptTagObserver = new MutationObserver((mutations) => {\n\t\tmutations.forEach(({addedNodes}) => {\n\t\t\t[...addedNodes]\n\t\t\t\t.forEach(node => {\n\n\t\t\t\t\tif ($(node).data(\"wpm-cookie-category\")) {\n\n\t\t\t\t\t\t// console.log(node)\n\n\t\t\t\t\t\t// If the pixel category has been approved > unblock\n\t\t\t\t\t\t// If the pixel belongs to more than one category, then unblock if one of the categories has been approved\n\t\t\t\t\t\t// If no category has been approved, but the Google Consent Mode is active, then only unblock the Google scripts\n\n\t\t\t\t\t\tif (wpm.shouldScriptBeActive(node)) {\n\t\t\t\t\t\t\twpm.unblockScript(node)\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\twpm.blockScript(node)\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t})\n\t\t})\n\t})\n\n\twpm.scriptTagObserver.observe(document.head, {childList: true, subtree: true})\n\twindow.addEventListener(\"DOMContentLoaded\", () => wpm.scriptTagObserver.disconnect())\n\n\twpm.shouldScriptBeActive = function (node) {\n\n\t\tif (\n\t\t\twpmDataLayer.shop.cookie_consent_mgmt.explicit_consent ||\n\t\t\twpmConsentValues.visitorHasChosen\n\t\t) {\n\n\t\t\tif (wpmConsentValues.mode === \"category\" && $(node).data(\"wpm-cookie-category\").split(\",\").some(element => wpmConsentValues.categories[element])) {\n\t\t\t\treturn true\n\t\t\t} else if (wpmConsentValues.mode === \"pixel\" && wpmConsentValues.pixels.includes($(node).data(\"wpm-pixel-name\"))) {\n\t\t\t\treturn true\n\t\t\t} else if (wpmConsentValues.mode === \"pixel\" && $(node).data(\"wpm-pixel-name\") === \"google\" && [\"google-analytics\", \"google-ads\"].some(element => wpmConsentValues.pixels.includes(element))) {\n\t\t\t\treturn true\n\t\t\t} else if (wpmDataLayer?.pixels?.google?.consent_mode?.active && $(node).data(\"wpm-pixel-name\") === \"google\") {\n\t\t\t\treturn true\n\t\t\t} else {\n\t\t\t\treturn false\n\t\t\t}\n\t\t} else {\n\t\t\treturn true\n\t\t}\n\t}\n\n\n\twpm.unblockScript = function (scriptNode, removeAttach = false) {\n\n\t\tif (removeAttach) $(scriptNode).remove()\n\n\t\tlet wpmSrc = $(scriptNode).data(\"wpm-src\")\n\t\tif (wpmSrc) $(scriptNode).attr(\"src\", wpmSrc)\n\n\t\tscriptNode.type = \"text/javascript\"\n\n\t\tif (removeAttach) $(scriptNode).appendTo(\"head\")\n\n\t\tjQuery(document).trigger(\"wpmPreLoadPixels\", {})\n\t}\n\n\twpm.blockScript = function (scriptNode, removeAttach = false) {\n\n\t\tif (removeAttach) $(scriptNode).remove()\n\n\t\tif ($(scriptNode).attr(\"src\")) $(scriptNode).removeAttr(\"src\")\n\t\tscriptNode.type = \"blocked/javascript\"\n\n\t\tif (removeAttach) $(scriptNode).appendTo(\"head\")\n\t}\n\n\twpm.unblockAllScripts = function (analytics = true, ads = true) {\n\t\t// console.log('unblocking all scripts')\n\n\t\t$.each(\n\t\t\t$(\"script[type=\\\"blocked/javascript\\\"]\"), function (index, scriptNode) {\n\n\t\t\t\tif ($(scriptNode).data(\"wpm-cookie-category\").includes(\"analytics\") && analytics) {\n\t\t\t\t\twpm.unblockScript(scriptNode, true)\n\t\t\t\t} else if ($(scriptNode).data(\"wpm-cookie-category\").includes(\"ads\") && ads) {\n\t\t\t\t\twpm.unblockScript(scriptNode, true)\n\t\t\t\t}\n\t\t\t})\n\n\t\tjQuery(document).trigger(\"wpmPreLoadPixels\", {})\n\t}\n\n\twpm.unblockSelectedPixels = function () {\n\t\t$.each(\n\t\t\t$(\"script[type=\\\"blocked/javascript\\\"]\"), function (index, node) {\n\n\t\t\t\tif (wpmConsentValues.pixels.includes($(node).data(\"wpm-pixel-name\"))) {\n\t\t\t\t\twpm.unblockScript(node, true)\n\t\t\t\t} else if ($(node).data(\"wpm-pixel-name\") === \"google\" && [\"google-analytics\", \"google-ads\"].some(element => wpmConsentValues.pixels.includes(element))) {\n\t\t\t\t\twpm.unblockScript(node, true)\n\t\t\t\t}\n\t\t\t})\n\n\t\tjQuery(document).trigger(\"wpmPreLoadPixels\", {})\n\t}\n\n\n\t/**\n\t * Block or unblock scripts for each CMP immediately after cookie consent has been updated\n\t * by the visitor.\n\t */\n\n\t// Borlabs Cookie\n\t// If visitor accepts cookies in Borlabs Cookie unblock the scripts\n\twindow.addEventListener(\"borlabs-cookie-consent-saved\", function () {\n\n\t\twpm.updateConsentCookieValues()\n\n\t\tif (wpmConsentValues.mode === \"pixel\") {\n\n\t\t\twpm.unblockSelectedPixels()\n\t\t\twpm.updateGoogleConsentMode(wpmConsentValues.pixels.includes(\"google-analytics\"), wpmConsentValues.pixels.includes(\"google-ads\"))\n\t\t} else {\n\n\t\t\twpm.unblockAllScripts(wpmConsentValues.categories.analytics, wpmConsentValues.categories.ads)\n\t\t\twpm.updateGoogleConsentMode(wpmConsentValues.categories.analytics, wpmConsentValues.categories.ads)\n\t\t}\n\t})\n\n\t// Cookiebot\n\t// If visitor accepts cookies in Cookiebot unblock the scripts\n\t// https://www.cookiebot.com/en/developer/\n\twindow.addEventListener(\"CookiebotOnAccept\", function () {\n\t\tif (Cookiebot.consent.statistics) wpmConsentValues.categories.analytics = true\n\t\tif (Cookiebot.consent.marketing) wpmConsentValues.categories.ads = true\n\n\t\twpm.unblockAllScripts(wpmConsentValues.categories.analytics, wpmConsentValues.categories.ads)\n\t\twpm.updateGoogleConsentMode(wpmConsentValues.categories.analytics, wpmConsentValues.categories.ads)\n\n\t}, false)\n\n\t/**\n\t * Cookie Script\n\t * If visitor accepts cookies in Cookie Script unblock the scripts\n\t * https://support.cookie-script.com/article/20-custom-events\n\t */\n\twindow.addEventListener(\"CookieScriptAccept\", function (e) {\n\t\tif (e.detail.categories.includes(\"performance\")) wpmConsentValues.categories.analytics = true\n\t\tif (e.detail.categories.includes(\"targeting\")) wpmConsentValues.categories.ads = true\n\n\t\twpm.unblockAllScripts(wpmConsentValues.categories.analytics, wpmConsentValues.categories.ads)\n\t\twpm.updateGoogleConsentMode(wpmConsentValues.categories.analytics, wpmConsentValues.categories.ads)\n\t})\n\n\t/**\n\t * Cookie Script\n\t * If visitor accepts cookies in Cookie Script unblock the scripts\n\t * https://support.cookie-script.com/\n\t */\n\twindow.addEventListener(\"CookieScriptAcceptAll\", function () {\n\t\twpm.unblockAllScripts(true, true)\n\t\twpm.updateGoogleConsentMode(true, true)\n\t})\n\n\t// Complianz Cookie\n\t// If visitor accepts cookies in Complianz unblock the scripts\n\tdocument.addEventListener(\"cmplzStatusChange\", function () {\n\n\t\twpm.updateConsentCookieValues()\n\n\t\t// console.log(wpmConsentValues)\n\n\t\twpm.unblockAllScripts(wpmConsentValues.categories.analytics, wpmConsentValues.categories.ads)\n\t\twpm.updateGoogleConsentMode(wpmConsentValues.categories.analytics, wpmConsentValues.categories.ads)\n\t})\n\n\t// Cookie Compliance by hu-manity.co (free and pro)\n\t// If visitor accepts cookies in Cookie Notice by hu-manity.co unblock the scripts (free version)\n\t// https://wordpress.org/support/topic/events-on-consent-change/#post-15202792\n\tdocument.addEventListener(\"setCookieNotice\", function () {\n\n\t\twpm.updateConsentCookieValues()\n\n\t\t// console.log(wpmConsentValues)\n\n\t\twpm.unblockAllScripts(wpmConsentValues.categories.analytics, wpmConsentValues.categories.ads)\n\t\twpm.updateGoogleConsentMode(wpmConsentValues.categories.analytics, wpmConsentValues.categories.ads)\n\t})\n\n\t/**\n\t * Cookie Compliance by hu-manity.co (free and pro)\n\t * If visitor accepts cookies in Cookie Notice by hu-manity.co unblock the scripts (pro version)\n\t * https://wordpress.org/support/topic/events-on-consent-change/#post-15202792\n\t * Because Cookie Notice has no documented API or event that is being triggered on consent save or update\n\t * we have to solve this by using a mutation observer.\n\t *\n\t * @type {MutationObserver}\n\t */\n\n\twpm.huObserver = new MutationObserver(function (mutations) {\n\t\tmutations.forEach(({addedNodes}) => {\n\t\t\t[...addedNodes]\n\t\t\t\t.forEach(node => {\n\n\t\t\t\t\tif (node.id === \"hu\") {\n\n\t\t\t\t\t\tjQuery(\".hu-cookies-save\").on(\"click\", function () {\n\t\t\t\t\t\t\twpm.updateConsentCookieValues()\n\t\t\t\t\t\t\twpm.unblockAllScripts(wpmConsentValues.categories.analytics, wpmConsentValues.categories.ads)\n\t\t\t\t\t\t\twpm.updateGoogleConsentMode(wpmConsentValues.categories.analytics, wpmConsentValues.categories.ads)\n\t\t\t\t\t\t})\n\t\t\t\t\t}\n\t\t\t\t})\n\t\t})\n\t})\n\n\tif (window.hu) {\n\t\twpm.huObserver.observe(document.documentElement || document.body, {childList: true, subtree: true})\n\t}\n\n\twpm.version = function () {\n\t\tconsole.log(wpmDataLayer.version)\n\t}\n\n\t// https://api.jquery.com/jquery.getscript/\n\twpm.loadScriptAndCacheIt = function (url, options) {\n\n\t\t// Allow user to set any option except for dataType, cache, and url\n\t\toptions = jQuery.extend(options || {}, {\n\t\t\tdataType: \"script\",\n\t\t\tcache : true,\n\t\t\turl : url,\n\t\t})\n\n\t\t// Use $.ajax() since it is more flexible than $.getScript\n\t\t// Return the jqXHR object so we can chain callbacks\n\t\treturn jQuery.ajax(options)\n\t}\n\n\twpm.getOrderItemPrice = function (orderItem) {\n\t\treturn (orderItem.total + orderItem.total_tax) / orderItem.quantity\n\t}\n\n\twpm.hasLoginEventFired = function () {\n\t\tlet data = wpm.getWpmSessionData()\n\t\treturn data?.loginEventFired\n\t}\n\n\twpm.setLoginEventFired = function () {\n\t\tlet data = wpm.getWpmSessionData()\n\t\tdata[\"loginEventFired\"] = true\n\t\twpm.setWpmSessionData(data)\n\t}\n\n\twpm.wpmDataLayerExists = function () {\n\t\treturn new Promise(function (resolve) {\n\t\t\t(function waitForVar() {\n\t\t\t\tif (typeof wpmDataLayer !== \"undefined\") return resolve()\n\t\t\t\tsetTimeout(waitForVar, 50)\n\t\t\t})()\n\t\t})\n\t}\n\n\twpm.pageLoaded = function () {\n\t\treturn new Promise(function (resolve) {\n\t\t\t(function waitForVar() {\n\t\t\t\tif (\"complete\" === document.readyState) return resolve()\n\t\t\t\tsetTimeout(waitForVar, 50)\n\t\t\t})()\n\t\t})\n\t}\n\n\twpm.pageReady = function () {\n\t\treturn new Promise(function (resolve) {\n\t\t\t(function waitForVar() {\n\t\t\t\tif (\"interactive\" === document.readyState || \"complete\" === document.readyState) return resolve()\n\t\t\t\tsetTimeout(waitForVar, 50)\n\t\t\t})()\n\t\t})\n\t}\n\n\twpm.isMiniCartActive = function () {\n\t\tif (window.sessionStorage) {\n\t\t\tfor (const [key, value] of Object.entries(window.sessionStorage)) {\n\t\t\t\tif (key.includes(\"wc_fragments\")) {\n\t\t\t\t\treturn true\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn false\n\t\t} else {\n\t\t\treturn false\n\t\t}\n\t}\n\n\twpm.doesWooCommerceCartExist = function () {\n\t\treturn document.cookie.includes(\"woocommerce_items_in_cart\")\n\t}\n\n\twpm.urlHasParameter = function (parameter) {\n\t\tlet urlParams = new URLSearchParams(window.location.search)\n\t\treturn urlParams.has(parameter)\n\t}\n\n\t// wpm['load'] = {\n\t// base: true\n\t// };\n\n\twindow[\"wpmLoaded\"] = {}\n\n\t// return {\n\t// writeOrderIdToStorage : writeOrderIdToStorage,\n\t// isOrderIdStored : isOrderIdStored,\n\t// isEmail : isEmail,\n\t// removeProductFromCart : removeProductFromCart,\n\t// getViewItemProducts : getViewItemProducts,\n\t// addProductToCart : addProductToCart,\n\t// getCartItemsFromBackEnd: getCartItemsFromBackEnd,\n\t// fireCheckoutOption : fireCheckoutOption,\n\t// getCartItems : getCartItems\n\t// }\n\n}(window.wpm = window.wpm || {}, jQuery))\n\n\n/**\n * Run when page is ready\n * */\n\nwpm.pageReady().then(function () {\n\n\n\t/**\n\t * Run as soon as wpm namespace is loaded\n\t */\n\n\twpm.wpmDataLayerExists()\n\t\t.then(function () {\n\t\t\t// watch for products visible in viewport\n\t\t\twpm.startIntersectionObserverToWatch()\n\n\t\t\t// watch for lazy loaded products\n\t\t\twpm.startProductsMutationObserverToWatch()\n\t\t})\n\n\t// let products = jQuery(\".products, .product\")\n\n\n\t// remove_from_cart event\n\tjQuery(document).on(\"click\", \".remove_from_cart_button, .remove\", function () {\n\t\t// jQuery('.remove_from_cart_button, .remove').on('click', function (e) {\n\n\t\ttry {\n\t\t\t// console.log('remove_from_cart: ' + jQuery(this).data('product_id'));\n\n\t\t\tlet url = new URL(jQuery(this).attr(\"href\"))\n\t\t\tlet productId = wpm.getProductIdByCartItemKeyUrl(url)\n\n\t\t\twpm.removeProductFromCart(productId)\n\n\t\t} catch (e) {\n\t\t\tconsole.error(e)\n\t\t}\n\t})\n\n\n\t// add_to_cart event\n\tjQuery(document).on(\"click\", \".add_to_cart_button:not(.product_type_variable), .ajax_add_to_cart, .single_add_to_cart_button\", function () {\n\t\t// jQuery('.add_to_cart_button:not(.product_type_variable), .ajax_add_to_cart, .js-ajax-add-to-cart, .single_add_to_cart_button, .btn_color-2').on('click', function (e) {\n\n\t\ttry {\n\t\t\t// console.log('add_to_cart');\n\n\t\t\tif (wpmDataLayer.shop.page_type === \"product\") {\n\n\t\t\t\t// first process related and upsell products\n\t\t\t\tif (typeof jQuery(this).attr(\"href\") !== \"undefined\" && jQuery(this).attr(\"href\").includes(\"add-to-cart\")) {\n\t\t\t\t\t// console.log('add-to-cart on upsell and related products');\n\t\t\t\t\tlet quantity = 1\n\t\t\t\t\tlet productId = jQuery(this).data(\"product_id\")\n\t\t\t\t\t// console.log('productId: ' + productId);\n\t\t\t\t\twpm.addProductToCart(productId, quantity)\n\t\t\t\t} else {\n\n\t\t\t\t\tif (wpmDataLayer.shop.product_type === \"simple\") {\n\n\t\t\t\t\t\t// console.log('test');\n\t\t\t\t\t\tlet quantity = Number(jQuery(\".input-text.qty\").val())\n\n\t\t\t\t\t\tif (!quantity && quantity !== 0) quantity = 1\n\n\t\t\t\t\t\tlet productId = jQuery(this).val()\n\n\t\t\t\t\t\t// console.log('productId: ' + productId);\n\t\t\t\t\t\t// console.log('quantity: ' + quantity);\n\n\t\t\t\t\t\twpm.addProductToCart(productId, quantity)\n\n\t\t\t\t\t} else if (wpmDataLayer.shop.product_type === \"variable\") {\n\n\t\t\t\t\t\t// console.log('variable');\n\n\t\t\t\t\t\tlet quantity = Number(jQuery(\".input-text.qty\").val())\n\n\t\t\t\t\t\tif (!quantity && quantity !== 0) quantity = 1\n\n\t\t\t\t\t\tlet productId = jQuery(\"[name='variation_id']\").val()\n\n\t\t\t\t\t\t// console.log('productId: ' + productId);\n\t\t\t\t\t\t// console.log('quantity: ' + quantity);\n\n\t\t\t\t\t\twpm.addProductToCart(productId, quantity)\n\n\t\t\t\t\t} else if (wpmDataLayer.shop.product_type === \"grouped\") {\n\n\t\t\t\t\t\t// console.log('grouped');\n\n\t\t\t\t\t\tjQuery(\".woocommerce-grouped-product-list-item\").each(function () {\n\n\t\t\t\t\t\t\tlet quantity = Number(jQuery(this).find(\".input-text.qty\").val())\n\n\t\t\t\t\t\t\tif (!quantity && quantity !== 0) quantity = 1\n\n\t\t\t\t\t\t\tlet classes = jQuery(this).attr(\"class\")\n\t\t\t\t\t\t\tlet productId = wpm.getPostIdFromString(classes)\n\n\t\t\t\t\t\t\t// console.log('productId: ' + productId);\n\t\t\t\t\t\t\t// console.log('quantity: ' + quantity);\n\n\t\t\t\t\t\t\twpm.addProductToCart(productId, quantity)\n\t\t\t\t\t\t})\n\t\t\t\t\t} else if (wpmDataLayer.shop.product_type === \"bundle\") {\n\n\t\t\t\t\t\t// console.log('bundle');\n\n\t\t\t\t\t\tlet quantity = Number(jQuery(\".input-text.qty\").val())\n\n\t\t\t\t\t\tif (!quantity && quantity !== 0) quantity = 1\n\n\t\t\t\t\t\tlet productId = jQuery(\"input[name=add-to-cart]\").val()\n\n\t\t\t\t\t\t// console.log('productId: ' + productId);\n\t\t\t\t\t\t// console.log('quantity: ' + quantity);\n\n\t\t\t\t\t\twpm.addProductToCart(productId, quantity)\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t} else {\n\n\t\t\t\t// console.log('non product page');\n\n\t\t\t\tlet quantity = 1\n\t\t\t\tlet productId = jQuery(this).data(\"product_id\")\n\t\t\t\t// console.log('productId: ' + productId);\n\t\t\t\twpm.addProductToCart(productId, quantity)\n\t\t\t}\n\t\t} catch (e) {\n\t\t\tconsole.error(e)\n\t\t}\n\t})\n\n\t// if someone clicks anywhere on a custom /?add-to-cart=123 link\n\t// trigger the add to cart event\n\t// body.one('click', function (e) {\n\t//\n\t// try {\n\t// if (jQuery(this)[0].URL) {\n\t//\n\t// let href = new URL(jQuery(this)[0].URL);\n\t// let searchParams = new URLSearchParams(href.search);\n\t//\n\t// if (searchParams.has('add-to-cart')) {\n\t// // console.log('non product page, /?add-to-cart=123 link');\n\t//\n\t// let productId = searchParams.get('add-to-cart');\n\t// wpm.addProductToCart(productId, 1);\n\t// }\n\t// }\n\t// } catch (e) {\n\t// console.error(e);\n\t// }\n\t// });\n\n\n\t/**\n\t * If someone clicks anywhere on a custom /?add-to-cart=123 link\n\t * trigger the add to cart event\n\t */\n\tjQuery(document).one(\"click\", \"a:not(.add_to_cart_button, .ajax_add_to_cart, .single_add_to_cart_button)\", function (event) {\n\t\t// jQuery('a:not(.add_to_cart_button, .ajax_add_to_cart, .single_add_to_cart_button)').one('click', function (event) {\n\n\t\ttry {\n\t\t\tif (jQuery(event.target).closest(\"a\").attr(\"href\")) {\n\n\t\t\t\tlet href = jQuery(event.target).closest(\"a\").attr(\"href\")\n\n\t\t\t\tif (href.includes(\"add-to-cart=\")) {\n\t\t\t\t\tlet matches = href.match(/(add-to-cart=)(\\d+)/)\n\t\t\t\t\t// console.log('pid: ' + matches[2])\n\t\t\t\t\tif (matches) wpm.addProductToCart(matches[2], 1)\n\t\t\t\t}\n\t\t\t}\n\t\t} catch (e) {\n\t\t\tconsole.error(e)\n\t\t}\n\t})\n\n\t// select_content GA UA event\n\t// select_item GA 4 event\n\t// jQuery(document).on('click', '.woocommerce-LoopProduct-link, .wc-block-grid__product, .product-small.box', function (e) {\n\tjQuery(document).on(\"click\", \".woocommerce-LoopProduct-link, .wc-block-grid__product, .product, .product-small, .type-product\", function () {\n\t\t// jQuery('.woocommerce-LoopProduct-link, .wc-block-grid__product, .product, .product-small, .type-product').on('click', function (e) {\n\n\t\ttry {\n\n\t\t\t/**\n\t\t\t *\n\t\t\t * On some pages the event fires multiple times, and on product pages\n\t\t\t * even on page load. Using e.stopPropagation helps to prevent this,\n\t\t\t * but I dont know why. We don't even have to use this, since only a real\n\t\t\t * product click yields a valid productId. So we filter the invalid click\n\t\t\t * events out later down the code. I'll keep it that way because this is\n\t\t\t * the most compatible way across shops.\n\t\t\t * e.stopPropagation();\n\t\t\t * */\n\n\t\t\t\t// console.log('select_content and select_item');\n\n\t\t\tlet productId = jQuery(this).nextAll(\".wpmProductId:first\").data(\"id\")\n\t\t\t// console.log('select_content and select_item: ' + productId);\n\n\n\t\t\t/**\n\t\t\t * On product pages, for some reason, the click event is triggered on the main product on page load.\n\t\t\t * In that case no ID is found. But we can discard it, since we only want to trigger the event on\n\t\t\t * related products, which are found below.\n\t\t\t */\n\n\t\t\tif (productId) {\n\n\t\t\t\t// console.log('select_content and select_item: ' + productId);\n\n\t\t\t\tproductId = getIdBasedOndVariationsOutputSetting(productId)\n\n\t\t\t\tif (!productId) throw Error(\"Wasn't able to retrieve a productId\")\n\n\t\t\t\t// console.log('prodid: ' + productId);\n\n\t\t\t\tif (wpmDataLayer.products && wpmDataLayer.products[productId]) {\n\n\t\t\t\t\tlet product = wpm.getProductDetailsFormattedForEvent(productId)\n\n\t\t\t\t\tjQuery(document).trigger(\"wpmSelectContentGaUa\", product)\n\t\t\t\t\tjQuery(document).trigger(\"wpmSelectItem\", product)\n\t\t\t\t}\n\t\t\t}\n\t\t} catch (e) {\n\t\t\tconsole.error(e)\n\t\t}\n\t})\n\n\t// begin_checkout event\n\tjQuery(document).one(\"click\", \".checkout-button, .cart-checkout-button, .button.checkout\", function () {\n\t\t// jQuery('.checkout-button, .cart-checkout-button, .button.checkout').one('click', function (e) {\n\t\t// console.log('begin_checkout');\n\n\t\tjQuery(document).trigger(\"wpmBeginCheckout\")\n\t})\n\n\n\t// checkout_progress event\n\t// track checkout option event: entered valid billing email\n\tjQuery(document).on(\"input\", \"#billing_email\", function () {\n\t\t// jQuery('#billing_email').on('input', function () {\n\n\t\tif (wpm.isEmail(jQuery(this).val())) {\n\t\t\t// wpm.fireCheckoutOption(2);\n\t\t\twpm.fireCheckoutProgress(2)\n\t\t\twpm.emailSelected = true\n\t\t}\n\t})\n\n\t// track checkout option event: purchase click\n\tjQuery(document).on(\"click\", \".wc_payment_methods\", function () {\n\t\t// jQuery('.wc_payment_methods').on('click', function () {\n\n\t\tif (false === wpm.paymentMethodSelected) {\n\t\t\twpm.fireCheckoutProgress(3)\n\t\t}\n\n\t\twpm.fireCheckoutOption(3, jQuery(\"input[name='payment_method']:checked\").val())\n\t\twpm.paymentMethodSelected = true\n\t})\n\n\t// track checkout option event: purchase click\n\tjQuery(document).one(\"click\", \"#place_order\", function () {\n\t\t// jQuery('#place_order').one('click', function () {\n\n\t\tif (false === wpm.emailSelected) {\n\t\t\twpm.fireCheckoutProgress(2)\n\t\t}\n\n\t\tif (false === wpm.paymentMethodSelected) {\n\t\t\twpm.fireCheckoutProgress(3)\n\t\t\twpm.fireCheckoutOption(3, jQuery(\"input[name='payment_method']:checked\").val())\n\t\t}\n\n\t\twpm.fireCheckoutProgress(4)\n\t})\n\n\t// update cart event\n\tjQuery(document).on(\"click\", \"[name='update_cart']\", function () {\n\t\t// jQuery(\"[name='update_cart']\").on('click', function (e) {\n\n\t\ttry {\n\t\t\tjQuery(\".cart_item\").each(function () {\n\n\t\t\t\t// let productId = jQuery(this).find('[data-product_id]').data('product_id');\n\n\t\t\t\tlet url = new URL(jQuery(this).find(\".product-remove\").find(\"a\").attr(\"href\"))\n\t\t\t\tlet productId = wpm.getProductIdByCartItemKeyUrl(url)\n\n\n\t\t\t\tlet quantity = jQuery(this).find(\".qty\").val()\n\n\t\t\t\tif (quantity === 0) {\n\t\t\t\t\twpm.removeProductFromCart(productId)\n\t\t\t\t} else if (quantity < wpmDataLayer.cart[productId].quantity) {\n\t\t\t\t\twpm.removeProductFromCart(productId, wpmDataLayer.cart[productId].quantity - quantity)\n\t\t\t\t} else if (quantity > wpmDataLayer.cart[productId].quantity) {\n\t\t\t\t\twpm.addProductToCart(productId, quantity - wpmDataLayer.cart[productId].quantity)\n\t\t\t\t}\n\t\t\t})\n\t\t} catch (e) {\n\t\t\tconsole.error(e)\n\t\t\twpm.getCartItemsFromBackend()\n\t\t}\n\t})\n\n\n\t// add_to_wishlist\n\tjQuery(document).on(\"click\", \".add_to_wishlist, .wl-add-to\", function () {\n\t\t// jQuery('.add_to_wishlist, .wl-add-to').on('click', function () {\n\n\t\ttry {\n\t\t\t// console.log('add_to_wishlist');\n\t\t\t// console.log('this:' + jQuery(this).data('product-id'));\n\n\t\t\tlet productId\n\n\t\t\tif (jQuery(this).data(\"productid\")) { // for the WooCommerce wishlist plugin\n\t\t\t\tproductId = jQuery(this).data(\"productid\")\n\t\t\t} else if (jQuery(this).data(\"product-id\")) { // for the YITH wishlist plugin\n\t\t\t\tproductId = jQuery(this).data(\"product-id\")\n\t\t\t}\n\n\t\t\tif (!productId) throw Error(\"Wasn't able to retrieve a productId\")\n\n\t\t\tlet product = wpm.getProductDetailsFormattedForEvent(productId)\n\n\t\t\t// console.log('add_to_wishlist');\n\t\t\t// console.log(product);\n\n\t\t\tjQuery(document).trigger(\"wpmAddToWishlist\", product)\n\t\t} catch (e) {\n\t\t\tconsole.error(e)\n\t\t}\n\t})\n\n\tjQuery(document).on(\"updated_cart_totals\", function () {\n\t\tjQuery(document).trigger(\"wpmViewCart\")\n\t})\n\n\n\t/**\n\t * Called when the user selects all the required dropdowns / attributes\n\t *\n\t * Has to be hooked after document ready\n\t *\n\t * https://stackoverflow.com/a/27849208/4688612\n\t * https://stackoverflow.com/a/65065335/4688612\n\t */\n\tjQuery(\".single_variation_wrap\").on(\"show_variation\", function (event, variation) {\n\n\t\ttry {\n\t\t\tlet productId = getIdBasedOndVariationsOutputSetting(variation.variation_id)\n\n\t\t\tif (!productId) throw Error(\"Wasn't able to retrieve a productId\")\n\n\t\t\tif (wpmDataLayer.products && wpmDataLayer.products[productId]) {\n\n\t\t\t\t// console.log('productId: ' + productId);\n\n\t\t\t\tlet product = wpm.getProductDetailsFormattedForEvent(productId)\n\n\t\t\t\tjQuery(document).trigger(\"wpmViewItem\", product)\n\t\t\t}\n\t\t} catch (e) {\n\t\t\tconsole.error(e)\n\t\t}\n\t})\n\n\t/**\n\t * Called on variable products when no selection has been done yet\n\t * or when the visitor deselects his choice.\n\t *\n\t * Has to be hooked after document ready\n\t */\n\n\tjQuery(\".single_variation_wrap\").on(\"hide_variation\", function () {\n\n\t\ttry {\n\t\t\tlet classes = jQuery(\"body\").attr(\"class\")\n\t\t\tlet productId = classes.match(/(postid-)(\\d+)/)[2]\n\n\t\t\tif (!productId) throw Error(\"Wasn't able to retrieve a productId\")\n\n\t\t\t/**\n\t\t\t * If we have a variable product with no preset,\n\t\t\t * and variations output is enabled,\n\t\t\t * then we send a viewItem event with the first\n\t\t\t * variation we find for the parent.\n\t\t\t * If variations output is disabled,\n\t\t\t * we just send the parent ID.\n\t\t\t */\n\t\t\tif (\n\t\t\t\t\"variable\" === wpmDataLayer.shop.product_type &&\n\t\t\t\twpmDataLayer?.general?.variationsOutput\n\t\t\t) {\n\t\t\t\tfor (const [key, product] of Object.entries(wpmDataLayer.products)) {\n\t\t\t\t\tif (\"parentId\" in product) {\n\t\t\t\t\t\t// console.log('pid: ' + value.parentId)\n\t\t\t\t\t\tproductId = product.id\n\t\t\t\t\t\tbreak\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (wpmDataLayer.products && wpmDataLayer.products[productId]) {\n\n\t\t\t\t// console.log('productId: ' + productId);\n\n\t\t\t\tlet product = wpm.getProductDetailsFormattedForEvent(productId)\n\n\t\t\t\tjQuery(document).trigger(\"wpmViewItem\", product)\n\t\t\t}\n\n\t\t} catch (e) {\n\t\t\tconsole.error(e)\n\t\t}\n\t})\n\n}) // End document ready wrap\n\n/**\n * Set up wpm events\n */\n\n\n// populate the wpmDataLayer with the cart items\njQuery(window).on(\"wpmLoad\", function () {\n\n\ttry {\n\t\t// When a new session is initiated there are no items in the cart,\n\t\t// so we can save the call to get the cart items\n\t\tif (wpm.doesWooCommerceCartExist()) wpm.getCartItems()\n\n\t} catch (e) {\n\t\tconsole.error(e)\n\t}\n})\n\n// get all add-to-cart= products from backend\njQuery(window).on(\"wpmLoad\", function () {\n\n\twpmDataLayer.products = wpmDataLayer.products || {}\n\n\t// scan page for add-to-cart= links\n\tlet productIds = wpm.getAddToCartLinkProductIds()\n\n\twpm.getProductsFromBackend(productIds)\n})\n\n/**\n * Save the referrer into a cookie\n */\n\njQuery(window).on(\"wpmLoad\", function () {\n\n\t// can't use session storage as we can't read it from the server\n\tif (!wpm.getCookie(\"wpmReferrer\")) {\n\n\t\tif (document.referrer) {\n\t\t\tlet referrerUrl = new URL(document.referrer)\n\t\t\tlet referrerHostname = referrerUrl.hostname\n\n\t\t\tif (referrerHostname !== window.location.host) {\n\t\t\t\twpm.setCookie(\"wpmReferrer\", referrerHostname)\n\t\t\t} else {\n\t\t\t\twpm.setCookie(\"wpmReferrer\", \"\")\n\t\t\t}\n\n\t\t} else {\n\t\t\twpm.setCookie(\"wpmReferrer\", \"\")\n\t\t}\n\t}\n})\n\n\n/**\n * Create our own load event in order to better handle script flow execution when JS \"optimizers\" shuffle the code.\n */\n\njQuery(window).on(\"wpmLoad\", function () {\n\ttry {\n\t\tif (typeof wpmDataLayer != \"undefined\" && !wpmDataLayer?.wpmLoadFired) {\n\n\t\t\tjQuery(document).trigger(\"wpmLoadAlways\")\n\n\t\t\tif (\"product\" === wpmDataLayer.shop.page_type && wpmDataLayer.shop.product_type !== \"variable\" && wpm.getMainProductIdFromProductPage()) {\n\n\t\t\t\tlet product = wpm.getProductDataForViewItemEvent(wpm.getMainProductIdFromProductPage())\n\t\t\t\tjQuery(document).trigger(\"wpmViewItem\", product)\n\n\t\t\t} else if (\"product_category\" === wpmDataLayer.shop.page_type) {\n\n\t\t\t\tjQuery(document).trigger(\"wpmCategory\")\n\n\t\t\t} else if (\"search\" === wpmDataLayer.shop.page_type) {\n\n\t\t\t\tjQuery(document).trigger(\"wpmSearch\")\n\n\t\t\t} else if (\"cart\" === wpmDataLayer.shop.page_type) {\n\n\t\t\t\tjQuery(document).trigger(\"wpmViewCart\")\n\n\t\t\t} else if (\"order_received_page\" === wpmDataLayer.shop.page_type && wpmDataLayer.order) {\n\n\t\t\t\tif (!wpm.isOrderIdStored(wpmDataLayer.order.id)) {\n\n\t\t\t\t\tjQuery(document).trigger(\"wpmOrderReceivedPage\")\n\t\t\t\t\twpm.writeOrderIdToStorage(wpmDataLayer.order.id)\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tjQuery(document).trigger(\"wpmEverywhereElse\")\n\t\t\t}\n\n\t\t\tif (wpmDataLayer?.user?.id && !wpm.hasLoginEventFired()) {\n\t\t\t\tjQuery(document).trigger(\"wpmLogin\")\n\t\t\t\twpm.setLoginEventFired()\n\t\t\t}\n\n\t\t\t// /**\n\t\t\t// * Load mini cart fragments into a wpm session storage key,\n\t\t\t// * after the document load event.\n\t\t\t// */\n\t\t\t// jQuery(document).ajaxSend(function (event, jqxhr, settings) {\n\t\t\t// \t// console.log('settings.url: ' + settings.url);\n\t\t\t//\n\t\t\t// \tif (settings.url.includes(\"get_refreshed_fragments\") && sessionStorage) {\n\t\t\t// \t\tif (!sessionStorage.getItem(\"wpmMiniCartActive\")) {\n\t\t\t// \t\t\tsessionStorage.setItem(\"wpmMiniCartActive\", JSON.stringify(true))\n\t\t\t// \t\t}\n\t\t\t// \t}\n\t\t\t// })\n\n\t\t\twpmDataLayer.wpmLoadFired = true\n\t\t}\n\n\t} catch (e) {\n\t\tconsole.error(e)\n\t}\n})\n\n// jQuery(window).on(\"load\", function () {\n// \tjQuery(document).trigger(\"wpmLoad\", {})\n// })\n\njQuery(window).on(\"wpmPreLoadPixels\", function () {\n\n\tif (wpmDataLayer?.shop?.cookie_consent_mgmt?.explicit_consent) {\n\t\twpm.updateConsentCookieValues(true)\n\t}\n\tjQuery(document).trigger(\"wpmLoadPixels\", {})\n})\n","(function (wpm, $, undefined) {\n\n\t// do something\n\n}(window.wpm = window.wpm || {}, jQuery))\n","// The module cache\nvar __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tvar cachedModule = __webpack_module_cache__[moduleId];\n\tif (cachedModule !== undefined) {\n\t\treturn cachedModule.exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\t// no module.id needed\n\t\t// no module.loaded needed\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId](module, module.exports, __webpack_require__);\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n","// TODO Try using the webpack ignore plugin to remove premium imports during compilation\n// https://webpack.js.org/plugins/ignore-plugin/\n// https://stackoverflow.com/questions/65004054/webpack-ignoreplugin-on-multiple-modules\n// https://stackoverflow.com/questions/61822069/conditional-import-import-if-exists\n// https://stackoverflow.com/questions/36367532/how-can-i-conditionally-import-an-es6-module\n\n\n// console.log(ENV)\n// if (ENV.tier === 'pro') {\n// console.log('tier')\n// }\n\n/**\n * Load all essential scripts first\n */\n\nrequire(\"./wpm\")\nrequire(\"./wpm__premium_only\")\nrequire(\"./google__premium_only\")\n\n/**\n * Load all free scripts\n */\n\nrequire(\"./google\")\nrequire(\"./google-ga-ua\")\nrequire(\"./google-ga-4\")\nrequire(\"./google-ads\")\nrequire(\"./facebook\")\nrequire(\"./hotjar\")\nrequire(\"./google-optimize\")\n\n/**\n * Load all premium scripts\n */\n\nrequire(\"./google-ga-ua-eec__premium_only\")\nrequire(\"./google-ga-4-eec__premium_only\")\nrequire(\"./tiktok__premium_only\")\nrequire(\"./snapchat__premium_only\")\nrequire(\"./pinterest__premium_only\")\nrequire(\"./facebook__premium_only\")\nrequire(\"./microsoft-ads__premium_only.js\")\nrequire(\"./twitter__premium_only.js\")\nrequire(\"./google-ads__premium_only.js\")\n\n\n/**\n * Execute the wpm loader. It makes sure that the script flow gets exectuded correctly, no matter how JS \"optimizers\" shuffle the code.\n */\n\nrequire(\"./wpm-loader\")\n\n\n// console.log('WooCommerce Pixel Manager premium version')\n\n\n"],"names":["wpm","$","undefined","fBUserData","loadFacebookPixel","wpmDataLayer","pixels","facebook","loaded","f","window","b","document","e","fbq","n","callMethod","apply","arguments","queue","push","_fbq","version","t","createElement","async","src","s","getElementsByTagName","parentNode","insertBefore","pixel_id","console","error","getRandomEventId","Math","random","toString","substring","getFbUserData","getFbUserDataFromBrowser","setFbUserData","fbp","getCookie","fbc","client_user_agent","navigator","userAgent","fbViewContent","product","eventId","content_type","content_name","name","content_ids","dyn_r_ids","dynamic_remarketing","id_type","currency","shop","value","price","eventID","jQuery","trigger","event_name","event_id","user_data","product_data","product_id","event_source_url","location","href","facebookContentIds","prodIds","key","item","Object","entries","order","items","general","variationsOutput","variation_id","String","products","id","on","canIFire","event","parseFloat","quantity","value_filtered","setFacebookIdentifiersOnServer","data","action","nonce","sessionStorage","getItem","ajax","type","dataType","url","ajax_url","success","response","setItem","JSON","stringify","content_category","category","eventData","capi","msg","indexOf","page_type","conversionIdentifiers","getGoogleAdsConversionIdentifiersWithLabel","google","ads","conversionIds","getGoogleAdsConversionIdentifiers","getGoogleAdsRegularOrderItems","orderItems","orderItem","getGoogleAdsDynamicRemarketingOrderItems","google_business_vertical","isEmptyObject","status","googleConfigConditionsMet","isVariable","send_events_with_parent_ids","gtagLoaded","then","gtag","send_to","data_basic","data_with_cart","transaction_id","number","new_customer","aw_merchant_id","discount","aw_feed_country","aw_feed_language","getCartItemsGa4","productId","cart","productItems","item_id","analytics","item_name","item_brand","brand","item_variant","variant","getFormattedGA4Categories","eec","ga4","measurement_id","index","list_position","item_list_name","list_name","item_list_id","list_id","cartValue","toFixed","position","search_term","getSearchTermFromUrl","getGA4OrderItems","item_category","join","variant_name","mp_active","affiliation","value_regular","tax","shipping","coupon","getCartItemsGaUa","universal","property_id","checkout_step","step","checkout_option","getGAUAOrderItems","load_google_optimize_pixel","optimize","loadScriptAndCacheIt","container_id","consent_mode","active","getConsentValues","mode","categories","includes","getVisitorConsentStatusAndUpdateGoogleConsentSettings","google_consent_settings","analytics_storage","ad_storage","updateGoogleConsentMode","cookie_consent_mgmt","explicit_consent","fireGtagGoogleAds","state","enhanced_conversions","phone_conversion_label","phone_conversion_number","keys","enhanced_conversion_data","fireGtagGoogleAnalyticsUA","parameters","fireGtagGoogleAnalyticsGA4","isGoogleActive","getGoogleGtagId","loadGoogle","done","script","textStatus","dataLayer","wait_for_update","region","ads_data_redaction","url_passthrough","linker","settings","Date","logPreventedPixelLoading","canGoogleLoad","Promise","resolve","reject","startTime","wait","setTimeout","Array","from","Set","isArray","length","max","i","setGoogleCidOnServer","targetIDs","clientID","target_ids","client_id","referrer","getReferrerFromCookie","gclid","getClidFromBrowser","getUserAgent","viewPortWidth","getViewPort","width","viewPortHeight","height","forEach","targetId","setCookie","parse","load_hotjar_pixel","hotjar","h","o","j","a","r","hj","q","_hjSettings","hjid","site_id","hjsv","appendChild","load_bing_pixel","bing","uetq","w","d","u","ti","uet_tag_id","UET","onload","onreadystatechange","this","readyState","bing_purchase_ecomm_prodids","bing_purchase_items","ecomm_pagetype","ecomm_prodid","revenue_value","getPinterestProductData","isVariation","product_name","product_variant_id","pinterest","parentId_dyn_r_ids","product_category","product_variant","product_price","product_quantity","product_brand","pinterestFormattedOrderItems","loadPinterestPixel","pintrk","prototype","slice","call","pinterestLoadEvent","userLoggedIn","enhanced_match","em","enhanced_match_email","line_items","productData","urlParams","URLSearchParams","search","search_query","get","order_quantity","order_id","snapchatGetEmail","userInfo","user","email_sha256","user_hashed_email","loadSnapchatPixel","snapchat","snaptr","handleRequest","getSnapchatOrderItemIds","contentIds","item_ids","loadTikTokPixel","tiktok","TiktokAnalyticsObject","ttq","methods","setAndDefer","concat","instance","_i","load","_u","_t","_o","page","track","getTikTokOrderItemIds","content_id","purchase_event_name","contents","loadTwitterPixel","twitter","twq","exe","twitterGetOrderContentIds","num_items","wpmDataLayerExists","log","pro","pageLoaded","wpmDeduper","wpmRestSettings","checkCookie","emailSelected","paymentMethodSelected","useRestEndpoint","isSessionStorageAvailable","isRestEndpointAvailable","isBelowRestErrorThreshold","testEndpoint","protocol","host","cookieName","timeout","statusCode","isWpmRestEndpointAvailable","writeOrderIdToStorage","orderId","Storage","localStorage","ids","expiresDate","setDate","getDate","cookie","toUTCString","storeOrderIdOnServer","orderDeduplication","isOrderIdStored","isEmail","email","test","removeProductFromCart","quantityToRemove","Error","getIdBasedOndVariationsOutputSetting","getProductDetailsFormattedForEvent","parentId","addProductToCart","getCartItemsFromBackend","getCartItems","saveCartObjectToDataLayer","cartItems","getProductsFromBackend","productIds","filter","hasOwnProperty","assign","cartObject","fireCheckoutOption","fireCheckoutProgress","getPostIdFromString","string","match","triggerViewItemList","getProductDataForViewItemEvent","getMainProductIdFromProductPage","product_type","viewItemListTriggerTestMode","target","css","append","find","viewItemListTrigger","opacity","backgroundColor","io","ioTimeouts","observerCallback","observer","entry","elementId","next","isIntersecting","testMode","repeat","unobserve","clearTimeout","remove","allIoElementsToWatch","ioid","startIntersectionObserverToWatch","urlHasParameter","IntersectionObserver","threshold","map","elem","parent","hasClass","prev","closest","each","observe","startProductsMutationObserverToWatch","productsNode","parents","has","first","productsMutationObserver","attributes","childList","characterData","MutationObserver","mutations","mutation","newNodes","addedNodes","hasWpmProductIdElement","siblings","cookieValue","expiryDays","setTime","getTime","expires","ca","decodeURIComponent","split","c","charAt","getWpmSessionData","setWpmSessionData","getProductIdByCartItemKeyUrl","cartItemKey","cartItemKeys","getAddToCartLinkProductIds","attr","matches","setReferrerToCookie","clidCookieId","clidId","dclid","documentElement","clientWidth","innerWidth","clientHeight","innerHeight","getComplianzCookies","cmplz_statistics","cmplz_marketing","visitorHasChosen","getCookieLawInfoCookies","analyticsCookie","adsCookie","wpmConsentValues","setConsentValueCategories","updateConsentCookieValues","explicitConsent","decodeURI","consents","statistics","marketing","thirdparty","advanced","setConsentDefaultValuesToExplicit","pixelName","canIFireMode","scriptTagObserver","node","shouldScriptBeActive","unblockScript","blockScript","head","subtree","addEventListener","disconnect","some","element","scriptNode","removeAttach","wpmSrc","appendTo","removeAttr","unblockAllScripts","unblockSelectedPixels","Cookiebot","consent","detail","huObserver","hu","body","options","extend","cache","getOrderItemPrice","total","total_tax","hasLoginEventFired","loginEventFired","setLoginEventFired","waitForVar","pageReady","isMiniCartActive","doesWooCommerceCartExist","parameter","URL","Number","val","classes","one","nextAll","variation","referrerHostname","hostname","wpmLoadFired","__webpack_module_cache__","__webpack_require__","moduleId","cachedModule","exports","module","__webpack_modules__","require"],"sourceRoot":""}
js/public/wpm.js ADDED
@@ -0,0 +1,1942 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 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
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /**
2
+ * Create a wpm namespace under which all functions are declared
3
+ */
4
+
5
+ // https://stackoverflow.com/a/5947280/4688612
6
+ (function (wpm, $, undefined) {
7
+
8
+ const wpmDeduper = {
9
+ keyName : "_wpm_order_ids",
10
+ cookieExpiresDays: 365,
11
+ }
12
+
13
+ const wpmRestSettings = {
14
+ // cookiesAvailable : '_wpm_cookies_are_available',
15
+ cookieWpmRestEndpointAvailable: "_wpm_endpoint_available",
16
+ restEndpoint : "/wp-json/",
17
+ restFails : 0,
18
+ restFailsThreshold : 10,
19
+ }
20
+
21
+ wpm.emailSelected = false
22
+ wpm.paymentMethodSelected = false
23
+
24
+ // wpm.checkIfCookiesAvailable = function () {
25
+ //
26
+ // // read the cookie if previously set, if it is return true, otherwise continue
27
+ // if (wpm.getCookie(wpmRestSettings.cookiesAvailable)) {
28
+ // return true;
29
+ // }
30
+ //
31
+ // // set the cookie for the session
32
+ // Cookies.set(wpmRestSettings.cookiesAvailable, true);
33
+ //
34
+ // // read cookie, true if ok, false if not ok
35
+ // return !!wpm.getCookie(wpmRestSettings.cookiesAvailable);
36
+ // }
37
+
38
+ wpm.useRestEndpoint = function () {
39
+
40
+ // only if sessionStorage is available
41
+
42
+ // only if REST API endpoint is generally accessible
43
+ // check in sessionStorage if we checked before and return answer
44
+ // otherwise check if the endpoint is available, save answer in sessionStorage and return answer
45
+
46
+ // only if not too many REST API errors happened
47
+
48
+ return wpm.isSessionStorageAvailable() &&
49
+ wpm.isRestEndpointAvailable() &&
50
+ wpm.isBelowRestErrorThreshold()
51
+ }
52
+
53
+ wpm.isBelowRestErrorThreshold = function () {
54
+ return window.sessionStorage.getItem(wpmRestSettings.restFails) <= wpmRestSettings.restFailsThreshold
55
+ }
56
+
57
+ wpm.isRestEndpointAvailable = function () {
58
+
59
+ if (window.sessionStorage.getItem(wpmRestSettings.cookieWpmRestEndpointAvailable)) {
60
+ return JSON.parse(window.sessionStorage.getItem(wpmRestSettings.cookieWpmRestEndpointAvailable))
61
+ } else {
62
+ // return wpm.testEndpoint();
63
+ // just set the value whenever possible in order not to wait or block the main thread
64
+ wpm.testEndpoint()
65
+ }
66
+ }
67
+
68
+ wpm.isSessionStorageAvailable = function () {
69
+
70
+ return !!window.sessionStorage
71
+ }
72
+
73
+ wpm.testEndpoint = function (
74
+ url = location.protocol + "//" + location.host + wpmRestSettings.restEndpoint,
75
+ cookieName = wpmRestSettings.cookieWpmRestEndpointAvailable,
76
+ ) {
77
+ // console.log('testing endpoint');
78
+
79
+ jQuery.ajax(url, {
80
+ type : "HEAD",
81
+ timeout: 1000,
82
+ // async: false,
83
+ statusCode: {
84
+ 200: function (response) {
85
+ // Cookies.set(cookieName, true);
86
+ // console.log('endpoint works');
87
+ window.sessionStorage.setItem(cookieName, JSON.stringify(true))
88
+ },
89
+ 404: function (response) {
90
+ // Cookies.set(cookieName, false);
91
+ // console.log('endpoint doesn\'t work');
92
+ window.sessionStorage.setItem(cookieName, JSON.stringify(false))
93
+ },
94
+ 0 : function (response) {
95
+ // Cookies.set(cookieName, false);
96
+ // console.log('endpoint doesn\'t work');
97
+ window.sessionStorage.setItem(cookieName, JSON.stringify(false))
98
+ },
99
+ },
100
+ }).then(response => {
101
+ // console.log('test done')
102
+ // console.log('result: ' + JSON.parse(window.sessionStorage.getItem(cookieName)));
103
+ // return JSON.parse(window.sessionStorage.getItem(cookieName));
104
+ })
105
+ }
106
+
107
+ wpm.isWpmRestEndpointAvailable = function (cookieName = wpmRestSettings.cookieWpmRestEndpointAvailable) {
108
+
109
+ return !!wpm.getCookie(cookieName)
110
+ }
111
+
112
+ wpm.writeOrderIdToStorage = function (orderId, expireDays = 365) {
113
+
114
+ // save the order ID in the browser storage
115
+
116
+ if (!window.Storage) {
117
+ let expiresDate = new Date()
118
+ expiresDate.setDate(expiresDate.getDate() + wpmDeduper.cookieExpiresDays)
119
+
120
+ let ids = []
121
+ if (checkCookie()) {
122
+ ids = JSON.parse(wpm.getCookie(wpmDeduper.keyName))
123
+ }
124
+
125
+ if (!ids.includes(orderId)) {
126
+ ids.push(orderId)
127
+ document.cookie = wpmDeduper.keyName + "=" + JSON.stringify(ids) + ";expires=" + expiresDate.toUTCString()
128
+ }
129
+
130
+ } else {
131
+ if (localStorage.getItem(wpmDeduper.keyName) === null) {
132
+ let ids = []
133
+ ids.push(orderId)
134
+ window.localStorage.setItem(wpmDeduper.keyName, JSON.stringify(ids))
135
+
136
+ } else {
137
+ let ids = JSON.parse(localStorage.getItem(wpmDeduper.keyName))
138
+ if (!ids.includes(orderId)) {
139
+ ids.push(orderId)
140
+ window.localStorage.setItem(wpmDeduper.keyName, JSON.stringify(ids))
141
+ }
142
+ }
143
+ }
144
+
145
+ if (typeof wpm.storeOrderIdOnServer === "function" && wpmDataLayer.orderDeduplication) {
146
+ wpm.storeOrderIdOnServer(orderId)
147
+ }
148
+ }
149
+
150
+ function checkCookie() {
151
+ let key = wpm.getCookie(wpmDeduper.keyName)
152
+ return key !== ""
153
+ }
154
+
155
+ wpm.isOrderIdStored = function (orderId) {
156
+
157
+ // console.log('deduper: ' + wpmDataLayer.orderDeduplication);
158
+ if (wpmDataLayer.orderDeduplication) {
159
+ // console.log('order deduplication: on');
160
+ if (!window.Storage) {
161
+
162
+ if (checkCookie()) {
163
+ let ids = JSON.parse(wpm.getCookie(wpmDeduper.keyName))
164
+ return ids.includes(orderId)
165
+ } else {
166
+ return false
167
+ }
168
+ } else {
169
+ if (localStorage.getItem(wpmDeduper.keyName) !== null) {
170
+ let ids = JSON.parse(localStorage.getItem(wpmDeduper.keyName))
171
+ return ids.includes(orderId)
172
+ } else {
173
+ return false
174
+ }
175
+ }
176
+ } else {
177
+ console.log("order duplication prevention: off")
178
+ return false
179
+ }
180
+ }
181
+
182
+ wpm.isEmail = function (email) {
183
+ // https://emailregex.com/
184
+ let regex = /^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/
185
+ return regex.test(email)
186
+ }
187
+
188
+ wpm.removeProductFromCart = function (productId, quantityToRemove = null) {
189
+ // console.log('product_id: ' + productId + ' | quantityToRemove: ' + quantityToRemove);
190
+
191
+ try {
192
+
193
+ if (!productId) throw Error("Wasn't able to retrieve a productId")
194
+
195
+ productId = getIdBasedOndVariationsOutputSetting(productId)
196
+
197
+ if (!productId) throw Error("Wasn't able to retrieve a productId")
198
+
199
+ let quantity
200
+
201
+ if (quantityToRemove == null) {
202
+ quantity = wpmDataLayer.cart[productId].quantity
203
+ } else {
204
+ quantity = quantityToRemove
205
+ }
206
+
207
+ // console.log('product_id: ' + productId + ' | qty: ' + quantity);
208
+ // console.log(productId);
209
+ // console.log(wpmDataLayer.cart);
210
+ // console.log(wpmDataLayer.cart[productId]);
211
+
212
+ if (wpmDataLayer.cart[productId]) {
213
+
214
+ // let product = {
215
+ // id : productId.toString(),
216
+ // dyn_r_ids: wpmDataLayer.cart[productId].dyn_r_ids,
217
+ // name : wpmDataLayer.cart[productId].name,
218
+ // // list_name: wpmDataLayer.shop.list_name, // doesn't make sense on mini_cart
219
+ // brand : wpmDataLayer.cart[productId].brand,
220
+ // category: wpmDataLayer.cart[productId].category,
221
+ // variant : wpmDataLayer.cart[productId].variant,
222
+ // // list_position: wpmDataLayer.cart[productId].position, // doesn't make sense on mini_cart
223
+ // quantity : quantity,
224
+ // price : wpmDataLayer.cart[productId].price,
225
+ // isVariation: wpmDataLayer.products[productId].isVariation,
226
+ // };
227
+ //
228
+ // if (product.isVariation) product['parentId_dyn_r_ids'] = wpmDataLayer.products[productId].parentId_dyn_r_ids;
229
+
230
+ let product = wpm.getProductDetailsFormattedForEvent(productId, quantity)
231
+
232
+ // console.log('removing');
233
+ // console.log(data);
234
+
235
+ jQuery(document).trigger("wpmRemoveFromCart", product)
236
+
237
+ if (quantityToRemove == null || wpmDataLayer.cart[productId].quantity === quantityToRemove) {
238
+ delete wpmDataLayer.cart[productId]
239
+ if (sessionStorage) sessionStorage.setItem("wpmDataLayerCart", JSON.stringify(wpmDataLayer.cart))
240
+ } else {
241
+ wpmDataLayer.cart[productId].quantity = wpmDataLayer.cart[productId].quantity - quantity
242
+ if (sessionStorage) sessionStorage.setItem("wpmDataLayerCart", JSON.stringify(wpmDataLayer.cart))
243
+ }
244
+ }
245
+ } catch (e) {
246
+ console.error(e)
247
+ // console.log('getting cart from back end');
248
+ // wpm.getCartItemsFromBackend();
249
+ // console.log('getting cart from back end done');
250
+
251
+ }
252
+ }
253
+
254
+ getIdBasedOndVariationsOutputSetting = function (productId) {
255
+
256
+ try {
257
+ if (wpmDataLayer?.general?.variationsOutput) {
258
+ // console.log('test');
259
+ return productId
260
+ } else {
261
+ if (wpmDataLayer.products[productId].isVariation) {
262
+ return wpmDataLayer.products[productId].parentId
263
+ } else {
264
+ return productId
265
+ }
266
+ }
267
+ } catch (e) {
268
+ console.error(e)
269
+ }
270
+ }
271
+
272
+ // add_to_cart
273
+ wpm.addProductToCart = function (productId, quantity) {
274
+
275
+ try {
276
+ // console.log('productId: ' + productId + ' | qty: ' + quantity);
277
+ // console.log('productId: ' + productId + ' | variationId: ' + variationId + ' | qty: ' + quantity);
278
+
279
+ if (!productId) throw Error("Wasn't able to retrieve a productId")
280
+
281
+ productId = getIdBasedOndVariationsOutputSetting(productId)
282
+
283
+ if (!productId) throw Error("Wasn't able to retrieve a productId")
284
+
285
+ if (wpmDataLayer?.products[productId]) {
286
+
287
+ let product = wpm.getProductDetailsFormattedForEvent(productId, quantity)
288
+
289
+ // console.log(productId)
290
+ // console.log(wpmDataLayer.cart)
291
+
292
+ jQuery(document).trigger("wpmAddToCart", product)
293
+
294
+ // add product to cart wpmDataLayer['cart']
295
+
296
+ // if the product already exists in the object, only add the additional quantity
297
+ // otherwise create that product object in the wpmDataLayer['cart']
298
+ if (wpmDataLayer?.cart[productId]) {
299
+ wpmDataLayer.cart[productId].quantity = wpmDataLayer.cart[productId].quantity + quantity
300
+ } else {
301
+
302
+ if (!("cart" in wpmDataLayer)) wpmDataLayer.cart = {}
303
+ wpmDataLayer.cart[productId] = wpm.getProductDetailsFormattedForEvent(productId, quantity)
304
+ }
305
+
306
+ if (sessionStorage) sessionStorage.setItem("wpmDataLayerCart", JSON.stringify(wpmDataLayer.cart))
307
+ }
308
+ } catch (e) {
309
+ console.error(e)
310
+
311
+ // fallback if wpmDataLayer.cart and wpmDataLayer.products got out of sync in case cart caching has an issue
312
+ wpm.getCartItemsFromBackend()
313
+ }
314
+ }
315
+
316
+ wpm.getCartItems = function () {
317
+
318
+ // console.log('get cart items');
319
+
320
+ if (sessionStorage) {
321
+ if (!sessionStorage.getItem("wpmDataLayerCart") || wpmDataLayer.shop.page_type === "order_received_page") {
322
+ sessionStorage.setItem("wpmDataLayerCart", JSON.stringify({}))
323
+ } else {
324
+ wpm.saveCartObjectToDataLayer(JSON.parse(sessionStorage.getItem("wpmDataLayerCart")))
325
+ }
326
+ } else {
327
+ wpm.getCartItemsFromBackend()
328
+ }
329
+ }
330
+
331
+ // get all cart items from the backend
332
+ wpm.getCartItemsFromBackend = function () {
333
+ try {
334
+ let data = {
335
+ action: "wpm_get_cart_items",
336
+ }
337
+
338
+ jQuery.ajax(
339
+ {
340
+ type : "get",
341
+ dataType: "json",
342
+ // url : ajax_object.ajax_url,
343
+ url : wpm.ajax_url,
344
+ data : data,
345
+ success: function (cartItems) {
346
+
347
+ // save all cart items into wpmDataLayer
348
+
349
+ if (!cartItems["cart"]) cartItems["cart"] = {}
350
+
351
+ wpm.saveCartObjectToDataLayer(cartItems["cart"])
352
+ if (sessionStorage) sessionStorage.setItem("wpmDataLayerCart", JSON.stringify(cartItems["cart"]))
353
+ },
354
+ })
355
+ } catch (e) {
356
+ console.error(e)
357
+ }
358
+ }
359
+
360
+ wpm.getProductsFromBackend = function (productIds) {
361
+ // console.log('getting pids from back-end: ' + productIds)
362
+ // get productIds from the backend
363
+
364
+ // reduce productIds by products already in the dataLayer
365
+ productIds = productIds.filter(item => !wpmDataLayer.products.hasOwnProperty(item))
366
+
367
+ // if no products IDs are in the object, don't try to get anything from the server
368
+ if (!productIds || productIds.length === 0) return
369
+
370
+ try {
371
+ let data = {
372
+ action : "wpm_get_product_ids",
373
+ productIds: productIds,
374
+ }
375
+
376
+ jQuery.ajax(
377
+ {
378
+ type : "get",
379
+ dataType: "json",
380
+ // url : ajax_object.ajax_url,
381
+ url : wpm.ajax_url,
382
+ data : data,
383
+ success: function (products) {
384
+
385
+ // merge products into wpmDataLayer.products
386
+ wpmDataLayer.products = Object.assign({}, wpmDataLayer.products, products)
387
+ },
388
+ error : function (response) {
389
+ console.log(response)
390
+ },
391
+ })
392
+ } catch (e) {
393
+ console.error(e)
394
+ }
395
+ }
396
+
397
+ wpm.saveCartObjectToDataLayer = function (cartObject) {
398
+ wpmDataLayer.cart = cartObject
399
+ wpmDataLayer.products = Object.assign({}, wpmDataLayer.products, cartObject)
400
+ }
401
+
402
+ wpm.fireCheckoutOption = function (step, checkout_option = null, value = null) {
403
+
404
+ let data = {
405
+ step : step,
406
+ checkout_option: checkout_option,
407
+ value : value,
408
+ }
409
+
410
+ jQuery(document).trigger("wpmFireCheckoutOption", data)
411
+ }
412
+
413
+ wpm.fireCheckoutProgress = function (step) {
414
+
415
+ let data = {
416
+ step: step,
417
+ }
418
+
419
+ jQuery(document).trigger("wpmFireCheckoutProgress", data)
420
+ }
421
+
422
+ wpm.getPostIdFromString = function (string) {
423
+ // console.log(string);
424
+ try {
425
+ return string.match(/(post-)(\d+)/)[2]
426
+ } catch (e) {
427
+ console.error(e)
428
+ }
429
+ }
430
+
431
+ wpm.triggerViewItemList = function (productId) {
432
+
433
+ // productId = null;
434
+
435
+ if (!productId) throw Error("Wasn't able to retrieve a productId")
436
+
437
+ productId = getIdBasedOndVariationsOutputSetting(productId)
438
+
439
+ if (!productId) throw Error("Wasn't able to retrieve a productId")
440
+
441
+ jQuery(document).trigger("wpmViewItemList", wpm.getProductDataForViewItemEvent(productId))
442
+ }
443
+
444
+ wpm.getProductDataForViewItemEvent = function (productId) {
445
+
446
+ if (!productId) throw Error("Wasn't able to retrieve a productId")
447
+
448
+ try {
449
+ if (wpmDataLayer.products[productId]) {
450
+
451
+ return wpm.getProductDetailsFormattedForEvent(productId)
452
+ }
453
+ } catch (e) {
454
+ console.error(e)
455
+ }
456
+ }
457
+ wpm.getMainProductIdFromProductPage = function () {
458
+ try {
459
+ if (["simple", "variable", "grouped", "composite", "bundle"].indexOf(wpmDataLayer.shop.product_type) >= 0) {
460
+ return jQuery(".wpmProductId:first").data("id")
461
+ } else {
462
+ return false
463
+ }
464
+ } catch (e) {
465
+ console.error(e)
466
+ }
467
+ }
468
+
469
+ wpm.viewItemListTriggerTestMode = function (target) {
470
+
471
+ jQuery(target).css({"position": "relative"})
472
+ jQuery(target).append("<div id=\"viewItemListTriggerOverlay\"></div>")
473
+ jQuery(target).find("#viewItemListTriggerOverlay").css({
474
+ "z-index" : "10",
475
+ "display" : "block",
476
+ "position" : "absolute",
477
+ "height" : "100%",
478
+ "top" : "0",
479
+ "left" : "0",
480
+ "right" : "0",
481
+ "opacity" : wpmDataLayer.viewItemListTrigger.opacity,
482
+ "background-color": wpmDataLayer.viewItemListTrigger.backgroundColor,
483
+ })
484
+ }
485
+
486
+ wpm.getSearchTermFromUrl = function () {
487
+ try {
488
+ let urlParameters = new URLSearchParams(window.location.search)
489
+ return urlParameters.get("s")
490
+ } catch (e) {
491
+ console.error(e)
492
+ }
493
+ }
494
+
495
+ // we need this to track timeouts for intersection observers
496
+ let ioTimeouts = {}
497
+
498
+ wpm.observerCallback = function (entries, observer) {
499
+
500
+ entries.forEach((entry) => {
501
+
502
+ try {
503
+ let productId
504
+
505
+ let elementId = jQuery(entry.target).data("ioid")
506
+
507
+ // Get the productId from next element, if wpmProductId is a sibling, like in Gutenberg blocks
508
+ // otherwise go search in children, like in regular WC loop items
509
+ if (jQuery(entry.target).next(".wpmProductId").length) {
510
+ // console.log('test 1');
511
+ productId = jQuery(entry.target).next(".wpmProductId").data("id")
512
+ } else {
513
+ productId = jQuery(entry.target).find(".wpmProductId").data("id")
514
+ }
515
+
516
+ // productId = null;
517
+
518
+ if (!productId) throw Error("wpmProductId element not found")
519
+
520
+ if (entry.isIntersecting) {
521
+
522
+ // console.log('prodid: ' + productId);
523
+ ioTimeouts[elementId] = setTimeout(() => {
524
+ // console.log('prodid: ' + productId);
525
+ wpm.triggerViewItemList(productId)
526
+ if (wpmDataLayer.viewItemListTrigger.testMode) wpm.viewItemListTriggerTestMode(entry.target)
527
+ if (wpmDataLayer.viewItemListTrigger.repeat === false) observer.unobserve(entry.target)
528
+ }, wpmDataLayer.viewItemListTrigger.timeout)
529
+
530
+ } else {
531
+
532
+ clearTimeout(ioTimeouts[elementId])
533
+ if (wpmDataLayer.viewItemListTrigger.testMode) jQuery(entry.target).find("#viewItemListTriggerOverlay").remove()
534
+ }
535
+ } catch (e) {
536
+ console.error(e)
537
+ }
538
+ })
539
+ }
540
+
541
+ // fire view_item_list only on products that have become visible
542
+ let io
543
+ let ioid = 0
544
+ let allIoElementsToWatch
545
+
546
+ let getAllElementsToWatch = function () {
547
+
548
+ allIoElementsToWatch = jQuery(".wpmProductId")
549
+ .map(function (i, elem) {
550
+ // console.log(elem);
551
+ if (
552
+ jQuery(elem).parent().hasClass("type-product") ||
553
+ jQuery(elem).parent().hasClass("product") ||
554
+ jQuery(elem).parent().hasClass("product-item-inner")
555
+ ) {
556
+ // console.log(elem);
557
+ return jQuery(elem).parent()
558
+ } else if (
559
+ jQuery(elem).prev().hasClass("wc-block-grid__product") ||
560
+ jQuery(elem).prev().hasClass("product") ||
561
+ jQuery(elem).prev().hasClass("product-small") ||
562
+ jQuery(elem).prev().hasClass("woocommerce-LoopProduct-link")
563
+ ) {
564
+ return jQuery(this).prev()
565
+ } else if (jQuery(elem).closest(".product").length) {
566
+ return jQuery(elem).closest(".product")
567
+ }
568
+ })
569
+ }
570
+
571
+ wpm.startIntersectionObserverToWatch = function () {
572
+
573
+ try {
574
+ // enable view_item_list test mode from browser
575
+ if (wpm.urlHasParameter("vildemomode")) wpmDataLayer.viewItemListTrigger.testMode = true
576
+
577
+ // set up intersection observer
578
+ io = new IntersectionObserver(wpm.observerCallback, {
579
+ threshold: wpmDataLayer.viewItemListTrigger.threshold,
580
+ })
581
+
582
+ getAllElementsToWatch()
583
+
584
+ // console.log(allElementsToWatch);
585
+
586
+ allIoElementsToWatch.each(function (i, elem) {
587
+ // console.log(elem[0]);
588
+ // jQuery(elem[0]).attr('data-ioid', ioid++);
589
+ jQuery(elem[0]).data("ioid", ioid++)
590
+
591
+ io.observe(elem[0])
592
+ })
593
+ } catch (e) {
594
+ console.error(e)
595
+ }
596
+ }
597
+
598
+ // watch DOM for new lazy loaded products and add them to the intersection observer
599
+ wpm.startProductsMutationObserverToWatch = function () {
600
+
601
+ try {
602
+ // Pass in the target node, as well as the observer options
603
+
604
+ // selects the most common parent node
605
+ // https://stackoverflow.com/a/7648323/4688612
606
+ let productsNode = jQuery(".wpmProductId:eq(0)").parents().has(jQuery(".wpmProductId:eq(1)").parents()).first()
607
+
608
+ if (productsNode.length) {
609
+ productsMutationObserver.observe(productsNode[0], {
610
+ attributes : true,
611
+ childList : true,
612
+ characterData: true,
613
+ })
614
+ }
615
+ } catch (e) {
616
+ console.error(e)
617
+ }
618
+ }
619
+
620
+ // Create an observer instance
621
+ let productsMutationObserver = new MutationObserver(function (mutations) {
622
+
623
+ mutations.forEach(function (mutation) {
624
+ let newNodes = mutation.addedNodes // DOM NodeList
625
+ if (newNodes !== null) { // If there are new nodes added
626
+ let nodes = jQuery(newNodes) // jQuery set
627
+ nodes.each(function () {
628
+ if (
629
+ jQuery(this).hasClass("type-product") ||
630
+ jQuery(this).hasClass("product-small") ||
631
+ jQuery(this).hasClass("wc-block-grid__product")
632
+ ) {
633
+ // check if the node has a child or sibling wpmProductId
634
+ // if yes add it to the intersectionObserver
635
+ if (hasWpmProductIdElement(this)) {
636
+ jQuery(this).data("ioid", ioid++)
637
+ io.observe(this)
638
+ }
639
+ }
640
+ })
641
+ }
642
+ })
643
+ })
644
+
645
+ let hasWpmProductIdElement = function (elem) {
646
+ return !!(jQuery(elem).find(".wpmProductId").length ||
647
+ jQuery(elem).siblings(".wpmProductId").length)
648
+ }
649
+
650
+ wpm.setCookie = function (cookieName, cookieValue = "", expiryDays = null) {
651
+ if (expiryDays) {
652
+ let d = new Date()
653
+ d.setTime(d.getTime() + (expiryDays * 24 * 60 * 60 * 1000))
654
+ let expires = "expires=" + d.toUTCString()
655
+ document.cookie = cookieName + "=" + cookieValue + ";" + expires + ";path=/"
656
+ } else {
657
+ document.cookie = cookieName + "=" + cookieValue + ";path=/"
658
+ }
659
+ }
660
+
661
+ wpm.getCookie = function (cookieName) {
662
+ let name = cookieName + "="
663
+ let decodedCookie = decodeURIComponent(document.cookie)
664
+ let ca = decodedCookie.split(";")
665
+ for (let i = 0; i < ca.length; i++) {
666
+ let c = ca[i]
667
+ while (c.charAt(0) == " ") {
668
+ c = c.substring(1)
669
+ }
670
+ if (c.indexOf(name) == 0) {
671
+ return c.substring(name.length, c.length)
672
+ }
673
+ }
674
+ return ""
675
+ }
676
+
677
+ wpm.getWpmSessionData = function () {
678
+ if (window.sessionStorage) {
679
+
680
+ let data = window.sessionStorage.getItem("_wpm")
681
+ if (data !== null) {
682
+ return JSON.parse(data)
683
+ } else {
684
+ return {}
685
+ }
686
+ } else {
687
+ return {}
688
+ }
689
+ }
690
+
691
+ wpm.setWpmSessionData = function (data) {
692
+ if (window.sessionStorage) {
693
+ window.sessionStorage.setItem("_wpm", JSON.stringify(data))
694
+ }
695
+ }
696
+
697
+ wpm.storeOrderIdOnServer = function (orderId) {
698
+
699
+ // console.log('saving wpm_purchase_pixels_fired');
700
+
701
+ // console.log('url: ' + wpm_premium_only_ajax_object.ajax_url);
702
+ // console.log('nonce: ' + wpm_premium_only_ajax_object.nonce);
703
+ // console.log('url: ' + wpm.ajax_url);
704
+ // console.log('nonce: ' + wpm.nonce);
705
+
706
+ try {
707
+ // save the state in the database
708
+ let data = {
709
+ action : "wpm_purchase_pixels_fired",
710
+ order_id: orderId,
711
+ // nonce : ajax_object.nonce,
712
+ nonce: wpm.nonce,
713
+ }
714
+
715
+ jQuery.ajax(
716
+ {
717
+ type : "post",
718
+ dataType: "json",
719
+ // url : ajax_object.ajax_url,
720
+ url : wpm.ajax_url,
721
+ data : data,
722
+ success: function (response) {
723
+ if (response.success === false) {
724
+ console.log(response)
725
+ }
726
+ },
727
+ error : function (response) {
728
+ console.log(response)
729
+ },
730
+ })
731
+ } catch (e) {
732
+ console.error(e)
733
+ }
734
+ }
735
+
736
+ wpm.getProductIdByCartItemKeyUrl = function (url) {
737
+ let searchParams = new URLSearchParams(url.search)
738
+ let cartItemKey = searchParams.get("remove_item")
739
+
740
+ let productId
741
+
742
+ if (wpmDataLayer.cartItemKeys[cartItemKey]["variation_id"] === 0) {
743
+ productId = wpmDataLayer.cartItemKeys[cartItemKey]["product_id"]
744
+ } else {
745
+ productId = wpmDataLayer.cartItemKeys[cartItemKey]["variation_id"]
746
+ }
747
+
748
+ return productId
749
+ }
750
+
751
+ wpm.getAddToCartLinkProductIds = function () {
752
+ return jQuery("a").map(function () {
753
+ let href = jQuery(this).attr("href")
754
+
755
+ if (href && href.includes("?add-to-cart=")) {
756
+ let matches = href.match(/(add-to-cart=)(\d+)/)
757
+ if (matches) return matches[2]
758
+ }
759
+ }).get()
760
+ }
761
+
762
+ wpm.getProductDetailsFormattedForEvent = function (productId, quantity = 1) {
763
+
764
+ // console.log(wpmDataLayer.products[productId].dyn_r_ids)
765
+
766
+ let product = {
767
+ id : productId.toString(),
768
+ dyn_r_ids : wpmDataLayer.products[productId].dyn_r_ids,
769
+ name : wpmDataLayer.products[productId].name,
770
+ list_name : wpmDataLayer.shop.list_name,
771
+ brand : wpmDataLayer.products[productId].brand,
772
+ category : wpmDataLayer.products[productId].category,
773
+ variant : wpmDataLayer.products[productId].variant,
774
+ list_position: wpmDataLayer.products[productId].position,
775
+ quantity : quantity,
776
+ price : wpmDataLayer.products[productId].price,
777
+ currency : wpmDataLayer.shop.currency,
778
+ isVariable : wpmDataLayer.products[productId].isVariable,
779
+ isVariation : wpmDataLayer.products[productId].isVariation,
780
+ parentId : wpmDataLayer.products[productId].parentId,
781
+ }
782
+
783
+ if (product.isVariation) product["parentId_dyn_r_ids"] = wpmDataLayer.products[productId].parentId_dyn_r_ids
784
+
785
+ return product
786
+ }
787
+
788
+ wpm.setReferrerToCookie = function () {
789
+ // can't use session storage as we can't read it from the server
790
+ if (!wpm.getCookie("wpmReferrer")) {
791
+ wpm.setCookie("wpmReferrer", document.referrer)
792
+ }
793
+ }
794
+
795
+ wpm.getReferrerFromCookie = function () {
796
+ if (wpm.getCookie("wpmReferrer")) {
797
+ return wpm.getCookie("wpmReferrer")
798
+ } else {
799
+ return null
800
+ }
801
+ }
802
+
803
+ wpm.getClidFromBrowser = function (clidId = "gclid") {
804
+
805
+ let clidCookieId
806
+
807
+ clidCookieId = {
808
+ gclid: "_gcl_aw",
809
+ dclid: "_gcl_dc",
810
+ }
811
+
812
+ if (wpm.getCookie(clidCookieId[clidId])) {
813
+ let clidCookie = wpm.getCookie(clidCookieId[clidId])
814
+ let matches = clidCookie.match(/(GCL.[\d]*.)(.*)/)
815
+ return matches[2]
816
+ } else {
817
+ return ""
818
+ }
819
+ }
820
+
821
+ wpm.getUserAgent = function () {
822
+ return navigator.userAgent
823
+ }
824
+
825
+ wpm.getViewPort = function () {
826
+ return {
827
+ width : Math.max(document.documentElement.clientWidth || 0, window.innerWidth || 0),
828
+ height: Math.max(document.documentElement.clientHeight || 0, window.innerHeight || 0),
829
+ }
830
+ }
831
+
832
+ /*
833
+ * Handle Cookie Management Platforms
834
+ * */
835
+
836
+ let getComplianzCookies = function () {
837
+
838
+ let cmplz_statistics = wpm.getCookie("cmplz_statistics")
839
+ let cmplz_marketing = wpm.getCookie("cmplz_marketing")
840
+ let cmplz_consent_status = wpm.getCookie("cmplz_consent_status") || wpm.getCookie("cmplz_banner-status")
841
+
842
+
843
+ if (cmplz_consent_status) {
844
+ return {
845
+ analytics : cmplz_statistics === "allow",
846
+ ads : cmplz_marketing === "allow",
847
+ visitorHasChosen: true,
848
+ }
849
+ } else {
850
+ return false
851
+ }
852
+ }
853
+
854
+ let getCookieLawInfoCookies = function () {
855
+
856
+ let analyticsCookie = wpm.getCookie("cookielawinfo-checkbox-analytics") || wpm.getCookie("cookielawinfo-checkbox-analytiques")
857
+ let adsCookie = wpm.getCookie("cookielawinfo-checkbox-advertisement") || wpm.getCookie("cookielawinfo-checkbox-publicite")
858
+ let visitorHasChosen = wpm.getCookie("CookieLawInfoConsent")
859
+
860
+ if (analyticsCookie || adsCookie) {
861
+
862
+ return {
863
+ analytics : analyticsCookie === "yes",
864
+ ads : adsCookie === "yes",
865
+ visitorHasChosen: !!visitorHasChosen,
866
+ }
867
+ } else {
868
+ return false
869
+ }
870
+ }
871
+
872
+
873
+ let
874
+ wpmConsentValues = {}
875
+ wpmConsentValues.categories = {}
876
+ wpmConsentValues.pixels = []
877
+ wpmConsentValues.mode = "category"
878
+ wpmConsentValues.visitorHasChosen = false
879
+
880
+ wpm.getConsentValues = function () {
881
+ return wpmConsentValues
882
+ }
883
+
884
+ wpm.setConsentValueCategories = function (analytics = false, ads = false) {
885
+ wpmConsentValues.categories.analytics = analytics
886
+ wpmConsentValues.categories.ads = ads
887
+ }
888
+
889
+ wpm.updateConsentCookieValues = function (explicitConsent = false) {
890
+
891
+ // ad_storage
892
+ // analytics_storage
893
+ // functionality_storage
894
+ // personalization_storage
895
+ // security_storage
896
+
897
+ // console.log('exp cons: ' + explicitConsent)
898
+
899
+ let cookie
900
+
901
+ if (cookie = wpm.getCookie("CookieConsent")) {
902
+ // Cookiebot
903
+ // https://wordpress.org/plugins/cookiebot/
904
+ cookie = decodeURI(cookie)
905
+
906
+ // console.log(cookie.indexOf('statistics:true'))
907
+ // console.log(cookie.indexOf('marketing:true'))
908
+
909
+ wpmConsentValues.categories.analytics = cookie.indexOf("statistics:true") >= 0
910
+ wpmConsentValues.categories.ads = cookie.indexOf("marketing:true") >= 0
911
+ wpmConsentValues.visitorHasChosen = true
912
+
913
+ } else if (cookie = wpm.getCookie("CookieScriptConsent")) {
914
+ // Cookie Script
915
+ // https://wordpress.org/plugins/cookie-script-com/
916
+
917
+ cookie = JSON.parse(cookie)
918
+
919
+ // console.log(cookie)
920
+ // console.log(cookie.action)
921
+ // console.log('cat length: ' + cookie.categories.length)
922
+ // console.log(cookie.categories.indexOf('performance'))
923
+
924
+ if (cookie.action === "reject") {
925
+ wpmConsentValues.categories.analytics = false
926
+ wpmConsentValues.categories.ads = false
927
+ } else if (cookie.categories.length === 2) {
928
+ wpmConsentValues.categories.analytics = true
929
+ wpmConsentValues.categories.ads = true
930
+ } else {
931
+ wpmConsentValues.categories.analytics = cookie.categories.indexOf("performance") >= 0
932
+ wpmConsentValues.categories.ads = cookie.categories.indexOf("targeting") >= 0
933
+ }
934
+
935
+ wpmConsentValues.visitorHasChosen = true
936
+
937
+ // console.log(wpmConsentValues)
938
+
939
+ } else if (cookie = wpm.getCookie("borlabs-cookie")) {
940
+ // Borlabs Cookie
941
+ // https://borlabs.io/borlabs-cookie/
942
+
943
+ cookie = decodeURI(cookie)
944
+ cookie = JSON.parse(cookie)
945
+
946
+ wpmConsentValues.categories.analytics = !!cookie?.consents?.statistics
947
+ wpmConsentValues.categories.ads = !!cookie?.consents?.marketing
948
+ wpmConsentValues.visitorHasChosen = true
949
+ wpmConsentValues.pixels = [...cookie?.consents?.statistics || [], ...cookie?.consents?.marketing || []]
950
+ wpmConsentValues.mode = "pixel"
951
+
952
+ } else if (cookie = getComplianzCookies()) {
953
+ // Complianz Cookie
954
+ // https://wordpress.org/plugins/complianz-gdpr/
955
+
956
+ // console.log(cookie)
957
+
958
+ wpmConsentValues.categories.analytics = cookie.analytics === true
959
+ wpmConsentValues.categories.ads = cookie.ads === true
960
+ wpmConsentValues.visitorHasChosen = cookie.visitorHasChosen
961
+
962
+ // console.log(wpmConsentValues)
963
+
964
+ } else if (cookie = wpm.getCookie("cookie_notice_accepted")) {
965
+ // Cookie Compliance (free version)
966
+ // https://wordpress.org/plugins/cookie-notice/
967
+
968
+ wpmConsentValues.categories.analytics = true
969
+ wpmConsentValues.categories.ads = true
970
+ wpmConsentValues.visitorHasChosen = true
971
+
972
+ } else if (cookie = wpm.getCookie("hu-consent")) {
973
+ // Cookie Compliance (pro version)
974
+ // https://wordpress.org/plugins/cookie-notice/
975
+
976
+ cookie = JSON.parse(cookie)
977
+
978
+ wpmConsentValues.categories.analytics = !!cookie.categories["3"]
979
+ wpmConsentValues.categories.ads = !!cookie.categories["4"]
980
+ wpmConsentValues.visitorHasChosen = true
981
+
982
+ } else if (cookie = getCookieLawInfoCookies()) {
983
+ // CookieYes, GDPR Cookie Consent (Cookie Law Info)
984
+ // https://wordpress.org/plugins/cookie-law-info/
985
+
986
+ wpmConsentValues.categories.analytics = cookie.analytics === true
987
+ wpmConsentValues.categories.ads = cookie.ads === true
988
+ wpmConsentValues.visitorHasChosen = cookie.visitorHasChosen === true
989
+
990
+ } else if (cookie = wpm.getCookie("moove_gdpr_popup")) {
991
+ // GDPR Cookie Compliance Plugin by Moove Agency
992
+ // https://wordpress.org/plugins/gdpr-cookie-compliance/
993
+ // TODO write documentation on how to set up the plugin in order for this to work properly
994
+
995
+ cookie = JSON.parse(cookie)
996
+ // console.log('moove cookie thirdparty: ' + cookie.thirdparty)
997
+ // console.log('moove cookie advanced: ' + cookie.advanced)
998
+
999
+ wpmConsentValues.categories.analytics = cookie.thirdparty === "1"
1000
+ wpmConsentValues.categories.ads = cookie.advanced === "1"
1001
+ wpmConsentValues.visitorHasChosen = true
1002
+
1003
+ // console.log(wpmConsentValues)
1004
+
1005
+ } else {
1006
+ // consentValues.categories.analytics = true
1007
+ // consentValues.categories.ads = true
1008
+
1009
+ wpmConsentValues.categories.analytics = !explicitConsent
1010
+ wpmConsentValues.categories.ads = !explicitConsent
1011
+ }
1012
+ }
1013
+
1014
+ wpm.updateConsentCookieValues()
1015
+
1016
+ wpm.setConsentDefaultValuesToExplicit = function () {
1017
+ wpmConsentValues.categories = {
1018
+ analytics: false,
1019
+ ads : false,
1020
+ }
1021
+ }
1022
+
1023
+ wpm.canIFire = function (category, pixelName) {
1024
+
1025
+ let canIFireMode
1026
+
1027
+ if ("category" === wpmConsentValues.mode) {
1028
+ canIFireMode = !!wpmConsentValues.categories[category]
1029
+ } else if ("pixel" === wpmConsentValues.mode) {
1030
+ canIFireMode = wpmConsentValues.pixels.includes(pixelName)
1031
+ } else {
1032
+ console.error("Couldn't find a valid consent mode in wpmConsentValues")
1033
+ canIFireMode = false
1034
+ }
1035
+
1036
+ if (canIFireMode) {
1037
+ return true
1038
+ } else {
1039
+ if (true || wpm.urlHasParameter("debugConsentMode")) {
1040
+ wpm.logPreventedPixelLoading(pixelName, category)
1041
+ }
1042
+
1043
+ return false
1044
+ }
1045
+ }
1046
+
1047
+ wpm.logPreventedPixelLoading = function (pixelName, category) {
1048
+ if (wpmDataLayer?.shop?.cookie_consent_mgmt?.explicit_consent) {
1049
+ console.log("WooCommerce Pixel Manager: The \"" + pixelName + " (category: " + category + ")\" pixel has not fired because you have not given consent for it yet. (WPM is in explicit consent mode.)")
1050
+ } else {
1051
+ console.log("WooCommerce Pixel Manager: The \"" + pixelName + " (category: " + category + ")\" pixel has not fired because you have removed consent for this pixel. (WPM is in implicit consent mode.)")
1052
+ }
1053
+ }
1054
+
1055
+ /**
1056
+ * Runs through each script in <head> and blocks / unblocks it according to the plugin settings
1057
+ * and user consent.
1058
+ */
1059
+
1060
+ // https://stackoverflow.com/q/65453565/4688612
1061
+ wpm.scriptTagObserver = new MutationObserver((mutations) => {
1062
+ mutations.forEach(({addedNodes}) => {
1063
+ [...addedNodes]
1064
+ .forEach(node => {
1065
+
1066
+ if ($(node).data("wpm-cookie-category")) {
1067
+
1068
+ // console.log(node)
1069
+
1070
+ // If the pixel category has been approved > unblock
1071
+ // If the pixel belongs to more than one category, then unblock if one of the categories has been approved
1072
+ // If no category has been approved, but the Google Consent Mode is active, then only unblock the Google scripts
1073
+
1074
+ if (wpm.shouldScriptBeActive(node)) {
1075
+ wpm.unblockScript(node)
1076
+ } else {
1077
+ wpm.blockScript(node)
1078
+ }
1079
+ }
1080
+ })
1081
+ })
1082
+ })
1083
+
1084
+ wpm.scriptTagObserver.observe(document.head, {childList: true, subtree: true})
1085
+ window.addEventListener("DOMContentLoaded", () => wpm.scriptTagObserver.disconnect())
1086
+
1087
+ wpm.shouldScriptBeActive = function (node) {
1088
+
1089
+ if (
1090
+ wpmDataLayer.shop.cookie_consent_mgmt.explicit_consent ||
1091
+ wpmConsentValues.visitorHasChosen
1092
+ ) {
1093
+
1094
+ if (wpmConsentValues.mode === "category" && $(node).data("wpm-cookie-category").split(",").some(element => wpmConsentValues.categories[element])) {
1095
+ return true
1096
+ } else if (wpmConsentValues.mode === "pixel" && wpmConsentValues.pixels.includes($(node).data("wpm-pixel-name"))) {
1097
+ return true
1098
+ } else if (wpmConsentValues.mode === "pixel" && $(node).data("wpm-pixel-name") === "google" && ["google-analytics", "google-ads"].some(element => wpmConsentValues.pixels.includes(element))) {
1099
+ return true
1100
+ } else if (wpmDataLayer?.pixels?.google?.consent_mode?.active && $(node).data("wpm-pixel-name") === "google") {
1101
+ return true
1102
+ } else {
1103
+ return false
1104
+ }
1105
+ } else {
1106
+ return true
1107
+ }
1108
+ }
1109
+
1110
+
1111
+ wpm.unblockScript = function (scriptNode, removeAttach = false) {
1112
+
1113
+ if (removeAttach) $(scriptNode).remove()
1114
+
1115
+ let wpmSrc = $(scriptNode).data("wpm-src")
1116
+ if (wpmSrc) $(scriptNode).attr("src", wpmSrc)
1117
+
1118
+ scriptNode.type = "text/javascript"
1119
+
1120
+ if (removeAttach) $(scriptNode).appendTo("head")
1121
+
1122
+ jQuery(document).trigger("wpmPreLoadPixels", {})
1123
+ }
1124
+
1125
+ wpm.blockScript = function (scriptNode, removeAttach = false) {
1126
+
1127
+ if (removeAttach) $(scriptNode).remove()
1128
+
1129
+ if ($(scriptNode).attr("src")) $(scriptNode).removeAttr("src")
1130
+ scriptNode.type = "blocked/javascript"
1131
+
1132
+ if (removeAttach) $(scriptNode).appendTo("head")
1133
+ }
1134
+
1135
+ wpm.unblockAllScripts = function (analytics = true, ads = true) {
1136
+ // console.log('unblocking all scripts')
1137
+
1138
+ $.each(
1139
+ $("script[type=\"blocked/javascript\"]"), function (index, scriptNode) {
1140
+
1141
+ if ($(scriptNode).data("wpm-cookie-category").includes("analytics") && analytics) {
1142
+ wpm.unblockScript(scriptNode, true)
1143
+ } else if ($(scriptNode).data("wpm-cookie-category").includes("ads") && ads) {
1144
+ wpm.unblockScript(scriptNode, true)
1145
+ }
1146
+ })
1147
+
1148
+ jQuery(document).trigger("wpmPreLoadPixels", {})
1149
+ }
1150
+
1151
+ wpm.unblockSelectedPixels = function () {
1152
+ $.each(
1153
+ $("script[type=\"blocked/javascript\"]"), function (index, node) {
1154
+
1155
+ if (wpmConsentValues.pixels.includes($(node).data("wpm-pixel-name"))) {
1156
+ wpm.unblockScript(node, true)
1157
+ } else if ($(node).data("wpm-pixel-name") === "google" && ["google-analytics", "google-ads"].some(element => wpmConsentValues.pixels.includes(element))) {
1158
+ wpm.unblockScript(node, true)
1159
+ }
1160
+ })
1161
+
1162
+ jQuery(document).trigger("wpmPreLoadPixels", {})
1163
+ }
1164
+
1165
+
1166
+ /**
1167
+ * Block or unblock scripts for each CMP immediately after cookie consent has been updated
1168
+ * by the visitor.
1169
+ */
1170
+
1171
+ // Borlabs Cookie
1172
+ // If visitor accepts cookies in Borlabs Cookie unblock the scripts
1173
+ window.addEventListener("borlabs-cookie-consent-saved", function () {
1174
+
1175
+ wpm.updateConsentCookieValues()
1176
+
1177
+ if (wpmConsentValues.mode === "pixel") {
1178
+
1179
+ wpm.unblockSelectedPixels()
1180
+ wpm.updateGoogleConsentMode(wpmConsentValues.pixels.includes("google-analytics"), wpmConsentValues.pixels.includes("google-ads"))
1181
+ } else {
1182
+
1183
+ wpm.unblockAllScripts(wpmConsentValues.categories.analytics, wpmConsentValues.categories.ads)
1184
+ wpm.updateGoogleConsentMode(wpmConsentValues.categories.analytics, wpmConsentValues.categories.ads)
1185
+ }
1186
+ })
1187
+
1188
+ // Cookiebot
1189
+ // If visitor accepts cookies in Cookiebot unblock the scripts
1190
+ // https://www.cookiebot.com/en/developer/
1191
+ window.addEventListener("CookiebotOnAccept", function () {
1192
+ if (Cookiebot.consent.statistics) wpmConsentValues.categories.analytics = true
1193
+ if (Cookiebot.consent.marketing) wpmConsentValues.categories.ads = true
1194
+
1195
+ wpm.unblockAllScripts(wpmConsentValues.categories.analytics, wpmConsentValues.categories.ads)
1196
+ wpm.updateGoogleConsentMode(wpmConsentValues.categories.analytics, wpmConsentValues.categories.ads)
1197
+
1198
+ }, false)
1199
+
1200
+ /**
1201
+ * Cookie Script
1202
+ * If visitor accepts cookies in Cookie Script unblock the scripts
1203
+ * https://support.cookie-script.com/article/20-custom-events
1204
+ */
1205
+ window.addEventListener("CookieScriptAccept", function (e) {
1206
+ if (e.detail.categories.includes("performance")) wpmConsentValues.categories.analytics = true
1207
+ if (e.detail.categories.includes("targeting")) wpmConsentValues.categories.ads = true
1208
+
1209
+ wpm.unblockAllScripts(wpmConsentValues.categories.analytics, wpmConsentValues.categories.ads)
1210
+ wpm.updateGoogleConsentMode(wpmConsentValues.categories.analytics, wpmConsentValues.categories.ads)
1211
+ })
1212
+
1213
+ /**
1214
+ * Cookie Script
1215
+ * If visitor accepts cookies in Cookie Script unblock the scripts
1216
+ * https://support.cookie-script.com/
1217
+ */
1218
+ window.addEventListener("CookieScriptAcceptAll", function () {
1219
+ wpm.unblockAllScripts(true, true)
1220
+ wpm.updateGoogleConsentMode(true, true)
1221
+ })
1222
+
1223
+ // Complianz Cookie
1224
+ // If visitor accepts cookies in Complianz unblock the scripts
1225
+ document.addEventListener("cmplzStatusChange", function () {
1226
+
1227
+ wpm.updateConsentCookieValues()
1228
+
1229
+ // console.log(wpmConsentValues)
1230
+
1231
+ wpm.unblockAllScripts(wpmConsentValues.categories.analytics, wpmConsentValues.categories.ads)
1232
+ wpm.updateGoogleConsentMode(wpmConsentValues.categories.analytics, wpmConsentValues.categories.ads)
1233
+ })
1234
+
1235
+ // Cookie Compliance by hu-manity.co (free and pro)
1236
+ // If visitor accepts cookies in Cookie Notice by hu-manity.co unblock the scripts (free version)
1237
+ // https://wordpress.org/support/topic/events-on-consent-change/#post-15202792
1238
+ document.addEventListener("setCookieNotice", function () {
1239
+
1240
+ wpm.updateConsentCookieValues()
1241
+
1242
+ // console.log(wpmConsentValues)
1243
+
1244
+ wpm.unblockAllScripts(wpmConsentValues.categories.analytics, wpmConsentValues.categories.ads)
1245
+ wpm.updateGoogleConsentMode(wpmConsentValues.categories.analytics, wpmConsentValues.categories.ads)
1246
+ })
1247
+
1248
+ /**
1249
+ * Cookie Compliance by hu-manity.co (free and pro)
1250
+ * If visitor accepts cookies in Cookie Notice by hu-manity.co unblock the scripts (pro version)
1251
+ * https://wordpress.org/support/topic/events-on-consent-change/#post-15202792
1252
+ * Because Cookie Notice has no documented API or event that is being triggered on consent save or update
1253
+ * we have to solve this by using a mutation observer.
1254
+ *
1255
+ * @type {MutationObserver}
1256
+ */
1257
+
1258
+ wpm.huObserver = new MutationObserver(function (mutations) {
1259
+ mutations.forEach(({addedNodes}) => {
1260
+ [...addedNodes]
1261
+ .forEach(node => {
1262
+
1263
+ if (node.id === "hu") {
1264
+
1265
+ jQuery(".hu-cookies-save").on("click", function () {
1266
+ wpm.updateConsentCookieValues()
1267
+ wpm.unblockAllScripts(wpmConsentValues.categories.analytics, wpmConsentValues.categories.ads)
1268
+ wpm.updateGoogleConsentMode(wpmConsentValues.categories.analytics, wpmConsentValues.categories.ads)
1269
+ })
1270
+ }
1271
+ })
1272
+ })
1273
+ })
1274
+
1275
+ if (window.hu) {
1276
+ wpm.huObserver.observe(document.documentElement || document.body, {childList: true, subtree: true})
1277
+ }
1278
+
1279
+ wpm.version = function () {
1280
+ console.log(wpmDataLayer.version)
1281
+ }
1282
+
1283
+ // https://api.jquery.com/jquery.getscript/
1284
+ wpm.loadScriptAndCacheIt = function (url, options) {
1285
+
1286
+ // Allow user to set any option except for dataType, cache, and url
1287
+ options = jQuery.extend(options || {}, {
1288
+ dataType: "script",
1289
+ cache : true,
1290
+ url : url,
1291
+ })
1292
+
1293
+ // Use $.ajax() since it is more flexible than $.getScript
1294
+ // Return the jqXHR object so we can chain callbacks
1295
+ return jQuery.ajax(options)
1296
+ }
1297
+
1298
+ wpm.getOrderItemPrice = function (orderItem) {
1299
+ return (orderItem.total + orderItem.total_tax) / orderItem.quantity
1300
+ }
1301
+
1302
+ wpm.hasLoginEventFired = function () {
1303
+ let data = wpm.getWpmSessionData()
1304
+ return data?.loginEventFired
1305
+ }
1306
+
1307
+ wpm.setLoginEventFired = function () {
1308
+ let data = wpm.getWpmSessionData()
1309
+ data["loginEventFired"] = true
1310
+ wpm.setWpmSessionData(data)
1311
+ }
1312
+
1313
+ wpm.wpmDataLayerExists = function () {
1314
+ return new Promise(function (resolve) {
1315
+ (function waitForVar() {
1316
+ if (typeof wpmDataLayer !== "undefined") return resolve()
1317
+ setTimeout(waitForVar, 50)
1318
+ })()
1319
+ })
1320
+ }
1321
+
1322
+ wpm.pageLoaded = function () {
1323
+ return new Promise(function (resolve) {
1324
+ (function waitForVar() {
1325
+ if ("complete" === document.readyState) return resolve()
1326
+ setTimeout(waitForVar, 50)
1327
+ })()
1328
+ })
1329
+ }
1330
+
1331
+ wpm.pageReady = function () {
1332
+ return new Promise(function (resolve) {
1333
+ (function waitForVar() {
1334
+ if ("interactive" === document.readyState || "complete" === document.readyState) return resolve()
1335
+ setTimeout(waitForVar, 50)
1336
+ })()
1337
+ })
1338
+ }
1339
+
1340
+ wpm.isMiniCartActive = function () {
1341
+ if (window.sessionStorage) {
1342
+ for (const [key, value] of Object.entries(window.sessionStorage)) {
1343
+ if (key.includes("wc_fragments")) {
1344
+ return true
1345
+ }
1346
+ }
1347
+ return false
1348
+ } else {
1349
+ return false
1350
+ }
1351
+ }
1352
+
1353
+ wpm.doesWooCommerceCartExist = function () {
1354
+ return document.cookie.includes("woocommerce_items_in_cart")
1355
+ }
1356
+
1357
+ wpm.urlHasParameter = function (parameter) {
1358
+ let urlParams = new URLSearchParams(window.location.search)
1359
+ return urlParams.has(parameter)
1360
+ }
1361
+
1362
+ // wpm['load'] = {
1363
+ // base: true
1364
+ // };
1365
+
1366
+ window["wpmLoaded"] = {}
1367
+
1368
+ // return {
1369
+ // writeOrderIdToStorage : writeOrderIdToStorage,
1370
+ // isOrderIdStored : isOrderIdStored,
1371
+ // isEmail : isEmail,
1372
+ // removeProductFromCart : removeProductFromCart,
1373
+ // getViewItemProducts : getViewItemProducts,
1374
+ // addProductToCart : addProductToCart,
1375
+ // getCartItemsFromBackEnd: getCartItemsFromBackEnd,
1376
+ // fireCheckoutOption : fireCheckoutOption,
1377
+ // getCartItems : getCartItems
1378
+ // }
1379
+
1380
+ }(window.wpm = window.wpm || {}, jQuery))
1381
+
1382
+
1383
+ /**
1384
+ * Run when page is ready
1385
+ * */
1386
+
1387
+ wpm.pageReady().then(function () {
1388
+
1389
+
1390
+ /**
1391
+ * Run as soon as wpm namespace is loaded
1392
+ */
1393
+
1394
+ wpm.wpmDataLayerExists()
1395
+ .then(function () {
1396
+ // watch for products visible in viewport
1397
+ wpm.startIntersectionObserverToWatch()
1398
+
1399
+ // watch for lazy loaded products
1400
+ wpm.startProductsMutationObserverToWatch()
1401
+ })
1402
+
1403
+ // let products = jQuery(".products, .product")
1404
+
1405
+
1406
+ // remove_from_cart event
1407
+ jQuery(document).on("click", ".remove_from_cart_button, .remove", function () {
1408
+ // jQuery('.remove_from_cart_button, .remove').on('click', function (e) {
1409
+
1410
+ try {
1411
+ // console.log('remove_from_cart: ' + jQuery(this).data('product_id'));
1412
+
1413
+ let url = new URL(jQuery(this).attr("href"))
1414
+ let productId = wpm.getProductIdByCartItemKeyUrl(url)
1415
+
1416
+ wpm.removeProductFromCart(productId)
1417
+
1418
+ } catch (e) {
1419
+ console.error(e)
1420
+ }
1421
+ })
1422
+
1423
+
1424
+ // add_to_cart event
1425
+ jQuery(document).on("click", ".add_to_cart_button:not(.product_type_variable), .ajax_add_to_cart, .single_add_to_cart_button", function () {
1426
+ // jQuery('.add_to_cart_button:not(.product_type_variable), .ajax_add_to_cart, .js-ajax-add-to-cart, .single_add_to_cart_button, .btn_color-2').on('click', function (e) {
1427
+
1428
+ try {
1429
+ // console.log('add_to_cart');
1430
+
1431
+ if (wpmDataLayer.shop.page_type === "product") {
1432
+
1433
+ // first process related and upsell products
1434
+ if (typeof jQuery(this).attr("href") !== "undefined" && jQuery(this).attr("href").includes("add-to-cart")) {
1435
+ // console.log('add-to-cart on upsell and related products');
1436
+ let quantity = 1
1437
+ let productId = jQuery(this).data("product_id")
1438
+ // console.log('productId: ' + productId);
1439
+ wpm.addProductToCart(productId, quantity)
1440
+ } else {
1441
+
1442
+ if (wpmDataLayer.shop.product_type === "simple") {
1443
+
1444
+ // console.log('test');
1445
+ let quantity = Number(jQuery(".input-text.qty").val())
1446
+
1447
+ if (!quantity && quantity !== 0) quantity = 1
1448
+
1449
+ let productId = jQuery(this).val()
1450
+
1451
+ // console.log('productId: ' + productId);
1452
+ // console.log('quantity: ' + quantity);
1453
+
1454
+ wpm.addProductToCart(productId, quantity)
1455
+
1456
+ } else if (wpmDataLayer.shop.product_type === "variable") {
1457
+
1458
+ // console.log('variable');
1459
+
1460
+ let quantity = Number(jQuery(".input-text.qty").val())
1461
+
1462
+ if (!quantity && quantity !== 0) quantity = 1
1463
+
1464
+ let productId = jQuery("[name='variation_id']").val()
1465
+
1466
+ // console.log('productId: ' + productId);
1467
+ // console.log('quantity: ' + quantity);
1468
+
1469
+ wpm.addProductToCart(productId, quantity)
1470
+
1471
+ } else if (wpmDataLayer.shop.product_type === "grouped") {
1472
+
1473
+ // console.log('grouped');
1474
+
1475
+ jQuery(".woocommerce-grouped-product-list-item").each(function () {
1476
+
1477
+ let quantity = Number(jQuery(this).find(".input-text.qty").val())
1478
+
1479
+ if (!quantity && quantity !== 0) quantity = 1
1480
+
1481
+ let classes = jQuery(this).attr("class")
1482
+ let productId = wpm.getPostIdFromString(classes)
1483
+
1484
+ // console.log('productId: ' + productId);
1485
+ // console.log('quantity: ' + quantity);
1486
+
1487
+ wpm.addProductToCart(productId, quantity)
1488
+ })
1489
+ } else if (wpmDataLayer.shop.product_type === "bundle") {
1490
+
1491
+ // console.log('bundle');
1492
+
1493
+ let quantity = Number(jQuery(".input-text.qty").val())
1494
+
1495
+ if (!quantity && quantity !== 0) quantity = 1
1496
+
1497
+ let productId = jQuery("input[name=add-to-cart]").val()
1498
+
1499
+ // console.log('productId: ' + productId);
1500
+ // console.log('quantity: ' + quantity);
1501
+
1502
+ wpm.addProductToCart(productId, quantity)
1503
+ }
1504
+ }
1505
+ } else {
1506
+
1507
+ // console.log('non product page');
1508
+
1509
+ let quantity = 1
1510
+ let productId = jQuery(this).data("product_id")
1511
+ // console.log('productId: ' + productId);
1512
+ wpm.addProductToCart(productId, quantity)
1513
+ }
1514
+ } catch (e) {
1515
+ console.error(e)
1516
+ }
1517
+ })
1518
+
1519
+ // if someone clicks anywhere on a custom /?add-to-cart=123 link
1520
+ // trigger the add to cart event
1521
+ // body.one('click', function (e) {
1522
+ //
1523
+ // try {
1524
+ // if (jQuery(this)[0].URL) {
1525
+ //
1526
+ // let href = new URL(jQuery(this)[0].URL);
1527
+ // let searchParams = new URLSearchParams(href.search);
1528
+ //
1529
+ // if (searchParams.has('add-to-cart')) {
1530
+ // // console.log('non product page, /?add-to-cart=123 link');
1531
+ //
1532
+ // let productId = searchParams.get('add-to-cart');
1533
+ // wpm.addProductToCart(productId, 1);
1534
+ // }
1535
+ // }
1536
+ // } catch (e) {
1537
+ // console.error(e);
1538
+ // }
1539
+ // });
1540
+
1541
+
1542
+ /**
1543
+ * If someone clicks anywhere on a custom /?add-to-cart=123 link
1544
+ * trigger the add to cart event
1545
+ */
1546
+ jQuery(document).one("click", "a:not(.add_to_cart_button, .ajax_add_to_cart, .single_add_to_cart_button)", function (event) {
1547
+ // jQuery('a:not(.add_to_cart_button, .ajax_add_to_cart, .single_add_to_cart_button)').one('click', function (event) {
1548
+
1549
+ try {
1550
+ if (jQuery(event.target).closest("a").attr("href")) {
1551
+
1552
+ let href = jQuery(event.target).closest("a").attr("href")
1553
+
1554
+ if (href.includes("add-to-cart=")) {
1555
+ let matches = href.match(/(add-to-cart=)(\d+)/)
1556
+ // console.log('pid: ' + matches[2])
1557
+ if (matches) wpm.addProductToCart(matches[2], 1)
1558
+ }
1559
+ }
1560
+ } catch (e) {
1561
+ console.error(e)
1562
+ }
1563
+ })
1564
+
1565
+ // select_content GA UA event
1566
+ // select_item GA 4 event
1567
+ // jQuery(document).on('click', '.woocommerce-LoopProduct-link, .wc-block-grid__product, .product-small.box', function (e) {
1568
+ jQuery(document).on("click", ".woocommerce-LoopProduct-link, .wc-block-grid__product, .product, .product-small, .type-product", function () {
1569
+ // jQuery('.woocommerce-LoopProduct-link, .wc-block-grid__product, .product, .product-small, .type-product').on('click', function (e) {
1570
+
1571
+ try {
1572
+
1573
+ /**
1574
+ *
1575
+ * On some pages the event fires multiple times, and on product pages
1576
+ * even on page load. Using e.stopPropagation helps to prevent this,
1577
+ * but I dont know why. We don't even have to use this, since only a real
1578
+ * product click yields a valid productId. So we filter the invalid click
1579
+ * events out later down the code. I'll keep it that way because this is
1580
+ * the most compatible way across shops.
1581
+ * e.stopPropagation();
1582
+ * */
1583
+
1584
+ // console.log('select_content and select_item');
1585
+
1586
+ let productId = jQuery(this).nextAll(".wpmProductId:first").data("id")
1587
+ // console.log('select_content and select_item: ' + productId);
1588
+
1589
+
1590
+ /**
1591
+ * On product pages, for some reason, the click event is triggered on the main product on page load.
1592
+ * In that case no ID is found. But we can discard it, since we only want to trigger the event on
1593
+ * related products, which are found below.
1594
+ */
1595
+
1596
+ if (productId) {
1597
+
1598
+ // console.log('select_content and select_item: ' + productId);
1599
+
1600
+ productId = getIdBasedOndVariationsOutputSetting(productId)
1601
+
1602
+ if (!productId) throw Error("Wasn't able to retrieve a productId")
1603
+
1604
+ // console.log('prodid: ' + productId);
1605
+
1606
+ if (wpmDataLayer.products && wpmDataLayer.products[productId]) {
1607
+
1608
+ let product = wpm.getProductDetailsFormattedForEvent(productId)
1609
+
1610
+ jQuery(document).trigger("wpmSelectContentGaUa", product)
1611
+ jQuery(document).trigger("wpmSelectItem", product)
1612
+ }
1613
+ }
1614
+ } catch (e) {
1615
+ console.error(e)
1616
+ }
1617
+ })
1618
+
1619
+ // begin_checkout event
1620
+ jQuery(document).one("click", ".checkout-button, .cart-checkout-button, .button.checkout", function () {
1621
+ // jQuery('.checkout-button, .cart-checkout-button, .button.checkout').one('click', function (e) {
1622
+ // console.log('begin_checkout');
1623
+
1624
+ jQuery(document).trigger("wpmBeginCheckout")
1625
+ })
1626
+
1627
+
1628
+ // checkout_progress event
1629
+ // track checkout option event: entered valid billing email
1630
+ jQuery(document).on("input", "#billing_email", function () {
1631
+ // jQuery('#billing_email').on('input', function () {
1632
+
1633
+ if (wpm.isEmail(jQuery(this).val())) {
1634
+ // wpm.fireCheckoutOption(2);
1635
+ wpm.fireCheckoutProgress(2)
1636
+ wpm.emailSelected = true
1637
+ }
1638
+ })
1639
+
1640
+ // track checkout option event: purchase click
1641
+ jQuery(document).on("click", ".wc_payment_methods", function () {
1642
+ // jQuery('.wc_payment_methods').on('click', function () {
1643
+
1644
+ if (false === wpm.paymentMethodSelected) {
1645
+ wpm.fireCheckoutProgress(3)
1646
+ }
1647
+
1648
+ wpm.fireCheckoutOption(3, jQuery("input[name='payment_method']:checked").val())
1649
+ wpm.paymentMethodSelected = true
1650
+ })
1651
+
1652
+ // track checkout option event: purchase click
1653
+ jQuery(document).one("click", "#place_order", function () {
1654
+ // jQuery('#place_order').one('click', function () {
1655
+
1656
+ if (false === wpm.emailSelected) {
1657
+ wpm.fireCheckoutProgress(2)
1658
+ }
1659
+
1660
+ if (false === wpm.paymentMethodSelected) {
1661
+ wpm.fireCheckoutProgress(3)
1662
+ wpm.fireCheckoutOption(3, jQuery("input[name='payment_method']:checked").val())
1663
+ }
1664
+
1665
+ wpm.fireCheckoutProgress(4)
1666
+ })
1667
+
1668
+ // update cart event
1669
+ jQuery(document).on("click", "[name='update_cart']", function () {
1670
+ // jQuery("[name='update_cart']").on('click', function (e) {
1671
+
1672
+ try {
1673
+ jQuery(".cart_item").each(function () {
1674
+
1675
+ // let productId = jQuery(this).find('[data-product_id]').data('product_id');
1676
+
1677
+ let url = new URL(jQuery(this).find(".product-remove").find("a").attr("href"))
1678
+ let productId = wpm.getProductIdByCartItemKeyUrl(url)
1679
+
1680
+
1681
+ let quantity = jQuery(this).find(".qty").val()
1682
+
1683
+ if (quantity === 0) {
1684
+ wpm.removeProductFromCart(productId)
1685
+ } else if (quantity < wpmDataLayer.cart[productId].quantity) {
1686
+ wpm.removeProductFromCart(productId, wpmDataLayer.cart[productId].quantity - quantity)
1687
+ } else if (quantity > wpmDataLayer.cart[productId].quantity) {
1688
+ wpm.addProductToCart(productId, quantity - wpmDataLayer.cart[productId].quantity)
1689
+ }
1690
+ })
1691
+ } catch (e) {
1692
+ console.error(e)
1693
+ wpm.getCartItemsFromBackend()
1694
+ }
1695
+ })
1696
+
1697
+
1698
+ // add_to_wishlist
1699
+ jQuery(document).on("click", ".add_to_wishlist, .wl-add-to", function () {
1700
+ // jQuery('.add_to_wishlist, .wl-add-to').on('click', function () {
1701
+
1702
+ try {
1703
+ // console.log('add_to_wishlist');
1704
+ // console.log('this:' + jQuery(this).data('product-id'));
1705
+
1706
+ let productId
1707
+
1708
+ if (jQuery(this).data("productid")) { // for the WooCommerce wishlist plugin
1709
+ productId = jQuery(this).data("productid")
1710
+ } else if (jQuery(this).data("product-id")) { // for the YITH wishlist plugin
1711
+ productId = jQuery(this).data("product-id")
1712
+ }
1713
+
1714
+ if (!productId) throw Error("Wasn't able to retrieve a productId")
1715
+
1716
+ let product = wpm.getProductDetailsFormattedForEvent(productId)
1717
+
1718
+ // console.log('add_to_wishlist');
1719
+ // console.log(product);
1720
+
1721
+ jQuery(document).trigger("wpmAddToWishlist", product)
1722
+ } catch (e) {
1723
+ console.error(e)
1724
+ }
1725
+ })
1726
+
1727
+ jQuery(document).on("updated_cart_totals", function () {
1728
+ jQuery(document).trigger("wpmViewCart")
1729
+ })
1730
+
1731
+
1732
+ /**
1733
+ * Called when the user selects all the required dropdowns / attributes
1734
+ *
1735
+ * Has to be hooked after document ready
1736
+ *
1737
+ * https://stackoverflow.com/a/27849208/4688612
1738
+ * https://stackoverflow.com/a/65065335/4688612
1739
+ */
1740
+ jQuery(".single_variation_wrap").on("show_variation", function (event, variation) {
1741
+
1742
+ try {
1743
+ let productId = getIdBasedOndVariationsOutputSetting(variation.variation_id)
1744
+
1745
+ if (!productId) throw Error("Wasn't able to retrieve a productId")
1746
+
1747
+ if (wpmDataLayer.products && wpmDataLayer.products[productId]) {
1748
+
1749
+ // console.log('productId: ' + productId);
1750
+
1751
+ let product = wpm.getProductDetailsFormattedForEvent(productId)
1752
+
1753
+ jQuery(document).trigger("wpmViewItem", product)
1754
+ }
1755
+ } catch (e) {
1756
+ console.error(e)
1757
+ }
1758
+ })
1759
+
1760
+ /**
1761
+ * Called on variable products when no selection has been done yet
1762
+ * or when the visitor deselects his choice.
1763
+ *
1764
+ * Has to be hooked after document ready
1765
+ */
1766
+
1767
+ jQuery(".single_variation_wrap").on("hide_variation", function () {
1768
+
1769
+ try {
1770
+ let classes = jQuery("body").attr("class")
1771
+ let productId = classes.match(/(postid-)(\d+)/)[2]
1772
+
1773
+ if (!productId) throw Error("Wasn't able to retrieve a productId")
1774
+
1775
+ /**
1776
+ * If we have a variable product with no preset,
1777
+ * and variations output is enabled,
1778
+ * then we send a viewItem event with the first
1779
+ * variation we find for the parent.
1780
+ * If variations output is disabled,
1781
+ * we just send the parent ID.
1782
+ */
1783
+ if (
1784
+ "variable" === wpmDataLayer.shop.product_type &&
1785
+ wpmDataLayer?.general?.variationsOutput
1786
+ ) {
1787
+ for (const [key, product] of Object.entries(wpmDataLayer.products)) {
1788
+ if ("parentId" in product) {
1789
+ // console.log('pid: ' + value.parentId)
1790
+ productId = product.id
1791
+ break
1792
+ }
1793
+ }
1794
+ }
1795
+
1796
+ if (wpmDataLayer.products && wpmDataLayer.products[productId]) {
1797
+
1798
+ // console.log('productId: ' + productId);
1799
+
1800
+ let product = wpm.getProductDetailsFormattedForEvent(productId)
1801
+
1802
+ jQuery(document).trigger("wpmViewItem", product)
1803
+ }
1804
+
1805
+ } catch (e) {
1806
+ console.error(e)
1807
+ }
1808
+ })
1809
+
1810
+ }) // End document ready wrap
1811
+
1812
+ /**
1813
+ * Set up wpm events
1814
+ */
1815
+
1816
+
1817
+ // populate the wpmDataLayer with the cart items
1818
+ jQuery(window).on("wpmLoad", function () {
1819
+
1820
+ try {
1821
+ // When a new session is initiated there are no items in the cart,
1822
+ // so we can save the call to get the cart items
1823
+ if (wpm.doesWooCommerceCartExist()) wpm.getCartItems()
1824
+
1825
+ } catch (e) {
1826
+ console.error(e)
1827
+ }
1828
+ })
1829
+
1830
+ // get all add-to-cart= products from backend
1831
+ jQuery(window).on("wpmLoad", function () {
1832
+
1833
+ wpmDataLayer.products = wpmDataLayer.products || {}
1834
+
1835
+ // scan page for add-to-cart= links
1836
+ let productIds = wpm.getAddToCartLinkProductIds()
1837
+
1838
+ wpm.getProductsFromBackend(productIds)
1839
+ })
1840
+
1841
+ /**
1842
+ * Save the referrer into a cookie
1843
+ */
1844
+
1845
+ jQuery(window).on("wpmLoad", function () {
1846
+
1847
+ // can't use session storage as we can't read it from the server
1848
+ if (!wpm.getCookie("wpmReferrer")) {
1849
+
1850
+ if (document.referrer) {
1851
+ let referrerUrl = new URL(document.referrer)
1852
+ let referrerHostname = referrerUrl.hostname
1853
+
1854
+ if (referrerHostname !== window.location.host) {
1855
+ wpm.setCookie("wpmReferrer", referrerHostname)
1856
+ } else {
1857
+ wpm.setCookie("wpmReferrer", "")
1858
+ }
1859
+
1860
+ } else {
1861
+ wpm.setCookie("wpmReferrer", "")
1862
+ }
1863
+ }
1864
+ })
1865
+
1866
+
1867
+ /**
1868
+ * Create our own load event in order to better handle script flow execution when JS "optimizers" shuffle the code.
1869
+ */
1870
+
1871
+ jQuery(window).on("wpmLoad", function () {
1872
+ try {
1873
+ if (typeof wpmDataLayer != "undefined" && !wpmDataLayer?.wpmLoadFired) {
1874
+
1875
+ jQuery(document).trigger("wpmLoadAlways")
1876
+
1877
+ if ("product" === wpmDataLayer.shop.page_type && wpmDataLayer.shop.product_type !== "variable" && wpm.getMainProductIdFromProductPage()) {
1878
+
1879
+ let product = wpm.getProductDataForViewItemEvent(wpm.getMainProductIdFromProductPage())
1880
+ jQuery(document).trigger("wpmViewItem", product)
1881
+
1882
+ } else if ("product_category" === wpmDataLayer.shop.page_type) {
1883
+
1884
+ jQuery(document).trigger("wpmCategory")
1885
+
1886
+ } else if ("search" === wpmDataLayer.shop.page_type) {
1887
+
1888
+ jQuery(document).trigger("wpmSearch")
1889
+
1890
+ } else if ("cart" === wpmDataLayer.shop.page_type) {
1891
+
1892
+ jQuery(document).trigger("wpmViewCart")
1893
+
1894
+ } else if ("order_received_page" === wpmDataLayer.shop.page_type && wpmDataLayer.order) {
1895
+
1896
+ if (!wpm.isOrderIdStored(wpmDataLayer.order.id)) {
1897
+
1898
+ jQuery(document).trigger("wpmOrderReceivedPage")
1899
+ wpm.writeOrderIdToStorage(wpmDataLayer.order.id)
1900
+ }
1901
+ } else {
1902
+ jQuery(document).trigger("wpmEverywhereElse")
1903
+ }
1904
+
1905
+ if (wpmDataLayer?.user?.id && !wpm.hasLoginEventFired()) {
1906
+ jQuery(document).trigger("wpmLogin")
1907
+ wpm.setLoginEventFired()
1908
+ }
1909
+
1910
+ // /**
1911
+ // * Load mini cart fragments into a wpm session storage key,
1912
+ // * after the document load event.
1913
+ // */
1914
+ // jQuery(document).ajaxSend(function (event, jqxhr, settings) {
1915
+ // // console.log('settings.url: ' + settings.url);
1916
+ //
1917
+ // if (settings.url.includes("get_refreshed_fragments") && sessionStorage) {
1918
+ // if (!sessionStorage.getItem("wpmMiniCartActive")) {
1919
+ // sessionStorage.setItem("wpmMiniCartActive", JSON.stringify(true))
1920
+ // }
1921
+ // }
1922
+ // })
1923
+
1924
+ wpmDataLayer.wpmLoadFired = true
1925
+ }
1926
+
1927
+ } catch (e) {
1928
+ console.error(e)
1929
+ }
1930
+ })
1931
+
1932
+ // jQuery(window).on("load", function () {
1933
+ // jQuery(document).trigger("wpmLoad", {})
1934
+ // })
1935
+
1936
+ jQuery(window).on("wpmPreLoadPixels", function () {
1937
+
1938
+ if (wpmDataLayer?.shop?.cookie_consent_mgmt?.explicit_consent) {
1939
+ wpm.updateConsentCookieValues(true)
1940
+ }
1941
+ jQuery(document).trigger("wpmLoadPixels", {})
1942
+ })
readme.txt CHANGED
@@ -4,7 +4,7 @@ Tags: woocommerce, google ads, google analytics, facebook pixel, conversion trac
4
  Requires at least: 3.7
5
  Tested up to: 5.9
6
  Requires PHP: 7.3
7
- Stable tag: 1.16.6
8
  License: GPLv3 or later
9
  License URI: http://www.gnu.org/licenses/gpl-3.0.html
10
 
@@ -186,11 +186,6 @@ You can send the link to the front page of your shop too if you think it would b
186
 
187
  == Changelog ==
188
 
189
- = 1.16.6 = 11.04.2022
190
-
191
- * Tweak: Safeguard for JavaScript optimizers that ignore the jQuery dependency of WPM and load jQuery after WPM
192
- * Tweak: Refactored the WPM JavaScript library (split code logically and into folders)
193
-
194
  = 1.16.5 = 08.04.2022
195
 
196
  * Tweak: More verbose logging of WPM load and pixel consent status into the dev console
4
  Requires at least: 3.7
5
  Tested up to: 5.9
6
  Requires PHP: 7.3
7
+ Stable tag: 1.16.5
8
  License: GPLv3 or later
9
  License URI: http://www.gnu.org/licenses/gpl-3.0.html
10
 
186
 
187
  == Changelog ==
188
 
 
 
 
 
 
189
  = 1.16.5 = 08.04.2022
190
 
191
  * Tweak: More verbose logging of WPM load and pixel consent status into the dev console
wgact.php CHANGED
@@ -10,7 +10,7 @@
10
  * Developer URI: https://sweetcode.com
11
  * Text Domain: woocommerce-google-adwords-conversion-tracking-tag
12
  * Domain path: /languages
13
- * * Version: 1.16.6
14
  *
15
  * WC requires at least: 3.7
16
  * WC tested up to: 6.3
@@ -20,7 +20,7 @@
20
  *
21
  *
22
  **/
23
- const WPM_CURRENT_VERSION = '1.16.6' ;
24
  // TODO export settings function
25
  // TODO add option checkbox on uninstall and ask if user wants to delete options from db
26
 
10
  * Developer URI: https://sweetcode.com
11
  * Text Domain: woocommerce-google-adwords-conversion-tracking-tag
12
  * Domain path: /languages
13
+ * * Version: 1.16.5
14
  *
15
  * WC requires at least: 3.7
16
  * WC tested up to: 6.3
20
  *
21
  *
22
  **/
23
+ const WPM_CURRENT_VERSION = '1.16.5' ;
24
  // TODO export settings function
25
  // TODO add option checkbox on uninstall and ask if user wants to delete options from db
26