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

Version Description

11.01.2022

Tweak: Removed some unnecessary console.log outputs Tweak: Added a safeguard when flushing Flying Press Cache Tweak: Added support output for various CMPs into the admin pages Tweak: Added more safeguards in case on the purchase confirmation page the order can't be retrieved through query vars Tweak: A few improvements how to read out cookies for various CMPs Tweak: Improved gtag firing based on cookie consent Tweak: Improvements to read out of Cookie Script consent cookie Tweak: Improvements to read out of Cookiebot consent cookie

Download this release

Release Info

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

Code changes from version 1.11.7 to 1.12.4

classes/admin/class-admin.php CHANGED
@@ -291,7 +291,7 @@ class Admin
291
  // add the field for the Pinterest pixel
292
  add_settings_field(
293
  'wgact_plugin_pinterest_pixel_id',
294
- esc_html__( 'Pinterest pixel ID', 'woocommerce-google-adwords-conversion-tracking-tag' ) . $this->html_beta(),
295
  [ $this, 'wgact_option_html_pinterest_pixel_id' ],
296
  'wgact_plugin_options_page',
297
  $section_ids['settings_name']
@@ -299,7 +299,7 @@ class Admin
299
  // add the field for the Snapchat pixel
300
  add_settings_field(
301
  'wgact_plugin_snapchat_pixel_id',
302
- esc_html__( 'Snapchat pixel ID', 'woocommerce-google-adwords-conversion-tracking-tag' ) . $this->html_beta(),
303
  [ $this, 'wgact_option_html_snapchat_pixel_id' ],
304
  'wgact_plugin_options_page',
305
  $section_ids['settings_name']
@@ -523,24 +523,94 @@ class Admin
523
  'wgact_plugin_options_page',
524
  $section_ids['settings_name']
525
  );
 
 
 
 
 
 
 
 
526
  if ( ( new Environment_Check() )->is_borlabs_cookie_active() ) {
527
- // add fields for the Borlabs support
528
  add_settings_field(
529
  'wgact_setting_borlabs_support',
530
- esc_html__( 'Borlabs support', 'woocommerce-google-adwords-conversion-tracking-tag' ) . $this->html_beta(),
531
  [ $this, 'wgact_setting_html_borlabs_support' ],
532
  'wgact_plugin_options_page',
533
  $section_ids['settings_name']
534
  );
535
  }
536
- // add fields for the Cookiebot support
537
- add_settings_field(
538
- 'wgact_setting_cookiebot_active',
539
- esc_html__( 'Cookiebot support', 'woocommerce-google-adwords-conversion-tracking-tag' ),
540
- [ $this, 'wgact_setting_html_cookiebot_support' ],
541
- 'wgact_plugin_options_page',
542
- $section_ids['settings_name']
543
- );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
544
  }
545
 
546
  public function add_section_advanced_subsection_facebook( $section_ids )
@@ -585,7 +655,7 @@ class Admin
585
  // add fields for Facebook microdata
586
  add_settings_field(
587
  'wgact_setting_facebook_microdata_active',
588
- esc_html__( 'Facebook Microdata Tags for Catalogues', 'woocommerce-google-adwords-conversion-tracking-tag' ) . $this->html_beta(),
589
  [ $this, 'wgact_setting_html_facebook_microdata' ],
590
  'wgact_plugin_options_page',
591
  $section_ids['settings_name']
@@ -1203,7 +1273,7 @@ class Admin
1203
  ?>
1204
  <select id="wgact_setting_google_consent_regions" multiple="multiple"
1205
  name="wgact_plugin_options[google][consent_mode][regions][]"
1206
- style="width:350px" data-placeholder="Choose countries&hellip;" aria-label="Country"
1207
  class="wc-enhanced-select"
1208
  <?php
1209
  echo $this->disable_if_demo() ;
@@ -1432,12 +1502,19 @@ class Admin
1432
 
1433
  public function wgact_setting_html_borlabs_support()
1434
  {
1435
- esc_html_e( 'Borlabs detected. Automatic support is:', 'woocommerce-google-adwords-conversion-tracking-tag' );
1436
  echo $this->get_status_icon( true, true, true ) ;
1437
  echo $this->html_pro_feature() ;
1438
  }
1439
 
1440
  public function wgact_setting_html_cookiebot_support()
 
 
 
 
 
 
 
1441
  {
1442
  // adding the hidden input is a hack to make WordPress save the option with the value zero,
1443
  // instead of not saving it and remove that array key entirely
@@ -1470,6 +1547,71 @@ class Admin
1470
 
1471
  }
1472
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1473
  public function wgact_setting_html_facebook_capi_token()
1474
  {
1475
  ?><textarea id='wgact_setting_facebook_capi_token'
@@ -1983,37 +2125,54 @@ class Admin
1983
  esc_html_e( 'post ID (default)', 'woocommerce-google-adwords-conversion-tracking-tag' );
1984
  ?></label>
1985
  <br>
 
 
 
 
 
 
 
 
 
 
1986
  <label>
1987
  <input type='radio' id='wgact_plugin_option_product_identifier_1'
1988
  name='wgact_plugin_options[google][ads][product_identifier]'
1989
  value='1' <?php
1990
  echo checked( 1, $this->options['google']['ads']['product_identifier'], false ) ;
1991
  ?>/><?php
1992
- esc_html_e( 'post ID with woocommerce_gpf_ prefix *', 'woocommerce-google-adwords-conversion-tracking-tag' );
1993
  ?>
1994
  </label>
1995
  <br>
1996
  <label>
1997
- <input type='radio' id='wgact_plugin_option_product_identifier_2'
1998
  name='wgact_plugin_options[google][ads][product_identifier]'
1999
- value='2' <?php
2000
- echo checked( 2, $this->options['google']['ads']['product_identifier'], false ) ;
2001
  ?>/><?php
2002
- esc_html_e( 'SKU', 'woocommerce-google-adwords-conversion-tracking-tag' );
2003
- ?></label>
2004
-
2005
- <br><br>
2006
-
2007
- <?php
2008
  esc_html_e( 'Choose a product identifier.', 'woocommerce-google-adwords-conversion-tracking-tag' );
2009
  ?>
2010
- <br><br>
 
2011
  <?php
2012
  esc_html_e( '* This is for users of the WooCommerce Google Product Feed Plugin', 'woocommerce-google-adwords-conversion-tracking-tag' );
2013
  ?>
2014
  <a href="https://woocommerce.com/products/google-product-feed/" target="_blank">WooCommerce Google Product Feed
2015
  Plugin</a>
2016
-
 
 
 
 
 
 
2017
 
2018
  <?php
2019
  }
291
  // add the field for the Pinterest pixel
292
  add_settings_field(
293
  'wgact_plugin_pinterest_pixel_id',
294
+ esc_html__( 'Pinterest pixel ID', 'woocommerce-google-adwords-conversion-tracking-tag' ),
295
  [ $this, 'wgact_option_html_pinterest_pixel_id' ],
296
  'wgact_plugin_options_page',
297
  $section_ids['settings_name']
299
  // add the field for the Snapchat pixel
300
  add_settings_field(
301
  'wgact_plugin_snapchat_pixel_id',
302
+ esc_html__( 'Snapchat pixel ID', 'woocommerce-google-adwords-conversion-tracking-tag' ),
303
  [ $this, 'wgact_option_html_snapchat_pixel_id' ],
304
  'wgact_plugin_options_page',
305
  $section_ids['settings_name']
523
  'wgact_plugin_options_page',
524
  $section_ids['settings_name']
525
  );
526
+ // add fields for explicit cookie consent mode
527
+ add_settings_field(
528
+ 'wgact_setting_explicit_consent_mode',
529
+ esc_html__( 'Explicit Consent Mode', 'woocommerce-google-adwords-conversion-tracking-tag' ),
530
+ [ $this, 'wgact_setting_html_explicit_consent_mode' ],
531
+ 'wgact_plugin_options_page',
532
+ $section_ids['settings_name']
533
+ );
534
  if ( ( new Environment_Check() )->is_borlabs_cookie_active() ) {
535
+ // add fields for the Borlabs Cookie support
536
  add_settings_field(
537
  'wgact_setting_borlabs_support',
538
+ esc_html__( 'Borlabs Cookie support', 'woocommerce-google-adwords-conversion-tracking-tag' ),
539
  [ $this, 'wgact_setting_html_borlabs_support' ],
540
  'wgact_plugin_options_page',
541
  $section_ids['settings_name']
542
  );
543
  }
544
+ if ( ( new Environment_Check() )->is_cookiebot_active() ) {
545
+ // add fields for the Cookiebot support
546
+ add_settings_field(
547
+ 'wgact_setting_cookiebot_support',
548
+ esc_html__( 'Cookiebot support', 'woocommerce-google-adwords-conversion-tracking-tag' ),
549
+ [ $this, 'wgact_setting_html_cookiebot_support' ],
550
+ 'wgact_plugin_options_page',
551
+ $section_ids['settings_name']
552
+ );
553
+ }
554
+ if ( !( new Environment_Check() )->is_some_cmp_active() ) {
555
+ // add fields for the Cookiebot support
556
+ add_settings_field(
557
+ 'wgact_setting_cookiebot_active',
558
+ esc_html__( 'Cookiebot support', 'woocommerce-google-adwords-conversion-tracking-tag' ),
559
+ [ $this, 'wgact_setting_html_cookiebot_manual_setting' ],
560
+ 'wgact_plugin_options_page',
561
+ $section_ids['settings_name']
562
+ );
563
+ }
564
+ if ( ( new Environment_Check() )->is_complianz_active() ) {
565
+ // add fields for the Complianz GDPR support
566
+ add_settings_field(
567
+ 'wgact_setting_complianz_support',
568
+ esc_html__( 'Complianz GDPR support', 'woocommerce-google-adwords-conversion-tracking-tag' ),
569
+ [ $this, 'wgact_setting_html_complianz_support' ],
570
+ 'wgact_plugin_options_page',
571
+ $section_ids['settings_name']
572
+ );
573
+ }
574
+ if ( ( new Environment_Check() )->is_cookie_notice_active() ) {
575
+ // add fields for the Cookie Notice by hu-manity.co support
576
+ add_settings_field(
577
+ 'wgact_setting_cookie_notice_support',
578
+ esc_html__( 'Cookie Notice support', 'woocommerce-google-adwords-conversion-tracking-tag' ),
579
+ [ $this, 'wgact_setting_html_cookie_notice_support' ],
580
+ 'wgact_plugin_options_page',
581
+ $section_ids['settings_name']
582
+ );
583
+ }
584
+ if ( ( new Environment_Check() )->is_cookie_script_active() ) {
585
+ // add fields for the Cookie Script support
586
+ add_settings_field(
587
+ 'wgact_setting_cookie_script_support',
588
+ esc_html__( 'Cookie Script support', 'woocommerce-google-adwords-conversion-tracking-tag' ),
589
+ [ $this, 'wgact_setting_html_cookie_script_support' ],
590
+ 'wgact_plugin_options_page',
591
+ $section_ids['settings_name']
592
+ );
593
+ }
594
+ if ( ( new Environment_Check() )->is_moove_gdpr_active() ) {
595
+ // add fields for the GDPR Cookie Compliance support
596
+ add_settings_field(
597
+ 'wgact_setting_moove_gdpr_support',
598
+ esc_html__( 'GDPR Cookie Compliance support', 'woocommerce-google-adwords-conversion-tracking-tag' ),
599
+ [ $this, 'wgact_setting_html_moove_gdpr_support' ],
600
+ 'wgact_plugin_options_page',
601
+ $section_ids['settings_name']
602
+ );
603
+ }
604
+ if ( ( new Environment_Check() )->is_cookie_law_info_active() ) {
605
+ // add fields for the GDPR Cookie Consent support
606
+ add_settings_field(
607
+ 'wgact_setting_moove_gdpr_support',
608
+ esc_html__( 'GDPR Cookie Consent support', 'woocommerce-google-adwords-conversion-tracking-tag' ),
609
+ [ $this, 'wgact_setting_html_cookie_law_info_support' ],
610
+ 'wgact_plugin_options_page',
611
+ $section_ids['settings_name']
612
+ );
613
+ }
614
  }
615
 
616
  public function add_section_advanced_subsection_facebook( $section_ids )
655
  // add fields for Facebook microdata
656
  add_settings_field(
657
  'wgact_setting_facebook_microdata_active',
658
+ esc_html__( 'Facebook Microdata Tags for Catalogues', 'woocommerce-google-adwords-conversion-tracking-tag' ),
659
  [ $this, 'wgact_setting_html_facebook_microdata' ],
660
  'wgact_plugin_options_page',
661
  $section_ids['settings_name']
1273
  ?>
1274
  <select id="wgact_setting_google_consent_regions" multiple="multiple"
1275
  name="wgact_plugin_options[google][consent_mode][regions][]"
1276
+ style="width:350px; padding-left: 10px" data-placeholder="Choose countries&hellip;" aria-label="Country"
1277
  class="wc-enhanced-select"
1278
  <?php
1279
  echo $this->disable_if_demo() ;
1502
 
1503
  public function wgact_setting_html_borlabs_support()
1504
  {
1505
+ esc_html_e( 'Borlabs Cookie detected. Automatic support is:', 'woocommerce-google-adwords-conversion-tracking-tag' );
1506
  echo $this->get_status_icon( true, true, true ) ;
1507
  echo $this->html_pro_feature() ;
1508
  }
1509
 
1510
  public function wgact_setting_html_cookiebot_support()
1511
+ {
1512
+ esc_html_e( 'Cookiebot detected. Automatic support is:', 'woocommerce-google-adwords-conversion-tracking-tag' );
1513
+ echo $this->get_status_icon( true, true, true ) ;
1514
+ echo $this->html_pro_feature() ;
1515
+ }
1516
+
1517
+ public function wgact_setting_html_cookiebot_manual_setting()
1518
  {
1519
  // adding the hidden input is a hack to make WordPress save the option with the value zero,
1520
  // instead of not saving it and remove that array key entirely
1547
 
1548
  }
1549
 
1550
+ public function wgact_setting_html_complianz_support()
1551
+ {
1552
+ esc_html_e( 'Complianz GDPR detected. Automatic support is:', 'woocommerce-google-adwords-conversion-tracking-tag' );
1553
+ echo $this->get_status_icon( true, true, true ) ;
1554
+ echo $this->html_pro_feature() ;
1555
+ }
1556
+
1557
+ public function wgact_setting_html_cookie_notice_support()
1558
+ {
1559
+ esc_html_e( 'Cookie Notice (by hu-manity.co) detected. Automatic support is:', 'woocommerce-google-adwords-conversion-tracking-tag' );
1560
+ echo $this->get_status_icon( true, true, true ) ;
1561
+ echo $this->html_pro_feature() ;
1562
+ }
1563
+
1564
+ public function wgact_setting_html_cookie_script_support()
1565
+ {
1566
+ esc_html_e( 'Cookie Script (by cookie-script.com) detected. Automatic support is:', 'woocommerce-google-adwords-conversion-tracking-tag' );
1567
+ echo $this->get_status_icon( true, true, true ) ;
1568
+ echo $this->html_pro_feature() ;
1569
+ }
1570
+
1571
+ public function wgact_setting_html_moove_gdpr_support()
1572
+ {
1573
+ esc_html_e( 'GDPR Cookie Compliance (by Moove Agency) detected. Automatic support is:', 'woocommerce-google-adwords-conversion-tracking-tag' );
1574
+ echo $this->get_status_icon( true, true, true ) ;
1575
+ echo $this->html_pro_feature() ;
1576
+ }
1577
+
1578
+ public function wgact_setting_html_cookie_law_info_support()
1579
+ {
1580
+ esc_html_e( 'GDPR Cookie Consent (by WebToffee) detected. Automatic support is:', 'woocommerce-google-adwords-conversion-tracking-tag' );
1581
+ echo $this->get_status_icon( true, true, true ) ;
1582
+ echo $this->html_pro_feature() ;
1583
+ }
1584
+
1585
+ public function wgact_setting_html_explicit_consent_mode()
1586
+ {
1587
+ // adding the hidden input is a hack to make WordPress save the option with the value zero,
1588
+ // instead of not saving it and remove that array key entirely
1589
+ // https://stackoverflow.com/a/1992745/4688612
1590
+ ?>
1591
+ <label>
1592
+ <input type='hidden' value='0' name='wgact_plugin_options[shop][cookie_consent_mgmt][explicit_consent]'>
1593
+ <input type='checkbox' id='wgact_setting_explicit_consent_mode'
1594
+ name='wgact_plugin_options[shop][cookie_consent_mgmt][explicit_consent]'
1595
+ value='1'
1596
+ <?php
1597
+ checked( $this->options['shop']['cookie_consent_mgmt']['explicit_consent'] );
1598
+ ?>
1599
+ <?php
1600
+ echo $this->disable_if_demo() ;
1601
+ ?>
1602
+ />
1603
+ <?php
1604
+ esc_html_e( 'Enable Explicit Consent Mode', 'woocommerce-google-adwords-conversion-tracking-tag' );
1605
+ ?></label>
1606
+ <?php
1607
+ echo $this->get_status_icon( $this->options['shop']['cookie_consent_mgmt']['explicit_consent'], true, true ) ;
1608
+ echo $this->get_documentation_html( '/wgact/#/consent-mgmt/overview?id=explicit-consent-mode' ) ;
1609
+ echo $this->html_pro_feature() ;
1610
+ echo '<p style="margin-top:10px">' ;
1611
+ esc_html_e( '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.', 'woocommerce-google-adwords-conversion-tracking-tag' );
1612
+ echo '</p>' ;
1613
+ }
1614
+
1615
  public function wgact_setting_html_facebook_capi_token()
1616
  {
1617
  ?><textarea id='wgact_setting_facebook_capi_token'
2125
  esc_html_e( 'post ID (default)', 'woocommerce-google-adwords-conversion-tracking-tag' );
2126
  ?></label>
2127
  <br>
2128
+ <label>
2129
+ <input type='radio' id='wgact_plugin_option_product_identifier_2'
2130
+ name='wgact_plugin_options[google][ads][product_identifier]'
2131
+ value='2' <?php
2132
+ echo checked( 2, $this->options['google']['ads']['product_identifier'], false ) ;
2133
+ ?>/><?php
2134
+ esc_html_e( 'SKU', 'woocommerce-google-adwords-conversion-tracking-tag' );
2135
+ ?>
2136
+ </label>
2137
+ <br>
2138
  <label>
2139
  <input type='radio' id='wgact_plugin_option_product_identifier_1'
2140
  name='wgact_plugin_options[google][ads][product_identifier]'
2141
  value='1' <?php
2142
  echo checked( 1, $this->options['google']['ads']['product_identifier'], false ) ;
2143
  ?>/><?php
2144
+ esc_html_e( 'ID for the WooCommerce Google Product Feed. Outputs the post ID with woocommerce_gpf_ prefix *', 'woocommerce-google-adwords-conversion-tracking-tag' );
2145
  ?>
2146
  </label>
2147
  <br>
2148
  <label>
2149
+ <input type='radio' id='wgact_plugin_option_product_identifier_3'
2150
  name='wgact_plugin_options[google][ads][product_identifier]'
2151
+ value='3' <?php
2152
+ echo checked( 3, $this->options['google']['ads']['product_identifier'], false ) ;
2153
  ?>/><?php
2154
+ esc_html_e( 'ID for the WooCommerce Google Listings & Ads Plugin. Outputs the post ID with gla_ prefix **', 'woocommerce-google-adwords-conversion-tracking-tag' );
2155
+ ?>
2156
+ </label>
2157
+ <br>
2158
+ <p style="margin-top:10px">
2159
+ <?php
2160
  esc_html_e( 'Choose a product identifier.', 'woocommerce-google-adwords-conversion-tracking-tag' );
2161
  ?>
2162
+ </p>
2163
+ <br>
2164
  <?php
2165
  esc_html_e( '* This is for users of the WooCommerce Google Product Feed Plugin', 'woocommerce-google-adwords-conversion-tracking-tag' );
2166
  ?>
2167
  <a href="https://woocommerce.com/products/google-product-feed/" target="_blank">WooCommerce Google Product Feed
2168
  Plugin</a>
2169
+ <br>
2170
+ <?php
2171
+ esc_html_e( '** This is for users of the WooCommerce Google Listings & Ads Plugin', 'woocommerce-google-adwords-conversion-tracking-tag' );
2172
+ ?>
2173
+ <a href="https://woocommerce.com/products/google-listings-and-ads/" target="_blank">WooCommerce Google Listings
2174
+ & Ads Plugin
2175
+ Plugin</a>
2176
 
2177
  <?php
2178
  }
classes/admin/class-environment-check.php CHANGED
@@ -75,17 +75,19 @@ class Environment_Check
75
  public function flush_cache_of_all_cache_plugins()
76
  {
77
  // error_log('flush cache of all cache plugins');
78
- if ($this->is_wp_rocket_active()) $this->flush_wp_rocket_cache(); // works
79
- if ($this->is_litespeed_active()) $this->flush_litespeed_cache(); // works
80
- if ($this->is_autoptimize_active()) $this->flush_autoptimize_cache(); // works
81
- if ($this->is_hummingbird_active()) $this->flush_hummingbird_cache(); // works
82
- if ($this->is_nitropack_active()) $this->flush_nitropack_cache(); // works
83
- if ($this->is_sg_optimizer_active()) $this->flush_sg_optimizer_cache(); // works
84
- if ($this->is_w3_total_cache_active()) $this->flush_w3_total_cache(); // works
85
- if ($this->is_wp_optimize_active()) $this->flush_wp_optimize_cache(); // works
86
- if ($this->is_wp_super_cache_active()) $this->flush_wp_super_cache(); // works
87
- if ($this->is_wp_fastest_cache_active()) $this->flush_wp_fastest_cache(); // works
88
- if ($this->is_cloudflare_active()) $this->flush_cloudflare_cache(); // works
 
 
89
 
90
  if ($this->is_hosting_wp_engine()) $this->flush_wp_engine_cache(); // works
91
  // if ($this->is_hosting_pagely()) $this->flush_pagely_cache(); // TODO test
@@ -134,6 +136,33 @@ class Environment_Check
134
  }
135
  }
136
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
137
  public function flush_wp_engine_cache()
138
  {
139
  try {
@@ -437,6 +466,54 @@ class Environment_Check
437
  return is_plugin_active('borlabs-cookie/borlabs-cookie.php');
438
  }
439
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
440
  public function is_wp_super_cache_active(): bool
441
  {
442
  // TODO find out if there is a pro version with different folder and file name
@@ -491,12 +568,34 @@ class Environment_Check
491
  return is_plugin_active('yith-woocommerce-brands-add-on-premium/init.php');
492
  }
493
 
494
- public function is_hosting_flywheel()
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
495
  {
496
  return defined("FLYWHEEL_PLUGIN_DIR");
497
  }
498
 
499
- public function is_hosting_cloudways()
500
  {
501
  return array_key_exists("cw_allowed_ip", $_SERVER) || preg_match("~/home/.*?cloudways.*~", __FILE__);
502
  }
@@ -647,13 +746,70 @@ class Environment_Check
647
  // add_filter('wpo_minify_inline_js', '__return_false');
648
  add_filter('wp-optimize-minify-default-exclusions', [$this, 'wp_optimize_minify_default_exclusions']);
649
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
650
  }
651
 
652
  public function wp_optimize_minify_default_exclusions($default_exclusions): array
653
  {
654
  // $default_exclusions[] = 'something/else.js';
655
  // $default_exclusions[] = 'something/else.css';
656
- return array_merge($default_exclusions, $this->get_wooptpm_script_identifiers());
657
  }
658
 
659
  // https://github.com/futtta/autoptimize/blob/37b13d4e19269bb2f50df123257de51afa37244f/classes/autoptimizeScripts.php#L387
@@ -684,7 +840,7 @@ class Environment_Check
684
  public function litespeed_optimize_js_excludes($excludes): array
685
  {
686
  if (is_array($excludes)) {
687
- $excludes = array_merge($excludes, $this->get_wooptpm_script_identifiers());
688
  }
689
 
690
  return $excludes;
@@ -693,7 +849,7 @@ class Environment_Check
693
  public function litespeed_cache_js_defer_exc($excludes): array
694
  {
695
  if (is_array($excludes)) {
696
- $excludes = array_merge($excludes, $this->get_wooptpm_script_identifiers());
697
  }
698
  return $excludes;
699
  }
@@ -701,7 +857,7 @@ class Environment_Check
701
  public function sg_optimizer_js_exclude_combine_inline_content($exclude_list): array
702
  {
703
  if (is_array($exclude_list)) {
704
- $exclude_list = array_merge($exclude_list, $this->get_wooptpm_script_identifiers());
705
  }
706
 
707
  // foreach ($this->get_wooptpm_script_identifiers() as $exclusion) {
@@ -735,7 +891,7 @@ class Environment_Check
735
  public function sgo_javascript_combine_exclude_move_after($exclude_list): array
736
  {
737
  if (is_array($exclude_list)) {
738
- $exclude_list = array_merge($exclude_list, $this->get_wooptpm_script_identifiers());
739
  }
740
 
741
  return $exclude_list;
@@ -743,7 +899,7 @@ class Environment_Check
743
 
744
  public function add_wp_rocket_exclusions($exclusions): array
745
  {
746
- if (is_array($exclusions)) $exclusions = array_merge($exclusions, $this->get_wooptpm_script_identifiers());
747
 
748
  return $exclusions;
749
  }
75
  public function flush_cache_of_all_cache_plugins()
76
  {
77
  // error_log('flush cache of all cache plugins');
78
+ if ($this->is_wp_rocket_active()) $this->flush_wp_rocket_cache(); // works
79
+ if ($this->is_litespeed_active()) $this->flush_litespeed_cache(); // works
80
+ if ($this->is_autoptimize_active()) $this->flush_autoptimize_cache(); // works
81
+ if ($this->is_hummingbird_active()) $this->flush_hummingbird_cache(); // works
82
+ if ($this->is_nitropack_active()) $this->flush_nitropack_cache(); // works
83
+ if ($this->is_sg_optimizer_active()) $this->flush_sg_optimizer_cache(); // works
84
+ if ($this->is_w3_total_cache_active()) $this->flush_w3_total_cache(); // works
85
+ if ($this->is_wp_optimize_active()) $this->flush_wp_optimize_cache(); // works
86
+ if ($this->is_wp_super_cache_active()) $this->flush_wp_super_cache(); // works
87
+ if ($this->is_wp_fastest_cache_active()) $this->flush_wp_fastest_cache(); // works
88
+ if ($this->is_cloudflare_active()) $this->flush_cloudflare_cache(); // works
89
+ if ($this->is_flying_press_active()) $this->flush_flying_press_cache(); // works
90
+
91
 
92
  if ($this->is_hosting_wp_engine()) $this->flush_wp_engine_cache(); // works
93
  // if ($this->is_hosting_pagely()) $this->flush_pagely_cache(); // TODO test
136
  }
137
  }
138
 
139
+ public function flush_flying_press_cache()
140
+ {
141
+ try {
142
+ if (class_exists('\FlyingPress\Config') && class_exists('\FlyingPress\Purge')) {
143
+
144
+ // This is the way to update the Flying Press settings.
145
+ // No other 'normal' way is possible.
146
+
147
+ if (!is_array(\FlyingPress\Config::$config['js_defer_excludes'])) {
148
+ \FlyingPress\Config::$config['js_defer_excludes'] = [];
149
+ }
150
+
151
+ \FlyingPress\Config::$config['js_defer_excludes'] = array_unique(array_merge(\FlyingPress\Config::$config['js_defer_excludes'], $this->get_wooptpm_script_identifiers()));
152
+
153
+ if (
154
+ method_exists('\FlyingPress\Config', 'update_config') &&
155
+ method_exists('\FlyingPress\Purge', 'purge_cached_pages')
156
+ ) {
157
+ \FlyingPress\Config::update_config(\FlyingPress\Config::$config);
158
+ \FlyingPress\Purge::purge_cached_pages();
159
+ }
160
+ }
161
+ } catch (\Exception $e) {
162
+ error_log($e);
163
+ }
164
+ }
165
+
166
  public function flush_wp_engine_cache()
167
  {
168
  try {
466
  return is_plugin_active('borlabs-cookie/borlabs-cookie.php');
467
  }
468
 
469
+ public function is_cookiebot_active(): bool
470
+ {
471
+ return is_plugin_active('cookiebot/cookiebot.php');
472
+ }
473
+
474
+ public function is_complianz_active(): bool
475
+ {
476
+ return is_plugin_active('complianz-gdpr/complianz-gpdr.php');
477
+ }
478
+
479
+ // Cookie Notice by hu-manity.co
480
+ public function is_cookie_notice_active(): bool
481
+ {
482
+ return is_plugin_active('cookie-notice/cookie-notice.php');
483
+ }
484
+
485
+ public function is_cookie_script_active(): bool
486
+ {
487
+ return is_plugin_active('cookie-script-com/cookie-script.php');
488
+ }
489
+
490
+ public function is_moove_gdpr_active(): bool
491
+ {
492
+ return is_plugin_active('gdpr-cookie-compliance/moove-gdpr.php');
493
+ }
494
+
495
+ public function is_cookie_law_info_active(): bool
496
+ {
497
+ return is_plugin_active('cookie-law-info/cookie-law-info.php');
498
+ }
499
+
500
+ public function is_some_cmp_active(): bool
501
+ {
502
+ if (
503
+ $this->is_borlabs_cookie_active() ||
504
+ $this->is_cookiebot_active() ||
505
+ $this->is_complianz_active() ||
506
+ $this->is_cookie_notice_active() ||
507
+ $this->is_cookie_script_active() ||
508
+ $this->is_moove_gdpr_active() ||
509
+ $this->is_cookie_law_info_active()
510
+ ) {
511
+ return true;
512
+ } else {
513
+ return false;
514
+ }
515
+ }
516
+
517
  public function is_wp_super_cache_active(): bool
518
  {
519
  // TODO find out if there is a pro version with different folder and file name
568
  return is_plugin_active('yith-woocommerce-brands-add-on-premium/init.php');
569
  }
570
 
571
+ public function is_optimocha_active(): bool
572
+ {
573
+ // TODO find out if there is a pro version with different folder and file name
574
+ return is_plugin_active('speed-booster-pack/speed-booster-pack.php');
575
+ }
576
+
577
+ public function is_async_javascript_active(): bool
578
+ {
579
+ // TODO find out if there is a pro version with different folder and file name
580
+ return is_plugin_active('async-javascript/async-javascript.php');
581
+ }
582
+
583
+ public function is_flying_press_active(): bool
584
+ {
585
+ // TODO find out if there is a pro version with different folder and file name
586
+ return is_plugin_active('flying-press/flying-press.php');
587
+ }
588
+
589
+ /*
590
+ * Check to find out what hosting provider is being used
591
+ * */
592
+
593
+ public function is_hosting_flywheel(): bool
594
  {
595
  return defined("FLYWHEEL_PLUGIN_DIR");
596
  }
597
 
598
+ public function is_hosting_cloudways(): bool
599
  {
600
  return array_key_exists("cw_allowed_ip", $_SERVER) || preg_match("~/home/.*?cloudways.*~", __FILE__);
601
  }
746
  // add_filter('wpo_minify_inline_js', '__return_false');
747
  add_filter('wp-optimize-minify-default-exclusions', [$this, 'wp_optimize_minify_default_exclusions']);
748
  }
749
+
750
+ if ($this->is_optimocha_active()) {
751
+ add_filter('option_sbp_options', function ($options) {
752
+
753
+ $options['js_exclude'] = $options['js_exclude'] . PHP_EOL . implode(PHP_EOL, $this->get_wooptpm_script_identifiers());
754
+
755
+ $js_include = explode(PHP_EOL, $options['js_include']);
756
+
757
+ $js_include = array_filter($js_include, function ($string) {
758
+ foreach ($this->get_wooptpm_script_identifiers() as $value) {
759
+ if (strpos($string, $value) !== false) return false;
760
+ }
761
+
762
+ return true;
763
+ });
764
+
765
+ $options['js_include'] = implode(PHP_EOL, $js_include);
766
+
767
+ return $options;
768
+ });
769
+ }
770
+
771
+ if ($this->is_async_javascript_active()) {
772
+
773
+ // add_filter('option_aj_exclusions', function ($options) {
774
+ // $options = explode(',', $options);
775
+ // $options = array_unique(array_merge($options, $this->get_wooptpm_script_identifiers()));
776
+ // return implode(',', $options);
777
+ // });
778
+
779
+ add_filter('option_aj_plugin_exclusions', function ($options) {
780
+
781
+ if (!is_array($options)) {
782
+ $options = [];
783
+ }
784
+
785
+ return array_unique(array_merge($options, [
786
+ 'woocommerce-google-adwords-conversion-tracking-tag',
787
+ 'woopt-pixel-manager-pro'
788
+ ]));
789
+ });
790
+ }
791
+
792
+ if ($this->is_flying_press_active()) {
793
+
794
+ add_filter('pre_update_option_FLYING_PRESS_CONFIG', function ($options) {
795
+
796
+ $options['js_defer_excludes'] = array_unique(array_merge($options['js_defer_excludes'], $this->get_wooptpm_script_identifiers()));
797
+ return $options;
798
+ });
799
+
800
+ add_filter('option_FLYING_PRESS_CONFIG', function ($options) {
801
+
802
+ $options['js_defer_excludes'] = array_unique(array_merge($options['js_defer_excludes'], $this->get_wooptpm_script_identifiers()));
803
+ return $options;
804
+ });
805
+ }
806
  }
807
 
808
  public function wp_optimize_minify_default_exclusions($default_exclusions): array
809
  {
810
  // $default_exclusions[] = 'something/else.js';
811
  // $default_exclusions[] = 'something/else.css';
812
+ return array_unique(array_merge($default_exclusions, $this->get_wooptpm_script_identifiers()));
813
  }
814
 
815
  // https://github.com/futtta/autoptimize/blob/37b13d4e19269bb2f50df123257de51afa37244f/classes/autoptimizeScripts.php#L387
840
  public function litespeed_optimize_js_excludes($excludes): array
841
  {
842
  if (is_array($excludes)) {
843
+ $excludes = array_unique(array_merge($excludes, $this->get_wooptpm_script_identifiers()));
844
  }
845
 
846
  return $excludes;
849
  public function litespeed_cache_js_defer_exc($excludes): array
850
  {
851
  if (is_array($excludes)) {
852
+ $excludes = array_unique(array_merge($excludes, $this->get_wooptpm_script_identifiers()));
853
  }
854
  return $excludes;
855
  }
857
  public function sg_optimizer_js_exclude_combine_inline_content($exclude_list): array
858
  {
859
  if (is_array($exclude_list)) {
860
+ $exclude_list = array_unique(array_merge($exclude_list, $this->get_wooptpm_script_identifiers()));
861
  }
862
 
863
  // foreach ($this->get_wooptpm_script_identifiers() as $exclusion) {
891
  public function sgo_javascript_combine_exclude_move_after($exclude_list): array
892
  {
893
  if (is_array($exclude_list)) {
894
+ $exclude_list = array_unique(array_merge($exclude_list, $this->get_wooptpm_script_identifiers()));
895
  }
896
 
897
  return $exclude_list;
899
 
900
  public function add_wp_rocket_exclusions($exclusions): array
901
  {
902
+ if (is_array($exclusions)) $exclusions = array_unique(array_merge($exclusions, $this->get_wooptpm_script_identifiers()));
903
 
904
  return $exclusions;
905
  }
classes/class-default-options.php CHANGED
@@ -84,6 +84,7 @@ class Default_Options
84
  'cookiebot' => [
85
  'active' => 0
86
  ],
 
87
  ],
88
  'order_deduplication' => 1
89
  ],
84
  'cookiebot' => [
85
  'active' => 0
86
  ],
87
+ 'explicit_consent' => 0,
88
  ],
89
  'order_deduplication' => 1
90
  ],
classes/pixels/class-pixel-manager.php CHANGED
@@ -313,9 +313,7 @@ class Pixel_Manager extends Pixel_Manager_Base
313
  }
