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

Version Description

1.4.2022

  • Tweak: Removed a few deprecated and inactive settings
  • Tweak: Updated Enhanced Conversions output as per updated specs by Google
  • Tweak: Improved formatting for Facebook CAPI event parameters
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.0
Comparing to
See all releases

Code changes from version 1.16.6 to 1.16.0

Files changed (40) hide show
  1. classes/admin/class-admin.php +154 -27
  2. classes/admin/class-ask-for-rating.php +2 -2
  3. classes/admin/class-environment-check.php +2 -2
  4. classes/admin/class-notifications.php +2 -2
  5. classes/pixels/class-cookie-consent-management.php +2 -2
  6. classes/pixels/class-pixel-manager.php +38 -21
  7. classes/pixels/class-pixel.php +1 -0
  8. classes/pixels/class-script-manager.php +25 -5
  9. classes/pixels/class-shortcodes.php +54 -57
  10. classes/pixels/google/class-google-analytics-refund.php +1 -0
  11. classes/pixels/google/class-google-pixel-manager.php +9 -14
  12. classes/pixels/google/class-google.php +16 -398
  13. classes/pixels/trait-product.php +60 -40
  14. classes/pixels/trait-shop.php +392 -283
  15. css/admin.css +2 -2
  16. js/admin/wpm-admin-freemius.p1.min.js +1 -1
  17. js/admin/wpm-admin-freemius.p1.min.js.map +1 -1
  18. js/admin/wpm-admin.p1.min.js +1 -1
  19. js/public/facebook.js +307 -0
  20. js/public/google-ads.js +305 -0
  21. js/public/google-ga-4.js +83 -0
  22. js/public/google-ga-ua.js +88 -0
  23. js/public/google-optimize.js +34 -0
  24. js/public/google.js +279 -0
  25. js/public/hotjar.js +39 -0
  26. js/public/main-free.js +27 -0
  27. js/public/main-premium.js +57 -0
  28. js/public/main.js +33 -0
  29. js/public/wpm-loader.js +17 -0
  30. js/public/wpm-public.p1.min.js +1 -1
  31. js/public/wpm-public.p1.min.js.map +1 -1
  32. js/public/wpm-public__premium_only.p1.min.js +2 -0
  33. js/public/wpm-public__premium_only.p1.min.js.map +1 -0
  34. js/public/wpm.js +1937 -0
  35. languages/woocommerce-google-adwords-conversion-tracking-tag.pot +203 -187
  36. readme.txt +24 -65
  37. vendor/freemius/wordpress-sdk/assets/img/plugin-icon.png +0 -0
  38. vendor/freemius/wordpress-sdk/assets/img/theme-icon.png +0 -0
  39. vendor/freemius/wordpress-sdk/assets/img/woocommerce-google-adwords-conversion-tracking-tag.png +0 -0
  40. wgact.php +4 -6
classes/admin/class-admin.php CHANGED
@@ -3,8 +3,10 @@
3
  // TODO move script for copying debug info into a proper .js enqueued file, or switch tabs to JavaScript switching and always save all settings at the same time
4
  namespace WCPM\Classes\Admin;
5
 
6
- use WCPM\Classes\Pixels\Google\Google ;
 
7
  use WCPM\Classes\Pixels\Trait_Shop ;
 
8
 