314
  if ( is_order_received_page() ) {
315
 
316
- if ( $this->get_order_from_order_received_page() ) {
317
- $order = new WC_Order( $this->get_order_from_order_received_page() );
318
- // $this->inject_transaction_deduper_script($order->get_order_number());
319
  $this->inject_transaction_deduper_script( $order->get_id() );
320
  $this->increase_conversion_count_for_ratings( $order );
321
  }
@@ -538,6 +536,9 @@ class Pixel_Manager extends Pixel_Manager_Base
538
  $data['mini_cart'] = [
539
  'track' => apply_filters( 'wooptpm_track_mini_cart', true ),
540
  ];
 
 
 
541
  ?>
542
 
543
  <script>
@@ -546,12 +547,24 @@ class Pixel_Manager extends Pixel_Manager_Base
546
  ?>;
547
  </script>
548
  <?php
 
 
 
 
 
 
 
 
 
 
 
 
549
  }
550
 
551
  private function inject_data_layer_general()
552
  {
553
  $data = [
554
- 'variationsOutput' => ( $this->options_obj->general->variations_output ? true : false ),
555
  ];
556
  ?>
557
 
313
  }
314
  if ( is_order_received_page() ) {
315
 
316
+ if ( $order = $this->get_order_from_order_received_page() ) {
 
 
317
  $this->inject_transaction_deduper_script( $order->get_id() );
318
  $this->increase_conversion_count_for_ratings( $order );
319
  }
536
  $data['mini_cart'] = [
537
  'track' => apply_filters( 'wooptpm_track_mini_cart', true ),
538
  ];
539
+ $data['cookie_consent_mgmt'] = [
540
+ 'explicit_consent' => (bool) $this->options_obj->shop->cookie_consent_mgmt->explicit_consent,
541
+ ];
542
  ?>
543
 
544
  <script>
547
  ?>;
548
  </script>
549
  <?php
550
+ if ( $this->options_obj->shop->cookie_consent_mgmt->explicit_consent ) {
551
+ ?>
552
+
553
+ <script>
554
+ if (typeof wooptpm != "undefined") {
555
+ wooptpm.updateConsentCookieValues(true)
556
+ } else {
557
+ console.error('wootpm is not defined. That means you are deferring the script which you shouldn\'t. wooptpm must be loaded before the inline scripts run. Visitor tracking will continue to work, but explicit consent mode will be ignored.')
558
+ }
559
+ </script>
560
+ <?php
561
+ }
562
  }
563
 
564
  private function inject_data_layer_general()
565
  {
566
  $data = [
567
+ 'variationsOutput' => (bool) $this->options_obj->general->variations_output,
568
  ];
569
  ?>
570
 
classes/pixels/class-shortcodes.php CHANGED
@@ -117,7 +117,7 @@ class Shortcodes extends Pixel
117
  ?>
118
 
119
  <script>
120
- gtag('event', 'conversion', {'send_to': 'AW-<?php echo $shortcode_attributes['gads-conversion-id'] ?>/<?php echo $shortcode_attributes['gads-conversion-label'] ?>'});
121
  </script>
122
  <?php
123
  }
117
  ?>
118
 
119
  <script>
120
+ if (googleConfigConditionsMet('ads')) gtag('event', 'conversion', {'send_to': 'AW-<?php echo $shortcode_attributes['gads-conversion-id'] ?>/<?php echo $shortcode_attributes['gads-conversion-label'] ?>'});
121
  </script>
122
  <?php
123
  }
classes/pixels/facebook/class-facebook-pixel-manager.php CHANGED
@@ -82,7 +82,15 @@ class Facebook_Pixel_Manager extends Pixel_Manager_Base
82
  {
83
  echo PHP_EOL ;
84
  echo ' <!-- START Facebook scripts -->' . PHP_EOL ;
85
- echo ' <script>' ;
 
 
 
 
 
 
 
 
86
  echo PHP_EOL ;
87
  }
88
 
82
  {
83
  echo PHP_EOL ;
84
  echo ' <!-- START Facebook scripts -->' . PHP_EOL ;
85
+ // echo ' <script>';
86
+ echo "\t\t\t" . $this->get_formatted_script_tag( [
87
+ 'async' => true,
88
+ 'defer' => false,
89
+ 'src' => '',
90
+ 'cookie_category' => 'ads',
91
+ 'pixel_name' => 'facebook-ads',
92
+ 'inject_cfasync' => false,
93
+ ] ) . PHP_EOL ;
94
  echo PHP_EOL ;
95
  }
96
 
classes/pixels/google/class-google-ads.php CHANGED
@@ -61,7 +61,7 @@ class Google_Ads extends Google
61
  if ( $this->options_obj->google->ads->conversion_label ) {
62
  ?>
63
 
64
- gtag('event', 'conversion', {
65
  'send_to' : <?php
66
  echo json_encode( $this->get_google_ads_conversion_ids( true ) ) ;
67
  ?>,
@@ -103,7 +103,7 @@ class Google_Ads extends Google
103
  if ( $this->add_cart_data == true && $this->conversion_id && $this->conversion_label ) {
104
  ?>
105
 
106
- gtag('event', 'purchase', <?php
107
  echo json_encode( $this->get_google_ads_formatted_purchase_json(
108
  $order,
109
  $order_total,
@@ -164,7 +164,7 @@ class Google_Ads extends Google
164
 
165
  protected function get_dyn_remarketing_purchase_script( $order, $order_total )
166
  {
167
- echo "\n wooptpmExists().then(function(){\n if (!wooptpm.isOrderIdStored('" . $order->get_id() . "')) {\n gtag('event', 'purchase', {\n 'send_to': " . json_encode( $this->get_google_ads_conversion_ids() ) . ",\n 'value' : " . $order_total . ",\n 'items' : " . json_encode( $this->get_order_items_for_google_ads_purchase_script( $order, true ) ) . "\n });\n }\n });\n " ;
168
  }
169
 
170
  private function get_order_items_for_google_ads_purchase_script( $order, $dyn_r = false ) : array
61
  if ( $this->options_obj->google->ads->conversion_label ) {
62
  ?>
63
 
64
+ if (googleConfigConditionsMet('ads')) gtag('event', 'conversion', {
65
  'send_to' : <?php
66
  echo json_encode( $this->get_google_ads_conversion_ids( true ) ) ;
67
  ?>,
103
  if ( $this->add_cart_data == true && $this->conversion_id && $this->conversion_label ) {
104
  ?>
105
 
106
+ if (googleConfigConditionsMet('ads')) gtag('event', 'purchase', <?php
107
  echo json_encode( $this->get_google_ads_formatted_purchase_json(
108
  $order,
109
  $order_total,
164
 
165
  protected function get_dyn_remarketing_purchase_script( $order, $order_total )
166
  {
167
+ echo "\n wooptpmExists().then(function(){\n if (!wooptpm.isOrderIdStored('" . $order->get_id() . "')) {\n if (googleConfigConditionsMet('ads')) gtag('event', 'purchase', {\n 'send_to': " . json_encode( $this->get_google_ads_conversion_ids() ) . ",\n 'value' : " . $order_total . ",\n 'items' : " . json_encode( $this->get_order_items_for_google_ads_purchase_script( $order, true ) ) . "\n });\n }\n });\n " ;
168
  }
169
 
170
  private function get_order_items_for_google_ads_purchase_script( $order, $dyn_r = false ) : array
classes/pixels/google/class-google-analytics-4.php CHANGED
@@ -23,7 +23,7 @@ class Google_Analytics_4 extends Google_Analytics
23
  echo "
24
  wooptpmExists().then(function(){
25
  if (!wooptpm.isOrderIdStored('" . $order->get_id() . "')) {
26
- gtag('event', 'purchase', " . $this->get_event_purchase_json($order, $order_total, $order_currency, $is_new_customer) . ");
27
  }
28
  });
29
  ";
23
  echo "
24
  wooptpmExists().then(function(){
25
  if (!wooptpm.isOrderIdStored('" . $order->get_id() . "')) {
26
+ if (googleConfigConditionsMet('analytics')) gtag('event', 'purchase', " . $this->get_event_purchase_json($order, $order_total, $order_currency, $is_new_customer) . ");
27
  }
28
  });
29
  ";
classes/pixels/google/class-google-analytics-refund-4.php CHANGED
@@ -31,7 +31,7 @@ class Google_Analytics_Refund_4 extends Google_Analytics
31
  ?>
32
  <script>
33
  // console.log('pushed refund to dataLayer');
34
- gtag('event', 'refund', <?php echo json_encode($data)?>);
35
  </script>
36
  <?php
37
  }
31
  ?>
32
  <script>
33
  // console.log('pushed refund to dataLayer');
34
+ if (googleConfigConditionsMet('analytics')) gtag('event', 'refund', <?php echo json_encode($data)?>);
35
  </script>
36
  <?php
37
  }
classes/pixels/google/class-google-analytics-refund-ua.php CHANGED
@@ -31,7 +31,7 @@ class Google_Analytics_Refund_UA extends Google_Analytics
31
  ?>
32
  <script>
33
  // console.log('pushed refund to dataLayer');
34
- gtag('event', 'refund', <?php echo json_encode($data) ?>);
35
  </script>
36
  <?php
37
  }
31
  ?>
32
  <script>
33
  // console.log('pushed refund to dataLayer');
34
+ if (googleConfigConditionsMet('analytics')) gtag('event', 'refund', <?php echo json_encode($data) ?>);
35
  </script>
36
  <?php
37
  }
classes/pixels/google/class-google-analytics-ua.php CHANGED
@@ -21,7 +21,7 @@ class Google_Analytics_UA extends Google_Analytics
21
  echo "
22
  wooptpmExists().then(function(){
23
  if (!wooptpm.isOrderIdStored('" . $order->get_id() . "')) {
24
- gtag('event', 'purchase', " . $this->get_event_purchase_json($order, $order_total, $order_currency, $is_new_customer) . ")
25
  }
26
  }).catch(() => {
27
  console.log('couldn\'t run gtag for GA UA');
21
  echo "
22
  wooptpmExists().then(function(){
23
  if (!wooptpm.isOrderIdStored('" . $order->get_id() . "')) {
24
+ if (googleConfigConditionsMet('analytics')) gtag('event', 'purchase', " . $this->get_event_purchase_json($order, $order_total, $order_currency, $is_new_customer) . ")
25
  }
26
  }).catch(() => {
27
  console.log('couldn\'t run gtag for GA UA');
classes/pixels/google/class-google.php CHANGED
@@ -4,6 +4,7 @@ namespace WGACT\Classes\Pixels\Google;
4
 
5
  use WGACT\Classes\Admin\Environment_Check ;
6
  use WGACT\Classes\Pixels\Pixel ;
 
7
 
8
  if ( !defined( 'ABSPATH' ) ) {
9
  exit;
@@ -13,6 +14,7 @@ if ( !defined( 'ABSPATH' ) ) {
13
  class Google extends Pixel
14
  {
15
  use Trait_Google ;
 
16
  protected $google_ads_conversion_identifiers ;
17
  public function __construct( $options )
18
  {
@@ -33,9 +35,36 @@ class Google extends Pixel
33
  {
34
  $this->inject_data_layer_pixels();
35
  if ( $this->options_obj->google->optimize->container_id ) {
36
- echo "<script async src='https://www.googleoptimize.com/optimize.js?id=" . $this->options_obj->google->optimize->container_id . "'></script>" . PHP_EOL ;
 
 
 
 
 
 
 
 
 
 
 
 
 
37
  }
38
- echo "\n <script async src='https://www.googletagmanager.com/gtag/js?id=" . $this->get_gtag_id() . "'></script>" ;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
39
  echo $this->get_modified_script_opening_tag() . PHP_EOL ;
40
  echo $this->get_google_init_js() ;
41
  foreach ( $this->google_ads_conversion_identifiers as $conversion_id => $conversion_label ) {
@@ -58,21 +87,40 @@ class Google extends Pixel
58
  if ( $this->is_google_ads_active() && $this->options_obj->google->ads->phone_conversion_number && $this->options_obj->google->ads->phone_conversion_label ) {
59
  $this->inject_phone_conversion_number_html__premium_only();
60
  }
61
- if ( $this->options_obj->google->consent_mode->active && ( new Environment_Check() )->is_borlabs_cookie_active() ) {
62
- echo $this->inject_borlabs_consent_mode_update() ;
63
- }
64
  // $this->inject_closing_script_tag();
65
  }
66
 
 
 
 
 
 
 
 
 
 
 
 
 
67
  private function get_modified_script_opening_tag() : string
68
  {
69
- $cookiebot_snippet = ( $this->options_obj->shop->cookie_consent_mgmt->cookiebot->active ? ' data-cookieconsent="ignore"' : '' );
70
- return "\n <script" . $cookiebot_snippet . ">";
 
 
 
 
 
 
 
71
  }
72
 
73
  protected function get_google_init_js() : string
74
  {
75
- return "\n window.dataLayer = window.dataLayer || [];\n\n window.gtag = function gtag() {\n dataLayer.push(arguments);\n }\n " . $this->consent_mode_gtag_html() . $this->linker_html() . "\n gtag('js', new Date());";
76
  }
77
 
78
  // https://developers.google.com/gtagjs/devguide/linker
@@ -104,7 +152,7 @@ class Google extends Pixel
104
  // needs to be output as text
105
  $url_passthrough = ( apply_filters( 'wooptpm_google_url_passthrough', true ) ? 'true' : 'false' );
106
  // needs to be output as text
107
- return "\n gtag('consent', 'default', " . json_encode( $data ) . ");\n gtag('set', 'ads_data_redaction', " . $ads_data_redaction . ");\n gtag('set', 'url_passthrough', " . $url_passthrough . ");" . PHP_EOL;
108
  } else {
109
  return '';
110
  }
@@ -263,6 +311,8 @@ class Google extends Pixel
263
  return $this->options_obj->google->analytics->ga4->measurement_id;
264
  } elseif ( $this->options_obj->google->ads->conversion_id ) {
265
  return 'AW-' . $this->options_obj->google->ads->conversion_id;
 
 
266
  }
267
 
268
  }
@@ -271,16 +321,16 @@ class Google extends Pixel
271
  {
272
  $data = [
273
  'google' => [
274
- 'ads' => [
275
  'dynamic_remarketing' => [
276
- 'status' => ( $this->options_obj->google->ads->dynamic_remarketing ? true : false ),
277
  'id_type' => $this->get_dyn_r_id_type(),
278
  'send_events_with_parent_ids' => apply_filters( 'wooptpm_send_events_with_parent_ids', true ),
279
  ],
280
  'conversionIds' => $this->get_google_ads_conversion_ids(),
281
  'google_business_vertical' => $this->google_business_vertical,
282
  ],
283
- 'analytics' => [
284
  'universal' => [
285
  'property_id' => $this->options_obj->google->analytics->universal->property_id,
286
  ],
@@ -288,7 +338,10 @@ class Google extends Pixel
288
  'measurement_id' => $this->options_obj->google->analytics->ga4->measurement_id,
289
  ],
290
  'id_type' => $this->get_ga_id_type(),
291
- 'eec' => ( $this->options_obj->google->analytics->eec ? true : false ),
 
 
 
292
  ],
293
  ],
294
  ];
@@ -308,9 +361,9 @@ class Google extends Pixel
308
  if ( 'ads' === $channel ) {
309
 
310
  if ( $this->options_obj->google->ads->enhanced_conversions ) {
311
- return PHP_EOL . "\t\t\t" . "gtag('config', 'AW-" . $id . "', {'allow_enhanced_conversions':true});" . PHP_EOL;
312
  } else {
313
- return PHP_EOL . "\t\t\t" . "gtag('config', 'AW-" . $id . "');" . PHP_EOL;
314
  }
315
 
316
  } elseif ( 'ga_ua' === $channel ) {
@@ -328,7 +381,7 @@ class Google extends Pixel
328
  'wooptpm_ga_ua_parameters'
329
  );
330
  $ga_ua_parameters = apply_filters( 'wooptpm_ga_ua_parameters', $ga_ua_parameters, $id );
331
- return "\t" . "gtag('config', '" . $id . "', " . json_encode( $ga_ua_parameters ) . ");";
332
  } elseif ( 'ga_4' === $channel ) {
333
  $ga_4_parameters = [];
334
  if ( $this->options_obj->google->user_id && is_user_logged_in() ) {
@@ -339,9 +392,9 @@ class Google extends Pixel
339
  $ga_4_parameters = apply_filters( 'wooptpm_ga_4_parameters', $ga_4_parameters, $id );
340
 
341
  if ( empty($ga_4_parameters) ) {
342
- return "\t" . "gtag('config', '" . $id . "');";
343
  } else {
344
- return "\t" . "gtag('config', '" . $id . "', " . json_encode( $ga_4_parameters ) . ");";
345
  }
346
 
347
  }
4
 
5
  use WGACT\Classes\Admin\Environment_Check ;
6
  use WGACT\Classes\Pixels\Pixel ;
7
+ use WGACT\Classes\Pixels\Trait_Shop ;
8
 
9
  if ( !defined( 'ABSPATH' ) ) {
10
  exit;
14
  class Google extends Pixel
15
  {
16
  use Trait_Google ;
17
+ use Trait_Shop ;
18
  protected $google_ads_conversion_identifiers ;
19
  public function __construct( $options )
20
  {
35
  {
36
  $this->inject_data_layer_pixels();
37
  if ( $this->options_obj->google->optimize->container_id ) {
38
+ // echo '<script async ';
39
+ // echo 'src="https://www.googleoptimize.com/optimize.js?id=' . $this->options_obj->google->optimize->container_id . '"';
40
+ // echo ' data-wooptpm-src="https://www.googleoptimize.com/optimize.js?id=' . $this->options_obj->google->optimize->container_id . '"';
41
+ // echo $this->script_type_value('analytics');
42
+ // echo '></script>';
43
+ // echo PHP_EOL;
44
+ echo $this->get_formatted_script_tag( [
45
+ 'async' => true,
46
+ 'defer' => false,
47
+ 'src' => "https://www.googleoptimize.com/optimize.js?id=" . $this->options_obj->google->optimize->container_id,
48
+ 'cookie_category' => 'analytics',
49
+ 'pixel_name' => 'google-optimize',
50
+ 'inject_cfasync' => false,
51
+ ] ) . PHP_EOL ;
52
  }
53
+ // echo "\t\t" . '<script async src="https://www.googletagmanager.com/gtag/js?id=' . $this->get_gtag_id() . '"' . $this->explicit_consent_mode_type_value($this->get_cookie_category()) . '></script>';
54
+ // echo "\t\t";
55
+ // echo '<script async ';
56
+ // echo 'src="https://www.googletagmanager.com/gtag/js?id=' . $this->get_gtag_id() . '"';
57
+ // echo !$this->options_obj->google->consent_mode->active ? ' data-wooptpm-src="https://www.googletagmanager.com/gtag/js?id=' . $this->get_gtag_id() . '"' : '';
58
+ // echo !$this->options_obj->google->consent_mode->active ? $this->script_type_value($this->get_cookie_category()) : '';
59
+ // echo '></script>';
60
+ echo "\t\t" . $this->get_formatted_script_tag( [
61
+ 'async' => true,
62
+ 'defer' => false,
63
+ 'src' => "https://www.googletagmanager.com/gtag/js?id=" . $this->get_gtag_id(),
64
+ 'cookie_category' => $this->get_cookie_category(),
65
+ 'pixel_name' => 'google',
66
+ 'inject_cfasync' => false,
67
+ ] ) . PHP_EOL ;
68
  echo $this->get_modified_script_opening_tag() . PHP_EOL ;
69
  echo $this->get_google_init_js() ;
70
  foreach ( $this->google_ads_conversion_identifiers as $conversion_id => $conversion_label ) {
87
  if ( $this->is_google_ads_active() && $this->options_obj->google->ads->phone_conversion_number && $this->options_obj->google->ads->phone_conversion_label ) {
88
  $this->inject_phone_conversion_number_html__premium_only();
89
  }
90
+ // if ($this->options_obj->google->consent_mode->active && (new Environment_Check())->is_borlabs_cookie_active()) {
91
+ // echo $this->inject_borlabs_consent_mode_update();
92
+ // }
93
  // $this->inject_closing_script_tag();
94
  }
95
 
96
+ public function get_cookie_category() : string
97
+ {
98
+ $data = [];
99
+ if ( $this->options_obj->google->analytics->universal->property_id || $this->options_obj->google->analytics->ga4->measurement_id ) {
100
+ $data[] = 'analytics';
101
+ }
102
+ if ( $this->options_obj->google->ads->conversion_id ) {
103
+ $data[] = 'ads';
104
+ }
105
+ return implode( ',', $data );
106
+ }
107
+
108
  private function get_modified_script_opening_tag() : string
109
  {
110
+ return "\n\t\t" . $this->get_formatted_script_tag( [
111
+ 'async' => true,
112
+ 'defer' => false,
113
+ 'src' => '',
114
+ 'cookie_category' => 'analytics,ads',
115
+ 'pixel_name' => 'google',
116
+ 'inject_cfasync' => false,
117
+ 'cookiebot-cookieconsent' => $this->options_obj->shop->cookie_consent_mgmt->cookiebot->active || ( new Environment_Check() )->is_some_cmp_active(),
118
+ ] ) . PHP_EOL;
119
  }
120
 
121
  protected function get_google_init_js() : string
122
  {
123
+ return "\n \n function googleConfigConditionsMet(type){\n if (typeof wooptpm != 'undefined') {\n return wooptpm.googleConfigConditionsMet(type)\n } else {\n console.error('wootpm is not defined. That means you are deferring the script which you shouldn\\'t. wooptpm must be loaded before the inline scripts run. Visitor tracking will continue to work, but visitor cookie consent will be ignored.')\n return true\n }\n }\n \n function getVisitorConsentStatusAndUpdateGoogleConsentSettings(google_consent_settings){\n if (typeof wooptpm != 'undefined') {\n return wooptpm.getVisitorConsentStatusAndUpdateGoogleConsentSettings(google_consent_settings)\n } else {\n console.error('wootpm is not defined. That means you are deferring the script which you shouldn\\'t. wooptpm must be loaded before the inline scripts run. Visitor tracking will continue to work, but visitor cookie consent will be ignored.')\n return true\n }\n }\n \n window.dataLayer = window.dataLayer || [];\n\n window.gtag = function gtag() {\n dataLayer.push(arguments);\n }\n " . $this->consent_mode_gtag_html() . $this->linker_html() . "\n gtag('js', new Date());";
124
  }
125
 
126
  // https://developers.google.com/gtagjs/devguide/linker
152
  // needs to be output as text
153
  $url_passthrough = ( apply_filters( 'wooptpm_google_url_passthrough', true ) ? 'true' : 'false' );
154
  // needs to be output as text
155
+ return "\n let google_consent_settings = " . json_encode( $data ) . ";\n \n google_consent_settings = getVisitorConsentStatusAndUpdateGoogleConsentSettings(google_consent_settings);\n \n// console.log(google_consent_settings);\n \n gtag('consent', 'default', google_consent_settings);\n gtag('set', 'ads_data_redaction', " . $ads_data_redaction . ");\n gtag('set', 'url_passthrough', " . $url_passthrough . ");" . PHP_EOL;
156
  } else {
157
  return '';
158
  }
311
  return $this->options_obj->google->analytics->ga4->measurement_id;
312
  } elseif ( $this->options_obj->google->ads->conversion_id ) {
313
  return 'AW-' . $this->options_obj->google->ads->conversion_id;
314
+ } else {
315
+ return '';
316
  }
317
 
318
  }
321
  {
322
  $data = [
323
  'google' => [
324
+ 'ads' => [
325
  'dynamic_remarketing' => [
326
+ 'status' => (bool) $this->options_obj->google->ads->dynamic_remarketing,
327
  'id_type' => $this->get_dyn_r_id_type(),
328
  'send_events_with_parent_ids' => apply_filters( 'wooptpm_send_events_with_parent_ids', true ),
329
  ],
330
  'conversionIds' => $this->get_google_ads_conversion_ids(),
331
  'google_business_vertical' => $this->google_business_vertical,
332
  ],
333
+ 'analytics' => [
334
  'universal' => [
335
  'property_id' => $this->options_obj->google->analytics->universal->property_id,
336
  ],
338
  'measurement_id' => $this->options_obj->google->analytics->ga4->measurement_id,
339
  ],
340
  'id_type' => $this->get_ga_id_type(),
341
+ 'eec' => (bool) $this->options_obj->google->analytics->eec,
342
+ ],
343
+ 'consent_mode' => [
344
+ 'active' => (bool) $this->options_obj->google->consent_mode->active,
345
  ],
346
  ],
347
  ];
361
  if ( 'ads' === $channel ) {
362
 
363
  if ( $this->options_obj->google->ads->enhanced_conversions ) {
364
+ return PHP_EOL . "\t\t\t" . "if (googleConfigConditionsMet('ads')) gtag('config', 'AW-" . $id . "', {'allow_enhanced_conversions':true});" . PHP_EOL;
365
  } else {
366
+ return PHP_EOL . "\t\t\t" . "if (googleConfigConditionsMet('ads')) gtag('config', 'AW-" . $id . "');" . PHP_EOL;
367
  }
368
 
369
  } elseif ( 'ga_ua' === $channel ) {
381
  'wooptpm_ga_ua_parameters'
382
  );
383
  $ga_ua_parameters = apply_filters( 'wooptpm_ga_ua_parameters', $ga_ua_parameters, $id );
384
+ return "\t" . "if (googleConfigConditionsMet('analytics')) gtag('config', '" . $id . "', " . json_encode( $ga_ua_parameters ) . ");";
385
  } elseif ( 'ga_4' === $channel ) {
386
  $ga_4_parameters = [];
387
  if ( $this->options_obj->google->user_id && is_user_logged_in() ) {
392
  $ga_4_parameters = apply_filters( 'wooptpm_ga_4_parameters', $ga_4_parameters, $id );
393
 
394
  if ( empty($ga_4_parameters) ) {
395
+ return "\t" . "if (googleConfigConditionsMet('analytics')) gtag('config', '" . $id . "');";
396
  } else {
397
+ return "\t" . "if (googleConfigConditionsMet('analytics')) gtag('config', '" . $id . "', " . json_encode( $ga_4_parameters ) . ");";
398
  }
399
 
400
  }
classes/pixels/hotjar/class-hotjar-pixel.php CHANGED
@@ -3,6 +3,7 @@
3
  namespace WGACT\Classes\Pixels\Hotjar;
4
 
5
  use WGACT\Classes\Pixels\Pixel;
 
6
 
7
  if (!defined('ABSPATH')) {
8
  exit; // Exit if accessed directly
@@ -10,6 +11,8 @@ if (!defined('ABSPATH')) {
10
 
11
  class Hotjar_Pixel extends Pixel
12
  {
 
 
13
  public function __construct($options)
14
  {
15
  parent::__construct($options);
@@ -18,9 +21,18 @@ class Hotjar_Pixel extends Pixel
18
  public function inject_everywhere()
19
  {
20
  // @formatter:off
 
 
 
 
 
 
 
 
 
 
21
  ?>
22
 
23
- <script>
24
  (function(h,o,t,j,a,r){
25
  h.hj=h.hj||function(){(h.hj.q=h.hj.q||[]).push(arguments)};
26
  h._hjSettings={hjid:<?php echo $this->options_obj->hotjar->site_id ?>,hjsv:6};
3
  namespace WGACT\Classes\Pixels\Hotjar;
4
 
5
  use WGACT\Classes\Pixels\Pixel;
6
+ use WGACT\Classes\Pixels\Trait_Shop;
7
 
8
  if (!defined('ABSPATH')) {
9
  exit; // Exit if accessed directly
11
 
12
  class Hotjar_Pixel extends Pixel
13
  {
14
+ use Trait_Shop;
15
+
16
  public function __construct($options)
17
  {
18
  parent::__construct($options);
21
  public function inject_everywhere()
22
  {
23
  // @formatter:off
24
+
25
+ echo "\n\t\t" . $this->get_formatted_script_tag([
26
+ 'async' => false,
27
+ 'defer' => false,
28
+ 'src' => '',
29
+ 'cookie_category' => 'analytics',
30
+ 'pixel_name' => 'hotjar',
31
+ 'inject_cfasync' => false,
32
+
33
+ ]) . PHP_EOL;
34
  ?>
35
 
 
36
  (function(h,o,t,j,a,r){
37
  h.hj=h.hj||function(){(h.hj.q=h.hj.q||[]).push(arguments)};
38
  h._hjSettings={hjid:<?php echo $this->options_obj->hotjar->site_id ?>,hjsv:6};
classes/pixels/trait-product.php CHANGED
@@ -109,7 +109,8 @@ trait Trait_Product
109
  $dyn_r_ids = [
110
  'post_id' => (string)$product->get_id(),
111
  'sku' => (string)$product->get_sku() ? $product->get_sku() : $product->get_id(),
112
- 'gpf' => 'woocommerce_gpf_' . (string)$product->get_id(),
 
113
  ];
114
 
115
  // if you want to add a custom dyn_r_id for each product
@@ -184,8 +185,8 @@ trait Trait_Product
184
  if ($product->is_type('variation')) {
185
  $product_details['variant'] = $this->get_formatted_variant_text($product);
186
 
187
- $parent_id = $product->get_parent_id();
188
- $parent_product = wc_get_product($parent_id);
189
 
190
  $dyn_r_ids_parent = $this->get_dyn_r_ids($parent_product);
191
  $parent_product_id_compiled = $dyn_r_ids_parent[$this->get_dyn_r_id_type()];
@@ -214,6 +215,8 @@ trait Trait_Product
214
  $this->dyn_r_id_type = 'gpf';
215
  } elseif ($this->options_obj->google->ads->product_identifier == 2) {
216
  $this->dyn_r_id_type = 'sku';
 
 
217
  }
218
 
219
  // if you want to change the dyn_r_id type for Google programmatically
109
  $dyn_r_ids = [
110
  'post_id' => (string)$product->get_id(),
111
  'sku' => (string)$product->get_sku() ? $product->get_sku() : $product->get_id(),
112
+ 'gpf' => 'woocommerce_gpf_' . $product->get_id(),
113
+ 'gla' => 'gla_' . $product->get_id(),
114
  ];
115
 
116
  // if you want to add a custom dyn_r_id for each product
185
  if ($product->is_type('variation')) {
186
  $product_details['variant'] = $this->get_formatted_variant_text($product);
187
 
188
+ $parent_id = $product->get_parent_id();
189
+ $parent_product = wc_get_product($parent_id);
190
 
191
  $dyn_r_ids_parent = $this->get_dyn_r_ids($parent_product);
192
  $parent_product_id_compiled = $dyn_r_ids_parent[$this->get_dyn_r_id_type()];
215
  $this->dyn_r_id_type = 'gpf';
216
  } elseif ($this->options_obj->google->ads->product_identifier == 2) {
217
  $this->dyn_r_id_type = 'sku';
218
+ } elseif ($this->options_obj->google->ads->product_identifier == 3) {
219
+ $this->dyn_r_id_type = 'gla';
220
  }
221
 
222
  // if you want to change the dyn_r_id type for Google programmatically
classes/pixels/trait-shop.php CHANGED
@@ -2,131 +2,201 @@
2
 
3
  namespace WGACT\Classes\Pixels;
4
 
5
- use WC_Order;
6
 
7
- if (!defined('ABSPATH')) {
8
- exit; // Exit if accessed directly
 
9
  }
10
 
11
  trait Trait_Shop
12
  {
13
- protected function get_script_suffix(): string
14
  {
15
- return (defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG || isset($_GET['nominify']) ) ? '.js' : '.min.js';
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
16
  }
17
-
18
- protected function get_list_name_suffix(): string
 
 
 
 
 
 
 
 
 
 
 
 
19
  {
20
  $list_suffix = '';
21
-
22
- if (is_product_category()) {
23
-
24
- $category = get_queried_object();
25
  $list_suffix = ' | ' . $category->name;
26
- $list_suffix = $this->add_parent_category_name($category, $list_suffix);
27
- } else if (is_product_tag()) {
28
- $tag = get_queried_object();
29
- $list_suffix = ' | ' . $tag->name;
 
 
 
 
30
  }
31
-
32
  return $list_suffix;
33
  }
34
-
35
- protected function add_parent_category_name($category, $list_suffix)
36
  {
37
- if ($category->parent > 0) {
38
-
39
- $parent_category = get_term_by('id', $category->parent, 'product_cat');
40
- $list_suffix = ' | ' . $parent_category->name . $list_suffix;
41
- $list_suffix = $this->add_parent_category_name($parent_category, $list_suffix);
42
  }
43
-
44
  return $list_suffix;
45
  }
46
-
47
- protected function get_list_id_suffix(): string
48
  {
49
  $list_suffix = '';
50
-
51
- if (is_product_category()) {
52
- $category = get_queried_object();
53
  $list_suffix = '.' . $category->slug;
54
- $list_suffix = $this->add_parent_category_id($category, $list_suffix);
55
- } else if (is_product_tag()) {
56
- $tag = get_queried_object();
57
- $list_suffix = '.' . $tag->slug;
 
 
 
 
58
  }
59
-
60
  return $list_suffix;
61
  }
62
-
63
- protected function add_parent_category_id($category, $list_suffix)
64
  {
65
- if ($category->parent > 0) {
66
-
67
- $parent_category = get_term_by('id', $category->parent, 'product_cat');
68
- // error_log(print_r($parent_category, true));
69
  $list_suffix = '.' . $parent_category->slug . $list_suffix;
70
- $list_suffix = $this->add_parent_category_id($parent_category, $list_suffix);
71
  }
72
-
73
  return $list_suffix;
74
  }
75
-
76
  // https://stackoverflow.com/a/49616130/4688612
77
  protected function get_order_from_order_received_page()
78
  {
79
- if ($this->get_order_from_query_vars()) {
 
80
  return $this->get_order_from_query_vars();
81
- } else if ($this->get_order_with_url_order_key()) {
82
- return $this->get_order_with_url_order_key();
83
  } else {
84
- return false;
 
 
 
 
 
 
85
  }
 
86
  }
87
-
88
  protected function get_order_from_query_vars()
89
  {
90
- global $wp;
91
-
92
- $order_id = absint($wp->query_vars['order-received']);
93
-
94
- if ($order_id && $order_id != 0) {
95
- return new WC_Order($order_id);
96
  } else {
97
- wc_get_logger()->debug(
98
- 'WooCommerce couldn\'t retrieve the order ID from $wp->query_vars[\'order-received\']',
99
- ['source' => 'wooptpm']
100
- );
101
-
102
- wc_get_logger()->debug(
103
- print_r($wp->query_vars, true),
104
- ['source' => 'wooptpm']
105
- );
106
-
107
  return false;
108
  }
 
109
  }
110
-
111
  protected function get_order_with_url_order_key()
112
  {
113
- if (isset($_GET['key'])) {
 
114
  $order_key = $_GET['key'];
115
- return new WC_Order(wc_get_order_id_by_order_key($order_key));
116
  } else {
117
-
118
- wc_get_logger()->debug(
119
- 'WooCommerce couldn\'t retrieve the order ID from order key in the URL',
120
- ['source' => 'wooptpm']
121
- );
122
-
123
  $order_key = $_GET['key'] ?? '';
124
- wc_get_logger()->debug(
125
- 'URL order key: ' . $order_key,
126
- ['source' => 'wooptpm']
127
- );
128
-
129
  return false;
130
  }
 
131
  }
 
132
  }
2
 
3
  namespace WGACT\Classes\Pixels;
4
 
5
+ use WC_Order ;
6
 
7
+ if ( !defined( 'ABSPATH' ) ) {
8
+ exit;
9
+ // Exit if accessed directly
10
  }
11
 
12
  trait Trait_Shop
13
  {
14
+ protected function get_formatted_script_tag( $components ) : string
15
  {
16
+ // error_log(print_r($components, true));
17
+ $html = '<script ';
18
+
19
+ if ( $components['src'] ) {
20
+ // A script tag can't have both async and defer attributes,
21
+ // therefore fall back to a default if both are set.
22
+ // Otherwise, use the one that is set.
23
+
24
+ if ( $components['async'] && $components['defer'] ) {
25
+ $html .= 'async ';
26
+ } else {
27
+
28
+ if ( $components['async'] ) {
29
+ $html .= 'async ';
30
+ } else {
31
+
32
+ if ( $components['defer'] ) {
33
+ $html .= 'defer ';
34
+ } else {
35
+ $html .= '';
36
+ }
37
+
38
+ }
39
+
40
+ }
41
+
42
+ if ( !$this->options_obj->shop->cookie_consent_mgmt->explicit_consent ) {
43
+ $html .= 'src="' . $components['src'] . '" ';
44
+ }
45
+ // $html .= !$this->options_obj->google->consent_mode->active ? 'data-wooptpm-src="' . $components['src'] . '" ' : '';
46
+ $html .= 'data-wooptpm-src="' . $components['src'] . '" ';
47
+ }
48
+
49
+ // $html .= !$this->options_obj->google->consent_mode->active ? $this->script_type_value($components['cookie_category']) . ' ' : '';
50
+ $html .= $this->script_type_value( $components['cookie_category'] ) . ' ';
51
+ // $html .= 'data-wooptpm-pixel-name="' . $this->pixel_name . '" ';
52
+ $html .= 'data-wooptpm-pixel-name="' . $components['pixel_name'] . '" ';
53
+ if ( $components['inject_cfasync'] ) {
54
+ $html .= 'data-cfasync="false"';
55
+ }
56
+ if ( array_key_exists( 'cookiebot-cookieconsent', $components ) && $components['cookiebot-cookieconsent'] ) {
57
+ $html .= 'data-cookieconsent="ignore"';
58
+ }
59
+
60
+ if ( $components['src'] ) {
61
+ $html .= '></script>';
62
+ } else {
63
+ $html .= '>';
64
+ }
65
+
66
+ return $html;
67
  }
68
+
69
+ public function script_type_value( $cookie_category ) : string
70
+ {
71
+ $type = '';
72
+ $type = 'text/javascript';
73
+ return 'type="' . $type . '" data-wooptpm-cookie-category="' . $cookie_category . '"';
74
+ }
75
+
76
+ protected function get_script_suffix() : string
77
+ {
78
+ return ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG || isset( $_GET['nominify'] ) ? '.js' : '.min.js' );
79
+ }
80
+
81
+ protected function get_list_name_suffix() : string
82
  {
83
  $list_suffix = '';
84
+
85
+ if ( is_product_category() ) {
86
+ $category = get_queried_object();
 
87
  $list_suffix = ' | ' . $category->name;
88
+ $list_suffix = $this->add_parent_category_name( $category, $list_suffix );
89
+ } else {
90
+
91
+ if ( is_product_tag() ) {
92
+ $tag = get_queried_object();
93
+ $list_suffix = ' | ' . $tag->name;
94
+ }
95
+
96
  }
97
+
98
  return $list_suffix;
99
  }
100
+
101
+ protected function add_parent_category_name( $category, $list_suffix )
102
  {
103
+
104
+ if ( $category->parent > 0 ) {
105
+ $parent_category = get_term_by( 'id', $category->parent, 'product_cat' );
106
+ $list_suffix = ' | ' . $parent_category->name . $list_suffix;
107
+ $list_suffix = $this->add_parent_category_name( $parent_category, $list_suffix );
108
  }
109
+
110
  return $list_suffix;
111
  }
112
+
113
+ protected function get_list_id_suffix() : string
114
  {
115
  $list_suffix = '';
116
+
117
+ if ( is_product_category() ) {
118
+ $category = get_queried_object();
119
  $list_suffix = '.' . $category->slug;
120
+ $list_suffix = $this->add_parent_category_id( $category, $list_suffix );
121
+ } else {
122
+
123
+ if ( is_product_tag() ) {
124
+ $tag = get_queried_object();
125
+ $list_suffix = '.' . $tag->slug;
126
+ }
127
+
128
  }
129
+
130
  return $list_suffix;
131
  }
132
+
133
+ protected function add_parent_category_id( $category, $list_suffix )
134
  {
135
+
136
+ if ( $category->parent > 0 ) {
137
+ $parent_category = get_term_by( 'id', $category->parent, 'product_cat' );
138
+ // error_log(print_r($parent_category, true));
139
  $list_suffix = '.' . $parent_category->slug . $list_suffix;
140
+ $list_suffix = $this->add_parent_category_id( $parent_category, $list_suffix );
141
  }
142
+
143
  return $list_suffix;
144
  }
145
+
146
  // https://stackoverflow.com/a/49616130/4688612
147
  protected function get_order_from_order_received_page()
148
  {
149
+
150
+ if ( $this->get_order_from_query_vars() ) {
151
  return $this->get_order_from_query_vars();
 
 
152
  } else {
153
+
154
+ if ( $this->get_order_with_url_order_key() ) {
155
+ return $this->get_order_with_url_order_key();
156
+ } else {
157
+ return false;
158
+ }
159
+
160
  }
161
+
162
  }
163
+
164
  protected function get_order_from_query_vars()
165
  {
166
+ global $wp ;
167
+ $order_id = absint( $wp->query_vars['order-received'] );
168
+
169
+ if ( $order_id && $order_id != 0 && ($order = wc_get_order( $order_id )) ) {
170
+ return $order;
 
171
  } else {
172
+ wc_get_logger()->debug( 'WooCommerce couldn\'t retrieve the order ID from $wp->query_vars[\'order-received\']', [
173
+ 'source' => 'wooptpm',
174
+ ] );
175
+ wc_get_logger()->debug( print_r( $wp->query_vars, true ), [
176
+ 'source' => 'wooptpm',
177
+ ] );
 
 
 
 
178
  return false;
179
  }
180
+
181
  }
182
+
183
  protected function get_order_with_url_order_key()
184
  {
185
+
186
+ if ( isset( $_GET['key'] ) ) {
187
  $order_key = $_GET['key'];
188
+ return wc_get_order( wc_get_order_id_by_order_key( $order_key ) );
189
  } else {
190
+ wc_get_logger()->debug( 'WooCommerce couldn\'t retrieve the order ID from order key in the URL', [
191
+ 'source' => 'wooptpm',
192
+ ] );
 
 
 
193
  $order_key = $_GET['key'] ?? '';
194
+ wc_get_logger()->debug( 'URL order key: ' . $order_key, [
195
+ 'source' => 'wooptpm',
196
+ ] );
 
 
197
  return false;
198
  }
199
+
200
  }
201
+
202
  }
js/public/facebook.js CHANGED
@@ -22,7 +22,7 @@ varExists('jQuery').then(function () {
22
 
23
  wooptpm.getFbUserData = function () {
24
  // We need the first one for InitiateCheckout
25
- // where getting the the user_data from the browser is too slow
26
  // using wooptpm.getCookie(), so we cache the user_data earlier.
27
  // And we need the second one because the ViewContent hit happens too fast
28
  // after adding a variation to the cart because the function to cache
@@ -49,6 +49,9 @@ varExists('jQuery').then(function () {
49
  }
50
 
51
  wooptpm.fbViewContent = function (product) {
 
 
 
52
  let eventId = wooptpm.getRandomEventId();
53
 
54
  fbq("track", "ViewContent", {
@@ -87,6 +90,8 @@ varExists('jQuery').then(function () {
87
  // console.log(product);
88
  // console.log('value: ' + product.quantity * product.price);
89
 
 
 
90
  let eventId = wooptpm.getRandomEventId();
91
 
92
  // console.log('eventId: ' + eventId);
@@ -118,6 +123,8 @@ varExists('jQuery').then(function () {
118
 
119
  // console.log('firing facebook ads InitiateCheckout event');
120
 
 
 
121
  let eventId = wooptpm.getRandomEventId();
122
 
123
  fbq("track", "InitiateCheckout", {}, {
@@ -139,6 +146,8 @@ varExists('jQuery').then(function () {
139
  // console.log('firing facebook ads AddToWishlist event');
140
  // console.log(product);
141
 
 
 
142
  let eventId = wooptpm.getRandomEventId();
143
 
144
  fbq("track", "AddToWishlist", {
@@ -169,6 +178,8 @@ varExists('jQuery').then(function () {
169
  // console.log('firing facebook ads ViewContent event');
170
  // console.log(product);
171
 
 
 
172
  wooptpm.fbViewContent(product);
173
  });
174
  }
@@ -194,6 +205,8 @@ varExists('jQuery').then(function () {
194
 
195
  } else if (wooptpmDataLayer.shop.page_type === 'search') {
196
 
 
 
197
  let eventId = wooptpm.getRandomEventId();
198
 
199
  fbq("track", "Search", {}, {
22
 
23
  wooptpm.getFbUserData = function () {
24
  // We need the first one for InitiateCheckout
25
+ // where getting the user_data from the browser is too slow
26
  // using wooptpm.getCookie(), so we cache the user_data earlier.
27
  // And we need the second one because the ViewContent hit happens too fast
28
  // after adding a variation to the cart because the function to cache
49
  }
50
 
51
  wooptpm.fbViewContent = function (product) {
52
+
53
+ if(!window.fbq) return;
54
+
55
  let eventId = wooptpm.getRandomEventId();
56
 
57
  fbq("track", "ViewContent", {
90
  // console.log(product);
91
  // console.log('value: ' + product.quantity * product.price);
92
 
93
+ if(!window.fbq) return;
94
+
95
  let eventId = wooptpm.getRandomEventId();
96
 
97
  // console.log('eventId: ' + eventId);
123
 
124
  // console.log('firing facebook ads InitiateCheckout event');
125
 
126
+ if(!window.fbq) return;
127
+
128
  let eventId = wooptpm.getRandomEventId();
129
 
130
  fbq("track", "InitiateCheckout", {}, {
146
  // console.log('firing facebook ads AddToWishlist event');
147
  // console.log(product);
148
 
149
+ if(!window.fbq) return;
150
+
151
  let eventId = wooptpm.getRandomEventId();
152
 
153
  fbq("track", "AddToWishlist", {
178
  // console.log('firing facebook ads ViewContent event');
179
  // console.log(product);
180
 
181
+ if(!window.fbq) return;
182
+
183
  wooptpm.fbViewContent(product);
184
  });
185
  }
205
 
206
  } else if (wooptpmDataLayer.shop.page_type === 'search') {
207
 
208
+ if(!window.fbq) return;
209
+
210
  let eventId = wooptpm.getRandomEventId();
211
 
212
  fbq("track", "Search", {}, {
js/public/facebook.min.js CHANGED
@@ -1 +1 @@
1
- if(typeof varExists!=="function"){function varExists(varName){return new Promise(function(resolve,reject){(function waitForVar(){if(typeof window[varName]!=="undefined")return resolve();setTimeout(waitForVar,30)})()})}}varExists("jQuery").then(function(){(function(wooptpm,$,undefined){let fBUserData;wooptpm.getRandomEventId=function(){return(Math.random()+1).toString(36).substring(2)};wooptpm.getFbUserData=function(){if(fBUserData){return fBUserData}else{return wooptpm.getFbUserDataFromBrowser()}};wooptpm.setFbUserData=function(){fBUserData=wooptpm.getFbUserDataFromBrowser()};wooptpm.getFbUserDataFromBrowser=function(){return{fbp:wooptpm.getCookie("_fbp"),fbc:wooptpm.getCookie("_fbc"),client_user_agent:navigator.userAgent}};wooptpm.fbViewContent=function(product){let eventId=wooptpm.getRandomEventId();fbq("track","ViewContent",{content_type:"product",content_name:product.name,content_ids:product.dyn_r_ids[wooptpmDataLayer.pixels.facebook.dynamic_remarketing.id_type],currency:wooptpmDataLayer.shop.currency,value:product.price},{eventID:eventId});product["currency"]=wooptpmDataLayer.shop.currency;jQuery(document).trigger("wooptpmFbCapiEvent",{event_name:"ViewContent",event_id:eventId,user_data:wooptpm.getFbUserData(),product_data:product,product_id:product.dyn_r_ids[wooptpmDataLayer.pixels.facebook.dynamic_remarketing.id_type],event_source_url:window.location.href})}})(window.wooptpm=window.wooptpm||{},jQuery);jQuery(function(){if(wooptpm.objectExists(wooptpmDataLayer.pixels.facebook)){jQuery(document).on("wooptpmAddToCart",function(event,product){let eventId=wooptpm.getRandomEventId();fbq("track","AddToCart",{content_type:"product",content_name:product.name,content_ids:product.dyn_r_ids[wooptpmDataLayer.pixels.facebook.dynamic_remarketing.id_type],value:parseFloat(product.quantity*product.price),currency:product.currency},{eventID:eventId});product["currency"]=wooptpmDataLayer.shop.currency;jQuery(document).trigger("wooptpmFbCapiEvent",{event_name:"AddToCart",event_id:eventId,user_data:wooptpm.getFbUserData(),product_data:product,product_id:product.dyn_r_ids[wooptpmDataLayer.pixels.facebook.dynamic_remarketing.id_type],event_source_url:window.location.href})});jQuery(document).on("wooptpmBeginCheckout",function(event){let eventId=wooptpm.getRandomEventId();fbq("track","InitiateCheckout",{},{eventID:eventId});jQuery(document).trigger("wooptpmFbCapiEvent",{event_name:"InitiateCheckout",event_id:eventId,user_data:wooptpm.getFbUserData(),event_source_url:window.location.href})});jQuery(document).on("wooptpmAddToWishlist",function(event,product){let eventId=wooptpm.getRandomEventId();fbq("track","AddToWishlist",{content_type:"product",content_name:product.name,content_ids:product.dyn_r_ids[wooptpmDataLayer.pixels.facebook.dynamic_remarketing.id_type],value:parseFloat(product.quantity*product.price),currency:product.currency},{eventID:eventId});product["currency"]=wooptpmDataLayer.shop.currency;jQuery(document).trigger("wooptpmFbCapiEvent",{event_name:"AddToWishlist",event_id:eventId,user_data:wooptpm.getFbUserData(),product_data:product,product_id:product.dyn_r_ids[wooptpmDataLayer.pixels.facebook.dynamic_remarketing.id_type],event_source_url:window.location.href})});jQuery(document).on("wooptpmViewItem",function(event,product){wooptpm.fbViewContent(product)})}});jQuery(window).on("load",function(){if(wooptpm.objectExists(wooptpmDataLayer.pixels.facebook)){wooptpm.setFbUserData();wooptpmExists().then(function(){try{if(wooptpmDataLayer.shop.page_type==="product"&&wooptpmDataLayer.shop.product_type!=="variable"&&wooptpm.getMainProductIdFromProductPage()){let product=wooptpm.getProductDataForViewItemEvent(wooptpm.getMainProductIdFromProductPage());wooptpm.fbViewContent(product)}else if(wooptpmDataLayer.shop.page_type==="search"){let eventId=wooptpm.getRandomEventId();fbq("track","Search",{},{eventID:eventId});jQuery(document).trigger("wooptpmFbCapiEvent",{event_name:"Search",event_id:eventId,user_data:wooptpm.getFbUserData(),event_source_url:window.location.href})}}catch(e){console.log(e)}})}})}).catch(function(){console.log("object couldn't be loaded")});
1
+ if(typeof varExists!=="function"){function varExists(varName){return new Promise(function(resolve,reject){(function waitForVar(){if(typeof window[varName]!=="undefined")return resolve();setTimeout(waitForVar,30)})()})}}varExists("jQuery").then(function(){(function(wooptpm,$,undefined){let fBUserData;wooptpm.getRandomEventId=function(){return(Math.random()+1).toString(36).substring(2)};wooptpm.getFbUserData=function(){if(fBUserData){return fBUserData}else{return wooptpm.getFbUserDataFromBrowser()}};wooptpm.setFbUserData=function(){fBUserData=wooptpm.getFbUserDataFromBrowser()};wooptpm.getFbUserDataFromBrowser=function(){return{fbp:wooptpm.getCookie("_fbp"),fbc:wooptpm.getCookie("_fbc"),client_user_agent:navigator.userAgent}};wooptpm.fbViewContent=function(product){if(!window.fbq)return;let eventId=wooptpm.getRandomEventId();fbq("track","ViewContent",{content_type:"product",content_name:product.name,content_ids:product.dyn_r_ids[wooptpmDataLayer.pixels.facebook.dynamic_remarketing.id_type],currency:wooptpmDataLayer.shop.currency,value:product.price},{eventID:eventId});product["currency"]=wooptpmDataLayer.shop.currency;jQuery(document).trigger("wooptpmFbCapiEvent",{event_name:"ViewContent",event_id:eventId,user_data:wooptpm.getFbUserData(),product_data:product,product_id:product.dyn_r_ids[wooptpmDataLayer.pixels.facebook.dynamic_remarketing.id_type],event_source_url:window.location.href})}})(window.wooptpm=window.wooptpm||{},jQuery);jQuery(function(){if(wooptpm.objectExists(wooptpmDataLayer.pixels.facebook)){jQuery(document).on("wooptpmAddToCart",function(event,product){if(!window.fbq)return;let eventId=wooptpm.getRandomEventId();fbq("track","AddToCart",{content_type:"product",content_name:product.name,content_ids:product.dyn_r_ids[wooptpmDataLayer.pixels.facebook.dynamic_remarketing.id_type],value:parseFloat(product.quantity*product.price),currency:product.currency},{eventID:eventId});product["currency"]=wooptpmDataLayer.shop.currency;jQuery(document).trigger("wooptpmFbCapiEvent",{event_name:"AddToCart",event_id:eventId,user_data:wooptpm.getFbUserData(),product_data:product,product_id:product.dyn_r_ids[wooptpmDataLayer.pixels.facebook.dynamic_remarketing.id_type],event_source_url:window.location.href})});jQuery(document).on("wooptpmBeginCheckout",function(event){if(!window.fbq)return;let eventId=wooptpm.getRandomEventId();fbq("track","InitiateCheckout",{},{eventID:eventId});jQuery(document).trigger("wooptpmFbCapiEvent",{event_name:"InitiateCheckout",event_id:eventId,user_data:wooptpm.getFbUserData(),event_source_url:window.location.href})});jQuery(document).on("wooptpmAddToWishlist",function(event,product){if(!window.fbq)return;let eventId=wooptpm.getRandomEventId();fbq("track","AddToWishlist",{content_type:"product",content_name:product.name,content_ids:product.dyn_r_ids[wooptpmDataLayer.pixels.facebook.dynamic_remarketing.id_type],value:parseFloat(product.quantity*product.price),currency:product.currency},{eventID:eventId});product["currency"]=wooptpmDataLayer.shop.currency;jQuery(document).trigger("wooptpmFbCapiEvent",{event_name:"AddToWishlist",event_id:eventId,user_data:wooptpm.getFbUserData(),product_data:product,product_id:product.dyn_r_ids[wooptpmDataLayer.pixels.facebook.dynamic_remarketing.id_type],event_source_url:window.location.href})});jQuery(document).on("wooptpmViewItem",function(event,product){if(!window.fbq)return;wooptpm.fbViewContent(product)})}});jQuery(window).on("load",function(){if(wooptpm.objectExists(wooptpmDataLayer.pixels.facebook)){wooptpm.setFbUserData();wooptpmExists().then(function(){try{if(wooptpmDataLayer.shop.page_type==="product"&&wooptpmDataLayer.shop.product_type!=="variable"&&wooptpm.getMainProductIdFromProductPage()){let product=wooptpm.getProductDataForViewItemEvent(wooptpm.getMainProductIdFromProductPage());wooptpm.fbViewContent(product)}else if(wooptpmDataLayer.shop.page_type==="search"){if(!window.fbq)return;let eventId=wooptpm.getRandomEventId();fbq("track","Search",{},{eventID:eventId});jQuery(document).trigger("wooptpmFbCapiEvent",{event_name:"Search",event_id:eventId,user_data:wooptpm.getFbUserData(),event_source_url:window.location.href})}}catch(e){console.log(e)}})}})}).catch(function(){console.log("object couldn't be loaded")});
js/public/google-ads.js CHANGED
@@ -32,7 +32,7 @@ varExists('jQuery').then(function () {
32
 
33
  // console.log('send to: ' + wooptpmDataLayer.pixels.google.ads.conversionIds);
34
 
35
- gtag('event', 'view_item_list', {
36
  send_to: wooptpmDataLayer.pixels.google.ads.conversionIds,
37
  items : [{
38
  id : product.dyn_r_ids[wooptpmDataLayer.pixels.google.ads.dynamic_remarketing.id_type],
32
 
33
  // console.log('send to: ' + wooptpmDataLayer.pixels.google.ads.conversionIds);
34
 
35
+ if (googleConfigConditionsMet('ads')) gtag('event', 'view_item_list', {
36
  send_to: wooptpmDataLayer.pixels.google.ads.conversionIds,
37
  items : [{
38
  id : product.dyn_r_ids[wooptpmDataLayer.pixels.google.ads.dynamic_remarketing.id_type],
js/public/google-ads.min.js CHANGED
@@ -1 +1 @@
1
- if(typeof varExists!=="function"){varExists=function(varName){return new Promise(function(resolve,reject){(function waitForJQuery(){if(typeof window[varName]!=="undefined")return resolve();setTimeout(waitForJQuery,30)})()})}}varExists("jQuery").then(function(){jQuery(function(){if(wooptpmDataLayer.pixels.google.ads.dynamic_remarketing.status){jQuery(document).on("wooptpmViewItemList",function(event,product){if(wooptpmDataLayer.general.variationsOutput&&product.isVariable&&wooptpmDataLayer.pixels.google.ads.dynamic_remarketing.send_events_with_parent_ids===false)return;if(!product)return;gtag("event","view_item_list",{send_to:wooptpmDataLayer.pixels.google.ads.conversionIds,items:[{id:product.dyn_r_ids[wooptpmDataLayer.pixels.google.ads.dynamic_remarketing.id_type],google_business_vertical:wooptpmDataLayer.pixels.google.ads.google_business_vertical}]})});jQuery(document).on("wooptpmAddToCart",function(event,product){gtag("event","add_to_cart",{send_to:wooptpmDataLayer.pixels.google.ads.conversionIds,value:product.quantity*product.price,items:[{id:product.dyn_r_ids[wooptpmDataLayer.pixels.google.ads.dynamic_remarketing.id_type],quantity:product.quantity,price:product.price,google_business_vertical:wooptpmDataLayer.pixels.google.ads.google_business_vertical}]})});jQuery(document).on("wooptpmViewItem",function(event,product){gtag("event","view_item",{send_to:wooptpmDataLayer.pixels.google.ads.conversionIds,value:product.quantity*product.price,items:[{id:product.dyn_r_ids[wooptpmDataLayer.pixels.google.ads.dynamic_remarketing.id_type],quantity:1,price:product.price,google_business_vertical:wooptpmDataLayer.pixels.google.ads.google_business_vertical}]})})}});jQuery(window).on("load",function(){wooptpmExists().then(function(){try{if(wooptpmDataLayer.shop.page_type==="product"&&wooptpmDataLayer.shop.product_type!=="variable"&&wooptpm.getMainProductIdFromProductPage()){let product=wooptpm.getProductDataForViewItemEvent(wooptpm.getMainProductIdFromProductPage());gtag("event","view_item",{send_to:wooptpmDataLayer.pixels.google.ads.conversionIds,value:1*product.price,items:[{id:product.dyn_r_ids[wooptpmDataLayer.pixels.google.ads.dynamic_remarketing.id_type],google_business_vertical:wooptpmDataLayer.pixels.google.ads.google_business_vertical}]})}else if(wooptpmDataLayer.shop.page_type==="search"){let products=[];for(const[key,product]of Object.entries(wooptpmDataLayer.products)){if(wooptpmDataLayer.general.variationsOutput&&product.isVariable&&wooptpmDataLayer.pixels.google.ads.dynamic_remarketing.send_events_with_parent_ids===false)return;products.push({id:product.dyn_r_ids[wooptpmDataLayer.pixels.google.ads.dynamic_remarketing.id_type],google_business_vertical:wooptpmDataLayer.pixels.google.ads.google_business_vertical})}gtag("event","view_search_results",{send_to:wooptpmDataLayer.pixels.google.ads.conversionIds,items:products})}}catch(e){console.log(e)}})})}).catch(function(){console.log("object couldn't be loaded")});
1
+ if(typeof varExists!=="function"){varExists=function(varName){return new Promise(function(resolve,reject){(function waitForJQuery(){if(typeof window[varName]!=="undefined")return resolve();setTimeout(waitForJQuery,30)})()})}}varExists("jQuery").then(function(){jQuery(function(){if(wooptpmDataLayer.pixels.google.ads.dynamic_remarketing.status){jQuery(document).on("wooptpmViewItemList",function(event,product){if(wooptpmDataLayer.general.variationsOutput&&product.isVariable&&wooptpmDataLayer.pixels.google.ads.dynamic_remarketing.send_events_with_parent_ids===false)return;if(!product)return;if(googleConfigConditionsMet("ads"))gtag("event","view_item_list",{send_to:wooptpmDataLayer.pixels.google.ads.conversionIds,items:[{id:product.dyn_r_ids[wooptpmDataLayer.pixels.google.ads.dynamic_remarketing.id_type],google_business_vertical:wooptpmDataLayer.pixels.google.ads.google_business_vertical}]})});jQuery(document).on("wooptpmAddToCart",function(event,product){gtag("event","add_to_cart",{send_to:wooptpmDataLayer.pixels.google.ads.conversionIds,value:product.quantity*product.price,items:[{id:product.dyn_r_ids[wooptpmDataLayer.pixels.google.ads.dynamic_remarketing.id_type],quantity:product.quantity,price:product.price,google_business_vertical:wooptpmDataLayer.pixels.google.ads.google_business_vertical}]})});jQuery(document).on("wooptpmViewItem",function(event,product){gtag("event","view_item",{send_to:wooptpmDataLayer.pixels.google.ads.conversionIds,value:product.quantity*product.price,items:[{id:product.dyn_r_ids[wooptpmDataLayer.pixels.google.ads.dynamic_remarketing.id_type],quantity:1,price:product.price,google_business_vertical:wooptpmDataLayer.pixels.google.ads.google_business_vertical}]})})}});jQuery(window).on("load",function(){wooptpmExists().then(function(){try{if(wooptpmDataLayer.shop.page_type==="product"&&wooptpmDataLayer.shop.product_type!=="variable"&&wooptpm.getMainProductIdFromProductPage()){let product=wooptpm.getProductDataForViewItemEvent(wooptpm.getMainProductIdFromProductPage());gtag("event","view_item",{send_to:wooptpmDataLayer.pixels.google.ads.conversionIds,value:1*product.price,items:[{id:product.dyn_r_ids[wooptpmDataLayer.pixels.google.ads.dynamic_remarketing.id_type],google_business_vertical:wooptpmDataLayer.pixels.google.ads.google_business_vertical}]})}else if(wooptpmDataLayer.shop.page_type==="search"){let products=[];for(const[key,product]of Object.entries(wooptpmDataLayer.products)){if(wooptpmDataLayer.general.variationsOutput&&product.isVariable&&wooptpmDataLayer.pixels.google.ads.dynamic_remarketing.send_events_with_parent_ids===false)return;products.push({id:product.dyn_r_ids[wooptpmDataLayer.pixels.google.ads.dynamic_remarketing.id_type],google_business_vertical:wooptpmDataLayer.pixels.google.ads.google_business_vertical})}gtag("event","view_search_results",{send_to:wooptpmDataLayer.pixels.google.ads.conversionIds,items:products})}}catch(e){console.log(e)}})})}).catch(function(){console.log("object couldn't be loaded")});
js/public/wooptpm.js CHANGED
@@ -11,8 +11,6 @@ if (typeof varExists !== 'function') {
11
 
12
  varExists('jQuery').then(function () {
13
 
14
- // console.log('jq loaded');
15
-
16
  (function (wooptpm, $, undefined) {
17
 
18
  const wgactDeduper = {
@@ -28,6 +26,7 @@ varExists('jQuery').then(function () {
28
  restFailsThreshold : 10,
29
  }
30
 
 
31
  // wooptpm.checkIfCookiesAvailable = function () {
32
  //
33
  // // read the cookie if previously set, if it is return true, otherwise continue
@@ -137,7 +136,7 @@ varExists('jQuery').then(function () {
137
 
138
  let ids = [];
139
  if (checkCookie()) {
140
- ids = JSON.parse(getCookie(wgactDeduper.keyName));
141
  }
142
 
143
  if (!ids.includes(orderId)) {
@@ -165,23 +164,8 @@ varExists('jQuery').then(function () {
165
  }
166
  }
167
 
168
- function getCookie(cname) {
169
- let name = cname + '=';
170
- let ca = document.cookie.split(';');
171
- for (let i = 0; i < ca.length; i++) {
172
- let c = ca[i];
173
- while (c.charAt(0) === ' ') {
174
- c = c.substring(1);
175
- }
176
- if (c.indexOf(name) === 0) {
177
- return c.substring(name.length, c.length);
178
- }
179
- }
180
- return "";
181
- }
182
-
183
  function checkCookie() {
184
- let key = getCookie(wgactDeduper.keyName);
185
  return key !== '';
186
  }
187
 
@@ -193,7 +177,7 @@ varExists('jQuery').then(function () {
193
  if (!window.Storage) {
194
 
195
  if (checkCookie()) {
196
- let ids = JSON.parse(getCookie(wgactDeduper.keyName));
197
  return ids.includes(orderId);
198
  } else {
199
  return false;
@@ -319,7 +303,7 @@ varExists('jQuery').then(function () {
319
 
320
  let product = wooptpm.getProductDetailsFormattedForEvent(productId, quantity);
321
 
322
- // console.log(data);
323
 
324
  jQuery(document).trigger('wooptpmAddToCart', product);
325
 
@@ -528,7 +512,7 @@ varExists('jQuery').then(function () {
528
  }
529
  wooptpm.getMainProductIdFromProductPage = function () {
530
  try {
531
- if (['simple', 'variable', 'grouped', 'composite'].indexOf(wooptpmDataLayer.shop.product_type) >= 0) {
532
  return jQuery('.wooptpmProductId:first').data('id');
533
  } else {
534
  return false;
@@ -876,11 +860,442 @@ varExists('jQuery').then(function () {
876
  };
877
  }
878
 
879
- // wooptpm['load'] = {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
880
  // base: true
881
  // };
882
 
883
- window['wooptpmLoaded'] = {};
884
 
885
  // return {
886
  // writeOrderIdToStorage : writeOrderIdToStorage,
@@ -912,7 +1327,7 @@ varExists('jQuery').then(function () {
912
  // remove_from_cart event
913
  // body.on('click', '.remove_from_cart_button, .remove', function (e) {
914
  jQuery(document).on('click', '.remove_from_cart_button, .remove', function (e) {
915
- // jQuery('.remove_from_cart_button, .remove').on('click', function (e) {
916
 
917
  try {
918
  // console.log('remove_from_cart: ' + jQuery(this).data('product_id'));
@@ -931,7 +1346,7 @@ varExists('jQuery').then(function () {
931
  // add_to_cart event
932
  // body.on('click', '.add_to_cart_button:not(.product_type_variable), .ajax_add_to_cart, .single_add_to_cart_button', function (e) {
933
  jQuery(document).on('click', '.add_to_cart_button:not(.product_type_variable), .ajax_add_to_cart, .single_add_to_cart_button', function (e) {
934
- // 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) {
935
 
936
  try {
937
  // console.log('add_to_cart');
@@ -994,6 +1409,20 @@ varExists('jQuery').then(function () {
994
 
995
  wooptpm.addProductToCart(productId, quantity);
996
  });
 
 
 
 
 
 
 
 
 
 
 
 
 
 
997
  }
998
  }
999
  } else {
@@ -1036,7 +1465,7 @@ varExists('jQuery').then(function () {
1036
  // trigger the add to cart event
1037
  // body.one('click', 'a:not(.add_to_cart_button, .ajax_add_to_cart, .single_add_to_cart_button)', function (event) {
1038
  jQuery(document).one('click', 'a:not(.add_to_cart_button, .ajax_add_to_cart, .single_add_to_cart_button)', function (event) {
1039
- // jQuery('a:not(.add_to_cart_button, .ajax_add_to_cart, .single_add_to_cart_button)').one('click', function (event) {
1040
 
1041
  try {
1042
  if (jQuery(event.target).closest('a').attr('href')) {
@@ -1059,7 +1488,7 @@ varExists('jQuery').then(function () {
1059
  // jQuery(document).on('click', '.woocommerce-LoopProduct-link, .wc-block-grid__product, .product-small.box', function (e) {
1060
  // body.on('click', '.woocommerce-LoopProduct-link, .wc-block-grid__product, .product, .product-small, .type-product', function (e) {
1061
  jQuery(document).on('click', '.woocommerce-LoopProduct-link, .wc-block-grid__product, .product, .product-small, .type-product', function (e) {
1062
- // jQuery('.woocommerce-LoopProduct-link, .wc-block-grid__product, .product, .product-small, .type-product').on('click', function (e) {
1063
 
1064
  try {
1065
 
@@ -1106,7 +1535,7 @@ varExists('jQuery').then(function () {
1106
  // begin_checkout event
1107
  // body.one('click', '.checkout-button, .cart-checkout-button, .button.checkout', function (e) {
1108
  jQuery(document).one('click', '.checkout-button, .cart-checkout-button, .button.checkout', function (e) {
1109
- // jQuery('.checkout-button, .cart-checkout-button, .button.checkout').one('click', function (e) {
1110
  // console.log('begin_checkout');
1111
 
1112
  jQuery(document).trigger('wooptpmBeginCheckout');
@@ -1118,7 +1547,7 @@ varExists('jQuery').then(function () {
1118
  // track checkout option event: entered valid billing email
1119
  // body.on('input', '#billing_email', function () {
1120
  jQuery(document).on('input', '#billing_email', function () {
1121
- // jQuery('#billing_email').on('input', function () {
1122
 
1123
  if (wooptpm.isEmail(jQuery(this).val())) {
1124
  // wooptpm.fireCheckoutOption(2);
@@ -1132,7 +1561,7 @@ varExists('jQuery').then(function () {
1132
 
1133
  // body.on('click', '.wc_payment_methods', function () {
1134
  jQuery(document).on('click', '.wc_payment_methods', function () {
1135
- // jQuery('.wc_payment_methods').on('click', function () {
1136
 
1137
  if (paymentMethodSelected === false) {
1138
  wooptpm.fireCheckoutProgress(3);
@@ -1162,7 +1591,7 @@ varExists('jQuery').then(function () {
1162
  // update cart event
1163
  // body.on('click', "[name='update_cart']", function (e) {
1164
  jQuery(document).on('click', "[name='update_cart']", function (e) {
1165
- // jQuery("[name='update_cart']").on('click', function (e) {
1166
 
1167
  try {
1168
  jQuery('.cart_item').each(function () {
@@ -1219,7 +1648,7 @@ varExists('jQuery').then(function () {
1219
  // add_to_wishlist
1220
  // body.on('click', '.add_to_wishlist, .wl-add-to', function () {
1221
  jQuery(document).on('click', '.add_to_wishlist, .wl-add-to', function () {
1222
- // jQuery('.add_to_wishlist, .wl-add-to').on('click', function () {
1223
 
1224
  try {
1225
  // console.log('add_to_wishlist');
@@ -1247,9 +1676,9 @@ varExists('jQuery').then(function () {
1247
  })
1248
 
1249
  // body.on('updated_cart_totals', function () {
1250
- jQuery(document).on('updated_cart_totals', function () {
1251
 
1252
- jQuery(document).trigger('wooptpmViewCart');
1253
  });
1254
  });
1255
 
@@ -1320,6 +1749,7 @@ varExists('jQuery').then(function () {
1320
  }
1321
  })
1322
 
1323
- }).catch(function () {
1324
- console.log('object couldn\'t be loaded');
 
1325
  })
11
 
12
  varExists('jQuery').then(function () {
13
 
 
 
14
  (function (wooptpm, $, undefined) {
15
 
16
  const wgactDeduper = {
26
  restFailsThreshold : 10,
27
  }
28
 
29
+
30
  // wooptpm.checkIfCookiesAvailable = function () {
31
  //
32
  // // read the cookie if previously set, if it is return true, otherwise continue
136
 
137
  let ids = [];
138
  if (checkCookie()) {
139
+ ids = JSON.parse(wooptpm.getCookie(wgactDeduper.keyName));
140
  }
141
 
142
  if (!ids.includes(orderId)) {
164
  }
165
  }
166
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
167
  function checkCookie() {
168
+ let key = wooptpm.getCookie(wgactDeduper.keyName);
169
  return key !== '';
170
  }
171
 
177
  if (!window.Storage) {
178
 
179
  if (checkCookie()) {
180
+ let ids = JSON.parse(wooptpm.getCookie(wgactDeduper.keyName));
181
  return ids.includes(orderId);
182
  } else {
183
  return false;
303
 
304
  let product = wooptpm.getProductDetailsFormattedForEvent(productId, quantity);
305
 
306
+ // console.log(productId);
307
 
308
  jQuery(document).trigger('wooptpmAddToCart', product);
309
 
512
  }
513
  wooptpm.getMainProductIdFromProductPage = function () {
514
  try {
515
+ if (['simple', 'variable', 'grouped', 'composite', 'bundle'].indexOf(wooptpmDataLayer.shop.product_type) >= 0) {
516
  return jQuery('.wooptpmProductId:first').data('id');
517
  } else {
518
  return false;
860
  };
861
  }
862
 
863
+ /*
864
+ * Handle Cookie Management Platforms
865
+ * */
866
+
867
+ let getComplianzCookies = function () {
868
+
869
+ let cmplz_statistics = wooptpm.getCookie('cmplz_statistics')
870
+ let cmplz_marketing = wooptpm.getCookie('cmplz_marketing')
871
+ let cmplz_consent_status = wooptpm.getCookie('cmplz_consent_status')
872
+
873
+ if (cmplz_consent_status) {
874
+ return {
875
+ analytics : cmplz_statistics === 'allow',
876
+ ads : cmplz_marketing === 'allow',
877
+ visitorHasChosen: true
878
+ }
879
+ } else {
880
+ return false
881
+ }
882
+ }
883
+
884
+ let getCookieLawInfoCookies = function () {
885
+
886
+ let analyticsCookie = wooptpm.getCookie('cookielawinfo-checkbox-analytics')
887
+ let adsCookie = wooptpm.getCookie('cookielawinfo-checkbox-advertisement')
888
+ let visitorHasChosen = wooptpm.getCookie('CookieLawInfoConsent')
889
+
890
+ if (analyticsCookie || adsCookie) {
891
+
892
+ return {
893
+ analytics : analyticsCookie === 'yes',
894
+ ads : adsCookie === 'yes',
895
+ visitorHasChosen: !!visitorHasChosen,
896
+ }
897
+ } else {
898
+ return false
899
+ }
900
+ }
901
+
902
+
903
+ let
904
+ wooptpmConsentValues = {}
905
+ wooptpmConsentValues.categories = {}
906
+ wooptpmConsentValues.pixels = []
907
+ wooptpmConsentValues.mode = 'category'
908
+ wooptpmConsentValues.visitorHasChosen = false
909
+
910
+ wooptpm.getConsentValues = function () {
911
+ return wooptpmConsentValues
912
+ }
913
+
914
+ wooptpm.updateConsentCookieValues = function (explicitConsent = false) {
915
+
916
+ // ad_storage
917
+ // analytics_storage
918
+ // functionality_storage
919
+ // personalization_storage
920
+ // security_storage
921
+
922
+ // console.log('exp cons: ' + explicitConsent)
923
+
924
+ let cookie
925
+
926
+ if (cookie = wooptpm.getCookie('CookieConsent')) {
927
+ // Cookiebot
928
+ // https://wordpress.org/plugins/cookiebot/
929
+ cookie = decodeURI(cookie)
930
+
931
+ // console.log(cookie.indexOf('statistics:true'))
932
+ // console.log(cookie.indexOf('marketing:true'))
933
+
934
+ wooptpmConsentValues.categories.analytics = cookie.indexOf('statistics:true') >= 0
935
+ wooptpmConsentValues.categories.ads = cookie.indexOf('marketing:true') >= 0
936
+ wooptpmConsentValues.visitorHasChosen = true
937
+
938
+ } else if (cookie = wooptpm.getCookie('CookieScriptConsent')) {
939
+ // Cookie Script
940
+ // https://wordpress.org/plugins/cookie-script-com/
941
+
942
+ cookie = JSON.parse(cookie)
943
+
944
+ // console.log(cookie)
945
+ // console.log(cookie.action)
946
+ // console.log('cat length: ' + cookie.categories.length)
947
+ // console.log(cookie.categories.indexOf('performance'))
948
+
949
+ if (cookie.action === 'reject') {
950
+ wooptpmConsentValues.categories.analytics = false
951
+ wooptpmConsentValues.categories.ads = false
952
+ } else if (cookie.categories.length === 2) {
953
+ wooptpmConsentValues.categories.analytics = true
954
+ wooptpmConsentValues.categories.ads = true
955
+ } else {
956
+ wooptpmConsentValues.categories.analytics = cookie.categories.indexOf('performance') >= 0
957
+ wooptpmConsentValues.categories.ads = cookie.categories.indexOf('targeting') >= 0
958
+ }
959
+
960
+ wooptpmConsentValues.visitorHasChosen = true
961
+
962
+ // console.log(wooptpmConsentValues)
963
+
964
+ } else if (cookie = wooptpm.getCookie('borlabs-cookie')) {
965
+ // Borlabs Cookie
966
+ // https://borlabs.io/borlabs-cookie/
967
+
968
+ cookie = decodeURI(cookie)
969
+ cookie = JSON.parse(cookie)
970
+
971
+ wooptpmConsentValues.categories.analytics = !!cookie?.consents?.statistics
972
+ wooptpmConsentValues.categories.ads = !!cookie?.consents?.marketing
973
+ wooptpmConsentValues.visitorHasChosen = true
974
+ wooptpmConsentValues.pixels = [...cookie?.consents?.statistics || [], ...cookie?.consents?.marketing || []]
975
+ wooptpmConsentValues.mode = 'pixel'
976
+
977
+ } else if (cookie = getComplianzCookies()) {
978
+ // Complianz Cookie
979
+ // https://wordpress.org/plugins/complianz-gdpr/
980
+
981
+ wooptpmConsentValues.categories.analytics = cookie.analytics === true
982
+ wooptpmConsentValues.categories.ads = cookie.ads === true
983
+ wooptpmConsentValues.visitorHasChosen = cookie.visitorHasChosen
984
+
985
+ } else if (cookie = wooptpm.getCookie('cookie_notice_accepted')) {
986
+ // Cookie Compliance (free version)
987
+ // https://wordpress.org/plugins/cookie-notice/
988
+
989
+ wooptpmConsentValues.categories.analytics = true
990
+ wooptpmConsentValues.categories.ads = true
991
+ wooptpmConsentValues.visitorHasChosen = true
992
+
993
+ } else if (cookie = wooptpm.getCookie('hu-consent')) {
994
+ // Cookie Compliance (pro version)
995
+ // https://wordpress.org/plugins/cookie-notice/
996
+
997
+ cookie = JSON.parse(cookie)
998
+
999
+ wooptpmConsentValues.categories.analytics = !!cookie.categories['3']
1000
+ wooptpmConsentValues.categories.ads = !!cookie.categories['4']
1001
+ wooptpmConsentValues.visitorHasChosen = true
1002
+
1003
+ } else if (cookie = getCookieLawInfoCookies()) {
1004
+ // CookieYes, GDPR Cookie Consent (Cookie Law Info)
1005
+ // https://wordpress.org/plugins/cookie-law-info/
1006
+
1007
+ wooptpmConsentValues.categories.analytics = cookie.analytics === true
1008
+ wooptpmConsentValues.categories.ads = cookie.ads === true
1009
+ wooptpmConsentValues.visitorHasChosen = cookie.visitorHasChosen === true
1010
+
1011
+ } else if (cookie = wooptpm.getCookie('moove_gdpr_popup')) {
1012
+ // GDPR Cookie Compliance Plugin by Moove Agency
1013
+ // https://wordpress.org/plugins/gdpr-cookie-compliance/
1014
+ // TODO write documentation on how to set up the plugin in order for this to work properly
1015
+
1016
+ cookie = JSON.parse(cookie)
1017
+ // console.log('moove cookie thirdparty: ' + cookie.thirdparty)
1018
+ // console.log('moove cookie advanced: ' + cookie.advanced)
1019
+
1020
+ wooptpmConsentValues.categories.analytics = cookie.thirdparty === '1'
1021
+ wooptpmConsentValues.categories.ads = cookie.advanced === '1'
1022
+ wooptpmConsentValues.visitorHasChosen = true
1023
+
1024
+ // console.log(wooptpmConsentValues)
1025
+
1026
+ } else {
1027
+ // consentValues.categories.analytics = true
1028
+ // consentValues.categories.ads = true
1029
+
1030
+ wooptpmConsentValues.categories.analytics = !explicitConsent
1031
+ wooptpmConsentValues.categories.ads = !explicitConsent
1032
+ }
1033
+ }
1034
+
1035
+ wooptpm.updateConsentCookieValues();
1036
+
1037
+ wooptpm.setConsentDefaultValuesToExplicit = function () {
1038
+ wooptpmConsentValues.categories = {
1039
+ analytics: false,
1040
+ ads : false,
1041
+ }
1042
+ }
1043
+
1044
+ /*
1045
+ * Runs through each script in <head> and blocks / unblocks it according to the plugin settings
1046
+ * and user consent.
1047
+ */
1048
+
1049
+ // https://stackoverflow.com/q/65453565/4688612
1050
+ wooptpm.scriptTagObserver = new MutationObserver((mutations) => {
1051
+ mutations.forEach(({addedNodes}) => {
1052
+ [...addedNodes]
1053
+ .forEach(node => {
1054
+
1055
+ if ($(node).data('wooptpm-cookie-category')) {
1056
+
1057
+ // console.log(node)
1058
+
1059
+ // If the pixel category has been approved > unblock
1060
+ // If the pixel belongs to more than one category, then unblock if one of the categories has been approved
1061
+ // If no category has been approved, but the Google Consent Mode is active, then only unblock the Google scripts
1062
+
1063
+ if (wooptpm.shouldScriptBeActive(node)) {
1064
+ wooptpm.unblockScript(node)
1065
+ } else {
1066
+ wooptpm.blockScript(node)
1067
+ }
1068
+ }
1069
+ });
1070
+ });
1071
+ })
1072
+
1073
+ wooptpm.scriptTagObserver.observe(document.head, {childList: true, subtree: true});
1074
+ window.addEventListener('DOMContentLoaded', () => wooptpm.scriptTagObserver.disconnect());
1075
+
1076
+ wooptpm.shouldScriptBeActive = function (node) {
1077
+
1078
+ if (
1079
+ wooptpmDataLayer.shop.cookie_consent_mgmt.explicit_consent ||
1080
+ wooptpmConsentValues.visitorHasChosen
1081
+ ) {
1082
+
1083
+ if (wooptpmConsentValues.mode === 'category' && $(node).data('wooptpm-cookie-category').split(',').some(element => wooptpmConsentValues.categories[element])) {
1084
+ return true
1085
+ } else if (wooptpmConsentValues.mode === 'pixel' && wooptpmConsentValues.pixels.includes($(node).data('wooptpm-pixel-name'))) {
1086
+ return true
1087
+ } else if (wooptpmConsentValues.mode === 'pixel' && $(node).data('wooptpm-pixel-name') === 'google' && ['google-analytics', 'google-ads'].some(element => wooptpmConsentValues.pixels.includes(element))) {
1088
+ return true
1089
+ } else if (wooptpmDataLayer?.pixels?.google?.consent_mode?.active && $(node).data('wooptpm-pixel-name') === 'google') {
1090
+ return true
1091
+ } else {
1092
+ return false
1093
+ }
1094
+ } else {
1095
+ return true
1096
+ }
1097
+ }
1098
+
1099
+
1100
+ wooptpm.unblockScript = function (scriptNode, removeAttach = false) {
1101
+
1102
+ if (removeAttach) $(scriptNode).remove()
1103
+
1104
+ let wooptpmSrc = $(scriptNode).data('wooptpm-src')
1105
+ if (wooptpmSrc) $(scriptNode).attr('src', wooptpmSrc)
1106
+
1107
+ scriptNode.type = 'text/javascript'
1108
+
1109
+ if (removeAttach) $(scriptNode).appendTo('head')
1110
+ }
1111
+
1112
+ wooptpm.blockScript = function (scriptNode, removeAttach = false) {
1113
+
1114
+ if (removeAttach) $(scriptNode).remove()
1115
+
1116
+ if ($(scriptNode).attr('src')) $(scriptNode).removeAttr('src')
1117
+ scriptNode.type = 'blocked/javascript'
1118
+
1119
+ if (removeAttach) $(scriptNode).appendTo('head')
1120
+ }
1121
+
1122
+ wooptpm.unblockAllScripts = function (analytics = true, ads = true) {
1123
+ // console.log('unblocking all scripts')
1124
+
1125
+ $.each(
1126
+ $('script[type="blocked/javascript"]'), function (index, scriptNode) {
1127
+
1128
+ if ($(scriptNode).data('wooptpm-cookie-category').includes('analytics') && analytics) {
1129
+ wooptpm.unblockScript(scriptNode, true)
1130
+ } else if ($(scriptNode).data('wooptpm-cookie-category').includes('ads') && ads) {
1131
+ wooptpm.unblockScript(scriptNode, true)
1132
+ }
1133
+ });
1134
+ }
1135
+
1136
+ wooptpm.unblockSelectedPixels = function () {
1137
+ $.each(
1138
+ $('script[type="blocked/javascript"]'), function (index, node) {
1139
+
1140
+ if (wooptpmConsentValues.pixels.includes($(node).data('wooptpm-pixel-name'))) {
1141
+ wooptpm.unblockScript(node, true)
1142
+ } else if ($(node).data('wooptpm-pixel-name') === 'google' && ['google-analytics', 'google-ads'].some(element => wooptpmConsentValues.pixels.includes(element))) {
1143
+ wooptpm.unblockScript(node, true)
1144
+ }
1145
+ });
1146
+ }
1147
+
1148
+ wooptpm.googleConfigConditionsMet = function (type) {
1149
+ // always returns true if Google Consent Mode is active
1150
+ if (wooptpmDataLayer.pixels.google.consent_mode.active) {
1151
+ return true
1152
+ } else if (wooptpmConsentValues.mode === 'category') {
1153
+ return wooptpmConsentValues.categories[type] === true
1154
+ } else if (wooptpmConsentValues.mode === 'pixel') {
1155
+ return wooptpmConsentValues.pixels.includes('google-' + type)
1156
+ } else {
1157
+ return false
1158
+ }
1159
+ }
1160
+
1161
+ wooptpm.getVisitorConsentStatusAndUpdateGoogleConsentSettings = function (google_consent_settings) {
1162
+
1163
+ if (wooptpmConsentValues.mode === 'category') {
1164
+ if (wooptpmConsentValues.categories.analytics) google_consent_settings.analytics_storage = 'granted'
1165
+ if (wooptpmConsentValues.categories.ads) google_consent_settings.ad_storage = 'granted'
1166
+ } else if ((wooptpmConsentValues.mode === 'pixel')) {
1167
+ google_consent_settings.analytics_storage = wooptpmConsentValues.pixels.includes('google-analytics') ? 'granted' : 'denied'
1168
+ google_consent_settings.ad_storage = wooptpmConsentValues.pixels.includes('google-ads') ? 'granted' : 'denied'
1169
+ }
1170
+
1171
+ return google_consent_settings
1172
+ }
1173
+
1174
+ wooptpm.updateGoogleConsentMode = function (analytics = true, ads = true) {
1175
+
1176
+ if (
1177
+ !window.gtag ||
1178
+ !wooptpmDataLayer.shop.cookie_consent_mgmt.explicit_consent
1179
+ ) return
1180
+
1181
+ gtag('consent', 'update', {
1182
+ 'analytics_storage': analytics ? 'granted' : 'denied',
1183
+ 'ad_storage' : ads ? 'granted' : 'denied'
1184
+ });
1185
+ }
1186
+
1187
+
1188
+ /*
1189
+ * Block or unblock scripts for each CMP immediately after cookie consent has been updated
1190
+ * by the visitor.
1191
+ */
1192
+
1193
+ // Borlabs Cookie
1194
+ // If visitor accepts cookies in Borlabs Cookie unblock the scripts
1195
+ window.addEventListener('borlabs-cookie-consent-saved', function (e) {
1196
+
1197
+ wooptpm.updateConsentCookieValues();
1198
+
1199
+ if (wooptpmConsentValues.mode === 'pixel') {
1200
+
1201
+ wooptpm.unblockSelectedPixels()
1202
+ wooptpm.updateGoogleConsentMode(wooptpmConsentValues.pixels.includes('google-analytics'), wooptpmConsentValues.pixels.includes('google-ads'))
1203
+ } else {
1204
+
1205
+ wooptpm.unblockAllScripts(wooptpmConsentValues.categories.analytics, wooptpmConsentValues.categories.ads)
1206
+ wooptpm.updateGoogleConsentMode(wooptpmConsentValues.categories.analytics, wooptpmConsentValues.categories.ads)
1207
+ }
1208
+ });
1209
+
1210
+ // Cookiebot
1211
+ // If visitor accepts cookies in Cookiebot unblock the scripts
1212
+ // https://www.cookiebot.com/en/developer/
1213
+ window.addEventListener('CookiebotOnAccept', function (e) {
1214
+ if (Cookiebot.consent.statistics) wooptpmConsentValues.categories.analytics = true
1215
+ if (Cookiebot.consent.marketing) wooptpmConsentValues.categories.ads = true
1216
+
1217
+ wooptpm.unblockAllScripts(wooptpmConsentValues.categories.analytics, wooptpmConsentValues.categories.ads)
1218
+ wooptpm.updateGoogleConsentMode(wooptpmConsentValues.categories.analytics, wooptpmConsentValues.categories.ads)
1219
+
1220
+ }, false);
1221
+
1222
+ // Cookie Script
1223
+ // If visitor accepts cookies in Cookie Script unblock the scripts
1224
+ // https://support.cookie-script.com/article/20-custom-events
1225
+ window.addEventListener('CookieScriptAccept', function (e) {
1226
+ if (e.detail.categories.includes('performance')) wooptpmConsentValues.categories.analytics = true
1227
+ if (e.detail.categories.includes('targeting')) wooptpmConsentValues.categories.ads = true
1228
+
1229
+ wooptpm.unblockAllScripts(wooptpmConsentValues.categories.analytics, wooptpmConsentValues.categories.ads)
1230
+ wooptpm.updateGoogleConsentMode(wooptpmConsentValues.categories.analytics, wooptpmConsentValues.categories.ads)
1231
+ })
1232
+
1233
+ // Cookie Script
1234
+ // If visitor accepts cookies in Cookie Script unblock the scripts
1235
+ // https://support.cookie-script.com/
1236
+ window.addEventListener('CookieScriptAcceptAll', function (e) {
1237
+ wooptpm.unblockAllScripts(true, true)
1238
+ wooptpm.updateGoogleConsentMode(true, true)
1239
+ })
1240
+
1241
+
1242
+
1243
+ // Complianz Cookie
1244
+ // If visitor accepts cookies in Complianz unblock the scripts
1245
+ document.addEventListener("cmplzStatusChange", function (e) {
1246
+
1247
+ wooptpm.updateConsentCookieValues();
1248
+
1249
+ // console.log(wooptpmConsentValues)
1250
+
1251
+ wooptpm.unblockAllScripts(wooptpmConsentValues.categories.analytics, wooptpmConsentValues.categories.ads)
1252
+ wooptpm.updateGoogleConsentMode(wooptpmConsentValues.categories.analytics, wooptpmConsentValues.categories.ads)
1253
+ });
1254
+
1255
+ // Cookie Compliance by hu-manity.co (free and pro)
1256
+ // If visitor accepts cookies in Cookie Notice by hu-manity.co unblock the scripts (free version)
1257
+ // https://wordpress.org/support/topic/events-on-consent-change/#post-15202792
1258
+ document.addEventListener("setCookieNotice", function (e) {
1259
+
1260
+ wooptpm.updateConsentCookieValues();
1261
+
1262
+ // console.log(wooptpmConsentValues)
1263
+
1264
+ wooptpm.unblockAllScripts(wooptpmConsentValues.categories.analytics, wooptpmConsentValues.categories.ads)
1265
+ wooptpm.updateGoogleConsentMode(wooptpmConsentValues.categories.analytics, wooptpmConsentValues.categories.ads)
1266
+ });
1267
+
1268
+ // Cookie Compliance by hu-manity.co (free and pro)
1269
+ // If visitor accepts cookies in Cookie Notice by hu-manity.co unblock the scripts (pro version)
1270
+ // https://wordpress.org/support/topic/events-on-consent-change/#post-15202792
1271
+ // Because Cookie Notice has no documented API or event that is being triggered on consent save or update
1272
+ // we have to solve this by using a mutation observer.
1273
+ wooptpm.huObserver = new MutationObserver(function (mutations) {
1274
+ mutations.forEach(({addedNodes}) => {
1275
+ [...addedNodes]
1276
+ .forEach(node => {
1277
+
1278
+ if (node.id === 'hu') {
1279
+
1280
+ jQuery('.hu-cookies-save').on('click', function (e) {
1281
+ wooptpm.updateConsentCookieValues();
1282
+ wooptpm.unblockAllScripts(wooptpmConsentValues.categories.analytics, wooptpmConsentValues.categories.ads)
1283
+ wooptpm.updateGoogleConsentMode(wooptpmConsentValues.categories.analytics, wooptpmConsentValues.categories.ads)
1284
+ });
1285
+ }
1286
+ });
1287
+ });
1288
+ });
1289
+
1290
+ if (window.hu) {
1291
+ wooptpm.huObserver.observe(document.documentElement || document.body, {childList: true, subtree: true});
1292
+ }
1293
+
1294
+ // wpm['load'] = {
1295
  // base: true
1296
  // };
1297
 
1298
+ window['wpmLoaded'] = {};
1299
 
1300
  // return {
1301
  // writeOrderIdToStorage : writeOrderIdToStorage,
1327
  // remove_from_cart event
1328
  // body.on('click', '.remove_from_cart_button, .remove', function (e) {
1329
  jQuery(document).on('click', '.remove_from_cart_button, .remove', function (e) {
1330
+ // jQuery('.remove_from_cart_button, .remove').on('click', function (e) {
1331
 
1332
  try {
1333
  // console.log('remove_from_cart: ' + jQuery(this).data('product_id'));
1346
  // add_to_cart event
1347
  // body.on('click', '.add_to_cart_button:not(.product_type_variable), .ajax_add_to_cart, .single_add_to_cart_button', function (e) {
1348
  jQuery(document).on('click', '.add_to_cart_button:not(.product_type_variable), .ajax_add_to_cart, .single_add_to_cart_button', function (e) {
1349
+ // 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) {
1350
 
1351
  try {
1352
  // console.log('add_to_cart');
1409
 
1410
  wooptpm.addProductToCart(productId, quantity);
1411
  });
1412
+ } else if (wooptpmDataLayer.shop.product_type === 'bundle') {
1413
+
1414
+ // console.log('bundle');
1415
+
1416
+ let quantity = Number(jQuery('.input-text.qty').val());
1417
+
1418
+ if (!quantity && quantity !== 0) quantity = 1;
1419
+
1420
+ let productId = jQuery('input[name=add-to-cart]').val();
1421
+
1422
+ // console.log('productId: ' + productId);
1423
+ // console.log('quantity: ' + quantity);
1424
+
1425
+ wooptpm.addProductToCart(productId, quantity);
1426
  }
1427
  }
1428
  } else {
1465
  // trigger the add to cart event
1466
  // body.one('click', 'a:not(.add_to_cart_button, .ajax_add_to_cart, .single_add_to_cart_button)', function (event) {
1467
  jQuery(document).one('click', 'a:not(.add_to_cart_button, .ajax_add_to_cart, .single_add_to_cart_button)', function (event) {
1468
+ // jQuery('a:not(.add_to_cart_button, .ajax_add_to_cart, .single_add_to_cart_button)').one('click', function (event) {
1469
 
1470
  try {
1471
  if (jQuery(event.target).closest('a').attr('href')) {
1488
  // jQuery(document).on('click', '.woocommerce-LoopProduct-link, .wc-block-grid__product, .product-small.box', function (e) {
1489
  // body.on('click', '.woocommerce-LoopProduct-link, .wc-block-grid__product, .product, .product-small, .type-product', function (e) {
1490
  jQuery(document).on('click', '.woocommerce-LoopProduct-link, .wc-block-grid__product, .product, .product-small, .type-product', function (e) {
1491
+ // jQuery('.woocommerce-LoopProduct-link, .wc-block-grid__product, .product, .product-small, .type-product').on('click', function (e) {
1492
 
1493
  try {
1494
 
1535
  // begin_checkout event
1536
  // body.one('click', '.checkout-button, .cart-checkout-button, .button.checkout', function (e) {
1537
  jQuery(document).one('click', '.checkout-button, .cart-checkout-button, .button.checkout', function (e) {
1538
+ // jQuery('.checkout-button, .cart-checkout-button, .button.checkout').one('click', function (e) {
1539
  // console.log('begin_checkout');
1540
 
1541
  jQuery(document).trigger('wooptpmBeginCheckout');
1547
  // track checkout option event: entered valid billing email
1548
  // body.on('input', '#billing_email', function () {
1549
  jQuery(document).on('input', '#billing_email', function () {
1550
+ // jQuery('#billing_email').on('input', function () {
1551
 
1552
  if (wooptpm.isEmail(jQuery(this).val())) {
1553
  // wooptpm.fireCheckoutOption(2);
1561
 
1562
  // body.on('click', '.wc_payment_methods', function () {
1563
  jQuery(document).on('click', '.wc_payment_methods', function () {
1564
+ // jQuery('.wc_payment_methods').on('click', function () {
1565
 
1566
  if (paymentMethodSelected === false) {
1567
  wooptpm.fireCheckoutProgress(3);
1591
  // update cart event
1592
  // body.on('click', "[name='update_cart']", function (e) {
1593
  jQuery(document).on('click', "[name='update_cart']", function (e) {
1594
+ // jQuery("[name='update_cart']").on('click', function (e) {
1595
 
1596
  try {
1597
  jQuery('.cart_item').each(function () {
1648
  // add_to_wishlist
1649
  // body.on('click', '.add_to_wishlist, .wl-add-to', function () {
1650
  jQuery(document).on('click', '.add_to_wishlist, .wl-add-to', function () {
1651
+ // jQuery('.add_to_wishlist, .wl-add-to').on('click', function () {
1652
 
1653
  try {
1654
  // console.log('add_to_wishlist');
1676
  })
1677
 
1678
  // body.on('updated_cart_totals', function () {
1679
+ jQuery(document).on('updated_cart_totals', function () {
1680
 
1681
+ jQuery(document).trigger('wooptpmViewCart');
1682
  });
1683
  });
1684
 
1749
  }
1750
  })
1751
 
1752
+ }).catch(function (e) {
1753
+ console.log(e)
1754
+ // console.log('object couldn\'t be loaded');
1755
  })
js/public/wooptpm.min.js CHANGED
@@ -1 +1 @@
1
- if(typeof varExists!=="function"){varExists=function(varName){return new Promise(function(resolve,reject){(function waitForVar(){if(typeof window[varName]!=="undefined")return resolve();setTimeout(waitForVar,30)})()})}}varExists("jQuery").then(function(){(function(wooptpm,$,undefined){const wgactDeduper={keyName:"_wooptpm_order_ids",cookieExpiresDays:365};const wooptpmRestSettings={cookieWooptpmRestEndpointAvailable:"_wooptpm_endpoint_available",restEndpoint:"/wp-json/",restFails:0,restFailsThreshold:10};wooptpm.useRestEndpoint=function(){return wooptpm.isSessionStorageAvailable()&&wooptpm.isRestEndpointAvailable()&&wooptpm.isBelowRestErrorThreshold()};wooptpm.isBelowRestErrorThreshold=function(){return window.sessionStorage.getItem(wooptpmRestSettings.restFails)<=wooptpmRestSettings.restFailsThreshold};wooptpm.isRestEndpointAvailable=function(){if(window.sessionStorage.getItem(wooptpmRestSettings.cookieWooptpmRestEndpointAvailable)){return JSON.parse(window.sessionStorage.getItem(wooptpmRestSettings.cookieWooptpmRestEndpointAvailable))}else{wooptpm.testEndpoint()}};wooptpm.isSessionStorageAvailable=function(){return!!window.sessionStorage};wooptpm.testEndpoint=function(url=location.protocol+"//"+location.host+wooptpmRestSettings.restEndpoint,cookieName=wooptpmRestSettings.cookieWooptpmRestEndpointAvailable){jQuery.ajax(url,{type:"HEAD",timeout:1e3,statusCode:{200:function(response){window.sessionStorage.setItem(cookieName,JSON.stringify(true))},404:function(response){window.sessionStorage.setItem(cookieName,JSON.stringify(false))},0:function(response){window.sessionStorage.setItem(cookieName,JSON.stringify(false))}}}).then(r=>{})};wooptpm.isWooptpmRestEndpointAvailable=function(cookieName=wooptpmRestSettings.cookieWooptpmRestEndpointAvailable){return!!wooptpm.getCookie(cookieName)};wooptpm.objectExists=function(obj){for(let i=1;i<arguments.length;i++){if(!obj.hasOwnProperty(arguments[i])){return false}obj=obj[arguments[i]]}return true};wooptpm.writeOrderIdToStorage=function(orderId,expireDays=365){if(!window.Storage){let expiresDate=new Date;expiresDate.setDate(expiresDate.getDate()+wgactDeduper.cookieExpiresDays);let ids=[];if(checkCookie()){ids=JSON.parse(getCookie(wgactDeduper.keyName))}if(!ids.includes(orderId)){ids.push(orderId);document.cookie=wgactDeduper.keyName+"="+JSON.stringify(ids)+";expires="+expiresDate.toUTCString()}}else{if(localStorage.getItem(wgactDeduper.keyName)===null){let ids=[];ids.push(orderId);window.localStorage.setItem(wgactDeduper.keyName,JSON.stringify(ids))}else{let ids=JSON.parse(localStorage.getItem(wgactDeduper.keyName));if(!ids.includes(orderId)){ids.push(orderId);window.localStorage.setItem(wgactDeduper.keyName,JSON.stringify(ids))}}}if(typeof wooptpm.storeOrderIdOnServer==="function"&&wooptpmDataLayer.orderDeduplication){wooptpm.storeOrderIdOnServer(orderId)}};function getCookie(cname){let name=cname+"=";let ca=document.cookie.split(";");for(let i=0;i<ca.length;i++){let c=ca[i];while(c.charAt(0)===" "){c=c.substring(1)}if(c.indexOf(name)===0){return c.substring(name.length,c.length)}}return""}function checkCookie(){let key=getCookie(wgactDeduper.keyName);return key!==""}wooptpm.isOrderIdStored=function(orderId){if(wooptpmDataLayer.orderDeduplication){if(!window.Storage){if(checkCookie()){let ids=JSON.parse(getCookie(wgactDeduper.keyName));return ids.includes(orderId)}else{return false}}else{if(localStorage.getItem(wgactDeduper.keyName)!==null){let ids=JSON.parse(localStorage.getItem(wgactDeduper.keyName));return ids.includes(orderId)}else{return false}}}else{console.log("order deduplication: off");return false}};wooptpm.isEmail=function(email){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,}))$/;return regex.test(email)};wooptpm.removeProductFromCart=function(productId,quantityToRemove=null){try{if(!productId)throw Error("Wasn't able to retrieve a productId");productId=getIdBasedOndVariationsOutputSetting(productId);if(!productId)throw Error("Wasn't able to retrieve a productId");let quantity;if(quantityToRemove==null){quantity=wooptpmDataLayer.cart[productId].quantity}else{quantity=quantityToRemove}if(wooptpmDataLayer.cart[productId]){let product=wooptpm.getProductDetailsFormattedForEvent(productId,quantity);jQuery(document).trigger("wooptpmRemoveFromCart",product);if(quantityToRemove==null||wooptpmDataLayer.cart[productId].quantity===quantityToRemove){delete wooptpmDataLayer.cart[productId];if(sessionStorage)sessionStorage.setItem("wooptpmDataLayerCart",JSON.stringify(wooptpmDataLayer.cart))}else{wooptpmDataLayer.cart[productId].quantity=wooptpmDataLayer.cart[productId].quantity-quantity;if(sessionStorage)sessionStorage.setItem("wooptpmDataLayerCart",JSON.stringify(wooptpmDataLayer.cart))}}}catch(e){console.log(e)}};getIdBasedOndVariationsOutputSetting=function(productId){try{if(wooptpmDataLayer.general.variationsOutput){return productId}else{if(wooptpmDataLayer.products[productId].isVariation){return wooptpmDataLayer.products[productId].parentId}else{return productId}}}catch(e){console.log(e)}};wooptpm.addProductToCart=function(productId,quantity){try{if(!productId)throw Error("Wasn't able to retrieve a productId");productId=getIdBasedOndVariationsOutputSetting(productId);if(!productId)throw Error("Wasn't able to retrieve a productId");if(wooptpmDataLayer.products[productId]){let product=wooptpm.getProductDetailsFormattedForEvent(productId,quantity);jQuery(document).trigger("wooptpmAddToCart",product);if(wooptpmDataLayer.cart!==undefined&&wooptpmDataLayer.cart[productId]!==undefined){wooptpmDataLayer.cart[productId].quantity=wooptpmDataLayer.cart[productId].quantity+quantity;if(sessionStorage)sessionStorage.setItem("wooptpmDataLayerCart",JSON.stringify(wooptpmDataLayer.cart))}else{if(!wooptpmDataLayer.cart){wooptpmDataLayer["cart"]={[productId]:wooptpm.getProductDetailsFormattedForEvent(productId,quantity)};if(sessionStorage)sessionStorage.setItem("wooptpmDataLayerCart",JSON.stringify(wooptpmDataLayer.cart))}else{wooptpmDataLayer.cart[productId]=wooptpm.getProductDetailsFormattedForEvent(productId,quantity);if(sessionStorage)sessionStorage.setItem("wooptpmDataLayerCart",JSON.stringify(wooptpmDataLayer.cart))}}}}catch(e){console.log(e);wooptpm.getCartItemsFromBackend()}};wooptpm.getCartItems=function(){if(sessionStorage){if(!sessionStorage.getItem("wooptpmDataLayerCart")||wooptpmDataLayer.shop.page_type==="order_received_page"){sessionStorage.setItem("wooptpmDataLayerCart",JSON.stringify({}))}else{wooptpm.saveCartObjectToDataLayer(JSON.parse(sessionStorage.getItem("wooptpmDataLayerCart")))}}else{wooptpm.getCartItemsFromBackend()}};wooptpm.getCartItemsFromBackend=function(){try{let data={action:"wooptpm_get_cart_items"};jQuery.ajax({type:"get",dataType:"json",url:ajax_object.ajax_url,data:data,success:function(cartItems){if(!cartItems["cart"])cartItems["cart"]={};wooptpm.saveCartObjectToDataLayer(cartItems["cart"]);if(sessionStorage)sessionStorage.setItem("wooptpmDataLayerCart",JSON.stringify(cartItems["cart"]))}})}catch(e){console.log(e)}};wooptpm.getProductsFromBackend=function(productIds){productIds=productIds.filter(item=>!wooptpmDataLayer.products.hasOwnProperty(item));if(!productIds||productIds.length===0)return;try{let data={action:"wooptpm_get_product_ids",productIds:productIds};jQuery.ajax({type:"get",dataType:"json",url:ajax_object.ajax_url,data:data,success:function(products){wooptpmDataLayer.products=Object.assign({},wooptpmDataLayer.products,products)},error:function(response){console.log(response)}})}catch(e){console.log(e)}};wooptpm.saveCartObjectToDataLayer=function(cartObject){wooptpmDataLayer.cart=cartObject;wooptpmDataLayer.products=Object.assign({},wooptpmDataLayer.products,cartObject)};wooptpm.fireCheckoutOption=function(step,checkout_option=null,value=null){let data={step:step,checkout_option:checkout_option,value:value};jQuery(document).trigger("wooptpmFireCheckoutOption",data)};wooptpm.fireCheckoutProgress=function(step){let data={step:step};jQuery(document).trigger("wooptpmFireCheckoutProgress",data)};wooptpm.getPostIdFromString=function(string){try{return string.match(/(post-)(\d+)/)[2]}catch(e){console.log(e)}};wooptpm.triggerViewItemList=function(productId){if(!productId)throw Error("Wasn't able to retrieve a productId");productId=getIdBasedOndVariationsOutputSetting(productId);if(!productId)throw Error("Wasn't able to retrieve a productId");jQuery(document).trigger("wooptpmViewItemList",wooptpm.getProductDataForViewItemEvent(productId))};wooptpm.getProductDataForViewItemEvent=function(productId){if(!productId)throw Error("Wasn't able to retrieve a productId");try{if(wooptpmDataLayer.products[productId]){return wooptpm.getProductDetailsFormattedForEvent(productId)}}catch(e){console.log(e)}};wooptpm.getMainProductIdFromProductPage=function(){try{if(["simple","variable","grouped","composite"].indexOf(wooptpmDataLayer.shop.product_type)>=0){return jQuery(".wooptpmProductId:first").data("id")}else{return false}}catch(e){console.log(e)}};wooptpm.viewItemListTriggerTestMode=function(target){jQuery(target).css({position:"relative"});jQuery(target).append('<div id="viewItemListTriggerOverlay"></div>');jQuery(target).find("#viewItemListTriggerOverlay").css({"z-index":"10",display:"block",position:"absolute",height:"100%",top:"0",left:"0",right:"0",opacity:wooptpmDataLayer.viewItemListTrigger.opacity,"background-color":wooptpmDataLayer.viewItemListTrigger.backgroundColor})};wooptpm.getSearchTermFromUrl=function(){try{let urlParameters=new URLSearchParams(window.location.search);return urlParameters.get("s")}catch(e){console.log(e)}};let ioTimeouts={};wooptpm.observerCallback=function(entries,observer){entries.forEach(entry=>{try{let productId;let elementId=jQuery(entry.target).data("ioid");if(jQuery(entry.target).next(".wooptpmProductId").length){productId=jQuery(entry.target).next(".wooptpmProductId").data("id")}else{productId=jQuery(entry.target).find(".wooptpmProductId").data("id")}if(!productId)throw Error("wooptpmProductId element not found");if(entry.isIntersecting){ioTimeouts[elementId]=setTimeout(()=>{wooptpm.triggerViewItemList(productId);if(wooptpmDataLayer.viewItemListTrigger.testMode)wooptpm.viewItemListTriggerTestMode(entry.target);if(wooptpmDataLayer.viewItemListTrigger.repeat===false)observer.unobserve(entry.target)},wooptpmDataLayer.viewItemListTrigger.timeout)}else{clearTimeout(ioTimeouts[elementId]);if(wooptpmDataLayer.viewItemListTrigger.testMode)jQuery(entry.target).find("#viewItemListTriggerOverlay").remove()}}catch(e){console.log(e)}})};let io;let ioid=0;let allIoElementsToWatch;let getAllElementsToWatch=function(){allIoElementsToWatch=jQuery(".wooptpmProductId").map(function(i,elem){if(jQuery(elem).parent().hasClass("type-product")||jQuery(elem).parent().hasClass("product")||jQuery(elem).parent().hasClass("product-item-inner")){return jQuery(elem).parent()}else if(jQuery(elem).prev().hasClass("wc-block-grid__product")||jQuery(elem).prev().hasClass("product")||jQuery(elem).prev().hasClass("product-small")||jQuery(elem).prev().hasClass("woocommerce-LoopProduct-link")){return jQuery(this).prev()}else if(jQuery(elem).closest(".product").length){return jQuery(elem).closest(".product")}})};wooptpm.startIntersectionObserverToWatch=function(){try{let urlParams=new URLSearchParams(window.location.search);if(urlParams.has("vildemomode"))wooptpmDataLayer.viewItemListTrigger.testMode=true;io=new IntersectionObserver(wooptpm.observerCallback,{threshold:wooptpmDataLayer.viewItemListTrigger.threshold});getAllElementsToWatch();allIoElementsToWatch.each(function(i,elem){jQuery(elem[0]).data("ioid",ioid++);io.observe(elem[0])})}catch(e){console.log(e)}};wooptpm.startProductsMutationObserverToWatch=function(){try{let productsNode=jQuery(".wooptpmProductId:eq(0)").parents().has(jQuery(".wooptpmProductId:eq(1)").parents()).first();if(productsNode.length){productsMutationObserver.observe(productsNode[0],{attributes:true,childList:true,characterData:true})}}catch(e){console.log(e)}};let productsMutationObserver=new MutationObserver(function(mutations){mutations.forEach(function(mutation){let newNodes=mutation.addedNodes;if(newNodes!==null){let nodes=jQuery(newNodes);nodes.each(function(){if(jQuery(this).hasClass("type-product")||jQuery(this).hasClass("product-small")||jQuery(this).hasClass("wc-block-grid__product")){if(hasWooptpmProductIdElement(this)){jQuery(this).data("ioid",ioid++);io.observe(this)}}})}})});let hasWooptpmProductIdElement=function(elem){return!!(jQuery(elem).find(".wooptpmProductId").length||jQuery(elem).siblings(".wooptpmProductId").length)};wooptpm.setCookie=function(cookieName,cookieValue="",expiryDays=null){if(expiryDays){let d=new Date;d.setTime(d.getTime()+expiryDays*24*60*60*1e3);let expires="expires="+d.toUTCString();document.cookie=cookieName+"="+cookieValue+";"+expires+";path=/"}else{document.cookie=cookieName+"="+cookieValue+";path=/"}};wooptpm.getCookie=function(cookieName){let name=cookieName+"=";let decodedCookie=decodeURIComponent(document.cookie);let ca=decodedCookie.split(";");for(let i=0;i<ca.length;i++){let c=ca[i];while(c.charAt(0)==" "){c=c.substring(1)}if(c.indexOf(name)==0){return c.substring(name.length,c.length)}}return""};wooptpm.storeOrderIdOnServer=function(orderId){try{let data={action:"wooptpm_purchase_pixels_fired",order_id:orderId,nonce:ajax_object.nonce};jQuery.ajax({type:"post",dataType:"json",url:ajax_object.ajax_url,data:data,success:function(response){if(response.success===false){console.log(response)}},error:function(response){console.log(response)}})}catch(e){console.log(e)}};wooptpm.getProductIdByCartItemKeyUrl=function(url){let searchParams=new URLSearchParams(url.search);let cartItemKey=searchParams.get("remove_item");let productId=null;if(wooptpmDataLayer.cartItemKeys[cartItemKey]["variation_id"]===0){productId=wooptpmDataLayer.cartItemKeys[cartItemKey]["product_id"]}else{productId=wooptpmDataLayer.cartItemKeys[cartItemKey]["variation_id"]}return productId};wooptpm.getAddToCartLinkProductIds=function(){return jQuery("a").map(function(){let href=jQuery(this).attr("href");if(href&&href.includes("?add-to-cart=")){let matches=href.match(/(add-to-cart=)(\d+)/);if(matches)return matches[2]}}).get()};wooptpm.getProductDetailsFormattedForEvent=function(productId,quantity=1){let product={id:productId.toString(),dyn_r_ids:wooptpmDataLayer.products[productId].dyn_r_ids,name:wooptpmDataLayer.products[productId].name,list_name:wooptpmDataLayer.shop.list_name,brand:wooptpmDataLayer.products[productId].brand,category:wooptpmDataLayer.products[productId].category,variant:wooptpmDataLayer.products[productId].variant,list_position:wooptpmDataLayer.products[productId].position,quantity:quantity,price:wooptpmDataLayer.products[productId].price,currency:wooptpmDataLayer.shop.currency,isVariable:wooptpmDataLayer.products[productId].isVariable,isVariation:wooptpmDataLayer.products[productId].isVariation,parentId:wooptpmDataLayer.products[productId].parentId};if(product.isVariation)product["parentId_dyn_r_ids"]=wooptpmDataLayer.products[productId].parentId_dyn_r_ids;return product};wooptpm.setReferrerToCookie=function(){if(!wooptpm.getCookie("wooptpmReferrer")){wooptpm.setCookie("wooptpmReferrer",document.referrer)}};wooptpm.getReferrerFromCookie=function(){if(wooptpm.getCookie("wooptpmReferrer")){return wooptpm.getCookie("wooptpmReferrer")}else{return null}};wooptpm.getClidFromBrowser=function(clidId="gclid"){let clidCookieId;clidCookieId={gclid:"_gcl_aw",dclid:"_gcl_dc"};if(wooptpm.getCookie(clidCookieId[clidId])){let clidCookie=wooptpm.getCookie(clidCookieId[clidId]);let matches=clidCookie.match(/(GCL.[\d]*.)(.*)/);return matches[2]}else{return""}};wooptpm.getUserAgent=function(){return navigator.userAgent};wooptpm.getViewPort=function(){return{width:Math.max(document.documentElement.clientWidth||0,window.innerWidth||0),height:Math.max(document.documentElement.clientHeight||0,window.innerHeight||0)}};window["wooptpmLoaded"]={}})(window.wooptpm=window.wooptpm||{},jQuery);jQuery(function(){wooptpm.startIntersectionObserverToWatch();wooptpm.startProductsMutationObserverToWatch();let body=jQuery("body");let products=jQuery(".products, .product");jQuery(document).on("click",".remove_from_cart_button, .remove",function(e){try{let url=new URL(jQuery(this).attr("href"));let productId=wooptpm.getProductIdByCartItemKeyUrl(url);wooptpm.removeProductFromCart(productId)}catch(e){console.log(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(wooptpmDataLayer.shop.page_type==="product"){if(typeof jQuery(this).attr("href")!=="undefined"&&jQuery(this).attr("href").includes("add-to-cart")){let quantity=1;let productId=jQuery(this).data("product_id");wooptpm.addProductToCart(productId,quantity)}else{if(wooptpmDataLayer.shop.product_type==="simple"){let quantity=Number(jQuery(".input-text.qty").val());if(!quantity&&quantity!==0)quantity=1;let productId=jQuery(this).val();wooptpm.addProductToCart(productId,quantity)}else if(wooptpmDataLayer.shop.product_type==="variable"){let quantity=Number(jQuery(".input-text.qty").val());if(!quantity&&quantity!==0)quantity=1;let productId=jQuery("[name='variation_id']").val();wooptpm.addProductToCart(productId,quantity)}else if(wooptpmDataLayer.shop.product_type==="grouped"){jQuery(".woocommerce-grouped-product-list-item").each(function(){let quantity=Number(jQuery(this).find(".input-text.qty").val());if(!quantity&&quantity!==0)quantity=1;let classes=jQuery(this).attr("class");let productId=wooptpm.getPostIdFromString(classes);wooptpm.addProductToCart(productId,quantity)})}}}else{let quantity=1;let productId=jQuery(this).data("product_id");wooptpm.addProductToCart(productId,quantity)}}catch(e){console.log(e)}});jQuery(document).one("click","a:not(.add_to_cart_button, .ajax_add_to_cart, .single_add_to_cart_button)",function(event){try{if(jQuery(event.target).closest("a").attr("href")){let href=jQuery(event.target).closest("a").attr("href");if(href.includes("add-to-cart=")){let matches=href.match(/(add-to-cart=)(\d+)/);if(matches)wooptpm.addProductToCart(matches[2],1)}}}catch(e){console.log(e)}});jQuery(document).on("click",".woocommerce-LoopProduct-link, .wc-block-grid__product, .product, .product-small, .type-product",function(e){try{let productId=jQuery(this).nextAll(".wooptpmProductId:first").data("id");if(productId){productId=getIdBasedOndVariationsOutputSetting(productId);if(!productId)throw Error("Wasn't able to retrieve a productId");if(wooptpmDataLayer.products&&wooptpmDataLayer.products[productId]){let product=wooptpm.getProductDetailsFormattedForEvent(productId);jQuery(document).trigger("wooptpmSelectContentGaUa",product);jQuery(document).trigger("wooptpmSelectItem",product)}}}catch(e){console.log(e)}});jQuery(document).one("click",".checkout-button, .cart-checkout-button, .button.checkout",function(e){jQuery(document).trigger("wooptpmBeginCheckout")});let emailSelected=false;jQuery(document).on("input","#billing_email",function(){if(wooptpm.isEmail(jQuery(this).val())){wooptpm.fireCheckoutProgress(2);emailSelected=true}});let paymentMethodSelected=false;jQuery(document).on("click",".wc_payment_methods",function(){if(paymentMethodSelected===false){wooptpm.fireCheckoutProgress(3)}wooptpm.fireCheckoutOption(3,jQuery("input[name='payment_method']:checked").val());paymentMethodSelected=true});jQuery(document).one("click","#place_order",function(){if(emailSelected===false){wooptpm.fireCheckoutProgress(2)}if(paymentMethodSelected===false){wooptpm.fireCheckoutProgress(3);wooptpm.fireCheckoutOption(3,jQuery("input[name='payment_method']:checked").val())}wooptpm.fireCheckoutProgress(4)});jQuery(document).on("click","[name='update_cart']",function(e){try{jQuery(".cart_item").each(function(){let url=new URL(jQuery(this).find(".product-remove").find("a").attr("href"));let productId=wooptpm.getProductIdByCartItemKeyUrl(url);let quantity=jQuery(this).find(".qty").val();if(quantity===0){wooptpm.removeProductFromCart(productId)}else if(quantity<wooptpmDataLayer.cart[productId].quantity){wooptpm.removeProductFromCart(productId,wooptpmDataLayer.cart[productId].quantity-quantity)}else if(quantity>wooptpmDataLayer.cart[productId].quantity){wooptpm.addProductToCart(productId,quantity-wooptpmDataLayer.cart[productId].quantity)}})}catch(e){console.log(e);wooptpm.getCartItemsFromBackend()}});jQuery(".single_variation_wrap").on("show_variation",function(event,variation){try{let productId=getIdBasedOndVariationsOutputSetting(variation.variation_id);if(!productId)throw Error("Wasn't able to retrieve a productId");if(wooptpmDataLayer.products&&wooptpmDataLayer.products[productId]){let product=wooptpm.getProductDetailsFormattedForEvent(productId);jQuery(document).trigger("wooptpmViewItem",product)}}catch(e){console.log(e)}});jQuery(document).on("click",".add_to_wishlist, .wl-add-to",function(){try{let productId;if(jQuery(this).data("productid")){productId=jQuery(this).data("productid")}else if(jQuery(this).data("product-id")){productId=jQuery(this).data("product-id")}if(!productId)throw Error("Wasn't able to retrieve a productId");let product=wooptpm.getProductDetailsFormattedForEvent(productId);jQuery(document).trigger("wooptpmAddToWishlist",product)}catch(e){console.log(e)}});jQuery(document).on("updated_cart_totals",function(){jQuery(document).trigger("wooptpmViewCart")})});jQuery(document).ajaxSend(function(event,jqxhr,settings){if(settings.url.includes("get_refreshed_fragments")&&sessionStorage){if(!sessionStorage.getItem("wooptpmMiniCartActive")){sessionStorage.setItem("wooptpmMiniCartActive",JSON.stringify(true))}}});jQuery(window).on("load",function(){try{if(JSON.parse(sessionStorage.getItem("wooptpmMiniCartActive"))&&JSON.parse(sessionStorage.getItem("wooptpmFirstPageLoad"))&&wooptpmDataLayer.shop.mini_cart.track===true){wooptpm.getCartItems()}else{sessionStorage.setItem("wooptpmFirstPageLoad",JSON.stringify(true))}}catch(e){console.log(e)}});jQuery(window).on("load",function(){wooptpmDataLayer.products=wooptpmDataLayer.products||{};let productIds=wooptpm.getAddToCartLinkProductIds();wooptpm.getProductsFromBackend(productIds)});jQuery(window).on("load",function(){if(!wooptpm.getCookie("wooptpmReferrer")){if(document.referrer){let referrerUrl=new URL(document.referrer);let referrerHostname=referrerUrl.hostname;if(referrerHostname!==window.location.host){wooptpm.setCookie("wooptpmReferrer",referrerHostname)}else{wooptpm.setCookie("wooptpmReferrer","")}}else{wooptpm.setCookie("wooptpmReferrer","")}}})}).catch(function(){console.log("object couldn't be loaded")});
1
+ if(typeof varExists!=="function"){varExists=function(varName){return new Promise(function(resolve,reject){(function waitForVar(){if(typeof window[varName]!=="undefined")return resolve();setTimeout(waitForVar,30)})()})}}varExists("jQuery").then(function(){(function(wooptpm,$,undefined){const wgactDeduper={keyName:"_wooptpm_order_ids",cookieExpiresDays:365};const wooptpmRestSettings={cookieWooptpmRestEndpointAvailable:"_wooptpm_endpoint_available",restEndpoint:"/wp-json/",restFails:0,restFailsThreshold:10};wooptpm.useRestEndpoint=function(){return wooptpm.isSessionStorageAvailable()&&wooptpm.isRestEndpointAvailable()&&wooptpm.isBelowRestErrorThreshold()};wooptpm.isBelowRestErrorThreshold=function(){return window.sessionStorage.getItem(wooptpmRestSettings.restFails)<=wooptpmRestSettings.restFailsThreshold};wooptpm.isRestEndpointAvailable=function(){if(window.sessionStorage.getItem(wooptpmRestSettings.cookieWooptpmRestEndpointAvailable)){return JSON.parse(window.sessionStorage.getItem(wooptpmRestSettings.cookieWooptpmRestEndpointAvailable))}else{wooptpm.testEndpoint()}};wooptpm.isSessionStorageAvailable=function(){return!!window.sessionStorage};wooptpm.testEndpoint=function(url=location.protocol+"//"+location.host+wooptpmRestSettings.restEndpoint,cookieName=wooptpmRestSettings.cookieWooptpmRestEndpointAvailable){jQuery.ajax(url,{type:"HEAD",timeout:1e3,statusCode:{200:function(response){window.sessionStorage.setItem(cookieName,JSON.stringify(true))},404:function(response){window.sessionStorage.setItem(cookieName,JSON.stringify(false))},0:function(response){window.sessionStorage.setItem(cookieName,JSON.stringify(false))}}}).then(r=>{})};wooptpm.isWooptpmRestEndpointAvailable=function(cookieName=wooptpmRestSettings.cookieWooptpmRestEndpointAvailable){return!!wooptpm.getCookie(cookieName)};wooptpm.objectExists=function(obj){for(let i=1;i<arguments.length;i++){if(!obj.hasOwnProperty(arguments[i])){return false}obj=obj[arguments[i]]}return true};wooptpm.writeOrderIdToStorage=function(orderId,expireDays=365){if(!window.Storage){let expiresDate=new Date;expiresDate.setDate(expiresDate.getDate()+wgactDeduper.cookieExpiresDays);let ids=[];if(checkCookie()){ids=JSON.parse(wooptpm.getCookie(wgactDeduper.keyName))}if(!ids.includes(orderId)){ids.push(orderId);document.cookie=wgactDeduper.keyName+"="+JSON.stringify(ids)+";expires="+expiresDate.toUTCString()}}else{if(localStorage.getItem(wgactDeduper.keyName)===null){let ids=[];ids.push(orderId);window.localStorage.setItem(wgactDeduper.keyName,JSON.stringify(ids))}else{let ids=JSON.parse(localStorage.getItem(wgactDeduper.keyName));if(!ids.includes(orderId)){ids.push(orderId);window.localStorage.setItem(wgactDeduper.keyName,JSON.stringify(ids))}}}if(typeof wooptpm.storeOrderIdOnServer==="function"&&wooptpmDataLayer.orderDeduplication){wooptpm.storeOrderIdOnServer(orderId)}};function checkCookie(){let key=wooptpm.getCookie(wgactDeduper.keyName);return key!==""}wooptpm.isOrderIdStored=function(orderId){if(wooptpmDataLayer.orderDeduplication){if(!window.Storage){if(checkCookie()){let ids=JSON.parse(wooptpm.getCookie(wgactDeduper.keyName));return ids.includes(orderId)}else{return false}}else{if(localStorage.getItem(wgactDeduper.keyName)!==null){let ids=JSON.parse(localStorage.getItem(wgactDeduper.keyName));return ids.includes(orderId)}else{return false}}}else{console.log("order deduplication: off");return false}};wooptpm.isEmail=function(email){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,}))$/;return regex.test(email)};wooptpm.removeProductFromCart=function(productId,quantityToRemove=null){try{if(!productId)throw Error("Wasn't able to retrieve a productId");productId=getIdBasedOndVariationsOutputSetting(productId);if(!productId)throw Error("Wasn't able to retrieve a productId");let quantity;if(quantityToRemove==null){quantity=wooptpmDataLayer.cart[productId].quantity}else{quantity=quantityToRemove}if(wooptpmDataLayer.cart[productId]){let product=wooptpm.getProductDetailsFormattedForEvent(productId,quantity);jQuery(document).trigger("wooptpmRemoveFromCart",product);if(quantityToRemove==null||wooptpmDataLayer.cart[productId].quantity===quantityToRemove){delete wooptpmDataLayer.cart[productId];if(sessionStorage)sessionStorage.setItem("wooptpmDataLayerCart",JSON.stringify(wooptpmDataLayer.cart))}else{wooptpmDataLayer.cart[productId].quantity=wooptpmDataLayer.cart[productId].quantity-quantity;if(sessionStorage)sessionStorage.setItem("wooptpmDataLayerCart",JSON.stringify(wooptpmDataLayer.cart))}}}catch(e){console.log(e)}};getIdBasedOndVariationsOutputSetting=function(productId){try{if(wooptpmDataLayer.general.variationsOutput){return productId}else{if(wooptpmDataLayer.products[productId].isVariation){return wooptpmDataLayer.products[productId].parentId}else{return productId}}}catch(e){console.log(e)}};wooptpm.addProductToCart=function(productId,quantity){try{if(!productId)throw Error("Wasn't able to retrieve a productId");productId=getIdBasedOndVariationsOutputSetting(productId);if(!productId)throw Error("Wasn't able to retrieve a productId");if(wooptpmDataLayer.products[productId]){let product=wooptpm.getProductDetailsFormattedForEvent(productId,quantity);jQuery(document).trigger("wooptpmAddToCart",product);if(wooptpmDataLayer.cart!==undefined&&wooptpmDataLayer.cart[productId]!==undefined){wooptpmDataLayer.cart[productId].quantity=wooptpmDataLayer.cart[productId].quantity+quantity;if(sessionStorage)sessionStorage.setItem("wooptpmDataLayerCart",JSON.stringify(wooptpmDataLayer.cart))}else{if(!wooptpmDataLayer.cart){wooptpmDataLayer["cart"]={[productId]:wooptpm.getProductDetailsFormattedForEvent(productId,quantity)};if(sessionStorage)sessionStorage.setItem("wooptpmDataLayerCart",JSON.stringify(wooptpmDataLayer.cart))}else{wooptpmDataLayer.cart[productId]=wooptpm.getProductDetailsFormattedForEvent(productId,quantity);if(sessionStorage)sessionStorage.setItem("wooptpmDataLayerCart",JSON.stringify(wooptpmDataLayer.cart))}}}}catch(e){console.log(e);wooptpm.getCartItemsFromBackend()}};wooptpm.getCartItems=function(){if(sessionStorage){if(!sessionStorage.getItem("wooptpmDataLayerCart")||wooptpmDataLayer.shop.page_type==="order_received_page"){sessionStorage.setItem("wooptpmDataLayerCart",JSON.stringify({}))}else{wooptpm.saveCartObjectToDataLayer(JSON.parse(sessionStorage.getItem("wooptpmDataLayerCart")))}}else{wooptpm.getCartItemsFromBackend()}};wooptpm.getCartItemsFromBackend=function(){try{let data={action:"wooptpm_get_cart_items"};jQuery.ajax({type:"get",dataType:"json",url:ajax_object.ajax_url,data:data,success:function(cartItems){if(!cartItems["cart"])cartItems["cart"]={};wooptpm.saveCartObjectToDataLayer(cartItems["cart"]);if(sessionStorage)sessionStorage.setItem("wooptpmDataLayerCart",JSON.stringify(cartItems["cart"]))}})}catch(e){console.log(e)}};wooptpm.getProductsFromBackend=function(productIds){productIds=productIds.filter(item=>!wooptpmDataLayer.products.hasOwnProperty(item));if(!productIds||productIds.length===0)return;try{let data={action:"wooptpm_get_product_ids",productIds:productIds};jQuery.ajax({type:"get",dataType:"json",url:ajax_object.ajax_url,data:data,success:function(products){wooptpmDataLayer.products=Object.assign({},wooptpmDataLayer.products,products)},error:function(response){console.log(response)}})}catch(e){console.log(e)}};wooptpm.saveCartObjectToDataLayer=function(cartObject){wooptpmDataLayer.cart=cartObject;wooptpmDataLayer.products=Object.assign({},wooptpmDataLayer.products,cartObject)};wooptpm.fireCheckoutOption=function(step,checkout_option=null,value=null){let data={step:step,checkout_option:checkout_option,value:value};jQuery(document).trigger("wooptpmFireCheckoutOption",data)};wooptpm.fireCheckoutProgress=function(step){let data={step:step};jQuery(document).trigger("wooptpmFireCheckoutProgress",data)};wooptpm.getPostIdFromString=function(string){try{return string.match(/(post-)(\d+)/)[2]}catch(e){console.log(e)}};wooptpm.triggerViewItemList=function(productId){if(!productId)throw Error("Wasn't able to retrieve a productId");productId=getIdBasedOndVariationsOutputSetting(productId);if(!productId)throw Error("Wasn't able to retrieve a productId");jQuery(document).trigger("wooptpmViewItemList",wooptpm.getProductDataForViewItemEvent(productId))};wooptpm.getProductDataForViewItemEvent=function(productId){if(!productId)throw Error("Wasn't able to retrieve a productId");try{if(wooptpmDataLayer.products[productId]){return wooptpm.getProductDetailsFormattedForEvent(productId)}}catch(e){console.log(e)}};wooptpm.getMainProductIdFromProductPage=function(){try{if(["simple","variable","grouped","composite","bundle"].indexOf(wooptpmDataLayer.shop.product_type)>=0){return jQuery(".wooptpmProductId:first").data("id")}else{return false}}catch(e){console.log(e)}};wooptpm.viewItemListTriggerTestMode=function(target){jQuery(target).css({position:"relative"});jQuery(target).append('<div id="viewItemListTriggerOverlay"></div>');jQuery(target).find("#viewItemListTriggerOverlay").css({"z-index":"10",display:"block",position:"absolute",height:"100%",top:"0",left:"0",right:"0",opacity:wooptpmDataLayer.viewItemListTrigger.opacity,"background-color":wooptpmDataLayer.viewItemListTrigger.backgroundColor})};wooptpm.getSearchTermFromUrl=function(){try{let urlParameters=new URLSearchParams(window.location.search);return urlParameters.get("s")}catch(e){console.log(e)}};let ioTimeouts={};wooptpm.observerCallback=function(entries,observer){entries.forEach(entry=>{try{let productId;let elementId=jQuery(entry.target).data("ioid");if(jQuery(entry.target).next(".wooptpmProductId").length){productId=jQuery(entry.target).next(".wooptpmProductId").data("id")}else{productId=jQuery(entry.target).find(".wooptpmProductId").data("id")}if(!productId)throw Error("wooptpmProductId element not found");if(entry.isIntersecting){ioTimeouts[elementId]=setTimeout(()=>{wooptpm.triggerViewItemList(productId);if(wooptpmDataLayer.viewItemListTrigger.testMode)wooptpm.viewItemListTriggerTestMode(entry.target);if(wooptpmDataLayer.viewItemListTrigger.repeat===false)observer.unobserve(entry.target)},wooptpmDataLayer.viewItemListTrigger.timeout)}else{clearTimeout(ioTimeouts[elementId]);if(wooptpmDataLayer.viewItemListTrigger.testMode)jQuery(entry.target).find("#viewItemListTriggerOverlay").remove()}}catch(e){console.log(e)}})};let io;let ioid=0;let allIoElementsToWatch;let getAllElementsToWatch=function(){allIoElementsToWatch=jQuery(".wooptpmProductId").map(function(i,elem){if(jQuery(elem).parent().hasClass("type-product")||jQuery(elem).parent().hasClass("product")||jQuery(elem).parent().hasClass("product-item-inner")){return jQuery(elem).parent()}else if(jQuery(elem).prev().hasClass("wc-block-grid__product")||jQuery(elem).prev().hasClass("product")||jQuery(elem).prev().hasClass("product-small")||jQuery(elem).prev().hasClass("woocommerce-LoopProduct-link")){return jQuery(this).prev()}else if(jQuery(elem).closest(".product").length){return jQuery(elem).closest(".product")}})};wooptpm.startIntersectionObserverToWatch=function(){try{let urlParams=new URLSearchParams(window.location.search);if(urlParams.has("vildemomode"))wooptpmDataLayer.viewItemListTrigger.testMode=true;io=new IntersectionObserver(wooptpm.observerCallback,{threshold:wooptpmDataLayer.viewItemListTrigger.threshold});getAllElementsToWatch();allIoElementsToWatch.each(function(i,elem){jQuery(elem[0]).data("ioid",ioid++);io.observe(elem[0])})}catch(e){console.log(e)}};wooptpm.startProductsMutationObserverToWatch=function(){try{let productsNode=jQuery(".wooptpmProductId:eq(0)").parents().has(jQuery(".wooptpmProductId:eq(1)").parents()).first();if(productsNode.length){productsMutationObserver.observe(productsNode[0],{attributes:true,childList:true,characterData:true})}}catch(e){console.log(e)}};let productsMutationObserver=new MutationObserver(function(mutations){mutations.forEach(function(mutation){let newNodes=mutation.addedNodes;if(newNodes!==null){let nodes=jQuery(newNodes);nodes.each(function(){if(jQuery(this).hasClass("type-product")||jQuery(this).hasClass("product-small")||jQuery(this).hasClass("wc-block-grid__product")){if(hasWooptpmProductIdElement(this)){jQuery(this).data("ioid",ioid++);io.observe(this)}}})}})});let hasWooptpmProductIdElement=function(elem){return!!(jQuery(elem).find(".wooptpmProductId").length||jQuery(elem).siblings(".wooptpmProductId").length)};wooptpm.setCookie=function(cookieName,cookieValue="",expiryDays=null){if(expiryDays){let d=new Date;d.setTime(d.getTime()+expiryDays*24*60*60*1e3);let expires="expires="+d.toUTCString();document.cookie=cookieName+"="+cookieValue+";"+expires+";path=/"}else{document.cookie=cookieName+"="+cookieValue+";path=/"}};wooptpm.getCookie=function(cookieName){let name=cookieName+"=";let decodedCookie=decodeURIComponent(document.cookie);let ca=decodedCookie.split(";");for(let i=0;i<ca.length;i++){let c=ca[i];while(c.charAt(0)==" "){c=c.substring(1)}if(c.indexOf(name)==0){return c.substring(name.length,c.length)}}return""};wooptpm.storeOrderIdOnServer=function(orderId){try{let data={action:"wooptpm_purchase_pixels_fired",order_id:orderId,nonce:ajax_object.nonce};jQuery.ajax({type:"post",dataType:"json",url:ajax_object.ajax_url,data:data,success:function(response){if(response.success===false){console.log(response)}},error:function(response){console.log(response)}})}catch(e){console.log(e)}};wooptpm.getProductIdByCartItemKeyUrl=function(url){let searchParams=new URLSearchParams(url.search);let cartItemKey=searchParams.get("remove_item");let productId=null;if(wooptpmDataLayer.cartItemKeys[cartItemKey]["variation_id"]===0){productId=wooptpmDataLayer.cartItemKeys[cartItemKey]["product_id"]}else{productId=wooptpmDataLayer.cartItemKeys[cartItemKey]["variation_id"]}return productId};wooptpm.getAddToCartLinkProductIds=function(){return jQuery("a").map(function(){let href=jQuery(this).attr("href");if(href&&href.includes("?add-to-cart=")){let matches=href.match(/(add-to-cart=)(\d+)/);if(matches)return matches[2]}}).get()};wooptpm.getProductDetailsFormattedForEvent=function(productId,quantity=1){let product={id:productId.toString(),dyn_r_ids:wooptpmDataLayer.products[productId].dyn_r_ids,name:wooptpmDataLayer.products[productId].name,list_name:wooptpmDataLayer.shop.list_name,brand:wooptpmDataLayer.products[productId].brand,category:wooptpmDataLayer.products[productId].category,variant:wooptpmDataLayer.products[productId].variant,list_position:wooptpmDataLayer.products[productId].position,quantity:quantity,price:wooptpmDataLayer.products[productId].price,currency:wooptpmDataLayer.shop.currency,isVariable:wooptpmDataLayer.products[productId].isVariable,isVariation:wooptpmDataLayer.products[productId].isVariation,parentId:wooptpmDataLayer.products[productId].parentId};if(product.isVariation)product["parentId_dyn_r_ids"]=wooptpmDataLayer.products[productId].parentId_dyn_r_ids;return product};wooptpm.setReferrerToCookie=function(){if(!wooptpm.getCookie("wooptpmReferrer")){wooptpm.setCookie("wooptpmReferrer",document.referrer)}};wooptpm.getReferrerFromCookie=function(){if(wooptpm.getCookie("wooptpmReferrer")){return wooptpm.getCookie("wooptpmReferrer")}else{return null}};wooptpm.getClidFromBrowser=function(clidId="gclid"){let clidCookieId;clidCookieId={gclid:"_gcl_aw",dclid:"_gcl_dc"};if(wooptpm.getCookie(clidCookieId[clidId])){let clidCookie=wooptpm.getCookie(clidCookieId[clidId]);let matches=clidCookie.match(/(GCL.[\d]*.)(.*)/);return matches[2]}else{return""}};wooptpm.getUserAgent=function(){return navigator.userAgent};wooptpm.getViewPort=function(){return{width:Math.max(document.documentElement.clientWidth||0,window.innerWidth||0),height:Math.max(document.documentElement.clientHeight||0,window.innerHeight||0)}};let getComplianzCookies=function(){let cmplz_statistics=wooptpm.getCookie("cmplz_statistics");let cmplz_marketing=wooptpm.getCookie("cmplz_marketing");let cmplz_consent_status=wooptpm.getCookie("cmplz_consent_status");if(cmplz_consent_status){return{analytics:cmplz_statistics==="allow",ads:cmplz_marketing==="allow",visitorHasChosen:true}}else{return false}};let getCookieLawInfoCookies=function(){let analyticsCookie=wooptpm.getCookie("cookielawinfo-checkbox-analytics");let adsCookie=wooptpm.getCookie("cookielawinfo-checkbox-advertisement");let visitorHasChosen=wooptpm.getCookie("CookieLawInfoConsent");if(analyticsCookie||adsCookie){return{analytics:analyticsCookie==="yes",ads:adsCookie==="yes",visitorHasChosen:!!visitorHasChosen}}else{return false}};let wooptpmConsentValues={};wooptpmConsentValues.categories={};wooptpmConsentValues.pixels=[];wooptpmConsentValues.mode="category";wooptpmConsentValues.visitorHasChosen=false;wooptpm.getConsentValues=function(){return wooptpmConsentValues};wooptpm.updateConsentCookieValues=function(explicitConsent=false){let cookie;if(cookie=wooptpm.getCookie("CookieConsent")){cookie=decodeURI(cookie);wooptpmConsentValues.categories.analytics=cookie.indexOf("statistics:true")>=0;wooptpmConsentValues.categories.ads=cookie.indexOf("marketing:true")>=0;wooptpmConsentValues.visitorHasChosen=true}else if(cookie=wooptpm.getCookie("CookieScriptConsent")){cookie=JSON.parse(cookie);if(cookie.action==="reject"){wooptpmConsentValues.categories.analytics=false;wooptpmConsentValues.categories.ads=false}else if(cookie.categories.length===2){wooptpmConsentValues.categories.analytics=true;wooptpmConsentValues.categories.ads=true}else{wooptpmConsentValues.categories.analytics=cookie.categories.indexOf("performance")>=0;wooptpmConsentValues.categories.ads=cookie.categories.indexOf("targeting")>=0}wooptpmConsentValues.visitorHasChosen=true}else if(cookie=wooptpm.getCookie("borlabs-cookie")){cookie=decodeURI(cookie);cookie=JSON.parse(cookie);wooptpmConsentValues.categories.analytics=!!cookie?.consents?.statistics;wooptpmConsentValues.categories.ads=!!cookie?.consents?.marketing;wooptpmConsentValues.visitorHasChosen=true;wooptpmConsentValues.pixels=[...cookie?.consents?.statistics||[],...cookie?.consents?.marketing||[]];wooptpmConsentValues.mode="pixel"}else if(cookie=getComplianzCookies()){wooptpmConsentValues.categories.analytics=cookie.analytics===true;wooptpmConsentValues.categories.ads=cookie.ads===true;wooptpmConsentValues.visitorHasChosen=cookie.visitorHasChosen}else if(cookie=wooptpm.getCookie("cookie_notice_accepted")){wooptpmConsentValues.categories.analytics=true;wooptpmConsentValues.categories.ads=true;wooptpmConsentValues.visitorHasChosen=true}else if(cookie=wooptpm.getCookie("hu-consent")){cookie=JSON.parse(cookie);wooptpmConsentValues.categories.analytics=!!cookie.categories["3"];wooptpmConsentValues.categories.ads=!!cookie.categories["4"];wooptpmConsentValues.visitorHasChosen=true}else if(cookie=getCookieLawInfoCookies()){wooptpmConsentValues.categories.analytics=cookie.analytics===true;wooptpmConsentValues.categories.ads=cookie.ads===true;wooptpmConsentValues.visitorHasChosen=cookie.visitorHasChosen===true}else if(cookie=wooptpm.getCookie("moove_gdpr_popup")){cookie=JSON.parse(cookie);wooptpmConsentValues.categories.analytics=cookie.thirdparty==="1";wooptpmConsentValues.categories.ads=cookie.advanced==="1";wooptpmConsentValues.visitorHasChosen=true}else{wooptpmConsentValues.categories.analytics=!explicitConsent;wooptpmConsentValues.categories.ads=!explicitConsent}};wooptpm.updateConsentCookieValues();wooptpm.setConsentDefaultValuesToExplicit=function(){wooptpmConsentValues.categories={analytics:false,ads:false}};wooptpm.scriptTagObserver=new MutationObserver(mutations=>{mutations.forEach(({addedNodes})=>{[...addedNodes].forEach(node=>{if($(node).data("wooptpm-cookie-category")){if(wooptpm.shouldScriptBeActive(node)){wooptpm.unblockScript(node)}else{wooptpm.blockScript(node)}}})})});wooptpm.scriptTagObserver.observe(document.head,{childList:true,subtree:true});window.addEventListener("DOMContentLoaded",()=>wooptpm.scriptTagObserver.disconnect());wooptpm.shouldScriptBeActive=function(node){if(wooptpmDataLayer.shop.cookie_consent_mgmt.explicit_consent||wooptpmConsentValues.visitorHasChosen){if(wooptpmConsentValues.mode==="category"&&$(node).data("wooptpm-cookie-category").split(",").some(element=>wooptpmConsentValues.categories[element])){return true}else if(wooptpmConsentValues.mode==="pixel"&&wooptpmConsentValues.pixels.includes($(node).data("wooptpm-pixel-name"))){return true}else if(wooptpmConsentValues.mode==="pixel"&&$(node).data("wooptpm-pixel-name")==="google"&&["google-analytics","google-ads"].some(element=>wooptpmConsentValues.pixels.includes(element))){return true}else if(wooptpmDataLayer?.pixels?.google?.consent_mode?.active&&$(node).data("wooptpm-pixel-name")==="google"){return true}else{return false}}else{return true}};wooptpm.unblockScript=function(scriptNode,removeAttach=false){if(removeAttach)$(scriptNode).remove();let wooptpmSrc=$(scriptNode).data("wooptpm-src");if(wooptpmSrc)$(scriptNode).attr("src",wooptpmSrc);scriptNode.type="text/javascript";if(removeAttach)$(scriptNode).appendTo("head")};wooptpm.blockScript=function(scriptNode,removeAttach=false){if(removeAttach)$(scriptNode).remove();if($(scriptNode).attr("src"))$(scriptNode).removeAttr("src");scriptNode.type="blocked/javascript";if(removeAttach)$(scriptNode).appendTo("head")};wooptpm.unblockAllScripts=function(analytics=true,ads=true){$.each($('script[type="blocked/javascript"]'),function(index,scriptNode){if($(scriptNode).data("wooptpm-cookie-category").includes("analytics")&&analytics){wooptpm.unblockScript(scriptNode,true)}else if($(scriptNode).data("wooptpm-cookie-category").includes("ads")&&ads){wooptpm.unblockScript(scriptNode,true)}})};wooptpm.unblockSelectedPixels=function(){$.each($('script[type="blocked/javascript"]'),function(index,node){if(wooptpmConsentValues.pixels.includes($(node).data("wooptpm-pixel-name"))){wooptpm.unblockScript(node,true)}else if($(node).data("wooptpm-pixel-name")==="google"&&["google-analytics","google-ads"].some(element=>wooptpmConsentValues.pixels.includes(element))){wooptpm.unblockScript(node,true)}})};wooptpm.googleConfigConditionsMet=function(type){if(wooptpmDataLayer.pixels.google.consent_mode.active){return true}else if(wooptpmConsentValues.mode==="category"){return wooptpmConsentValues.categories[type]===true}else if(wooptpmConsentValues.mode==="pixel"){return wooptpmConsentValues.pixels.includes("google-"+type)}else{return false}};wooptpm.getVisitorConsentStatusAndUpdateGoogleConsentSettings=function(google_consent_settings){if(wooptpmConsentValues.mode==="category"){if(wooptpmConsentValues.categories.analytics)google_consent_settings.analytics_storage="granted";if(wooptpmConsentValues.categories.ads)google_consent_settings.ad_storage="granted"}else if(wooptpmConsentValues.mode==="pixel"){google_consent_settings.analytics_storage=wooptpmConsentValues.pixels.includes("google-analytics")?"granted":"denied";google_consent_settings.ad_storage=wooptpmConsentValues.pixels.includes("google-ads")?"granted":"denied"}return google_consent_settings};wooptpm.updateGoogleConsentMode=function(analytics=true,ads=true){if(!window.gtag||!wooptpmDataLayer.shop.cookie_consent_mgmt.explicit_consent)return;gtag("consent","update",{analytics_storage:analytics?"granted":"denied",ad_storage:ads?"granted":"denied"})};window.addEventListener("borlabs-cookie-consent-saved",function(e){wooptpm.updateConsentCookieValues();if(wooptpmConsentValues.mode==="pixel"){wooptpm.unblockSelectedPixels();wooptpm.updateGoogleConsentMode(wooptpmConsentValues.pixels.includes("google-analytics"),wooptpmConsentValues.pixels.includes("google-ads"))}else{wooptpm.unblockAllScripts(wooptpmConsentValues.categories.analytics,wooptpmConsentValues.categories.ads);wooptpm.updateGoogleConsentMode(wooptpmConsentValues.categories.analytics,wooptpmConsentValues.categories.ads)}});window.addEventListener("CookiebotOnAccept",function(e){if(Cookiebot.consent.statistics)wooptpmConsentValues.categories.analytics=true;if(Cookiebot.consent.marketing)wooptpmConsentValues.categories.ads=true;wooptpm.unblockAllScripts(wooptpmConsentValues.categories.analytics,wooptpmConsentValues.categories.ads);wooptpm.updateGoogleConsentMode(wooptpmConsentValues.categories.analytics,wooptpmConsentValues.categories.ads)},false);window.addEventListener("CookieScriptAccept",function(e){if(e.detail.categories.includes("performance"))wooptpmConsentValues.categories.analytics=true;if(e.detail.categories.includes("targeting"))wooptpmConsentValues.categories.ads=true;wooptpm.unblockAllScripts(wooptpmConsentValues.categories.analytics,wooptpmConsentValues.categories.ads);wooptpm.updateGoogleConsentMode(wooptpmConsentValues.categories.analytics,wooptpmConsentValues.categories.ads)});window.addEventListener("CookieScriptAcceptAll",function(e){wooptpm.unblockAllScripts(true,true);wooptpm.updateGoogleConsentMode(true,true)});document.addEventListener("cmplzStatusChange",function(e){wooptpm.updateConsentCookieValues();wooptpm.unblockAllScripts(wooptpmConsentValues.categories.analytics,wooptpmConsentValues.categories.ads);wooptpm.updateGoogleConsentMode(wooptpmConsentValues.categories.analytics,wooptpmConsentValues.categories.ads)});document.addEventListener("setCookieNotice",function(e){wooptpm.updateConsentCookieValues();wooptpm.unblockAllScripts(wooptpmConsentValues.categories.analytics,wooptpmConsentValues.categories.ads);wooptpm.updateGoogleConsentMode(wooptpmConsentValues.categories.analytics,wooptpmConsentValues.categories.ads)});wooptpm.huObserver=new MutationObserver(function(mutations){mutations.forEach(({addedNodes})=>{[...addedNodes].forEach(node=>{if(node.id==="hu"){jQuery(".hu-cookies-save").on("click",function(e){wooptpm.updateConsentCookieValues();wooptpm.unblockAllScripts(wooptpmConsentValues.categories.analytics,wooptpmConsentValues.categories.ads);wooptpm.updateGoogleConsentMode(wooptpmConsentValues.categories.analytics,wooptpmConsentValues.categories.ads)})}})})});if(window.hu){wooptpm.huObserver.observe(document.documentElement||document.body,{childList:true,subtree:true})}window["wpmLoaded"]={}})(window.wooptpm=window.wooptpm||{},jQuery);jQuery(function(){wooptpm.startIntersectionObserverToWatch();wooptpm.startProductsMutationObserverToWatch();let body=jQuery("body");let products=jQuery(".products, .product");jQuery(document).on("click",".remove_from_cart_button, .remove",function(e){try{let url=new URL(jQuery(this).attr("href"));let productId=wooptpm.getProductIdByCartItemKeyUrl(url);wooptpm.removeProductFromCart(productId)}catch(e){console.log(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(wooptpmDataLayer.shop.page_type==="product"){if(typeof jQuery(this).attr("href")!=="undefined"&&jQuery(this).attr("href").includes("add-to-cart")){let quantity=1;let productId=jQuery(this).data("product_id");wooptpm.addProductToCart(productId,quantity)}else{if(wooptpmDataLayer.shop.product_type==="simple"){let quantity=Number(jQuery(".input-text.qty").val());if(!quantity&&quantity!==0)quantity=1;let productId=jQuery(this).val();wooptpm.addProductToCart(productId,quantity)}else if(wooptpmDataLayer.shop.product_type==="variable"){let quantity=Number(jQuery(".input-text.qty").val());if(!quantity&&quantity!==0)quantity=1;let productId=jQuery("[name='variation_id']").val();wooptpm.addProductToCart(productId,quantity)}else if(wooptpmDataLayer.shop.product_type==="grouped"){jQuery(".woocommerce-grouped-product-list-item").each(function(){let quantity=Number(jQuery(this).find(".input-text.qty").val());if(!quantity&&quantity!==0)quantity=1;let classes=jQuery(this).attr("class");let productId=wooptpm.getPostIdFromString(classes);wooptpm.addProductToCart(productId,quantity)})}else if(wooptpmDataLayer.shop.product_type==="bundle"){let quantity=Number(jQuery(".input-text.qty").val());if(!quantity&&quantity!==0)quantity=1;let productId=jQuery("input[name=add-to-cart]").val();wooptpm.addProductToCart(productId,quantity)}}}else{let quantity=1;let productId=jQuery(this).data("product_id");wooptpm.addProductToCart(productId,quantity)}}catch(e){console.log(e)}});jQuery(document).one("click","a:not(.add_to_cart_button, .ajax_add_to_cart, .single_add_to_cart_button)",function(event){try{if(jQuery(event.target).closest("a").attr("href")){let href=jQuery(event.target).closest("a").attr("href");if(href.includes("add-to-cart=")){let matches=href.match(/(add-to-cart=)(\d+)/);if(matches)wooptpm.addProductToCart(matches[2],1)}}}catch(e){console.log(e)}});jQuery(document).on("click",".woocommerce-LoopProduct-link, .wc-block-grid__product, .product, .product-small, .type-product",function(e){try{let productId=jQuery(this).nextAll(".wooptpmProductId:first").data("id");if(productId){productId=getIdBasedOndVariationsOutputSetting(productId);if(!productId)throw Error("Wasn't able to retrieve a productId");if(wooptpmDataLayer.products&&wooptpmDataLayer.products[productId]){let product=wooptpm.getProductDetailsFormattedForEvent(productId);jQuery(document).trigger("wooptpmSelectContentGaUa",product);jQuery(document).trigger("wooptpmSelectItem",product)}}}catch(e){console.log(e)}});jQuery(document).one("click",".checkout-button, .cart-checkout-button, .button.checkout",function(e){jQuery(document).trigger("wooptpmBeginCheckout")});let emailSelected=false;jQuery(document).on("input","#billing_email",function(){if(wooptpm.isEmail(jQuery(this).val())){wooptpm.fireCheckoutProgress(2);emailSelected=true}});let paymentMethodSelected=false;jQuery(document).on("click",".wc_payment_methods",function(){if(paymentMethodSelected===false){wooptpm.fireCheckoutProgress(3)}wooptpm.fireCheckoutOption(3,jQuery("input[name='payment_method']:checked").val());paymentMethodSelected=true});jQuery(document).one("click","#place_order",function(){if(emailSelected===false){wooptpm.fireCheckoutProgress(2)}if(paymentMethodSelected===false){wooptpm.fireCheckoutProgress(3);wooptpm.fireCheckoutOption(3,jQuery("input[name='payment_method']:checked").val())}wooptpm.fireCheckoutProgress(4)});jQuery(document).on("click","[name='update_cart']",function(e){try{jQuery(".cart_item").each(function(){let url=new URL(jQuery(this).find(".product-remove").find("a").attr("href"));let productId=wooptpm.getProductIdByCartItemKeyUrl(url);let quantity=jQuery(this).find(".qty").val();if(quantity===0){wooptpm.removeProductFromCart(productId)}else if(quantity<wooptpmDataLayer.cart[productId].quantity){wooptpm.removeProductFromCart(productId,wooptpmDataLayer.cart[productId].quantity-quantity)}else if(quantity>wooptpmDataLayer.cart[productId].quantity){wooptpm.addProductToCart(productId,quantity-wooptpmDataLayer.cart[productId].quantity)}})}catch(e){console.log(e);wooptpm.getCartItemsFromBackend()}});jQuery(".single_variation_wrap").on("show_variation",function(event,variation){try{let productId=getIdBasedOndVariationsOutputSetting(variation.variation_id);if(!productId)throw Error("Wasn't able to retrieve a productId");if(wooptpmDataLayer.products&&wooptpmDataLayer.products[productId]){let product=wooptpm.getProductDetailsFormattedForEvent(productId);jQuery(document).trigger("wooptpmViewItem",product)}}catch(e){console.log(e)}});jQuery(document).on("click",".add_to_wishlist, .wl-add-to",function(){try{let productId;if(jQuery(this).data("productid")){productId=jQuery(this).data("productid")}else if(jQuery(this).data("product-id")){productId=jQuery(this).data("product-id")}if(!productId)throw Error("Wasn't able to retrieve a productId");let product=wooptpm.getProductDetailsFormattedForEvent(productId);jQuery(document).trigger("wooptpmAddToWishlist",product)}catch(e){console.log(e)}});jQuery(document).on("updated_cart_totals",function(){jQuery(document).trigger("wooptpmViewCart")})});jQuery(document).ajaxSend(function(event,jqxhr,settings){if(settings.url.includes("get_refreshed_fragments")&&sessionStorage){if(!sessionStorage.getItem("wooptpmMiniCartActive")){sessionStorage.setItem("wooptpmMiniCartActive",JSON.stringify(true))}}});jQuery(window).on("load",function(){try{if(JSON.parse(sessionStorage.getItem("wooptpmMiniCartActive"))&&JSON.parse(sessionStorage.getItem("wooptpmFirstPageLoad"))&&wooptpmDataLayer.shop.mini_cart.track===true){wooptpm.getCartItems()}else{sessionStorage.setItem("wooptpmFirstPageLoad",JSON.stringify(true))}}catch(e){console.log(e)}});jQuery(window).on("load",function(){wooptpmDataLayer.products=wooptpmDataLayer.products||{};let productIds=wooptpm.getAddToCartLinkProductIds();wooptpm.getProductsFromBackend(productIds)});jQuery(window).on("load",function(){if(!wooptpm.getCookie("wooptpmReferrer")){if(document.referrer){let referrerUrl=new URL(document.referrer);let referrerHostname=referrerUrl.hostname;if(referrerHostname!==window.location.host){wooptpm.setCookie("wooptpmReferrer",referrerHostname)}else{wooptpm.setCookie("wooptpmReferrer","")}}else{wooptpm.setCookie("wooptpmReferrer","")}}})}).catch(function(e){console.log(e)});
languages/woocommerce-google-adwords-conversion-tracking-tag.pot CHANGED
@@ -1,20 +1,22 @@
1
- # Copyright (C) 2021 woopt
2
  # This file is distributed under the GPLv2 or later.
3
  msgid ""
4
  msgstr ""
5
- "Project-Id-Version: WooCommerce Pixel Manager 1.11.7\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: 2021-10-29T07:02:26+00:00\n"
13
  "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
14
  "X-Generator: WP-CLI 2.5.0\n"
15
  "X-Domain: woocommerce-google-adwords-conversion-tracking-tag\n"
16
 
17
  #. Plugin Name of the plugin
 
 
18
  msgid "WooCommerce Pixel Manager"
19
  msgstr ""
20
 
@@ -167,65 +169,90 @@ msgstr ""
167
  msgid "Google Consent Regions"
168
  msgstr ""
169
 
170
- #: classes/admin/class-admin.php:714
171
- msgid "Borlabs support"
172
  msgstr ""
173
 
174
- #: classes/admin/class-admin.php:727
 
 
 
 
 
175
  msgid "Cookiebot support"
176
  msgstr ""
177
 
178
- #: classes/admin/class-admin.php:760
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
179
  msgid "Facebook CAPI: token"
180
  msgstr ""
181
 
182
- #: classes/admin/class-admin.php:772
183
  msgid "Facebook CAPI: process anonymous hits"
184
  msgstr ""
185
 
186
- #: classes/admin/class-admin.php:784
187
  msgid "Facebook CAPI: send additional visitor identifiers"
188
  msgstr ""
189
 
190
- #: classes/admin/class-admin.php:796
191
  msgid "Facebook Microdata Tags for Catalogues"
192
  msgstr ""
193
 
194
- #: classes/admin/class-admin.php:809
195
- #: classes/admin/class-admin.php:822
196
- #: classes/admin/class-admin.php:869
197
  msgid "Dynamic Remarketing"
198
  msgstr ""
199
 
200
- #: classes/admin/class-admin.php:881
201
  msgid "Product Identifier"
202
  msgstr ""
203
 
204
- #: classes/admin/class-admin.php:893
205
  msgid "Variations output"
206
  msgstr ""
207
 
208
- #: classes/admin/class-admin.php:906
209
  msgid "Google Business Vertical"
210
  msgstr ""
211
 
212
- #: classes/admin/class-admin.php:920
213
- #: classes/admin/class-admin.php:929
214
  msgid "Support"
215
  msgstr ""
216
 
217
- #: classes/admin/class-admin.php:938
218
- #: classes/admin/class-admin.php:947
219
  msgid "Author"
220
  msgstr ""
221
 
222
- #: classes/admin/class-admin.php:984
223
  msgid ""
224
  "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"
225
  " In order for the plugin to work properly you need to disable the script blocker."
226
  msgstr ""
227
 
228
- #: classes/admin/class-admin.php:991
229
  #: classes/admin/class-notifications.php:25
230
  #: classes/admin/class-notifications.php:66
231
  #: classes/admin/class-notifications.php:105
@@ -233,406 +260,446 @@ msgstr ""
233
  msgid "Learn more"
234
  msgstr ""
235
 
236
- #: classes/admin/class-admin.php:1024
237
  msgid "Profit Driven Marketing by woopt"
238
  msgstr ""
239
 
240
- #: classes/admin/class-admin.php:1049
241
  msgid "Visit us here:"
242
  msgstr ""
243
 
244
- #: classes/admin/class-admin.php:1100
245
  msgid "Support contacts"
246
  msgstr ""
247
 
248
- #: classes/admin/class-admin.php:1102
249
  msgid "Use the following two resources for support: "
250
  msgstr ""
251
 
252
- #: classes/admin/class-admin.php:1109
253
  msgid "Post a support request in the WordPress support forum here: "
254
  msgstr ""
255
 
256
- #: classes/admin/class-admin.php:1113
257
  msgid "Support forum"
258
  msgstr ""
259
 
260
- #: classes/admin/class-admin.php:1118
261
  msgid "(Never post the debug or other sensitive information to the support forum. Instead send us the information by email.)"
262
  msgstr ""
263
 
264
- #: classes/admin/class-admin.php:1122
265
  msgid "Or send us an email to the following address: "
266
  msgstr ""
267
 
268
- #: classes/admin/class-admin.php:1130
269
  msgid "Translations"
270
  msgstr ""
271
 
272
- #: classes/admin/class-admin.php:1132
273
  msgid "If you want to participate improving the translations of this plugin into your language, please follow this link:"
274
  msgstr ""
275
 
276
- #: classes/admin/class-admin.php:1140
277
  msgid "Debugging information"
278
  msgstr ""
279
 
280
- #: classes/admin/class-admin.php:1151
281
  msgid "copy to clipboard"
282
  msgstr ""
283
 
284
- #: classes/admin/class-admin.php:1166
285
  msgid "More details about the developer of this plugin: "
286
  msgstr ""
287
 
288
- #: classes/admin/class-admin.php:1170
289
  msgid "Developer: woopt"
290
  msgstr ""
291
 
292
- #: classes/admin/class-admin.php:1174
293
  msgid "Website: "
294
  msgstr ""
295
 
296
- #: classes/admin/class-admin.php:1188
297
  msgid "The Google Analytics Universal property ID looks like this:"
298
  msgstr ""
299
 
300
- #: classes/admin/class-admin.php:1198
301
  msgid "The Google Analytics 4 measurement ID looks like this:"
302
  msgstr ""
303
 
304
- #: classes/admin/class-admin.php:1208
305
  msgid "The conversion ID looks similar to this:"
306
  msgstr ""
307
 
308
- #: classes/admin/class-admin.php:1218
309
  msgid "The conversion Label looks similar to this:"
310
  msgstr ""
311
 
312
- #: classes/admin/class-admin.php:1222
313
- #: classes/admin/class-admin.php:1875
314
  msgid "Requires an active Google Ads Conversion ID"
315
  msgstr ""
316
 
317
- #: classes/admin/class-admin.php:1234
318
  msgid "The Google Optimize container ID looks like this:"
319
  msgstr ""
320
 
321
- #: classes/admin/class-admin.php:1244
322
  msgid "The Facebook pixel ID looks similar to this:"
323
  msgstr ""
324
 
325
- #: classes/admin/class-admin.php:1255
326
  msgid "The Microsoft Advertising UET tag ID looks similar to this:"
327
  msgstr ""
328
 
329
- #: classes/admin/class-admin.php:1266
330
  msgid "The Twitter pixel ID looks similar to this:"
331
  msgstr ""
332
 
333
- #: classes/admin/class-admin.php:1277
334
  msgid "The Pinterest pixel ID looks similar to this:"
335
  msgstr ""
336
 
337
- #: classes/admin/class-admin.php:1288
338
  msgid "The Snapchat pixel ID looks similar to this:"
339
  msgstr ""
340
 
341
- #: classes/admin/class-admin.php:1299
342
  msgid "The TikTok pixel ID looks similar to this:"
343
  msgstr ""
344
 
345
- #: classes/admin/class-admin.php:1309
346
  msgid "The Hotjar site ID looks similar to this:"
347
  msgstr ""
348
 
349
- #: classes/admin/class-admin.php:1321
350
  msgid "Use order_subtotal: Doesn't include tax and shipping (default)"
351
  msgstr ""
352
 
353
- #: classes/admin/class-admin.php:1329
354
  msgid "Use order_total: Includes tax and shipping"
355
  msgstr ""
356
 
357
- #: classes/admin/class-admin.php:1333
358
  msgid "This is the order total amount reported back to Google Ads"
359
  msgstr ""
360
 
361
- #: classes/admin/class-admin.php:1341
362
  msgid "open the documentation"
363
  msgstr ""
364
 
365
- #: classes/admin/class-admin.php:1360
366
  msgid "Disable gtag.js insertion, if another plugin is inserting it already"
367
  msgstr ""
368
 
369
- #: classes/admin/class-admin.php:1369
370
  msgid "Only do this, if the other plugin does insert the gtag above this pixel. If not, keep the gtag active."
371
  msgstr ""
372
 
373
- #: classes/admin/class-admin.php:1374
374
  msgid "This setting is deprecated. It will be removed in future versions of the plugin. Read more about it in the documentation."
375
  msgstr ""
376
 
377
- #: classes/admin/class-admin.php:1393
378
  msgid "Enable Google consent mode with standard settings"
379
  msgstr ""
380
 
381
- #: classes/admin/class-admin.php:1431
382
  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."
383
  msgstr ""
384
 
385
- #: classes/admin/class-admin.php:1452
386
  msgid "Enable Google Analytics enhanced e-commerce"
387
  msgstr ""
388
 
389
- #: classes/admin/class-admin.php:1462
390
- #: classes/admin/class-admin.php:1517
391
- #: classes/admin/class-admin.php:1547
392
  msgid "You need to activate at least Google Analytics UA or Google Analytics 4"
393
  msgstr ""
394
 
395
- #: classes/admin/class-admin.php:1483
396
  msgid "Google Analytics 4 activation required"
397
  msgstr ""
398
 
399
- #: classes/admin/class-admin.php:1488
400
  msgid "Enhanced E-Commerce activation required"
401
  msgstr ""
402
 
403
- #: classes/admin/class-admin.php:1491
404
  msgid "If enabled, purchase and refund events will be sent to Google through the measurement protocol for increased accuracy."
405
  msgstr ""
406
 
407
- #: classes/admin/class-admin.php:1507
408
  msgid "Enable Google Analytics enhanced link attribution"
409
  msgstr ""
410
 
411
- #: classes/admin/class-admin.php:1537
412
  msgid "Enable Google user ID"
413
  msgstr ""
414
 
415
- #: classes/admin/class-admin.php:1567
416
  msgid "Enable Google Ads Enhanced Conversions"
417
  msgstr ""
418
 
419
- #: classes/admin/class-admin.php:1577
420
  msgid "You need to activate Google Ads"
421
  msgstr ""
422
 
423
- #: classes/admin/class-admin.php:1596
424
  msgid "The Google Ads phone conversion number must be in the same format as on the website."
425
  msgstr ""
426
 
427
- #: classes/admin/class-admin.php:1618
428
- msgid "Borlabs detected. Automatic support is:"
429
  msgstr ""
430
 
431
- #: classes/admin/class-admin.php:1638
 
 
 
 
432
  msgid "Enable Cookiebot settings"
433
  msgstr ""
434
 
435
- #: classes/admin/class-admin.php:1644
436
  msgid "You need to activate the Google consent mode"
437
  msgstr ""
438
 
439
- #: classes/admin/class-admin.php:1663
440
- #: classes/admin/class-admin.php:1696
441
- #: classes/admin/class-admin.php:1725
442
- #: classes/admin/class-admin.php:1753
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
443
  msgid "You need to activate the Facebook pixel"
444
  msgstr ""
445
 
446
- #: classes/admin/class-admin.php:1688
447
  msgid "Send CAPI hits for anonymous visitors who likely have blocked the Facebook pixel."
448
  msgstr ""
449
 
450
- #: classes/admin/class-admin.php:1717
451
  msgid "Include additional visitor's identifiers, such as IP address, email and shop ID in the CAPI hit."
452
  msgstr ""
453
 
454
- #: classes/admin/class-admin.php:1745
455
  msgid "Enable Facebook product microdata output"
456
  msgstr ""
457
 
458
- #: classes/admin/class-admin.php:1771
459
  msgid "Add the cart data to the conversion event"
460
  msgstr ""
461
 
462
- #: classes/admin/class-admin.php:1779
463
  msgid "Requires an active Google Ads Conversion ID, an active Conversion Label and an active Google Merchant Center ID (aw_merchant_id)"
464
  msgstr ""
465
 
466
- #: classes/admin/class-admin.php:1805
467
  msgid "Only disable order duplication prevention for testing. Remember to re-enable the setting once done."
468
  msgstr ""
469
 
470
- #: classes/admin/class-admin.php:1823
471
  msgid "Enable the maximum compatibility mode"
472
  msgstr ""
473
 
474
- #: classes/admin/class-admin.php:1835
475
  msgid "Advanced order duplication prevention is "
476
  msgstr ""
477
 
478
- #: classes/admin/class-admin.php:1837
479
  msgid "Basic order duplication prevention is "
480
  msgstr ""
481
 
482
- #: classes/admin/class-admin.php:1864
483
  msgid "Enable dynamic remarketing audience collection"
484
  msgstr ""
485
 
486
- #: classes/admin/class-admin.php:1880
487
  msgid "You need to choose the correct product identifier setting in order to match the product identifiers in the product feeds."
488
  msgstr ""
489
 
490
- #: classes/admin/class-admin.php:1899
491
  msgid "Enable variations output"
492
  msgstr ""
493
 
494
- #: classes/admin/class-admin.php:1907
495
  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."
496
  msgstr ""
497
 
498
- #: classes/admin/class-admin.php:1922
499
  msgid "Retail"
500
  msgstr ""
501
 
502
- #: classes/admin/class-admin.php:1932
503
  msgid "Education"
504
  msgstr ""
505
 
506
- #: classes/admin/class-admin.php:1942
507
  msgid "Hotels and rentals"
508
  msgstr ""
509
 
510
- #: classes/admin/class-admin.php:1952
511
  msgid "Jobs"
512
  msgstr ""
513
 
514
- #: classes/admin/class-admin.php:1962
515
  msgid "Local deals"
516
  msgstr ""
517
 
518
- #: classes/admin/class-admin.php:1972
519
  msgid "Real estate"
520
  msgstr ""
521
 
522
- #: classes/admin/class-admin.php:1982
523
  msgid "Custom"
524
  msgstr ""
525
 
526
- #: classes/admin/class-admin.php:1995
527
  msgid "ID of your Google Merchant Center account. It looks like this: 12345678"
528
  msgstr ""
529
 
530
- #: classes/admin/class-admin.php:2012
531
  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:"
532
  msgstr ""
533
 
534
- #: classes/admin/class-admin.php:2049
535
  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:"
536
  msgstr ""
537
 
538
- #: classes/admin/class-admin.php:2069
539
  msgid "post ID (default)"
540
  msgstr ""
541
 
542
- #: classes/admin/class-admin.php:2076
543
- msgid "post ID with woocommerce_gpf_ prefix *"
544
  msgstr ""
545
 
546
- #: classes/admin/class-admin.php:2084
547
- msgid "SKU"
548
  msgstr ""
549
 
550
- #: classes/admin/class-admin.php:2089
 
 
 
 
551
  msgid "Choose a product identifier."
552
  msgstr ""
553
 
554
- #: classes/admin/class-admin.php:2092
555
  msgid "* This is for users of the WooCommerce Google Product Feed Plugin"
556
  msgstr ""
557
 
558
- #: classes/admin/class-admin.php:2102
 
 
 
 
559
  msgid "beta"
560
  msgstr ""
561
 
562
- #: classes/admin/class-admin.php:2107
563
  msgid "active"
564
  msgstr ""
565
 
566
- #: classes/admin/class-admin.php:2112
567
  msgid "inactive"
568
  msgstr ""
569
 
570
- #: classes/admin/class-admin.php:2117
571
  msgid "partially active"
572
  msgstr ""
573
 
574
- #: classes/admin/class-admin.php:2125
575
  msgid "Pro Feature"
576
  msgstr ""
577
 
578
- #: classes/admin/class-admin.php:2161
579
  msgid "You have entered an invalid Google Analytics Universal property ID."
580
  msgstr ""
581
 
582
- #: classes/admin/class-admin.php:2169
583
  msgid "You have entered an invalid Google Analytics 4 measurement ID."
584
  msgstr ""
585
 
586
- #: classes/admin/class-admin.php:2177
587
  msgid "You have entered an invalid Google Analytics 4 API key."
588
  msgstr ""
589
 
590
- #: classes/admin/class-admin.php:2185
591
  msgid "You have entered an invalid conversion ID. It only contains 8 to 10 digits."
592
  msgstr ""
593
 
594
- #: classes/admin/class-admin.php:2193
595
- #: classes/admin/class-admin.php:2201
596
  msgid "You have entered an invalid conversion label."
597
  msgstr ""
598
 
599
- #: classes/admin/class-admin.php:2209
600
  msgid "You have entered an invalid merchant ID. It only contains 7 to 10 digits."
601
  msgstr ""
602
 
603
- #: classes/admin/class-admin.php:2217
604
  msgid "You have entered an invalid Google Optimize container ID."
605
  msgstr ""
606
 
607
- #: classes/admin/class-admin.php:2225
608
  msgid "You have entered an invalid Facebook pixel ID. It only contains 14 to 16 digits."
609
  msgstr ""
610
 
611
- #: classes/admin/class-admin.php:2233
612
  msgid "You have entered an invalid Facebook CAPI token."
613
  msgstr ""
614
 
615
- #: classes/admin/class-admin.php:2241
616
  msgid "You have entered an invalid Bing Ads UET tag ID. It only contains 7 to 9 digits."
617
  msgstr ""
618
 
619
- #: classes/admin/class-admin.php:2249
620
  msgid "You have entered an invalid Twitter pixel ID. It only contains 5 to 7 lowercase letters and numbers."
621
  msgstr ""
622
 
623
- #: classes/admin/class-admin.php:2257
624
  msgid "You have entered an invalid Pinterest pixel ID. It only contains 13 digits."
625
  msgstr ""
626
 
627
- #: classes/admin/class-admin.php:2265
628
  msgid "You have entered an invalid Snapchat pixel ID."
629
  msgstr ""
630
 
631
- #: classes/admin/class-admin.php:2273
632
  msgid "You have entered an invalid TikTok pixel ID."
633
  msgstr ""
634
 
635
- #: classes/admin/class-admin.php:2281
636
  msgid "You have entered an invalid Hotjar site ID. It only contains 6 to 9 digits."
637
  msgstr ""
638
 
@@ -728,3 +795,15 @@ msgstr ""
728
  #: classes/admin/class-notifications.php:150
729
  msgid "Find more information about the the reason in our documentation: "
730
  msgstr ""
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Copyright (C) 2022 woopt
2
  # This file is distributed under the GPLv2 or later.
3
  msgid ""
4
  msgstr ""
5
+ "Project-Id-Version: WooCommerce Pixel Manager 1.12.4\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-01-11T08:45:21+00:00\n"
13
  "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
14
  "X-Generator: WP-CLI 2.5.0\n"
15
  "X-Domain: woocommerce-google-adwords-conversion-tracking-tag\n"
16
 
17
  #. Plugin Name of the plugin
18
+ #: wgact.php:119
19
+ #: wgact.php:120
20
  msgid "WooCommerce Pixel Manager"
21
  msgstr ""
22
 
169
  msgid "Google Consent Regions"
170
  msgstr ""
171
 
172
+ #: classes/admin/class-admin.php:713
173
+ msgid "Explicit Consent Mode"
174
  msgstr ""
175
 
176
+ #: classes/admin/class-admin.php:726
177
+ msgid "Borlabs Cookie support"
178
+ msgstr ""
179
+
180
+ #: classes/admin/class-admin.php:740
181
+ #: classes/admin/class-admin.php:754
182
  msgid "Cookiebot support"
183
  msgstr ""
184
 
185
+ #: classes/admin/class-admin.php:768
186
+ msgid "Complianz GDPR support"
187
+ msgstr ""
188
+
189
+ #: classes/admin/class-admin.php:782
190
+ msgid "Cookie Notice support"
191
+ msgstr ""
192
+
193
+ #: classes/admin/class-admin.php:796
194
+ msgid "Cookie Script support"
195
+ msgstr ""
196
+
197
+ #: classes/admin/class-admin.php:810
198
+ msgid "GDPR Cookie Compliance support"
199
+ msgstr ""
200
+
201
+ #: classes/admin/class-admin.php:824
202
+ msgid "GDPR Cookie Consent support"
203
+ msgstr ""
204
+
205
+ #: classes/admin/class-admin.php:858
206
  msgid "Facebook CAPI: token"
207
  msgstr ""
208
 
209
+ #: classes/admin/class-admin.php:870
210
  msgid "Facebook CAPI: process anonymous hits"
211
  msgstr ""
212
 
213
+ #: classes/admin/class-admin.php:882
214
  msgid "Facebook CAPI: send additional visitor identifiers"
215
  msgstr ""
216
 
217
+ #: classes/admin/class-admin.php:894
218
  msgid "Facebook Microdata Tags for Catalogues"
219
  msgstr ""
220
 
221
+ #: classes/admin/class-admin.php:907
222
+ #: classes/admin/class-admin.php:920
223
+ #: classes/admin/class-admin.php:967
224
  msgid "Dynamic Remarketing"
225
  msgstr ""
226
 
227
+ #: classes/admin/class-admin.php:979
228
  msgid "Product Identifier"
229
  msgstr ""
230
 
231
+ #: classes/admin/class-admin.php:991
232
  msgid "Variations output"
233
  msgstr ""
234
 
235
+ #: classes/admin/class-admin.php:1004
236
  msgid "Google Business Vertical"
237
  msgstr ""
238
 
239
+ #: classes/admin/class-admin.php:1018
240
+ #: classes/admin/class-admin.php:1027
241
  msgid "Support"
242
  msgstr ""
243
 
244
+ #: classes/admin/class-admin.php:1036
245
+ #: classes/admin/class-admin.php:1045
246
  msgid "Author"
247
  msgstr ""
248
 
249
+ #: classes/admin/class-admin.php:1082
250
  msgid ""
251
  "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"
252
  " In order for the plugin to work properly you need to disable the script blocker."
253
  msgstr ""
254
 
255
+ #: classes/admin/class-admin.php:1089
256
  #: classes/admin/class-notifications.php:25
257
  #: classes/admin/class-notifications.php:66
258
  #: classes/admin/class-notifications.php:105
260
  msgid "Learn more"
261
  msgstr ""
262
 
263
+ #: classes/admin/class-admin.php:1122
264
  msgid "Profit Driven Marketing by woopt"
265
  msgstr ""
266
 
267
+ #: classes/admin/class-admin.php:1147
268
  msgid "Visit us here:"
269
  msgstr ""
270
 
271
+ #: classes/admin/class-admin.php:1198
272
  msgid "Support contacts"
273
  msgstr ""
274
 
275
+ #: classes/admin/class-admin.php:1200
276
  msgid "Use the following two resources for support: "
277
  msgstr ""
278
 
279
+ #: classes/admin/class-admin.php:1207
280
  msgid "Post a support request in the WordPress support forum here: "
281
  msgstr ""
282
 
283
+ #: classes/admin/class-admin.php:1211
284
  msgid "Support forum"
285
  msgstr ""
286
 
287
+ #: classes/admin/class-admin.php:1216
288
  msgid "(Never post the debug or other sensitive information to the support forum. Instead send us the information by email.)"
289
  msgstr ""
290
 
291
+ #: classes/admin/class-admin.php:1220
292
  msgid "Or send us an email to the following address: "
293
  msgstr ""
294
 
295
+ #: classes/admin/class-admin.php:1228
296
  msgid "Translations"
297
  msgstr ""
298
 
299
+ #: classes/admin/class-admin.php:1230
300
  msgid "If you want to participate improving the translations of this plugin into your language, please follow this link:"
301
  msgstr ""
302
 
303
+ #: classes/admin/class-admin.php:1238
304
  msgid "Debugging information"
305
  msgstr ""
306
 
307
+ #: classes/admin/class-admin.php:1249
308
  msgid "copy to clipboard"
309
  msgstr ""
310
 
311
+ #: classes/admin/class-admin.php:1264
312
  msgid "More details about the developer of this plugin: "
313
  msgstr ""
314
 
315
+ #: classes/admin/class-admin.php:1268
316
  msgid "Developer: woopt"
317
  msgstr ""
318
 
319
+ #: classes/admin/class-admin.php:1272
320
  msgid "Website: "
321
  msgstr ""
322
 
323
+ #: classes/admin/class-admin.php:1286
324
  msgid "The Google Analytics Universal property ID looks like this:"
325
  msgstr ""
326
 
327
+ #: classes/admin/class-admin.php:1296
328
  msgid "The Google Analytics 4 measurement ID looks like this:"
329
  msgstr ""
330
 
331
+ #: classes/admin/class-admin.php:1306
332
  msgid "The conversion ID looks similar to this:"
333
  msgstr ""
334
 
335
+ #: classes/admin/class-admin.php:1316
336
  msgid "The conversion Label looks similar to this:"
337
  msgstr ""
338
 
339
+ #: classes/admin/class-admin.php:1320
340
+ #: classes/admin/class-admin.php:2042
341
  msgid "Requires an active Google Ads Conversion ID"
342
  msgstr ""
343
 
344
+ #: classes/admin/class-admin.php:1332
345
  msgid "The Google Optimize container ID looks like this:"
346
  msgstr ""
347
 
348
+ #: classes/admin/class-admin.php:1342
349
  msgid "The Facebook pixel ID looks similar to this:"
350
  msgstr ""
351
 
352
+ #: classes/admin/class-admin.php:1353
353
  msgid "The Microsoft Advertising UET tag ID looks similar to this:"
354
  msgstr ""
355
 
356
+ #: classes/admin/class-admin.php:1364
357
  msgid "The Twitter pixel ID looks similar to this:"
358
  msgstr ""
359
 
360
+ #: classes/admin/class-admin.php:1375
361
  msgid "The Pinterest pixel ID looks similar to this:"
362
  msgstr ""
363
 
364
+ #: classes/admin/class-admin.php:1386
365
  msgid "The Snapchat pixel ID looks similar to this:"
366
  msgstr ""
367
 
368
+ #: classes/admin/class-admin.php:1397
369
  msgid "The TikTok pixel ID looks similar to this:"
370
  msgstr ""
371
 
372
+ #: classes/admin/class-admin.php:1407
373
  msgid "The Hotjar site ID looks similar to this:"
374
  msgstr ""
375
 
376
+ #: classes/admin/class-admin.php:1419
377
  msgid "Use order_subtotal: Doesn't include tax and shipping (default)"
378
  msgstr ""
379
 
380
+ #: classes/admin/class-admin.php:1427
381
  msgid "Use order_total: Includes tax and shipping"
382
  msgstr ""
383
 
384
+ #: classes/admin/class-admin.php:1431
385
  msgid "This is the order total amount reported back to Google Ads"
386
  msgstr ""
387
 
388
+ #: classes/admin/class-admin.php:1439
389
  msgid "open the documentation"
390
  msgstr ""
391
 
392
+ #: classes/admin/class-admin.php:1458
393
  msgid "Disable gtag.js insertion, if another plugin is inserting it already"
394
  msgstr ""
395
 
396
+ #: classes/admin/class-admin.php:1467
397
  msgid "Only do this, if the other plugin does insert the gtag above this pixel. If not, keep the gtag active."
398
  msgstr ""
399
 
400
+ #: classes/admin/class-admin.php:1472
401
  msgid "This setting is deprecated. It will be removed in future versions of the plugin. Read more about it in the documentation."
402
  msgstr ""
403
 
404
+ #: classes/admin/class-admin.php:1491
405
  msgid "Enable Google consent mode with standard settings"
406
  msgstr ""
407
 
408
+ #: classes/admin/class-admin.php:1529
409
  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."
410
  msgstr ""
411
 
412
+ #: classes/admin/class-admin.php:1550
413
  msgid "Enable Google Analytics enhanced e-commerce"
414
  msgstr ""
415
 
416
+ #: classes/admin/class-admin.php:1560
417
+ #: classes/admin/class-admin.php:1615
418
+ #: classes/admin/class-admin.php:1645
419
  msgid "You need to activate at least Google Analytics UA or Google Analytics 4"
420
  msgstr ""
421
 
422
+ #: classes/admin/class-admin.php:1581
423
  msgid "Google Analytics 4 activation required"
424
  msgstr ""
425
 
426
+ #: classes/admin/class-admin.php:1586
427
  msgid "Enhanced E-Commerce activation required"
428
  msgstr ""
429
 
430
+ #: classes/admin/class-admin.php:1589
431
  msgid "If enabled, purchase and refund events will be sent to Google through the measurement protocol for increased accuracy."
432
  msgstr ""
433
 
434
+ #: classes/admin/class-admin.php:1605
435
  msgid "Enable Google Analytics enhanced link attribution"
436
  msgstr ""
437
 
438
+ #: classes/admin/class-admin.php:1635
439
  msgid "Enable Google user ID"
440
  msgstr ""
441
 
442
+ #: classes/admin/class-admin.php:1665
443
  msgid "Enable Google Ads Enhanced Conversions"
444
  msgstr ""
445
 
446
+ #: classes/admin/class-admin.php:1675
447
  msgid "You need to activate Google Ads"
448
  msgstr ""
449
 
450
+ #: classes/admin/class-admin.php:1694
451
  msgid "The Google Ads phone conversion number must be in the same format as on the website."
452
  msgstr ""
453
 
454
+ #: classes/admin/class-admin.php:1716
455
+ msgid "Borlabs Cookie detected. Automatic support is:"
456
  msgstr ""
457
 
458
+ #: classes/admin/class-admin.php:1723
459
+ msgid "Cookiebot detected. Automatic support is:"
460
+ msgstr ""
461
+
462
+ #: classes/admin/class-admin.php:1743
463
  msgid "Enable Cookiebot settings"
464
  msgstr ""
465
 
466
+ #: classes/admin/class-admin.php:1749
467
  msgid "You need to activate the Google consent mode"
468
  msgstr ""
469
 
470
+ #: classes/admin/class-admin.php:1756
471
+ msgid "Complianz GDPR detected. Automatic support is:"
472
+ msgstr ""
473
+
474
+ #: classes/admin/class-admin.php:1763
475
+ msgid "Cookie Notice (by hu-manity.co) detected. Automatic support is:"
476
+ msgstr ""
477
+
478
+ #: classes/admin/class-admin.php:1770
479
+ msgid "Cookie Script (by cookie-script.com) detected. Automatic support is:"
480
+ msgstr ""
481
+
482
+ #: classes/admin/class-admin.php:1777
483
+ msgid "GDPR Cookie Compliance (by Moove Agency) detected. Automatic support is:"
484
+ msgstr ""
485
+
486
+ #: classes/admin/class-admin.php:1784
487
+ msgid "GDPR Cookie Consent (by WebToffee) detected. Automatic support is:"
488
+ msgstr ""
489
+
490
+ #: classes/admin/class-admin.php:1804
491
+ msgid "Enable Explicit Consent Mode"
492
+ msgstr ""
493
+
494
+ #: classes/admin/class-admin.php:1811
495
+ 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."
496
+ msgstr ""
497
+
498
+ #: classes/admin/class-admin.php:1830
499
+ #: classes/admin/class-admin.php:1863
500
+ #: classes/admin/class-admin.php:1892
501
+ #: classes/admin/class-admin.php:1920
502
  msgid "You need to activate the Facebook pixel"
503
  msgstr ""
504
 
505
+ #: classes/admin/class-admin.php:1855
506
  msgid "Send CAPI hits for anonymous visitors who likely have blocked the Facebook pixel."
507
  msgstr ""
508
 
509
+ #: classes/admin/class-admin.php:1884
510
  msgid "Include additional visitor's identifiers, such as IP address, email and shop ID in the CAPI hit."
511
  msgstr ""
512
 
513
+ #: classes/admin/class-admin.php:1912
514
  msgid "Enable Facebook product microdata output"
515
  msgstr ""
516
 
517
+ #: classes/admin/class-admin.php:1938
518
  msgid "Add the cart data to the conversion event"
519
  msgstr ""
520
 
521
+ #: classes/admin/class-admin.php:1946
522
  msgid "Requires an active Google Ads Conversion ID, an active Conversion Label and an active Google Merchant Center ID (aw_merchant_id)"
523
  msgstr ""
524
 
525
+ #: classes/admin/class-admin.php:1972
526
  msgid "Only disable order duplication prevention for testing. Remember to re-enable the setting once done."
527
  msgstr ""
528
 
529
+ #: classes/admin/class-admin.php:1990
530
  msgid "Enable the maximum compatibility mode"
531
  msgstr ""
532
 
533
+ #: classes/admin/class-admin.php:2002
534
  msgid "Advanced order duplication prevention is "
535
  msgstr ""
536
 
537
+ #: classes/admin/class-admin.php:2004
538
  msgid "Basic order duplication prevention is "
539
  msgstr ""
540
 
541
+ #: classes/admin/class-admin.php:2031
542
  msgid "Enable dynamic remarketing audience collection"
543
  msgstr ""
544
 
545
+ #: classes/admin/class-admin.php:2047
546
  msgid "You need to choose the correct product identifier setting in order to match the product identifiers in the product feeds."
547
  msgstr ""
548
 
549
+ #: classes/admin/class-admin.php:2066
550
  msgid "Enable variations output"
551
  msgstr ""
552
 
553
+ #: classes/admin/class-admin.php:2074
554
  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."
555
  msgstr ""
556
 
557
+ #: classes/admin/class-admin.php:2089
558
  msgid "Retail"
559
  msgstr ""
560
 
561
+ #: classes/admin/class-admin.php:2099
562
  msgid "Education"
563
  msgstr ""
564
 
565
+ #: classes/admin/class-admin.php:2109
566
  msgid "Hotels and rentals"
567
  msgstr ""
568
 
569
+ #: classes/admin/class-admin.php:2119
570
  msgid "Jobs"
571
  msgstr ""
572
 
573
+ #: classes/admin/class-admin.php:2129
574
  msgid "Local deals"
575
  msgstr ""
576
 
577
+ #: classes/admin/class-admin.php:2139
578
  msgid "Real estate"
579
  msgstr ""
580
 
581
+ #: classes/admin/class-admin.php:2149
582
  msgid "Custom"
583
  msgstr ""
584
 
585
+ #: classes/admin/class-admin.php:2162
586
  msgid "ID of your Google Merchant Center account. It looks like this: 12345678"
587
  msgstr ""
588
 
589
+ #: classes/admin/class-admin.php:2179
590
  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:"
591
  msgstr ""
592
 
593
+ #: classes/admin/class-admin.php:2216
594
  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:"
595
  msgstr ""
596
 
597
+ #: classes/admin/class-admin.php:2236
598
  msgid "post ID (default)"
599
  msgstr ""
600
 
601
+ #: classes/admin/class-admin.php:2243
602
+ msgid "SKU"
603
  msgstr ""
604
 
605
+ #: classes/admin/class-admin.php:2251
606
+ msgid "ID for the WooCommerce Google Product Feed. Outputs the post ID with woocommerce_gpf_ prefix *"
607
  msgstr ""
608
 
609
+ #: classes/admin/class-admin.php:2259
610
+ msgid "ID for the WooCommerce Google Listings & Ads Plugin. Outputs the post ID with gla_ prefix **"
611
+ msgstr ""
612
+
613
+ #: classes/admin/class-admin.php:2263
614
  msgid "Choose a product identifier."
615
  msgstr ""
616
 
617
+ #: classes/admin/class-admin.php:2267
618
  msgid "* This is for users of the WooCommerce Google Product Feed Plugin"
619
  msgstr ""
620
 
621
+ #: classes/admin/class-admin.php:2272
622
+ msgid "** This is for users of the WooCommerce Google Listings & Ads Plugin"
623
+ msgstr ""
624
+
625
+ #: classes/admin/class-admin.php:2282
626
  msgid "beta"
627
  msgstr ""
628
 
629
+ #: classes/admin/class-admin.php:2287
630
  msgid "active"
631
  msgstr ""
632
 
633
+ #: classes/admin/class-admin.php:2292
634
  msgid "inactive"
635
  msgstr ""
636
 
637
+ #: classes/admin/class-admin.php:2297
638
  msgid "partially active"
639
  msgstr ""
640
 
641
+ #: classes/admin/class-admin.php:2305
642
  msgid "Pro Feature"
643
  msgstr ""
644
 
645
+ #: classes/admin/class-admin.php:2341
646
  msgid "You have entered an invalid Google Analytics Universal property ID."
647
  msgstr ""
648
 
649
+ #: classes/admin/class-admin.php:2349
650
  msgid "You have entered an invalid Google Analytics 4 measurement ID."
651
  msgstr ""
652
 
653
+ #: classes/admin/class-admin.php:2357
654
  msgid "You have entered an invalid Google Analytics 4 API key."
655
  msgstr ""
656
 
657
+ #: classes/admin/class-admin.php:2365
658
  msgid "You have entered an invalid conversion ID. It only contains 8 to 10 digits."
659
  msgstr ""
660
 
661
+ #: classes/admin/class-admin.php:2373
662
+ #: classes/admin/class-admin.php:2381
663
  msgid "You have entered an invalid conversion label."
664
  msgstr ""
665
 
666
+ #: classes/admin/class-admin.php:2389
667
  msgid "You have entered an invalid merchant ID. It only contains 7 to 10 digits."
668
  msgstr ""
669
 
670
+ #: classes/admin/class-admin.php:2397
671
  msgid "You have entered an invalid Google Optimize container ID."
672
  msgstr ""
673
 
674
+ #: classes/admin/class-admin.php:2405
675
  msgid "You have entered an invalid Facebook pixel ID. It only contains 14 to 16 digits."
676
  msgstr ""
677
 
678
+ #: classes/admin/class-admin.php:2413
679
  msgid "You have entered an invalid Facebook CAPI token."
680
  msgstr ""
681
 
682
+ #: classes/admin/class-admin.php:2421
683
  msgid "You have entered an invalid Bing Ads UET tag ID. It only contains 7 to 9 digits."
684
  msgstr ""
685
 
686
+ #: classes/admin/class-admin.php:2429
687
  msgid "You have entered an invalid Twitter pixel ID. It only contains 5 to 7 lowercase letters and numbers."
688
  msgstr ""
689
 
690
+ #: classes/admin/class-admin.php:2437
691
  msgid "You have entered an invalid Pinterest pixel ID. It only contains 13 digits."
692
  msgstr ""
693
 
694
+ #: classes/admin/class-admin.php:2445
695
  msgid "You have entered an invalid Snapchat pixel ID."
696
  msgstr ""
697
 
698
+ #: classes/admin/class-admin.php:2453
699
  msgid "You have entered an invalid TikTok pixel ID."
700
  msgstr ""
701
 
702
+ #: classes/admin/class-admin.php:2461
703
  msgid "You have entered an invalid Hotjar site ID. It only contains 6 to 9 digits."
704
  msgstr ""
705
 
795
  #: classes/admin/class-notifications.php:150
796
  msgid "Find more information about the the reason in our documentation: "
797
  msgstr ""
798
+
799
+ #: wgact.php:136
800
+ msgid "WooCommerce Pixel Manager error"
801
+ msgstr ""
802
+
803
+ #: wgact.php:138
804
+ msgid "Your environment doesn't meet all the system requirements listed below."
805
+ msgstr ""
806
+
807
+ #: wgact.php:142
808
+ msgid "The WooCommerce plugin needs to be activated"
809
+ msgstr ""
readme.txt CHANGED
@@ -3,8 +3,8 @@ Contributors: alekv, woopt, 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.8
6
- Requires PHP: 7.2
7
- Stable tag: 1.11.7
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -168,7 +168,7 @@ Our plugin injects tracking pixels on the front end of WooCommerce shops. As a c
168
 
169
  Unfortunately there is no way for us to generally approve our scripts in all blockers for the WooCommerce back end.
170
 
171
- Therefore we recommend admins of the shop to exclude their own shop from the blocker in their browser.
172
 
173
  = Where can I report a bug or suggest improvements? =
174
 
@@ -181,7 +181,44 @@ You can send the link to the front page of your shop too if you think it would b
181
 
182
  == Changelog ==
183
 
184
- = 1.11.7 = XX.XX.2021
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
185
 
186
 
187
 
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.8
6
+ Requires PHP: 7.3
7
+ Stable tag: 1.12.4
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
168
 
169
  Unfortunately there is no way for us to generally approve our scripts in all blockers for the WooCommerce back end.
170
 
171
+ Therefore, we recommend admins of the shop to exclude their own shop from the blocker in their browser.
172
 
173
  = Where can I report a bug or suggest improvements? =
174
 
181
 
182
  == Changelog ==
183
 
184
+ = 1.12.4 = 11.01.2022
185
+
186
+ Tweak: Removed some unnecessary console.log outputs
187
+ Tweak: Added a safeguard when flushing Flying Press Cache
188
+ Tweak: Added support output for various CMPs into the admin pages
189
+ Tweak: Added more safeguards in case on the purchase confirmation page the order can't be retrieved through query vars
190
+ Tweak: A few improvements how to read out cookies for various CMPs
191
+ Tweak: Improved gtag firing based on cookie consent
192
+ Tweak: Improvements to read out of Cookie Script consent cookie
193
+ Tweak: Improvements to read out of Cookiebot consent cookie
194
+
195
+ = 1.12.3 = 04.01.2022
196
+
197
+ Fix: Deliver proper updated wooptpm.js
198
+
199
+ = 1.12.2 = 03.01.2022
200
+
201
+ Tweak: Added automatic improvements for users of the Optimocha Speed Booster Pack plugin
202
+ Tweak: Added automatic improvements for users of the Async JavaScript plugin
203
+ Tweak: Added automatic improvements for users of the Flying Press plugin
204
+ Tweak: Added a few console warnings if wooptpm scripts are being deferred
205
+ Fix: Fixed a bug that appeared when a shop was using the "Complianz | GDPR/CCPA Cookie Consent" consent management plugin
206
+
207
+ = 1.12.1 = 02.01.2022
208
+
209
+ Tweak: Added back the cookie prevention filter and included a deprecation notice
210
+ Fix: Fixed a bug that appeared when a shop was using the "CookieYes, GDPR Cookie Consent (Cookie Law Info)" consent management plugin
211
+
212
+ = 1.12.0 = 31.12.2021
213
+
214
+ New: Added dynamic remarketing ID output for the WooCommerce Google Listings & Ads plugin
215
+
216
+ Tweak: Bumped up minimum PHP version to 7.3
217
+ Tweak: Much more cache friendly handling of Cookie Consent Platforms
218
+ Tweak: Added support for several more Cookie Consent Platforms
219
+ Tweak: Properly handle error if WooCommerce is not active
220
+
221
+ = 1.11.7 = 29.10.2021
222
 
223
 
224
 
wgact.php CHANGED
@@ -5,11 +5,11 @@
5
  * Author: woopt
6
  * Plugin URI: https://wordpress.org/plugins/woocommerce-google-adwords-conversion-tracking-tag/
7
  * Author URI: https://woopt.com
8
- * Version: 1.11.7
9
  * License: GPLv2 or later
10
  * Text Domain: woocommerce-google-adwords-conversion-tracking-tag
11
  * WC requires at least: 3.7
12
- * WC tested up to: 5.5
13
  *
14
  *
15
  **/
@@ -50,7 +50,8 @@ class WGACT
50
  // check if WooCommerce is running
51
  // currently this is the most reliable test for single and multisite setups
52
  include_once(ABSPATH . 'wp-admin/includes/plugin.php');
53
- if (is_plugin_active('woocommerce/woocommerce.php')) {
 
54
 
55
  // autoloader
56
  require_once 'lib/autoload.php';
@@ -94,9 +95,61 @@ class WGACT
94
  register_deactivation_hook(__FILE__, [$this, 'plugin_deactivated']);
95
 
96
  $this->init();
 
 
 
 
97
  }
98
  }
99
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
100
  public function plugin_activated()
101
  {
102
  $this->environment_check->flush_cache_of_all_cache_plugins();
@@ -147,20 +200,27 @@ class WGACT
147
  add_filter('plugin_action_links_' . plugin_basename(__FILE__), [$this, 'wgact_settings_link']);
148
 
149
  // inject pixels into front end
150
- // in order to time it correctly so that the prevention filter works we need to use the after_setup_theme action
151
- // https://stackoverflow.com/a/19279650
152
  add_action('after_setup_theme', [$this, 'inject_pixels']);
153
  }
154
 
155
  public function inject_pixels()
156
  {
157
- // check if cookie prevention has been activated
158
-
159
- // load the cookie consent management functions
160
- $cookie_consent = new Cookie_Consent_Management();
161
- $cookie_consent->set_plugin_prefix(WOOPTPM_PLUGIN_PREFIX);
162
-
163
- if ($cookie_consent->is_cookie_prevention_active() == false) {
 
 
 
 
 
 
 
 
 
164
 
165
  // inject pixels
166
  new Pixel_Manager($this->options);
5
  * Author: woopt
6
  * Plugin URI: https://wordpress.org/plugins/woocommerce-google-adwords-conversion-tracking-tag/
7
  * Author URI: https://woopt.com
8
+ * Version: 1.12.4
9
  * License: GPLv2 or later
10
  * Text Domain: woocommerce-google-adwords-conversion-tracking-tag
11
  * WC requires at least: 3.7
12
+ * WC tested up to: 6.0
13
  *
14
  *
15
  **/
50
  // check if WooCommerce is running
51
  // currently this is the most reliable test for single and multisite setups
52
  include_once(ABSPATH . 'wp-admin/includes/plugin.php');
53
+
54
+ if ($this->are_requirements_met()) {
55
 
56
  // autoloader
57
  require_once 'lib/autoload.php';
95
  register_deactivation_hook(__FILE__, [$this, 'plugin_deactivated']);
96
 
97
  $this->init();
98
+ } else {
99
+ add_action('admin_menu', [$this, 'add_empty_admin_page'], 99);
100
+ add_action('admin_notices', [$this, 'requirements_error']);
101
+ error_log('The WooCommerce Pixel Manager requires the WooCommerce plugin to be active.');
102
  }
103
  }
104
 
105
+ private function are_requirements_met(): bool
106
+ {
107
+ if (is_plugin_active('woocommerce/woocommerce.php')) {
108
+ return true;
109
+ } else {
110
+ return false;
111
+ }
112
+ }
113
+
114
+ public function add_empty_admin_page()
115
+ {
116
+ add_submenu_page(
117
+ 'woocommerce',
118
+ esc_html__('WooCommerce Pixel Manager', 'woocommerce-google-adwords-conversion-tracking-tag'),
119
+ esc_html__('WooCommerce Pixel Manager', 'woocommerce-google-adwords-conversion-tracking-tag'),
120
+ 'manage_options',
121
+ 'wgact',
122
+ function () {
123
+ }
124
+ );
125
+ }
126
+
127
+ // https://github.com/iandunn/WordPress-Plugin-Skeleton/blob/master/views/requirements-error.php
128
+ public function requirements_error()
129
+ {
130
+ ?>
131
+
132
+ <div class="error">
133
+ <p>
134
+ <strong>
135
+ <?php esc_html_e("WooCommerce Pixel Manager error", 'woocommerce-google-adwords-conversion-tracking-tag') ?>
136
+ </strong>:
137
+ <?php esc_html_e("Your environment doesn't meet all the system requirements listed below.", 'woocommerce-google-adwords-conversion-tracking-tag') ?>
138
+ </p>
139
+
140
+ <ul class="ul-disc">
141
+ <li><?php esc_html_e("The WooCommerce plugin needs to be activated", 'woocommerce-google-adwords-conversion-tracking-tag') ?></li>
142
+ </ul>
143
+ </div>
144
+ <style>
145
+ .fs-tab {
146
+ display: none !important;
147
+ }
148
+ </style>
149
+
150
+ <?php
151
+ }
152
+
153
  public function plugin_activated()
154
  {
155
  $this->environment_check->flush_cache_of_all_cache_plugins();
200
  add_filter('plugin_action_links_' . plugin_basename(__FILE__), [$this, 'wgact_settings_link']);
201
 
202
  // inject pixels into front end
 
 
203
  add_action('after_setup_theme', [$this, 'inject_pixels']);
204
  }
205
 
206
  public function inject_pixels()
207
  {
208
+ // TODO Remove the cookie prevention filters by January 2023
209
+ $cookie_prevention = apply_filters_deprecated(
210
+ 'wgact_cookie_prevention',
211
+ [false],
212
+ '1.10.4',
213
+ 'wooptpm_cookie_prevention'
214
+ );
215
+
216
+ $cookie_prevention = apply_filters_deprecated(
217
+ 'wooptpm_cookie_prevention', [$cookie_prevention],
218
+ '1.12.1',
219
+ '',
220
+ 'This filter has been replaced by a much more robust cookie consent handing in the plugin. Please read more about it in the documentation.'
221
+ );
222
+
223
+ if ($cookie_prevention === false) {
224
 
225
  // inject pixels
226
  new Pixel_Manager($this->options);