9
  if ( !defined( 'ABSPATH' ) ) {
10
  exit;
@@ -13,6 +15,7 @@ if ( !defined( 'ABSPATH' ) ) {
13
 
14
  class Admin
15
  {
 
16
  use Trait_Shop ;
17
  public $ip ;
18
  protected $text_domain ;
@@ -21,13 +24,11 @@ class Admin
21
  protected $documentation ;
22
  private $consent_mode_regions ;
23
  private $validations ;
24
- private $google ;
25
  public function __construct( $options )
26
  {
27
  $this->options = $options;
28
  $this->plugin_hook = 'woocommerce_page_wpm';
29
  $this->documentation = new Documentation();
30
- $this->google = new Google( $this->options );
31
  add_action( 'admin_enqueue_scripts', [ $this, 'wpm_admin_scripts' ] );
32
  // add the admin options page
33
  add_action( 'admin_menu', [ $this, 'wpm_plugin_admin_add_page' ], 99 );
@@ -46,7 +47,7 @@ class Admin
46
 
47
  protected function if_is_wpm_admin_page()
48
  {
49
- $_get = filter_input_array( INPUT_GET, FILTER_SANITIZE_FULL_SPECIAL_CHARS );
50
 
51
  if ( !empty($_get['page']) && 'wpm' === $_get['page'] ) {
52
  return true;
@@ -75,7 +76,7 @@ class Admin
75
 
76
  public function my_after_purchase_js( $js_function )
77
  {
78
- return "function ( response ) {\n\n let\n isTrial = (null != response.purchase.trial_ends),\n isSubscription = (null != response.purchase.initial_amount),\n total = isTrial ? 0 : (isSubscription ? response.purchase.initial_amount : response.purchase.gross).toString(),\n productName = 'WooCommerce Pixel Manager',\n // storeUrl = 'https://sweetcode.com',\n storeName = 'SweetCode';\n \n window.dataLayer = window.dataLayer || [];\n\n function gtag() {\n dataLayer.push(arguments);\n }\n \n gtag('js', new Date()); \n \n gtag('config', 'UA-39746956-10', {'anonymize_ip': true});\n gtag('config', 'G-2QE000DX8D');\n gtag('config', 'AW-406204436');\n \n gtag('event', 'purchase', {\n 'send_to':['UA-39746956-10', 'G-2QE000DX8D'],\n 'transaction_id':response.purchase.id.toString(),\n 'currency': response.purchase.currency.toUpperCase(),\n 'discount':0,\n 'items':[{\n 'id':response.purchase.plan_id.toString(),\n 'quantity':1,\n 'price':total,\n 'name':productName,\n 'category': 'Plugin',\n }],\n 'affiliation': storeName,\n 'value':response.purchase.initial_amount.toString()\n });\n \n gtag('event', 'conversion', {\n 'send_to': 'AW-406204436/XrUYCK3J8YoCEJTg2MEB',\n 'value': response.purchase.initial_amount.toString(),\n 'currency': response.purchase.currency.toUpperCase(),\n 'transaction_id': response.purchase.id.toString()\n });\n \n !function(f,b,e,v,n,t,s)\n {if(f.fbq)return;n=f.fbq=function(){n.callMethod?\n n.callMethod.apply(n,arguments):n.queue.push(arguments)};\n if(!f._fbq)f._fbq=n;n.push=n;n.loaded=!0;n.version='2.0';\n n.queue=[];t=b.createElement(e);t.async=!0;\n t.src=v;s=b.getElementsByTagName(e)[0];\n s.parentNode.insertBefore(t,s)}(window, document,'script',\n 'https://connect.facebook.net/en_US/fbevents.js');\n fbq('init', '257839909406661');\n fbq('track', 'PageView');\n \n fbq('track', 'Purchase', {\n currency: 'USD',\n value: total\n });\n \n var _dcq = _dcq || [];\n\t\t\tvar _dcs = _dcs || {};\n\t\t\t_dcs.account = '5594556';\n\t\n\t\t\t(function() {\n\t\t\t\tvar dc = document.createElement('script');\n\t\t\t\tdc.type = 'text/javascript'; dc.async = true;\n\t\t\t\tdc.src = '//tag.getdrip.com/5594556.js';\n\t\t\t\tvar s = document.getElementsByTagName('script')[0];\n\t\t\t\ts.parentNode.insertBefore(dc, s);\n\t\t\t})();\n\t\t\t\n\t\t\twindow._dcq.push([\n\t\t\t\t'track',\n\t\t\t\t'Placed an order',\n\t\t\t]);\n\t\t\t\n\t\t\twindow._dcq.push([\n\t\t\t\t'track',\n\t\t\t\t'purchase,\n\t\t\t\t{\n\t\t\t\t\tvalue: total * 100,\n\t\t\t\t\tcurrency_code: response.purchase.currency.toUpperCase(),\n\t\t\t\t}\n\t\t\t]);\n \n }";
79
  }
80
 
81
  public function my_checkout_enrich( $html )
@@ -234,7 +235,7 @@ class Admin
234
  public function add_section_main_subsection_facebook( $section_ids )
235
  {
236
  $sub_section_ids = [
237
- 'title' => esc_html__( 'Meta (Facebook)', 'woocommerce-google-adwords-conversion-tracking-tag' ),
238
  'slug' => 'facebook',
239
  ];
240
  add_settings_field(
@@ -249,7 +250,7 @@ class Admin
249
  // add the field for the conversion label
250
  add_settings_field(
251
  'wpm_plugin_facebook_pixel_id',
252
- esc_html__( 'Meta (Facebook) pixel ID', 'woocommerce-google-adwords-conversion-tracking-tag' ),
253
  [ $this, 'wpm_option_html_facebook_pixel_id' ],
254
  'wpm_plugin_options_page',
255
  $section_ids['settings_name']
@@ -392,7 +393,7 @@ class Admin
392
  // add checkbox for disabling tracking for user roles
393
  add_settings_field(
394
  'wpm_setting_disable_tracking_for_user_roles',
395
- esc_html__( 'Disable Tracking for User Roles', 'woocommerce-google-adwords-conversion-tracking-tag' ),
396
  [ $this, 'wpm_setting_html_disable_tracking_for_user_roles' ],
397
  'wpm_plugin_options_page',
398
  $section_ids['settings_name']
@@ -607,7 +608,7 @@ class Admin
607
  public function add_section_advanced_subsection_facebook( $section_ids )
608
  {
609
  $sub_section_ids = [
610
- 'title' => 'Meta (Facebook)',
611
  'slug' => 'facebook',
612
  ];
613
  add_settings_field(
@@ -622,7 +623,7 @@ class Admin
622
  // add field for the Facebook CAPI token
623
  add_settings_field(
624
  'wpm_setting_facebook_capi_token',
625
- esc_html__( 'Meta (Facebook) CAPI: token', 'woocommerce-google-adwords-conversion-tracking-tag' ),
626
  [ $this, 'wpm_setting_html_facebook_capi_token' ],
627
  'wpm_plugin_options_page',
628
  $section_ids['settings_name']
@@ -630,7 +631,7 @@ class Admin
630
  // add field for the Facebook CAPI user transparency process anonymous hits
631
  add_settings_field(
632
  'wpm_setting_facebook_capi_user_transparency_process_anonymous_hits',
633
- esc_html__( 'Meta (Facebook) CAPI: process anonymous hits', 'woocommerce-google-adwords-conversion-tracking-tag' ),
634
  [ $this, 'wpm_setting_facebook_capi_user_transparency_process_anonymous_hits' ],
635
  'wpm_plugin_options_page',
636
  $section_ids['settings_name']
@@ -638,7 +639,7 @@ class Admin
638
  // add field for the Facebook CAPI user transparency send additional client identifiers
639
  add_settings_field(
640
  'wpm_setting_facebook_capi_user_transparency_send_additional_client_identifiers',
641
- esc_html__( 'Meta (Facebook) CAPI: send additional visitor identifiers', 'woocommerce-google-adwords-conversion-tracking-tag' ),
642
  [ $this, 'wpm_setting_facebook_capi_user_transparency_send_additional_client_identifiers' ],
643
  'wpm_plugin_options_page',
644
  $section_ids['settings_name']
@@ -646,7 +647,7 @@ class Admin
646
  // add fields for Facebook microdata
647
  add_settings_field(
648
  'wpm_setting_facebook_microdata_active',
649
- esc_html__( 'Meta (Facebook) Microdata Tags for Catalogues', 'woocommerce-google-adwords-conversion-tracking-tag' ),
650
  [ $this, 'wpm_setting_html_facebook_microdata' ],
651
  'wpm_plugin_options_page',
652
  $section_ids['settings_name']
@@ -668,6 +669,39 @@ class Admin
668
  [ $this, 'wpm_plugin_section_add_cart_data_description' ],
669
  'wpm_plugin_options_page'
670
  );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
671
  // add checkbox for dynamic remarketing
672
  add_settings_field(
673
  'wpm_plugin_option_gads_dynamic_remarketing',
@@ -1149,7 +1183,7 @@ class Admin
1149
  $this->get_status_icon_new( $this->options['facebook']['pixel_id'] );
1150
  $this->get_documentation_html_by_key( 'facebook_pixel_id' );
1151
  echo '<br><br>' ;
1152
- esc_html_e( 'The Meta (Facebook) pixel ID looks similar to this:', 'woocommerce-google-adwords-conversion-tracking-tag' );
1153
  echo '&nbsp;<i>765432112345678</i>' ;
1154
  }
1155
 
@@ -1335,7 +1369,7 @@ class Admin
1335
  <a class="documentation-icon" href="<?php
1336
  echo esc_url( $path ) ;
1337
  ?>" target="_blank">
1338
- <span style="vertical-align: top; margin-top: 0" class="dashicons dashicons-info-outline tooltip"><span
1339
  class="tooltiptext">
1340
  <?php
1341
  esc_html_e( 'open the documentation', 'woocommerce-google-adwords-conversion-tracking-tag' );
@@ -1395,7 +1429,7 @@ class Admin
1395
  <option value="<?php
1396
  esc_html_e( $region_code );
1397
  ?>" <?php
1398
- esc_html_e( ( in_array( $region_code, $this->options['google']['consent_mode']['regions'], true ) ? 'selected' : '' ) );
1399
  ?>><?php
1400
  esc_html_e( $region_name );
1401
  ?></option>
@@ -1553,7 +1587,7 @@ class Admin
1553
  ?>
1554
  </label>
1555
  <?php
1556
- $this->get_status_icon_new( $this->options['google']['user_id'], $this->options['google']['analytics']['universal']['property_id'] || $this->options['google']['analytics']['ga4']['measurement_id'] || $this->google->is_google_ads_active(), true );
1557
  $this->html_pro_feature();
1558
  // echo $this->get_documentation_html('/wgact/?utm_source=woocommerce-plugin&utm_medium=documentation-link&utm_campaign=woocommerce-pixel-manager-docs&utm_content=google-consent-mode#/consent-mgmt/google-consent-mode');
1559
  ?>
@@ -1590,13 +1624,13 @@ class Admin
1590
  ?>
1591
  </label>
1592
  <?php
1593
- $this->get_status_icon_new( $this->options['google']['ads']['enhanced_conversions'], $this->google->is_google_ads_active(), false );
1594
  $this->html_pro_feature();
1595
  $this->get_documentation_html_by_key( 'google_ads_enhanced_conversions' );
1596
  ?>
1597
  <?php
1598
 
1599
- if ( !$this->google->is_google_ads_active() ) {
1600
  echo '<p></p><span class="dashicons dashicons-info"></span>' ;
1601
  esc_html_e( 'You need to activate Google Ads', 'woocommerce-google-adwords-conversion-tracking-tag' );
1602
  echo '</p><br>' ;
@@ -1750,7 +1784,7 @@ class Admin
1750
 
1751
  if ( !$this->options['facebook']['pixel_id'] ) {
1752
  echo '<p></p><span class="dashicons dashicons-info"></span>' ;
1753
- esc_html_e( 'You need to activate the Meta (Facebook) pixel', 'woocommerce-google-adwords-conversion-tracking-tag' );
1754
  echo '</p><br>' ;
1755
  }
1756
 
@@ -1780,7 +1814,7 @@ class Admin
1780
  ?>
1781
  />
1782
  <?php
1783
- esc_html_e( 'Send CAPI hits for anonymous visitors who likely have blocked the Meta (Facebook) pixel.', 'woocommerce-google-adwords-conversion-tracking-tag' );
1784
  ?>
1785
  </label>
1786
  <?php
@@ -1790,7 +1824,7 @@ class Admin
1790
 
1791
  if ( $this->options['facebook']['capi']['user_transparency']['process_anonymous_hits'] && !$this->options['facebook']['pixel_id'] ) {
1792
  echo '<p></p><span class="dashicons dashicons-info"></span>' ;
1793
- esc_html_e( 'You need to activate the Meta (Facebook) pixel', 'woocommerce-google-adwords-conversion-tracking-tag' );
1794
  echo '</p><br>' ;
1795
  }
1796
 
@@ -1826,7 +1860,7 @@ class Admin
1826
 
1827
  if ( $this->options['facebook']['capi']['user_transparency']['send_additional_client_identifiers'] && !$this->options['facebook']['pixel_id'] ) {
1828
  echo '<p></p><span class="dashicons dashicons-info"></span>' ;
1829
- esc_html_e( 'You need to activate the Meta (Facebook) pixel', 'woocommerce-google-adwords-conversion-tracking-tag' );
1830
  echo '</p><br>' ;
1831
  }
1832
 
@@ -1851,7 +1885,7 @@ class Admin
1851
  ?>
1852
  />
1853
  <?php
1854
- esc_html_e( 'Enable Meta (Facebook) product microdata output', 'woocommerce-google-adwords-conversion-tracking-tag' );
1855
  ?>
1856
  </label>
1857
  <?php
@@ -1861,12 +1895,44 @@ class Admin
1861
 
1862
  if ( $this->options['facebook']['microdata'] && !$this->options['facebook']['pixel_id'] ) {
1863
  echo '<p></p><span class="dashicons dashicons-info"></span>' ;
1864
- esc_html_e( 'You need to activate the Meta (Facebook) pixel', 'woocommerce-google-adwords-conversion-tracking-tag' );
1865
  echo '</p><br>' ;
1866
  }
1867
 
1868
  }
1869
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1870
  public function wpm_setting_html_order_duplication_prevention()
1871
  {
1872
  // adding the hidden input is a hack to make WordPress save the option with the value zero,
@@ -2191,6 +2257,67 @@ class Admin
2191
  esc_html_e( 'ID of your Google Merchant Center account. It looks like this: 12345678', 'woocommerce-google-adwords-conversion-tracking-tag' );
2192
  }
2193
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2194
  public function wpm_plugin_option_product_identifier()
2195
  {
2196
  ?>
@@ -2442,7 +2569,7 @@ class Admin
2442
 
2443
  if ( !$this->validations->is_facebook_pixel_id( $input['facebook']['pixel_id'] ) ) {
2444
  $input['facebook']['pixel_id'] = ( isset( $this->options['facebook']['pixel_id'] ) ? $this->options['facebook']['pixel_id'] : '' );
2445
- add_settings_error( 'wgact_plugin_options', 'invalid-facebook-pixel-id', esc_html__( 'You have entered an invalid Meta (Facebook) pixel ID. It only contains 14 to 16 digits.', 'woocommerce-google-adwords-conversion-tracking-tag' ) );
2446
  }
2447
 
2448
  }
@@ -2451,7 +2578,7 @@ class Admin
2451
 
2452
  if ( !$this->validations->is_facebook_capi_token( $input['facebook']['capi']['token'] ) ) {
2453
  $input['facebook']['capi']['token'] = ( isset( $this->options['facebook']['capi']['token'] ) ? $this->options['facebook']['capi']['token'] : '' );
2454
- add_settings_error( 'wgact_plugin_options', 'invalid-facebook-pixel-id', esc_html__( 'You have entered an invalid Meta (Facebook) CAPI token.', 'woocommerce-google-adwords-conversion-tracking-tag' ) );
2455
  }
2456
 
2457
  }
3
  // TODO move script for copying debug info into a proper .js enqueued file, or switch tabs to JavaScript switching and always save all settings at the same time
4
  namespace WCPM\Classes\Admin;
5
 
6
+ use WC_Geolocation ;
7
+ use WCPM\Classes\Pixels\Google\Trait_Google ;
8
  use WCPM\Classes\Pixels\Trait_Shop ;
9
+ use WP_Screen ;
10
 
11
  if ( !defined( 'ABSPATH' ) ) {
12
  exit;
15
 
16
  class Admin
17
  {
18
+ use Trait_Google ;
19
  use Trait_Shop ;
20
  public $ip ;
21
  protected $text_domain ;
24
  protected $documentation ;
25
  private $consent_mode_regions ;
26
  private $validations ;
 
27
  public function __construct( $options )
28
  {
29
  $this->options = $options;
30
  $this->plugin_hook = 'woocommerce_page_wpm';
31
  $this->documentation = new Documentation();
 
32
  add_action( 'admin_enqueue_scripts', [ $this, 'wpm_admin_scripts' ] );
33
  // add the admin options page
34
  add_action( 'admin_menu', [ $this, 'wpm_plugin_admin_add_page' ], 99 );
47
 
48
  protected function if_is_wpm_admin_page()
49
  {
50
+ $_get = filter_input_array( INPUT_GET, FILTER_SANITIZE_STRING );
51
 
52
  if ( !empty($_get['page']) && 'wpm' === $_get['page'] ) {
53
  return true;
76
 
77
  public function my_after_purchase_js( $js_function )
78
  {
79
+ return "function ( response ) {\n\n let\n isTrial = (null != response.purchase.trial_ends),\n isSubscription = (null != response.purchase.initial_amount),\n total = isTrial ? 0 : (isSubscription ? response.purchase.initial_amount : response.purchase.gross).toString(),\n productName = 'WooCommerce Pixel Manager',\n // storeUrl = 'https://sweetcode.com',\n storeName = 'SweetCode';\n \n window.dataLayer = window.dataLayer || [];\n\n function gtag() {\n dataLayer.push(arguments);\n }\n \n gtag('js', new Date()); \n \n gtag('config', 'UA-39746956-10', {'anonymize_ip':'true'});\n gtag('config', 'G-2QE000DX8D');\n gtag('config', 'AW-406204436');\n \n gtag('event', 'purchase', {\n 'send_to':['UA-39746956-10', 'G-2QE000DX8D'],\n 'transaction_id':response.purchase.id.toString(),\n 'currency': response.purchase.currency.toUpperCase(),\n 'discount':0,\n 'items':[{\n 'id':response.purchase.plan_id.toString(),\n 'quantity':1,\n 'price':total,\n 'name':productName,\n 'category': 'Plugin',\n }],\n 'affiliation': storeName,\n 'value':response.purchase.initial_amount.toString()\n });\n \n gtag('event', 'conversion', {\n 'send_to': 'AW-406204436/XrUYCK3J8YoCEJTg2MEB',\n 'value': response.purchase.initial_amount.toString(),\n 'currency': response.purchase.currency.toUpperCase(),\n 'transaction_id': response.purchase.id.toString()\n });\n \n !function(f,b,e,v,n,t,s)\n {if(f.fbq)return;n=f.fbq=function(){n.callMethod?\n n.callMethod.apply(n,arguments):n.queue.push(arguments)};\n if(!f._fbq)f._fbq=n;n.push=n;n.loaded=!0;n.version='2.0';\n n.queue=[];t=b.createElement(e);t.async=!0;\n t.src=v;s=b.getElementsByTagName(e)[0];\n s.parentNode.insertBefore(t,s)}(window, document,'script',\n 'https://connect.facebook.net/en_US/fbevents.js');\n fbq('init', '257839909406661');\n fbq('track', 'PageView');\n \n fbq('track', 'Purchase', {\n currency: 'USD',\n value: total\n });\n \n var _dcq = _dcq || [];\n\t\t\tvar _dcs = _dcs || {};\n\t\t\t_dcs.account = '5594556';\n\t\n\t\t\t(function() {\n\t\t\t\tvar dc = document.createElement('script');\n\t\t\t\tdc.type = 'text/javascript'; dc.async = true;\n\t\t\t\tdc.src = '//tag.getdrip.com/5594556.js';\n\t\t\t\tvar s = document.getElementsByTagName('script')[0];\n\t\t\t\ts.parentNode.insertBefore(dc, s);\n\t\t\t})();\n\t\t\t\n\t\t\twindow._dcq.push([\n\t\t\t\t'track',\n\t\t\t\t'Placed an order',\n\t\t\t]);\n\t\t\t\n\t\t\twindow._dcq.push([\n\t\t\t\t'track',\n\t\t\t\t'purchase,\n\t\t\t\t{\n\t\t\t\t\tvalue: total * 100,\n\t\t\t\t\tcurrency_code: response.purchase.currency.toUpperCase(),\n\t\t\t\t}\n\t\t\t]);\n \n }";
80
  }
81
 
82
  public function my_checkout_enrich( $html )
235
  public function add_section_main_subsection_facebook( $section_ids )
236
  {
237
  $sub_section_ids = [
238
+ 'title' => esc_html__( 'Facebook', 'woocommerce-google-adwords-conversion-tracking-tag' ),
239
  'slug' => 'facebook',
240
  ];
241
  add_settings_field(
250
  // add the field for the conversion label
251
  add_settings_field(
252
  'wpm_plugin_facebook_pixel_id',
253
+ esc_html__( 'Facebook pixel ID', 'woocommerce-google-adwords-conversion-tracking-tag' ),
254
  [ $this, 'wpm_option_html_facebook_pixel_id' ],
255
  'wpm_plugin_options_page',
256
  $section_ids['settings_name']
393
  // add checkbox for disabling tracking for user roles
394
  add_settings_field(
395
  'wpm_setting_disable_tracking_for_user_roles',
396
+ esc_html__( 'Disable tracking for user roles', 'woocommerce-google-adwords-conversion-tracking-tag' ),
397
  [ $this, 'wpm_setting_html_disable_tracking_for_user_roles' ],
398
  'wpm_plugin_options_page',
399
  $section_ids['settings_name']
608
  public function add_section_advanced_subsection_facebook( $section_ids )
609
  {
610
  $sub_section_ids = [
611
+ 'title' => 'Facebook',
612
  'slug' => 'facebook',
613
  ];
614
  add_settings_field(
623
  // add field for the Facebook CAPI token
624
  add_settings_field(
625
  'wpm_setting_facebook_capi_token',
626
+ esc_html__( 'Facebook CAPI: token', 'woocommerce-google-adwords-conversion-tracking-tag' ),
627
  [ $this, 'wpm_setting_html_facebook_capi_token' ],
628
  'wpm_plugin_options_page',
629
  $section_ids['settings_name']
631
  // add field for the Facebook CAPI user transparency process anonymous hits
632
  add_settings_field(
633
  'wpm_setting_facebook_capi_user_transparency_process_anonymous_hits',
634
+ esc_html__( 'Facebook CAPI: process anonymous hits', 'woocommerce-google-adwords-conversion-tracking-tag' ),
635
  [ $this, 'wpm_setting_facebook_capi_user_transparency_process_anonymous_hits' ],
636
  'wpm_plugin_options_page',
637
  $section_ids['settings_name']
639
  // add field for the Facebook CAPI user transparency send additional client identifiers
640
  add_settings_field(
641
  'wpm_setting_facebook_capi_user_transparency_send_additional_client_identifiers',
642
+ esc_html__( 'Facebook CAPI: send additional visitor identifiers', 'woocommerce-google-adwords-conversion-tracking-tag' ),
643
  [ $this, 'wpm_setting_facebook_capi_user_transparency_send_additional_client_identifiers' ],
644
  'wpm_plugin_options_page',
645
  $section_ids['settings_name']
647
  // add fields for Facebook microdata
648
  add_settings_field(
649
  'wpm_setting_facebook_microdata_active',
650
+ esc_html__( 'Facebook Microdata Tags for Catalogues', 'woocommerce-google-adwords-conversion-tracking-tag' ),
651
  [ $this, 'wpm_setting_html_facebook_microdata' ],
652
  'wpm_plugin_options_page',
653
  $section_ids['settings_name']
669
  [ $this, 'wpm_plugin_section_add_cart_data_description' ],
670
  'wpm_plugin_options_page'
671
  );
672
+ // add fields for cart data
673
+ // add_settings_field(
674
+ // 'wgact_plugin_add_cart_data',
675
+ // esc_html__(
676
+ // 'Activation',
677
+ // 'woocommerce-google-adwords-conversion-tracking-tag'
678
+ // ),
679
+ // [$this, 'wgact_option_html_google_ads_add_cart_data'],
680
+ // 'wpm_plugin_options_page',
681
+ // 'wpm_plugin_beta_section'
682
+ // );
683
+ // add the field for the aw_feed_country
684
+ // add_settings_field(
685
+ // 'wgact_plugin_aw_feed_country',
686
+ // esc_html__(
687
+ // 'aw_feed_country',
688
+ // 'woocommerce-google-adwords-conversion-tracking-tag'
689
+ // ),
690
+ // [$this, 'wgact_plugin_setting_aw_feed_country'],
691
+ // 'wpm_plugin_options_page',
692
+ // 'wpm_plugin_beta_section'
693
+ // );
694
+ // add the field for the aw_feed_language
695
+ // add_settings_field(
696
+ // 'wgact_plugin_aw_feed_language',
697
+ // esc_html__(
698
+ // 'aw_feed_language',
699
+ // 'woocommerce-google-adwords-conversion-tracking-tag'
700
+ // ),
701
+ // [$this, 'wgact_plugin_setting_aw_feed_language'],
702
+ // 'wpm_plugin_options_page',
703
+ // 'wpm_plugin_beta_section'
704
+ // );
705
  // add checkbox for dynamic remarketing
706
  add_settings_field(
707
  'wpm_plugin_option_gads_dynamic_remarketing',
1183
  $this->get_status_icon_new( $this->options['facebook']['pixel_id'] );
1184
  $this->get_documentation_html_by_key( 'facebook_pixel_id' );
1185
  echo '<br><br>' ;
1186
+ esc_html_e( 'The Facebook pixel ID looks similar to this:', 'woocommerce-google-adwords-conversion-tracking-tag' );
1187
  echo '&nbsp;<i>765432112345678</i>' ;
1188
  }
1189
 
1369
  <a class="documentation-icon" href="<?php
1370
  echo esc_url( $path ) ;
1371
  ?>" target="_blank">
1372
+ <span style="vertical-align: top; margin-top: 0px" class="dashicons dashicons-info-outline tooltip"><span
1373
  class="tooltiptext">
1374
  <?php
1375
  esc_html_e( 'open the documentation', 'woocommerce-google-adwords-conversion-tracking-tag' );
1429
  <option value="<?php
1430
  esc_html_e( $region_code );
1431
  ?>" <?php
1432
+ esc_html_e( ( in_array( $region_code, $this->options['google']['consent_mode']['regions'] ) ? 'selected' : '' ) );
1433
  ?>><?php
1434
  esc_html_e( $region_name );
1435
  ?></option>
1587
  ?>
1588
  </label>
1589
  <?php
1590
+ $this->get_status_icon_new( $this->options['google']['user_id'], $this->options['google']['analytics']['universal']['property_id'] || $this->options['google']['analytics']['ga4']['measurement_id'] || $this->is_google_ads_active(), true );
1591
  $this->html_pro_feature();
1592
  // echo $this->get_documentation_html('/wgact/?utm_source=woocommerce-plugin&utm_medium=documentation-link&utm_campaign=woocommerce-pixel-manager-docs&utm_content=google-consent-mode#/consent-mgmt/google-consent-mode');
1593
  ?>
1624
  ?>
1625
  </label>
1626
  <?php
1627
+ $this->get_status_icon_new( $this->options['google']['ads']['enhanced_conversions'], $this->is_google_ads_active(), false );
1628
  $this->html_pro_feature();
1629
  $this->get_documentation_html_by_key( 'google_ads_enhanced_conversions' );
1630
  ?>
1631
  <?php
1632
 
1633
+ if ( !$this->is_google_ads_active() ) {
1634
  echo '<p></p><span class="dashicons dashicons-info"></span>' ;
1635
  esc_html_e( 'You need to activate Google Ads', 'woocommerce-google-adwords-conversion-tracking-tag' );
1636
  echo '</p><br>' ;
1784
 
1785
  if ( !$this->options['facebook']['pixel_id'] ) {
1786
  echo '<p></p><span class="dashicons dashicons-info"></span>' ;
1787
+ esc_html_e( 'You need to activate the Facebook pixel', 'woocommerce-google-adwords-conversion-tracking-tag' );
1788
  echo '</p><br>' ;
1789
  }
1790
 
1814
  ?>
1815
  />
1816
  <?php
1817
+ esc_html_e( 'Send CAPI hits for anonymous visitors who likely have blocked the Facebook pixel.', 'woocommerce-google-adwords-conversion-tracking-tag' );
1818
  ?>
1819
  </label>
1820
  <?php
1824
 
1825
  if ( $this->options['facebook']['capi']['user_transparency']['process_anonymous_hits'] && !$this->options['facebook']['pixel_id'] ) {
1826
  echo '<p></p><span class="dashicons dashicons-info"></span>' ;
1827
+ esc_html_e( 'You need to activate the Facebook pixel', 'woocommerce-google-adwords-conversion-tracking-tag' );
1828
  echo '</p><br>' ;
1829
  }
1830
 
1860
 
1861
  if ( $this->options['facebook']['capi']['user_transparency']['send_additional_client_identifiers'] && !$this->options['facebook']['pixel_id'] ) {
1862
  echo '<p></p><span class="dashicons dashicons-info"></span>' ;
1863
+ esc_html_e( 'You need to activate the Facebook pixel', 'woocommerce-google-adwords-conversion-tracking-tag' );
1864
  echo '</p><br>' ;
1865
  }
1866
 
1885
  ?>
1886
  />
1887
  <?php
1888
+ esc_html_e( 'Enable Facebook product microdata output', 'woocommerce-google-adwords-conversion-tracking-tag' );
1889
  ?>
1890
  </label>
1891
  <?php
1895
 
1896
  if ( $this->options['facebook']['microdata'] && !$this->options['facebook']['pixel_id'] ) {
1897
  echo '<p></p><span class="dashicons dashicons-info"></span>' ;
1898
+ esc_html_e( 'You need to activate the Facebook pixel', 'woocommerce-google-adwords-conversion-tracking-tag' );
1899
  echo '</p><br>' ;
1900
  }
1901
 
1902
  }
1903
 
1904
+ public function wgact_option_html_google_ads_add_cart_data()
1905
+ {
1906
+ // adding the hidden input is a hack to make WordPress save the option with the value zero,
1907
+ // instead of not saving it and remove that array key entirely
1908
+ // https://stackoverflow.com/a/1992745/4688612
1909
+ ?>
1910
+ <label>
1911
+ <input type='hidden' value='0' name='wgact_plugin_options[google][ads][add_cart_data]'>
1912
+ <input type='checkbox' id='wgact_plugin_option_gads_add_cart_data'
1913
+ name='wgact_plugin_options[google][ads][add_cart_data]'
1914
+ value='1' <?php
1915
+ checked( $this->options['google']['ads']['add_cart_data'] );
1916
+ ?> />
1917
+ <?php
1918
+ esc_html_e( 'Add the cart data to the conversion event', 'woocommerce-google-adwords-conversion-tracking-tag' );
1919
+ ?>
1920
+ </label>
1921
+ <?php
1922
+ $this->get_status_icon_new( $this->options['google']['ads']['add_cart_data'], $this->add_to_cart_requirements_fulfilled() );
1923
+
1924
+ if ( !$this->add_to_cart_requirements_fulfilled() ) {
1925
+ ?>
1926
+ <p><span class="dashicons dashicons-info"></span>
1927
+ <?php
1928
+ esc_html_e( 'Requires an active Google Ads Conversion ID, an active Conversion Label and an active Google Merchant Center ID (aw_merchant_id)', 'woocommerce-google-adwords-conversion-tracking-tag' );
1929
+ ?>
1930
+ </p>
1931
+ <?php
1932
+ }
1933
+
1934
+ }
1935
+
1936
  public function wpm_setting_html_order_duplication_prevention()
1937
  {
1938
  // adding the hidden input is a hack to make WordPress save the option with the value zero,
2257
  esc_html_e( 'ID of your Google Merchant Center account. It looks like this: 12345678', 'woocommerce-google-adwords-conversion-tracking-tag' );
2258
  }
2259
 
2260
+ public function wgact_plugin_setting_aw_feed_country()
2261
+ {
2262
+ ?>
2263
+ <b><?php
2264
+ esc_html_e( $this->get_visitor_country() );
2265
+ ?></b>
2266
+ <div style="margin-top:10px">
2267
+ <?php
2268
+ esc_html_e( 'Currently the plugin automatically detects the location of the visitor for this setting. In most, if not all, cases this will work fine. Please let us know if you have a use case where you need another output:', 'woocommerce-google-adwords-conversion-tracking-tag' );
2269
+ ?>
2270
+ <a href="mailto:support@sweetcode.com">support@sweetcode.com</a>
2271
+ </div>
2272
+ <?php
2273
+ }
2274
+
2275
+ // dupe in pixel
2276
+ public function get_visitor_country()
2277
+ {
2278
+
2279
+ if ( $this->is_localhost() ) {
2280
+ // error_log('check external ip');
2281
+ $this->ip = WC_Geolocation::get_external_ip_address();
2282
+ } else {
2283
+ // error_log('check regular ip');
2284
+ $this->ip = WC_Geolocation::get_ip_address();
2285
+ }
2286
+
2287
+ $location = WC_Geolocation::geolocate_ip( $this->ip );
2288
+ // error_log ('ip: ' . $this->>$ip);
2289
+ // error_log ('country: ' . $location['country']);
2290
+ return $location['country'];
2291
+ }
2292
+
2293
+ // dupe in pixel
2294
+ public function is_localhost()
2295
+ {
2296
+ $_server = filter_input_array( INPUT_SERVER, FILTER_SANITIZE_STRING );
2297
+ return in_array( $_server['REMOTE_ADDR'], [ '127.0.0.1', '::1' ] );
2298
+ }
2299
+
2300
+ public function wgact_plugin_setting_aw_feed_language()
2301
+ {
2302
+ ?>
2303
+ <b><?php
2304
+ esc_html_e( $this->get_gmc_language() );
2305
+ ?></b>
2306
+ <div style="margin-top:10px">
2307
+ <?php
2308
+ esc_html_e( 'The plugin will use the WordPress default language for this setting. If the shop uses translations, in theory we could also use the visitors locale. But, if that language is not set up in the Google Merchant Center we might run into issues. If you need more options here let us know:', 'woocommerce-google-adwords-conversion-tracking-tag' );
2309
+ ?>
2310
+ <a href=\"mailto:support@sweetcode.com\">support@sweetcode.com</a>
2311
+ </div>
2312
+ <?php
2313
+ }
2314
+
2315
+ // dupe in pixel
2316
+ public function get_gmc_language()
2317
+ {
2318
+ return strtoupper( substr( get_locale(), 0, 2 ) );
2319
+ }
2320
+
2321
  public function wpm_plugin_option_product_identifier()
2322
  {
2323
  ?>
2569
 
2570
  if ( !$this->validations->is_facebook_pixel_id( $input['facebook']['pixel_id'] ) ) {
2571
  $input['facebook']['pixel_id'] = ( isset( $this->options['facebook']['pixel_id'] ) ? $this->options['facebook']['pixel_id'] : '' );
2572
+ add_settings_error( 'wgact_plugin_options', 'invalid-facebook-pixel-id', esc_html__( 'You have entered an invalid Facebook pixel ID. It only contains 14 to 16 digits.', 'woocommerce-google-adwords-conversion-tracking-tag' ) );
2573
  }
2574
 
2575
  }
2578
 
2579
  if ( !$this->validations->is_facebook_capi_token( $input['facebook']['capi']['token'] ) ) {
2580
  $input['facebook']['capi']['token'] = ( isset( $this->options['facebook']['capi']['token'] ) ? $this->options['facebook']['capi']['token'] : '' );
2581
+ add_settings_error( 'wgact_plugin_options', 'invalid-facebook-pixel-id', esc_html__( 'You have entered an invalid Facebook CAPI token.', 'woocommerce-google-adwords-conversion-tracking-tag' ) );
2582
  }
2583
 
2584
  }
classes/admin/class-ask-for-rating.php CHANGED
@@ -36,7 +36,7 @@ class Ask_For_Rating {
36
  // server side php ajax handler for the admin rating notice
37
  public function ajax_rating_notice_handler() {
38
 
39
- $_post = filter_input_array(INPUT_POST, FILTER_SANITIZE_FULL_SPECIAL_CHARS);
40
 
41
  $set = $_post['set'];
42
 
@@ -151,7 +151,7 @@ class Ask_For_Rating {
151
  <?php esc_html_e('I already did', 'woocommerce-google-adwords-conversion-tracking-tag'); ?>
152
  </a>
153
  </div>
154
- <div style="white-space:normal; bottom:0; right: 0; margin-bottom: 0; margin-right: 5px;align-self: flex-end;">
155
  <a href="<?php echo esc_url(( new Documentation() )->get_link('the_dismiss_button_doesnt_work_why')); ?>"
156
  target="_blank">
157
  <?php esc_html_e('If the dismiss button is not working, here\'s why >>', 'woocommerce-google-adwords-conversion-tracking-tag'); ?>
36
  // server side php ajax handler for the admin rating notice
37
  public function ajax_rating_notice_handler() {
38
 
39
+ $_post = filter_input_array(INPUT_POST, FILTER_SANITIZE_STRING);
40
 
41
  $set = $_post['set'];
42
 
151
  <?php esc_html_e('I already did', 'woocommerce-google-adwords-conversion-tracking-tag'); ?>
152
  </a>
153
  </div>
154
+ <div style="white-space:normal; bottom:0; right: 0; margin-bottom: 0px; margin-right: 5px;align-self: flex-end;">
155
  <a href="<?php echo esc_url(( new Documentation() )->get_link('the_dismiss_button_doesnt_work_why')); ?>"
156
  target="_blank">
157
  <?php esc_html_e('If the dismiss button is not working, here\'s why >>', 'woocommerce-google-adwords-conversion-tracking-tag'); ?>
classes/admin/class-environment-check.php CHANGED
@@ -340,7 +340,7 @@ class Environment_Check {
340
 
341
  public function ajax_environment_check_handler() {
342
 
343
- $_post = filter_input_array(INPUT_POST, FILTER_SANITIZE_FULL_SPECIAL_CHARS);
344
 
345
  if (isset($_post['set'])) {
346
 
@@ -594,7 +594,7 @@ class Environment_Check {
594
 
595
  public function is_hosting_cloudways() {
596
 
597
- $_server = filter_input_array(INPUT_SERVER, FILTER_SANITIZE_FULL_SPECIAL_CHARS);
598
 
599
  return array_key_exists('cw_allowed_ip', $_server) || preg_match('~/home/.*?cloudways.*~', __FILE__);
600
  }
340
 
341
  public function ajax_environment_check_handler() {
342
 
343
+ $_post = filter_input_array(INPUT_POST, FILTER_SANITIZE_STRING);
344
 
345
  if (isset($_post['set'])) {
346
 
594
 
595
  public function is_hosting_cloudways() {
596
 
597
+ $_server = filter_input_array(INPUT_SERVER, FILTER_SANITIZE_STRING);
598
 
599
  return array_key_exists('cw_allowed_ip', $_server) || preg_match('~/home/.*?cloudways.*~', __FILE__);
600
  }
classes/admin/class-notifications.php CHANGED
@@ -125,7 +125,7 @@ class Notifications {
125
  <div id="wpm-paypal-standard-error-dismissal-button" class="button" style="white-space:normal;">
126
  <?php esc_html_e('Click here to dismiss this warning forever', 'woocommerce-google-adwords-conversion-tracking-tag'); ?>
127
  </div>
128
- <div style="white-space:normal; bottom:0; right: 0; margin-bottom: 0; margin-right: 5px;align-self: flex-end;">
129
  <a href="<?php echo esc_url(( new Documentation() )->get_link('the_dismiss_button_doesnt_work_why')); ?>"
130
  target="_blank">
131
  <?php esc_html_e('If the dismiss button is not working, here\'s why >>', 'woocommerce-google-adwords-conversion-tracking-tag'); ?>
@@ -174,7 +174,7 @@ class Notifications {
174
  data-plugin-slug="<?php echo esc_js($slug); ?>">
175
  <?php esc_html_e('Click here to dismiss this warning forever', 'woocommerce-google-adwords-conversion-tracking-tag'); ?>
176
  </div>
177
- <div style="white-space:normal; bottom:0; right: 0; margin-bottom: 0; margin-right: 5px;align-self: flex-end;">
178
  <a href="<?php echo esc_url(( new Documentation() )->get_link('the_dismiss_button_doesnt_work_why')); ?>"
179
  target="_blank">
180
  <?php esc_html_e('If the dismiss button is not working, here\'s why >>', 'woocommerce-google-adwords-conversion-tracking-tag'); ?>
125
  <div id="wpm-paypal-standard-error-dismissal-button" class="button" style="white-space:normal;">
126
  <?php esc_html_e('Click here to dismiss this warning forever', 'woocommerce-google-adwords-conversion-tracking-tag'); ?>
127
  </div>
128
+ <div style="white-space:normal; bottom:0; right: 0; margin-bottom: 0px; margin-right: 5px;align-self: flex-end;">
129
  <a href="<?php echo esc_url(( new Documentation() )->get_link('the_dismiss_button_doesnt_work_why')); ?>"
130
  target="_blank">
131
  <?php esc_html_e('If the dismiss button is not working, here\'s why >>', 'woocommerce-google-adwords-conversion-tracking-tag'); ?>
174
  data-plugin-slug="<?php echo esc_js($slug); ?>">
175
  <?php esc_html_e('Click here to dismiss this warning forever', 'woocommerce-google-adwords-conversion-tracking-tag'); ?>
176
  </div>
177
+ <div style="white-space:normal; bottom:0; right: 0; margin-bottom: 0px; margin-right: 5px;align-self: flex-end;">
178
  <a href="<?php echo esc_url(( new Documentation() )->get_link('the_dismiss_button_doesnt_work_why')); ?>"
179
  target="_blank">
180
  <?php esc_html_e('If the dismiss button is not working, here\'s why >>', 'woocommerce-google-adwords-conversion-tracking-tag'); ?>
classes/pixels/class-cookie-consent-management.php CHANGED
@@ -88,7 +88,7 @@ class Cookie_Consent_Management {
88
  // return the cookie contents, if the cookie is set
89
  public function get_cookie( $cookie_name ) {
90
 
91
- $_cookie = filter_input_array(INPUT_COOKIE, FILTER_SANITIZE_FULL_SPECIAL_CHARS);
92
 
93
  return $_cookie[$cookie_name] ? $_cookie[$cookie_name] : null;
94
  }
@@ -121,7 +121,7 @@ class Cookie_Consent_Management {
121
  // https://wordpress.org/plugins/gdpr-cookie-compliance/
122
  public function is_moove_cookie_prevention_active() {
123
 
124
- $_cookie = filter_input_array(INPUT_COOKIE, FILTER_SANITIZE_FULL_SPECIAL_CHARS);
125
 
126
  if (isset($_cookie['moove_gdpr_popup'])) {
127
 
88
  // return the cookie contents, if the cookie is set
89
  public function get_cookie( $cookie_name ) {
90
 
91
+ $_cookie = filter_input_array(INPUT_COOKIE, FILTER_SANITIZE_STRING);
92
 
93
  return $_cookie[$cookie_name] ? $_cookie[$cookie_name] : null;
94
  }
121
  // https://wordpress.org/plugins/gdpr-cookie-compliance/
122
  public function is_moove_cookie_prevention_active() {
123
 
124
+ $_cookie = filter_input_array(INPUT_COOKIE, FILTER_SANITIZE_STRING);
125
 
126
  if (isset($_cookie['moove_gdpr_popup'])) {
127
 
classes/pixels/class-pixel-manager.php CHANGED
@@ -4,9 +4,9 @@ namespace WCPM\Classes\Pixels;
4
 
5
  use WCPM\Classes\Pixels\Facebook\Facebook_Pixel_Manager ;
6
  use WCPM\Classes\Pixels\Facebook\Facebook_Pixel_Manager_Microdata ;
7
- use WCPM\Classes\Pixels\Google\Google ;
8
  use WCPM\Classes\Pixels\Google\Google_Analytics_Refund ;
9
  use WCPM\Classes\Pixels\Google\Google_Pixel_Manager ;
 
10
 
11
  if ( !defined( 'ABSPATH' ) ) {
12
  exit;
@@ -16,6 +16,7 @@ if ( !defined( 'ABSPATH' ) ) {
16
  class Pixel_Manager extends Script_Manager
17
  {
18
  use Trait_Product ;
 
19
  use Trait_Shop ;
20
  protected $options ;
21
  protected $options_obj ;
@@ -25,7 +26,6 @@ class Pixel_Manager extends Script_Manager
25
  protected $dyn_r_ids ;
26
  protected $transaction_deduper_timeout = 1000 ;
27
  protected $position = 1 ;
28
- protected $google ;
29
  public function __construct( $options )
30
  {
31
  /**
@@ -38,9 +38,7 @@ class Pixel_Manager extends Script_Manager
38
  * Set a few states
39
  */
40
  $this->facebook_active = !empty($this->options_obj->facebook->pixel_id);
41
- // $this->google_active = $this->google_active();
42
- $this->google = new Google( $this->options );
43
- $this->google_active = $this->google->google_active();
44
  /**
45
  * Inject pixel snippets in head
46
  */
@@ -70,9 +68,7 @@ class Pixel_Manager extends Script_Manager
70
  /**
71
  * Front-end script section
72
  */
73
- if ( $this->track_user() ) {
74
- add_action( 'wp_enqueue_scripts', [ $this, 'wpm_front_end_scripts' ] );
75
- }
76
  add_action( 'wp_ajax_wpm_get_cart_items', [ $this, 'ajax_wpm_get_cart_items' ] );
77
  add_action( 'wp_ajax_nopriv_wpm_get_cart_items', [ $this, 'ajax_wpm_get_cart_items' ] );
78
  add_action( 'wp_ajax_wpm_get_product_ids', [ $this, 'ajax_wpm_get_product_ids' ] );
@@ -242,7 +238,7 @@ class Pixel_Manager extends Script_Manager
242
  {
243
  ?>
244
 
245
- <script>
246
 
247
  window.wpmDataLayer = window.wpmDataLayer || {}
248
  window.wpmDataLayer = <?php
@@ -283,7 +279,7 @@ class Pixel_Manager extends Script_Manager
283
  ],
284
  'google' => [
285
  'ads' => [
286
- 'conversionIds' => (object) $this->google->get_google_ads_conversion_ids( is_order_received_page() ),
287
  'dynamic_remarketing' => [
288
  'status' => (bool) $this->options_obj->google->ads->dynamic_remarketing,
289
  'id_type' => $this->get_dyn_r_id_type( 'google' ),
@@ -294,29 +290,29 @@ class Pixel_Manager extends Script_Manager
294
  'wpm_send_events_with_parent_ids'
295
  ) ),
296
  ],
297
- 'google_business_vertical' => $this->google->get_google_business_vertical( $this->options['google']['ads']['google_business_vertical'] ),
298
  'phone_conversion_label' => $this->options_obj->google->ads->phone_conversion_label,
299
  'phone_conversion_number' => $this->options_obj->google->ads->phone_conversion_number,
300
  ],
301
  'analytics' => [
302
  'universal' => [
303
  'property_id' => $this->options_obj->google->analytics->universal->property_id,
304
- 'parameters' => (object) $this->google->get_ga_ua_parameters( $this->options_obj->google->analytics->universal->property_id ),
305
  'mp_active' => wpm_fs()->is__premium_only(),
306
  ],
307
  'ga4' => [
308
  'measurement_id' => $this->options_obj->google->analytics->ga4->measurement_id,
309
- 'parameters' => (object) $this->google->get_ga4_parameters( $this->options_obj->google->analytics->ga4->measurement_id ),
310
  'mp_active' => $this->options_obj->google->analytics->ga4->api_secret && wpm_fs()->is__premium_only(),
311
  ],
312
- 'id_type' => $this->google->get_ga_id_type(),
313
  'eec' => (bool) $this->options_obj->google->analytics->eec,
314
  ],
315
  'optimize' => [
316
  'container_id' => $this->options_obj->google->optimize->container_id,
317
  ],
318
  'linker' => [
319
- 'settings' => $this->google->get_google_linker_settings(),
320
  ],
321
  'user_id' => (bool) $this->options_obj->google->user_id,
322
  ],
@@ -334,7 +330,7 @@ class Pixel_Manager extends Script_Manager
334
  '1.13.0',
335
  'wpm_pinterest_enhanced_match'
336
  ) ),
337
- 'enhanced_match_email' => $this->get_user_email(),
338
  ],
339
  'snapchat' => [
340
  'pixel_id' => $this->options_obj->snapchat->pixel_id,
@@ -360,8 +356,7 @@ class Pixel_Manager extends Script_Manager
360
  $data['shop'] = $this->get_shop_data();
361
  $data['general'] = $this->get_general_data();
362
  $data['user'] = $this->get_user_data();
363
- // Return and optionally modify the wpm data layer
364
- return apply_filters( 'wpm_experimental_data_layer', $data );
365
  }
366
 
367
  protected function get_order_data()
@@ -389,7 +384,7 @@ class Pixel_Manager extends Script_Manager
389
  'coupon' => implode( ',', $order->get_coupon_codes() ),
390
  'aw_merchant_id' => ( (int) $this->options['google']['ads']['aw_merchant_id'] ? (int) $this->options['google']['ads']['aw_merchant_id'] : '' ),
391
  'aw_feed_country' => (string) $this->get_visitor_country(),
392
- 'aw_feed_language' => (string) $this->google->get_gmc_language(),
393
  'new_customer' => !$this->is_existing_customer( $order ),
394
  'quantity' => (int) count( $this->wpm_get_order_items( $order ) ),
395
  'items' => $this->get_front_end_order_items( $order ),
@@ -560,7 +555,7 @@ class Pixel_Manager extends Script_Manager
560
 
561
  public function ajax_wpm_get_product_ids()
562
  {
563
- $_get = filter_input_array( INPUT_GET, FILTER_SANITIZE_FULL_SPECIAL_CHARS );
564
  $product_ids = $_get['productIds'];
565
 
566
  if ( !$product_ids ) {
@@ -595,7 +590,7 @@ class Pixel_Manager extends Script_Manager
595
  // error_log('Invalid security token sent.');
596
  // wp_die();
597
  // }
598
- $_post = filter_input_array( INPUT_POST, FILTER_SANITIZE_FULL_SPECIAL_CHARS );
599
  $order_id = $_post['order_id'];
600
  update_post_meta( $order_id, '_wpm_conversion_pixel_fired', true );
601
  wp_send_json_success();
@@ -749,5 +744,27 @@ class Pixel_Manager extends Script_Manager
749
  ];
750
  return $data;
751
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
752
 
753
  }
4
 
5
  use WCPM\Classes\Pixels\Facebook\Facebook_Pixel_Manager ;
6
  use WCPM\Classes\Pixels\Facebook\Facebook_Pixel_Manager_Microdata ;
 
7
  use WCPM\Classes\Pixels\Google\Google_Analytics_Refund ;
8
  use WCPM\Classes\Pixels\Google\Google_Pixel_Manager ;
9
+ use WCPM\Classes\Pixels\Google\Trait_Google ;
10
 
11
  if ( !defined( 'ABSPATH' ) ) {
12
  exit;
16
  class Pixel_Manager extends Script_Manager
17
  {
18
  use Trait_Product ;
19
+ use Trait_Google ;
20
  use Trait_Shop ;
21
  protected $options ;
22
  protected $options_obj ;
26
  protected $dyn_r_ids ;
27
  protected $transaction_deduper_timeout = 1000 ;
28
  protected $position = 1 ;
 
29
  public function __construct( $options )
30
  {
31
  /**
38
  * Set a few states
39
  */
40
  $this->facebook_active = !empty($this->options_obj->facebook->pixel_id);
41
+ $this->google_active = $this->google_active();
 
 
42
  /**
43
  * Inject pixel snippets in head
44
  */
68
  /**
69
  * Front-end script section
70
  */
71
+ add_action( 'wp_enqueue_scripts', [ $this, 'wpm_front_end_scripts' ] );
 
 
72
  add_action( 'wp_ajax_wpm_get_cart_items', [ $this, 'ajax_wpm_get_cart_items' ] );
73
  add_action( 'wp_ajax_nopriv_wpm_get_cart_items', [ $this, 'ajax_wpm_get_cart_items' ] );
74
  add_action( 'wp_ajax_wpm_get_product_ids', [ $this, 'ajax_wpm_get_product_ids' ] );
238
  {
239
  ?>
240
 
241
+ <script data-cfasync="false">
242
 
243
  window.wpmDataLayer = window.wpmDataLayer || {}
244
  window.wpmDataLayer = <?php
279
  ],
280
  'google' => [
281
  'ads' => [
282
+ 'conversionIds' => (object) $this->get_google_ads_conversion_ids( is_order_received_page() ),
283
  'dynamic_remarketing' => [
284
  'status' => (bool) $this->options_obj->google->ads->dynamic_remarketing,
285
  'id_type' => $this->get_dyn_r_id_type( 'google' ),
290
  'wpm_send_events_with_parent_ids'
291
  ) ),
292
  ],
293
+ 'google_business_vertical' => $this->get_google_business_vertical( $this->options['google']['ads']['google_business_vertical'] ),
294
  'phone_conversion_label' => $this->options_obj->google->ads->phone_conversion_label,
295
  'phone_conversion_number' => $this->options_obj->google->ads->phone_conversion_number,
296
  ],
297
  'analytics' => [
298
  'universal' => [
299
  'property_id' => $this->options_obj->google->analytics->universal->property_id,
300
+ 'parameters' => (object) $this->get_ga_ua_parameters( $this->options_obj->google->analytics->universal->property_id ),
301
  'mp_active' => wpm_fs()->is__premium_only(),
302
  ],
303
  'ga4' => [
304
  'measurement_id' => $this->options_obj->google->analytics->ga4->measurement_id,
305
+ 'parameters' => (object) $this->get_ga4_parameters( $this->options_obj->google->analytics->ga4->measurement_id ),
306
  'mp_active' => $this->options_obj->google->analytics->ga4->api_secret && wpm_fs()->is__premium_only(),
307
  ],
308
+ 'id_type' => $this->get_ga_id_type(),
309
  'eec' => (bool) $this->options_obj->google->analytics->eec,
310
  ],
311
  'optimize' => [
312
  'container_id' => $this->options_obj->google->optimize->container_id,
313
  ],
314
  'linker' => [
315
+ 'settings' => $this->get_google_linker_settings(),
316
  ],
317
  'user_id' => (bool) $this->options_obj->google->user_id,
318
  ],
330
  '1.13.0',
331
  'wpm_pinterest_enhanced_match'
332
  ) ),
333
+ 'enhanced_match_email' => $this->get_pinterest_enhanced_match_email(),
334
  ],
335
  'snapchat' => [
336
  'pixel_id' => $this->options_obj->snapchat->pixel_id,
356
  $data['shop'] = $this->get_shop_data();
357
  $data['general'] = $this->get_general_data();
358
  $data['user'] = $this->get_user_data();
359
+ return $data;
 
360
  }
361
 
362
  protected function get_order_data()
384
  'coupon' => implode( ',', $order->get_coupon_codes() ),
385
  'aw_merchant_id' => ( (int) $this->options['google']['ads']['aw_merchant_id'] ? (int) $this->options['google']['ads']['aw_merchant_id'] : '' ),
386
  'aw_feed_country' => (string) $this->get_visitor_country(),
387
+ 'aw_feed_language' => (string) $this->get_gmc_language(),
388
  'new_customer' => !$this->is_existing_customer( $order ),
389
  'quantity' => (int) count( $this->wpm_get_order_items( $order ) ),
390
  'items' => $this->get_front_end_order_items( $order ),
555
 
556
  public function ajax_wpm_get_product_ids()
557
  {
558
+ $_get = filter_input_array( INPUT_GET, FILTER_SANITIZE_STRING );
559
  $product_ids = $_get['productIds'];
560
 
561
  if ( !$product_ids ) {
590
  // error_log('Invalid security token sent.');
591
  // wp_die();
592
  // }
593
+ $_post = filter_input_array( INPUT_POST, FILTER_SANITIZE_STRING );
594
  $order_id = $_post['order_id'];
595
  update_post_meta( $order_id, '_wpm_conversion_pixel_fired', true );
596
  wp_send_json_success();
744
  ];
745
  return $data;
746
  }
747
+
748
+ protected function get_pinterest_enhanced_match_email()
749
+ {
750
+
751
+ if ( is_user_logged_in() ) {
752
+ $current_user = wp_get_current_user();
753
+ $email = $current_user->user_email;
754
+ } elseif ( is_order_received_page() ) {
755
+ $order = $this->get_order_from_order_received_page();
756
+
757
+ if ( $order ) {
758
+ $email = $order->get_billing_email();
759
+ } else {
760
+ $email = '';
761
+ }
762
+
763
+ } else {
764
+ $email = '';
765
+ }
766
+
767
+ return $email;
768
+ }
769
 
770
  }
classes/pixels/class-pixel.php CHANGED
@@ -32,6 +32,7 @@ class Pixel {
32
  $this->options = $options;
33
  $this->options_obj = json_decode(wp_json_encode($this->options));
34
 
 
35
  $this->options_obj->shop->currency = get_woocommerce_currency();
36
 
37
  $this->order_total_logic = $this->options['shop']['order_total_logic'];
32
  $this->options = $options;
33
  $this->options_obj = json_decode(wp_json_encode($this->options));
34
 
35
+ $this->options_obj->shop->currency = new stdClass();
36
  $this->options_obj->shop->currency = get_woocommerce_currency();
37
 
38
  $this->order_total_logic = $this->options['shop']['order_total_logic'];
classes/pixels/class-script-manager.php CHANGED
@@ -40,7 +40,7 @@ class Script_Manager
40
  public function inject_head_pixels()
41
  {
42
  global $woocommerce ;
43
- $_post = filter_input_array( INPUT_POST, FILTER_SANITIZE_FULL_SPECIAL_CHARS );
44
  $this->inject_opening_script_tag();
45
  $this->inject_everywhere();
46
 
@@ -145,14 +145,34 @@ class Script_Manager
145
  // error_log('order number: ' . $order->get_order_number());
146
  // error_log('get_post_meta($order->get_order_number(), \'_wpm_conversion_pixel_fired\', true): ' . get_post_meta($order->get_order_number(), '_wpm_conversion_pixel_fired', true));
147
 
148
- if ( $this->is_nodedupe_parameter_set() || !$order->has_status( 'failed' ) && $this->track_user() && false == $conversion_prevention && (!$this->options['shop']['order_deduplication'] || $this->has_conversion_pixel_already_fired( $order ) != true) ) {
 
149
  return true;
150
  } else {
 
151
  return false;
152
  }
153
 
154
  }
155
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
156
  private function has_conversion_pixel_already_fired( $order )
157
  {
158
  return false;
@@ -192,7 +212,7 @@ class Script_Manager
192
 
193
  protected function is_nodedupe_parameter_set()
194
  {
195
- $_get = filter_input_array( INPUT_GET, FILTER_SANITIZE_FULL_SPECIAL_CHARS );
196
 
197
  if ( isset( $_get['nodedupe'] ) ) {
198
  return true;
@@ -204,7 +224,7 @@ class Script_Manager
204
 
205
  protected function query_string_contains_all_variation_attributes( $product )
206
  {
207
- $_server = filter_input_array( INPUT_SERVER, FILTER_SANITIZE_FULL_SPECIAL_CHARS );
208
 
209
  if ( !empty($_server['QUERY_STRING']) ) {
210
  parse_str( $_server['QUERY_STRING'], $query_string_attributes );
@@ -222,7 +242,7 @@ class Script_Manager
222
 
223
  protected function get_variation_from_query_string( $product_id, $product )
224
  {
225
- $_server = filter_input_array( INPUT_SERVER, FILTER_SANITIZE_FULL_SPECIAL_CHARS );
226
  parse_str( $_server['QUERY_STRING'], $query_string_attributes );
227
  $search_variation_attributes = [];
228
  foreach ( array_keys( $product->get_attributes() ) as $variation_attribute => $value ) {
40
  public function inject_head_pixels()
41
  {
42
  global $woocommerce ;
43
+ $_post = filter_input_array( INPUT_POST, FILTER_SANITIZE_STRING );
44
  $this->inject_opening_script_tag();
45
  $this->inject_everywhere();
46
 
145
  // error_log('order number: ' . $order->get_order_number());
146
  // error_log('get_post_meta($order->get_order_number(), \'_wpm_conversion_pixel_fired\', true): ' . get_post_meta($order->get_order_number(), '_wpm_conversion_pixel_fired', true));
147
 
148
+ if ( $this->is_nodedupe_parameter_set() || !$order->has_status( 'failed' ) && $this->track_current_user() && false == $conversion_prevention && (!$this->options['shop']['order_deduplication'] || $this->has_conversion_pixel_already_fired( $order ) != true) ) {
149
+ // error_log('fire pixels: true' . PHP_EOL);
150
  return true;
151
  } else {
152
+ // error_log('fire pixels: false' . PHP_EOL);
153
  return false;
154
  }
155
 
156
  }
157
 
158
+ protected function track_current_user()
159
+ {
160
+
161
+ if ( is_user_logged_in() ) {
162
+ $user = wp_get_current_user();
163
+ // getting & setting the current user
164
+ $roles = $user->roles;
165
+ // obtaining the role
166
+ foreach ( $roles as $role ) {
167
+ if ( in_array( $role, $this->options_obj->shop->disable_tracking_for, true ) ) {
168
+ return false;
169
+ }
170
+ }
171
+ }
172
+
173
+ return true;
174
+ }
175
+
176
  private function has_conversion_pixel_already_fired( $order )
177
  {
178
  return false;
212
 
213
  protected function is_nodedupe_parameter_set()
214
  {
215
+ $_get = filter_input_array( INPUT_GET, FILTER_SANITIZE_STRING );
216
 
217
  if ( isset( $_get['nodedupe'] ) ) {
218
  return true;
224
 
225
  protected function query_string_contains_all_variation_attributes( $product )
226
  {
227
+ $_server = filter_input_array( INPUT_SERVER, FILTER_SANITIZE_STRING );
228
 
229
  if ( !empty($_server['QUERY_STRING']) ) {
230
  parse_str( $_server['QUERY_STRING'], $query_string_attributes );
242
 
243
  protected function get_variation_from_query_string( $product_id, $product )
244
  {
245
+ $_server = filter_input_array( INPUT_SERVER, FILTER_SANITIZE_STRING );
246
  parse_str( $_server['QUERY_STRING'], $query_string_attributes );
247
  $search_variation_attributes = [];
248
  foreach ( array_keys( $product->get_attributes() ) as $variation_attribute => $value ) {
classes/pixels/class-shortcodes.php CHANGED
@@ -2,22 +2,19 @@
2
 
3
  namespace WCPM\Classes\Pixels;
4
 
5
- use WCPM\Classes\Pixels\Google\Google;
6
 
7
  if (!defined('ABSPATH')) {
8
  exit; // Exit if accessed directly
9
  }
10
 
11
  class Shortcodes extends Pixel {
 
12
  use Trait_Product;
13
 
14
- private $google;
15
-
16
  public function __construct( $options ) {
17
  parent::__construct($options);
18
 
19
- $this->google = new Google($options);
20
-
21
  add_shortcode('view-item', [$this, 'wpm_view_item']);
22
  add_shortcode('conversion-pixel', [$this, 'wpm_conversion_pixel']);
23
  }
@@ -42,9 +39,9 @@ class Shortcodes extends Pixel {
42
  ?>
43
 
44
  <script>
45
- jQuery(window).on("wpmLoad", function () {
46
- jQuery(document).trigger("wpmViewItem", wpm.getProductDetailsFormattedForEvent(<?php echo esc_js($shortcode_attributes['product-id']); ?>))
47
- })
48
  </script>
49
  <?php
50
  }
@@ -72,10 +69,10 @@ class Shortcodes extends Pixel {
72
  $shortcode_attributes = shortcode_atts($pairs, $attributes);
73
 
74
  if ('google-ads' === $shortcode_attributes['pixel']) {
75
- if ($this->google->is_google_ads_active()) {
76
  $this->conversion_html_google_ads($shortcode_attributes);
77
  }
78
- } elseif ('facebook' === $shortcode_attributes['pixel'] || 'meta' === $shortcode_attributes['pixel']) {
79
  if ($this->options_obj->facebook->pixel_id) {
80
  $this->conversion_html_facebook($shortcode_attributes);
81
  }
@@ -100,7 +97,7 @@ class Shortcodes extends Pixel {
100
  $this->conversion_html_tiktok($shortcode_attributes);
101
  }
102
  } elseif ('all' === $shortcode_attributes['pixel']) {
103
- if ($this->google->is_google_ads_active()) {
104
  $this->conversion_html_google_ads($shortcode_attributes);
105
  }
106
  if ($this->options_obj->facebook->pixel_id) {
@@ -129,9 +126,9 @@ class Shortcodes extends Pixel {
129
  ?>
130
 
131
  <script>
132
- wpmFunctionExists("snaptr").then(function () {
133
- snaptr("track", '<?php echo esc_js($shortcode_attributes['snap-event']); ?>')
134
- },
135
  )
136
  </script>
137
  <?php
@@ -142,9 +139,9 @@ class Shortcodes extends Pixel {
142
  ?>
143
 
144
  <script>
145
- wpmFunctionExists("ttq").then(function () {
146
- ttq.track('<?php echo esc_js($shortcode_attributes['tiktok-event']); ?>')
147
- },
148
  )
149
  </script>
150
  <?php
@@ -155,9 +152,9 @@ class Shortcodes extends Pixel {
155
  ?>
156
 
157
  <script>
158
- wpmFunctionExists("gtag").then(function () {
159
- if (wpm.googleConfigConditionsMet("ads")) gtag("event", "conversion", {"send_to": 'AW-<?php echo esc_js($shortcode_attributes['gads-conversion-id']); ?>/<?php echo esc_js($shortcode_attributes['gads-conversion-label']); ?>'})
160
- },
161
  )
162
  </script>
163
  <?php
@@ -170,24 +167,24 @@ class Shortcodes extends Pixel {
170
  ?>
171
 
172
  <script>
173
- jQuery(window).on("wpmLoad", function () {
174
 
175
- let eventId = wpm.getRandomEventId()
176
 
177
- wpmFunctionExists("fbq").then(function () {
178
- fbq("track", '<?php echo esc_js($shortcode_attributes['fbc-event']); ?>', {}, {
179
  eventID: eventId,
180
- })
181
- },
182
  )
183
 
184
- jQuery(document).trigger("wpmFbCapiEvent", {
185
  event_name : "<?php echo esc_js($shortcode_attributes['fbc-event']); ?>",
186
  event_id : eventId,
187
  user_data : wpm.getFbUserData(),
188
- event_source_url: window.location.href,
189
- })
190
- })
191
 
192
  </script>
193
  <?php
@@ -195,9 +192,9 @@ class Shortcodes extends Pixel {
195
  ?>
196
 
197
  <script>
198
- wpmFunctionExists("fbq").then(function () {
199
- fbq("track", '<?php echo esc_js($shortcode_attributes['fbc-event']); ?>')
200
- },
201
  )
202
  </script>
203
  <?php
@@ -210,9 +207,9 @@ class Shortcodes extends Pixel {
210
  ?>
211
 
212
  <script>
213
- wpmFunctionExists("twq").then(function () {
214
- twq("track", '<?php echo esc_js($shortcode_attributes['twc-event']); ?>')
215
- },
216
  )
217
  </script>
218
  <?php
@@ -226,9 +223,9 @@ class Shortcodes extends Pixel {
226
  ?>
227
 
228
  <script>
229
- wpmFunctionExists("pintrk").then(function () {
230
- pintrk("track", '<?php echo esc_js($shortcode_attributes['pinc-event']); ?>')
231
- },
232
  )
233
  </script>
234
  <?php
@@ -236,11 +233,11 @@ class Shortcodes extends Pixel {
236
  ?>
237
 
238
  <script>
239
- wpmFunctionExists("pintrk").then(function () {
240
- pintrk("track", '<?php echo esc_js($shortcode_attributes['pinc-event']); ?>', {
241
- lead_type: '<?php echo esc_js($shortcode_attributes['pinc-lead-type']); ?>',
242
- })
243
- },
244
  )
245
  </script>
246
  <?php
@@ -252,14 +249,14 @@ class Shortcodes extends Pixel {
252
  ?>
253
 
254
  <script>
255
- wpmFunctionExists("uetq").then(function () {
256
- window.uetq = window.uetq || []
257
- window.uetq.push("event", '<?php echo esc_js($shortcode_attributes['ms-ads-event']); ?>', {
258
- "event_category": '<?php echo esc_js($shortcode_attributes['ms-ads-event-category']); ?>',
259
- "event_label" : '<?php echo esc_js($shortcode_attributes['ms-ads-event-label']); ?>',
260
- "event_value" : '<?php echo esc_js($shortcode_attributes['ms-ads-event-value']); ?>',
261
- })
262
- },
263
  )
264
  </script>
265
  <?php
@@ -269,14 +266,14 @@ class Shortcodes extends Pixel {
269
  ?>
270
 
271
  <script>
272
- if (typeof wpmFunctionExists !== "function") {
273
  window.wpmFunctionExists = function (functionName) {
274
  return new Promise(function (resolve) {
275
  (function waitForVar() {
276
- if (typeof window[functionName] !== "undefined") return resolve()
277
- setTimeout(waitForVar, 1000)
278
- })()
279
- })
280
  }
281
  }
282
  </script>
2
 
3
  namespace WCPM\Classes\Pixels;
4
 
5
+ use WCPM\Classes\Pixels\Google\Trait_Google;
6
 
7
  if (!defined('ABSPATH')) {
8
  exit; // Exit if accessed directly
9
  }
10
 
11
  class Shortcodes extends Pixel {
12
+ use Trait_Google;
13
  use Trait_Product;
14
 
 
 
15
  public function __construct( $options ) {
16
  parent::__construct($options);
17
 
 
 
18
  add_shortcode('view-item', [$this, 'wpm_view_item']);
19
  add_shortcode('conversion-pixel', [$this, 'wpm_conversion_pixel']);
20
  }
39
  ?>
40
 
41
  <script>
42
+ jQuery(window).on('wpmLoad', function () {
43
+ jQuery(document).trigger('wpmViewItem', wpm.getProductDetailsFormattedForEvent(<?php echo esc_js($shortcode_attributes['product-id']); ?>));
44
+ });
45
  </script>
46
  <?php
47
  }
69
  $shortcode_attributes = shortcode_atts($pairs, $attributes);
70
 
71
  if ('google-ads' === $shortcode_attributes['pixel']) {
72
+ if ($this->is_google_ads_active()) {
73
  $this->conversion_html_google_ads($shortcode_attributes);
74
  }
75
+ } elseif ('facebook' === $shortcode_attributes['pixel']) {
76
  if ($this->options_obj->facebook->pixel_id) {
77
  $this->conversion_html_facebook($shortcode_attributes);
78
  }
97
  $this->conversion_html_tiktok($shortcode_attributes);
98
  }
99
  } elseif ('all' === $shortcode_attributes['pixel']) {
100
+ if ($this->is_google_ads_active()) {
101
  $this->conversion_html_google_ads($shortcode_attributes);
102
  }
103
  if ($this->options_obj->facebook->pixel_id) {
126
  ?>
127
 
128
  <script>
129
+ wpmFunctionExists('snaptr').then(function () {
130
+ snaptr('track', '<?php echo esc_js($shortcode_attributes['snap-event']); ?>');
131
+ }
132
  )
133
  </script>
134
  <?php
139
  ?>
140
 
141
  <script>
142
+ wpmFunctionExists('ttq').then(function () {
143
+ ttq.track('<?php echo esc_js($shortcode_attributes['tiktok-event']); ?>');
144
+ }
145
  )
146
  </script>
147
  <?php
152
  ?>
153
 
154
  <script>
155
+ wpmFunctionExists('gtag').then(function () {
156
+ if (wpm.googleConfigConditionsMet('ads')) gtag('event', 'conversion', {'send_to': 'AW-<?php echo esc_js($shortcode_attributes['gads-conversion-id']); ?>/<?php echo esc_js($shortcode_attributes['gads-conversion-label']); ?>'});
157
+ }
158
  )
159
  </script>
160
  <?php
167
  ?>
168
 
169
  <script>
170
+ jQuery(window).on('wpmLoad', function () {
171
 
172
+ let eventId = wpm.getRandomEventId();
173
 
174
+ wpmFunctionExists('fbq').then(function () {
175
+ fbq('track', '<?php echo esc_js($shortcode_attributes['fbc-event']); ?>', {}, {
176
  eventID: eventId,
177
+ });
178
+ }
179
  )
180
 
181
+ jQuery(document).trigger('wpmFbCapiEvent', {
182
  event_name : "<?php echo esc_js($shortcode_attributes['fbc-event']); ?>",
183
  event_id : eventId,
184
  user_data : wpm.getFbUserData(),
185
+ event_source_url: window.location.href
186
+ });
187
+ });
188
 
189
  </script>
190
  <?php
192
  ?>
193
 
194
  <script>
195
+ wpmFunctionExists('fbq').then(function () {
196
+ fbq('track', '<?php echo esc_js($shortcode_attributes['fbc-event']); ?>');
197
+ }
198
  )
199
  </script>
200
  <?php
207
  ?>
208
 
209
  <script>
210
+ wpmFunctionExists('twq').then(function () {
211
+ twq('track', '<?php echo esc_js($shortcode_attributes['twc-event']); ?>');
212
+ }
213
  )
214
  </script>
215
  <?php
223
  ?>
224
 
225
  <script>
226
+ wpmFunctionExists('pintrk').then(function () {
227
+ pintrk('track', '<?php echo esc_js($shortcode_attributes['pinc-event']); ?>');
228
+ }
229
  )
230
  </script>
231
  <?php
233
  ?>
234
 
235
  <script>
236
+ wpmFunctionExists('pintrk').then(function () {
237
+ pintrk('track', '<?php echo esc_js($shortcode_attributes['pinc-event']); ?>', {
238
+ lead_type: '<?php echo esc_js($shortcode_attributes['pinc-lead-type']); ?>'
239
+ });
240
+ }
241
  )
242
  </script>
243
  <?php
249
  ?>
250
 
251
  <script>
252
+ wpmFunctionExists('uetq').then(function () {
253
+ window.uetq = window.uetq || [];
254
+ window.uetq.push('event', '<?php echo esc_js($shortcode_attributes['ms-ads-event']); ?>', {
255
+ 'event_category': '<?php echo esc_js($shortcode_attributes['ms-ads-event-category']); ?>',
256
+ 'event_label' : '<?php echo esc_js($shortcode_attributes['ms-ads-event-label']); ?>',
257
+ 'event_value' : '<?php echo esc_js($shortcode_attributes['ms-ads-event-value']); ?>'
258
+ });
259
+ }
260
  )
261
  </script>
262
  <?php
266
  ?>
267
 
268
  <script>
269
+ if (typeof wpmFunctionExists !== 'function') {
270
  window.wpmFunctionExists = function (functionName) {
271
  return new Promise(function (resolve) {
272
  (function waitForVar() {
273
+ if (typeof window[functionName] !== 'undefined') return resolve();
274
+ setTimeout(waitForVar, 1000);
275
+ })();
276
+ });
277
  }
278
  }
279
  </script>
classes/pixels/google/class-google-analytics-refund.php CHANGED
@@ -12,6 +12,7 @@ if ( !defined( 'ABSPATH' ) ) {
12
 
13
  class Google_Analytics_Refund extends Google_Analytics
14
  {
 
15
  public function __construct( $options )
16
  {
17
  parent::__construct( $options );
12
 
13
  class Google_Analytics_Refund extends Google_Analytics
14
  {
15
+ use Trait_Google ;
16
  public function __construct( $options )
17
  {
18
  parent::__construct( $options );
classes/pixels/google/class-google-pixel-manager.php CHANGED
@@ -13,9 +13,16 @@ if ( !defined( 'ABSPATH' ) ) {
13
 
14
  class Google_Pixel_Manager extends Script_Manager
15
  {
 
16
  private $google_pixel ;
 
 
 
 
17
  private $google_analytics_ua_http_mp ;
18
  private $google_analytics_4_http_mp ;
 
 
19
  private $cid_key_ga_ua ;
20
  private $cid_key_ga4 ;
21
  public function __construct( $options )
@@ -24,28 +31,16 @@ class Google_Pixel_Manager extends Script_Manager
24
  $this->google_pixel = new Google( $options );
25
  }
26
 
27
- protected function log_prevented_order_report_for_user( $order )
28
- {
29
-
30
- if ( is_user_logged_in() ) {
31
- $user_info = $order->get_user();
32
- wc_get_logger()->debug( 'Prevented order ID ' . $order->get_id() . ' to be reported through the Measurement Protocol for user ' . $user_info->user_login . ' (roles: ' . implode( ', ', $user_info->roles ) . ')', [
33
- 'source' => 'wpm',
34
- ] );
35
- }
36
-
37
- }
38
-
39
  public function inject_order_received_page_dedupe( $order, $order_total, $is_new_customer )
40
  {
41
- if ( $this->google_pixel->is_google_ads_active() && wpm_fs()->is__premium_only() ) {
42
  $this->save_gclid_in_order__premium_only( $order );
43
  }
44
  }
45
 
46
  public function inject_order_received_page_no_dedupe( $order, $order_total, $is_new_customer )
47
  {
48
- if ( $this->google_pixel->is_google_ads_active() && wpm_fs()->is__premium_only() ) {
49
  $this->save_gclid_in_order__premium_only( $order );
50
  }
51
  }
13
 
14
  class Google_Pixel_Manager extends Script_Manager
15
  {
16
+ use Trait_Google ;
17
  private $google_pixel ;
18
+ private $google_ads_pixel ;
19
+ private $google_analytics_ua_standard_pixel ;
20
+ private $google_analytics_4_standard_pixel ;
21
+ private $google_analytics_ua_eec_pixel ;
22
  private $google_analytics_ua_http_mp ;
23
  private $google_analytics_4_http_mp ;
24
+ // private $google_analytics_ua_refund_pixel;
25
+ private $google_analytics_4_eec_pixel ;
26
  private $cid_key_ga_ua ;
27
  private $cid_key_ga4 ;
28
  public function __construct( $options )
31
  $this->google_pixel = new Google( $options );
32
  }
33
 
 
 
 
 
 
 
 
 
 
 
 
 
34
  public function inject_order_received_page_dedupe( $order, $order_total, $is_new_customer )
35
  {
36
+ if ( $this->is_google_ads_active() && wpm_fs()->is__premium_only() ) {
37
  $this->save_gclid_in_order__premium_only( $order );
38
  }
39
  }
40
 
41
  public function inject_order_received_page_no_dedupe( $order, $order_total, $is_new_customer )
42
  {
43
+ if ( $this->is_google_ads_active() && wpm_fs()->is__premium_only() ) {
44
  $this->save_gclid_in_order__premium_only( $order );
45
  }
46
  }
classes/pixels/google/class-google.php CHANGED
@@ -2,405 +2,23 @@
2
 
3
  namespace WCPM\Classes\Pixels\Google;
4
 
5
- use WCPM\Classes\Admin\Environment_Check ;
6
- use WCPM\Classes\Pixels\Pixel ;
7
- use WCPM\Classes\Pixels\Trait_Shop ;
8
 
9
- if ( !defined( 'ABSPATH' ) ) {
10
- exit;
11
- // Exit if accessed directly
12
  }
13
 
14
- class Google extends Pixel
15
- {
16
- use Trait_Shop ;
17
- public function __construct( $options )
18
- {
19
- parent::__construct( $options );
20
- $this->google_business_vertical = $this->get_google_business_vertical( $this->options['google']['ads']['google_business_vertical'] );
21
- $this->pixel_name = 'google';
22
- }
23
-
24
- public function get_order_item_data( $order_item )
25
- {
26
- $product = $order_item->get_product();
27
-
28
- if ( !is_object( $product ) ) {
29
- wc_get_logger()->debug( 'get_order_item_data received an order item which is not a valid product: ' . $order_item->get_id(), [
30
- 'source' => 'wpm',
31
- ] );
32
- return [];
33
- }
34
-
35
- $dyn_r_ids = $this->get_dyn_r_ids( $product );
36
-
37
- if ( $product->get_type() === 'variation' ) {
38
- $parent_product = wc_get_product( $product->get_parent_id() );
39
- $name = $parent_product->get_name();
40
- } else {
41
- $name = $product->get_name();
42
- }
43
-
44
- return [
45
- 'id' => (string) $dyn_r_ids[$this->get_ga_id_type()],
46
- 'name' => (string) $name,
47
- 'quantity' => (int) $order_item['quantity'],
48
- 'affiliation' => (string) get_bloginfo( 'name' ),
49
- 'brand' => (string) $this->get_brand_name( $product->get_id() ),
50
- 'category' => implode( ',', $this->get_product_category( $product->get_id() ) ),
51
- 'category_array' => $this->get_product_category( $product->get_id() ),
52
- 'variant' => ( (string) ($product->get_type() === 'variation') ? $this->get_formatted_variant_text( $product ) : '' ),
53
- 'price' => (double) $this->wpm_get_order_item_price( $order_item, $product ),
54
- ];
55
- }
56
-
57
- public function get_ga_id_type()
58
- {
59
- $ga_id_type = 'post_id';
60
- $ga_id_type = apply_filters_deprecated(
61
- 'wooptpm_product_id_type_for_google_analytics',
62
- [ $ga_id_type ],
63
- '1.13.0',
64
- 'wpm_product_id_type_for_google_analytics'
65
- );
66
- // Change the output of the product ID type for Google Analytics
67
- return apply_filters( 'wpm_product_id_type_for_google_analytics', $ga_id_type );
68
- }
69
-
70
- public function google_active()
71
- {
72
-
73
- if ( $this->options_obj->google->analytics->universal->property_id ) {
74
- return true;
75
- } elseif ( $this->options_obj->google->analytics->ga4->measurement_id ) {
76
- return true;
77
- } elseif ( $this->options_obj->google->ads->conversion_id ) {
78
- return true;
79
- } else {
80
- return false;
81
- }
82
-
83
- }
84
-
85
- public function is_google_ads_active()
86
- {
87
-
88
- if ( $this->options['google']['ads']['conversion_id'] ) {
89
- return true;
90
- } else {
91
- return false;
92
- }
93
-
94
- }
95
-
96
- public function is_google_analytics_active()
97
- {
98
-
99
- if ( $this->is_google_analytics_ua_active() || $this->is_google_analytics_4_active() ) {
100
- return true;
101
- } else {
102
- return false;
103
- }
104
-
105
- }
106
-
107
- public function is_google_analytics_ua_active()
108
- {
109
-
110
- if ( $this->options_obj->google->analytics->universal->property_id ) {
111
- return true;
112
- } else {
113
- return false;
114
- }
115
-
116
- }
117
-
118
- protected function is_google_analytics_4_active()
119
- {
120
-
121
- if ( $this->options_obj->google->analytics->ga4->measurement_id ) {
122
- return true;
123
- } else {
124
- return false;
125
- }
126
-
127
- }
128
-
129
- public function is_google_analytics_4_mp_active()
130
- {
131
-
132
- if ( $this->options_obj->google->analytics->ga4->measurement_id && $this->options_obj->google->analytics->ga4->api_secret ) {
133
- return true;
134
- } else {
135
- return false;
136
- }
137
-
138
- }
139
-
140
- public function wpm_get_order_item_price( $order_item, $product )
141
- {
142
-
143
- if ( ( new Environment_Check( $this->options ) )->is_woo_discount_rules_active() ) {
144
- $item_value = $order_item->get_meta( '_advanced_woo_discount_item_total_discount' );
145
-
146
- if ( is_array( $item_value ) && array_key_exists( 'discounted_price', $item_value ) && 0 != $item_value['discounted_price'] ) {
147
- return (double) $item_value['discounted_price'];
148
- } elseif ( is_array( $item_value ) && array_key_exists( 'initial_price', $item_value ) && 0 != $item_value['initial_price'] ) {
149
- return (double) $item_value['initial_price'];
150
- } else {
151
- return (double) $product->get_price();
152
- }
153
-
154
- } else {
155
- return (double) $product->get_price();
156
- }
157
-
158
- }
159
-
160
- public function add_categories_to_ga4_product_items( $item_details_array, $categories )
161
- {
162
- $categories = array_unique( $categories );
163
-
164
- if ( count( $categories ) > 0 ) {
165
- $max_categories = 5;
166
- $item_details_array['item_category'] = $categories[0];
167
- $max = ( count( $categories ) > $max_categories ? $max_categories : count( $categories ) );
168
- for ( $i = 1 ; $i < $max ; $i++ ) {
169
- $item_details_array['item_category' . ($i + 1)] = $categories[$i];
170
- }
171
- }
172
-
173
- return $item_details_array;
174
- }
175
-
176
- public function get_google_business_vertical( $id )
177
- {
178
- $verticals = [
179
- 0 => 'retail',
180
- 1 => 'education',
181
- 2 => 'flights',
182
- 3 => 'hotel_rental',
183
- 4 => 'jobs',
184
- 5 => 'local',
185
- 6 => 'real_estate',
186
- 7 => 'travel',
187
- 8 => 'custom',
188
- ];
189
- return $verticals[$id];
190
- }
191
-
192
- public function get_google_ads_conversion_ids( $purchase = false )
193
- {
194
- $this->google_ads_conversion_identifiers[$this->options['google']['ads']['conversion_id']] = $this->options['google']['ads']['conversion_label'];
195
- $this->google_ads_conversion_identifiers = apply_filters_deprecated(
196
- 'wgact_google_ads_conversion_identifiers',
197
- [ $this->google_ads_conversion_identifiers ],
198
- '1.10.2',
199
- 'wooptpm_google_ads_conversion_identifiers'
200
- );
201
- $this->google_ads_conversion_identifiers = apply_filters_deprecated(
202
- 'wooptpm_google_ads_conversion_identifiers',
203
- [ $this->google_ads_conversion_identifiers ],
204
- '1.13.0',
205
- 'wpm_google_ads_conversion_identifiers'
206
- );
207
- $this->google_ads_conversion_identifiers = apply_filters( 'wpm_google_ads_conversion_identifiers', $this->google_ads_conversion_identifiers );
208
- $formatted_conversion_ids = [];
209
-
210
- if ( $purchase ) {
211
- foreach ( $this->google_ads_conversion_identifiers as $conversion_id => $conversion_label ) {
212
- $conversion_id = $this->extract_google_ads_id( $conversion_id );
213
- if ( $conversion_id ) {
214
- $formatted_conversion_ids['AW-' . $conversion_id] = $conversion_label;
215
- }
216
- }
217
- } else {
218
- foreach ( $this->google_ads_conversion_identifiers as $conversion_id => $conversion_label ) {
219
- $conversion_id = $this->extract_google_ads_id( $conversion_id );
220
- if ( $conversion_id ) {
221
- $formatted_conversion_ids['AW-' . $conversion_id] = '';
222
- }
223
- }
224
- }
225
-
226
- return $formatted_conversion_ids;
227
- }
228
-
229
- protected function extract_google_ads_id( $string )
230
- {
231
- $re = '/\\d{9,11}/';
232
-
233
- if ( $string ) {
234
- preg_match(
235
- $re,
236
- $string,
237
- $matches,
238
- PREG_OFFSET_CAPTURE,
239
- 0
240
- );
241
- if ( is_array( $matches[0] ) ) {
242
- return $matches[0][0];
243
- }
244
- }
245
-
246
- return '';
247
- }
248
-
249
- public function get_google_ads_enhanced_conversion_data( $order )
250
- {
251
- $customer_data = [];
252
- if ( $order->get_billing_email() ) {
253
- $customer_data['email'] = (string) $order->get_billing_email();
254
- }
255
- if ( $order->get_billing_phone() ) {
256
- $customer_data['phone_number'] = $this->get_e164_formatted_phone_number( (string) $order->get_billing_phone(), (string) $order->get_billing_country() );
257
- }
258
-
259
- if ( $this->are_billing_and_shipping_addresses_equal( $order ) ) {
260
- $customer_data['address'] = $this->get_billing_address_details( $order );
261
- } else {
262
- $customer_data['address'][] = $this->get_billing_address_details( $order );
263
- $customer_data['address'][] = $this->get_shipping_address_details( $order );
264
- }
265
-
266
- return $customer_data;
267
- }
268
-
269
- protected function get_billing_address_details( $order )
270
- {
271
- $customer_data = [];
272
- if ( $order->get_billing_first_name() ) {
273
- $customer_data['first_name'] = (string) $order->get_billing_first_name();
274
- }
275
- if ( $order->get_billing_last_name() ) {
276
- $customer_data['last_name'] = (string) $order->get_billing_last_name();
277
- }
278
- if ( $order->get_billing_address_1() ) {
279
- $customer_data['street'] = (string) $order->get_billing_address_1();
280
- }
281
- if ( $order->get_billing_city() ) {
282
- $customer_data['city'] = (string) $order->get_billing_city();
283
- }
284
- if ( $order->get_billing_state() ) {
285
- $customer_data['region'] = (string) $order->get_billing_state();
286
- }
287
- if ( $order->get_billing_postcode() ) {
288
- $customer_data['postal_code'] = (string) $order->get_billing_postcode();
289
- }
290
- if ( $order->get_billing_country() ) {
291
- $customer_data['country'] = (string) $order->get_billing_country();
292
- }
293
- return $customer_data;
294
- }
295
-
296
- protected function get_shipping_address_details( $order )
297
- {
298
- $customer_data = [];
299
- if ( $order->get_shipping_first_name() ) {
300
- $customer_data['first_name'] = (string) $order->get_shipping_first_name();
301
- }
302
- if ( $order->get_shipping_last_name() ) {
303
- $customer_data['last_name'] = (string) $order->get_shipping_last_name();
304
- }
305
- if ( $order->get_shipping_address_1() ) {
306
- $customer_data['street'] = (string) $order->get_shipping_address_1();
307
- }
308
- if ( $order->get_shipping_city() ) {
309
- $customer_data['city'] = (string) $order->get_shipping_city();
310
- }
311
- if ( $order->get_shipping_state() ) {
312
- $customer_data['region'] = (string) $order->get_shipping_state();
313
- }
314
- if ( $order->get_shipping_postcode() ) {
315
- $customer_data['postal_code'] = (string) $order->get_shipping_postcode();
316
- }
317
- if ( $order->get_shipping_country() ) {
318
- $customer_data['country'] = (string) $order->get_shipping_country();
319
- }
320
- return $customer_data;
321
- }
322
-
323
- private function are_billing_and_shipping_addresses_equal( $order )
324
- {
325
-
326
- if ( $order->get_billing_first_name() === $order->get_shipping_first_name() && $order->get_billing_last_name() === $order->get_shipping_last_name() && $order->get_billing_address_1() === $order->get_shipping_address_1() && $order->get_billing_city() === $order->get_shipping_city() && $order->get_billing_state() === $order->get_shipping_state() && $order->get_billing_postcode() === $order->get_shipping_postcode() && $order->get_billing_country() === $order->get_shipping_country() ) {
327
- return true;
328
- } else {
329
- return false;
330
- }
331
-
332
- }
333
-
334
- public function get_gmc_language()
335
- {
336
- return strtoupper( substr( get_locale(), 0, 2 ) );
337
- }
338
-
339
- // https://developers.google.com/gtagjs/devguide/linker
340
- public function get_google_linker_settings()
341
- {
342
- $linker_settings = apply_filters_deprecated(
343
- 'wooptpm_google_cross_domain_linker_settings',
344
- [ null ],
345
- '1.13.0',
346
- 'wpm_google_cross_domain_linker_settings'
347
- );
348
- return apply_filters( 'wpm_google_cross_domain_linker_settings', $linker_settings );
349
- }
350
-
351
- public function get_ga4_parameters( $id )
352
- {
353
- $ga_4_parameters = [];
354
- if ( $this->options_obj->google->user_id && is_user_logged_in() ) {
355
- $ga_4_parameters = [
356
- 'user_id' => get_current_user_id(),
357
- ];
358
- }
359
- $ga_4_parameters = apply_filters_deprecated(
360
- 'wooptpm_ga_4_parameters',
361
- [ $ga_4_parameters, $id ],
362
- '1.13.0',
363
- 'wpm_ga_4_parameters'
364
- );
365
- return apply_filters( 'wpm_ga_4_parameters', $ga_4_parameters, $id );
366
- }
367
-
368
- public function get_ga_ua_parameters( $id )
369
- {
370
- $ga_ua_parameters = [
371
- 'anonymize_ip' => true,
372
- 'link_attribution' => (bool) $this->options_obj->google->analytics->link_attribution,
373
- ];
374
- if ( $this->options_obj->google->user_id && is_user_logged_in() ) {
375
- $ga_ua_parameters['user_id'] = get_current_user_id();
376
- }
377
- $ga_ua_parameters = apply_filters_deprecated(
378
- 'woopt_pm_analytics_parameters',
379
- [ $ga_ua_parameters, $id ],
380
- '1.10.10',
381
- 'wooptpm_ga_ua_parameters'
382
- );
383
- $ga_ua_parameters = apply_filters_deprecated(
384
- 'wooptpm_ga_ua_parameters',
385
- [ $ga_ua_parameters, $id ],
386
- '1.13.0',
387
- 'wpm_ga_ua_parameters'
388
- );
389
- return apply_filters( 'wpm_ga_ua_parameters', $ga_ua_parameters, $id );
390
- }
391
-
392
- public function get_all_refund_products( $refund )
393
- {
394
- $data = [];
395
- $item_index = 1;
396
- foreach ( $refund->get_items() as $item_id => $item ) {
397
- // $product = new WC_Product($refund_item->get_product_id());
398
- $order_item_data = $this->google->get_order_item_data( $item );
399
- $data['pr' . $item_index . 'id'] = $order_item_data['id'];
400
- $data['pr' . $item_index . 'qt'] = -1 * $order_item_data['quantity'];
401
- $item_index++;
402
- }
403
- return $data;
404
- }
405
 
406
- }
 
 
 
 
 
 
 
 
2
 
3
  namespace WCPM\Classes\Pixels\Google;
4
 
5
+ use WCPM\Classes\Pixels\Pixel;
6
+ use WCPM\Classes\Pixels\Trait_Shop;
 
7
 
8
+ if (!defined('ABSPATH')) {
9
+ exit; // Exit if accessed directly
 
10
  }
11
 
12
+ class Google extends Pixel {
13
+ use Trait_Google;
14
+ use Trait_Shop;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
15
 
16
+
17
+ public function __construct( $options ) {
18
+ parent::__construct($options);
19
+
20
+ $this->google_business_vertical = $this->get_google_business_vertical($this->options['google']['ads']['google_business_vertical']);
21
+
22
+ $this->pixel_name = 'google';
23
+ }
24
+ }
classes/pixels/trait-product.php CHANGED
@@ -3,14 +3,12 @@
3
  namespace WCPM\Classes\Pixels;
4
 
5
  use WCPM\Classes\Admin\Environment_Check;
6
- use WCPM\Classes\Pixels\Google\Google;
7
 
8
  if (!defined('ABSPATH')) {
9
  exit; // Exit if accessed directly
10
  }
11
 
12
  trait Trait_Product {
13
-
14
  protected function get_formatted_variant_text( $product ) {
15
  $variant_text_array = [];
16
 
@@ -27,8 +25,7 @@ trait Trait_Product {
27
  }
28
 
29
  protected function get_variation_or_product_id( $item, $variations_output = true ) {
30
-
31
- if (0 <> $item['variation_id'] && true === $variations_output) {
32
  return $item['variation_id'];
33
  } else {
34
  return $item['product_id'];
@@ -38,13 +35,19 @@ trait Trait_Product {
38
  // https://stackoverflow.com/a/56278308/4688612
39
  // https://stackoverflow.com/a/39034036/4688612
40
  public function get_brand_name( $product_id ) {
 
 
 
 
41
 
42
  $brand_taxonomy = 'pa_brand';
43
 
44
  if (( new Environment_Check($this->options) )->is_yith_wc_brands_active()) {
45
  $brand_taxonomy = 'yith_product_brand';
46
- } elseif (( new Environment_Check($this->options) )->is_woocommerce_brands_active()) {
47
- $brand_taxonomy = 'product_brand';
 
 
48
  }
49
 
50
  $brand_taxonomy = apply_filters_deprecated('wooptpm_custom_brand_taxonomy', [$brand_taxonomy], '1.13.0', 'wpm_custom_brand_taxonomy');
@@ -52,6 +55,10 @@ trait Trait_Product {
52
  // Use custom brand_taxonomy
53
  $brand_taxonomy = apply_filters('wpm_custom_brand_taxonomy', $brand_taxonomy);
54
 
 
 
 
 
55
  if ($this->get_brand_by_taxonomy($product_id, $brand_taxonomy)) {
56
  return $this->get_brand_by_taxonomy($product_id, $brand_taxonomy);
57
  } elseif ($this->get_brand_by_taxonomy($product_id, 'pa_' . $brand_taxonomy)) {
@@ -62,7 +69,6 @@ trait Trait_Product {
62
  }
63
 
64
  public function get_brand_by_taxonomy( $product_id, $taxonomy ) {
65
-
66
  if (taxonomy_exists($taxonomy)) {
67
  $brand_names = wp_get_post_terms($product_id, $taxonomy, ['fields' => 'names']);
68
  return reset($brand_names);
@@ -73,19 +79,13 @@ trait Trait_Product {
73
 
74
  // get an array with all product categories
75
  public function get_product_category( $product_id ) {
76
-
77
- if ($this->is_variable_product_by_id($product_id)) {
78
- $product = wc_get_product($product_id);
79
- $product_id = $product->get_parent_id();
80
- }
81
-
82
  $prod_cats = get_the_terms($product_id, 'product_cat');
83
  $prod_cats_output = [];
84
 
85
  // only continue with the loop if one or more product categories have been set for the product
86
  if (!empty($prod_cats)) {
87
  foreach ((array) $prod_cats as $key) {
88
- $prod_cats_output[] = $key->name;
89
  }
90
 
91
  // apply filter to the $prod_cats_output array
@@ -95,15 +95,7 @@ trait Trait_Product {
95
  return $prod_cats_output;
96
  }
97
 
98
- protected function is_variable_product_by_id( $product_id ) {
99
-
100
- $product = wc_get_product($product_id);
101
-
102
- return $product->get_type() === 'variable';
103
- }
104
-
105
  protected function get_compiled_product_id( $product_id, $product_sku, $options, $channel = '' ) {
106
-
107
  // depending on setting use product IDs or SKUs
108
  if (0 == $this->options['google']['ads']['product_identifier'] || 'ga_ua' === $channel || 'ga_4' === $channel) {
109
  return (string) $product_id;
@@ -121,7 +113,6 @@ trait Trait_Product {
121
  }
122
 
123
  protected function get_dyn_r_ids( $product ) {
124
-
125
  $dyn_r_ids = [
126
  'post_id' => (string) $product->get_id(),
127
  'sku' => (string) $product->get_sku() ? $product->get_sku() : $product->get_id(),
@@ -135,7 +126,6 @@ trait Trait_Product {
135
  }
136
 
137
  protected function log_problematic_product_id( $product_id = 0 ) {
138
-
139
  wc_get_logger()->debug(
140
  'WooCommerce detects the page ID ' . $product_id . ' as product, but when invoked by wc_get_product( ' . $product_id . ' ) it returns no product object',
141
  ['source' => 'wpm']
@@ -158,6 +148,7 @@ trait Trait_Product {
158
 
159
  $dyn_r_ids = $this->get_dyn_r_ids($product);
160
  $product_id_compiled = $dyn_r_ids[$this->get_dyn_r_id_type()];
 
161
  array_push($order_items_array, $product_id_compiled);
162
  } else {
163
 
@@ -169,7 +160,6 @@ trait Trait_Product {
169
  }
170
 
171
  protected function get_order_items_formatted_for_purchase_event( $order ) {
172
-
173
  $order_items = $this->wpm_get_order_items($order);
174
  $order_items_formatted = [];
175
 
@@ -185,6 +175,7 @@ trait Trait_Product {
185
 
186
  $dyn_r_ids = $this->get_dyn_r_ids($product);
187
  $product_id_compiled = $dyn_r_ids[$this->get_dyn_r_id_type()];
 
188
 
189
  $product_details['id'] = $product_id_compiled;
190
  $product_details['name'] = $product->get_name();
@@ -193,6 +184,8 @@ trait Trait_Product {
193
  $product_details['brand'] = $this->get_brand_name($product_id);
194
  $product_details['category'] = implode(',', $this->get_product_category($product_id));
195
 
 
 
196
  if ($product->is_type('variation')) {
197
  $product_details['variant'] = $this->get_formatted_variant_text($product);
198
 
@@ -205,6 +198,7 @@ trait Trait_Product {
205
  }
206
 
207
  $order_items_formatted[] = $product_details;
 
208
  } else {
209
 
210
  $this->log_problematic_product_id($product_id);
@@ -214,7 +208,9 @@ trait Trait_Product {
214
  return $order_items_formatted;
215
  }
216
 
 
217
  protected function get_dyn_r_id_type( $pixel_name = null ) {
 
218
 
219
  if ($pixel_name) {
220
  $this->pixel_name = $pixel_name;
@@ -230,7 +226,7 @@ trait Trait_Product {
230
  $this->dyn_r_id_type = 'gla';
231
  }
232
 
233
- // If you want to change the dyn_r_id type programmatically
234
  $this->dyn_r_id_type = apply_filters_deprecated('wooptpm_product_id_type_for_' . $this->pixel_name, [$this->dyn_r_id_type], '1.13.0', 'wpm_product_id_type_for_');
235
  $this->dyn_r_id_type = apply_filters('wpm_product_id_type_for_' . $this->pixel_name, $this->dyn_r_id_type);
236
 
@@ -238,16 +234,11 @@ trait Trait_Product {
238
  }
239
 
240
  protected function wpm_get_order_items( $order ) {
241
-
242
  $order_items = apply_filters_deprecated('wooptpm_order_items', [$order->get_items(), $order], '1.13.0', 'wpm_order_items');
243
-
244
- // Give option to filter order items
245
- // then return
246
  return apply_filters('wpm_order_items', $order_items, $order);
247
  }
248
 
249
  protected function get_front_end_order_items( $order ) {
250
-
251
  $order_items = $this->wpm_get_order_items($order);
252
  $order_items_formatted = [];
253
 
@@ -268,7 +259,7 @@ trait Trait_Product {
268
  'variation_id' => $order_item_data['variation_id'],
269
  'name' => $order_item_data['name'],
270
  'quantity' => $order_item_data['quantity'],
271
- 'price' => ( new Google($this->options) )->wpm_get_order_item_price($order_item, $product),
272
  'subtotal' => (float) number_format($order_item_data['subtotal'], 2, '.', ''),
273
  'subtotal_tax' => (float) number_format($order_item_data['subtotal_tax'], 2, '.', ''),
274
  'total' => (float) number_format($order_item_data['total'], 2, '.', ''),
@@ -289,23 +280,50 @@ trait Trait_Product {
289
  }
290
 
291
  public function get_product_data_layer_script( $product, $set_position = true, $meta_tag = false ) {
292
-
293
  if (!is_object($product)) {
 
 
294
  wc_get_logger()->debug('get_product_data_layer_script received an invalid product', ['source' => 'wpm']);
 
295
  return '';
296
  }
297
 
298
  $data = $this->get_product_details_for_datalayer($product);
299
 
300
- // If placed in <head> it must be a <meta> tag else, it can be an <input> tag
301
- // Added name and content to meta in order to pass W3 validation test at https://validator.w3.org/nu/
 
302
  $tag = $meta_tag ? "meta name='wpm-dataLayer-meta' content='" . $product->get_id() . "'" : "input type='hidden'";
303
 
 
 
 
 
 
 
304
  $this->get_product_data_layer_script_html_part_1($tag, $product, $data, $set_position, $meta_tag);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
305
  }
306
 
307
  protected function get_product_data_layer_script_html_part_1( $tag, $product, $data, $set_position, $meta_tag ) {
308
-
309
  if ($meta_tag) {
310
  ?>
311
  <meta name="pm-dataLayer-meta" content="<?php esc_html_e($product->get_id()); ?>" class="wpmProductId"
@@ -318,22 +336,24 @@ trait Trait_Product {
318
  }
319
 
320
  ?>
321
- <script>
322
  (window.wpmDataLayer = window.wpmDataLayer || {}).products = window.wpmDataLayer.products || {}
323
  window.wpmDataLayer.products[<?php esc_html_e($product->get_id()); ?>] = <?php echo wp_json_encode($data); ?>;
324
  <?php $set_position ? $this->get_product_data_layer_script_html_part_2($product) : ''; ?>
325
  </script>
326
  <?php
 
327
  }
328
 
329
  protected function get_product_data_layer_script_html_part_2( $product ) {
330
  ?>
331
  window.wpmDataLayer.products[<?php esc_html_e($product->get_id()); ?>]['position'] = window.wpmDataLayer.position++
332
  <?php
 
333
  }
334
 
335
- public function get_product_details_for_datalayer( $product ) {
336
 
 
337
  global $woocommerce_wpml;
338
 
339
  $dyn_r_ids = $this->get_dyn_r_ids($product);
@@ -353,11 +373,11 @@ trait Trait_Product {
353
  'category' => $this->get_product_category($product->get_id()),
354
  'quantity' => 1,
355
  'dyn_r_ids' => $dyn_r_ids,
356
- 'isVariable' => $product->get_type() === 'variable',
357
  'isVariation' => false,
358
  ];
359
 
360
- if ($product->get_type() === 'variation') {
361
 
362
  $parent_product = wc_get_product($product->get_parent_id());
363
  if ($parent_product) {
3
  namespace WCPM\Classes\Pixels;
4
 
5
  use WCPM\Classes\Admin\Environment_Check;
 
6
 
7
  if (!defined('ABSPATH')) {
8
  exit; // Exit if accessed directly
9
  }
10
 
11
  trait Trait_Product {
 
12
  protected function get_formatted_variant_text( $product ) {
13
  $variant_text_array = [];
14
 
25
  }
26
 
27
  protected function get_variation_or_product_id( $item, $variations_output = true ) {
28
+ if (0 <> $item['variation_id'] && true == $variations_output) {
 
29
  return $item['variation_id'];
30
  } else {
31
  return $item['product_id'];
35
  // https://stackoverflow.com/a/56278308/4688612
36
  // https://stackoverflow.com/a/39034036/4688612
37
  public function get_brand_name( $product_id ) {
38
+ // return $this->get_brand_by_taxonomy($product_id, 'product_brand') ?: // for Woocommerce Brands plugin
39
+ // $this->get_brand_by_taxonomy($product_id, 'yith_product_brand') ?: // for YITH WooCommerce Brands plugin
40
+ // $this->get_brand_by_taxonomy($product_id, 'pa_brand') ?: // for a custom product attribute
41
+ // '';
42
 
43
  $brand_taxonomy = 'pa_brand';
44
 
45
  if (( new Environment_Check($this->options) )->is_yith_wc_brands_active()) {
46
  $brand_taxonomy = 'yith_product_brand';
47
+ } else {
48
+ if (( new Environment_Check($this->options) )->is_woocommerce_brands_active()) {
49
+ $brand_taxonomy = 'product_brand';
50
+ }
51
  }
52
 
53
  $brand_taxonomy = apply_filters_deprecated('wooptpm_custom_brand_taxonomy', [$brand_taxonomy], '1.13.0', 'wpm_custom_brand_taxonomy');
55
  // Use custom brand_taxonomy
56
  $brand_taxonomy = apply_filters('wpm_custom_brand_taxonomy', $brand_taxonomy);
57
 
58
+ // return $this->get_brand_by_taxonomy($product_id, $brand_taxonomy) ?:
59
+ // $this->get_brand_by_taxonomy($product_id, 'pa_' . $brand_taxonomy) ?:
60
+ // '';
61
+
62
  if ($this->get_brand_by_taxonomy($product_id, $brand_taxonomy)) {
63
  return $this->get_brand_by_taxonomy($product_id, $brand_taxonomy);
64
  } elseif ($this->get_brand_by_taxonomy($product_id, 'pa_' . $brand_taxonomy)) {
69
  }
70
 
71
  public function get_brand_by_taxonomy( $product_id, $taxonomy ) {
 
72
  if (taxonomy_exists($taxonomy)) {
73
  $brand_names = wp_get_post_terms($product_id, $taxonomy, ['fields' => 'names']);
74
  return reset($brand_names);
79
 
80
  // get an array with all product categories
81
  public function get_product_category( $product_id ) {
 
 
 
 
 
 
82
  $prod_cats = get_the_terms($product_id, 'product_cat');
83
  $prod_cats_output = [];
84
 
85
  // only continue with the loop if one or more product categories have been set for the product
86
  if (!empty($prod_cats)) {
87
  foreach ((array) $prod_cats as $key) {
88
+ array_push($prod_cats_output, $key->name);
89
  }
90
 
91
  // apply filter to the $prod_cats_output array
95
  return $prod_cats_output;
96
  }
97
 
 
 
 
 
 
 
 
98
  protected function get_compiled_product_id( $product_id, $product_sku, $options, $channel = '' ) {
 
99
  // depending on setting use product IDs or SKUs
100
  if (0 == $this->options['google']['ads']['product_identifier'] || 'ga_ua' === $channel || 'ga_4' === $channel) {
101
  return (string) $product_id;
113
  }
114
 
115
  protected function get_dyn_r_ids( $product ) {
 
116
  $dyn_r_ids = [
117
  'post_id' => (string) $product->get_id(),
118
  'sku' => (string) $product->get_sku() ? $product->get_sku() : $product->get_id(),
126
  }
127
 
128
  protected function log_problematic_product_id( $product_id = 0 ) {
 
129
  wc_get_logger()->debug(
130
  'WooCommerce detects the page ID ' . $product_id . ' as product, but when invoked by wc_get_product( ' . $product_id . ' ) it returns no product object',
131
  ['source' => 'wpm']
148
 
149
  $dyn_r_ids = $this->get_dyn_r_ids($product);
150
  $product_id_compiled = $dyn_r_ids[$this->get_dyn_r_id_type()];
151
+ // $product_id_compiled = $this->get_compiled_product_id($product_id, $product->get_sku(), $this->options, '');
152
  array_push($order_items_array, $product_id_compiled);
153
  } else {
154
 
160
  }
161
 
162
  protected function get_order_items_formatted_for_purchase_event( $order ) {
 
163
  $order_items = $this->wpm_get_order_items($order);
164
  $order_items_formatted = [];
165
 
175
 
176
  $dyn_r_ids = $this->get_dyn_r_ids($product);
177
  $product_id_compiled = $dyn_r_ids[$this->get_dyn_r_id_type()];
178
+ // $product_id_compiled = $this->get_compiled_product_id($product_id, $product->get_sku(), $this->options, '');
179
 
180
  $product_details['id'] = $product_id_compiled;
181
  $product_details['name'] = $product->get_name();
184
  $product_details['brand'] = $this->get_brand_name($product_id);
185
  $product_details['category'] = implode(',', $this->get_product_category($product_id));
186
 
187
+ // error_log('type: ' . $product->get_type());
188
+
189
  if ($product->is_type('variation')) {
190
  $product_details['variant'] = $this->get_formatted_variant_text($product);
191
 
198
  }
199
 
200
  $order_items_formatted[] = $product_details;
201
+ // array_push($order_items_formatted, $product_details);
202
  } else {
203
 
204
  $this->log_problematic_product_id($product_id);
208
  return $order_items_formatted;
209
  }
210
 
211
+
212
  protected function get_dyn_r_id_type( $pixel_name = null ) {
213
+ // $dyn_r_id_type = '';
214
 
215
  if ($pixel_name) {
216
  $this->pixel_name = $pixel_name;
226
  $this->dyn_r_id_type = 'gla';
227
  }
228
 
229
+ // if you want to change the dyn_r_id type for Google programmatically
230
  $this->dyn_r_id_type = apply_filters_deprecated('wooptpm_product_id_type_for_' . $this->pixel_name, [$this->dyn_r_id_type], '1.13.0', 'wpm_product_id_type_for_');
231
  $this->dyn_r_id_type = apply_filters('wpm_product_id_type_for_' . $this->pixel_name, $this->dyn_r_id_type);
232
 
234
  }
235
 
236
  protected function wpm_get_order_items( $order ) {
 
237
  $order_items = apply_filters_deprecated('wooptpm_order_items', [$order->get_items(), $order], '1.13.0', 'wpm_order_items');
 
 
 
238
  return apply_filters('wpm_order_items', $order_items, $order);
239
  }
240
 
241
  protected function get_front_end_order_items( $order ) {
 
242
  $order_items = $this->wpm_get_order_items($order);
243
  $order_items_formatted = [];
244
 
259
  'variation_id' => $order_item_data['variation_id'],
260
  'name' => $order_item_data['name'],
261
  'quantity' => $order_item_data['quantity'],
262
+ 'price' => $this->wpm_get_order_item_price($order_item, $product),
263
  'subtotal' => (float) number_format($order_item_data['subtotal'], 2, '.', ''),
264
  'subtotal_tax' => (float) number_format($order_item_data['subtotal_tax'], 2, '.', ''),
265
  'total' => (float) number_format($order_item_data['total'], 2, '.', ''),
280
  }
281
 
282
  public function get_product_data_layer_script( $product, $set_position = true, $meta_tag = false ) {
 
283
  if (!is_object($product)) {
284
+
285
+ // $this->log_problematic_product_id();
286
  wc_get_logger()->debug('get_product_data_layer_script received an invalid product', ['source' => 'wpm']);
287
+
288
  return '';
289
  }
290
 
291
  $data = $this->get_product_details_for_datalayer($product);
292
 
293
+ // if placed in <head> it must be a <meta> tag else, it can be an <input> tag
294
+ // $tag = $meta_tag ? "meta" : "input";
295
+ // added name and content to meta in order to pass W3 validation test at https://validator.w3.org/nu/
296
  $tag = $meta_tag ? "meta name='wpm-dataLayer-meta' content='" . $product->get_id() . "'" : "input type='hidden'";
297
 
298
+ // $html = "
299
+ // <$tag class='wpmProductId' data-id='" . $product->get_id() . "'>
300
+ // <script type=\"text/javascript\" data-cfasync=\"false\">
301
+ // window.wpmDataLayer.products = window.wpmDataLayer.products || {};
302
+ // window.wpmDataLayer.products[" . $product->get_id() . "] = " . wp_json_encode($data) . ";";
303
+
304
  $this->get_product_data_layer_script_html_part_1($tag, $product, $data, $set_position, $meta_tag);
305
+
306
+ // $html = '
307
+ // <' . $tag . ' class="wpmProductId" data-id="' . $product->get_id() . '">
308
+ // <script type="text/javascript" data-cfasync="false">
309
+ // window.wpmDataLayer.products = window.wpmDataLayer.products || {};
310
+ // window.wpmDataLayer.products[' . $product->get_id() . '] = ' . wp_json_encode($data) . ';';
311
+
312
+ // if (true === $set_position) {
313
+ //
314
+ //// $html .= "
315
+ //// window.wpmDataLayer.products[{$product->get_id()}]['position'] = window.wpmDataLayer.position++;";
316
+ ////
317
+ // $this->get_product_data_layer_script_html_part_2($product);
318
+ // }
319
+
320
+ // $html .= '</script>';
321
+ // echo '</script>';
322
+
323
+ // return $html;
324
  }
325
 
326
  protected function get_product_data_layer_script_html_part_1( $tag, $product, $data, $set_position, $meta_tag ) {
 
327
  if ($meta_tag) {
328
  ?>
329
  <meta name="pm-dataLayer-meta" content="<?php esc_html_e($product->get_id()); ?>" class="wpmProductId"
336
  }
337
 
338
  ?>
339
+ <script type="text/javascript" data-cfasync="false">
340
  (window.wpmDataLayer = window.wpmDataLayer || {}).products = window.wpmDataLayer.products || {}
341
  window.wpmDataLayer.products[<?php esc_html_e($product->get_id()); ?>] = <?php echo wp_json_encode($data); ?>;
342
  <?php $set_position ? $this->get_product_data_layer_script_html_part_2($product) : ''; ?>
343
  </script>
344
  <?php
345
+
346
  }
347
 
348
  protected function get_product_data_layer_script_html_part_2( $product ) {
349
  ?>
350
  window.wpmDataLayer.products[<?php esc_html_e($product->get_id()); ?>]['position'] = window.wpmDataLayer.position++
351
  <?php
352
+
353
  }
354
 
 
355
 
356
+ public function get_product_details_for_datalayer( $product ) {
357
  global $woocommerce_wpml;
358
 
359
  $dyn_r_ids = $this->get_dyn_r_ids($product);
373
  'category' => $this->get_product_category($product->get_id()),
374
  'quantity' => 1,
375
  'dyn_r_ids' => $dyn_r_ids,
376
+ 'isVariable' => $product->get_type() == 'variable',
377
  'isVariation' => false,
378
  ];
379
 
380
+ if ($product->get_type() == 'variation') {
381
 
382
  $parent_product = wc_get_product($product->get_parent_id());
383
  if ($parent_product) {
classes/pixels/trait-shop.php CHANGED
@@ -2,288 +2,397 @@
2
 
3
  namespace WCPM\Classes\Pixels;
4
 
5
- use libphonenumber\NumberParseException;
6
- use libphonenumber\PhoneNumberFormat;
7
- use libphonenumber\PhoneNumberUtil;
8
- use WC_Geolocation;
9
-
10
- if (!defined('ABSPATH')) {
11
- exit; // Exit if accessed directly
12
- }
13
-
14
- trait Trait_Shop {
15
-
16
- protected function get_list_name_suffix() {
17
- $list_suffix = '';
18
-
19
- if (is_product_category()) {
20
-
21
- $category = get_queried_object();
22
- $list_suffix = ' | ' . $category->name;
23
- $list_suffix = $this->add_parent_category_name($category, $list_suffix);
24
- } else {
25
- if (is_product_tag()) {
26
- $tag = get_queried_object();
27
- $list_suffix = ' | ' . $tag->name;
28
- }
29
- }
30
-
31
- return $list_suffix;
32
- }
33
-
34
- protected function add_parent_category_name( $category, $list_suffix ) {
35
- if ($category->parent > 0) {
36
-
37
- $parent_category = get_term_by('id', $category->parent, 'product_cat');
38
- $list_suffix = ' | ' . $parent_category->name . $list_suffix;
39
- $list_suffix = $this->add_parent_category_name($parent_category, $list_suffix);
40
- }
41
-
42
- return $list_suffix;
43
- }
44
-
45
- protected function get_list_id_suffix() {
46
- $list_suffix = '';
47
-
48
- if (is_product_category()) {
49
- $category = get_queried_object();
50
- $list_suffix = '.' . $category->slug;
51
- $list_suffix = $this->add_parent_category_id($category, $list_suffix);
52
- } else {
53
- if (is_product_tag()) {
54
- $tag = get_queried_object();
55
- $list_suffix = '.' . $tag->slug;
56
- }
57
- }
58
-
59
- return $list_suffix;
60
- }
61
-
62
- protected function add_parent_category_id( $category, $list_suffix ) {
63
- if ($category->parent > 0) {
64
-
65
- $parent_category = get_term_by('id', $category->parent, 'product_cat');
66
- $list_suffix = '.' . $parent_category->slug . $list_suffix;
67
- $list_suffix = $this->add_parent_category_id($parent_category, $list_suffix);
68
- }
69
-
70
- return $list_suffix;
71
- }
72
-
73
- // https://stackoverflow.com/a/49616130/4688612
74
- protected function get_order_from_order_received_page() {
75
- if ($this->get_order_from_query_vars()) {
76
- return $this->get_order_from_query_vars();
77
- } else {
78
- if ($this->get_order_with_url_order_key()) {
79
- return $this->get_order_with_url_order_key();
80
- } else {
81
- return false;
82
- }
83
- }
84
- }
85
-
86
- protected function wpm_get_order_total( $order ) {
87
-
88
- $order_total = 0 == $this->options_obj->shop->order_total_logic ? $order->get_subtotal() - $order->get_total_discount() : $order->get_total();
89
-
90
- // filter to adjust the order value
91
- $order_total = apply_filters_deprecated('wgact_conversion_value_filter', [$order_total, $order], '1.10.2', 'wooptpm_conversion_value_filter');
92
- $order_total = apply_filters_deprecated('wooptpm_conversion_value_filter', [$order_total, $order], '1.13.0', 'wpm_conversion_value_filter');
93
- $order_total = apply_filters('wpm_conversion_value_filter', $order_total, $order);
94
-
95
- return number_format((float) $order_total, 2, '.', '');
96
-
97
- }
98
-
99
- protected function get_order_from_query_vars() {
100
- global $wp;
101
-
102
- $order_id = absint($wp->query_vars['order-received']);
103
-
104
- if ($order_id && 0 != $order_id && wc_get_order($order_id)) {
105
-
106
- return wc_get_order($order_id);
107
- } else {
108
-
109
- wc_get_logger()->debug(
110
- 'WooCommerce couldn\'t retrieve the order ID from $wp->query_vars[\'order-received\']',
111
- ['source' => 'wpm']
112
- );
113
-
114
- wc_get_logger()->debug(
115
- print_r($wp->query_vars, true),
116
- ['source' => 'wpm']
117
- );
118
-
119
- return false;
120
- }
121
- }
122
-
123
- protected function get_order_with_url_order_key() {
124
-
125
- $_get = filter_input_array(INPUT_GET, FILTER_SANITIZE_FULL_SPECIAL_CHARS);
126
-
127
- if (isset($_get['key'])) {
128
- $order_key = $_get['key'];
129
- return wc_get_order(wc_get_order_id_by_order_key($order_key));
130
- } else {
131
-
132
- wc_get_logger()->debug(
133
- 'WooCommerce couldn\'t retrieve the order ID from order key in the URL',
134
- ['source' => 'wpm']
135
- );
136
-
137
- $order_key = $_get['key'] ? $_get['key'] : '';
138
- wc_get_logger()->debug(
139
- 'URL order key: ' . $order_key,
140
- ['source' => 'wpm']
141
- );
142
-
143
- return false;
144
- }
145
- }
146
-
147
- protected function get_order_currency( $order ) {
148
- // use the right function to get the currency depending on the WooCommerce version
149
- return $this->woocommerce_3_and_above() ? $order->get_currency() : $order->get_order_currency();
150
- }
151
-
152
- protected function woocommerce_3_and_above() {
153
- global $woocommerce;
154
- if (version_compare($woocommerce->version, 3.0, '>=')) {
155
- return true;
156
- } else {
157
- return false;
158
- }
159
- }
160
-
161
- // https://stackoverflow.com/a/46216073/4688612
162
- // https://github.com/woocommerce/woocommerce/wiki/wc_get_orders-and-WC_Order_Query#description
163
- protected function is_existing_customer( $order, $value = 0 ) {
164
-
165
- if (is_numeric($value)) { // Based on user ID (registered users)
166
- $meta_key = '_customer_user';
167
- $meta_value = 0 == $value ? get_current_user_id() : (int) $value;
168
- } else { // Based on billing email (Guest users)
169
- $meta_key = '_billing_email';
170
- $meta_value = sanitize_email($value);
171
- }
172
-
173
- $orders = wc_get_orders([
174
- 'return' => 'ids',
175
- 'meta_key' => $meta_key,
176
- 'meta_value' => $meta_value,
177
- // 'orderby' => 'date',
178
- // 'order' => 'DESC',
179
- 'post_status' => wc_get_is_paid_statuses(),
180
- 'limit' => 1,
181
- ]);
182
-
183
- // Return a boolean value based on orders count
184
- return count($orders) > 0;
185
- }
186
-
187
- protected function get_user_ip() {
188
-
189
- if ($this->is_localhost()) {
190
- $ip = WC_Geolocation::get_external_ip_address();
191
- } else {
192
- $ip = WC_Geolocation::get_ip_address();
193
- }
194
-
195
- // only set the IP if it is a public address
196
- $ip = filter_var($ip, FILTER_VALIDATE_IP, FILTER_FLAG_NO_PRIV_RANGE | FILTER_FLAG_NO_RES_RANGE);
197
-
198
- // Remove the IPv6 to IPv4 mapping in case the IP contains one
199
- // and return the IP plain public IPv4 or IPv6 IP
200
- // https://en.wikipedia.org/wiki/IPv6_address
201
- return str_replace('::ffff:', '', $ip);
202
- }
203
-
204
- protected function get_visitor_country() {
205
-
206
- $location = WC_Geolocation::geolocate_ip($this->get_user_ip());
207
-
208
- return $location['country'];
209
- }
210
-
211
- protected function is_localhost() {
212
-
213
- $_server = filter_input_array(INPUT_SERVER, FILTER_SANITIZE_FULL_SPECIAL_CHARS);
214
-
215
- // If the IP is local, return true, else false
216
- // https://stackoverflow.com/a/13818647/4688612
217
- return !filter_var(
218
- $_server['REMOTE_ADDR'],
219
- FILTER_VALIDATE_IP,
220
- FILTER_FLAG_IPV4 | FILTER_FLAG_IPV6 | FILTER_FLAG_NO_PRIV_RANGE | FILTER_FLAG_NO_RES_RANGE
221
- );
222
- }
223
-
224
- protected function get_user_email( $algo = null ) {
225
-
226
- if (is_user_logged_in()) {
227
- $current_user = wp_get_current_user();
228
- $email = $current_user->user_email;
229
- } elseif (is_order_received_page()) {
230
- $order = $this->get_order_from_order_received_page();
231
-
232
- if ($order) {
233
- $email = $order->get_billing_email();
234
- } else {
235
- $email = '';
236
- }
237
- } else {
238
- $email = '';
239
- }
240
-
241
- // encrypt email
242
- if ($email && $algo && in_array($algo, hash_algos(), true)) {
243
- $email = hash($algo, $email);
244
- }
245
-
246
- return $email;
247
- }
248
-
249
- private function get_e164_formatted_phone_number( $number, $country ) {
250
- try {
251
- $phone_util = PhoneNumberUtil::getInstance();
252
- $number_parsed = $phone_util->parse($number, $country);
253
- return $phone_util->format($number_parsed, PhoneNumberFormat::E164);
254
- } catch (NumberParseException $e) {
255
- error_log($e);
256
- return $number;
257
- }
258
- }
259
-
260
- protected function track_user( $user_id = null ) {
261
-
262
- $user = null;
263
-
264
- if (0 === $user_id) { // If anonymous visitor then track
265
- return true;
266
- } elseif ($user_id && 0 <= $user_id) { // If user ID is known, get the user
267
- $user = get_user_by('id', $user_id);
268
- } elseif (null === $user_id && is_user_logged_in()) { // If user id is not given, but the user is logged in, get the user
269
- $user = wp_get_current_user();
270
- }
271
-
272
- // Find out if the user has a role that is restricted from tracking
273
- if ($user) {
274
-
275
- foreach ($user->roles as $role) {
276
- if (in_array($role, $this->options_obj->shop->disable_tracking_for, true)) {
277
- return false;
278
- }
279
- }
280
- }
281
-
282
- return true;
283
- }
284
-
285
- protected function do_not_track_user( $user_id = null ) {
286
- return !$this->track_user($user_id);
287
- }
288
  }
289
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2
 
3
  namespace WCPM\Classes\Pixels;
4
 
5
+ use libphonenumber\NumberParseException ;
6
+ use libphonenumber\PhoneNumberFormat ;
7
+ use libphonenumber\PhoneNumberUtil ;
8
+ use WC_Geolocation ;
9
+
10
+ if ( !defined( 'ABSPATH' ) ) {
11
+ exit;
12
+ // Exit if accessed directly
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
13
  }
14
 
15
+ trait Trait_Shop
16
+ {
17
+ protected function get_formatted_script_tag_new( $components )
18
+ {
19
+ $allowed_protocols = [
20
+ 'http' => [],
21
+ 'https' => [],
22
+ ];
23
+ echo PHP_EOL ;
24
+
25
+ if ( $components['src'] ) {
26
+ echo "\t" . '<script ' . wp_kses( $this->print_script_components( $components ), [], $allowed_protocols ) . '></script>' ;
27
+ } else {
28
+ echo "\t" . '<script ' . wp_kses( $this->print_script_components( $components ), [], $allowed_protocols ) . '>' ;
29
+ }
30
+
31
+ echo PHP_EOL ;
32
+ }
33
+
34
+ protected function print_script_components( $components )
35
+ {
36
+ $attributes[] = $this->get_script_async_defer( $components );
37
+ $attributes[] = $this->get_script_src( $components['src'] );
38
+ $attributes[] = $this->get_script_type_value( $components['cookie_category'] );
39
+ $attributes[] = $this->get_script_cookie_category( $components['cookie_category'] );
40
+ $attributes[] = $this->get_script_data_wpm_pixel_name( $components['pixel_name'] );
41
+ $attributes[] = $this->get_script_cfasync( $components['inject_cfasync'] );
42
+ $attributes[] = $this->get_script_cookiebot_cookieconsent( $components );
43
+ return implode( ' ', array_filter( $attributes ) );
44
+ }
45
+
46
+ protected function get_script_cookiebot_cookieconsent( $components )
47
+ {
48
+ if ( array_key_exists( 'cookiebot-cookieconsent', $components ) && $components['cookiebot-cookieconsent'] ) {
49
+ return 'data-cookieconsent="ignore"';
50
+ }
51
+ }
52
+
53
+ protected function get_script_cfasync( $cfasync )
54
+ {
55
+ if ( $cfasync ) {
56
+ return 'data-cfasync="false"';
57
+ }
58
+ }
59
+
60
+ protected function get_script_data_wpm_pixel_name( $pixel_name )
61
+ {
62
+ return 'data-wpm-pixel-name="' . $pixel_name . '"';
63
+ }
64
+
65
+ protected function get_script_src( $src )
66
+ {
67
+
68
+ if ( $src ) {
69
+ if ( !$this->options_obj->shop->cookie_consent_mgmt->explicit_consent ) {
70
+ return $this->print_script_src_orig( $src );
71
+ }
72
+ return $this->print_script_src_data_wpm( $src );
73
+ }
74
+
75
+ }
76
+
77
+ protected function print_script_src_orig( $src )
78
+ {
79
+ return 'src="' . $src . '"';
80
+ }
81
+
82
+ protected function print_script_src_data_wpm( $src )
83
+ {
84
+ return 'data-wpm-src="' . $src . '"';
85
+ }
86
+
87
+ private function get_script_async_defer( $components )
88
+ {
89
+ if ( $components['src'] ) {
90
+ // A script tag can't have both async and defer attributes,
91
+ // therefore fall back to a default if both are set.
92
+ // Otherwise, use the one that is set.
93
+
94
+ if ( $components['async'] && $components['defer'] ) {
95
+ return 'async';
96
+ } else {
97
+
98
+ if ( $components['async'] ) {
99
+ return 'async';
100
+ } else {
101
+ if ( $components['defer'] ) {
102
+ return 'defer';
103
+ }
104
+ }
105
+
106
+ }
107
+
108
+ }
109
+ }
110
+
111
+ public function get_script_type_value( $cookie_category )
112
+ {
113
+ return 'type="text/javascript"';
114
+ }
115
+
116
+ protected function get_script_cookie_category( $cookie_category )
117
+ {
118
+ return 'data-wpm-cookie-category="' . $cookie_category . '"';
119
+ }
120
+
121
+ protected function get_list_name_suffix()
122
+ {
123
+ $list_suffix = '';
124
+
125
+ if ( is_product_category() ) {
126
+ $category = get_queried_object();
127
+ $list_suffix = ' | ' . $category->name;
128
+ $list_suffix = $this->add_parent_category_name( $category, $list_suffix );
129
+ } else {
130
+
131
+ if ( is_product_tag() ) {
132
+ $tag = get_queried_object();
133
+ $list_suffix = ' | ' . $tag->name;
134
+ }
135
+
136
+ }
137
+
138
+ return $list_suffix;
139
+ }
140
+
141
+ protected function add_parent_category_name( $category, $list_suffix )
142
+ {
143
+
144
+ if ( $category->parent > 0 ) {
145
+ $parent_category = get_term_by( 'id', $category->parent, 'product_cat' );
146
+ $list_suffix = ' | ' . $parent_category->name . $list_suffix;
147
+ $list_suffix = $this->add_parent_category_name( $parent_category, $list_suffix );
148
+ }
149
+
150
+ return $list_suffix;
151
+ }
152
+
153
+ protected function get_list_id_suffix()
154
+ {
155
+ $list_suffix = '';
156
+
157
+ if ( is_product_category() ) {
158
+ $category = get_queried_object();
159
+ $list_suffix = '.' . $category->slug;
160
+ $list_suffix = $this->add_parent_category_id( $category, $list_suffix );
161
+ } else {
162
+
163
+ if ( is_product_tag() ) {
164
+ $tag = get_queried_object();
165
+ $list_suffix = '.' . $tag->slug;
166
+ }
167
+
168
+ }
169
+
170
+ return $list_suffix;
171
+ }
172
+
173
+ protected function add_parent_category_id( $category, $list_suffix )
174
+ {
175
+
176
+ if ( $category->parent > 0 ) {
177
+ $parent_category = get_term_by( 'id', $category->parent, 'product_cat' );
178
+ $list_suffix = '.' . $parent_category->slug . $list_suffix;
179
+ $list_suffix = $this->add_parent_category_id( $parent_category, $list_suffix );
180
+ }
181
+
182
+ return $list_suffix;
183
+ }
184
+
185
+ // https://stackoverflow.com/a/49616130/4688612
186
+ protected function get_order_from_order_received_page()
187
+ {
188
+
189
+ if ( $this->get_order_from_query_vars() ) {
190
+ return $this->get_order_from_query_vars();
191
+ } else {
192
+
193
+ if ( $this->get_order_with_url_order_key() ) {
194
+ return $this->get_order_with_url_order_key();
195
+ } else {
196
+ return false;
197
+ }
198
+
199
+ }
200
+
201
+ }
202
+
203
+ protected function wpm_get_order_total( $order )
204
+ {
205
+ $order_total = ( 0 == $this->options_obj->shop->order_total_logic ? $order->get_subtotal() - $order->get_total_discount() : $order->get_total() );
206
+ // filter to adjust the order value
207
+ $order_total = apply_filters_deprecated(
208
+ 'wgact_conversion_value_filter',
209
+ [ $order_total, $order ],
210
+ '1.10.2',
211
+ 'wooptpm_conversion_value_filter'
212
+ );
213
+ $order_total = apply_filters_deprecated(
214
+ 'wooptpm_conversion_value_filter',
215
+ [ $order_total, $order ],
216
+ '1.13.0',
217
+ 'wpm_conversion_value_filter'
218
+ );
219
+ $order_total = apply_filters( 'wpm_conversion_value_filter', $order_total, $order );
220
+ return number_format(
221
+ (double) $order_total,
222
+ 2,
223
+ '.',
224
+ ''
225
+ );
226
+ }
227
+
228
+ protected function get_order_from_query_vars()
229
+ {
230
+ global $wp ;
231
+ $order_id = absint( $wp->query_vars['order-received'] );
232
+
233
+ if ( $order_id && 0 != $order_id && wc_get_order( $order_id ) ) {
234
+ return wc_get_order( $order_id );
235
+ } else {
236
+ wc_get_logger()->debug( 'WooCommerce couldn\'t retrieve the order ID from $wp->query_vars[\'order-received\']', [
237
+ 'source' => 'wpm',
238
+ ] );
239
+ wc_get_logger()->debug( print_r( $wp->query_vars, true ), [
240
+ 'source' => 'wpm',
241
+ ] );
242
+ return false;
243
+ }
244
+
245
+ }
246
+
247
+ protected function get_order_with_url_order_key()
248
+ {
249
+ $_get = filter_input_array( INPUT_GET, FILTER_SANITIZE_STRING );
250
+
251
+ if ( isset( $_get['key'] ) ) {
252
+ $order_key = $_get['key'];
253
+ return wc_get_order( wc_get_order_id_by_order_key( $order_key ) );
254
+ } else {
255
+ wc_get_logger()->debug( 'WooCommerce couldn\'t retrieve the order ID from order key in the URL', [
256
+ 'source' => 'wpm',
257
+ ] );
258
+ $order_key = ( $_get['key'] ? $_get['key'] : '' );
259
+ wc_get_logger()->debug( 'URL order key: ' . $order_key, [
260
+ 'source' => 'wpm',
261
+ ] );
262
+ return false;
263
+ }
264
+
265
+ }
266
+
267
+ protected function get_order_currency( $order )
268
+ {
269
+ // use the right function to get the currency depending on the WooCommerce version
270
+ return ( $this->woocommerce_3_and_above() ? $order->get_currency() : $order->get_order_currency() );
271
+ }
272
+
273
+ protected function woocommerce_3_and_above()
274
+ {
275
+ global $woocommerce ;
276
+
277
+ if ( version_compare( $woocommerce->version, 3.0, '>=' ) ) {
278
+ return true;
279
+ } else {
280
+ return false;
281
+ }
282
+
283
+ }
284
+
285
+ // https://stackoverflow.com/a/46216073/4688612
286
+ // https://github.com/woocommerce/woocommerce/wiki/wc_get_orders-and-WC_Order_Query#description
287
+ protected function is_existing_customer( $order, $value = 0 )
288
+ {
289
+
290
+ if ( is_numeric( $value ) ) {
291
+ // Based on user ID (registered users)
292
+ $meta_key = '_customer_user';
293
+ $meta_value = ( 0 == $value ? get_current_user_id() : (int) $value );
294
+ } else {
295
+ // Based on billing email (Guest users)
296
+ $meta_key = '_billing_email';
297
+ $meta_value = sanitize_email( $value );
298
+ }
299
+
300
+ $orders = wc_get_orders( [
301
+ 'return' => 'ids',
302
+ 'meta_key' => $meta_key,
303
+ 'meta_value' => $meta_value,
304
+ 'post_status' => wc_get_is_paid_statuses(),
305
+ 'limit' => 1,
306
+ ] );
307
+ // Return a boolean value based on orders count
308
+ return count( $orders ) > 0;
309
+ }
310
+
311
+ // https://stackoverflow.com/a/46216073/4688612
312
+ // protected function is_existing_customer( $order, $value = 0 ) {
313
+ // global $wpdb;
314
+ //
315
+ // // Based on user ID (registered users)
316
+ // if (is_numeric($value)) {
317
+ // $meta_key = '_customer_user';
318
+ // $meta_value = 0 == $value ? get_current_user_id() : (int) $value;
319
+ // } else { // Based on billing email (Guest users)
320
+ // $meta_key = '_billing_email';
321
+ // $meta_value = sanitize_email($value);
322
+ // }
323
+ //
324
+ // $paid_order_statuses = array_map('esc_sql', wc_get_is_paid_statuses());
325
+ //
326
+ // $count = $wpdb->get_var($wpdb->prepare("
327
+ // SELECT COUNT(p.ID) FROM {$wpdb->prefix}posts AS p
328
+ // INNER JOIN {$wpdb->prefix}postmeta AS pm ON p.ID = pm.post_id
329
+ // WHERE p.post_status IN ( 'wc-" . implode("','wc-", $paid_order_statuses) . "' )
330
+ // AND p.post_type LIKE 'shop_order'
331
+ // AND p.ID <> {$order->get_id()}
332
+ // AND pm.meta_key = '%s'
333
+ // AND pm.meta_value = %s
334
+ // LIMIT 1
335
+ // ", $meta_key, $meta_value)
336
+ // );
337
+ //
338
+ // // Return a boolean value based on orders count
339
+ // return $count > 0;
340
+ // }
341
+ protected function get_visitor_country()
342
+ {
343
+
344
+ if ( $this->is_localhost() ) {
345
+ $this->ip = WC_Geolocation::get_external_ip_address();
346
+ } else {
347
+ $this->ip = WC_Geolocation::get_ip_address();
348
+ }
349
+
350
+ $location = WC_Geolocation::geolocate_ip( $this->ip );
351
+ return $location['country'];
352
+ }
353
+
354
+ protected function is_localhost()
355
+ {
356
+ $_server = filter_input_array( INPUT_SERVER, FILTER_SANITIZE_STRING );
357
+ return in_array( $_server['REMOTE_ADDR'], [ '127.0.0.1', '::1' ], true );
358
+ }
359
+
360
+ protected function get_user_email( $algo = '' )
361
+ {
362
+
363
+ if ( is_user_logged_in() ) {
364
+ $current_user = wp_get_current_user();
365
+ $email = $current_user->user_email;
366
+ } elseif ( is_order_received_page() ) {
367
+ $order = $this->get_order_from_order_received_page();
368
+
369
+ if ( $order ) {
370
+ $email = $order->get_billing_email();
371
+ } else {
372
+ $email = '';
373
+ }
374
+
375
+ } else {
376
+ $email = '';
377
+ }
378
+
379
+ // encrypt email
380
+ if ( $email && in_array( $algo, hash_algos(), true ) ) {
381
+ $email = hash( $algo, $email );
382
+ }
383
+ return $email;
384
+ }
385
+
386
+ private function get_e164_formatted_phone_number( $number, $country )
387
+ {
388
+ try {
389
+ $phone_util = PhoneNumberUtil::getInstance();
390
+ $number_parsed = $phone_util->parse( $number, $country );
391
+ return $phone_util->format( $number_parsed, PhoneNumberFormat::E164 );
392
+ } catch ( NumberParseException $e ) {
393
+ error_log( $e );
394
+ return $number;
395
+ }
396
+ }
397
+
398
+ }
css/admin.css CHANGED
@@ -47,7 +47,7 @@
47
  .developer-banner {
48
  background: #f3f5f6;
49
  color: #0071a1;
50
- padding: 0 10px;
51
  margin-bottom: 20px;
52
  border-radius: 3px;
53
  border-style: solid;
@@ -174,4 +174,4 @@ input:checked + .slider:before {
174
  text-decoration: none;
175
  margin-left: 5px;
176
  margin-right: 5px;
177
- }
47
  .developer-banner {
48
  background: #f3f5f6;
49
  color: #0071a1;
50
+ padding: 0px 10px;
51
  margin-bottom: 20px;
52
  border-radius: 3px;
53
  border-style: solid;
174
  text-decoration: none;
175
  margin-left: 5px;
176
  margin-right: 5px;
177
+ }
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,307 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
+ if (wpmDataLayer?.pixels?.facebook?.pixel_id) {
13
+
14
+ wpmDataLayer.pixels.facebook.loaded = true
15
+
16
+ // @formatter:off
17
+ !function(f,b,e,v,n,t,s)
18
+ {if(f.fbq)return;n=f.fbq=function(){n.callMethod?
19
+ n.callMethod.apply(n,arguments):n.queue.push(arguments)};
20
+ if(!f._fbq)f._fbq=n;n.push=n;n.loaded=!0;n.version='2.0';
21
+ n.queue=[];t=b.createElement(e);t.async=!0;
22
+ t.src=v;s=b.getElementsByTagName(e)[0];
23
+ s.parentNode.insertBefore(t,s)}(window, document,'script',
24
+ 'https://connect.facebook.net/en_US/fbevents.js');
25
+ // @formatter:on
26
+
27
+ fbq("init", wpmDataLayer.pixels.facebook.pixel_id)
28
+ fbq("track", "PageView")
29
+ }
30
+ } catch (e) {
31
+ console.error(e)
32
+ }
33
+ }
34
+
35
+ wpm.getRandomEventId = function () {
36
+ return (Math.random() + 1).toString(36).substring(2)
37
+ }
38
+
39
+ wpm.getFbUserData = function () {
40
+ // We need the first one for InitiateCheckout
41
+ // where getting the user_data from the browser is too slow
42
+ // using wpm.getCookie(), so we cache the user_data earlier.
43
+ // And we need the second one because the ViewContent hit happens too fast
44
+ // after adding a variation to the cart because the function to cache
45
+ // the user_data is too slow. But we can get the user_data using wpm.getCookie()
46
+ // because we don't move away from the page and can wait for the browser
47
+ // to get it.
48
+ if (fBUserData) {
49
+ return fBUserData
50
+ } else {
51
+ return wpm.getFbUserDataFromBrowser()
52
+ }
53
+ }
54
+
55
+ wpm.setFbUserData = function () {
56
+ fBUserData = wpm.getFbUserDataFromBrowser()
57
+ }
58
+
59
+ wpm.getFbUserDataFromBrowser = function () {
60
+ return {
61
+ fbp : wpm.getCookie("_fbp"),
62
+ fbc : wpm.getCookie("_fbc"),
63
+ client_user_agent: navigator.userAgent,
64
+ }
65
+ }
66
+
67
+ wpm.fbViewContent = function (product) {
68
+
69
+ try {
70
+ if (!wpmDataLayer?.pixels?.facebook?.loaded) return
71
+
72
+ let eventId = wpm.getRandomEventId()
73
+
74
+ fbq("track", "ViewContent", {
75
+ content_type: "product",
76
+ content_name: product.name,
77
+ // content_category: product.category,
78
+ content_ids: product.dyn_r_ids[wpmDataLayer.pixels.facebook.dynamic_remarketing.id_type],
79
+ currency : wpmDataLayer.shop.currency,
80
+ value : product.price,
81
+ }, {
82
+ eventID: eventId,
83
+ })
84
+
85
+ product["currency"] = wpmDataLayer.shop.currency
86
+
87
+ jQuery(document).trigger("wpmFbCapiEvent", {
88
+ event_name : "ViewContent",
89
+ event_id : eventId,
90
+ user_data : wpm.getFbUserData(),
91
+ product_data : product,
92
+ product_id : product.dyn_r_ids[wpmDataLayer.pixels.facebook.dynamic_remarketing.id_type],
93
+ event_source_url: window.location.href,
94
+ })
95
+ } catch (e) {
96
+ console.error(e)
97
+ }
98
+ }
99
+
100
+ wpm.facebookContentIds = function () {
101
+ let prodIds = []
102
+
103
+ for (const [key, item] of Object.entries(wpmDataLayer.order.items)) {
104
+
105
+ if (wpmDataLayer?.general?.variationsOutput && 0 !== item.variation_id) {
106
+ prodIds.push(String(wpmDataLayer.products[item.variation_id].dyn_r_ids[wpmDataLayer.pixels.facebook.dynamic_remarketing.id_type]))
107
+ } else {
108
+ prodIds.push(String(wpmDataLayer.products[item.id].dyn_r_ids[wpmDataLayer.pixels.facebook.dynamic_remarketing.id_type]))
109
+ }
110
+ }
111
+
112
+ return prodIds
113
+ }
114
+
115
+ }(window.wpm = window.wpm || {}, jQuery));
116
+
117
+
118
+ /**
119
+ * Execute as soon as possible
120
+ * */
121
+
122
+ (function () {
123
+
124
+ jQuery(document).on("wpmLoadPixels", function () {
125
+
126
+ if (wpm.canIFire("ads", "facebook-ads") && !wpmDataLayer?.pixels?.facebook?.loaded) wpm.loadFacebookPixel()
127
+
128
+ })
129
+
130
+ })()
131
+
132
+
133
+ /**
134
+ * All event listeners
135
+ * */
136
+
137
+ // AddToCart event
138
+ jQuery(document).on("wpmAddToCart", function (event, product) {
139
+
140
+ try {
141
+ if (!wpmDataLayer?.pixels?.facebook?.loaded) return
142
+
143
+ let eventId = wpm.getRandomEventId()
144
+
145
+ // console.log('eventId: ' + eventId);
146
+
147
+ fbq("track", "AddToCart", {
148
+ content_type: "product",
149
+ content_name: product.name,
150
+ content_ids : product.dyn_r_ids[wpmDataLayer.pixels.facebook.dynamic_remarketing.id_type],
151
+ value : parseFloat(product.quantity * product.price),
152
+ currency : product.currency,
153
+ }, {
154
+ eventID: eventId,
155
+ })
156
+
157
+
158
+ product["currency"] = wpmDataLayer.shop.currency
159
+
160
+ jQuery(document).trigger("wpmFbCapiEvent", {
161
+ event_name : "AddToCart",
162
+ event_id : eventId,
163
+ user_data : wpm.getFbUserData(),
164
+ product_data : product,
165
+ product_id : product.dyn_r_ids[wpmDataLayer.pixels.facebook.dynamic_remarketing.id_type],
166
+ event_source_url: window.location.href,
167
+ })
168
+ } catch (e) {
169
+ console.error(e)
170
+ }
171
+ })
172
+
173
+ // InitiateCheckout event
174
+ jQuery(document).on("wpmBeginCheckout", function (event) {
175
+
176
+ try {
177
+ // console.log('firing facebook ads InitiateCheckout event');
178
+
179
+ if (!wpmDataLayer?.pixels?.facebook?.loaded) return
180
+
181
+ let eventId = wpm.getRandomEventId()
182
+
183
+ fbq("track", "InitiateCheckout", {}, {
184
+ eventID: eventId,
185
+ })
186
+
187
+ jQuery(document).trigger("wpmFbCapiEvent", {
188
+ event_name : "InitiateCheckout",
189
+ event_id : eventId,
190
+ user_data : wpm.getFbUserData(),
191
+ event_source_url: window.location.href,
192
+ })
193
+ } catch (e) {
194
+ console.error(e)
195
+ }
196
+ })
197
+
198
+ // AddToWishlist event
199
+ jQuery(document).on("wpmAddToWishlist", function (event, product) {
200
+
201
+ try {
202
+ // console.log('firing facebook ads AddToWishlist event');
203
+ // console.log(product);
204
+
205
+ if (!wpmDataLayer?.pixels?.facebook?.loaded) return
206
+
207
+ let eventId = wpm.getRandomEventId()
208
+
209
+ fbq("track", "AddToWishlist", {
210
+ content_type: "product",
211
+ content_name: product.name,
212
+ content_ids : product.dyn_r_ids[wpmDataLayer.pixels.facebook.dynamic_remarketing.id_type],
213
+ value : parseFloat(product.quantity * product.price),
214
+ currency : product.currency,
215
+ }, {
216
+ eventID: eventId,
217
+ })
218
+
219
+
220
+ product["currency"] = wpmDataLayer.shop.currency
221
+
222
+ jQuery(document).trigger("wpmFbCapiEvent", {
223
+ event_name : "AddToWishlist",
224
+ event_id : eventId,
225
+ user_data : wpm.getFbUserData(),
226
+ product_data : product,
227
+ product_id : product.dyn_r_ids[wpmDataLayer.pixels.facebook.dynamic_remarketing.id_type],
228
+ event_source_url: window.location.href,
229
+ })
230
+ } catch (e) {
231
+ console.error(e)
232
+ }
233
+ })
234
+
235
+ // ViewContent event
236
+ jQuery(document).on("wpmViewItem", function (event, product) {
237
+
238
+ try {
239
+ // console.log('firing facebook ads ViewContent event');
240
+ // console.log(product);
241
+
242
+ if (!wpmDataLayer?.pixels?.facebook?.loaded) return
243
+
244
+ wpm.fbViewContent(product)
245
+ } catch (e) {
246
+ console.error(e)
247
+ }
248
+ })
249
+
250
+ // view search event
251
+ jQuery(document).on("wpmSearch", function () {
252
+
253
+ try {
254
+ if (!wpmDataLayer?.pixels?.facebook?.loaded) return
255
+
256
+ let eventId = wpm.getRandomEventId()
257
+
258
+ fbq("track", "Search", {}, {
259
+ eventID: eventId,
260
+ })
261
+
262
+ jQuery(document).trigger("wpmFbCapiEvent", {
263
+ event_name : "Search",
264
+ event_id : eventId,
265
+ user_data : wpm.getFbUserData(),
266
+ event_source_url: window.location.href,
267
+ })
268
+ } catch (e) {
269
+ console.error(e)
270
+ }
271
+ })
272
+
273
+ // load always event
274
+ jQuery(document).on("wpmLoadAlways", function () {
275
+
276
+ try {
277
+ if (!wpmDataLayer?.pixels?.facebook?.loaded) return
278
+
279
+ wpm.setFbUserData()
280
+ } catch (e) {
281
+ console.error(e)
282
+ }
283
+ })
284
+
285
+ // view order received page event
286
+ // https://developers.pinterest.com/docs/tag/conversion/
287
+ jQuery(document).on("wpmOrderReceivedPage", function () {
288
+
289
+ try {
290
+ if (!wpmDataLayer?.pixels?.facebook?.loaded) return
291
+
292
+ fbq("track", "Purchase",
293
+ {
294
+ content_type: "product",
295
+ value : wpmDataLayer.order.value_filtered,
296
+ currency : wpmDataLayer.order.currency,
297
+ content_ids : wpm.facebookContentIds(),
298
+ },
299
+ {eventID: wpmDataLayer.order.id},
300
+ )
301
+
302
+
303
+ // console.log(wpm.facebookContentIds())
304
+ } catch (e) {
305
+ console.error(e)
306
+ }
307
+ })
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,34 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ (function (wpm, $, undefined) {
2
+
3
+ wpm.load_google_optimize_pixel = function () {
4
+
5
+ try {
6
+ if (wpmDataLayer?.pixels?.google?.optimize?.container_id) {
7
+
8
+ wpmDataLayer.pixels.google.optimize.loaded = true
9
+
10
+ wpm.loadScriptAndCacheIt("https://www.googleoptimize.com/optimize.js?id=" + wpmDataLayer.pixels.google.optimize.container_id)
11
+ // .done(function (script, textStatus) {
12
+ // console.log('Google Optimize loaded')
13
+ // });
14
+ }
15
+ } catch (e) {
16
+ console.error(e)
17
+ }
18
+ }
19
+
20
+ }(window.wpm = window.wpm || {}, jQuery));
21
+
22
+
23
+ (function () {
24
+
25
+ jQuery(document).on("wpmLoadPixels", function () {
26
+
27
+ if (wpm.canIFire("analytics", "google-optimize") && !wpmDataLayer?.pixels?.google?.optimize?.loaded) wpm.load_google_optimize_pixel()
28
+
29
+ })
30
+
31
+ })()
32
+
33
+
34
+
js/public/google.js ADDED
@@ -0,0 +1,279 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
+ if (wpm.googleConfigConditionsMet("ads") && !jQuery.isEmptyObject(wpmDataLayer?.pixels?.google?.ads?.conversionIds)) wpm.fireGtagGoogleAds()
172
+ if (wpm.googleConfigConditionsMet("analytics") && wpmDataLayer?.pixels?.google?.analytics?.universal?.property_id) wpm.fireGtagGoogleAnalyticsUA()
173
+ if (wpm.googleConfigConditionsMet("analytics") && wpmDataLayer?.pixels?.google?.analytics?.ga4?.measurement_id) wpm.fireGtagGoogleAnalyticsGA4()
174
+
175
+ wpmDataLayer.pixels.google.state = "ready"
176
+ } catch (e) {
177
+ console.error(e)
178
+ }
179
+ })
180
+ }
181
+ }
182
+
183
+ wpm.canGoogleLoad = function () {
184
+
185
+ if (wpmDataLayer?.pixels?.google?.consent_mode?.active) {
186
+ return true
187
+ } else if ("category" === wpm.getConsentValues().mode) {
188
+ return !!(wpm.getConsentValues().categories["ads"] || wpm.getConsentValues().categories["analytics"])
189
+ } else if ("pixel" === wpm.getConsentValues().mode) {
190
+ return wpm.getConsentValues().pixels.includes("google-ads") || wpm.getConsentValues().pixels.includes("google-analytics")
191
+ } else {
192
+ console.error("Couldn't find a valid load condition for Google mode in wpmConsentValues")
193
+ return false
194
+ }
195
+ }
196
+
197
+ wpm.gtagLoaded = function () {
198
+ return new Promise(function (resolve, reject) {
199
+
200
+ if (typeof wpmDataLayer?.pixels?.google?.state === "undefined") reject()
201
+
202
+ let startTime = 0
203
+ let timeout = 5000
204
+ let frequency = 200;
205
+
206
+ (function wait() {
207
+ if (wpmDataLayer?.pixels?.google?.state === "ready") return resolve()
208
+ if (startTime >= timeout) return reject()
209
+ startTime += frequency
210
+ setTimeout(wait, frequency)
211
+ })()
212
+ })
213
+ }
214
+
215
+ // wpm.gtagLoadednew = function () {
216
+ // return Promise.race([
217
+ // new Promise(function (resolve, reject) {
218
+ //
219
+ // if (typeof wpmDataLayer?.pixels?.google?.state === "undefined") reject();
220
+ //
221
+ //
222
+ // (function wait() {
223
+ // if (wpmDataLayer?.pixels?.google?.state === "ready") return resolve()
224
+ // if (to >= 1000) return reject()
225
+ // setTimeout(wait, 100)
226
+ // })()
227
+ // }),
228
+ // new Promise(function (resolve, reject) {
229
+ // setTimeout(() => reject(), 1000)
230
+ // }),
231
+ // ],
232
+ // )
233
+ // // .then((value) => {console.log("race then value: " + value)})
234
+ // .catch(
235
+ // (value) => {
236
+ // console.log("race catch value: " + value)
237
+ // return Promise.reject()
238
+ // })
239
+ // }
240
+
241
+
242
+ // const promise1 = new Promise((resolve, reject) => {
243
+ // setTimeout(resolve, 500, "one")
244
+ // })
245
+ //
246
+ // const promise2 = new Promise((resolve, reject) => {
247
+ // setTimeout(reject, 100, "two")
248
+ // })
249
+ //
250
+ // let onlyRunIfResolves = function () {
251
+ // return Promise.race([promise1, promise2])
252
+ // .catch(() => {
253
+ // })
254
+ // }
255
+ //
256
+ // onlyRunIfResolves()
257
+ // .then(() => {
258
+ // console.log("running function")
259
+ // })
260
+
261
+
262
+ }(window.wpm = window.wpm || {}, jQuery));
263
+
264
+
265
+ (function () {
266
+
267
+ jQuery(document).on("wpmLoadPixels", function () {
268
+
269
+ if (
270
+ wpm.canGoogleLoad() &&
271
+ (typeof wpmDataLayer?.pixels?.google?.state === "undefined")
272
+ ) {
273
+ wpm.loadGoogle()
274
+ }
275
+ })
276
+
277
+ // return wpmDataLayer?.pixels?.google?.state === "undefined";
278
+
279
+ })()
js/public/hotjar.js ADDED
@@ -0,0 +1,39 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ (function (wpm, $, undefined) {
2
+
3
+ wpm.load_hotjar_pixel = function () {
4
+
5
+ if (wpmDataLayer?.pixels?.hotjar?.site_id) {
6
+
7
+ // console.log('hotjar loaded');
8
+
9
+ wpmDataLayer.pixels.hotjar.loaded = true;
10
+
11
+ // @formatter:off
12
+ (function(h,o,t,j,a,r){
13
+ h.hj=h.hj||function(){(h.hj.q=h.hj.q||[]).push(arguments)};
14
+ h._hjSettings={hjid:wpmDataLayer.pixels.hotjar.site_id,hjsv:6};
15
+ a=o.getElementsByTagName('head')[0];
16
+ r=o.createElement('script');r.async=1;
17
+ r.src=t+h._hjSettings.hjid+j+h._hjSettings.hjsv;
18
+ a.appendChild(r);
19
+ })(window,document,'https://static.hotjar.com/c/hotjar-','.js?sv=');
20
+ // @formatter:on
21
+
22
+ }
23
+ }
24
+
25
+ }(window.wpm = window.wpm || {}, jQuery));
26
+
27
+
28
+ (function () {
29
+
30
+ jQuery(document).on("wpmLoadPixels", function () {
31
+
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,17 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
+ wpm.wpmDataLayerExists()
9
+ .then(function () {
10
+ jQuery(document).trigger("wpmPreLoadPixels", {})
11
+ })
12
+ .then(function () {
13
+ wpm.pageLoaded().then(function () {
14
+ jQuery(document).trigger("wpmLoad", {})
15
+ })
16
+ })
17
+
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{var e,t,o;null!==(e=wpmDataLayer)&&void 0!==e&&null!==(t=e.pixels)&&void 0!==t&&null!==(o=t.facebook)&&void 0!==o&&o.pixel_id&&(wpmDataLayer.pixels.facebook.loaded=!0,a=window,r=document,n="script",a.fbq||(i=a.fbq=function(){i.callMethod?i.callMethod.apply(i,arguments):i.queue.push(arguments)},a._fbq||(a._fbq=i),i.push=i,i.loaded=!0,i.version="2.0",i.queue=[],(s=r.createElement(n)).async=!0,s.src="https://connect.facebook.net/en_US/fbevents.js",(d=r.getElementsByTagName(n)[0]).parentNode.insertBefore(s,d)),fbq("init",wpmDataLayer.pixels.facebook.pixel_id),fbq("track","PageView"))}catch(n){console.error(n)}var a,r,n,i,s,d},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;!wpm.canIFire("ads","facebook-ads")||null!==(e=wpmDataLayer)&&void 0!==e&&null!==(t=e.pixels)&&void 0!==t&&null!==(o=t.facebook)&&void 0!==o&&o.loaded||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{var t,o,a,r;null!==(t=wpmDataLayer)&&void 0!==t&&null!==(o=t.pixels)&&void 0!==o&&null!==(a=o.google)&&void 0!==a&&null!==(r=a.optimize)&&void 0!==r&&r.container_id&&(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;!wpm.canIFire("analytics","google-optimize")||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.loaded||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 j,x,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!==(j=wpmDataLayer)&&void 0!==j&&null!==(x=j.pixels)&&void 0!==x&&null!==(k=x.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),e.googleConfigConditionsMet("ads")&&!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.fireGtagGoogleAds(),e.googleConfigConditionsMet("analytics")&&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.fireGtagGoogleAnalyticsUA(),e.googleConfigConditionsMet("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.fireGtagGoogleAnalyticsGA4(),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;wpm.canGoogleLoad()&&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.loadGoogle()}))},570:()=>{!function(e,t,o){e.load_hotjar_pixel=function(){var e,t,o,a,r,n,i;null!==(e=wpmDataLayer)&&void 0!==e&&null!==(t=e.pixels)&&void 0!==t&&null!==(o=t.hotjar)&&void 0!==o&&o.site_id&&(wpmDataLayer.pixels.hotjar.loaded=!0,a=window,r=document,a.hj=a.hj||function(){(a.hj.q=a.hj.q||[]).push(arguments)},a._hjSettings={hjid:wpmDataLayer.pixels.hotjar.site_id,hjsv:6},n=r.getElementsByTagName("head")[0],(i=r.createElement("script")).async=1,i.src="https://static.hotjar.com/c/hotjar-"+a._hjSettings.hjid+".js?sv="+a._hjSettings.hjsv,n.appendChild(i))}}(window.wpm=window.wpm||{},jQuery),jQuery(document).on("wpmLoadPixels",(function(){var e,t,o;!wpm.canIFire("analytics","hotjar")||null!==(e=wpmDataLayer)&&void 0!==e&&null!==(t=e.pixels)&&void 0!==t&&null!==(o=t.hotjar)&&void 0!==o&&o.loaded||wpm.load_hotjar_pixel()}))},560:()=>{wpm.wpmDataLayerExists().then((function(){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.urlHasParameter("debugConsentMode")&&(null!==(r=wpmDataLayer)&&void 0!==r&&null!==(n=r.shop)&&void 0!==n&&null!==(i=n.cookie_consent_mgmt)&&void 0!==i&&i.explicit_consent?console.log('WooCommerce Pixel Manager: The "'+o+" (category: "+t+')" pixel has not fired because you have not given consent for it yet. (The shop is in explicit consent mode.)'):console.log('WooCommerce Pixel Manager: The "'+o+" (category: "+t+')" pixel has not fired because you have removed consent for this pixel. (The shop is in implicit consent mode.)')),!1);var r,n,i},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(t){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(t){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(t){e.unblockAllScripts(!0,!0),e.updateGoogleConsentMode(!0,!0)})),document.addEventListener("cmplzStatusChange",(function(t){e.updateConsentCookieValues(),e.unblockAllScripts(y.categories.analytics,y.categories.ads),e.updateGoogleConsentMode(y.categories.analytics,y.categories.ads)})),document.addEventListener("setCookieNotice",(function(t){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(t){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.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(e){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(e){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(e){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(e){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(e){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(e,t){try{var o,a;let e=jQuery("body").attr("class").match(/(postid-)(\d+)/)[2];if(!e)throw Error("Wasn't able to retrieve a productId");if("variable"===wpmDataLayer.shop.product_type&&null!==(o=wpmDataLayer)&&void 0!==o&&null!==(a=o.general)&&void 0!==a&&a.variationsOutput)for(const[t,o]of Object.entries(wpmDataLayer.products))if("parentId"in o){e=o.id;break}if(wpmDataLayer.products&&wpmDataLayer.products[e]){let t=wpm.getProductDetailsFormattedForEvent(e);jQuery(document).trigger("wpmViewItem",t)}}catch(e){console.error(e)}}))})),jQuery(window).on("wpmLoad",(function(){try{JSON.parse(sessionStorage.getItem("wpmFirstPageLoadDone"))?wpm.getCartItems():sessionStorage.setItem("wpmFirstPageLoadDone",JSON.stringify(!0))}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,mBAAcC,cAAd,mBAAsBC,gBAAtB,UAAgCC,UAAY,UAACH,oBAAD,iBAAC,EAAcC,cAAf,iBAAC,EAAsBC,gBAAvB,OAAC,EAAgCE,QAC5EC,IAAIC,SAAS,MAAO,iBAAiBD,IAAIE,uBAK/CV,OAAOC,UAAUC,GAAG,gBAAgB,SAAUS,EAAOC,GAEpD,IAAI,UACH,GAAI,UAACT,oBAAD,iBAAC,EAAcC,cAAf,iBAAC,EAAsBC,gBAAvB,QAAC,EAAgCE,OAAQ,OAE7C,IAAIM,EAAUL,IAAIM,mBAIlBC,IAAI,QAAS,YAAa,CACzBC,aAAc,UACdC,aAAcL,EAAQM,KACtBC,YAAcP,EAAQQ,UAAUjB,aAAaC,OAAOC,SAASgB,oBAAoBC,SACjFC,MAAcC,WAAWZ,EAAQa,SAAWb,EAAQc,OACpDC,SAAcf,EAAQe,UACpB,CACFC,QAASf,IAIVD,EAAO,SAAeT,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AGrB,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,kB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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\tif (wpmDataLayer?.pixels?.facebook?.pixel_id) {\n\n\t\t\t\twpmDataLayer.pixels.facebook.loaded = true\n\n\t\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\t\tfbq(\"init\", wpmDataLayer.pixels.facebook.pixel_id)\n\t\t\t\tfbq(\"track\", \"PageView\")\n\t\t\t}\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 (wpm.canIFire(\"ads\", \"facebook-ads\") && !wpmDataLayer?.pixels?.facebook?.loaded) wpm.loadFacebookPixel()\n\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\tif (wpmDataLayer?.pixels?.google?.optimize?.container_id) {\n\n\t\t\t\twpmDataLayer.pixels.google.optimize.loaded = true\n\n\t\t\t\twpm.loadScriptAndCacheIt(\"https://www.googleoptimize.com/optimize.js?id=\" + wpmDataLayer.pixels.google.optimize.container_id)\n\t\t\t\t// .done(function (script, textStatus) {\n\t\t\t\t// \t\tconsole.log('Google Optimize loaded')\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}(window.wpm = window.wpm || {}, jQuery));\n\n\n(function () {\n\n\tjQuery(document).on(\"wpmLoadPixels\", function () {\n\n\t\tif (wpm.canIFire(\"analytics\", \"google-optimize\") && !wpmDataLayer?.pixels?.google?.optimize?.loaded) wpm.load_google_optimize_pixel()\n\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\tif (wpm.googleConfigConditionsMet(\"ads\") && !jQuery.isEmptyObject(wpmDataLayer?.pixels?.google?.ads?.conversionIds)) wpm.fireGtagGoogleAds()\n\t\t\t\t\t\tif (wpm.googleConfigConditionsMet(\"analytics\") && wpmDataLayer?.pixels?.google?.analytics?.universal?.property_id) wpm.fireGtagGoogleAnalyticsUA()\n\t\t\t\t\t\tif (wpm.googleConfigConditionsMet(\"analytics\") && wpmDataLayer?.pixels?.google?.analytics?.ga4?.measurement_id) wpm.fireGtagGoogleAnalyticsGA4()\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 (\n\t\t\twpm.canGoogleLoad() &&\n\t\t\t(typeof wpmDataLayer?.pixels?.google?.state === \"undefined\")\n\t\t) {\n\t\t\twpm.loadGoogle()\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\tif (wpmDataLayer?.pixels?.hotjar?.site_id) {\n\n\t\t\t// console.log('hotjar loaded');\n\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}\n\t}\n\n}(window.wpm = window.wpm || {}, jQuery));\n\n\n(function () {\n\n\tjQuery(document).on(\"wpmLoadPixels\", function () {\n\n\t\tif (wpm.canIFire(\"analytics\", \"hotjar\") && !wpmDataLayer?.pixels?.hotjar?.loaded) wpm.load_hotjar_pixel()\n\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 */\nwpm.wpmDataLayerExists()\n\t.then(function () {\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(r => {\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 (wpm.urlHasParameter(\"debugConsentMode\")) {\n\t\t\t\tif (wpmDataLayer?.shop?.cookie_consent_mgmt?.explicit_consent) {\n\t\t\t\t\tconsole.log(\"WooCommerce Pixel Manager: The \\\"\" + pixelName + \" (category: \" + category + \")\\\" pixel has not fired because you have not given consent for it yet. (The shop is in explicit consent mode.)\")\n\t\t\t\t} else {\n\t\t\t\t\tconsole.log(\"WooCommerce Pixel Manager: The \\\"\" + pixelName + \" (category: \" + category + \")\\\" pixel has not fired because you have removed consent for this pixel. (The shop is in implicit consent mode.)\")\n\t\t\t\t}\n\t\t\t}\n\n\t\t\treturn false\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 (e) {\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 (e) {\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 (e) {\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 (e) {\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 (e) {\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 (e) {\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.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 (e) {\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 (e) {\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 (e) {\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 (e) {\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 (e) {\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 (event, data) {\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 (!JSON.parse(sessionStorage.getItem(\"wpmFirstPageLoadDone\"))) {\n\t\t\tsessionStorage.setItem(\"wpmFirstPageLoadDone\", JSON.stringify(true))\n\t\t} else {\n\t\t\twpm.getCartItems()\n\t\t}\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","pixel_id","loaded","f","window","b","document","e","fbq","n","callMethod","apply","arguments","queue","push","_fbq","version","t","createElement","async","src","s","getElementsByTagName","parentNode","insertBefore","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","container_id","loadScriptAndCacheIt","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","canGoogleLoad","Promise","resolve","reject","startTime","wait","setTimeout","load_hotjar_pixel","h","o","a","r","hotjar","site_id","hj","q","_hjSettings","hjid","hjsv","appendChild","wpmDataLayerExists","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","log","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","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{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.loaded=!0,o=window,r=document,i="script",o.fbq||(n=o.fbq=function(){n.callMethod?n.callMethod.apply(n,arguments):n.queue.push(arguments)},o._fbq||(o._fbq=n),n.push=n,n.loaded=!0,n.version="2.0",n.queue=[],(l=r.createElement(i)).async=!0,l.src="https://connect.facebook.net/en_US/fbevents.js",(d=r.getElementsByTagName(i)[0]).parentNode.insertBefore(l,d)),fbq("init",wpmDataLayer.pixels.facebook.pixel_id),fbq("track","PageView"))}catch(i){console.error(i)}var o,r,i,n,l,d},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;!wpm.canIFire("ads","facebook-ads")||null!==(e=wpmDataLayer)&&void 0!==e&&null!==(t=e.pixels)&&void 0!==t&&null!==(a=t.facebook)&&void 0!==a&&a.loaded||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{var t,a,o,r;null!==(t=wpmDataLayer)&&void 0!==t&&null!==(a=t.pixels)&&void 0!==a&&null!==(o=a.google)&&void 0!==o&&null!==(r=o.optimize)&&void 0!==r&&r.container_id&&(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;!wpm.canIFire("analytics","google-optimize")||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.loaded||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,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!==(C=wpmDataLayer)&&void 0!==C&&null!==(b=C.pixels)&&void 0!==b&&null!==(j=b.google)&&void 0!==j&&null!==(I=j.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!==(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),e.googleConfigConditionsMet("ads")&&!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.fireGtagGoogleAds(),e.googleConfigConditionsMet("analytics")&&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.fireGtagGoogleAnalyticsUA(),e.googleConfigConditionsMet("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.fireGtagGoogleAnalyticsGA4(),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;wpm.canGoogleLoad()&&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.loadGoogle()}))},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(){var e,t,a;null!==(e=wpmDataLayer)&&void 0!==e&&null!==(t=e.pixels)&&void 0!==t&&null!==(a=t.hotjar)&&void 0!==a&&a.site_id&&(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))}}(window.wpm=window.wpm||{},jQuery),jQuery(document).on("wpmLoadPixels",(function(){var e,t,a;!wpm.canIFire("analytics","hotjar")||null!==(e=wpmDataLayer)&&void 0!==e&&null!==(t=e.pixels)&&void 0!==t&&null!==(a=t.hotjar)&&void 0!==a&&a.loaded||wpm.load_hotjar_pixel()}))},623:()=>{!function(e,t,a){e.load_bing_pixel=function(){try{var e,t,a;null!==(e=wpmDataLayer)&&void 0!==e&&null!==(t=e.pixels)&&void 0!==t&&null!==(a=t.bing)&&void 0!==a&&a.uet_tag_id&&(wpmDataLayer.pixels.bing.loaded=!0,window.uetq=window.uetq||[],o=window,r=document,i="script",o[n="uetq"]=o[n]||[],l=function(){var e={ti:wpmDataLayer.pixels.bing.uet_tag_id};e.q=o[n],o[n]=new UET(e),o[n].push("pageLoad")},(d=r.createElement(i)).src="//bat.bing.com/bat.js",d.async=1,d.onload=d.onreadystatechange=function(){var e=this.readyState;e&&"loaded"!==e&&"complete"!==e||(l(),d.onload=d.onreadystatechange=null)},(s=r.getElementsByTagName(i)[0]).parentNode.insertBefore(d,s))}catch(e){console.error(e)}var o,r,i,n,l,d,s},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;!wpm.canIFire("ads","bing-ads")||null!==(e=wpmDataLayer)&&void 0!==e&&null!==(t=e.pixels)&&void 0!==t&&null!==(a=t.bing)&&void 0!==a&&a.loaded||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{var t,a,o;null!==(t=wpmDataLayer)&&void 0!==t&&null!==(a=t.pixels)&&void 0!==a&&null!==(o=a.pinterest)&&void 0!==o&&o.pixel_id&&(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;!wpm.canIFire("ads","pinterest-ads")||null!==(e=wpmDataLayer)&&void 0!==e&&null!==(t=e.pixels)&&void 0!==t&&null!==(a=t.pinterest)&&void 0!==a&&a.loaded||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{var t,a,o;null!==(t=wpmDataLayer)&&void 0!==t&&null!==(a=t.pixels)&&void 0!==a&&null!==(o=a.snapchat)&&void 0!==o&&o.pixel_id&&(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;!wpm.canIFire("ads","snapchat-ads")||null!==(e=wpmDataLayer)&&void 0!==e&&null!==(t=e.pixels)&&void 0!==t&&null!==(a=t.snapchat)&&void 0!==a&&a.loaded||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{var e,t,a;null!==(e=wpmDataLayer)&&void 0!==e&&null!==(t=e.pixels)&&void 0!==t&&null!==(a=t.tiktok)&&void 0!==a&&a.pixel_id&&(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;!wpm.canIFire("ads","tiktok-ads")||null!==(e=wpmDataLayer)&&void 0!==e&&null!==(t=e.pixels)&&void 0!==t&&null!==(a=t.tiktok)&&void 0!==a&&a.loaded||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{var e,t,a;null!==(e=wpmDataLayer)&&void 0!==e&&null!==(t=e.pixels)&&void 0!==t&&null!==(a=t.twitter)&&void 0!==a&&a.pixel_id&&(wpmDataLayer.pixels.twitter.loaded=!0,o=window,r=document,i="script",o.twq||(n=o.twq=function(){n.exe?n.exe.apply(n,arguments):n.queue.push(arguments)},n.version="1.1",n.queue=[],(l=r.createElement(i)).async=!0,l.src="//static.ads-twitter.com/uwt.js",(d=r.getElementsByTagName(i)[0]).parentNode.insertBefore(l,d)),twq("init",wpmDataLayer.pixels.twitter.pixel_id),twq("track","PageView"))}catch(o){console.error(o)}var o,r,i,n,l,d},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;!wpm.canIFire("ads","twitter-ads")||null!==(e=wpmDataLayer)&&void 0!==e&&null!==(t=e.pixels)&&void 0!==t&&null!==(a=t.twitter)&&void 0!==a&&a.loaded||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(){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.urlHasParameter("debugConsentMode")&&(null!==(r=wpmDataLayer)&&void 0!==r&&null!==(i=r.shop)&&void 0!==i&&null!==(n=i.cookie_consent_mgmt)&&void 0!==n&&n.explicit_consent?console.log('WooCommerce Pixel Manager: The "'+a+" (category: "+t+')" pixel has not fired because you have not given consent for it yet. (The shop is in explicit consent mode.)'):console.log('WooCommerce Pixel Manager: The "'+a+" (category: "+t+')" pixel has not fired because you have removed consent for this pixel. (The shop is in implicit consent mode.)')),!1);var r,i,n},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(t){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(t){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(t){e.unblockAllScripts(!0,!0),e.updateGoogleConsentMode(!0,!0)})),document.addEventListener("cmplzStatusChange",(function(t){e.updateConsentCookieValues(),e.unblockAllScripts(g.categories.analytics,g.categories.ads),e.updateGoogleConsentMode(g.categories.analytics,g.categories.ads)})),document.addEventListener("setCookieNotice",(function(t){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(t){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.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(e){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(e){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(e){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(e){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(e){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(e,t){try{var a,o;let e=jQuery("body").attr("class").match(/(postid-)(\d+)/)[2];if(!e)throw Error("Wasn't able to retrieve a productId");if("variable"===wpmDataLayer.shop.product_type&&null!==(a=wpmDataLayer)&&void 0!==a&&null!==(o=a.general)&&void 0!==o&&o.variationsOutput)for(const[t,a]of Object.entries(wpmDataLayer.products))if("parentId"in a){e=a.id;break}if(wpmDataLayer.products&&wpmDataLayer.products[e]){let t=wpm.getProductDetailsFormattedForEvent(e);jQuery(document).trigger("wpmViewItem",t)}}catch(e){console.error(e)}}))})),jQuery(window).on("wpmLoad",(function(){try{JSON.parse(sessionStorage.getItem("wpmFirstPageLoadDone"))?wpm.getCartItems():sessionStorage.setItem("wpmFirstPageLoadDone",JSON.stringify(!0))}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,IAAI,UACH,UAAIC,oBAAJ,iBAAI,EAAcC,cAAlB,iBAAI,EAAsBC,gBAA1B,OAAI,EAAgCC,WAEnCH,aAAaC,OAAOC,SAASE,QAAS,EAGzBC,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,IAIhCb,IAAI,OAAQV,aAAaC,OAAOC,SAASC,UACzCO,IAAI,QAAS,aAEb,MAAOD,GACRkB,QAAQC,MAAMnB,GAdT,IAASJ,EAAEE,EAAEE,EAAIE,EAAEQ,EAAEI,GAkB5B5B,EAAIkC,iBAAmB,WACtB,OAAQC,KAAKC,SAAW,GAAGC,SAAS,IAAIC,UAAU,IAGnDtC,EAAIuC,cAAgB,WASnB,OAAIpC,GAGIH,EAAIwC,4BAIbxC,EAAIyC,cAAgB,WACnBtC,EAAaH,EAAIwC,4BAGlBxC,EAAIwC,yBAA2B,WAC9B,MAAO,CACNE,IAAmB1C,EAAI2C,UAAU,QACjCC,IAAmB5C,EAAI2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oBjP,KAAOtF,IAAIuiB,uBAClCxe,OAAOlD,UAAUmD,QAAQ,YACzBhE,IAAIyiB,sBAiBLpiB,aAAakjB,cAAe,GAG5B,MAAOziB,GACRkB,QAAQC,MAAMnB,OAQhBiD,OAAOpD,QAAQ4E,GAAG,oBAAoB,WAAY,UAEjD,UAAIlF,oBAAJ,iBAAI,EAAcsD,YAAlB,iBAAI,EAAoBgJ,2BAAxB,OAAI,EAAyCC,kBAC5C5M,IAAI8f,2BAA0B,GAE/B/b,OAAOlD,UAAUmD,QAAQ,gBAAiB,Q,SC34DzCrD,OAAOX,IAAMW,OAAOX,KAAO,GAAI+D,SCH7Byf,EAA2B,GAG/B,SAASC,EAAoBC,GAE5B,IAAIC,EAAeH,EAAyBE,GAC5C,QAAqBxjB,IAAjByjB,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\tif (wpmDataLayer?.pixels?.facebook?.pixel_id) {\n\n\t\t\t\twpmDataLayer.pixels.facebook.loaded = true\n\n\t\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\t\tfbq(\"init\", wpmDataLayer.pixels.facebook.pixel_id)\n\t\t\t\tfbq(\"track\", \"PageView\")\n\t\t\t}\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 (wpm.canIFire(\"ads\", \"facebook-ads\") && !wpmDataLayer?.pixels?.facebook?.loaded) wpm.loadFacebookPixel()\n\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\tif (wpmDataLayer?.pixels?.google?.optimize?.container_id) {\n\n\t\t\t\twpmDataLayer.pixels.google.optimize.loaded = true\n\n\t\t\t\twpm.loadScriptAndCacheIt(\"https://www.googleoptimize.com/optimize.js?id=\" + wpmDataLayer.pixels.google.optimize.container_id)\n\t\t\t\t// .done(function (script, textStatus) {\n\t\t\t\t// \t\tconsole.log('Google Optimize loaded')\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}(window.wpm = window.wpm || {}, jQuery));\n\n\n(function () {\n\n\tjQuery(document).on(\"wpmLoadPixels\", function () {\n\n\t\tif (wpm.canIFire(\"analytics\", \"google-optimize\") && !wpmDataLayer?.pixels?.google?.optimize?.loaded) wpm.load_google_optimize_pixel()\n\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\tif (wpm.googleConfigConditionsMet(\"ads\") && !jQuery.isEmptyObject(wpmDataLayer?.pixels?.google?.ads?.conversionIds)) wpm.fireGtagGoogleAds()\n\t\t\t\t\t\tif (wpm.googleConfigConditionsMet(\"analytics\") && wpmDataLayer?.pixels?.google?.analytics?.universal?.property_id) wpm.fireGtagGoogleAnalyticsUA()\n\t\t\t\t\t\tif (wpm.googleConfigConditionsMet(\"analytics\") && wpmDataLayer?.pixels?.google?.analytics?.ga4?.measurement_id) wpm.fireGtagGoogleAnalyticsGA4()\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 (\n\t\t\twpm.canGoogleLoad() &&\n\t\t\t(typeof wpmDataLayer?.pixels?.google?.state === \"undefined\")\n\t\t) {\n\t\t\twpm.loadGoogle()\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\tif (wpmDataLayer?.pixels?.hotjar?.site_id) {\n\n\t\t\t// console.log('hotjar loaded');\n\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}\n\t}\n\n}(window.wpm = window.wpm || {}, jQuery));\n\n\n(function () {\n\n\tjQuery(document).on(\"wpmLoadPixels\", function () {\n\n\t\tif (wpm.canIFire(\"analytics\", \"hotjar\") && !wpmDataLayer?.pixels?.hotjar?.loaded) wpm.load_hotjar_pixel()\n\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\tif (wpmDataLayer?.pixels?.bing?.uet_tag_id) {\n\n\t\t\t\twpmDataLayer.pixels.bing.loaded = true\n\n\t\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 (wpm.canIFire(\"ads\", \"bing-ads\") && !wpmDataLayer?.pixels?.bing?.loaded) wpm.load_bing_pixel()\n\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\tif (wpmDataLayer?.pixels?.pinterest?.pixel_id) {\n\n\t\t\t\twpmDataLayer.pixels.pinterest.loaded = true;\n\n\t\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\t\t\t}\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 (wpm.canIFire(\"ads\", \"pinterest-ads\") && !wpmDataLayer?.pixels?.pinterest?.loaded) wpm.loadPinterestPixel()\n\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\tif (wpmDataLayer?.pixels?.snapchat?.pixel_id) {\n\n\t\t\t\twpmDataLayer.pixels.snapchat.loaded = true;\n\n\t\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\t\tsnaptr(\"init\", wpmDataLayer.pixels.snapchat.pixel_id, wpm.snapchatGetEmail())\n\t\t\t\tsnaptr(\"track\", \"PAGE_VIEW\")\n\t\t\t}\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 (wpm.canIFire(\"ads\", \"snapchat-ads\") && !wpmDataLayer?.pixels?.snapchat?.loaded) wpm.loadSnapchatPixel()\n\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\tif (wpmDataLayer?.pixels?.tiktok?.pixel_id) {\n\n\t\t\t\twpmDataLayer.pixels.tiktok.loaded = true;\n\n\t\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\t\tttq.track(\"Browse\")\n\t\t\t}\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 (wpm.canIFire(\"ads\", \"tiktok-ads\") && !wpmDataLayer?.pixels?.tiktok?.loaded) wpm.loadTikTokPixel()\n\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\tif (wpmDataLayer?.pixels?.twitter?.pixel_id) {\n\n\t\t\t\twpmDataLayer.pixels.twitter.loaded = true;\n\n\t\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\t\ttwq(\"track\", \"PageView\")\n\t\t\t}\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 (wpm.canIFire(\"ads\", \"twitter-ads\") && !wpmDataLayer?.pixels?.twitter?.loaded) wpm.loadTwitterPixel()\n\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 */\nwpm.wpmDataLayerExists()\n\t.then(function () {\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(r => {\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 (wpm.urlHasParameter(\"debugConsentMode\")) {\n\t\t\t\tif (wpmDataLayer?.shop?.cookie_consent_mgmt?.explicit_consent) {\n\t\t\t\t\tconsole.log(\"WooCommerce Pixel Manager: The \\\"\" + pixelName + \" (category: \" + category + \")\\\" pixel has not fired because you have not given consent for it yet. (The shop is in explicit consent mode.)\")\n\t\t\t\t} else {\n\t\t\t\t\tconsole.log(\"WooCommerce Pixel Manager: The \\\"\" + pixelName + \" (category: \" + category + \")\\\" pixel has not fired because you have removed consent for this pixel. (The shop is in implicit consent mode.)\")\n\t\t\t\t}\n\t\t\t}\n\n\t\t\treturn false\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 (e) {\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 (e) {\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 (e) {\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 (e) {\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 (e) {\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 (e) {\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.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 (e) {\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 (e) {\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 (e) {\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 (e) {\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 (e) {\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 (event, data) {\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 (!JSON.parse(sessionStorage.getItem(\"wpmFirstPageLoadDone\"))) {\n\t\t\tsessionStorage.setItem(\"wpmFirstPageLoadDone\", JSON.stringify(true))\n\t\t} else {\n\t\t\twpm.getCartItems()\n\t\t}\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","pixel_id","loaded","f","window","b","document","e","fbq","n","callMethod","apply","arguments","queue","push","_fbq","version","t","createElement","async","src","s","getElementsByTagName","parentNode","insertBefore","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","container_id","loadScriptAndCacheIt","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","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","site_id","h","o","j","a","r","hj","q","_hjSettings","hjid","hjsv","appendChild","load_bing_pixel","bing","uet_tag_id","uetq","w","d","u","ti","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","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","log","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","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,1937 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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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(r => {
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 (wpm.urlHasParameter("debugConsentMode")) {
1040
+ if (wpmDataLayer?.shop?.cookie_consent_mgmt?.explicit_consent) {
1041
+ console.log("WooCommerce Pixel Manager: The \"" + pixelName + " (category: " + category + ")\" pixel has not fired because you have not given consent for it yet. (The shop is in explicit consent mode.)")
1042
+ } else {
1043
+ console.log("WooCommerce Pixel Manager: The \"" + pixelName + " (category: " + category + ")\" pixel has not fired because you have removed consent for this pixel. (The shop is in implicit consent mode.)")
1044
+ }
1045
+ }
1046
+
1047
+ return false
1048
+ }
1049
+ }
1050
+
1051
+ /**
1052
+ * Runs through each script in <head> and blocks / unblocks it according to the plugin settings
1053
+ * and user consent.
1054
+ */
1055
+
1056
+ // https://stackoverflow.com/q/65453565/4688612
1057
+ wpm.scriptTagObserver = new MutationObserver((mutations) => {
1058
+ mutations.forEach(({addedNodes}) => {
1059
+ [...addedNodes]
1060
+ .forEach(node => {
1061
+
1062
+ if ($(node).data("wpm-cookie-category")) {
1063
+
1064
+ // console.log(node)
1065
+
1066
+ // If the pixel category has been approved > unblock
1067
+ // If the pixel belongs to more than one category, then unblock if one of the categories has been approved
1068
+ // If no category has been approved, but the Google Consent Mode is active, then only unblock the Google scripts
1069
+
1070
+ if (wpm.shouldScriptBeActive(node)) {
1071
+ wpm.unblockScript(node)
1072
+ } else {
1073
+ wpm.blockScript(node)
1074
+ }
1075
+ }
1076
+ })
1077
+ })
1078
+ })
1079
+
1080
+ wpm.scriptTagObserver.observe(document.head, {childList: true, subtree: true})
1081
+ window.addEventListener("DOMContentLoaded", () => wpm.scriptTagObserver.disconnect())
1082
+
1083
+ wpm.shouldScriptBeActive = function (node) {
1084
+
1085
+ if (
1086
+ wpmDataLayer.shop.cookie_consent_mgmt.explicit_consent ||
1087
+ wpmConsentValues.visitorHasChosen
1088
+ ) {
1089
+
1090
+ if (wpmConsentValues.mode === "category" && $(node).data("wpm-cookie-category").split(",").some(element => wpmConsentValues.categories[element])) {
1091
+ return true
1092
+ } else if (wpmConsentValues.mode === "pixel" && wpmConsentValues.pixels.includes($(node).data("wpm-pixel-name"))) {
1093
+ return true
1094
+ } else if (wpmConsentValues.mode === "pixel" && $(node).data("wpm-pixel-name") === "google" && ["google-analytics", "google-ads"].some(element => wpmConsentValues.pixels.includes(element))) {
1095
+ return true
1096
+ } else if (wpmDataLayer?.pixels?.google?.consent_mode?.active && $(node).data("wpm-pixel-name") === "google") {
1097
+ return true
1098
+ } else {
1099
+ return false
1100
+ }
1101
+ } else {
1102
+ return true
1103
+ }
1104
+ }
1105
+
1106
+
1107
+ wpm.unblockScript = function (scriptNode, removeAttach = false) {
1108
+
1109
+ if (removeAttach) $(scriptNode).remove()
1110
+
1111
+ let wpmSrc = $(scriptNode).data("wpm-src")
1112
+ if (wpmSrc) $(scriptNode).attr("src", wpmSrc)
1113
+
1114
+ scriptNode.type = "text/javascript"
1115
+
1116
+ if (removeAttach) $(scriptNode).appendTo("head")
1117
+
1118
+ jQuery(document).trigger("wpmPreLoadPixels", {})
1119
+ }
1120
+
1121
+ wpm.blockScript = function (scriptNode, removeAttach = false) {
1122
+
1123
+ if (removeAttach) $(scriptNode).remove()
1124
+
1125
+ if ($(scriptNode).attr("src")) $(scriptNode).removeAttr("src")
1126
+ scriptNode.type = "blocked/javascript"
1127
+
1128
+ if (removeAttach) $(scriptNode).appendTo("head")
1129
+ }
1130
+
1131
+ wpm.unblockAllScripts = function (analytics = true, ads = true) {
1132
+ // console.log('unblocking all scripts')
1133
+
1134
+ $.each(
1135
+ $("script[type=\"blocked/javascript\"]"), function (index, scriptNode) {
1136
+
1137
+ if ($(scriptNode).data("wpm-cookie-category").includes("analytics") && analytics) {
1138
+ wpm.unblockScript(scriptNode, true)
1139
+ } else if ($(scriptNode).data("wpm-cookie-category").includes("ads") && ads) {
1140
+ wpm.unblockScript(scriptNode, true)
1141
+ }
1142
+ })
1143
+
1144
+ jQuery(document).trigger("wpmPreLoadPixels", {})
1145
+ }
1146
+
1147
+ wpm.unblockSelectedPixels = function () {
1148
+ $.each(
1149
+ $("script[type=\"blocked/javascript\"]"), function (index, node) {
1150
+
1151
+ if (wpmConsentValues.pixels.includes($(node).data("wpm-pixel-name"))) {
1152
+ wpm.unblockScript(node, true)
1153
+ } else if ($(node).data("wpm-pixel-name") === "google" && ["google-analytics", "google-ads"].some(element => wpmConsentValues.pixels.includes(element))) {
1154
+ wpm.unblockScript(node, true)
1155
+ }
1156
+ })
1157
+
1158
+ jQuery(document).trigger("wpmPreLoadPixels", {})
1159
+ }
1160
+
1161
+
1162
+ /**
1163
+ * Block or unblock scripts for each CMP immediately after cookie consent has been updated
1164
+ * by the visitor.
1165
+ */
1166
+
1167
+ // Borlabs Cookie
1168
+ // If visitor accepts cookies in Borlabs Cookie unblock the scripts
1169
+ window.addEventListener("borlabs-cookie-consent-saved", function (e) {
1170
+
1171
+ wpm.updateConsentCookieValues()
1172
+
1173
+ if (wpmConsentValues.mode === "pixel") {
1174
+
1175
+ wpm.unblockSelectedPixels()
1176
+ wpm.updateGoogleConsentMode(wpmConsentValues.pixels.includes("google-analytics"), wpmConsentValues.pixels.includes("google-ads"))
1177
+ } else {
1178
+
1179
+ wpm.unblockAllScripts(wpmConsentValues.categories.analytics, wpmConsentValues.categories.ads)
1180
+ wpm.updateGoogleConsentMode(wpmConsentValues.categories.analytics, wpmConsentValues.categories.ads)
1181
+ }
1182
+ })
1183
+
1184
+ // Cookiebot
1185
+ // If visitor accepts cookies in Cookiebot unblock the scripts
1186
+ // https://www.cookiebot.com/en/developer/
1187
+ window.addEventListener("CookiebotOnAccept", function (e) {
1188
+ if (Cookiebot.consent.statistics) wpmConsentValues.categories.analytics = true
1189
+ if (Cookiebot.consent.marketing) wpmConsentValues.categories.ads = true
1190
+
1191
+ wpm.unblockAllScripts(wpmConsentValues.categories.analytics, wpmConsentValues.categories.ads)
1192
+ wpm.updateGoogleConsentMode(wpmConsentValues.categories.analytics, wpmConsentValues.categories.ads)
1193
+
1194
+ }, false)
1195
+
1196
+ /**
1197
+ * Cookie Script
1198
+ * If visitor accepts cookies in Cookie Script unblock the scripts
1199
+ * https://support.cookie-script.com/article/20-custom-events
1200
+ */
1201
+ window.addEventListener("CookieScriptAccept", function (e) {
1202
+ if (e.detail.categories.includes("performance")) wpmConsentValues.categories.analytics = true
1203
+ if (e.detail.categories.includes("targeting")) wpmConsentValues.categories.ads = true
1204
+
1205
+ wpm.unblockAllScripts(wpmConsentValues.categories.analytics, wpmConsentValues.categories.ads)
1206
+ wpm.updateGoogleConsentMode(wpmConsentValues.categories.analytics, wpmConsentValues.categories.ads)
1207
+ })
1208
+
1209
+ /**
1210
+ * Cookie Script
1211
+ * If visitor accepts cookies in Cookie Script unblock the scripts
1212
+ * https://support.cookie-script.com/
1213
+ */
1214
+ window.addEventListener("CookieScriptAcceptAll", function (e) {
1215
+ wpm.unblockAllScripts(true, true)
1216
+ wpm.updateGoogleConsentMode(true, true)
1217
+ })
1218
+
1219
+ // Complianz Cookie
1220
+ // If visitor accepts cookies in Complianz unblock the scripts
1221
+ document.addEventListener("cmplzStatusChange", function (e) {
1222
+
1223
+ wpm.updateConsentCookieValues()
1224
+
1225
+ // console.log(wpmConsentValues)
1226
+
1227
+ wpm.unblockAllScripts(wpmConsentValues.categories.analytics, wpmConsentValues.categories.ads)
1228
+ wpm.updateGoogleConsentMode(wpmConsentValues.categories.analytics, wpmConsentValues.categories.ads)
1229
+ })
1230
+
1231
+ // Cookie Compliance by hu-manity.co (free and pro)
1232
+ // If visitor accepts cookies in Cookie Notice by hu-manity.co unblock the scripts (free version)
1233
+ // https://wordpress.org/support/topic/events-on-consent-change/#post-15202792
1234
+ document.addEventListener("setCookieNotice", function (e) {
1235
+
1236
+ wpm.updateConsentCookieValues()
1237
+
1238
+ // console.log(wpmConsentValues)
1239
+
1240
+ wpm.unblockAllScripts(wpmConsentValues.categories.analytics, wpmConsentValues.categories.ads)
1241
+ wpm.updateGoogleConsentMode(wpmConsentValues.categories.analytics, wpmConsentValues.categories.ads)
1242
+ })
1243
+
1244
+ /**
1245
+ * Cookie Compliance by hu-manity.co (free and pro)
1246
+ * If visitor accepts cookies in Cookie Notice by hu-manity.co unblock the scripts (pro version)
1247
+ * https://wordpress.org/support/topic/events-on-consent-change/#post-15202792
1248
+ * Because Cookie Notice has no documented API or event that is being triggered on consent save or update
1249
+ * we have to solve this by using a mutation observer.
1250
+ *
1251
+ * @type {MutationObserver}
1252
+ */
1253
+
1254
+ wpm.huObserver = new MutationObserver(function (mutations) {
1255
+ mutations.forEach(({addedNodes}) => {
1256
+ [...addedNodes]
1257
+ .forEach(node => {
1258
+
1259
+ if (node.id === "hu") {
1260
+
1261
+ jQuery(".hu-cookies-save").on("click", function (e) {
1262
+ wpm.updateConsentCookieValues()
1263
+ wpm.unblockAllScripts(wpmConsentValues.categories.analytics, wpmConsentValues.categories.ads)
1264
+ wpm.updateGoogleConsentMode(wpmConsentValues.categories.analytics, wpmConsentValues.categories.ads)
1265
+ })
1266
+ }
1267
+ })
1268
+ })
1269
+ })
1270
+
1271
+ if (window.hu) {
1272
+ wpm.huObserver.observe(document.documentElement || document.body, {childList: true, subtree: true})
1273
+ }
1274
+
1275
+ wpm.version = function () {
1276
+ console.log(wpmDataLayer.version)
1277
+ }
1278
+
1279
+ // https://api.jquery.com/jquery.getscript/
1280
+ wpm.loadScriptAndCacheIt = function (url, options) {
1281
+
1282
+ // Allow user to set any option except for dataType, cache, and url
1283
+ options = jQuery.extend(options || {}, {
1284
+ dataType: "script",
1285
+ cache : true,
1286
+ url : url,
1287
+ })
1288
+
1289
+ // Use $.ajax() since it is more flexible than $.getScript
1290
+ // Return the jqXHR object so we can chain callbacks
1291
+ return jQuery.ajax(options)
1292
+ }
1293
+
1294
+ wpm.getOrderItemPrice = function (orderItem) {
1295
+ return (orderItem.total + orderItem.total_tax) / orderItem.quantity
1296
+ }
1297
+
1298
+ wpm.hasLoginEventFired = function () {
1299
+ let data = wpm.getWpmSessionData()
1300
+ return data?.loginEventFired
1301
+ }
1302
+
1303
+ wpm.setLoginEventFired = function () {
1304
+ let data = wpm.getWpmSessionData()
1305
+ data["loginEventFired"] = true
1306
+ wpm.setWpmSessionData(data)
1307
+ }
1308
+
1309
+ wpm.wpmDataLayerExists = function () {
1310
+ return new Promise(function (resolve) {
1311
+ (function waitForVar() {
1312
+ if (typeof wpmDataLayer !== "undefined") return resolve()
1313
+ setTimeout(waitForVar, 50)
1314
+ })()
1315
+ })
1316
+ }
1317
+
1318
+ wpm.pageLoaded = function () {
1319
+ return new Promise(function (resolve) {
1320
+ (function waitForVar() {
1321
+ if ("complete" === document.readyState) return resolve()
1322
+ setTimeout(waitForVar, 50)
1323
+ })()
1324
+ })
1325
+ }
1326
+
1327
+ wpm.pageReady = function () {
1328
+ return new Promise(function (resolve) {
1329
+ (function waitForVar() {
1330
+ if ("interactive" === document.readyState || "complete" === document.readyState) return resolve()
1331
+ setTimeout(waitForVar, 50)
1332
+ })()
1333
+ })
1334
+ }
1335
+
1336
+ wpm.isMiniCartActive = function () {
1337
+ if (window.sessionStorage) {
1338
+ for (const [key, value] of Object.entries(window.sessionStorage)) {
1339
+ if (key.includes("wc_fragments")) {
1340
+ return true
1341
+ }
1342
+ }
1343
+ return false
1344
+ } else {
1345
+ return false
1346
+ }
1347
+ }
1348
+
1349
+ wpm.urlHasParameter = function (parameter) {
1350
+ let urlParams = new URLSearchParams(window.location.search)
1351
+ return urlParams.has(parameter)
1352
+ }
1353
+
1354
+ // wpm['load'] = {
1355
+ // base: true
1356
+ // };
1357
+
1358
+ window["wpmLoaded"] = {}
1359
+
1360
+ // return {
1361
+ // writeOrderIdToStorage : writeOrderIdToStorage,
1362
+ // isOrderIdStored : isOrderIdStored,
1363
+ // isEmail : isEmail,
1364
+ // removeProductFromCart : removeProductFromCart,
1365
+ // getViewItemProducts : getViewItemProducts,
1366
+ // addProductToCart : addProductToCart,
1367
+ // getCartItemsFromBackEnd: getCartItemsFromBackEnd,
1368
+ // fireCheckoutOption : fireCheckoutOption,
1369
+ // getCartItems : getCartItems
1370
+ // }
1371
+
1372
+ }(window.wpm = window.wpm || {}, jQuery))
1373
+
1374
+
1375
+ /**
1376
+ * Run when page is ready
1377
+ * */
1378
+
1379
+ wpm.pageReady().then(function () {
1380
+
1381
+
1382
+ /**
1383
+ * Run as soon as wpm namespace is loaded
1384
+ */
1385
+
1386
+ wpm.wpmDataLayerExists()
1387
+ .then(function () {
1388
+ // watch for products visible in viewport
1389
+ wpm.startIntersectionObserverToWatch()
1390
+
1391
+ // watch for lazy loaded products
1392
+ wpm.startProductsMutationObserverToWatch()
1393
+ })
1394
+
1395
+ // let products = jQuery(".products, .product")
1396
+
1397
+
1398
+ // remove_from_cart event
1399
+ jQuery(document).on("click", ".remove_from_cart_button, .remove", function (e) {
1400
+ // jQuery('.remove_from_cart_button, .remove').on('click', function (e) {
1401
+
1402
+ try {
1403
+ // console.log('remove_from_cart: ' + jQuery(this).data('product_id'));
1404
+
1405
+ let url = new URL(jQuery(this).attr("href"))
1406
+ let productId = wpm.getProductIdByCartItemKeyUrl(url)
1407
+
1408
+ wpm.removeProductFromCart(productId)
1409
+
1410
+ } catch (e) {
1411
+ console.error(e)
1412
+ }
1413
+ })
1414
+
1415
+
1416
+ // add_to_cart event
1417
+ jQuery(document).on("click", ".add_to_cart_button:not(.product_type_variable), .ajax_add_to_cart, .single_add_to_cart_button", function (e) {
1418
+ // 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) {
1419
+
1420
+ try {
1421
+ // console.log('add_to_cart');
1422
+
1423
+ if (wpmDataLayer.shop.page_type === "product") {
1424
+
1425
+ // first process related and upsell products
1426
+ if (typeof jQuery(this).attr("href") !== "undefined" && jQuery(this).attr("href").includes("add-to-cart")) {
1427
+ // console.log('add-to-cart on upsell and related products');
1428
+ let quantity = 1
1429
+ let productId = jQuery(this).data("product_id")
1430
+ // console.log('productId: ' + productId);
1431
+ wpm.addProductToCart(productId, quantity)
1432
+ } else {
1433
+
1434
+ if (wpmDataLayer.shop.product_type === "simple") {
1435
+
1436
+ // console.log('test');
1437
+ let quantity = Number(jQuery(".input-text.qty").val())
1438
+
1439
+ if (!quantity && quantity !== 0) quantity = 1
1440
+
1441
+ let productId = jQuery(this).val()
1442
+
1443
+ // console.log('productId: ' + productId);
1444
+ // console.log('quantity: ' + quantity);
1445
+
1446
+ wpm.addProductToCart(productId, quantity)
1447
+
1448
+ } else if (wpmDataLayer.shop.product_type === "variable") {
1449
+
1450
+ // console.log('variable');
1451
+
1452
+ let quantity = Number(jQuery(".input-text.qty").val())
1453
+
1454
+ if (!quantity && quantity !== 0) quantity = 1
1455
+
1456
+ let productId = jQuery("[name='variation_id']").val()
1457
+
1458
+ // console.log('productId: ' + productId);
1459
+ // console.log('quantity: ' + quantity);
1460
+
1461
+ wpm.addProductToCart(productId, quantity)
1462
+
1463
+ } else if (wpmDataLayer.shop.product_type === "grouped") {
1464
+
1465
+ // console.log('grouped');
1466
+
1467
+ jQuery(".woocommerce-grouped-product-list-item").each(function () {
1468
+
1469
+ let quantity = Number(jQuery(this).find(".input-text.qty").val())
1470
+
1471
+ if (!quantity && quantity !== 0) quantity = 1
1472
+
1473
+ let classes = jQuery(this).attr("class")
1474
+ let productId = wpm.getPostIdFromString(classes)
1475
+
1476
+ // console.log('productId: ' + productId);
1477
+ // console.log('quantity: ' + quantity);
1478
+
1479
+ wpm.addProductToCart(productId, quantity)
1480
+ })
1481
+ } else if (wpmDataLayer.shop.product_type === "bundle") {
1482
+
1483
+ // console.log('bundle');
1484
+
1485
+ let quantity = Number(jQuery(".input-text.qty").val())
1486
+
1487
+ if (!quantity && quantity !== 0) quantity = 1
1488
+
1489
+ let productId = jQuery("input[name=add-to-cart]").val()
1490
+
1491
+ // console.log('productId: ' + productId);
1492
+ // console.log('quantity: ' + quantity);
1493
+
1494
+ wpm.addProductToCart(productId, quantity)
1495
+ }
1496
+ }
1497
+ } else {
1498
+
1499
+ // console.log('non product page');
1500
+
1501
+ let quantity = 1
1502
+ let productId = jQuery(this).data("product_id")
1503
+ // console.log('productId: ' + productId);
1504
+ wpm.addProductToCart(productId, quantity)
1505
+ }
1506
+ } catch (e) {
1507
+ console.error(e)
1508
+ }
1509
+ })
1510
+
1511
+ // if someone clicks anywhere on a custom /?add-to-cart=123 link
1512
+ // trigger the add to cart event
1513
+ // body.one('click', function (e) {
1514
+ //
1515
+ // try {
1516
+ // if (jQuery(this)[0].URL) {
1517
+ //
1518
+ // let href = new URL(jQuery(this)[0].URL);
1519
+ // let searchParams = new URLSearchParams(href.search);
1520
+ //
1521
+ // if (searchParams.has('add-to-cart')) {
1522
+ // // console.log('non product page, /?add-to-cart=123 link');
1523
+ //
1524
+ // let productId = searchParams.get('add-to-cart');
1525
+ // wpm.addProductToCart(productId, 1);
1526
+ // }
1527
+ // }
1528
+ // } catch (e) {
1529
+ // console.error(e);
1530
+ // }
1531
+ // });
1532
+
1533
+
1534
+ /**
1535
+ * If someone clicks anywhere on a custom /?add-to-cart=123 link
1536
+ * trigger the add to cart event
1537
+ */
1538
+ jQuery(document).one("click", "a:not(.add_to_cart_button, .ajax_add_to_cart, .single_add_to_cart_button)", function (event) {
1539
+ // jQuery('a:not(.add_to_cart_button, .ajax_add_to_cart, .single_add_to_cart_button)').one('click', function (event) {
1540
+
1541
+ try {
1542
+ if (jQuery(event.target).closest("a").attr("href")) {
1543
+
1544
+ let href = jQuery(event.target).closest("a").attr("href")
1545
+
1546
+ if (href.includes("add-to-cart=")) {
1547
+ let matches = href.match(/(add-to-cart=)(\d+)/)
1548
+ // console.log('pid: ' + matches[2])
1549
+ if (matches) wpm.addProductToCart(matches[2], 1)
1550
+ }
1551
+ }
1552
+ } catch (e) {
1553
+ console.error(e)
1554
+ }
1555
+ })
1556
+
1557
+ // select_content GA UA event
1558
+ // select_item GA 4 event
1559
+ // jQuery(document).on('click', '.woocommerce-LoopProduct-link, .wc-block-grid__product, .product-small.box', function (e) {
1560
+ jQuery(document).on("click", ".woocommerce-LoopProduct-link, .wc-block-grid__product, .product, .product-small, .type-product", function (e) {
1561
+ // jQuery('.woocommerce-LoopProduct-link, .wc-block-grid__product, .product, .product-small, .type-product').on('click', function (e) {
1562
+
1563
+ try {
1564
+
1565
+ /**
1566
+ *
1567
+ * On some pages the event fires multiple times, and on product pages
1568
+ * even on page load. Using e.stopPropagation helps to prevent this,
1569
+ * but I dont know why. We don't even have to use this, since only a real
1570
+ * product click yields a valid productId. So we filter the invalid click
1571
+ * events out later down the code. I'll keep it that way because this is
1572
+ * the most compatible way across shops.
1573
+ * e.stopPropagation();
1574
+ * */
1575
+
1576
+ // console.log('select_content and select_item');
1577
+
1578
+ let productId = jQuery(this).nextAll(".wpmProductId:first").data("id")
1579
+ // console.log('select_content and select_item: ' + productId);
1580
+
1581
+
1582
+ /**
1583
+ * On product pages, for some reason, the click event is triggered on the main product on page load.
1584
+ * In that case no ID is found. But we can discard it, since we only want to trigger the event on
1585
+ * related products, which are found below.
1586
+ */
1587
+
1588
+ if (productId) {
1589
+
1590
+ // console.log('select_content and select_item: ' + productId);
1591
+
1592
+ productId = getIdBasedOndVariationsOutputSetting(productId)
1593
+
1594
+ if (!productId) throw Error("Wasn't able to retrieve a productId")
1595
+
1596
+ // console.log('prodid: ' + productId);
1597
+
1598
+ if (wpmDataLayer.products && wpmDataLayer.products[productId]) {
1599
+
1600
+ let product = wpm.getProductDetailsFormattedForEvent(productId)
1601
+
1602
+ jQuery(document).trigger("wpmSelectContentGaUa", product)
1603
+ jQuery(document).trigger("wpmSelectItem", product)
1604
+ }
1605
+ }
1606
+ } catch (e) {
1607
+ console.error(e)
1608
+ }
1609
+ })
1610
+
1611
+ // begin_checkout event
1612
+ jQuery(document).one("click", ".checkout-button, .cart-checkout-button, .button.checkout", function (e) {
1613
+ // jQuery('.checkout-button, .cart-checkout-button, .button.checkout').one('click', function (e) {
1614
+ // console.log('begin_checkout');
1615
+
1616
+ jQuery(document).trigger("wpmBeginCheckout")
1617
+ })
1618
+
1619
+
1620
+ // checkout_progress event
1621
+ // track checkout option event: entered valid billing email
1622
+ jQuery(document).on("input", "#billing_email", function () {
1623
+ // jQuery('#billing_email').on('input', function () {
1624
+
1625
+ if (wpm.isEmail(jQuery(this).val())) {
1626
+ // wpm.fireCheckoutOption(2);
1627
+ wpm.fireCheckoutProgress(2)
1628
+ wpm.emailSelected = true
1629
+ }
1630
+ })
1631
+
1632
+ // track checkout option event: purchase click
1633
+ jQuery(document).on("click", ".wc_payment_methods", function () {
1634
+ // jQuery('.wc_payment_methods').on('click', function () {
1635
+
1636
+ if (false === wpm.paymentMethodSelected) {
1637
+ wpm.fireCheckoutProgress(3)
1638
+ }
1639
+
1640
+ wpm.fireCheckoutOption(3, jQuery("input[name='payment_method']:checked").val())
1641
+ wpm.paymentMethodSelected = true
1642
+ })
1643
+
1644
+ // track checkout option event: purchase click
1645
+ jQuery(document).one("click", "#place_order", function () {
1646
+ // jQuery('#place_order').one('click', function () {
1647
+
1648
+ if (false === wpm.emailSelected) {
1649
+ wpm.fireCheckoutProgress(2)
1650
+ }
1651
+
1652
+ if (false === wpm.paymentMethodSelected) {
1653
+ wpm.fireCheckoutProgress(3)
1654
+ wpm.fireCheckoutOption(3, jQuery("input[name='payment_method']:checked").val())
1655
+ }
1656
+
1657
+ wpm.fireCheckoutProgress(4)
1658
+ })
1659
+
1660
+ // update cart event
1661
+ jQuery(document).on("click", "[name='update_cart']", function (e) {
1662
+ // jQuery("[name='update_cart']").on('click', function (e) {
1663
+
1664
+ try {
1665
+ jQuery(".cart_item").each(function () {
1666
+
1667
+ // let productId = jQuery(this).find('[data-product_id]').data('product_id');
1668
+
1669
+ let url = new URL(jQuery(this).find(".product-remove").find("a").attr("href"))
1670
+ let productId = wpm.getProductIdByCartItemKeyUrl(url)
1671
+
1672
+
1673
+ let quantity = jQuery(this).find(".qty").val()
1674
+
1675
+ if (quantity === 0) {
1676
+ wpm.removeProductFromCart(productId)
1677
+ } else if (quantity < wpmDataLayer.cart[productId].quantity) {
1678
+ wpm.removeProductFromCart(productId, wpmDataLayer.cart[productId].quantity - quantity)
1679
+ } else if (quantity > wpmDataLayer.cart[productId].quantity) {
1680
+ wpm.addProductToCart(productId, quantity - wpmDataLayer.cart[productId].quantity)
1681
+ }
1682
+ })
1683
+ } catch (e) {
1684
+ console.error(e)
1685
+ wpm.getCartItemsFromBackend()
1686
+ }
1687
+ })
1688
+
1689
+
1690
+ // add_to_wishlist
1691
+ jQuery(document).on("click", ".add_to_wishlist, .wl-add-to", function () {
1692
+ // jQuery('.add_to_wishlist, .wl-add-to').on('click', function () {
1693
+
1694
+ try {
1695
+ // console.log('add_to_wishlist');
1696
+ // console.log('this:' + jQuery(this).data('product-id'));
1697
+
1698
+ let productId
1699
+
1700
+ if (jQuery(this).data("productid")) { // for the WooCommerce wishlist plugin
1701
+ productId = jQuery(this).data("productid")
1702
+ } else if (jQuery(this).data("product-id")) { // for the YITH wishlist plugin
1703
+ productId = jQuery(this).data("product-id")
1704
+ }
1705
+
1706
+ if (!productId) throw Error("Wasn't able to retrieve a productId")
1707
+
1708
+ let product = wpm.getProductDetailsFormattedForEvent(productId)
1709
+
1710
+ // console.log('add_to_wishlist');
1711
+ // console.log(product);
1712
+
1713
+ jQuery(document).trigger("wpmAddToWishlist", product)
1714
+ } catch (e) {
1715
+ console.error(e)
1716
+ }
1717
+ })
1718
+
1719
+ jQuery(document).on("updated_cart_totals", function () {
1720
+ jQuery(document).trigger("wpmViewCart")
1721
+ })
1722
+
1723
+
1724
+ /**
1725
+ * Called when the user selects all the required dropdowns / attributes
1726
+ *
1727
+ * Has to be hooked after document ready
1728
+ *
1729
+ * https://stackoverflow.com/a/27849208/4688612
1730
+ * https://stackoverflow.com/a/65065335/4688612
1731
+ */
1732
+ jQuery(".single_variation_wrap").on("show_variation", function (event, variation) {
1733
+
1734
+ try {
1735
+ let productId = getIdBasedOndVariationsOutputSetting(variation.variation_id)
1736
+
1737
+ if (!productId) throw Error("Wasn't able to retrieve a productId")
1738
+
1739
+ if (wpmDataLayer.products && wpmDataLayer.products[productId]) {
1740
+
1741
+ // console.log('productId: ' + productId);
1742
+
1743
+ let product = wpm.getProductDetailsFormattedForEvent(productId)
1744
+
1745
+ jQuery(document).trigger("wpmViewItem", product)
1746
+ }
1747
+ } catch (e) {
1748
+ console.error(e)
1749
+ }
1750
+ })
1751
+
1752
+ /**
1753
+ * Called on variable products when no selection has been done yet
1754
+ * or when the visitor deselects his choice.
1755
+ *
1756
+ * Has to be hooked after document ready
1757
+ */
1758
+
1759
+ jQuery(".single_variation_wrap").on("hide_variation", function (event, data) {
1760
+
1761
+ try {
1762
+ let classes = jQuery("body").attr("class")
1763
+ let productId = classes.match(/(postid-)(\d+)/)[2]
1764
+
1765
+ if (!productId) throw Error("Wasn't able to retrieve a productId")
1766
+
1767
+ /**
1768
+ * If we have a variable product with no preset,
1769
+ * and variations output is enabled,
1770
+ * then we send a viewItem event with the first
1771
+ * variation we find for the parent.
1772
+ * If variations output is disabled,
1773
+ * we just send the parent ID.
1774
+ */
1775
+ if (
1776
+ "variable" === wpmDataLayer.shop.product_type &&
1777
+ wpmDataLayer?.general?.variationsOutput
1778
+ ) {
1779
+ for (const [key, product] of Object.entries(wpmDataLayer.products)) {
1780
+ if ("parentId" in product) {
1781
+ // console.log('pid: ' + value.parentId)
1782
+ productId = product.id
1783
+ break
1784
+ }
1785
+ }
1786
+ }
1787
+
1788
+ if (wpmDataLayer.products && wpmDataLayer.products[productId]) {
1789
+
1790
+ // console.log('productId: ' + productId);
1791
+
1792
+ let product = wpm.getProductDetailsFormattedForEvent(productId)
1793
+
1794
+ jQuery(document).trigger("wpmViewItem", product)
1795
+ }
1796
+
1797
+ } catch (e) {
1798
+ console.error(e)
1799
+ }
1800
+ })
1801
+
1802
+ }) // End document ready wrap
1803
+
1804
+ /**
1805
+ * Set up wpm events
1806
+ */
1807
+
1808
+
1809
+ // populate the wpmDataLayer with the cart items
1810
+ jQuery(window).on("wpmLoad", function () {
1811
+
1812
+ try {
1813
+ // When a new session is initiated there are no items in the cart,
1814
+ // so we can save the call to get the cart items
1815
+ if (!JSON.parse(sessionStorage.getItem("wpmFirstPageLoadDone"))) {
1816
+ sessionStorage.setItem("wpmFirstPageLoadDone", JSON.stringify(true))
1817
+ } else {
1818
+ wpm.getCartItems()
1819
+ }
1820
+ } catch (e) {
1821
+ console.error(e)
1822
+ }
1823
+ })
1824
+
1825
+ // get all add-to-cart= products from backend
1826
+ jQuery(window).on("wpmLoad", function () {
1827
+
1828
+ wpmDataLayer.products = wpmDataLayer.products || {}
1829
+
1830
+ // scan page for add-to-cart= links
1831
+ let productIds = wpm.getAddToCartLinkProductIds()
1832
+
1833
+ wpm.getProductsFromBackend(productIds)
1834
+ })
1835
+
1836
+ /**
1837
+ * Save the referrer into a cookie
1838
+ */
1839
+
1840
+ jQuery(window).on("wpmLoad", function () {
1841
+
1842
+ // can't use session storage as we can't read it from the server
1843
+ if (!wpm.getCookie("wpmReferrer")) {
1844
+
1845
+ if (document.referrer) {
1846
+ let referrerUrl = new URL(document.referrer)
1847
+ let referrerHostname = referrerUrl.hostname
1848
+
1849
+ if (referrerHostname !== window.location.host) {
1850
+ wpm.setCookie("wpmReferrer", referrerHostname)
1851
+ } else {
1852
+ wpm.setCookie("wpmReferrer", "")
1853
+ }
1854
+
1855
+ } else {
1856
+ wpm.setCookie("wpmReferrer", "")
1857
+ }
1858
+ }
1859
+ })
1860
+
1861
+
1862
+ /**
1863
+ * Create our own load event in order to better handle script flow execution when JS "optimizers" shuffle the code.
1864
+ */
1865
+
1866
+ jQuery(window).on("wpmLoad", function () {
1867
+ try {
1868
+ if (typeof wpmDataLayer != "undefined" && !wpmDataLayer?.wpmLoadFired) {
1869
+
1870
+ jQuery(document).trigger("wpmLoadAlways")
1871
+
1872
+ if ("product" === wpmDataLayer.shop.page_type && wpmDataLayer.shop.product_type !== "variable" && wpm.getMainProductIdFromProductPage()) {
1873
+
1874
+ let product = wpm.getProductDataForViewItemEvent(wpm.getMainProductIdFromProductPage())
1875
+ jQuery(document).trigger("wpmViewItem", product)
1876
+
1877
+ } else if ("product_category" === wpmDataLayer.shop.page_type) {
1878
+
1879
+ jQuery(document).trigger("wpmCategory")
1880
+
1881
+ } else if ("search" === wpmDataLayer.shop.page_type) {
1882
+
1883
+ jQuery(document).trigger("wpmSearch")
1884
+
1885
+ } else if ("cart" === wpmDataLayer.shop.page_type) {
1886
+
1887
+ jQuery(document).trigger("wpmViewCart")
1888
+
1889
+ } else if ("order_received_page" === wpmDataLayer.shop.page_type && wpmDataLayer.order) {
1890
+
1891
+ if (!wpm.isOrderIdStored(wpmDataLayer.order.id)) {
1892
+
1893
+ jQuery(document).trigger("wpmOrderReceivedPage")
1894
+ wpm.writeOrderIdToStorage(wpmDataLayer.order.id)
1895
+ }
1896
+ } else {
1897
+ jQuery(document).trigger("wpmEverywhereElse")
1898
+ }
1899
+
1900
+ if (wpmDataLayer?.user?.id && !wpm.hasLoginEventFired()) {
1901
+ jQuery(document).trigger("wpmLogin")
1902
+ wpm.setLoginEventFired()
1903
+ }
1904
+
1905
+ // /**
1906
+ // * Load mini cart fragments into a wpm session storage key,
1907
+ // * after the document load event.
1908
+ // */
1909
+ // jQuery(document).ajaxSend(function (event, jqxhr, settings) {
1910
+ // // console.log('settings.url: ' + settings.url);
1911
+ //
1912
+ // if (settings.url.includes("get_refreshed_fragments") && sessionStorage) {
1913
+ // if (!sessionStorage.getItem("wpmMiniCartActive")) {
1914
+ // sessionStorage.setItem("wpmMiniCartActive", JSON.stringify(true))
1915
+ // }
1916
+ // }
1917
+ // })
1918
+
1919
+ wpmDataLayer.wpmLoadFired = true
1920
+ }
1921
+
1922
+ } catch (e) {
1923
+ console.error(e)
1924
+ }
1925
+ })
1926
+
1927
+ // jQuery(window).on("load", function () {
1928
+ // jQuery(document).trigger("wpmLoad", {})
1929
+ // })
1930
+
1931
+ jQuery(window).on("wpmPreLoadPixels", function () {
1932
+
1933
+ if (wpmDataLayer?.shop?.cookie_consent_mgmt?.explicit_consent) {
1934
+ wpm.updateConsentCookieValues(true)
1935
+ }
1936
+ jQuery(document).trigger("wpmLoadPixels", {})
1937
+ })
languages/woocommerce-google-adwords-conversion-tracking-tag.pot CHANGED
@@ -2,21 +2,21 @@
2
  # This file is distributed under the GNU General Public License v3.0.
3
  msgid ""
4
  msgstr ""
5
- "Project-Id-Version: WooCommerce Pixel Manager 1.16.3\n"
6
  "Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/src\n"
7
  "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
8
  "Language-Team: LANGUAGE <LL@li.org>\n"
9
  "MIME-Version: 1.0\n"
10
  "Content-Type: text/plain; charset=UTF-8\n"
11
  "Content-Transfer-Encoding: 8bit\n"
12
- "POT-Creation-Date: 2022-04-07T03:49:34+00:00\n"
13
  "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
14
  "X-Generator: WP-CLI 2.6.0\n"
15
  "X-Domain: woocommerce-google-adwords-conversion-tracking-tag\n"
16
 
17
  #. Plugin Name of the plugin
18
- #: wgact.php:207
19
- #: wgact.php:208
20
  msgid "WooCommerce Pixel Manager"
21
  msgstr ""
22
 
@@ -36,222 +36,222 @@ msgstr ""
36
  msgid "https://sweetcode.com"
37
  msgstr ""
38
 
39
- #: classes/admin/class-admin.php:226
40
  #: classes/admin/class-admin.php:227
 
41
  msgid "Pixel Manager"
42
  msgstr ""
43
 
44
- #: classes/admin/class-admin.php:257
45
  msgid "Main"
46
  msgstr ""
47
 
48
- #: classes/admin/class-admin.php:278
49
  msgid "Google"
50
  msgstr ""
51
 
52
- #: classes/admin/class-admin.php:301
53
  msgid "Google Ads Conversion ID"
54
  msgstr ""
55
 
56
- #: classes/admin/class-admin.php:313
57
  msgid "Google Ads Purchase Conversion Label"
58
  msgstr ""
59
 
60
- #: classes/admin/class-admin.php:324
61
  msgid "Google Analytics UA"
62
  msgstr ""
63
 
64
- #: classes/admin/class-admin.php:335
65
  msgid "Google Analytics 4"
66
  msgstr ""
67
 
68
- #: classes/admin/class-admin.php:346
69
  msgid "Google Optimize"
70
  msgstr ""
71
 
72
- #: classes/admin/class-admin.php:358
73
- msgid "Meta (Facebook)"
74
  msgstr ""
75
 
76
- #: classes/admin/class-admin.php:381
77
- msgid "Meta (Facebook) pixel ID"
78
  msgstr ""
79
 
80
- #: classes/admin/class-admin.php:393
81
  msgid "more pixels"
82
  msgstr ""
83
 
84
- #: classes/admin/class-admin.php:418
85
  msgid "Microsoft Advertising UET tag ID"
86
  msgstr ""
87
 
88
- #: classes/admin/class-admin.php:430
89
  msgid "Twitter pixel ID"
90
  msgstr ""
91
 
92
- #: classes/admin/class-admin.php:442
93
  msgid "Pinterest pixel ID"
94
  msgstr ""
95
 
96
- #: classes/admin/class-admin.php:454
97
  msgid "Snapchat pixel ID"
98
  msgstr ""
99
 
100
- #: classes/admin/class-admin.php:466
101
  msgid "TikTok pixel ID"
102
  msgstr ""
103
 
104
- #: classes/admin/class-admin.php:479
105
  msgid "Hotjar site ID"
106
  msgstr ""
107
 
108
- #: classes/admin/class-admin.php:491
109
  msgid "Advanced"
110
  msgstr ""
111
 
112
- #: classes/admin/class-admin.php:542
113
  msgid "Order Total Logic"
114
  msgstr ""
115
 
116
- #: classes/admin/class-admin.php:554
117
  msgid "Order Duplication Prevention"
118
  msgstr ""
119
 
120
- #: classes/admin/class-admin.php:566
121
  msgid "Maximum Compatibility Mode"
122
  msgstr ""
123
 
124
- #: classes/admin/class-admin.php:580
125
- msgid "Disable Tracking for User Roles"
126
  msgstr ""
127
 
128
- #: classes/admin/class-admin.php:614
129
  msgid "Conversion Cart Data"
130
  msgstr ""
131
 
132
- #: classes/admin/class-admin.php:627
133
  msgid "Enhanced E-Commerce"
134
  msgstr ""
135
 
136
- #: classes/admin/class-admin.php:639
137
  msgid "GA 4 API secret"
138
  msgstr ""
139
 
140
- #: classes/admin/class-admin.php:652
141
  msgid "Enhanced Link Attribution"
142
  msgstr ""
143
 
144
- #: classes/admin/class-admin.php:665
145
  msgid "Google User ID"
146
  msgstr ""
147
 
148
- #: classes/admin/class-admin.php:677
149
  msgid "Google Ads Enhanced Conversions"
150
  msgstr ""
151
 
152
- #: classes/admin/class-admin.php:691
153
  msgid "Google Ads Phone Conversion Number"
154
  msgstr ""
155
 
156
- #: classes/admin/class-admin.php:703
157
  msgid "Google Ads Phone Conversion Label"
158
  msgstr ""
159
 
160
- #: classes/admin/class-admin.php:716
161
  msgid "Cookie Consent Management"
162
  msgstr ""
163
 
164
- #: classes/admin/class-admin.php:739
165
  msgid "Google Consent Mode"
166
  msgstr ""
167
 
168
- #: classes/admin/class-admin.php:751
169
  msgid "Google Consent Regions"
170
  msgstr ""
171
 
172
- #: classes/admin/class-admin.php:763
173
  msgid "Explicit Consent Mode"
174
  msgstr ""
175
 
176
- #: classes/admin/class-admin.php:776
177
  msgid "Borlabs Cookie support"
178
  msgstr ""
179
 
180
- #: classes/admin/class-admin.php:790
181
  msgid "Cookiebot support"
182
  msgstr ""
183
 
184
- #: classes/admin/class-admin.php:804
185
  msgid "Complianz GDPR support"
186
  msgstr ""
187
 
188
- #: classes/admin/class-admin.php:818
189
  msgid "Cookie Notice support"
190
  msgstr ""
191
 
192
- #: classes/admin/class-admin.php:832
193
  msgid "Cookie Script support"
194
  msgstr ""
195
 
196
- #: classes/admin/class-admin.php:846
197
  msgid "GDPR Cookie Compliance support"
198
  msgstr ""
199
 
200
- #: classes/admin/class-admin.php:860
201
  msgid "GDPR Cookie Consent support"
202
  msgstr ""
203
 
204
- #: classes/admin/class-admin.php:893
205
- msgid "Meta (Facebook) CAPI: token"
206
  msgstr ""
207
 
208
- #: classes/admin/class-admin.php:905
209
- msgid "Meta (Facebook) CAPI: process anonymous hits"
210
  msgstr ""
211
 
212
- #: classes/admin/class-admin.php:917
213
- msgid "Meta (Facebook) CAPI: send additional visitor identifiers"
214
  msgstr ""
215
 
216
- #: classes/admin/class-admin.php:929
217
- msgid "Meta (Facebook) Microdata Tags for Catalogues"
218
  msgstr ""
219
 
220
- #: classes/admin/class-admin.php:941
221
- #: classes/admin/class-admin.php:954
222
- #: classes/admin/class-admin.php:965
223
  msgid "Dynamic Remarketing"
224
  msgstr ""
225
 
226
- #: classes/admin/class-admin.php:977
227
  msgid "Product Identifier"
228
  msgstr ""
229
 
230
- #: classes/admin/class-admin.php:989
231
  msgid "Variations output"
232
  msgstr ""
233
 
234
- #: classes/admin/class-admin.php:1002
235
  msgid "Google Business Vertical"
236
  msgstr ""
237
 
238
- #: classes/admin/class-admin.php:1015
239
- #: classes/admin/class-admin.php:1024
240
  msgid "Support"
241
  msgstr ""
242
 
243
- #: classes/admin/class-admin.php:1032
244
- #: classes/admin/class-admin.php:1042
245
  msgid "Author"
246
  msgstr ""
247
 
248
- #: classes/admin/class-admin.php:1078
249
  msgid ""
250
  "It looks like you are using some sort of ad or script blocker which is blocking the script and CSS files of this plugin.\n"
251
  " In order for the plugin to work properly you need to disable the script blocker."
252
  msgstr ""
253
 
254
- #: classes/admin/class-admin.php:1085
255
  #: classes/admin/class-notifications.php:31
256
  #: classes/admin/class-notifications.php:73
257
  #: classes/admin/class-notifications.php:114
@@ -259,413 +259,429 @@ msgstr ""
259
  msgid "Learn more"
260
  msgstr ""
261
 
262
- #: classes/admin/class-admin.php:1130
263
  msgid "Profit Driven Marketing by SweetCode"
264
  msgstr ""
265
 
266
- #: classes/admin/class-admin.php:1155
267
  msgid "Visit us here:"
268
  msgstr ""
269
 
270
- #: classes/admin/class-admin.php:1200
271
  msgid "Contacting Support"
272
  msgstr ""
273
 
274
- #: classes/admin/class-admin.php:1214
275
  msgid "Debug Information"
276
  msgstr ""
277
 
278
- #: classes/admin/class-admin.php:1223
279
  msgid "copy to clipboard"
280
  msgstr ""
281
 
282
- #: classes/admin/class-admin.php:1237
283
  msgid "Translations"
284
  msgstr ""
285
 
286
- #: classes/admin/class-admin.php:1238
287
  msgid "If you want to participate improving the translations of this plugin into your language, please follow this link:"
288
  msgstr ""
289
 
290
- #: classes/admin/class-admin.php:1256
291
  msgid "Post a support request in the WordPress support forum here: "
292
  msgstr ""
293
 
294
- #: classes/admin/class-admin.php:1259
295
  msgid "Support forum"
296
  msgstr ""
297
 
298
- #: classes/admin/class-admin.php:1263
299
  msgid "(Never post the debug or other sensitive information to the support forum. Instead send us the information by email.)"
300
  msgstr ""
301
 
302
- #: classes/admin/class-admin.php:1266
303
  msgid "Or send us an email to the following address: "
304
  msgstr ""
305
 
306
- #: classes/admin/class-admin.php:1282
307
  msgid "Send us your support request through the WooCommerce.com dashboard: "
308
  msgstr ""
309
 
310
- #: classes/admin/class-admin.php:1296
311
  msgid "More details about the developer of this plugin: "
312
  msgstr ""
313
 
314
- #: classes/admin/class-admin.php:1299
315
  msgid "Developer: SweetCode"
316
  msgstr ""
317
 
318
- #: classes/admin/class-admin.php:1301
319
  msgid "Website: "
320
  msgstr ""
321
 
322
- #: classes/admin/class-admin.php:1324
323
  msgid "The Google Analytics Universal property ID looks like this:"
324
  msgstr ""
325
 
326
- #: classes/admin/class-admin.php:1340
327
  msgid "The Google Analytics 4 measurement ID looks like this:"
328
  msgstr ""
329
 
330
- #: classes/admin/class-admin.php:1356
331
  msgid "The conversion ID looks similar to this:"
332
  msgstr ""
333
 
334
- #: classes/admin/class-admin.php:1372
335
  msgid "The purchase conversion label looks similar to this:"
336
  msgstr ""
337
 
338
- #: classes/admin/class-admin.php:1376
339
- #: classes/admin/class-admin.php:2103
340
  msgid "Requires an active Google Ads Conversion ID"
341
  msgstr ""
342
 
343
- #: classes/admin/class-admin.php:1394
344
  msgid "The Google Optimize container ID looks like this:"
345
  msgstr ""
346
 
347
- #: classes/admin/class-admin.php:1410
348
- msgid "The Meta (Facebook) pixel ID looks similar to this:"
349
  msgstr ""
350
 
351
- #: classes/admin/class-admin.php:1428
352
  msgid "The Microsoft Advertising UET tag ID looks similar to this:"
353
  msgstr ""
354
 
355
- #: classes/admin/class-admin.php:1447
356
  msgid "The Twitter pixel ID looks similar to this:"
357
  msgstr ""
358
 
359
- #: classes/admin/class-admin.php:1466
360
  msgid "The Pinterest pixel ID looks similar to this:"
361
  msgstr ""
362
 
363
- #: classes/admin/class-admin.php:1485
364
  msgid "The Snapchat pixel ID looks similar to this:"
365
  msgstr ""
366
 
367
- #: classes/admin/class-admin.php:1504
368
  msgid "The TikTok pixel ID looks similar to this:"
369
  msgstr ""
370
 
371
- #: classes/admin/class-admin.php:1516
372
  msgid "The Hotjar site ID looks similar to this:"
373
  msgstr ""
374
 
375
- #: classes/admin/class-admin.php:1526
376
  msgid "Use order_subtotal: Doesn't include tax and shipping (default)"
377
  msgstr ""
378
 
379
- #: classes/admin/class-admin.php:1533
380
  msgid "Use order_total: Includes tax and shipping"
381
  msgstr ""
382
 
383
- #: classes/admin/class-admin.php:1536
384
  msgid "This is the order total amount reported back to Google Ads"
385
  msgstr ""
386
 
387
- #: classes/admin/class-admin.php:1556
388
  msgid "open the documentation"
389
  msgstr ""
390
 
391
- #: classes/admin/class-admin.php:1576
392
  msgid "Enable Google consent mode with standard settings"
393
  msgstr ""
394
 
395
- #: classes/admin/class-admin.php:1614
396
  msgid "If no region is set, then the restrictions are enabled for all regions. If you specify one or more regions, then the restrictions only apply for the specified regions."
397
  msgstr ""
398
 
399
- #: classes/admin/class-admin.php:1635
400
  msgid "Enable Google Analytics enhanced e-commerce"
401
  msgstr ""
402
 
403
- #: classes/admin/class-admin.php:1646
404
- #: classes/admin/class-admin.php:1707
405
- #: classes/admin/class-admin.php:1737
406
  msgid "You need to activate at least Google Analytics UA or Google Analytics 4"
407
  msgstr ""
408
 
409
- #: classes/admin/class-admin.php:1668
410
  msgid "Google Analytics 4 activation required"
411
  msgstr ""
412
 
413
- #: classes/admin/class-admin.php:1673
414
  msgid "Enhanced E-Commerce activation required"
415
  msgstr ""
416
 
417
- #: classes/admin/class-admin.php:1676
418
  msgid "If enabled, purchase and refund events will be sent to Google through the measurement protocol for increased accuracy."
419
  msgstr ""
420
 
421
- #: classes/admin/class-admin.php:1691
422
  msgid "Enable Google Analytics enhanced link attribution"
423
  msgstr ""
424
 
425
- #: classes/admin/class-admin.php:1726
426
  msgid "Enable Google user ID"
427
  msgstr ""
428
 
429
- #: classes/admin/class-admin.php:1756
430
  msgid "Enable Google Ads Enhanced Conversions"
431
  msgstr ""
432
 
433
- #: classes/admin/class-admin.php:1767
434
  msgid "You need to activate Google Ads"
435
  msgstr ""
436
 
437
- #: classes/admin/class-admin.php:1787
438
  msgid "The Google Ads phone conversion number must be in the same format as on the website."
439
  msgstr ""
440
 
441
- #: classes/admin/class-admin.php:1809
442
  msgid "Borlabs Cookie detected. Automatic support is:"
443
  msgstr ""
444
 
445
- #: classes/admin/class-admin.php:1815
446
  msgid "Cookiebot detected. Automatic support is:"
447
  msgstr ""
448
 
449
- #: classes/admin/class-admin.php:1821
450
  msgid "Complianz GDPR detected. Automatic support is:"
451
  msgstr ""
452
 
453
- #: classes/admin/class-admin.php:1827
454
  msgid "Cookie Notice (by hu-manity.co) detected. Automatic support is:"
455
  msgstr ""
456
 
457
- #: classes/admin/class-admin.php:1833
458
  msgid "Cookie Script (by cookie-script.com) detected. Automatic support is:"
459
  msgstr ""
460
 
461
- #: classes/admin/class-admin.php:1839
462
  msgid "GDPR Cookie Compliance (by Moove Agency) detected. Automatic support is:"
463
  msgstr ""
464
 
465
- #: classes/admin/class-admin.php:1845
466
  msgid "GDPR Cookie Consent (by WebToffee) detected. Automatic support is:"
467
  msgstr ""
468
 
469
- #: classes/admin/class-admin.php:1864
470
  msgid "Enable Explicit Consent Mode"
471
  msgstr ""
472
 
473
- #: classes/admin/class-admin.php:1873
474
  msgid "Only activate the Explicit Consent Mode if you are also using a Cookie Management Platform (a cookie banner) that is compatible with this plugin. Find a list of compatible plugins in the documentation."
475
  msgstr ""
476
 
477
- #: classes/admin/class-admin.php:1892
478
- #: classes/admin/class-admin.php:1925
479
- #: classes/admin/class-admin.php:1954
480
- #: classes/admin/class-admin.php:1982
481
- msgid "You need to activate the Meta (Facebook) pixel"
482
  msgstr ""
483
 
484
- #: classes/admin/class-admin.php:1916
485
- msgid "Send CAPI hits for anonymous visitors who likely have blocked the Meta (Facebook) pixel."
486
  msgstr ""
487
 
488
- #: classes/admin/class-admin.php:1945
489
  msgid "Include additional visitor's identifiers, such as IP address, email and shop ID in the CAPI hit."
490
  msgstr ""
491
 
492
- #: classes/admin/class-admin.php:1973
493
- msgid "Enable Meta (Facebook) product microdata output"
 
 
 
 
 
 
 
 
494
  msgstr ""
495
 
496
- #: classes/admin/class-admin.php:2009
497
  msgid "Only disable order duplication prevention for testing. Remember to re-enable the setting once done."
498
  msgstr ""
499
 
500
- #: classes/admin/class-admin.php:2026
501
  msgid "Enable the maximum compatibility mode"
502
  msgstr ""
503
 
504
- #: classes/admin/class-admin.php:2062
505
  msgid "Advanced order duplication prevention is "
506
  msgstr ""
507
 
508
- #: classes/admin/class-admin.php:2064
509
  msgid "Basic order duplication prevention is "
510
  msgstr ""
511
 
512
- #: classes/admin/class-admin.php:2088
513
  msgid "Enable dynamic remarketing audience collection"
514
  msgstr ""
515
 
516
- #: classes/admin/class-admin.php:2109
517
  msgid "You need to choose the correct product identifier setting in order to match the product identifiers in the product feeds."
518
  msgstr ""
519
 
520
- #: classes/admin/class-admin.php:2127
521
  msgid "Enable variations output"
522
  msgstr ""
523
 
524
- #: classes/admin/class-admin.php:2138
525
  msgid "In order for this to work you need to upload your product feed including product variations and the item_group_id. Disable it, if you choose only to upload the parent product for variable products."
526
  msgstr ""
527
 
528
- #: classes/admin/class-admin.php:2153
529
  msgid "Retail"
530
  msgstr ""
531
 
532
- #: classes/admin/class-admin.php:2163
533
  msgid "Education"
534
  msgstr ""
535
 
536
- #: classes/admin/class-admin.php:2173
537
  msgid "Hotels and rentals"
538
  msgstr ""
539
 
540
- #: classes/admin/class-admin.php:2183
541
  msgid "Jobs"
542
  msgstr ""
543
 
544
- #: classes/admin/class-admin.php:2193
545
  msgid "Local deals"
546
  msgstr ""
547
 
548
- #: classes/admin/class-admin.php:2203
549
  msgid "Real estate"
550
  msgstr ""
551
 
552
- #: classes/admin/class-admin.php:2213
553
  msgid "Custom"
554
  msgstr ""
555
 
556
- #: classes/admin/class-admin.php:2232
557
  msgid "ID of your Google Merchant Center account. It looks like this: 12345678"
558
  msgstr ""
559
 
560
- #: classes/admin/class-admin.php:2241
 
 
 
 
 
 
 
 
561
  msgid "post ID (default)"
562
  msgstr ""
563
 
564
- #: classes/admin/class-admin.php:2247
565
  msgid "SKU"
566
  msgstr ""
567
 
568
- #: classes/admin/class-admin.php:2254
569
  msgid "ID for the WooCommerce Google Product Feed. Outputs the post ID with woocommerce_gpf_ prefix *"
570
  msgstr ""
571
 
572
- #: classes/admin/class-admin.php:2261
573
  msgid "ID for the WooCommerce Google Listings & Ads Plugin. Outputs the post ID with gla_ prefix **"
574
  msgstr ""
575
 
576
- #: classes/admin/class-admin.php:2265
577
  msgid "Choose a product identifier."
578
  msgstr ""
579
 
580
- #: classes/admin/class-admin.php:2268
581
  msgid "* This is for users of the WooCommerce Google Product Feed Plugin"
582
  msgstr ""
583
 
584
- #: classes/admin/class-admin.php:2272
585
  msgid "** This is for users of the WooCommerce Google Listings & Ads Plugin"
586
  msgstr ""
587
 
588
- #: classes/admin/class-admin.php:2281
589
  msgid "beta"
590
  msgstr ""
591
 
592
- #: classes/admin/class-admin.php:2285
593
- #: classes/admin/class-admin.php:2290
594
  msgid "active"
595
  msgstr ""
596
 
597
- #: classes/admin/class-admin.php:2295
598
- #: classes/admin/class-admin.php:2300
599
  msgid "inactive"
600
  msgstr ""
601
 
602
- #: classes/admin/class-admin.php:2305
603
- #: classes/admin/class-admin.php:2310
604
  msgid "partially active"
605
  msgstr ""
606
 
607
- #: classes/admin/class-admin.php:2321
608
  msgid "Pro Feature"
609
  msgstr ""
610
 
611
- #: classes/admin/class-admin.php:2365
612
  msgid "You have entered an invalid Google Analytics Universal property ID."
613
  msgstr ""
614
 
615
- #: classes/admin/class-admin.php:2373
616
  msgid "You have entered an invalid Google Analytics 4 measurement ID."
617
  msgstr ""
618
 
619
- #: classes/admin/class-admin.php:2381
620
  msgid "You have entered an invalid Google Analytics 4 API key."
621
  msgstr ""
622
 
623
- #: classes/admin/class-admin.php:2389
624
  msgid "You have entered an invalid conversion ID. It only contains 8 to 10 digits."
625
  msgstr ""
626
 
627
- #: classes/admin/class-admin.php:2397
628
- #: classes/admin/class-admin.php:2405
629
  msgid "You have entered an invalid conversion label."
630
  msgstr ""
631
 
632
- #: classes/admin/class-admin.php:2413
633
  msgid "You have entered an invalid merchant ID. It only contains 7 to 10 digits."
634
  msgstr ""
635
 
636
- #: classes/admin/class-admin.php:2421
637
  msgid "You have entered an invalid Google Optimize container ID."
638
  msgstr ""
639
 
640
- #: classes/admin/class-admin.php:2429
641
- msgid "You have entered an invalid Meta (Facebook) pixel ID. It only contains 14 to 16 digits."
642
  msgstr ""
643
 
644
- #: classes/admin/class-admin.php:2437
645
- msgid "You have entered an invalid Meta (Facebook) CAPI token."
646
  msgstr ""
647
 
648
- #: classes/admin/class-admin.php:2445
649
  msgid "You have entered an invalid Bing Ads UET tag ID. It only contains 7 to 9 digits."
650
  msgstr ""
651
 
652
- #: classes/admin/class-admin.php:2453
653
  msgid "You have entered an invalid Twitter pixel ID. It only contains 5 to 7 lowercase letters and numbers."
654
  msgstr ""
655
 
656
- #: classes/admin/class-admin.php:2461
657
  msgid "You have entered an invalid Pinterest pixel ID. It only contains 13 digits."
658
  msgstr ""
659
 
660
- #: classes/admin/class-admin.php:2469
661
  msgid "You have entered an invalid Snapchat pixel ID."
662
  msgstr ""
663
 
664
- #: classes/admin/class-admin.php:2477
665
  msgid "You have entered an invalid TikTok pixel ID."
666
  msgstr ""
667
 
668
- #: classes/admin/class-admin.php:2485
669
  msgid "You have entered an invalid Hotjar site ID. It only contains 6 to 9 digits."
670
  msgstr ""
671
 
@@ -762,14 +778,14 @@ msgstr ""
762
  msgid "Find more information about the the reason in our documentation: "
763
  msgstr ""
764
 
765
- #: wgact.php:223
766
  msgid "WooCommerce Pixel Manager error"
767
  msgstr ""
768
 
769
- #: wgact.php:225
770
  msgid "Your environment doesn't meet all the system requirements listed below."
771
  msgstr ""
772
 
773
- #: wgact.php:229
774
  msgid "The WooCommerce plugin needs to be activated"
775
  msgstr ""
2
  # This file is distributed under the GNU General Public License v3.0.
3
  msgid ""
4
  msgstr ""
5
+ "Project-Id-Version: WooCommerce Pixel Manager 1.16.0\n"
6
  "Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/src\n"
7
  "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
8
  "Language-Team: LANGUAGE <LL@li.org>\n"
9
  "MIME-Version: 1.0\n"
10
  "Content-Type: text/plain; charset=UTF-8\n"
11
  "Content-Transfer-Encoding: 8bit\n"
12
+ "POT-Creation-Date: 2022-03-31T18:30:43+00:00\n"
13
  "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
14
  "X-Generator: WP-CLI 2.6.0\n"
15
  "X-Domain: woocommerce-google-adwords-conversion-tracking-tag\n"
16
 
17
  #. Plugin Name of the plugin
18
+ #: wgact.php:205
19
+ #: wgact.php:206
20
  msgid "WooCommerce Pixel Manager"
21
  msgstr ""
22
 
36
  msgid "https://sweetcode.com"
37
  msgstr ""
38
 
 
39
  #: classes/admin/class-admin.php:227
40
+ #: classes/admin/class-admin.php:228
41
  msgid "Pixel Manager"
42
  msgstr ""
43
 
44
+ #: classes/admin/class-admin.php:258
45
  msgid "Main"
46
  msgstr ""
47
 
48
+ #: classes/admin/class-admin.php:279
49
  msgid "Google"
50
  msgstr ""
51
 
52
+ #: classes/admin/class-admin.php:302
53
  msgid "Google Ads Conversion ID"
54
  msgstr ""
55
 
56
+ #: classes/admin/class-admin.php:314
57
  msgid "Google Ads Purchase Conversion Label"
58
  msgstr ""
59
 
60
+ #: classes/admin/class-admin.php:325
61
  msgid "Google Analytics UA"
62
  msgstr ""
63
 
64
+ #: classes/admin/class-admin.php:336
65
  msgid "Google Analytics 4"
66
  msgstr ""
67
 
68
+ #: classes/admin/class-admin.php:347
69
  msgid "Google Optimize"
70
  msgstr ""
71
 
72
+ #: classes/admin/class-admin.php:359
73
+ msgid "Facebook"
74
  msgstr ""
75
 
76
+ #: classes/admin/class-admin.php:382
77
+ msgid "Facebook pixel ID"
78
  msgstr ""
79
 
80
+ #: classes/admin/class-admin.php:394
81
  msgid "more pixels"
82
  msgstr ""
83
 
84
+ #: classes/admin/class-admin.php:419
85
  msgid "Microsoft Advertising UET tag ID"
86
  msgstr ""
87
 
88
+ #: classes/admin/class-admin.php:431
89
  msgid "Twitter pixel ID"
90
  msgstr ""
91
 
92
+ #: classes/admin/class-admin.php:443
93
  msgid "Pinterest pixel ID"
94
  msgstr ""
95
 
96
+ #: classes/admin/class-admin.php:455
97
  msgid "Snapchat pixel ID"
98
  msgstr ""
99
 
100
+ #: classes/admin/class-admin.php:467
101
  msgid "TikTok pixel ID"
102
  msgstr ""
103
 
104
+ #: classes/admin/class-admin.php:480
105
  msgid "Hotjar site ID"
106
  msgstr ""
107
 
108
+ #: classes/admin/class-admin.php:492
109
  msgid "Advanced"
110
  msgstr ""
111
 
112
+ #: classes/admin/class-admin.php:543
113
  msgid "Order Total Logic"
114
  msgstr ""
115
 
116
+ #: classes/admin/class-admin.php:555
117
  msgid "Order Duplication Prevention"
118
  msgstr ""
119
 
120
+ #: classes/admin/class-admin.php:567
121
  msgid "Maximum Compatibility Mode"
122
  msgstr ""
123
 
124
+ #: classes/admin/class-admin.php:581
125
+ msgid "Disable tracking for user roles"
126
  msgstr ""
127
 
128
+ #: classes/admin/class-admin.php:615
129
  msgid "Conversion Cart Data"
130
  msgstr ""
131
 
132
+ #: classes/admin/class-admin.php:628
133
  msgid "Enhanced E-Commerce"
134
  msgstr ""
135
 
136
+ #: classes/admin/class-admin.php:640
137
  msgid "GA 4 API secret"
138
  msgstr ""
139
 
140
+ #: classes/admin/class-admin.php:653
141
  msgid "Enhanced Link Attribution"
142
  msgstr ""
143
 
144
+ #: classes/admin/class-admin.php:666
145
  msgid "Google User ID"
146
  msgstr ""
147
 
148
+ #: classes/admin/class-admin.php:678
149
  msgid "Google Ads Enhanced Conversions"
150
  msgstr ""
151
 
152
+ #: classes/admin/class-admin.php:692
153
  msgid "Google Ads Phone Conversion Number"
154
  msgstr ""
155
 
156
+ #: classes/admin/class-admin.php:704
157
  msgid "Google Ads Phone Conversion Label"
158
  msgstr ""
159
 
160
+ #: classes/admin/class-admin.php:717
161
  msgid "Cookie Consent Management"
162
  msgstr ""
163
 
164
+ #: classes/admin/class-admin.php:740
165
  msgid "Google Consent Mode"
166
  msgstr ""
167
 
168
+ #: classes/admin/class-admin.php:752
169
  msgid "Google Consent Regions"
170
  msgstr ""
171
 
172
+ #: classes/admin/class-admin.php:764
173
  msgid "Explicit Consent Mode"
174
  msgstr ""
175
 
176
+ #: classes/admin/class-admin.php:777
177
  msgid "Borlabs Cookie support"
178
  msgstr ""
179
 
180
+ #: classes/admin/class-admin.php:791
181
  msgid "Cookiebot support"
182
  msgstr ""
183
 
184
+ #: classes/admin/class-admin.php:805
185
  msgid "Complianz GDPR support"
186
  msgstr ""
187
 
188
+ #: classes/admin/class-admin.php:819
189
  msgid "Cookie Notice support"
190
  msgstr ""
191
 
192
+ #: classes/admin/class-admin.php:833
193
  msgid "Cookie Script support"
194
  msgstr ""
195
 
196
+ #: classes/admin/class-admin.php:847
197
  msgid "GDPR Cookie Compliance support"
198
  msgstr ""
199
 
200
+ #: classes/admin/class-admin.php:861
201
  msgid "GDPR Cookie Consent support"
202
  msgstr ""
203
 
204
+ #: classes/admin/class-admin.php:894
205
+ msgid "Facebook CAPI: token"
206
  msgstr ""
207
 
208
+ #: classes/admin/class-admin.php:906
209
+ msgid "Facebook CAPI: process anonymous hits"
210
  msgstr ""
211
 
212
+ #: classes/admin/class-admin.php:918
213
+ msgid "Facebook CAPI: send additional visitor identifiers"
214
  msgstr ""
215
 
216
+ #: classes/admin/class-admin.php:930
217
+ msgid "Facebook Microdata Tags for Catalogues"
218
  msgstr ""
219
 
220
+ #: classes/admin/class-admin.php:942
221
+ #: classes/admin/class-admin.php:955
222
+ #: classes/admin/class-admin.php:1002
223
  msgid "Dynamic Remarketing"
224
  msgstr ""
225
 
226
+ #: classes/admin/class-admin.php:1014
227
  msgid "Product Identifier"
228
  msgstr ""
229
 
230
+ #: classes/admin/class-admin.php:1026
231
  msgid "Variations output"
232
  msgstr ""
233
 
234
+ #: classes/admin/class-admin.php:1039
235
  msgid "Google Business Vertical"
236
  msgstr ""
237
 
238
+ #: classes/admin/class-admin.php:1052
239
+ #: classes/admin/class-admin.php:1061
240
  msgid "Support"
241
  msgstr ""
242
 
243
+ #: classes/admin/class-admin.php:1069
244
+ #: classes/admin/class-admin.php:1079
245
  msgid "Author"
246
  msgstr ""
247
 
248
+ #: classes/admin/class-admin.php:1115
249
  msgid ""
250
  "It looks like you are using some sort of ad or script blocker which is blocking the script and CSS files of this plugin.\n"
251
  " In order for the plugin to work properly you need to disable the script blocker."
252
  msgstr ""
253
 
254
+ #: classes/admin/class-admin.php:1122
255
  #: classes/admin/class-notifications.php:31
256
  #: classes/admin/class-notifications.php:73
257
  #: classes/admin/class-notifications.php:114
259
  msgid "Learn more"
260
  msgstr ""
261
 
262
+ #: classes/admin/class-admin.php:1167
263
  msgid "Profit Driven Marketing by SweetCode"
264
  msgstr ""
265
 
266
+ #: classes/admin/class-admin.php:1192
267
  msgid "Visit us here:"
268
  msgstr ""
269
 
270
+ #: classes/admin/class-admin.php:1237
271
  msgid "Contacting Support"
272
  msgstr ""
273
 
274
+ #: classes/admin/class-admin.php:1251
275
  msgid "Debug Information"
276
  msgstr ""
277
 
278
+ #: classes/admin/class-admin.php:1260
279
  msgid "copy to clipboard"
280
  msgstr ""
281
 
282
+ #: classes/admin/class-admin.php:1274
283
  msgid "Translations"
284
  msgstr ""
285
 
286
+ #: classes/admin/class-admin.php:1275
287
  msgid "If you want to participate improving the translations of this plugin into your language, please follow this link:"
288
  msgstr ""
289
 
290
+ #: classes/admin/class-admin.php:1293
291
  msgid "Post a support request in the WordPress support forum here: "
292
  msgstr ""
293
 
294
+ #: classes/admin/class-admin.php:1296
295
  msgid "Support forum"
296
  msgstr ""
297
 
298
+ #: classes/admin/class-admin.php:1300
299
  msgid "(Never post the debug or other sensitive information to the support forum. Instead send us the information by email.)"
300
  msgstr ""
301
 
302
+ #: classes/admin/class-admin.php:1303
303
  msgid "Or send us an email to the following address: "
304
  msgstr ""
305
 
306
+ #: classes/admin/class-admin.php:1319
307
  msgid "Send us your support request through the WooCommerce.com dashboard: "
308
  msgstr ""
309
 
310
+ #: classes/admin/class-admin.php:1333
311
  msgid "More details about the developer of this plugin: "
312
  msgstr ""
313
 
314
+ #: classes/admin/class-admin.php:1336
315
  msgid "Developer: SweetCode"
316
  msgstr ""
317
 
318
+ #: classes/admin/class-admin.php:1338
319
  msgid "Website: "
320
  msgstr ""
321
 
322
+ #: classes/admin/class-admin.php:1361
323
  msgid "The Google Analytics Universal property ID looks like this:"
324
  msgstr ""
325
 
326
+ #: classes/admin/class-admin.php:1377
327
  msgid "The Google Analytics 4 measurement ID looks like this:"
328
  msgstr ""
329
 
330
+ #: classes/admin/class-admin.php:1393
331
  msgid "The conversion ID looks similar to this:"
332
  msgstr ""
333
 
334
+ #: classes/admin/class-admin.php:1409
335
  msgid "The purchase conversion label looks similar to this:"
336
  msgstr ""
337
 
338
+ #: classes/admin/class-admin.php:1413
339
+ #: classes/admin/class-admin.php:2167
340
  msgid "Requires an active Google Ads Conversion ID"
341
  msgstr ""
342
 
343
+ #: classes/admin/class-admin.php:1431
344
  msgid "The Google Optimize container ID looks like this:"
345
  msgstr ""
346
 
347
+ #: classes/admin/class-admin.php:1447
348
+ msgid "The Facebook pixel ID looks similar to this:"
349
  msgstr ""
350
 
351
+ #: classes/admin/class-admin.php:1465
352
  msgid "The Microsoft Advertising UET tag ID looks similar to this:"
353
  msgstr ""
354
 
355
+ #: classes/admin/class-admin.php:1484
356
  msgid "The Twitter pixel ID looks similar to this:"
357
  msgstr ""
358
 
359
+ #: classes/admin/class-admin.php:1503
360
  msgid "The Pinterest pixel ID looks similar to this:"
361
  msgstr ""
362
 
363
+ #: classes/admin/class-admin.php:1522
364
  msgid "The Snapchat pixel ID looks similar to this:"
365
  msgstr ""
366
 
367
+ #: classes/admin/class-admin.php:1541
368
  msgid "The TikTok pixel ID looks similar to this:"
369
  msgstr ""
370
 
371
+ #: classes/admin/class-admin.php:1553
372
  msgid "The Hotjar site ID looks similar to this:"
373
  msgstr ""
374
 
375
+ #: classes/admin/class-admin.php:1563
376
  msgid "Use order_subtotal: Doesn't include tax and shipping (default)"
377
  msgstr ""
378
 
379
+ #: classes/admin/class-admin.php:1570
380
  msgid "Use order_total: Includes tax and shipping"
381
  msgstr ""
382
 
383
+ #: classes/admin/class-admin.php:1573
384
  msgid "This is the order total amount reported back to Google Ads"
385
  msgstr ""
386
 
387
+ #: classes/admin/class-admin.php:1593
388
  msgid "open the documentation"
389
  msgstr ""
390
 
391
+ #: classes/admin/class-admin.php:1613
392
  msgid "Enable Google consent mode with standard settings"
393
  msgstr ""
394
 
395
+ #: classes/admin/class-admin.php:1651
396
  msgid "If no region is set, then the restrictions are enabled for all regions. If you specify one or more regions, then the restrictions only apply for the specified regions."
397
  msgstr ""
398
 
399
+ #: classes/admin/class-admin.php:1672
400
  msgid "Enable Google Analytics enhanced e-commerce"
401
  msgstr ""
402
 
403
+ #: classes/admin/class-admin.php:1683
404
+ #: classes/admin/class-admin.php:1744
405
+ #: classes/admin/class-admin.php:1774
406
  msgid "You need to activate at least Google Analytics UA or Google Analytics 4"
407
  msgstr ""
408
 
409
+ #: classes/admin/class-admin.php:1705
410
  msgid "Google Analytics 4 activation required"
411
  msgstr ""
412
 
413
+ #: classes/admin/class-admin.php:1710
414
  msgid "Enhanced E-Commerce activation required"
415
  msgstr ""
416
 
417
+ #: classes/admin/class-admin.php:1713
418
  msgid "If enabled, purchase and refund events will be sent to Google through the measurement protocol for increased accuracy."
419
  msgstr ""
420
 
421
+ #: classes/admin/class-admin.php:1728
422
  msgid "Enable Google Analytics enhanced link attribution"
423
  msgstr ""
424
 
425
+ #: classes/admin/class-admin.php:1763
426
  msgid "Enable Google user ID"
427
  msgstr ""
428
 
429
+ #: classes/admin/class-admin.php:1793
430
  msgid "Enable Google Ads Enhanced Conversions"
431
  msgstr ""
432
 
433
+ #: classes/admin/class-admin.php:1804
434
  msgid "You need to activate Google Ads"
435
  msgstr ""
436
 
437
+ #: classes/admin/class-admin.php:1824
438
  msgid "The Google Ads phone conversion number must be in the same format as on the website."
439
  msgstr ""
440
 
441
+ #: classes/admin/class-admin.php:1846
442
  msgid "Borlabs Cookie detected. Automatic support is:"
443
  msgstr ""
444
 
445
+ #: classes/admin/class-admin.php:1852
446
  msgid "Cookiebot detected. Automatic support is:"
447
  msgstr ""
448
 
449
+ #: classes/admin/class-admin.php:1858
450
  msgid "Complianz GDPR detected. Automatic support is:"
451
  msgstr ""
452
 
453
+ #: classes/admin/class-admin.php:1864
454
  msgid "Cookie Notice (by hu-manity.co) detected. Automatic support is:"
455
  msgstr ""
456
 
457
+ #: classes/admin/class-admin.php:1870
458
  msgid "Cookie Script (by cookie-script.com) detected. Automatic support is:"
459
  msgstr ""
460
 
461
+ #: classes/admin/class-admin.php:1876
462
  msgid "GDPR Cookie Compliance (by Moove Agency) detected. Automatic support is:"
463
  msgstr ""
464
 
465
+ #: classes/admin/class-admin.php:1882
466
  msgid "GDPR Cookie Consent (by WebToffee) detected. Automatic support is:"
467
  msgstr ""
468
 
469
+ #: classes/admin/class-admin.php:1901
470
  msgid "Enable Explicit Consent Mode"
471
  msgstr ""
472
 
473
+ #: classes/admin/class-admin.php:1910
474
  msgid "Only activate the Explicit Consent Mode if you are also using a Cookie Management Platform (a cookie banner) that is compatible with this plugin. Find a list of compatible plugins in the documentation."
475
  msgstr ""
476
 
477
+ #: classes/admin/class-admin.php:1929
478
+ #: classes/admin/class-admin.php:1962
479
+ #: classes/admin/class-admin.php:1991
480
+ #: classes/admin/class-admin.php:2019
481
+ msgid "You need to activate the Facebook pixel"
482
  msgstr ""
483
 
484
+ #: classes/admin/class-admin.php:1953
485
+ msgid "Send CAPI hits for anonymous visitors who likely have blocked the Facebook pixel."
486
  msgstr ""
487
 
488
+ #: classes/admin/class-admin.php:1982
489
  msgid "Include additional visitor's identifiers, such as IP address, email and shop ID in the CAPI hit."
490
  msgstr ""
491
 
492
+ #: classes/admin/class-admin.php:2010
493
+ msgid "Enable Facebook product microdata output"
494
+ msgstr ""
495
+
496
+ #: classes/admin/class-admin.php:2035
497
+ msgid "Add the cart data to the conversion event"
498
+ msgstr ""
499
+
500
+ #: classes/admin/class-admin.php:2044
501
+ msgid "Requires an active Google Ads Conversion ID, an active Conversion Label and an active Google Merchant Center ID (aw_merchant_id)"
502
  msgstr ""
503
 
504
+ #: classes/admin/class-admin.php:2073
505
  msgid "Only disable order duplication prevention for testing. Remember to re-enable the setting once done."
506
  msgstr ""
507
 
508
+ #: classes/admin/class-admin.php:2090
509
  msgid "Enable the maximum compatibility mode"
510
  msgstr ""
511
 
512
+ #: classes/admin/class-admin.php:2126
513
  msgid "Advanced order duplication prevention is "
514
  msgstr ""
515
 
516
+ #: classes/admin/class-admin.php:2128
517
  msgid "Basic order duplication prevention is "
518
  msgstr ""
519
 
520
+ #: classes/admin/class-admin.php:2152
521
  msgid "Enable dynamic remarketing audience collection"
522
  msgstr ""
523
 
524
+ #: classes/admin/class-admin.php:2173
525
  msgid "You need to choose the correct product identifier setting in order to match the product identifiers in the product feeds."
526
  msgstr ""
527
 
528
+ #: classes/admin/class-admin.php:2191
529
  msgid "Enable variations output"
530
  msgstr ""
531
 
532
+ #: classes/admin/class-admin.php:2202
533
  msgid "In order for this to work you need to upload your product feed including product variations and the item_group_id. Disable it, if you choose only to upload the parent product for variable products."
534
  msgstr ""
535
 
536
+ #: classes/admin/class-admin.php:2217
537
  msgid "Retail"
538
  msgstr ""
539
 
540
+ #: classes/admin/class-admin.php:2227
541
  msgid "Education"
542
  msgstr ""
543
 
544
+ #: classes/admin/class-admin.php:2237
545
  msgid "Hotels and rentals"
546
  msgstr ""
547
 
548
+ #: classes/admin/class-admin.php:2247
549
  msgid "Jobs"
550
  msgstr ""
551
 
552
+ #: classes/admin/class-admin.php:2257
553
  msgid "Local deals"
554
  msgstr ""
555
 
556
+ #: classes/admin/class-admin.php:2267
557
  msgid "Real estate"
558
  msgstr ""
559
 
560
+ #: classes/admin/class-admin.php:2277
561
  msgid "Custom"
562
  msgstr ""
563
 
564
+ #: classes/admin/class-admin.php:2296
565
  msgid "ID of your Google Merchant Center account. It looks like this: 12345678"
566
  msgstr ""
567
 
568
+ #: classes/admin/class-admin.php:2304
569
+ msgid "Currently the plugin automatically detects the location of the visitor for this setting. In most, if not all, cases this will work fine. Please let us know if you have a use case where you need another output:"
570
+ msgstr ""
571
+
572
+ #: classes/admin/class-admin.php:2342
573
+ msgid "The plugin will use the WordPress default language for this setting. If the shop uses translations, in theory we could also use the visitors locale. But, if that language is not set up in the Google Merchant Center we might run into issues. If you need more options here let us know:"
574
+ msgstr ""
575
+
576
+ #: classes/admin/class-admin.php:2360
577
  msgid "post ID (default)"
578
  msgstr ""
579
 
580
+ #: classes/admin/class-admin.php:2366
581
  msgid "SKU"
582
  msgstr ""
583
 
584
+ #: classes/admin/class-admin.php:2373
585
  msgid "ID for the WooCommerce Google Product Feed. Outputs the post ID with woocommerce_gpf_ prefix *"
586
  msgstr ""
587
 
588
+ #: classes/admin/class-admin.php:2380
589
  msgid "ID for the WooCommerce Google Listings & Ads Plugin. Outputs the post ID with gla_ prefix **"
590
  msgstr ""
591
 
592
+ #: classes/admin/class-admin.php:2384
593
  msgid "Choose a product identifier."
594
  msgstr ""
595
 
596
+ #: classes/admin/class-admin.php:2387
597
  msgid "* This is for users of the WooCommerce Google Product Feed Plugin"
598
  msgstr ""
599
 
600
+ #: classes/admin/class-admin.php:2391
601
  msgid "** This is for users of the WooCommerce Google Listings & Ads Plugin"
602
  msgstr ""
603
 
604
+ #: classes/admin/class-admin.php:2400
605
  msgid "beta"
606
  msgstr ""
607
 
608
+ #: classes/admin/class-admin.php:2404
609
+ #: classes/admin/class-admin.php:2409
610
  msgid "active"
611
  msgstr ""
612
 
613
+ #: classes/admin/class-admin.php:2414
614
+ #: classes/admin/class-admin.php:2419
615
  msgid "inactive"
616
  msgstr ""
617
 
618
+ #: classes/admin/class-admin.php:2424
619
+ #: classes/admin/class-admin.php:2429
620
  msgid "partially active"
621
  msgstr ""
622
 
623
+ #: classes/admin/class-admin.php:2440
624
  msgid "Pro Feature"
625
  msgstr ""
626
 
627
+ #: classes/admin/class-admin.php:2484
628
  msgid "You have entered an invalid Google Analytics Universal property ID."
629
  msgstr ""
630
 
631
+ #: classes/admin/class-admin.php:2492
632
  msgid "You have entered an invalid Google Analytics 4 measurement ID."
633
  msgstr ""
634
 
635
+ #: classes/admin/class-admin.php:2500
636
  msgid "You have entered an invalid Google Analytics 4 API key."
637
  msgstr ""
638
 
639
+ #: classes/admin/class-admin.php:2508
640
  msgid "You have entered an invalid conversion ID. It only contains 8 to 10 digits."
641
  msgstr ""
642
 
643
+ #: classes/admin/class-admin.php:2516
644
+ #: classes/admin/class-admin.php:2524
645
  msgid "You have entered an invalid conversion label."
646
  msgstr ""
647
 
648
+ #: classes/admin/class-admin.php:2532
649
  msgid "You have entered an invalid merchant ID. It only contains 7 to 10 digits."
650
  msgstr ""
651
 
652
+ #: classes/admin/class-admin.php:2540
653
  msgid "You have entered an invalid Google Optimize container ID."
654
  msgstr ""
655
 
656
+ #: classes/admin/class-admin.php:2548
657
+ msgid "You have entered an invalid Facebook pixel ID. It only contains 14 to 16 digits."
658
  msgstr ""
659
 
660
+ #: classes/admin/class-admin.php:2556
661
+ msgid "You have entered an invalid Facebook CAPI token."
662
  msgstr ""
663
 
664
+ #: classes/admin/class-admin.php:2564
665
  msgid "You have entered an invalid Bing Ads UET tag ID. It only contains 7 to 9 digits."
666
  msgstr ""
667
 
668
+ #: classes/admin/class-admin.php:2572
669
  msgid "You have entered an invalid Twitter pixel ID. It only contains 5 to 7 lowercase letters and numbers."
670
  msgstr ""
671
 
672
+ #: classes/admin/class-admin.php:2580
673
  msgid "You have entered an invalid Pinterest pixel ID. It only contains 13 digits."
674
  msgstr ""
675
 
676
+ #: classes/admin/class-admin.php:2588
677
  msgid "You have entered an invalid Snapchat pixel ID."
678
  msgstr ""
679
 
680
+ #: classes/admin/class-admin.php:2596
681
  msgid "You have entered an invalid TikTok pixel ID."
682
  msgstr ""
683
 
684
+ #: classes/admin/class-admin.php:2604
685
  msgid "You have entered an invalid Hotjar site ID. It only contains 6 to 9 digits."
686
  msgstr ""
687
 
778
  msgid "Find more information about the the reason in our documentation: "
779
  msgstr ""
780
 
781
+ #: wgact.php:221
782
  msgid "WooCommerce Pixel Manager error"
783
  msgstr ""
784
 
785
+ #: wgact.php:223
786
  msgid "Your environment doesn't meet all the system requirements listed below."
787
  msgstr ""
788
 
789
+ #: wgact.php:227
790
  msgid "The WooCommerce plugin needs to be activated"
791
  msgstr ""
readme.txt CHANGED
@@ -1,20 +1,20 @@
1
  === WooCommerce Pixel Manager ===
2
  Contributors: alekv, wolfbaer
3
- Tags: woocommerce, google ads, google analytics, facebook pixel, conversion tracking, dynamic retargeting, remarketing, meta pixel, facebook conversion api, woocommerce google, woocommerce facebook
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
 
11
- Track visitors and conversions in Google Ads, Google Analytics, Meta Pixel (Facebook Pixel), and more !
12
 
13
  == Description ==
14
 
15
  This plugin <strong>tracks WooCommerce shop visitors and collects valuable data for conversion optimization, dynamic remarketing and reporting</strong>.
16
 
17
- While the setup is as simple as it can get, the pixel engine under the hood is very powerful. It tracks all e-commerce events and implements all advanced pixel features like Meta CAPI (Facebook CAPI) (Pro version), Google Enhanced E-Commerce, Google Shopping Cart Item Tracking and much more. For advanced users the plugin offers filters which allow to tweak the output flexibly and fine tune the behavior to each shop.
18
  <strong>What sets us apart from other, similar plugins?</strong>
19
 
20
  Out of many things, probably high tracking accuracy and a simple user interface are the most important properties that set our plugin apart from others.
@@ -25,24 +25,24 @@ Read more about the importance of tracking accuracy over [here](https://sweetcod
25
 
26
  <strong>The plugin comes with integrations for:</strong>
27
 
28
- * Google Ads Pixel
29
- * Google Analytics Pixel (Universal and Google Analytics 4)
30
- * Meta Ads Pixel (Facebook Ads Pixel)
31
- * Google Optimize Pixel
32
- * HotJar Pixel
33
- * Microsoft Ads Pixel (Pro version)
34
- * Twitter Ads Pixel (Pro version)
35
- * Pinterest Ads Pixel (Pro version)
36
- * Snapchat Ads Pixel (Pro version)
37
- * TikTok Ads Pixel (Pro version)
38
 
39
  <strong>Highlights</strong>
40
 
41
  * Google Ads Enhanced Conversions (Pro version)
42
- * Meta Conversion API (Facebook Conversion API) (Pro version)
43
  * Google Analytics Enhanced E-Commerce (Pro version)
44
  * Precise measurement by preventing duplicate reporting effectively, excluding admins and shop managers from tracking, and not counting failed payments.
45
- * Collects dynamic remarketing audiences for dynamic retargeting (Google Ads, Meta (Facebook), etc.)
46
  * Google Add Cart Data feature. [Google support page](https://support.google.com/google-ads/answer/9028254)
47
  * Support for various cookie consent management systems
48
 
@@ -52,11 +52,11 @@ Read more about the importance of tracking accuracy over [here](https://sweetcod
52
  * Google Ads Dynamic Remarketing
53
  * Google Ads Cart Item Tracking
54
  * Google Shopping New Customer Parameter
55
- * Google Analytics Universal Pixel (includes purchase tracking)
56
- * Google Analytics 4 Pixel (includes purchase tracking)
57
- * Google Optimize Pixel
58
- * Meta Pixel (Facebook Pixel)
59
- * Meta Remarketing Events (Facebook Remarketing Events)
60
  * Hotjar Pixel
61
  * Basic Order Duplication Prevention
62
  * Many useful filters that help tweak the plugin output
@@ -66,8 +66,8 @@ Have a look at the full feature list over [here](https://sweetcode.com/docs/wpm/
66
 
67
  <strong>Premium Features</strong>
68
 
69
- * Meta CAPI (Facebook CAPI)
70
- * Meta Microdata Output (Facebook Microdata Output)
71
  * Google Analytics Universal and Google Analytics 4 Enhanced E-Commerce
72
  * Google Consent Mode
73
  * Google Dynamic Remarketing Choice for all Business Verticals
@@ -110,18 +110,12 @@ The plugin uses data from several Cookie Consent Management plugins to manage ap
110
 
111
  It works with the following Cookie Consent Management plugins out of the box:
112
 
113
- * [Cookiebot](https://wordpress.org/plugins/cookiebot/)
114
- * [Cookie Script](https://wordpress.org/plugins/cookie-script-com/)
115
- * [Complianz GDPR/CCPA Cookie Consent](https://wordpress.org/plugins/complianz-gdpr/)
116
  * [Cookie Notice](https://wordpress.org/plugins/cookie-notice/)
117
- * [Cookie Notice & Compliance for GDPR / CCPA](https://wordpress.org/plugins/cookie-notice/)
118
  * [Cookie Law Info](https://wordpress.org/plugins/cookie-law-info/)
119
  * [GDPR Cookie Compliance](https://wordpress.org/plugins/gdpr-cookie-compliance/)
120
  * [Borlabs Cookie](https://borlabs.io/borlabs-cookie/) (from version 2.1.0)
121
  [Borlabs Cookie Setup](https://sweetcode.com/docs/wpm/consent-management/borlabs-cookie?utm_source=wordpress.org&utm_medium=wpm-plugin-page&utm_campaign=woocommerce-pixel-manager-docs&utm_content=borlabs-cookie)
122
 
123
- Please read the following for additional [setup information](https://sweetcode.com/docs/wpm/consent-management/platforms?utm_source=wordpress.org&utm_medium=wpm-plugin-page&utm_campaign=woocommerce-pixel-manager-docs&utm_content=cookie-consent-plugins)
124
-
125
  <strong>Requirements</strong>
126
 
127
  [List of requirements](https://sweetcode.com/docs/wpm/setup/requirements?utm_source=wordpress.org&utm_medium=wpm-plugin-page&utm_campaign=woocommerce-pixel-manager-docs&utm_content=requirements)
@@ -186,42 +180,7 @@ 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
197
- * Tweak: Added new logic to retrieve categories for variations
198
-
199
- = 1.16.4 = 07.04.2022
200
-
201
- * Fix: Fixed a bug that prevented disabling user role tracking
202
-
203
- = 1.16.3 = 07.04.2022
204
-
205
- * Tweak: Remove the IPv6 to IPv4 mapping in case the the external user IP contains one
206
- * Tweak: Improved local IP detection
207
- * Tweak: Replaced deprecated FILTER_SANITIZE_STRING filter with FILTER_SANITIZE_FULL_SPECIAL_CHARS
208
-
209
- = 1.16.2 = 05.04.2022
210
-
211
-
212
- * Fix: Improved detection of users that are deactivated for tracking
213
-
214
- = 1.16.1 = 05.04.2022
215
-
216
- * Tweak: Removed data-cfasync=”false” to allow Cloudflare Rocket Loader to optimize scripts
217
- * Tweak: Removed unused functions
218
- * Tweak: Refactored some code and removed cruft
219
- * Tweak: Improved logic of when to load cart items into the wpm dataLayer
220
- * Tweak: For users, who have been disabled for tracking, prevent tracking entirely, not just for purchase events
221
- * Tweak: Renamed Facebook to Meta
222
- * Tweak: Add log entry when a purchase hit has been prevented because of a user role that has been opted out from tracking
223
-
224
- = 1.16.0 = 01.04.2022
225
 
226
 
227
  * Tweak: Removed a few deprecated and inactive settings
1
  === WooCommerce Pixel Manager ===
2
  Contributors: alekv, wolfbaer
3
+ Tags: woocommerce, google ads, google analytics, facebook pixel, conversion tracking, dynamic retargeting, remarketing, pixel, facebook conversion api, woocommerce google, woocommerce facebook
4
  Requires at least: 3.7
5
  Tested up to: 5.9
6
  Requires PHP: 7.3
7
+ Stable tag: 1.16.0
8
  License: GPLv3 or later
9
  License URI: http://www.gnu.org/licenses/gpl-3.0.html
10
 
11
+ Track visitors and conversions in Google Ads, Google Analytics, Facebook Pixel (Conversion API) and more !
12
 
13
  == Description ==
14
 
15
  This plugin <strong>tracks WooCommerce shop visitors and collects valuable data for conversion optimization, dynamic remarketing and reporting</strong>.
16
 
17
+ While the setup is as simple as it can get, the pixel engine under the hood is very powerful. It tracks all e-commerce events and implements all advanced pixel features like Facebook CAPI (Pro version), Google Enhanced E-Commerce, Google Shopping Cart Item Tracking and much more. For advanced users the plugin offers filters which allow to tweak the output flexibly and fine tune the behavior to each shop.
18
  <strong>What sets us apart from other, similar plugins?</strong>
19
 
20
  Out of many things, probably high tracking accuracy and a simple user interface are the most important properties that set our plugin apart from others.
25
 
26
  <strong>The plugin comes with integrations for:</strong>
27
 
28
+ * Google Ads
29
+ * Google Analytics (Universal and Google Analytics 4)
30
+ * Facebook Ads Pixel (Meta Ads Pixel)
31
+ * Google Optimize
32
+ * HotJar
33
+ * Microsoft Ads (Pro version)
34
+ * Twitter Ads (Pro version)
35
+ * Pinterest Ads (Pro version)
36
+ * Snapchat Ads (Pro version)
37
+ * TikTok Ads (Pro version)
38
 
39
  <strong>Highlights</strong>
40
 
41
  * Google Ads Enhanced Conversions (Pro version)
42
+ * Facebook Conversion API (CAPI) (Pro version)
43
  * Google Analytics Enhanced E-Commerce (Pro version)
44
  * Precise measurement by preventing duplicate reporting effectively, excluding admins and shop managers from tracking, and not counting failed payments.
45
+ * Collects dynamic remarketing audiences for dynamic retargeting (Google Ads, Facebook, etc.)
46
  * Google Add Cart Data feature. [Google support page](https://support.google.com/google-ads/answer/9028254)
47
  * Support for various cookie consent management systems
48
 
52
  * Google Ads Dynamic Remarketing
53
  * Google Ads Cart Item Tracking
54
  * Google Shopping New Customer Parameter
55
+ * Google Analytics Universal (includes purchase tracking)
56
+ * Google Analytics 4 (includes purchase tracking)
57
+ * Google Optimize
58
+ * Facebook Pixel (Meta Pixel)
59
+ * Facebook Remarketing Events (Meta Remarketing Events)
60
  * Hotjar Pixel
61
  * Basic Order Duplication Prevention
62
  * Many useful filters that help tweak the plugin output
66
 
67
  <strong>Premium Features</strong>
68
 
69
+ * Facebook CAPI (Meta CAPI)
70
+ * Facebook Microdata Output (Meta Microdata Output)
71
  * Google Analytics Universal and Google Analytics 4 Enhanced E-Commerce
72
  * Google Consent Mode
73
  * Google Dynamic Remarketing Choice for all Business Verticals
110
 
111
  It works with the following Cookie Consent Management plugins out of the box:
112
 
 
 
 
113
  * [Cookie Notice](https://wordpress.org/plugins/cookie-notice/)
 
114
  * [Cookie Law Info](https://wordpress.org/plugins/cookie-law-info/)
115
  * [GDPR Cookie Compliance](https://wordpress.org/plugins/gdpr-cookie-compliance/)
116
  * [Borlabs Cookie](https://borlabs.io/borlabs-cookie/) (from version 2.1.0)
117
  [Borlabs Cookie Setup](https://sweetcode.com/docs/wpm/consent-management/borlabs-cookie?utm_source=wordpress.org&utm_medium=wpm-plugin-page&utm_campaign=woocommerce-pixel-manager-docs&utm_content=borlabs-cookie)
118
 
 
 
119
  <strong>Requirements</strong>
120
 
121
  [List of requirements](https://sweetcode.com/docs/wpm/setup/requirements?utm_source=wordpress.org&utm_medium=wpm-plugin-page&utm_campaign=woocommerce-pixel-manager-docs&utm_content=requirements)
180
 
181
  == Changelog ==
182
 
183
+ = 1.16.0 = 1.4.2022
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
184
 
185
 
186
  * Tweak: Removed a few deprecated and inactive settings
vendor/freemius/wordpress-sdk/assets/img/plugin-icon.png CHANGED
Binary file
vendor/freemius/wordpress-sdk/assets/img/theme-icon.png CHANGED
Binary file
vendor/freemius/wordpress-sdk/assets/img/woocommerce-google-adwords-conversion-tracking-tag.png CHANGED
Binary file
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
 
@@ -149,8 +149,7 @@ if ( function_exists( 'wpm_fs' ) ) {
149
  $this->environment_check->flush_cache_on_plugin_changes();
150
  register_activation_hook( __FILE__, [ $this, 'plugin_activated' ] );
151
  register_deactivation_hook( __FILE__, [ $this, 'plugin_deactivated' ] );
152
- // $this->init();
153
- add_action( 'woocommerce_init', [ $this, 'init' ] );
154
  } else {
155
  add_action( 'admin_menu', [ $this, 'add_empty_admin_page' ], 99 );
156
  add_action( 'admin_notices', [ $this, 'requirements_error' ] );
@@ -251,8 +250,7 @@ if ( function_exists( 'wpm_fs' ) ) {
251
  }
252
 
253
  // inject pixels into front end
254
- // add_action('after_setup_theme', [$this, 'inject_pixels']);
255
- $this->inject_pixels();
256
  }
257
 
258
  public function inject_pixels()
10
  * Developer URI: https://sweetcode.com
11
  * Text Domain: woocommerce-google-adwords-conversion-tracking-tag
12
  * Domain path: /languages
13
+ * Version: 1.16.0
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.0' ;
24
  // TODO export settings function
25
  // TODO add option checkbox on uninstall and ask if user wants to delete options from db
26
 
149
  $this->environment_check->flush_cache_on_plugin_changes();
150
  register_activation_hook( __FILE__, [ $this, 'plugin_activated' ] );
151
  register_deactivation_hook( __FILE__, [ $this, 'plugin_deactivated' ] );
152
+ $this->init();
 
153
  } else {
154
  add_action( 'admin_menu', [ $this, 'add_empty_admin_page' ], 99 );
155
  add_action( 'admin_notices', [ $this, 'requirements_error' ] );
250
  }
251
 
252
  // inject pixels into front end
253
+ add_action( 'after_setup_theme', [ $this, 'inject_pixels' ] );
 
254
  }
255
 
256
  public function inject_pixels()