Version Description
15.03.2022
- Experiment: Added experimental filter which defers the WPM script. The filter may be removed without prior notice. If you like the filter vote it up over here: https://app.loopedin.io/woocommerce-pixel-manager?card=622f4ba9d0b938002e8378c0
- Experiment: Added experimental filter which moves the WPM script to the footer. The filter may be removed without prior notice. If you like the filter vote it up over here: https://app.loopedin.io/woocommerce-pixel-manager?card=622f4bc2d0b938002e8378e2
- Tweak: Moved sourcemaps into correct folder
- Tweak: Moved parts of the back-end logic to the front-end in order to gain much more flexibility and better handle front-end script flow
- Tweak: Bumped up WC version
Download this release
Release Info
Developer | alekv |
Plugin | Pixel Manager for WooCommerce – Track Google Analytics, Google Ads, Facebook and more |
Version | 1.15.0 |
Comparing to | |
See all releases |
Code changes from version 1.16.6 to 1.15.0
- classes/admin/class-admin.php +214 -88
- classes/admin/class-ask-for-rating.php +2 -2
- classes/admin/class-environment-check.php +94 -181
- classes/admin/class-notifications.php +2 -2
- classes/class-default-options.php +13 -49
- classes/pixels/class-cookie-consent-management.php +2 -2
- classes/pixels/class-pixel-manager.php +58 -34
- classes/pixels/class-pixel.php +6 -0
- classes/pixels/class-script-manager.php +13 -17
- classes/pixels/class-shortcodes.php +54 -57
- classes/pixels/google/class-google-analytics-refund.php +1 -0
- classes/pixels/google/class-google-pixel-manager.php +9 -14
- classes/pixels/google/class-google.php +16 -398
- classes/pixels/google/trait-google.php +61 -54
- classes/pixels/trait-product.php +61 -41
- classes/pixels/trait-shop.php +376 -282
- css/admin.css +2 -2
- js/admin/wpm-admin-freemius.p1.min.js +1 -1
- js/admin/wpm-admin-freemius.p1.min.js.map +1 -1
- js/admin/wpm-admin.p1.min.js +1 -1
- js/admin/wpm-admin.p1.min.js.map +1 -1
- js/public/facebook.js +307 -0
- js/public/google-ads.js +305 -0
- js/public/google-ga-4.js +83 -0
- js/public/google-ga-ua.js +89 -0
- js/public/google-optimize.js +34 -0
- js/public/google.js +279 -0
- js/public/hotjar.js +39 -0
- js/public/main-free.js +27 -0
- js/public/main-premium.js +57 -0
- js/public/main.js +33 -0
- js/public/wpm-loader.js +17 -0
- js/public/wpm-public.p1.min.js +1 -1
- js/public/wpm-public.p1.min.js.map +1 -1
- js/public/wpm-public__premium_only.p1.min.js +2 -0
- js/public/wpm-public__premium_only.p1.min.js.map +1 -0
- js/public/wpm.js +1905 -0
- languages/woocommerce-google-adwords-conversion-tracking-tag.pot +188 -161
classes/admin/class-admin.php
CHANGED
@@ -1,10 +1,13 @@
|
|
1 |
<?php
|
2 |
|
3 |
// TODO move script for copying debug info into a proper .js enqueued file, or switch tabs to JavaScript switching and always save all settings at the same time
|
|
|
4 |
namespace WCPM\Classes\Admin;
|
5 |
|
6 |
-
use
|
|
|
7 |
use WCPM\Classes\Pixels\Trait_Shop ;
|
|
|
8 |
|
9 |
if ( !defined( 'ABSPATH' ) ) {
|
10 |
exit;
|
@@ -13,6 +16,7 @@ if ( !defined( 'ABSPATH' ) ) {
|
|
13 |
|
14 |
class Admin
|
15 |
{
|
|
|
16 |
use Trait_Shop ;
|
17 |
public $ip ;
|
18 |
protected $text_domain ;
|
@@ -21,13 +25,11 @@ class Admin
|
|
21 |
protected $documentation ;
|
22 |
private $consent_mode_regions ;
|
23 |
private $validations ;
|
24 |
-
private $google ;
|
25 |
public function __construct( $options )
|
26 |
{
|
27 |
$this->options = $options;
|
28 |
$this->plugin_hook = 'woocommerce_page_wpm';
|
29 |
$this->documentation = new Documentation();
|
30 |
-
$this->google = new Google( $this->options );
|
31 |
add_action( 'admin_enqueue_scripts', [ $this, 'wpm_admin_scripts' ] );
|
32 |
// add the admin options page
|
33 |
add_action( 'admin_menu', [ $this, 'wpm_plugin_admin_add_page' ], 99 );
|
@@ -46,7 +48,7 @@ class Admin
|
|
46 |
|
47 |
protected function if_is_wpm_admin_page()
|
48 |
{
|
49 |
-
$_get = filter_input_array( INPUT_GET,
|
50 |
|
51 |
if ( !empty($_get['page']) && 'wpm' === $_get['page'] ) {
|
52 |
return true;
|
@@ -75,7 +77,7 @@ class Admin
|
|
75 |
|
76 |
public function my_after_purchase_js( $js_function )
|
77 |
{
|
78 |
-
return "function ( response ) {\n\n let\n isTrial = (null != response.purchase.trial_ends),\n isSubscription = (null != response.purchase.initial_amount),\n total = isTrial ? 0 : (isSubscription ? response.purchase.initial_amount : response.purchase.gross).toString(),\n productName = 'WooCommerce Pixel Manager',\n // storeUrl = 'https://sweetcode.com',\n storeName = 'SweetCode';\n \n window.dataLayer = window.dataLayer || [];\n\n function gtag() {\n dataLayer.push(arguments);\n }\n \n gtag('js', new Date()); \n \n gtag('config', 'UA-39746956-10', {'anonymize_ip':
|
79 |
}
|
80 |
|
81 |
public function my_checkout_enrich( $html )
|
@@ -234,7 +236,7 @@ class Admin
|
|
234 |
public function add_section_main_subsection_facebook( $section_ids )
|
235 |
{
|
236 |
$sub_section_ids = [
|
237 |
-
'title' => esc_html__( '
|
238 |
'slug' => 'facebook',
|
239 |
];
|
240 |
add_settings_field(
|
@@ -249,7 +251,7 @@ class Admin
|
|
249 |
// add the field for the conversion label
|
250 |
add_settings_field(
|
251 |
'wpm_plugin_facebook_pixel_id',
|
252 |
-
esc_html__( '
|
253 |
[ $this, 'wpm_option_html_facebook_pixel_id' ],
|
254 |
'wpm_plugin_options_page',
|
255 |
$section_ids['settings_name']
|
@@ -388,16 +390,6 @@ class Admin
|
|
388 |
'wpm_plugin_options_page',
|
389 |
$section_ids['settings_name']
|
390 |
);
|
391 |
-
if ( wpm_fs()->is__premium_only() || $this->options['general']['pro_version_demo'] ) {
|
392 |
-
// add checkbox for disabling tracking for user roles
|
393 |
-
add_settings_field(
|
394 |
-
'wpm_setting_disable_tracking_for_user_roles',
|
395 |
-
esc_html__( 'Disable Tracking for User Roles', 'woocommerce-google-adwords-conversion-tracking-tag' ),
|
396 |
-
[ $this, 'wpm_setting_html_disable_tracking_for_user_roles' ],
|
397 |
-
'wpm_plugin_options_page',
|
398 |
-
$section_ids['settings_name']
|
399 |
-
);
|
400 |
-
}
|
401 |
}
|
402 |
|
403 |
public function add_section_advanced_subsection_google( $section_ids )
|
@@ -415,6 +407,16 @@ class Admin
|
|
415 |
'wpm_plugin_options_page',
|
416 |
$section_ids['settings_name']
|
417 |
);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
418 |
// add the field for the aw_merchant_id
|
419 |
add_settings_field(
|
420 |
'wpm_plugin_aw_merchant_id',
|
@@ -607,7 +609,7 @@ class Admin
|
|
607 |
public function add_section_advanced_subsection_facebook( $section_ids )
|
608 |
{
|
609 |
$sub_section_ids = [
|
610 |
-
'title' => '
|
611 |
'slug' => 'facebook',
|
612 |
];
|
613 |
add_settings_field(
|
@@ -622,7 +624,7 @@ class Admin
|
|
622 |
// add field for the Facebook CAPI token
|
623 |
add_settings_field(
|
624 |
'wpm_setting_facebook_capi_token',
|
625 |
-
esc_html__( '
|
626 |
[ $this, 'wpm_setting_html_facebook_capi_token' ],
|
627 |
'wpm_plugin_options_page',
|
628 |
$section_ids['settings_name']
|
@@ -630,7 +632,7 @@ class Admin
|
|
630 |
// add field for the Facebook CAPI user transparency process anonymous hits
|
631 |
add_settings_field(
|
632 |
'wpm_setting_facebook_capi_user_transparency_process_anonymous_hits',
|
633 |
-
esc_html__( '
|
634 |
[ $this, 'wpm_setting_facebook_capi_user_transparency_process_anonymous_hits' ],
|
635 |
'wpm_plugin_options_page',
|
636 |
$section_ids['settings_name']
|
@@ -638,7 +640,7 @@ class Admin
|
|
638 |
// add field for the Facebook CAPI user transparency send additional client identifiers
|
639 |
add_settings_field(
|
640 |
'wpm_setting_facebook_capi_user_transparency_send_additional_client_identifiers',
|
641 |
-
esc_html__( '
|
642 |
[ $this, 'wpm_setting_facebook_capi_user_transparency_send_additional_client_identifiers' ],
|
643 |
'wpm_plugin_options_page',
|
644 |
$section_ids['settings_name']
|
@@ -646,7 +648,7 @@ class Admin
|
|
646 |
// add fields for Facebook microdata
|
647 |
add_settings_field(
|
648 |
'wpm_setting_facebook_microdata_active',
|
649 |
-
esc_html__( '
|
650 |
[ $this, 'wpm_setting_html_facebook_microdata' ],
|
651 |
'wpm_plugin_options_page',
|
652 |
$section_ids['settings_name']
|
@@ -668,6 +670,39 @@ class Admin
|
|
668 |
[ $this, 'wpm_plugin_section_add_cart_data_description' ],
|
669 |
'wpm_plugin_options_page'
|
670 |
);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
671 |
// add checkbox for dynamic remarketing
|
672 |
add_settings_field(
|
673 |
'wpm_plugin_option_gads_dynamic_remarketing',
|
@@ -785,7 +820,7 @@ class Admin
|
|
785 |
|
786 |
<script>
|
787 |
if (typeof wpm_hide_script_blocker_warning === "function") {
|
788 |
-
wpm_hide_script_blocker_warning()
|
789 |
}
|
790 |
</script>
|
791 |
|
@@ -1149,7 +1184,7 @@ class Admin
|
|
1149 |
$this->get_status_icon_new( $this->options['facebook']['pixel_id'] );
|
1150 |
$this->get_documentation_html_by_key( 'facebook_pixel_id' );
|
1151 |
echo '<br><br>' ;
|
1152 |
-
esc_html_e( 'The
|
1153 |
echo ' <i>765432112345678</i>' ;
|
1154 |
}
|
1155 |
|
@@ -1335,7 +1370,7 @@ class Admin
|
|
1335 |
<a class="documentation-icon" href="<?php
|
1336 |
echo esc_url( $path ) ;
|
1337 |
?>" target="_blank">
|
1338 |
-
<span style="vertical-align: top; margin-top:
|
1339 |
class="tooltiptext">
|
1340 |
<?php
|
1341 |
esc_html_e( 'open the documentation', 'woocommerce-google-adwords-conversion-tracking-tag' );
|
@@ -1345,6 +1380,42 @@ class Admin
|
|
1345 |
<?php
|
1346 |
}
|
1347 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1348 |
public function wpm_setting_html_google_consent_mode_active()
|
1349 |
{
|
1350 |
// adding the hidden input is a hack to make WordPress save the option with the value zero,
|
@@ -1395,7 +1466,7 @@ class Admin
|
|
1395 |
<option value="<?php
|
1396 |
esc_html_e( $region_code );
|
1397 |
?>" <?php
|
1398 |
-
esc_html_e( ( in_array( $region_code, $this->options['google']['consent_mode']['regions']
|
1399 |
?>><?php
|
1400 |
esc_html_e( $region_name );
|
1401 |
?></option>
|
@@ -1405,9 +1476,9 @@ class Admin
|
|
1405 |
|
1406 |
</select>
|
1407 |
<script>
|
1408 |
-
jQuery(
|
1409 |
// theme: "classic"
|
1410 |
-
})
|
1411 |
</script>
|
1412 |
<?php
|
1413 |
$this->get_documentation_html_by_key( 'google_consent_regions' );
|
@@ -1553,7 +1624,7 @@ class Admin
|
|
1553 |
?>
|
1554 |
</label>
|
1555 |
<?php
|
1556 |
-
$this->get_status_icon_new( $this->options['google']['user_id'], $this->options['google']['analytics']['universal']['property_id'] || $this->options['google']['analytics']['ga4']['measurement_id'] || $this->
|
1557 |
$this->html_pro_feature();
|
1558 |
// echo $this->get_documentation_html('/wgact/?utm_source=woocommerce-plugin&utm_medium=documentation-link&utm_campaign=woocommerce-pixel-manager-docs&utm_content=google-consent-mode#/consent-mgmt/google-consent-mode');
|
1559 |
?>
|
@@ -1590,13 +1661,13 @@ class Admin
|
|
1590 |
?>
|
1591 |
</label>
|
1592 |
<?php
|
1593 |
-
$this->get_status_icon_new( $this->options['google']['ads']['enhanced_conversions'], $this->
|
1594 |
$this->html_pro_feature();
|
1595 |
$this->get_documentation_html_by_key( 'google_ads_enhanced_conversions' );
|
1596 |
?>
|
1597 |
<?php
|
1598 |
|
1599 |
-
if ( !$this->
|
1600 |
echo '<p></p><span class="dashicons dashicons-info"></span>' ;
|
1601 |
esc_html_e( 'You need to activate Google Ads', 'woocommerce-google-adwords-conversion-tracking-tag' );
|
1602 |
echo '</p><br>' ;
|
@@ -1750,7 +1821,7 @@ class Admin
|
|
1750 |
|
1751 |
if ( !$this->options['facebook']['pixel_id'] ) {
|
1752 |
echo '<p></p><span class="dashicons dashicons-info"></span>' ;
|
1753 |
-
esc_html_e( 'You need to activate the
|
1754 |
echo '</p><br>' ;
|
1755 |
}
|
1756 |
|
@@ -1780,7 +1851,7 @@ class Admin
|
|
1780 |
?>
|
1781 |
/>
|
1782 |
<?php
|
1783 |
-
esc_html_e( 'Send CAPI hits for anonymous visitors who likely have blocked the
|
1784 |
?>
|
1785 |
</label>
|
1786 |
<?php
|
@@ -1790,7 +1861,7 @@ class Admin
|
|
1790 |
|
1791 |
if ( $this->options['facebook']['capi']['user_transparency']['process_anonymous_hits'] && !$this->options['facebook']['pixel_id'] ) {
|
1792 |
echo '<p></p><span class="dashicons dashicons-info"></span>' ;
|
1793 |
-
esc_html_e( 'You need to activate the
|
1794 |
echo '</p><br>' ;
|
1795 |
}
|
1796 |
|
@@ -1826,7 +1897,7 @@ class Admin
|
|
1826 |
|
1827 |
if ( $this->options['facebook']['capi']['user_transparency']['send_additional_client_identifiers'] && !$this->options['facebook']['pixel_id'] ) {
|
1828 |
echo '<p></p><span class="dashicons dashicons-info"></span>' ;
|
1829 |
-
esc_html_e( 'You need to activate the
|
1830 |
echo '</p><br>' ;
|
1831 |
}
|
1832 |
|
@@ -1851,7 +1922,7 @@ class Admin
|
|
1851 |
?>
|
1852 |
/>
|
1853 |
<?php
|
1854 |
-
esc_html_e( 'Enable
|
1855 |
?>
|
1856 |
</label>
|
1857 |
<?php
|
@@ -1861,12 +1932,44 @@ class Admin
|
|
1861 |
|
1862 |
if ( $this->options['facebook']['microdata'] && !$this->options['facebook']['pixel_id'] ) {
|
1863 |
echo '<p></p><span class="dashicons dashicons-info"></span>' ;
|
1864 |
-
esc_html_e( 'You need to activate the
|
1865 |
echo '</p><br>' ;
|
1866 |
}
|
1867 |
|
1868 |
}
|
1869 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1870 |
public function wpm_setting_html_order_duplication_prevention()
|
1871 |
{
|
1872 |
// adding the hidden input is a hack to make WordPress save the option with the value zero,
|
@@ -1916,49 +2019,10 @@ class Admin
|
|
1916 |
?>
|
1917 |
</label>
|
1918 |
<?php
|
1919 |
-
$this->get_status_icon_new( $this->options['general']['maximum_compatibility_mode']
|
1920 |
$this->get_documentation_html_by_key( 'maximum_compatibility_mode' );
|
1921 |
}
|
1922 |
|
1923 |
-
public function wpm_setting_html_disable_tracking_for_user_roles()
|
1924 |
-
{
|
1925 |
-
// https://semantic-ui.com/modules/dropdown.html#multiple-selection
|
1926 |
-
// https://developer.woocommerce.com/2017/08/08/selectwoo-an-accessible-replacement-for-select2/
|
1927 |
-
// https://github.com/woocommerce/selectWoo
|
1928 |
-
?>
|
1929 |
-
<select id="wpm_setting_disable_tracking_for_user_roles" multiple="multiple"
|
1930 |
-
name="wgact_plugin_options[shop][disable_tracking_for][]"
|
1931 |
-
style="width:350px; padding-left: 10px" data-placeholder="Choose roles…" aria-label="Roles"
|
1932 |
-
class="wc-enhanced-select"
|
1933 |
-
<?php
|
1934 |
-
esc_html_e( $this->disable_if_demo() );
|
1935 |
-
?>
|
1936 |
-
>
|
1937 |
-
<?php
|
1938 |
-
foreach ( get_editable_roles() as $role => $details ) {
|
1939 |
-
?>
|
1940 |
-
<option value="<?php
|
1941 |
-
esc_html_e( $role );
|
1942 |
-
?>" <?php
|
1943 |
-
esc_html_e( ( in_array( $role, $this->options['shop']['disable_tracking_for'], true ) ? 'selected' : '' ) );
|
1944 |
-
?>><?php
|
1945 |
-
esc_html_e( $details['name'] );
|
1946 |
-
?></option>
|
1947 |
-
<?php
|
1948 |
-
}
|
1949 |
-
?>
|
1950 |
-
|
1951 |
-
</select>
|
1952 |
-
<script>
|
1953 |
-
jQuery("#wpm_setting_disable_tracking_for_user_roles").select2({
|
1954 |
-
// theme: "classic"
|
1955 |
-
})
|
1956 |
-
</script>
|
1957 |
-
<?php
|
1958 |
-
// $this->get_documentation_html_by_key('google_consent_regions');
|
1959 |
-
$this->html_pro_feature();
|
1960 |
-
}
|
1961 |
-
|
1962 |
private function get_order_duplication_prevention_text()
|
1963 |
{
|
1964 |
esc_html_e( 'Basic order duplication prevention is ', 'woocommerce-google-adwords-conversion-tracking-tag' );
|
@@ -2191,6 +2255,67 @@ class Admin
|
|
2191 |
esc_html_e( 'ID of your Google Merchant Center account. It looks like this: 12345678', 'woocommerce-google-adwords-conversion-tracking-tag' );
|
2192 |
}
|
2193 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2194 |
public function wpm_plugin_option_product_identifier()
|
2195 |
{
|
2196 |
?>
|
@@ -2442,7 +2567,7 @@ class Admin
|
|
2442 |
|
2443 |
if ( !$this->validations->is_facebook_pixel_id( $input['facebook']['pixel_id'] ) ) {
|
2444 |
$input['facebook']['pixel_id'] = ( isset( $this->options['facebook']['pixel_id'] ) ? $this->options['facebook']['pixel_id'] : '' );
|
2445 |
-
add_settings_error( 'wgact_plugin_options', 'invalid-facebook-pixel-id', esc_html__( 'You have entered an invalid
|
2446 |
}
|
2447 |
|
2448 |
}
|
@@ -2451,7 +2576,7 @@ class Admin
|
|
2451 |
|
2452 |
if ( !$this->validations->is_facebook_capi_token( $input['facebook']['capi']['token'] ) ) {
|
2453 |
$input['facebook']['capi']['token'] = ( isset( $this->options['facebook']['capi']['token'] ) ? $this->options['facebook']['capi']['token'] : '' );
|
2454 |
-
add_settings_error( 'wgact_plugin_options', 'invalid-facebook-pixel-id', esc_html__( 'You have entered an invalid
|
2455 |
}
|
2456 |
|
2457 |
}
|
@@ -2509,12 +2634,16 @@ class Admin
|
|
2509 |
}
|
2510 |
|
2511 |
}
|
2512 |
-
|
2513 |
-
|
2514 |
-
|
2515 |
-
|
2516 |
-
|
2517 |
-
|
|
|
|
|
|
|
|
|
2518 |
}
|
2519 |
|
2520 |
// Recursively go through the array and merge (overwrite old values with new ones
|
@@ -2554,9 +2683,6 @@ class Admin
|
|
2554 |
// but should be preserved
|
2555 |
$non_form_keys = [
|
2556 |
'db_version' => $this->options['db_version'],
|
2557 |
-
'shop' => [
|
2558 |
-
'disable_tracking_for' => [],
|
2559 |
-
],
|
2560 |
];
|
2561 |
// in case the form field input is missing
|
2562 |
// if (!array_key_exists('google_business_vertical', $input['google']['ads'])) {
|
1 |
<?php
|
2 |
|
3 |
// TODO move script for copying debug info into a proper .js enqueued file, or switch tabs to JavaScript switching and always save all settings at the same time
|
4 |
+
// TODO debug info list of active payment gateways
|
5 |
namespace WCPM\Classes\Admin;
|
6 |
|
7 |
+
use WC_Geolocation ;
|
8 |
+
use WCPM\Classes\Pixels\Google\Trait_Google ;
|
9 |
use WCPM\Classes\Pixels\Trait_Shop ;
|
10 |
+
use WP_Screen ;
|
11 |
|
12 |
if ( !defined( 'ABSPATH' ) ) {
|
13 |
exit;
|
16 |
|
17 |
class Admin
|
18 |
{
|
19 |
+
use Trait_Google ;
|
20 |
use Trait_Shop ;
|
21 |
public $ip ;
|
22 |
protected $text_domain ;
|
25 |
protected $documentation ;
|
26 |
private $consent_mode_regions ;
|
27 |
private $validations ;
|
|
|
28 |
public function __construct( $options )
|
29 |
{
|
30 |
$this->options = $options;
|
31 |
$this->plugin_hook = 'woocommerce_page_wpm';
|
32 |
$this->documentation = new Documentation();
|
|
|
33 |
add_action( 'admin_enqueue_scripts', [ $this, 'wpm_admin_scripts' ] );
|
34 |
// add the admin options page
|
35 |
add_action( 'admin_menu', [ $this, 'wpm_plugin_admin_add_page' ], 99 );
|
48 |
|
49 |
protected function if_is_wpm_admin_page()
|
50 |
{
|
51 |
+
$_get = filter_input_array( INPUT_GET, FILTER_SANITIZE_STRING );
|
52 |
|
53 |
if ( !empty($_get['page']) && 'wpm' === $_get['page'] ) {
|
54 |
return true;
|
77 |
|
78 |
public function my_after_purchase_js( $js_function )
|
79 |
{
|
80 |
+
return "function ( response ) {\n\n let\n isTrial = (null != response.purchase.trial_ends),\n isSubscription = (null != response.purchase.initial_amount),\n total = isTrial ? 0 : (isSubscription ? response.purchase.initial_amount : response.purchase.gross).toString(),\n productName = 'WooCommerce Pixel Manager',\n // storeUrl = 'https://sweetcode.com',\n storeName = 'SweetCode';\n \n window.dataLayer = window.dataLayer || [];\n\n function gtag() {\n dataLayer.push(arguments);\n }\n \n gtag('js', new Date()); \n \n gtag('config', 'UA-39746956-10', {'anonymize_ip':'true'});\n gtag('config', 'G-2QE000DX8D');\n gtag('config', 'AW-406204436');\n \n gtag('event', 'purchase', {\n 'send_to':['UA-39746956-10', 'G-2QE000DX8D'],\n 'transaction_id':response.purchase.id.toString(),\n 'currency': response.purchase.currency.toUpperCase(),\n 'discount':0,\n 'items':[{\n 'id':response.purchase.plan_id.toString(),\n 'quantity':1,\n 'price':total,\n 'name':productName,\n 'category': 'Plugin',\n }],\n 'affiliation': storeName,\n 'value':response.purchase.initial_amount.toString()\n });\n \n gtag('event', 'conversion', {\n 'send_to': 'AW-406204436/XrUYCK3J8YoCEJTg2MEB',\n 'value': response.purchase.initial_amount.toString(),\n 'currency': response.purchase.currency.toUpperCase(),\n 'transaction_id': response.purchase.id.toString()\n });\n \n !function(f,b,e,v,n,t,s)\n {if(f.fbq)return;n=f.fbq=function(){n.callMethod?\n n.callMethod.apply(n,arguments):n.queue.push(arguments)};\n if(!f._fbq)f._fbq=n;n.push=n;n.loaded=!0;n.version='2.0';\n n.queue=[];t=b.createElement(e);t.async=!0;\n t.src=v;s=b.getElementsByTagName(e)[0];\n s.parentNode.insertBefore(t,s)}(window, document,'script',\n 'https://connect.facebook.net/en_US/fbevents.js');\n fbq('init', '257839909406661');\n fbq('track', 'PageView');\n \n fbq('track', 'Purchase', {\n currency: 'USD',\n value: total\n });\n }";
|
81 |
}
|
82 |
|
83 |
public function my_checkout_enrich( $html )
|
236 |
public function add_section_main_subsection_facebook( $section_ids )
|
237 |
{
|
238 |
$sub_section_ids = [
|
239 |
+
'title' => esc_html__( 'Facebook', 'woocommerce-google-adwords-conversion-tracking-tag' ),
|
240 |
'slug' => 'facebook',
|
241 |
];
|
242 |
add_settings_field(
|
251 |
// add the field for the conversion label
|
252 |
add_settings_field(
|
253 |
'wpm_plugin_facebook_pixel_id',
|
254 |
+
esc_html__( 'Facebook pixel ID', 'woocommerce-google-adwords-conversion-tracking-tag' ),
|
255 |
[ $this, 'wpm_option_html_facebook_pixel_id' ],
|
256 |
'wpm_plugin_options_page',
|
257 |
$section_ids['settings_name']
|
390 |
'wpm_plugin_options_page',
|
391 |
$section_ids['settings_name']
|
392 |
);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
393 |
}
|
394 |
|
395 |
public function add_section_advanced_subsection_google( $section_ids )
|
407 |
'wpm_plugin_options_page',
|
408 |
$section_ids['settings_name']
|
409 |
);
|
410 |
+
if ( $this->options['google']['gtag']['deactivation'] ) {
|
411 |
+
// add fields for the gtag insertion
|
412 |
+
add_settings_field(
|
413 |
+
'wpm_plugin_option_gtag_deactivation',
|
414 |
+
esc_html__( 'gtag Deactivation', 'woocommerce-google-adwords-conversion-tracking-tag' ),
|
415 |
+
[ $this, 'wpm_setting_html_google_gtag_deactivation' ],
|
416 |
+
'wpm_plugin_options_page',
|
417 |
+
$section_ids['settings_name']
|
418 |
+
);
|
419 |
+
}
|
420 |
// add the field for the aw_merchant_id
|
421 |
add_settings_field(
|
422 |
'wpm_plugin_aw_merchant_id',
|
609 |
public function add_section_advanced_subsection_facebook( $section_ids )
|
610 |
{
|
611 |
$sub_section_ids = [
|
612 |
+
'title' => 'Facebook',
|
613 |
'slug' => 'facebook',
|
614 |
];
|
615 |
add_settings_field(
|
624 |
// add field for the Facebook CAPI token
|
625 |
add_settings_field(
|
626 |
'wpm_setting_facebook_capi_token',
|
627 |
+
esc_html__( 'Facebook CAPI: token', 'woocommerce-google-adwords-conversion-tracking-tag' ),
|
628 |
[ $this, 'wpm_setting_html_facebook_capi_token' ],
|
629 |
'wpm_plugin_options_page',
|
630 |
$section_ids['settings_name']
|
632 |
// add field for the Facebook CAPI user transparency process anonymous hits
|
633 |
add_settings_field(
|
634 |
'wpm_setting_facebook_capi_user_transparency_process_anonymous_hits',
|
635 |
+
esc_html__( 'Facebook CAPI: process anonymous hits', 'woocommerce-google-adwords-conversion-tracking-tag' ),
|
636 |
[ $this, 'wpm_setting_facebook_capi_user_transparency_process_anonymous_hits' ],
|
637 |
'wpm_plugin_options_page',
|
638 |
$section_ids['settings_name']
|
640 |
// add field for the Facebook CAPI user transparency send additional client identifiers
|
641 |
add_settings_field(
|
642 |
'wpm_setting_facebook_capi_user_transparency_send_additional_client_identifiers',
|
643 |
+
esc_html__( 'Facebook CAPI: send additional visitor identifiers', 'woocommerce-google-adwords-conversion-tracking-tag' ),
|
644 |
[ $this, 'wpm_setting_facebook_capi_user_transparency_send_additional_client_identifiers' ],
|
645 |
'wpm_plugin_options_page',
|
646 |
$section_ids['settings_name']
|
648 |
// add fields for Facebook microdata
|
649 |
add_settings_field(
|
650 |
'wpm_setting_facebook_microdata_active',
|
651 |
+
esc_html__( 'Facebook Microdata Tags for Catalogues', 'woocommerce-google-adwords-conversion-tracking-tag' ),
|
652 |
[ $this, 'wpm_setting_html_facebook_microdata' ],
|
653 |
'wpm_plugin_options_page',
|
654 |
$section_ids['settings_name']
|
670 |
[ $this, 'wpm_plugin_section_add_cart_data_description' ],
|
671 |
'wpm_plugin_options_page'
|
672 |
);
|
673 |
+
// add fields for cart data
|
674 |
+
// add_settings_field(
|
675 |
+
// 'wgact_plugin_add_cart_data',
|
676 |
+
// esc_html__(
|
677 |
+
// 'Activation',
|
678 |
+
// 'woocommerce-google-adwords-conversion-tracking-tag'
|
679 |
+
// ),
|
680 |
+
// [$this, 'wgact_option_html_google_ads_add_cart_data'],
|
681 |
+
// 'wpm_plugin_options_page',
|
682 |
+
// 'wpm_plugin_beta_section'
|
683 |
+
// );
|
684 |
+
// add the field for the aw_feed_country
|
685 |
+
// add_settings_field(
|
686 |
+
// 'wgact_plugin_aw_feed_country',
|
687 |
+
// esc_html__(
|
688 |
+
// 'aw_feed_country',
|
689 |
+
// 'woocommerce-google-adwords-conversion-tracking-tag'
|
690 |
+
// ),
|
691 |
+
// [$this, 'wgact_plugin_setting_aw_feed_country'],
|
692 |
+
// 'wpm_plugin_options_page',
|
693 |
+
// 'wpm_plugin_beta_section'
|
694 |
+
// );
|
695 |
+
// add the field for the aw_feed_language
|
696 |
+
// add_settings_field(
|
697 |
+
// 'wgact_plugin_aw_feed_language',
|
698 |
+
// esc_html__(
|
699 |
+
// 'aw_feed_language',
|
700 |
+
// 'woocommerce-google-adwords-conversion-tracking-tag'
|
701 |
+
// ),
|
702 |
+
// [$this, 'wgact_plugin_setting_aw_feed_language'],
|
703 |
+
// 'wpm_plugin_options_page',
|
704 |
+
// 'wpm_plugin_beta_section'
|
705 |
+
// );
|
706 |
// add checkbox for dynamic remarketing
|
707 |
add_settings_field(
|
708 |
'wpm_plugin_option_gads_dynamic_remarketing',
|
820 |
|
821 |
<script>
|
822 |
if (typeof wpm_hide_script_blocker_warning === "function") {
|
823 |
+
wpm_hide_script_blocker_warning();
|
824 |
}
|
825 |
</script>
|
826 |
|
1184 |
$this->get_status_icon_new( $this->options['facebook']['pixel_id'] );
|
1185 |
$this->get_documentation_html_by_key( 'facebook_pixel_id' );
|
1186 |
echo '<br><br>' ;
|
1187 |
+
esc_html_e( 'The Facebook pixel ID looks similar to this:', 'woocommerce-google-adwords-conversion-tracking-tag' );
|
1188 |
echo ' <i>765432112345678</i>' ;
|
1189 |
}
|
1190 |
|
1370 |
<a class="documentation-icon" href="<?php
|
1371 |
echo esc_url( $path ) ;
|
1372 |
?>" target="_blank">
|
1373 |
+
<span style="vertical-align: top; margin-top: 0px" class="dashicons dashicons-info-outline tooltip"><span
|
1374 |
class="tooltiptext">
|
1375 |
<?php
|
1376 |
esc_html_e( 'open the documentation', 'woocommerce-google-adwords-conversion-tracking-tag' );
|
1380 |
<?php
|
1381 |
}
|
1382 |
|
1383 |
+
public function wpm_setting_html_google_gtag_deactivation()
|
1384 |
+
{
|
1385 |
+
// adding the hidden input is a hack to make WordPress save the option with the value zero,
|
1386 |
+
// instead of not saving it and remove that array key entirely
|
1387 |
+
// https://stackoverflow.com/a/1992745/4688612
|
1388 |
+
?>
|
1389 |
+
<label>
|
1390 |
+
<input type='hidden' value='0' name='wgact_plugin_options[google][gtag][deactivation]'>
|
1391 |
+
<input type='checkbox' id='wpm_plugin_option_gtag_deactivation'
|
1392 |
+
name='wgact_plugin_options[google][gtag][deactivation]'
|
1393 |
+
value='1' <?php
|
1394 |
+
checked( $this->options['google']['gtag']['deactivation'] );
|
1395 |
+
?> />
|
1396 |
+
<?php
|
1397 |
+
esc_html_e( 'Disable gtag.js insertion, if another plugin is inserting it already', 'woocommerce-google-adwords-conversion-tracking-tag' );
|
1398 |
+
?>
|
1399 |
+
</label>
|
1400 |
+
<?php
|
1401 |
+
$this->get_documentation_html_by_key( 'google_gtag_deactivation' );
|
1402 |
+
?>
|
1403 |
+
<br>
|
1404 |
+
<p>
|
1405 |
+
<span class="dashicons dashicons-info"></span>
|
1406 |
+
<?php
|
1407 |
+
esc_html_e( 'Only do this, if the other plugin does insert the gtag above this pixel. If not, keep the gtag active.', 'woocommerce-google-adwords-conversion-tracking-tag' );
|
1408 |
+
?>
|
1409 |
+
</p>
|
1410 |
+
<p>
|
1411 |
+
<span class="dashicons dashicons-info"></span>
|
1412 |
+
<?php
|
1413 |
+
esc_html_e( 'This setting is deprecated. It will be removed in future versions of the plugin. Read more about it in the documentation.', 'woocommerce-google-adwords-conversion-tracking-tag' );
|
1414 |
+
?>
|
1415 |
+
</p>
|
1416 |
+
<?php
|
1417 |
+
}
|
1418 |
+
|
1419 |
public function wpm_setting_html_google_consent_mode_active()
|
1420 |
{
|
1421 |
// adding the hidden input is a hack to make WordPress save the option with the value zero,
|
1466 |
<option value="<?php
|
1467 |
esc_html_e( $region_code );
|
1468 |
?>" <?php
|
1469 |
+
esc_html_e( ( in_array( $region_code, $this->options['google']['consent_mode']['regions'] ) ? 'selected' : '' ) );
|
1470 |
?>><?php
|
1471 |
esc_html_e( $region_name );
|
1472 |
?></option>
|
1476 |
|
1477 |
</select>
|
1478 |
<script>
|
1479 |
+
jQuery('#wpm_setting_google_consent_regions').select2({
|
1480 |
// theme: "classic"
|
1481 |
+
});
|
1482 |
</script>
|
1483 |
<?php
|
1484 |
$this->get_documentation_html_by_key( 'google_consent_regions' );
|
1624 |
?>
|
1625 |
</label>
|
1626 |
<?php
|
1627 |
+
$this->get_status_icon_new( $this->options['google']['user_id'], $this->options['google']['analytics']['universal']['property_id'] || $this->options['google']['analytics']['ga4']['measurement_id'] || $this->is_google_ads_active(), true );
|
1628 |
$this->html_pro_feature();
|
1629 |
// echo $this->get_documentation_html('/wgact/?utm_source=woocommerce-plugin&utm_medium=documentation-link&utm_campaign=woocommerce-pixel-manager-docs&utm_content=google-consent-mode#/consent-mgmt/google-consent-mode');
|
1630 |
?>
|
1661 |
?>
|
1662 |
</label>
|
1663 |
<?php
|
1664 |
+
$this->get_status_icon_new( $this->options['google']['ads']['enhanced_conversions'], $this->is_google_ads_active(), false );
|
1665 |
$this->html_pro_feature();
|
1666 |
$this->get_documentation_html_by_key( 'google_ads_enhanced_conversions' );
|
1667 |
?>
|
1668 |
<?php
|
1669 |
|
1670 |
+
if ( !$this->is_google_ads_active() ) {
|
1671 |
echo '<p></p><span class="dashicons dashicons-info"></span>' ;
|
1672 |
esc_html_e( 'You need to activate Google Ads', 'woocommerce-google-adwords-conversion-tracking-tag' );
|
1673 |
echo '</p><br>' ;
|
1821 |
|
1822 |
if ( !$this->options['facebook']['pixel_id'] ) {
|
1823 |
echo '<p></p><span class="dashicons dashicons-info"></span>' ;
|
1824 |
+
esc_html_e( 'You need to activate the Facebook pixel', 'woocommerce-google-adwords-conversion-tracking-tag' );
|
1825 |
echo '</p><br>' ;
|
1826 |
}
|
1827 |
|
1851 |
?>
|
1852 |
/>
|
1853 |
<?php
|
1854 |
+
esc_html_e( 'Send CAPI hits for anonymous visitors who likely have blocked the Facebook pixel.', 'woocommerce-google-adwords-conversion-tracking-tag' );
|
1855 |
?>
|
1856 |
</label>
|
1857 |
<?php
|
1861 |
|
1862 |
if ( $this->options['facebook']['capi']['user_transparency']['process_anonymous_hits'] && !$this->options['facebook']['pixel_id'] ) {
|
1863 |
echo '<p></p><span class="dashicons dashicons-info"></span>' ;
|
1864 |
+
esc_html_e( 'You need to activate the Facebook pixel', 'woocommerce-google-adwords-conversion-tracking-tag' );
|
1865 |
echo '</p><br>' ;
|
1866 |
}
|
1867 |
|
1897 |
|
1898 |
if ( $this->options['facebook']['capi']['user_transparency']['send_additional_client_identifiers'] && !$this->options['facebook']['pixel_id'] ) {
|
1899 |
echo '<p></p><span class="dashicons dashicons-info"></span>' ;
|
1900 |
+
esc_html_e( 'You need to activate the Facebook pixel', 'woocommerce-google-adwords-conversion-tracking-tag' );
|
1901 |
echo '</p><br>' ;
|
1902 |
}
|
1903 |
|
1922 |
?>
|
1923 |
/>
|
1924 |
<?php
|
1925 |
+
esc_html_e( 'Enable Facebook product microdata output', 'woocommerce-google-adwords-conversion-tracking-tag' );
|
1926 |
?>
|
1927 |
</label>
|
1928 |
<?php
|
1932 |
|
1933 |
if ( $this->options['facebook']['microdata'] && !$this->options['facebook']['pixel_id'] ) {
|
1934 |
echo '<p></p><span class="dashicons dashicons-info"></span>' ;
|
1935 |
+
esc_html_e( 'You need to activate the Facebook pixel', 'woocommerce-google-adwords-conversion-tracking-tag' );
|
1936 |
echo '</p><br>' ;
|
1937 |
}
|
1938 |
|
1939 |
}
|
1940 |
|
1941 |
+
public function wgact_option_html_google_ads_add_cart_data()
|
1942 |
+
{
|
1943 |
+
// adding the hidden input is a hack to make WordPress save the option with the value zero,
|
1944 |
+
// instead of not saving it and remove that array key entirely
|
1945 |
+
// https://stackoverflow.com/a/1992745/4688612
|
1946 |
+
?>
|
1947 |
+
<label>
|
1948 |
+
<input type='hidden' value='0' name='wgact_plugin_options[google][ads][add_cart_data]'>
|
1949 |
+
<input type='checkbox' id='wgact_plugin_option_gads_add_cart_data'
|
1950 |
+
name='wgact_plugin_options[google][ads][add_cart_data]'
|
1951 |
+
value='1' <?php
|
1952 |
+
checked( $this->options['google']['ads']['add_cart_data'] );
|
1953 |
+
?> />
|
1954 |
+
<?php
|
1955 |
+
esc_html_e( 'Add the cart data to the conversion event', 'woocommerce-google-adwords-conversion-tracking-tag' );
|
1956 |
+
?>
|
1957 |
+
</label>
|
1958 |
+
<?php
|
1959 |
+
$this->get_status_icon_new( $this->options['google']['ads']['add_cart_data'], $this->add_to_cart_requirements_fulfilled() );
|
1960 |
+
|
1961 |
+
if ( !$this->add_to_cart_requirements_fulfilled() ) {
|
1962 |
+
?>
|
1963 |
+
<p><span class="dashicons dashicons-info"></span>
|
1964 |
+
<?php
|
1965 |
+
esc_html_e( 'Requires an active Google Ads Conversion ID, an active Conversion Label and an active Google Merchant Center ID (aw_merchant_id)', 'woocommerce-google-adwords-conversion-tracking-tag' );
|
1966 |
+
?>
|
1967 |
+
</p>
|
1968 |
+
<?php
|
1969 |
+
}
|
1970 |
+
|
1971 |
+
}
|
1972 |
+
|
1973 |
public function wpm_setting_html_order_duplication_prevention()
|
1974 |
{
|
1975 |
// adding the hidden input is a hack to make WordPress save the option with the value zero,
|
2019 |
?>
|
2020 |
</label>
|
2021 |
<?php
|
2022 |
+
$this->get_status_icon_new( $this->options['general']['maximum_compatibility_mode'] );
|
2023 |
$this->get_documentation_html_by_key( 'maximum_compatibility_mode' );
|
2024 |
}
|
2025 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2026 |
private function get_order_duplication_prevention_text()
|
2027 |
{
|
2028 |
esc_html_e( 'Basic order duplication prevention is ', 'woocommerce-google-adwords-conversion-tracking-tag' );
|
2255 |
esc_html_e( 'ID of your Google Merchant Center account. It looks like this: 12345678', 'woocommerce-google-adwords-conversion-tracking-tag' );
|
2256 |
}
|
2257 |
|
2258 |
+
public function wgact_plugin_setting_aw_feed_country()
|
2259 |
+
{
|
2260 |
+
?>
|
2261 |
+
<b><?php
|
2262 |
+
esc_html_e( $this->get_visitor_country() );
|
2263 |
+
?></b>
|
2264 |
+
<div style="margin-top:10px">
|
2265 |
+
<?php
|
2266 |
+
esc_html_e( 'Currently the plugin automatically detects the location of the visitor for this setting. In most, if not all, cases this will work fine. Please let us know if you have a use case where you need another output:', 'woocommerce-google-adwords-conversion-tracking-tag' );
|
2267 |
+
?>
|
2268 |
+
<a href="mailto:support@sweetcode.com">support@sweetcode.com</a>
|
2269 |
+
</div>
|
2270 |
+
<?php
|
2271 |
+
}
|
2272 |
+
|
2273 |
+
// dupe in pixel
|
2274 |
+
public function get_visitor_country()
|
2275 |
+
{
|
2276 |
+
|
2277 |
+
if ( $this->is_localhost() ) {
|
2278 |
+
// error_log('check external ip');
|
2279 |
+
$this->ip = WC_Geolocation::get_external_ip_address();
|
2280 |
+
} else {
|
2281 |
+
// error_log('check regular ip');
|
2282 |
+
$this->ip = WC_Geolocation::get_ip_address();
|
2283 |
+
}
|
2284 |
+
|
2285 |
+
$location = WC_Geolocation::geolocate_ip( $this->ip );
|
2286 |
+
// error_log ('ip: ' . $this->>$ip);
|
2287 |
+
// error_log ('country: ' . $location['country']);
|
2288 |
+
return $location['country'];
|
2289 |
+
}
|
2290 |
+
|
2291 |
+
// dupe in pixel
|
2292 |
+
public function is_localhost()
|
2293 |
+
{
|
2294 |
+
$_server = filter_input_array( INPUT_SERVER, FILTER_SANITIZE_STRING );
|
2295 |
+
return in_array( $_server['REMOTE_ADDR'], [ '127.0.0.1', '::1' ] );
|
2296 |
+
}
|
2297 |
+
|
2298 |
+
public function wgact_plugin_setting_aw_feed_language()
|
2299 |
+
{
|
2300 |
+
?>
|
2301 |
+
<b><?php
|
2302 |
+
esc_html_e( $this->get_gmc_language() );
|
2303 |
+
?></b>
|
2304 |
+
<div style="margin-top:10px">
|
2305 |
+
<?php
|
2306 |
+
esc_html_e( 'The plugin will use the WordPress default language for this setting. If the shop uses translations, in theory we could also use the visitors locale. But, if that language is not set up in the Google Merchant Center we might run into issues. If you need more options here let us know:', 'woocommerce-google-adwords-conversion-tracking-tag' );
|
2307 |
+
?>
|
2308 |
+
<a href=\"mailto:support@sweetcode.com\">support@sweetcode.com</a>
|
2309 |
+
</div>
|
2310 |
+
<?php
|
2311 |
+
}
|
2312 |
+
|
2313 |
+
// dupe in pixel
|
2314 |
+
public function get_gmc_language()
|
2315 |
+
{
|
2316 |
+
return strtoupper( substr( get_locale(), 0, 2 ) );
|
2317 |
+
}
|
2318 |
+
|
2319 |
public function wpm_plugin_option_product_identifier()
|
2320 |
{
|
2321 |
?>
|
2567 |
|
2568 |
if ( !$this->validations->is_facebook_pixel_id( $input['facebook']['pixel_id'] ) ) {
|
2569 |
$input['facebook']['pixel_id'] = ( isset( $this->options['facebook']['pixel_id'] ) ? $this->options['facebook']['pixel_id'] : '' );
|
2570 |
+
add_settings_error( 'wgact_plugin_options', 'invalid-facebook-pixel-id', esc_html__( 'You have entered an invalid Facebook pixel ID. It only contains 14 to 16 digits.', 'woocommerce-google-adwords-conversion-tracking-tag' ) );
|
2571 |
}
|
2572 |
|
2573 |
}
|
2576 |
|
2577 |
if ( !$this->validations->is_facebook_capi_token( $input['facebook']['capi']['token'] ) ) {
|
2578 |
$input['facebook']['capi']['token'] = ( isset( $this->options['facebook']['capi']['token'] ) ? $this->options['facebook']['capi']['token'] : '' );
|
2579 |
+
add_settings_error( 'wgact_plugin_options', 'invalid-facebook-pixel-id', esc_html__( 'You have entered an invalid Facebook CAPI token.', 'woocommerce-google-adwords-conversion-tracking-tag' ) );
|
2580 |
}
|
2581 |
|
2582 |
}
|
2634 |
}
|
2635 |
|
2636 |
}
|
2637 |
+
// merging with the existing options
|
2638 |
+
// and overwriting old values
|
2639 |
+
// since disabling a checkbox doesn't send a value,
|
2640 |
+
// we need to set one to overwrite the old value
|
2641 |
+
$input = array_replace_recursive( $this->non_form_keys( $input ), $input );
|
2642 |
+
// error_log(print_r($input, true));
|
2643 |
+
// $input = $this->merge_options($this->options, $input);
|
2644 |
+
// error_log('input merged');
|
2645 |
+
// error_log(print_r($input, true));
|
2646 |
+
return $input;
|
2647 |
}
|
2648 |
|
2649 |
// Recursively go through the array and merge (overwrite old values with new ones
|
2683 |
// but should be preserved
|
2684 |
$non_form_keys = [
|
2685 |
'db_version' => $this->options['db_version'],
|
|
|
|
|
|
|
2686 |
];
|
2687 |
// in case the form field input is missing
|
2688 |
// if (!array_key_exists('google_business_vertical', $input['google']['ads'])) {
|
classes/admin/class-ask-for-rating.php
CHANGED
@@ -36,7 +36,7 @@ class Ask_For_Rating {
|
|
36 |
// server side php ajax handler for the admin rating notice
|
37 |
public function ajax_rating_notice_handler() {
|
38 |
|
39 |
-
$_post = filter_input_array(INPUT_POST,
|
40 |
|
41 |
$set = $_post['set'];
|
42 |
|
@@ -151,7 +151,7 @@ class Ask_For_Rating {
|
|
151 |
<?php esc_html_e('I already did', 'woocommerce-google-adwords-conversion-tracking-tag'); ?>
|
152 |
</a>
|
153 |
</div>
|
154 |
-
<div style="white-space:normal; bottom:0; right: 0; margin-bottom:
|
155 |
<a href="<?php echo esc_url(( new Documentation() )->get_link('the_dismiss_button_doesnt_work_why')); ?>"
|
156 |
target="_blank">
|
157 |
<?php esc_html_e('If the dismiss button is not working, here\'s why >>', 'woocommerce-google-adwords-conversion-tracking-tag'); ?>
|
36 |
// server side php ajax handler for the admin rating notice
|
37 |
public function ajax_rating_notice_handler() {
|
38 |
|
39 |
+
$_post = filter_input_array(INPUT_POST, FILTER_SANITIZE_STRING);
|
40 |
|
41 |
$set = $_post['set'];
|
42 |
|
151 |
<?php esc_html_e('I already did', 'woocommerce-google-adwords-conversion-tracking-tag'); ?>
|
152 |
</a>
|
153 |
</div>
|
154 |
+
<div style="white-space:normal; bottom:0; right: 0; margin-bottom: 0px; margin-right: 5px;align-self: flex-end;">
|
155 |
<a href="<?php echo esc_url(( new Documentation() )->get_link('the_dismiss_button_doesnt_work_why')); ?>"
|
156 |
target="_blank">
|
157 |
<?php esc_html_e('If the dismiss button is not working, here\'s why >>', 'woocommerce-google-adwords-conversion-tracking-tag'); ?>
|
classes/admin/class-environment-check.php
CHANGED
@@ -340,7 +340,7 @@ class Environment_Check {
|
|
340 |
|
341 |
public function ajax_environment_check_handler() {
|
342 |
|
343 |
-
$_post = filter_input_array(INPUT_POST,
|
344 |
|
345 |
if (isset($_post['set'])) {
|
346 |
|
@@ -594,7 +594,7 @@ class Environment_Check {
|
|
594 |
|
595 |
public function is_hosting_cloudways() {
|
596 |
|
597 |
-
$_server = filter_input_array(INPUT_SERVER,
|
598 |
|
599 |
return array_key_exists('cw_allowed_ip', $_server) || preg_match('~/home/.*?cloudways.*~', __FILE__);
|
600 |
}
|
@@ -691,13 +691,78 @@ class Environment_Check {
|
|
691 |
return 0;
|
692 |
}
|
693 |
|
694 |
-
|
695 |
-
|
696 |
-
|
697 |
-
|
698 |
-
|
699 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
700 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
701 |
|
702 |
public function wp_optimize_minify_default_exclusions( $default_exclusions ) {
|
703 |
// $default_exclusions[] = 'something/else.js';
|
@@ -769,7 +834,6 @@ class Environment_Check {
|
|
769 |
}
|
770 |
|
771 |
public function sg_optimizer_js_minify_exclude( $exclude_list ) {
|
772 |
-
|
773 |
$exclude_list[] = 'wpm-front-end-scripts';
|
774 |
$exclude_list[] = 'wpm-front-end-scripts-premium-only';
|
775 |
$exclude_list[] = 'wpm';
|
@@ -793,7 +857,6 @@ class Environment_Check {
|
|
793 |
}
|
794 |
|
795 |
public function sgo_javascript_combine_exclude_move_after( $exclude_list ) {
|
796 |
-
|
797 |
if (is_array($exclude_list)) {
|
798 |
$exclude_list = array_unique(array_merge($exclude_list, $this->get_wpm_script_identifiers()));
|
799 |
}
|
@@ -866,141 +929,34 @@ class Environment_Check {
|
|
866 |
}
|
867 |
}
|
868 |
|
869 |
-
public function
|
870 |
|
871 |
-
|
872 |
-
* SiteGround Optimizer
|
873 |
-
*/
|
874 |
|
875 |
-
|
|
|
876 |
|
877 |
-
|
878 |
-
* The function wpmFunctionExists needs to be excluded from combination from SGO.
|
879 |
-
* Otherwise, it won't work on pages which include WPM shortcodes.
|
880 |
-
* */
|
881 |
|
882 |
-
|
883 |
-
|
884 |
-
|
885 |
-
});
|
886 |
|
887 |
-
|
888 |
-
|
889 |
-
* leading to errors "jQuery not defined" errors on several pages
|
890 |
-
* and thus breaking tracking in those cases.
|
891 |
-
*
|
892 |
-
* Therefore, we need to exclude jquery-core from deferring.
|
893 |
-
* */
|
894 |
-
|
895 |
-
add_filter('sgo_js_async_exclude', function ( $excludes ) {
|
896 |
-
$excludes[] = 'jquery-core';
|
897 |
-
return $excludes;
|
898 |
});
|
899 |
-
}
|
900 |
|
901 |
-
|
902 |
-
* Litespeed
|
903 |
-
*/
|
904 |
|
905 |
-
|
906 |
-
|
907 |
-
if (is_array($excludes)) {
|
908 |
-
$excludes[] = 'wpmFunctionExists';
|
909 |
-
}
|
910 |
-
|
911 |
-
return $excludes;
|
912 |
});
|
913 |
}
|
914 |
-
}
|
915 |
-
|
916 |
-
public function enable_compatibility_mode() {
|
917 |
-
|
918 |
-
$this->compatibility_mode_yoast_seo();
|
919 |
-
|
920 |
-
$this->compatibility_mode_prevent_third_party_js_optimization();
|
921 |
-
}
|
922 |
-
|
923 |
-
protected function compatibility_mode_prevent_third_party_js_optimization() {
|
924 |
-
|
925 |
-
if ($this->is_wp_rocket_active()) {
|
926 |
-
$this->disable_wp_rocket_js_optimization();
|
927 |
-
}
|
928 |
-
|
929 |
-
if ($this->is_flying_press_active()) {
|
930 |
-
$this->disable_flying_press_js_optimization();
|
931 |
-
}
|
932 |
|
|
|
933 |
if ($this->is_optimocha_active()) {
|
934 |
-
$
|
935 |
-
}
|
936 |
-
|
937 |
-
if ($this->is_wp_optimize_active()) {
|
938 |
-
$this->disable_wp_optimize_js_optimization();
|
939 |
-
}
|
940 |
-
|
941 |
-
if ($this->is_async_javascript_active()) {
|
942 |
-
$this->disable_async_javascript_js_optimization();
|
943 |
-
}
|
944 |
-
|
945 |
-
if ($this->is_sg_optimizer_active()) {
|
946 |
-
$this->disable_sg_optimizer_js_optimization();
|
947 |
-
}
|
948 |
-
|
949 |
-
if ($this->is_litespeed_active()) {
|
950 |
-
$this->disable_litespeed_js_optimization();
|
951 |
-
}
|
952 |
-
|
953 |
-
if ($this->is_autoptimize_active()) {
|
954 |
-
$this->disable_autoptimze_js_optimization();
|
955 |
-
}
|
956 |
-
}
|
957 |
-
|
958 |
-
protected function disable_sg_optimizer_js_optimization() {
|
959 |
-
|
960 |
-
add_filter('sgo_javascript_combine_excluded_inline_content', [$this, 'sg_optimizer_js_exclude_combine_inline_content']);
|
961 |
-
add_filter('sgo_javascript_combine_exclude', [$this, 'sgo_javascript_combine_exclude_move_after']);
|
962 |
-
add_filter('sgo_javascript_combine_exclude_move_after', [$this, 'sgo_javascript_combine_exclude_move_after']);
|
963 |
-
add_filter('sgo_js_minify_exclude', [$this, 'sg_optimizer_js_minify_exclude']);
|
964 |
-
add_filter('sgo_js_async_exclude', [$this, 'sgo_javascript_combine_exclude_move_after']);
|
965 |
-
}
|
966 |
-
|
967 |
-
protected function disable_litespeed_js_optimization() {
|
968 |
-
add_filter('litespeed_optimize_js_excludes', [$this, 'litespeed_optimize_js_excludes']);
|
969 |
-
add_filter('litespeed_optm_js_defer_exc', [$this, 'litespeed_cache_js_defer_exc']);
|
970 |
-
add_filter('litespeed_optm_cssjs', [$this, 'litespeed_optm_cssjs']);
|
971 |
-
add_filter('option_litespeed.conf.optm-js_inline_defer', [$this, 'disable_litespeed_js_inline_after_dom']);
|
972 |
-
}
|
973 |
-
|
974 |
-
protected function disable_autoptimze_js_optimization() {
|
975 |
-
add_filter('autoptimize_filter_js_consider_minified', [$this, 'autoptimize_filter_js_consider_minified']);
|
976 |
-
add_filter('autoptimize_filter_js_dontmove', [$this, 'autoptimize_filter_js_dontmove']);
|
977 |
-
}
|
978 |
-
|
979 |
-
protected function disable_wp_optimize_js_optimization() {
|
980 |
-
// add_filter('wpo_minify_inline_js', '__return_false');
|
981 |
-
add_filter('wp-optimize-minify-default-exclusions', [$this, 'wp_optimize_minify_default_exclusions']);
|
982 |
-
}
|
983 |
-
|
984 |
-
protected function disable_async_javascript_js_optimization() {
|
985 |
-
add_filter('option_aj_plugin_exclusions', function ( $options ) {
|
986 |
-
|
987 |
-
if (!is_array($options)) {
|
988 |
-
$options = [];
|
989 |
-
}
|
990 |
|
991 |
-
return array_unique(array_merge($options, [
|
992 |
-
'woocommerce-google-adwords-conversion-tracking-tag',
|
993 |
-
'woopt-pixel-manager-pro',
|
994 |
-
'woocommerce-pixel-manager',
|
995 |
-
'woocommerce-pixel-manager-pro',
|
996 |
-
]));
|
997 |
-
});
|
998 |
-
}
|
999 |
-
|
1000 |
-
protected function disable_optimocha_js_optimization() {
|
1001 |
-
add_filter('option_sbp_options', function ( $options ) {
|
1002 |
-
|
1003 |
-
if (isset($options['js_exclude'])) {
|
1004 |
$options['js_exclude'] = $options['js_exclude'] . PHP_EOL . implode(PHP_EOL, $this->get_wpm_script_identifiers());
|
1005 |
$js_include = explode(PHP_EOL, $options['js_include']);
|
1006 |
$js_include = array_filter($js_include, function ( $string ) {
|
@@ -1013,55 +969,14 @@ class Environment_Check {
|
|
1013 |
return true;
|
1014 |
});
|
1015 |
$options['js_include'] = implode(PHP_EOL, $js_include);
|
1016 |
-
}
|
1017 |
-
|
1018 |
-
return $options;
|
1019 |
-
});
|
1020 |
-
}
|
1021 |
-
|
1022 |
-
protected function disable_flying_press_js_optimization() {
|
1023 |
-
add_filter('pre_update_option_FLYING_PRESS_CONFIG', function ( $options ) {
|
1024 |
-
|
1025 |
-
if (isset($options['js_defer_excludes'])) {
|
1026 |
-
$options['js_defer_excludes'] = array_unique(array_merge($options['js_defer_excludes'], $this->get_wpm_script_identifiers()));
|
1027 |
-
}
|
1028 |
-
|
1029 |
-
return $options;
|
1030 |
-
});
|
1031 |
-
|
1032 |
-
add_filter('option_FLYING_PRESS_CONFIG', function ( $options ) {
|
1033 |
-
|
1034 |
-
if (isset($options['js_defer_excludes'])) {
|
1035 |
-
$options['js_defer_excludes'] = array_unique(array_merge($options['js_defer_excludes'], $this->get_wpm_script_identifiers()));
|
1036 |
-
}
|
1037 |
-
return $options;
|
1038 |
-
});
|
1039 |
|
1040 |
-
|
1041 |
-
|
1042 |
-
|
1043 |
-
// if (isset($options['js_interaction'])) {
|
1044 |
-
// $options['js_interaction'] = false;
|
1045 |
-
// }
|
1046 |
-
// return $options;
|
1047 |
-
// });
|
1048 |
-
// }
|
1049 |
-
}
|
1050 |
-
|
1051 |
-
protected function disable_wp_rocket_js_optimization() {
|
1052 |
-
// for testing you need to clear the WP Rocket cache, only then the filters run
|
1053 |
-
$this->exclude_inline_scripts_from_wp_rocket_using_options();
|
1054 |
-
add_filter('rocket_delay_js_exclusions', [$this, 'add_wp_rocket_exclusions']);
|
1055 |
-
add_filter('rocket_defer_inline_exclusions', [$this, 'add_wp_rocket_exclusions']);
|
1056 |
-
add_filter('rocket_exclude_defer_js', [$this, 'add_wp_rocket_exclusions']);
|
1057 |
-
add_filter('rocket_exclude_js', [$this, 'add_wp_rocket_exclusions']);
|
1058 |
-
add_filter('rocket_minify_excluded_external_js', [$this, 'add_wp_rocket_exclusions']);
|
1059 |
-
add_filter('rocket_excluded_inline_js_content', [$this, 'add_wp_rocket_exclusions']);
|
1060 |
}
|
1061 |
|
1062 |
-
public function
|
1063 |
-
|
1064 |
-
if ($this->is_yoast_seo_active() && isset($this->options['facebook']['microdata']) && $this->options['facebook']['microdata']) {
|
1065 |
add_filter('option_wpseo_social', [$this, 'disable_yoast_seo_facebook_social']);
|
1066 |
}
|
1067 |
}
|
@@ -1070,7 +985,6 @@ class Environment_Check {
|
|
1070 |
return [
|
1071 |
'optimize.js',
|
1072 |
'googleoptimize.com/optimize.js',
|
1073 |
-
'jquery',
|
1074 |
'jQuery',
|
1075 |
'jQuery.min.js',
|
1076 |
'jquery.js',
|
@@ -1156,8 +1070,7 @@ class Environment_Check {
|
|
1156 |
|
1157 |
// https://stackoverflow.com/questions/8429342/php-get-headers-set-temporary-stream-context
|
1158 |
protected function get_headers_with_stream_context( $url, $context, $assoc = 0 ) {
|
1159 |
-
|
1160 |
-
$fp = @fopen($url, 'r', null, $context);
|
1161 |
|
1162 |
if (!is_bool($fp)) {
|
1163 |
|
340 |
|
341 |
public function ajax_environment_check_handler() {
|
342 |
|
343 |
+
$_post = filter_input_array(INPUT_POST, FILTER_SANITIZE_STRING);
|
344 |
|
345 |
if (isset($_post['set'])) {
|
346 |
|
594 |
|
595 |
public function is_hosting_cloudways() {
|
596 |
|
597 |
+
$_server = filter_input_array(INPUT_SERVER, FILTER_SANITIZE_STRING);
|
598 |
|
599 |
return array_key_exists('cw_allowed_ip', $_server) || preg_match('~/home/.*?cloudways.*~', __FILE__);
|
600 |
}
|
691 |
return 0;
|
692 |
}
|
693 |
|
694 |
+
public function disable_wp_rocket_js_optimizations( $option ) {
|
695 |
+
$option['minify_concatenate_js'] = 0;
|
696 |
+
// $option['defer_all_js'] = 0;
|
697 |
+
// $option['delay_js'] = 0;
|
698 |
+
return $option;
|
699 |
+
}
|
700 |
+
|
701 |
+
public function prevent_third_party_js_optimization() {
|
702 |
+
|
703 |
+
// for testing you need to clear the WP Rocket cache, only then the filters run
|
704 |
+
if ($this->is_wp_rocket_active()) {
|
705 |
+
$this->exclude_inline_scripts_from_wp_rocket_using_options();
|
706 |
+
add_filter('rocket_delay_js_exclusions', [$this, 'add_wp_rocket_exclusions']);
|
707 |
+
add_filter('rocket_defer_inline_exclusions', [$this, 'add_wp_rocket_exclusions']);
|
708 |
+
add_filter('rocket_exclude_defer_js', [$this, 'add_wp_rocket_exclusions']);
|
709 |
+
add_filter('rocket_exclude_js', [$this, 'add_wp_rocket_exclusions']);
|
710 |
+
add_filter('rocket_minify_excluded_external_js', [$this, 'add_wp_rocket_exclusions']);
|
711 |
+
add_filter('rocket_excluded_inline_js_content', [$this, 'add_wp_rocket_exclusions']);
|
712 |
+
}
|
713 |
+
|
714 |
+
if ($this->is_sg_optimizer_active()) {
|
715 |
+
add_filter('sgo_javascript_combine_excluded_inline_content', [$this, 'sg_optimizer_js_exclude_combine_inline_content']);
|
716 |
+
add_filter('sgo_js_minify_exclude', [$this, 'sg_optimizer_js_minify_exclude']);
|
717 |
+
add_filter('sgo_javascript_combine_exclude_move_after', [$this, 'sgo_javascript_combine_exclude_move_after']);
|
718 |
+
add_filter('sgo_javascript_combine_exclude', [$this, 'sgo_javascript_combine_exclude_move_after']);
|
719 |
+
add_filter('sgo_js_async_exclude', [$this, 'sgo_javascript_combine_exclude_move_after']);
|
720 |
+
}
|
721 |
+
|
722 |
+
if ($this->is_litespeed_active()) {
|
723 |
+
add_filter('litespeed_optm_js_defer_exc', [$this, 'litespeed_cache_js_defer_exc']);
|
724 |
+
add_filter('litespeed_optimize_js_excludes', [$this, 'litespeed_optimize_js_excludes']);
|
725 |
+
add_filter('litespeed_optm_cssjs', [$this, 'litespeed_optm_cssjs']);
|
726 |
+
add_filter('option_litespeed.conf.optm-js_inline_defer', [$this, 'disable_litespeed_js_inline_after_dom']);
|
727 |
+
}
|
728 |
+
|
729 |
+
if ($this->is_autoptimize_active()) {
|
730 |
+
add_filter('autoptimize_filter_js_consider_minified', [$this, 'autoptimize_filter_js_consider_minified']);
|
731 |
+
add_filter('autoptimize_filter_js_dontmove', [$this, 'autoptimize_filter_js_dontmove']);
|
732 |
+
}
|
733 |
+
|
734 |
+
if ($this->is_wp_optimize_active()) {
|
735 |
+
// add_filter('wpo_minify_inline_js', '__return_false');
|
736 |
+
add_filter('wp-optimize-minify-default-exclusions', [$this, 'wp_optimize_minify_default_exclusions']);
|
737 |
+
}
|
738 |
+
|
739 |
+
if ($this->is_async_javascript_active()) {
|
740 |
+
|
741 |
+
add_filter('option_aj_plugin_exclusions', function ( $options ) {
|
742 |
|
743 |
+
if (!is_array($options)) {
|
744 |
+
$options = [];
|
745 |
+
}
|
746 |
+
|
747 |
+
return array_unique(array_merge($options, [
|
748 |
+
'woocommerce-google-adwords-conversion-tracking-tag',
|
749 |
+
'woopt-pixel-manager-pro',
|
750 |
+
'woocommerce-pixel-manager',
|
751 |
+
'woocommerce-pixel-manager-pro',
|
752 |
+
]));
|
753 |
+
});
|
754 |
+
}
|
755 |
+
|
756 |
+
// Make sure to never delay JS until interaction
|
757 |
+
// if ($this->is_flying_press_active()) {
|
758 |
+
// add_filter('option_FLYING_PRESS_CONFIG', function ( $options ) {
|
759 |
+
// if (isset($options['js_interaction'])) {
|
760 |
+
// $options['js_interaction'] = false;
|
761 |
+
// }
|
762 |
+
// return $options;
|
763 |
+
// });
|
764 |
+
// }
|
765 |
+
}
|
766 |
|
767 |
public function wp_optimize_minify_default_exclusions( $default_exclusions ) {
|
768 |
// $default_exclusions[] = 'something/else.js';
|
834 |
}
|
835 |
|
836 |
public function sg_optimizer_js_minify_exclude( $exclude_list ) {
|
|
|
837 |
$exclude_list[] = 'wpm-front-end-scripts';
|
838 |
$exclude_list[] = 'wpm-front-end-scripts-premium-only';
|
839 |
$exclude_list[] = 'wpm';
|
857 |
}
|
858 |
|
859 |
public function sgo_javascript_combine_exclude_move_after( $exclude_list ) {
|
|
|
860 |
if (is_array($exclude_list)) {
|
861 |
$exclude_list = array_unique(array_merge($exclude_list, $this->get_wpm_script_identifiers()));
|
862 |
}
|
929 |
}
|
930 |
}
|
931 |
|
932 |
+
public function enable_maximum_compatibility_mode() {
|
933 |
|
934 |
+
$this->maximum_compatibility_mode_yoast_seo();
|
|
|
|
|
935 |
|
936 |
+
$this->maximum_compatibility_mode_prevent_third_party_js_optimization();
|
937 |
+
}
|
938 |
|
939 |
+
protected function maximum_compatibility_mode_prevent_third_party_js_optimization() {
|
|
|
|
|
|
|
940 |
|
941 |
+
// Disable Flying Press JS optimization
|
942 |
+
if ($this->is_flying_press_active()) {
|
943 |
+
add_filter('pre_update_option_FLYING_PRESS_CONFIG', function ( $options ) {
|
|
|
944 |
|
945 |
+
$options['js_defer_excludes'] = array_unique(array_merge($options['js_defer_excludes'], $this->get_wpm_script_identifiers()));
|
946 |
+
return $options;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
947 |
});
|
|
|
948 |
|
949 |
+
add_filter('option_FLYING_PRESS_CONFIG', function ( $options ) {
|
|
|
|
|
950 |
|
951 |
+
$options['js_defer_excludes'] = array_unique(array_merge($options['js_defer_excludes'], $this->get_wpm_script_identifiers()));
|
952 |
+
return $options;
|
|
|
|
|
|
|
|
|
|
|
953 |
});
|
954 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
955 |
|
956 |
+
// Disable Optimocha JS optimization
|
957 |
if ($this->is_optimocha_active()) {
|
958 |
+
add_filter('option_sbp_options', function ( $options ) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
959 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
960 |
$options['js_exclude'] = $options['js_exclude'] . PHP_EOL . implode(PHP_EOL, $this->get_wpm_script_identifiers());
|
961 |
$js_include = explode(PHP_EOL, $options['js_include']);
|
962 |
$js_include = array_filter($js_include, function ( $string ) {
|
969 |
return true;
|
970 |
});
|
971 |
$options['js_include'] = implode(PHP_EOL, $js_include);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
972 |
|
973 |
+
return $options;
|
974 |
+
});
|
975 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
976 |
}
|
977 |
|
978 |
+
public function maximum_compatibility_mode_yoast_seo() {
|
979 |
+
if ($this->is_yoast_seo_active() && $this->options['facebook']['microdata']) {
|
|
|
980 |
add_filter('option_wpseo_social', [$this, 'disable_yoast_seo_facebook_social']);
|
981 |
}
|
982 |
}
|
985 |
return [
|
986 |
'optimize.js',
|
987 |
'googleoptimize.com/optimize.js',
|
|
|
988 |
'jQuery',
|
989 |
'jQuery.min.js',
|
990 |
'jquery.js',
|
1070 |
|
1071 |
// https://stackoverflow.com/questions/8429342/php-get-headers-set-temporary-stream-context
|
1072 |
protected function get_headers_with_stream_context( $url, $context, $assoc = 0 ) {
|
1073 |
+
$fp = fopen($url, 'r', null, $context);
|
|
|
1074 |
|
1075 |
if (!is_bool($fp)) {
|
1076 |
|
classes/admin/class-notifications.php
CHANGED
@@ -125,7 +125,7 @@ class Notifications {
|
|
125 |
<div id="wpm-paypal-standard-error-dismissal-button" class="button" style="white-space:normal;">
|
126 |
<?php esc_html_e('Click here to dismiss this warning forever', 'woocommerce-google-adwords-conversion-tracking-tag'); ?>
|
127 |
</div>
|
128 |
-
<div style="white-space:normal; bottom:0; right: 0; margin-bottom:
|
129 |
<a href="<?php echo esc_url(( new Documentation() )->get_link('the_dismiss_button_doesnt_work_why')); ?>"
|
130 |
target="_blank">
|
131 |
<?php esc_html_e('If the dismiss button is not working, here\'s why >>', 'woocommerce-google-adwords-conversion-tracking-tag'); ?>
|
@@ -174,7 +174,7 @@ class Notifications {
|
|
174 |
data-plugin-slug="<?php echo esc_js($slug); ?>">
|
175 |
<?php esc_html_e('Click here to dismiss this warning forever', 'woocommerce-google-adwords-conversion-tracking-tag'); ?>
|
176 |
</div>
|
177 |
-
<div style="white-space:normal; bottom:0; right: 0; margin-bottom:
|
178 |
<a href="<?php echo esc_url(( new Documentation() )->get_link('the_dismiss_button_doesnt_work_why')); ?>"
|
179 |
target="_blank">
|
180 |
<?php esc_html_e('If the dismiss button is not working, here\'s why >>', 'woocommerce-google-adwords-conversion-tracking-tag'); ?>
|
125 |
<div id="wpm-paypal-standard-error-dismissal-button" class="button" style="white-space:normal;">
|
126 |
<?php esc_html_e('Click here to dismiss this warning forever', 'woocommerce-google-adwords-conversion-tracking-tag'); ?>
|
127 |
</div>
|
128 |
+
<div style="white-space:normal; bottom:0; right: 0; margin-bottom: 0px; margin-right: 5px;align-self: flex-end;">
|
129 |
<a href="<?php echo esc_url(( new Documentation() )->get_link('the_dismiss_button_doesnt_work_why')); ?>"
|
130 |
target="_blank">
|
131 |
<?php esc_html_e('If the dismiss button is not working, here\'s why >>', 'woocommerce-google-adwords-conversion-tracking-tag'); ?>
|
174 |
data-plugin-slug="<?php echo esc_js($slug); ?>">
|
175 |
<?php esc_html_e('Click here to dismiss this warning forever', 'woocommerce-google-adwords-conversion-tracking-tag'); ?>
|
176 |
</div>
|
177 |
+
<div style="white-space:normal; bottom:0; right: 0; margin-bottom: 0px; margin-right: 5px;align-self: flex-end;">
|
178 |
<a href="<?php echo esc_url(( new Documentation() )->get_link('the_dismiss_button_doesnt_work_why')); ?>"
|
179 |
target="_blank">
|
180 |
<?php esc_html_e('If the dismiss button is not working, here\'s why >>', 'woocommerce-google-adwords-conversion-tracking-tag'); ?>
|
classes/class-default-options.php
CHANGED
@@ -77,18 +77,14 @@ class Default_Options {
|
|
77 |
'site_id' => ''
|
78 |
],
|
79 |
'shop' => [
|
80 |
-
'order_total_logic'
|
81 |
-
'cookie_consent_mgmt'
|
82 |
'cookiebot' => [ // This Cookiebot setting is deprecated. Not in use anymore.
|
83 |
-
|
84 |
],
|
85 |
'explicit_consent' => 0,
|
86 |
],
|
87 |
-
'order_deduplication'
|
88 |
-
'disable_tracking_for' => [
|
89 |
-
'administrator',
|
90 |
-
'shop_manager',
|
91 |
-
],
|
92 |
],
|
93 |
'general' => [
|
94 |
'variations_output' => 1,
|
@@ -99,49 +95,17 @@ class Default_Options {
|
|
99 |
];
|
100 |
}
|
101 |
|
102 |
-
public function update_with_defaults( $
|
103 |
-
|
104 |
-
|
105 |
-
|
106 |
-
|
107 |
-
|
108 |
-
|
109 |
-
|
110 |
-
// copy all default values,
|
111 |
-
// including the subtree if one exists,
|
112 |
-
// into the target array.
|
113 |
-
if (!isset($target_array[$default_key])) {
|
114 |
-
$target_array[$default_key] = $default_value;
|
115 |
-
|
116 |
-
// We only want to keep going down the tree
|
117 |
-
// if the array contains more settings in an associative array,
|
118 |
-
// otherwise we keep the settings of what's in the target array.
|
119 |
-
} elseif ($this->is_associative_array($default_value)) {
|
120 |
-
|
121 |
-
$target_array[$default_key] = $this->update_with_defaults($target_array[$default_key], $default_value);
|
122 |
}
|
123 |
}
|
124 |
|
125 |
-
|
126 |
-
return $target_array;
|
127 |
-
}
|
128 |
-
|
129 |
-
protected function does_contain_nested_arrays( $array ) {
|
130 |
-
|
131 |
-
foreach ($array as $key) {
|
132 |
-
if (is_array($key)) {
|
133 |
-
return true;
|
134 |
-
}
|
135 |
-
}
|
136 |
-
|
137 |
-
return false;
|
138 |
-
}
|
139 |
-
|
140 |
-
protected function is_associative_array( $array ) {
|
141 |
-
if (is_array($array)) {
|
142 |
-
return ( array_values($array) !== $array );
|
143 |
-
} else {
|
144 |
-
return false;
|
145 |
-
}
|
146 |
}
|
147 |
}
|
77 |
'site_id' => ''
|
78 |
],
|
79 |
'shop' => [
|
80 |
+
'order_total_logic' => 0,
|
81 |
+
'cookie_consent_mgmt' => [
|
82 |
'cookiebot' => [ // This Cookiebot setting is deprecated. Not in use anymore.
|
83 |
+
'active' => 0
|
84 |
],
|
85 |
'explicit_consent' => 0,
|
86 |
],
|
87 |
+
'order_deduplication' => 1
|
|
|
|
|
|
|
|
|
88 |
],
|
89 |
'general' => [
|
90 |
'variations_output' => 1,
|
95 |
];
|
96 |
}
|
97 |
|
98 |
+
public function update_with_defaults( $array_input, $array_default ) {
|
99 |
+
foreach ($array_default as $key => $value) {
|
100 |
+
if (array_key_exists($key, $array_input)) {
|
101 |
+
if (is_array($value)) {
|
102 |
+
$array_input[$key] = $this->update_with_defaults($array_input[$key], $value);
|
103 |
+
}
|
104 |
+
} else {
|
105 |
+
$array_input[$key] = $value;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
106 |
}
|
107 |
}
|
108 |
|
109 |
+
return $array_input;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
110 |
}
|
111 |
}
|
classes/pixels/class-cookie-consent-management.php
CHANGED
@@ -88,7 +88,7 @@ class Cookie_Consent_Management {
|
|
88 |
// return the cookie contents, if the cookie is set
|
89 |
public function get_cookie( $cookie_name ) {
|
90 |
|
91 |
-
$_cookie = filter_input_array(INPUT_COOKIE,
|
92 |
|
93 |
return $_cookie[$cookie_name] ? $_cookie[$cookie_name] : null;
|
94 |
}
|
@@ -121,7 +121,7 @@ class Cookie_Consent_Management {
|
|
121 |
// https://wordpress.org/plugins/gdpr-cookie-compliance/
|
122 |
public function is_moove_cookie_prevention_active() {
|
123 |
|
124 |
-
$_cookie = filter_input_array(INPUT_COOKIE,
|
125 |
|
126 |
if (isset($_cookie['moove_gdpr_popup'])) {
|
127 |
|
88 |
// return the cookie contents, if the cookie is set
|
89 |
public function get_cookie( $cookie_name ) {
|
90 |
|
91 |
+
$_cookie = filter_input_array(INPUT_COOKIE, FILTER_SANITIZE_STRING);
|
92 |
|
93 |
return $_cookie[$cookie_name] ? $_cookie[$cookie_name] : null;
|
94 |
}
|
121 |
// https://wordpress.org/plugins/gdpr-cookie-compliance/
|
122 |
public function is_moove_cookie_prevention_active() {
|
123 |
|
124 |
+
$_cookie = filter_input_array(INPUT_COOKIE, FILTER_SANITIZE_STRING);
|
125 |
|
126 |
if (isset($_cookie['moove_gdpr_popup'])) {
|
127 |
|
classes/pixels/class-pixel-manager.php
CHANGED
@@ -2,11 +2,12 @@
|
|
2 |
|
3 |
namespace WCPM\Classes\Pixels;
|
4 |
|
|
|
5 |
use WCPM\Classes\Pixels\Facebook\Facebook_Pixel_Manager ;
|
6 |
use WCPM\Classes\Pixels\Facebook\Facebook_Pixel_Manager_Microdata ;
|
7 |
-
use WCPM\Classes\Pixels\Google\Google ;
|
8 |
use WCPM\Classes\Pixels\Google\Google_Analytics_Refund ;
|
9 |
use WCPM\Classes\Pixels\Google\Google_Pixel_Manager ;
|
|
|
10 |
|
11 |
if ( !defined( 'ABSPATH' ) ) {
|
12 |
exit;
|
@@ -16,6 +17,7 @@ if ( !defined( 'ABSPATH' ) ) {
|
|
16 |
class Pixel_Manager extends Script_Manager
|
17 |
{
|
18 |
use Trait_Product ;
|
|
|
19 |
use Trait_Shop ;
|
20 |
protected $options ;
|
21 |
protected $options_obj ;
|
@@ -25,7 +27,6 @@ class Pixel_Manager extends Script_Manager
|
|
25 |
protected $dyn_r_ids ;
|
26 |
protected $transaction_deduper_timeout = 1000 ;
|
27 |
protected $position = 1 ;
|
28 |
-
protected $google ;
|
29 |
public function __construct( $options )
|
30 |
{
|
31 |
/**
|
@@ -38,9 +39,7 @@ class Pixel_Manager extends Script_Manager
|
|
38 |
* Set a few states
|
39 |
*/
|
40 |
$this->facebook_active = !empty($this->options_obj->facebook->pixel_id);
|
41 |
-
|
42 |
-
$this->google = new Google( $this->options );
|
43 |
-
$this->google_active = $this->google->google_active();
|
44 |
/**
|
45 |
* Inject pixel snippets in head
|
46 |
*/
|
@@ -70,9 +69,7 @@ class Pixel_Manager extends Script_Manager
|
|
70 |
/**
|
71 |
* Front-end script section
|
72 |
*/
|
73 |
-
|
74 |
-
add_action( 'wp_enqueue_scripts', [ $this, 'wpm_front_end_scripts' ] );
|
75 |
-
}
|
76 |
add_action( 'wp_ajax_wpm_get_cart_items', [ $this, 'ajax_wpm_get_cart_items' ] );
|
77 |
add_action( 'wp_ajax_nopriv_wpm_get_cart_items', [ $this, 'ajax_wpm_get_cart_items' ] );
|
78 |
add_action( 'wp_ajax_wpm_get_product_ids', [ $this, 'ajax_wpm_get_product_ids' ] );
|
@@ -242,7 +239,7 @@ class Pixel_Manager extends Script_Manager
|
|
242 |
{
|
243 |
?>
|
244 |
|
245 |
-
<script>
|
246 |
|
247 |
window.wpmDataLayer = window.wpmDataLayer || {}
|
248 |
window.wpmDataLayer = <?php
|
@@ -283,7 +280,7 @@ class Pixel_Manager extends Script_Manager
|
|
283 |
],
|
284 |
'google' => [
|
285 |
'ads' => [
|
286 |
-
'conversionIds' => (object) $this->
|
287 |
'dynamic_remarketing' => [
|
288 |
'status' => (bool) $this->options_obj->google->ads->dynamic_remarketing,
|
289 |
'id_type' => $this->get_dyn_r_id_type( 'google' ),
|
@@ -294,29 +291,29 @@ class Pixel_Manager extends Script_Manager
|
|
294 |
'wpm_send_events_with_parent_ids'
|
295 |
) ),
|
296 |
],
|
297 |
-
'google_business_vertical' => $this->
|
298 |
'phone_conversion_label' => $this->options_obj->google->ads->phone_conversion_label,
|
299 |
'phone_conversion_number' => $this->options_obj->google->ads->phone_conversion_number,
|
300 |
],
|
301 |
'analytics' => [
|
302 |
'universal' => [
|
303 |
'property_id' => $this->options_obj->google->analytics->universal->property_id,
|
304 |
-
'parameters' => (object) $this->
|
305 |
'mp_active' => wpm_fs()->is__premium_only(),
|
306 |
],
|
307 |
'ga4' => [
|
308 |
'measurement_id' => $this->options_obj->google->analytics->ga4->measurement_id,
|
309 |
-
'parameters' => (object) $this->
|
310 |
'mp_active' => $this->options_obj->google->analytics->ga4->api_secret && wpm_fs()->is__premium_only(),
|
311 |
],
|
312 |
-
'id_type' => $this->
|
313 |
'eec' => (bool) $this->options_obj->google->analytics->eec,
|
314 |
],
|
315 |
'optimize' => [
|
316 |
'container_id' => $this->options_obj->google->optimize->container_id,
|
317 |
],
|
318 |
'linker' => [
|
319 |
-
'settings' => $this->
|
320 |
],
|
321 |
'user_id' => (bool) $this->options_obj->google->user_id,
|
322 |
],
|
@@ -334,7 +331,7 @@ class Pixel_Manager extends Script_Manager
|
|
334 |
'1.13.0',
|
335 |
'wpm_pinterest_enhanced_match'
|
336 |
) ),
|
337 |
-
'enhanced_match_email' => $this->
|
338 |
],
|
339 |
'snapchat' => [
|
340 |
'pixel_id' => $this->options_obj->snapchat->pixel_id,
|
@@ -360,8 +357,7 @@ class Pixel_Manager extends Script_Manager
|
|
360 |
$data['shop'] = $this->get_shop_data();
|
361 |
$data['general'] = $this->get_general_data();
|
362 |
$data['user'] = $this->get_user_data();
|
363 |
-
|
364 |
-
return apply_filters( 'wpm_experimental_data_layer', $data );
|
365 |
}
|
366 |
|
367 |
protected function get_order_data()
|
@@ -389,7 +385,7 @@ class Pixel_Manager extends Script_Manager
|
|
389 |
'coupon' => implode( ',', $order->get_coupon_codes() ),
|
390 |
'aw_merchant_id' => ( (int) $this->options['google']['ads']['aw_merchant_id'] ? (int) $this->options['google']['ads']['aw_merchant_id'] : '' ),
|
391 |
'aw_feed_country' => (string) $this->get_visitor_country(),
|
392 |
-
'aw_feed_language' => (string) $this->
|
393 |
'new_customer' => !$this->is_existing_customer( $order ),
|
394 |
'quantity' => (int) count( $this->wpm_get_order_items( $order ) ),
|
395 |
'items' => $this->get_front_end_order_items( $order ),
|
@@ -468,6 +464,9 @@ class Pixel_Manager extends Script_Manager
|
|
468 |
|
469 |
public function inject_wpm_opening()
|
470 |
{
|
|
|
|
|
|
|
471 |
echo PHP_EOL . '<!-- START WooCommerce Pixel Manager -->' . PHP_EOL ;
|
472 |
}
|
473 |
|
@@ -482,6 +481,9 @@ class Pixel_Manager extends Script_Manager
|
|
482 |
|
483 |
}
|
484 |
echo PHP_EOL . '<!-- END WooCommerce Pixel Manager -->' . PHP_EOL ;
|
|
|
|
|
|
|
485 |
}
|
486 |
|
487 |
private function increase_conversion_count_for_ratings( $order )
|
@@ -560,7 +562,7 @@ class Pixel_Manager extends Script_Manager
|
|
560 |
|
561 |
public function ajax_wpm_get_product_ids()
|
562 |
{
|
563 |
-
$_get = filter_input_array( INPUT_GET,
|
564 |
$product_ids = $_get['productIds'];
|
565 |
|
566 |
if ( !$product_ids ) {
|
@@ -595,7 +597,7 @@ class Pixel_Manager extends Script_Manager
|
|
595 |
// error_log('Invalid security token sent.');
|
596 |
// wp_die();
|
597 |
// }
|
598 |
-
$_post = filter_input_array( INPUT_POST,
|
599 |
$order_id = $_post['order_id'];
|
600 |
update_post_meta( $order_id, '_wpm_conversion_pixel_fired', true );
|
601 |
wp_send_json_success();
|
@@ -718,23 +720,13 @@ class Pixel_Manager extends Script_Manager
|
|
718 |
}
|
719 |
|
720 |
$data['currency'] = get_woocommerce_currency();
|
721 |
-
|
722 |
-
// $data['mini_cart']['track'] = apply_filters('wpm_track_mini_cart', $data['mini_cart']['track']);
|
723 |
-
$mini_cart_filter_deprecation_message = 'The filter has become obsolete since WPM now tracks cart item data using the browser cache and doesn\'t rely entirely on the server anymore.';
|
724 |
-
apply_filters_deprecated(
|
725 |
'wooptpm_track_mini_cart',
|
726 |
[ true ],
|
727 |
'1.13.0',
|
728 |
-
''
|
729 |
-
$mini_cart_filter_deprecation_message
|
730 |
-
);
|
731 |
-
apply_filters_deprecated(
|
732 |
-
'wpm_track_mini_cart',
|
733 |
-
[ true ],
|
734 |
-
'1.15.5',
|
735 |
-
'',
|
736 |
-
$mini_cart_filter_deprecation_message
|
737 |
);
|
|
|
738 |
$data['cookie_consent_mgmt'] = [
|
739 |
'explicit_consent' => (bool) $this->options_obj->shop->cookie_consent_mgmt->explicit_consent,
|
740 |
];
|
@@ -749,5 +741,37 @@ class Pixel_Manager extends Script_Manager
|
|
749 |
];
|
750 |
return $data;
|
751 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
752 |
|
753 |
}
|
2 |
|
3 |
namespace WCPM\Classes\Pixels;
|
4 |
|
5 |
+
use WCPM\Classes\Admin\Environment_Check ;
|
6 |
use WCPM\Classes\Pixels\Facebook\Facebook_Pixel_Manager ;
|
7 |
use WCPM\Classes\Pixels\Facebook\Facebook_Pixel_Manager_Microdata ;
|
|
|
8 |
use WCPM\Classes\Pixels\Google\Google_Analytics_Refund ;
|
9 |
use WCPM\Classes\Pixels\Google\Google_Pixel_Manager ;
|
10 |
+
use WCPM\Classes\Pixels\Google\Trait_Google ;
|
11 |
|
12 |
if ( !defined( 'ABSPATH' ) ) {
|
13 |
exit;
|
17 |
class Pixel_Manager extends Script_Manager
|
18 |
{
|
19 |
use Trait_Product ;
|
20 |
+
use Trait_Google ;
|
21 |
use Trait_Shop ;
|
22 |
protected $options ;
|
23 |
protected $options_obj ;
|
27 |
protected $dyn_r_ids ;
|
28 |
protected $transaction_deduper_timeout = 1000 ;
|
29 |
protected $position = 1 ;
|
|
|
30 |
public function __construct( $options )
|
31 |
{
|
32 |
/**
|
39 |
* Set a few states
|
40 |
*/
|
41 |
$this->facebook_active = !empty($this->options_obj->facebook->pixel_id);
|
42 |
+
$this->google_active = $this->google_active();
|
|
|
|
|
43 |
/**
|
44 |
* Inject pixel snippets in head
|
45 |
*/
|
69 |
/**
|
70 |
* Front-end script section
|
71 |
*/
|
72 |
+
add_action( 'wp_enqueue_scripts', [ $this, 'wpm_front_end_scripts' ] );
|
|
|
|
|
73 |
add_action( 'wp_ajax_wpm_get_cart_items', [ $this, 'ajax_wpm_get_cart_items' ] );
|
74 |
add_action( 'wp_ajax_nopriv_wpm_get_cart_items', [ $this, 'ajax_wpm_get_cart_items' ] );
|
75 |
add_action( 'wp_ajax_wpm_get_product_ids', [ $this, 'ajax_wpm_get_product_ids' ] );
|
239 |
{
|
240 |
?>
|
241 |
|
242 |
+
<script data-cfasync="false">
|
243 |
|
244 |
window.wpmDataLayer = window.wpmDataLayer || {}
|
245 |
window.wpmDataLayer = <?php
|
280 |
],
|
281 |
'google' => [
|
282 |
'ads' => [
|
283 |
+
'conversionIds' => (object) $this->get_google_ads_conversion_ids( is_order_received_page() ),
|
284 |
'dynamic_remarketing' => [
|
285 |
'status' => (bool) $this->options_obj->google->ads->dynamic_remarketing,
|
286 |
'id_type' => $this->get_dyn_r_id_type( 'google' ),
|
291 |
'wpm_send_events_with_parent_ids'
|
292 |
) ),
|
293 |
],
|
294 |
+
'google_business_vertical' => $this->get_google_business_vertical( $this->options['google']['ads']['google_business_vertical'] ),
|
295 |
'phone_conversion_label' => $this->options_obj->google->ads->phone_conversion_label,
|
296 |
'phone_conversion_number' => $this->options_obj->google->ads->phone_conversion_number,
|
297 |
],
|
298 |
'analytics' => [
|
299 |
'universal' => [
|
300 |
'property_id' => $this->options_obj->google->analytics->universal->property_id,
|
301 |
+
'parameters' => (object) $this->get_ga_ua_parameters( $this->options_obj->google->analytics->universal->property_id ),
|
302 |
'mp_active' => wpm_fs()->is__premium_only(),
|
303 |
],
|
304 |
'ga4' => [
|
305 |
'measurement_id' => $this->options_obj->google->analytics->ga4->measurement_id,
|
306 |
+
'parameters' => (object) $this->get_ga4_parameters( $this->options_obj->google->analytics->ga4->measurement_id ),
|
307 |
'mp_active' => $this->options_obj->google->analytics->ga4->api_secret && wpm_fs()->is__premium_only(),
|
308 |
],
|
309 |
+
'id_type' => $this->get_ga_id_type(),
|
310 |
'eec' => (bool) $this->options_obj->google->analytics->eec,
|
311 |
],
|
312 |
'optimize' => [
|
313 |
'container_id' => $this->options_obj->google->optimize->container_id,
|
314 |
],
|
315 |
'linker' => [
|
316 |
+
'settings' => $this->get_google_linker_settings(),
|
317 |
],
|
318 |
'user_id' => (bool) $this->options_obj->google->user_id,
|
319 |
],
|
331 |
'1.13.0',
|
332 |
'wpm_pinterest_enhanced_match'
|
333 |
) ),
|
334 |
+
'enhanced_match_email' => $this->get_pinterest_enhanced_match_email(),
|
335 |
],
|
336 |
'snapchat' => [
|
337 |
'pixel_id' => $this->options_obj->snapchat->pixel_id,
|
357 |
$data['shop'] = $this->get_shop_data();
|
358 |
$data['general'] = $this->get_general_data();
|
359 |
$data['user'] = $this->get_user_data();
|
360 |
+
return $data;
|
|
|
361 |
}
|
362 |
|
363 |
protected function get_order_data()
|
385 |
'coupon' => implode( ',', $order->get_coupon_codes() ),
|
386 |
'aw_merchant_id' => ( (int) $this->options['google']['ads']['aw_merchant_id'] ? (int) $this->options['google']['ads']['aw_merchant_id'] : '' ),
|
387 |
'aw_feed_country' => (string) $this->get_visitor_country(),
|
388 |
+
'aw_feed_language' => (string) $this->get_gmc_language(),
|
389 |
'new_customer' => !$this->is_existing_customer( $order ),
|
390 |
'quantity' => (int) count( $this->wpm_get_order_items( $order ) ),
|
391 |
'items' => $this->get_front_end_order_items( $order ),
|
464 |
|
465 |
public function inject_wpm_opening()
|
466 |
{
|
467 |
+
if ( ( new Environment_Check( $this->options ) )->is_autoptimize_active() ) {
|
468 |
+
$this->inject_noptimize_opening_tag();
|
469 |
+
}
|
470 |
echo PHP_EOL . '<!-- START WooCommerce Pixel Manager -->' . PHP_EOL ;
|
471 |
}
|
472 |
|
481 |
|
482 |
}
|
483 |
echo PHP_EOL . '<!-- END WooCommerce Pixel Manager -->' . PHP_EOL ;
|
484 |
+
if ( ( new Environment_Check( $this->options ) )->is_autoptimize_active() ) {
|
485 |
+
$this->inject_noptimize_closing_tag();
|
486 |
+
}
|
487 |
}
|
488 |
|
489 |
private function increase_conversion_count_for_ratings( $order )
|
562 |
|
563 |
public function ajax_wpm_get_product_ids()
|
564 |
{
|
565 |
+
$_get = filter_input_array( INPUT_GET, FILTER_SANITIZE_STRING );
|
566 |
$product_ids = $_get['productIds'];
|
567 |
|
568 |
if ( !$product_ids ) {
|
597 |
// error_log('Invalid security token sent.');
|
598 |
// wp_die();
|
599 |
// }
|
600 |
+
$_post = filter_input_array( INPUT_POST, FILTER_SANITIZE_STRING );
|
601 |
$order_id = $_post['order_id'];
|
602 |
update_post_meta( $order_id, '_wpm_conversion_pixel_fired', true );
|
603 |
wp_send_json_success();
|
720 |
}
|
721 |
|
722 |
$data['currency'] = get_woocommerce_currency();
|
723 |
+
$data['mini_cart']['track'] = apply_filters_deprecated(
|
|
|
|
|
|
|
724 |
'wooptpm_track_mini_cart',
|
725 |
[ true ],
|
726 |
'1.13.0',
|
727 |
+
'wpm_track_mini_cart'
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
728 |
);
|
729 |
+
$data['mini_cart']['track'] = apply_filters( 'wpm_track_mini_cart', $data['mini_cart']['track'] );
|
730 |
$data['cookie_consent_mgmt'] = [
|
731 |
'explicit_consent' => (bool) $this->options_obj->shop->cookie_consent_mgmt->explicit_consent,
|
732 |
];
|
741 |
];
|
742 |
return $data;
|
743 |
}
|
744 |
+
|
745 |
+
protected function get_pinterest_enhanced_match_email()
|
746 |
+
{
|
747 |
+
|
748 |
+
if ( is_user_logged_in() ) {
|
749 |
+
$current_user = wp_get_current_user();
|
750 |
+
$email = $current_user->user_email;
|
751 |
+
} elseif ( is_order_received_page() ) {
|
752 |
+
$order = $this->get_order_from_order_received_page();
|
753 |
+
|
754 |
+
if ( $order ) {
|
755 |
+
$email = $order->get_billing_email();
|
756 |
+
} else {
|
757 |
+
$email = '';
|
758 |
+
}
|
759 |
+
|
760 |
+
} else {
|
761 |
+
$email = '';
|
762 |
+
}
|
763 |
+
|
764 |
+
return $email;
|
765 |
+
}
|
766 |
+
|
767 |
+
private function inject_noptimize_opening_tag()
|
768 |
+
{
|
769 |
+
echo PHP_EOL . '<!--noptimize-->' ;
|
770 |
+
}
|
771 |
+
|
772 |
+
private function inject_noptimize_closing_tag()
|
773 |
+
{
|
774 |
+
echo '<!--/noptimize-->' . PHP_EOL . PHP_EOL ;
|
775 |
+
}
|
776 |
|
777 |
}
|
classes/pixels/class-pixel.php
CHANGED
@@ -17,6 +17,7 @@ class Pixel {
|
|
17 |
protected $conversion_label;
|
18 |
protected $dynamic_remarketing;
|
19 |
protected $google_business_vertical;
|
|
|
20 |
protected $ip;
|
21 |
protected $order_total_logic;
|
22 |
protected $product_identifier;
|
@@ -32,6 +33,7 @@ class Pixel {
|
|
32 |
$this->options = $options;
|
33 |
$this->options_obj = json_decode(wp_json_encode($this->options));
|
34 |
|
|
|
35 |
$this->options_obj->shop->currency = get_woocommerce_currency();
|
36 |
|
37 |
$this->order_total_logic = $this->options['shop']['order_total_logic'];
|
@@ -41,5 +43,9 @@ class Pixel {
|
|
41 |
$this->conversion_label = $this->options['google']['ads']['conversion_label'];
|
42 |
$this->dynamic_remarketing = $this->options['google']['ads']['dynamic_remarketing'];
|
43 |
$this->product_identifier = $this->options['google']['ads']['product_identifier'];
|
|
|
|
|
|
|
|
|
44 |
}
|
45 |
}
|
17 |
protected $conversion_label;
|
18 |
protected $dynamic_remarketing;
|
19 |
protected $google_business_vertical;
|
20 |
+
protected $gtag_deactivation;
|
21 |
protected $ip;
|
22 |
protected $order_total_logic;
|
23 |
protected $product_identifier;
|
33 |
$this->options = $options;
|
34 |
$this->options_obj = json_decode(wp_json_encode($this->options));
|
35 |
|
36 |
+
$this->options_obj->shop->currency = new stdClass();
|
37 |
$this->options_obj->shop->currency = get_woocommerce_currency();
|
38 |
|
39 |
$this->order_total_logic = $this->options['shop']['order_total_logic'];
|
43 |
$this->conversion_label = $this->options['google']['ads']['conversion_label'];
|
44 |
$this->dynamic_remarketing = $this->options['google']['ads']['dynamic_remarketing'];
|
45 |
$this->product_identifier = $this->options['google']['ads']['product_identifier'];
|
46 |
+
|
47 |
+
if (array_key_exists('gtag', $this->options['google'])) {
|
48 |
+
$this->gtag_deactivation = $this->options['google']['gtag']['deactivation'];
|
49 |
+
}
|
50 |
}
|
51 |
}
|
classes/pixels/class-script-manager.php
CHANGED
@@ -40,7 +40,7 @@ class Script_Manager
|
|
40 |
public function inject_head_pixels()
|
41 |
{
|
42 |
global $woocommerce ;
|
43 |
-
$_post = filter_input_array( INPUT_POST,
|
44 |
$this->inject_opening_script_tag();
|
45 |
$this->inject_everywhere();
|
46 |
|
@@ -145,9 +145,11 @@ class Script_Manager
|
|
145 |
// error_log('order number: ' . $order->get_order_number());
|
146 |
// error_log('get_post_meta($order->get_order_number(), \'_wpm_conversion_pixel_fired\', true): ' . get_post_meta($order->get_order_number(), '_wpm_conversion_pixel_fired', true));
|
147 |
|
148 |
-
if ( $this->is_nodedupe_parameter_set() || !$order->has_status( 'failed' ) &&
|
|
|
149 |
return true;
|
150 |
} else {
|
|
|
151 |
return false;
|
152 |
}
|
153 |
|
@@ -192,7 +194,7 @@ class Script_Manager
|
|
192 |
|
193 |
protected function is_nodedupe_parameter_set()
|
194 |
{
|
195 |
-
$_get = filter_input_array( INPUT_GET,
|
196 |
|
197 |
if ( isset( $_get['nodedupe'] ) ) {
|
198 |
return true;
|
@@ -204,7 +206,7 @@ class Script_Manager
|
|
204 |
|
205 |
protected function query_string_contains_all_variation_attributes( $product )
|
206 |
{
|
207 |
-
$_server = filter_input_array( INPUT_SERVER,
|
208 |
|
209 |
if ( !empty($_server['QUERY_STRING']) ) {
|
210 |
parse_str( $_server['QUERY_STRING'], $query_string_attributes );
|
@@ -222,7 +224,7 @@ class Script_Manager
|
|
222 |
|
223 |
protected function get_variation_from_query_string( $product_id, $product )
|
224 |
{
|
225 |
-
$_server = filter_input_array( INPUT_SERVER,
|
226 |
parse_str( $_server['QUERY_STRING'], $query_string_attributes );
|
227 |
$search_variation_attributes = [];
|
228 |
foreach ( array_keys( $product->get_attributes() ) as $variation_attribute => $value ) {
|
@@ -240,22 +242,16 @@ class Script_Manager
|
|
240 |
{
|
241 |
?>
|
242 |
|
243 |
-
<!--
|
244 |
-
|
245 |
-
|
246 |
-
|
247 |
-
- The pixels have already been fired. To prevent double counting the pixels are only fired once.
|
248 |
-
|
249 |
If you want to test the order you have two options:
|
250 |
-
- Turn off order
|
251 |
-
- Add the '&nodedupe' parameter to the order confirmation URL like this:
|
252 |
-
https://example.test/checkout/order-received/123/?key=wc_order_123abc&nodedupe
|
253 |
-
|
254 |
More info on testing: <?php
|
255 |
esc_html_e( ( new Documentation() )->get_link( 'test_order' ) );
|
256 |
?>
|
257 |
-
|
258 |
-
----------------------------------------------------------------------------------------------------
|
259 |
-->
|
260 |
<?php
|
261 |
}
|
40 |
public function inject_head_pixels()
|
41 |
{
|
42 |
global $woocommerce ;
|
43 |
+
$_post = filter_input_array( INPUT_POST, FILTER_SANITIZE_STRING );
|
44 |
$this->inject_opening_script_tag();
|
45 |
$this->inject_everywhere();
|
46 |
|
145 |
// error_log('order number: ' . $order->get_order_number());
|
146 |
// error_log('get_post_meta($order->get_order_number(), \'_wpm_conversion_pixel_fired\', true): ' . get_post_meta($order->get_order_number(), '_wpm_conversion_pixel_fired', true));
|
147 |
|
148 |
+
if ( $this->is_nodedupe_parameter_set() || !$order->has_status( 'failed' ) && !current_user_can( 'edit_others_pages' ) && false == $conversion_prevention && (!$this->options['shop']['order_deduplication'] || $this->has_conversion_pixel_already_fired( $order ) != true) ) {
|
149 |
+
// error_log('fire pixels: true' . PHP_EOL);
|
150 |
return true;
|
151 |
} else {
|
152 |
+
// error_log('fire pixels: false' . PHP_EOL);
|
153 |
return false;
|
154 |
}
|
155 |
|
194 |
|
195 |
protected function is_nodedupe_parameter_set()
|
196 |
{
|
197 |
+
$_get = filter_input_array( INPUT_GET, FILTER_SANITIZE_STRING );
|
198 |
|
199 |
if ( isset( $_get['nodedupe'] ) ) {
|
200 |
return true;
|
206 |
|
207 |
protected function query_string_contains_all_variation_attributes( $product )
|
208 |
{
|
209 |
+
$_server = filter_input_array( INPUT_SERVER, FILTER_SANITIZE_STRING );
|
210 |
|
211 |
if ( !empty($_server['QUERY_STRING']) ) {
|
212 |
parse_str( $_server['QUERY_STRING'], $query_string_attributes );
|
224 |
|
225 |
protected function get_variation_from_query_string( $product_id, $product )
|
226 |
{
|
227 |
+
$_server = filter_input_array( INPUT_SERVER, FILTER_SANITIZE_STRING );
|
228 |
parse_str( $_server['QUERY_STRING'], $query_string_attributes );
|
229 |
$search_variation_attributes = [];
|
230 |
foreach ( array_keys( $product->get_attributes() ) as $variation_attribute => $value ) {
|
242 |
{
|
243 |
?>
|
244 |
|
245 |
+
<!-- The conversion pixels have not been inserted. Possible reasons:
|
246 |
+
You are logged into WooCommerce as admin or shop manager.
|
247 |
+
The order payment has failed.
|
248 |
+
The pixels have already been fired. To prevent double counting the pixels are only fired once.
|
|
|
|
|
249 |
If you want to test the order you have two options:
|
250 |
+
- Turn off order deduplication in the advanced settings
|
251 |
+
- Add the '&nodedupe' parameter to the order confirmation URL like this: https://example.test/checkout/order-received/123/?key=wc_order_123abc&nodedupe
|
|
|
|
|
252 |
More info on testing: <?php
|
253 |
esc_html_e( ( new Documentation() )->get_link( 'test_order' ) );
|
254 |
?>
|
|
|
|
|
255 |
-->
|
256 |
<?php
|
257 |
}
|
classes/pixels/class-shortcodes.php
CHANGED
@@ -2,22 +2,19 @@
|
|
2 |
|
3 |
namespace WCPM\Classes\Pixels;
|
4 |
|
5 |
-
use WCPM\Classes\Pixels\Google\
|
6 |
|
7 |
if (!defined('ABSPATH')) {
|
8 |
exit; // Exit if accessed directly
|
9 |
}
|
10 |
|
11 |
class Shortcodes extends Pixel {
|
|
|
12 |
use Trait_Product;
|
13 |
|
14 |
-
private $google;
|
15 |
-
|
16 |
public function __construct( $options ) {
|
17 |
parent::__construct($options);
|
18 |
|
19 |
-
$this->google = new Google($options);
|
20 |
-
|
21 |
add_shortcode('view-item', [$this, 'wpm_view_item']);
|
22 |
add_shortcode('conversion-pixel', [$this, 'wpm_conversion_pixel']);
|
23 |
}
|
@@ -42,9 +39,9 @@ class Shortcodes extends Pixel {
|
|
42 |
?>
|
43 |
|
44 |
<script>
|
45 |
-
jQuery(window).on(
|
46 |
-
jQuery(document).trigger(
|
47 |
-
})
|
48 |
</script>
|
49 |
<?php
|
50 |
}
|
@@ -72,10 +69,10 @@ class Shortcodes extends Pixel {
|
|
72 |
$shortcode_attributes = shortcode_atts($pairs, $attributes);
|
73 |
|
74 |
if ('google-ads' === $shortcode_attributes['pixel']) {
|
75 |
-
if ($this->
|
76 |
$this->conversion_html_google_ads($shortcode_attributes);
|
77 |
}
|
78 |
-
} elseif ('facebook' === $shortcode_attributes['pixel']
|
79 |
if ($this->options_obj->facebook->pixel_id) {
|
80 |
$this->conversion_html_facebook($shortcode_attributes);
|
81 |
}
|
@@ -100,7 +97,7 @@ class Shortcodes extends Pixel {
|
|
100 |
$this->conversion_html_tiktok($shortcode_attributes);
|
101 |
}
|
102 |
} elseif ('all' === $shortcode_attributes['pixel']) {
|
103 |
-
if ($this->
|
104 |
$this->conversion_html_google_ads($shortcode_attributes);
|
105 |
}
|
106 |
if ($this->options_obj->facebook->pixel_id) {
|
@@ -129,9 +126,9 @@ class Shortcodes extends Pixel {
|
|
129 |
?>
|
130 |
|
131 |
<script>
|
132 |
-
wpmFunctionExists(
|
133 |
-
snaptr(
|
134 |
-
}
|
135 |
)
|
136 |
</script>
|
137 |
<?php
|
@@ -142,9 +139,9 @@ class Shortcodes extends Pixel {
|
|
142 |
?>
|
143 |
|
144 |
<script>
|
145 |
-
wpmFunctionExists(
|
146 |
-
ttq.track('<?php echo esc_js($shortcode_attributes['tiktok-event']); ?>')
|
147 |
-
}
|
148 |
)
|
149 |
</script>
|
150 |
<?php
|
@@ -155,9 +152,9 @@ class Shortcodes extends Pixel {
|
|
155 |
?>
|
156 |
|
157 |
<script>
|
158 |
-
wpmFunctionExists(
|
159 |
-
if (wpm.googleConfigConditionsMet(
|
160 |
-
}
|
161 |
)
|
162 |
</script>
|
163 |
<?php
|
@@ -170,24 +167,24 @@ class Shortcodes extends Pixel {
|
|
170 |
?>
|
171 |
|
172 |
<script>
|
173 |
-
jQuery(window).on(
|
174 |
|
175 |
-
let eventId = wpm.getRandomEventId()
|
176 |
|
177 |
-
wpmFunctionExists(
|
178 |
-
fbq(
|
179 |
eventID: eventId,
|
180 |
-
})
|
181 |
-
}
|
182 |
)
|
183 |
|
184 |
-
jQuery(document).trigger(
|
185 |
event_name : "<?php echo esc_js($shortcode_attributes['fbc-event']); ?>",
|
186 |
event_id : eventId,
|
187 |
user_data : wpm.getFbUserData(),
|
188 |
-
event_source_url: window.location.href
|
189 |
-
})
|
190 |
-
})
|
191 |
|
192 |
</script>
|
193 |
<?php
|
@@ -195,9 +192,9 @@ class Shortcodes extends Pixel {
|
|
195 |
?>
|
196 |
|
197 |
<script>
|
198 |
-
wpmFunctionExists(
|
199 |
-
fbq(
|
200 |
-
}
|
201 |
)
|
202 |
</script>
|
203 |
<?php
|
@@ -210,9 +207,9 @@ class Shortcodes extends Pixel {
|
|
210 |
?>
|
211 |
|
212 |
<script>
|
213 |
-
wpmFunctionExists(
|
214 |
-
twq(
|
215 |
-
}
|
216 |
)
|
217 |
</script>
|
218 |
<?php
|
@@ -226,9 +223,9 @@ class Shortcodes extends Pixel {
|
|
226 |
?>
|
227 |
|
228 |
<script>
|
229 |
-
wpmFunctionExists(
|
230 |
-
pintrk(
|
231 |
-
}
|
232 |
)
|
233 |
</script>
|
234 |
<?php
|
@@ -236,11 +233,11 @@ class Shortcodes extends Pixel {
|
|
236 |
?>
|
237 |
|
238 |
<script>
|
239 |
-
wpmFunctionExists(
|
240 |
-
pintrk(
|
241 |
-
lead_type: '<?php echo esc_js($shortcode_attributes['pinc-lead-type']); ?>'
|
242 |
-
})
|
243 |
-
}
|
244 |
)
|
245 |
</script>
|
246 |
<?php
|
@@ -252,14 +249,14 @@ class Shortcodes extends Pixel {
|
|
252 |
?>
|
253 |
|
254 |
<script>
|
255 |
-
wpmFunctionExists(
|
256 |
-
window.uetq = window.uetq || []
|
257 |
-
window.uetq.push(
|
258 |
-
|
259 |
-
|
260 |
-
|
261 |
-
})
|
262 |
-
}
|
263 |
)
|
264 |
</script>
|
265 |
<?php
|
@@ -269,14 +266,14 @@ class Shortcodes extends Pixel {
|
|
269 |
?>
|
270 |
|
271 |
<script>
|
272 |
-
if (typeof wpmFunctionExists !==
|
273 |
window.wpmFunctionExists = function (functionName) {
|
274 |
return new Promise(function (resolve) {
|
275 |
(function waitForVar() {
|
276 |
-
if (typeof window[functionName] !==
|
277 |
-
setTimeout(waitForVar, 1000)
|
278 |
-
})()
|
279 |
-
})
|
280 |
}
|
281 |
}
|
282 |
</script>
|
2 |
|
3 |
namespace WCPM\Classes\Pixels;
|
4 |
|
5 |
+
use WCPM\Classes\Pixels\Google\Trait_Google;
|
6 |
|
7 |
if (!defined('ABSPATH')) {
|
8 |
exit; // Exit if accessed directly
|
9 |
}
|
10 |
|
11 |
class Shortcodes extends Pixel {
|
12 |
+
use Trait_Google;
|
13 |
use Trait_Product;
|
14 |
|
|
|
|
|
15 |
public function __construct( $options ) {
|
16 |
parent::__construct($options);
|
17 |
|
|
|
|
|
18 |
add_shortcode('view-item', [$this, 'wpm_view_item']);
|
19 |
add_shortcode('conversion-pixel', [$this, 'wpm_conversion_pixel']);
|
20 |
}
|
39 |
?>
|
40 |
|
41 |
<script>
|
42 |
+
jQuery(window).on('wpmLoad', function () {
|
43 |
+
jQuery(document).trigger('wpmViewItem', wpm.getProductDetailsFormattedForEvent(<?php echo esc_js($shortcode_attributes['product-id']); ?>));
|
44 |
+
});
|
45 |
</script>
|
46 |
<?php
|
47 |
}
|
69 |
$shortcode_attributes = shortcode_atts($pairs, $attributes);
|
70 |
|
71 |
if ('google-ads' === $shortcode_attributes['pixel']) {
|
72 |
+
if ($this->is_google_ads_active()) {
|
73 |
$this->conversion_html_google_ads($shortcode_attributes);
|
74 |
}
|
75 |
+
} elseif ('facebook' === $shortcode_attributes['pixel']) {
|
76 |
if ($this->options_obj->facebook->pixel_id) {
|
77 |
$this->conversion_html_facebook($shortcode_attributes);
|
78 |
}
|
97 |
$this->conversion_html_tiktok($shortcode_attributes);
|
98 |
}
|
99 |
} elseif ('all' === $shortcode_attributes['pixel']) {
|
100 |
+
if ($this->is_google_ads_active()) {
|
101 |
$this->conversion_html_google_ads($shortcode_attributes);
|
102 |
}
|
103 |
if ($this->options_obj->facebook->pixel_id) {
|
126 |
?>
|
127 |
|
128 |
<script>
|
129 |
+
wpmFunctionExists('snaptr').then(function () {
|
130 |
+
snaptr('track', '<?php echo esc_js($shortcode_attributes['snap-event']); ?>');
|
131 |
+
}
|
132 |
)
|
133 |
</script>
|
134 |
<?php
|
139 |
?>
|
140 |
|
141 |
<script>
|
142 |
+
wpmFunctionExists('ttq').then(function () {
|
143 |
+
ttq.track('<?php echo esc_js($shortcode_attributes['tiktok-event']); ?>');
|
144 |
+
}
|
145 |
)
|
146 |
</script>
|
147 |
<?php
|
152 |
?>
|
153 |
|
154 |
<script>
|
155 |
+
wpmFunctionExists('gtag').then(function () {
|
156 |
+
if (wpm.googleConfigConditionsMet('ads')) gtag('event', 'conversion', {'send_to': 'AW-<?php echo esc_js($shortcode_attributes['gads-conversion-id']); ?>/<?php echo esc_js($shortcode_attributes['gads-conversion-label']); ?>'});
|
157 |
+
}
|
158 |
)
|
159 |
</script>
|
160 |
<?php
|
167 |
?>
|
168 |
|
169 |
<script>
|
170 |
+
jQuery(window).on('wpmLoad', function () {
|
171 |
|
172 |
+
let eventId = wpm.getRandomEventId();
|
173 |
|
174 |
+
wpmFunctionExists('fbq').then(function () {
|
175 |
+
fbq('track', '<?php echo esc_js($shortcode_attributes['fbc-event']); ?>', {}, {
|
176 |
eventID: eventId,
|
177 |
+
});
|
178 |
+
}
|
179 |
)
|
180 |
|
181 |
+
jQuery(document).trigger('wpmFbCapiEvent', {
|
182 |
event_name : "<?php echo esc_js($shortcode_attributes['fbc-event']); ?>",
|
183 |
event_id : eventId,
|
184 |
user_data : wpm.getFbUserData(),
|
185 |
+
event_source_url: window.location.href
|
186 |
+
});
|
187 |
+
});
|
188 |
|
189 |
</script>
|
190 |
<?php
|
192 |
?>
|
193 |
|
194 |
<script>
|
195 |
+
wpmFunctionExists('fbq').then(function () {
|
196 |
+
fbq('track', '<?php echo esc_js($shortcode_attributes['fbc-event']); ?>');
|
197 |
+
}
|
198 |
)
|
199 |
</script>
|
200 |
<?php
|
207 |
?>
|
208 |
|
209 |
<script>
|
210 |
+
wpmFunctionExists('twq').then(function () {
|
211 |
+
twq('track', '<?php echo esc_js($shortcode_attributes['twc-event']); ?>');
|
212 |
+
}
|
213 |
)
|
214 |
</script>
|
215 |
<?php
|
223 |
?>
|
224 |
|
225 |
<script>
|
226 |
+
wpmFunctionExists('pintrk').then(function () {
|
227 |
+
pintrk('track', '<?php echo esc_js($shortcode_attributes['pinc-event']); ?>');
|
228 |
+
}
|
229 |
)
|
230 |
</script>
|
231 |
<?php
|
233 |
?>
|
234 |
|
235 |
<script>
|
236 |
+
wpmFunctionExists('pintrk').then(function () {
|
237 |
+
pintrk('track', '<?php echo esc_js($shortcode_attributes['pinc-event']); ?>', {
|
238 |
+
lead_type: '<?php echo esc_js($shortcode_attributes['pinc-lead-type']); ?>'
|
239 |
+
});
|
240 |
+
}
|
241 |
)
|
242 |
</script>
|
243 |
<?php
|
249 |
?>
|
250 |
|
251 |
<script>
|
252 |
+
wpmFunctionExists('uetq').then(function () {
|
253 |
+
window.uetq = window.uetq || [];
|
254 |
+
window.uetq.push('event', '<?php echo esc_js($shortcode_attributes['ms-ads-event']); ?>', {
|
255 |
+
'event_category': '<?php echo esc_js($shortcode_attributes['ms-ads-event-category']); ?>',
|
256 |
+
'event_label' : '<?php echo esc_js($shortcode_attributes['ms-ads-event-label']); ?>',
|
257 |
+
'event_value' : '<?php echo esc_js($shortcode_attributes['ms-ads-event-value']); ?>'
|
258 |
+
});
|
259 |
+
}
|
260 |
)
|
261 |
</script>
|
262 |
<?php
|
266 |
?>
|
267 |
|
268 |
<script>
|
269 |
+
if (typeof wpmFunctionExists !== 'function') {
|
270 |
window.wpmFunctionExists = function (functionName) {
|
271 |
return new Promise(function (resolve) {
|
272 |
(function waitForVar() {
|
273 |
+
if (typeof window[functionName] !== 'undefined') return resolve();
|
274 |
+
setTimeout(waitForVar, 1000);
|
275 |
+
})();
|
276 |
+
});
|
277 |
}
|
278 |
}
|
279 |
</script>
|
classes/pixels/google/class-google-analytics-refund.php
CHANGED
@@ -12,6 +12,7 @@ if ( !defined( 'ABSPATH' ) ) {
|
|
12 |
|
13 |
class Google_Analytics_Refund extends Google_Analytics
|
14 |
{
|
|
|
15 |
public function __construct( $options )
|
16 |
{
|
17 |
parent::__construct( $options );
|
12 |
|
13 |
class Google_Analytics_Refund extends Google_Analytics
|
14 |
{
|
15 |
+
use Trait_Google ;
|
16 |
public function __construct( $options )
|
17 |
{
|
18 |
parent::__construct( $options );
|
classes/pixels/google/class-google-pixel-manager.php
CHANGED
@@ -13,9 +13,16 @@ if ( !defined( 'ABSPATH' ) ) {
|
|
13 |
|
14 |
class Google_Pixel_Manager extends Script_Manager
|
15 |
{
|
|
|
16 |
private $google_pixel ;
|
|
|
|
|
|
|
|
|
17 |
private $google_analytics_ua_http_mp ;
|
18 |
private $google_analytics_4_http_mp ;
|
|
|
|
|
19 |
private $cid_key_ga_ua ;
|
20 |
private $cid_key_ga4 ;
|
21 |
public function __construct( $options )
|
@@ -24,28 +31,16 @@ class Google_Pixel_Manager extends Script_Manager
|
|
24 |
$this->google_pixel = new Google( $options );
|
25 |
}
|
26 |
|
27 |
-
protected function log_prevented_order_report_for_user( $order )
|
28 |
-
{
|
29 |
-
|
30 |
-
if ( is_user_logged_in() ) {
|
31 |
-
$user_info = $order->get_user();
|
32 |
-
wc_get_logger()->debug( 'Prevented order ID ' . $order->get_id() . ' to be reported through the Measurement Protocol for user ' . $user_info->user_login . ' (roles: ' . implode( ', ', $user_info->roles ) . ')', [
|
33 |
-
'source' => 'wpm',
|
34 |
-
] );
|
35 |
-
}
|
36 |
-
|
37 |
-
}
|
38 |
-
|
39 |
public function inject_order_received_page_dedupe( $order, $order_total, $is_new_customer )
|
40 |
{
|
41 |
-
if ( $this->
|
42 |
$this->save_gclid_in_order__premium_only( $order );
|
43 |
}
|
44 |
}
|
45 |
|
46 |
public function inject_order_received_page_no_dedupe( $order, $order_total, $is_new_customer )
|
47 |
{
|
48 |
-
if ( $this->
|
49 |
$this->save_gclid_in_order__premium_only( $order );
|
50 |
}
|
51 |
}
|
13 |
|
14 |
class Google_Pixel_Manager extends Script_Manager
|
15 |
{
|
16 |
+
use Trait_Google ;
|
17 |
private $google_pixel ;
|
18 |
+
private $google_ads_pixel ;
|
19 |
+
private $google_analytics_ua_standard_pixel ;
|
20 |
+
private $google_analytics_4_standard_pixel ;
|
21 |
+
private $google_analytics_ua_eec_pixel ;
|
22 |
private $google_analytics_ua_http_mp ;
|
23 |
private $google_analytics_4_http_mp ;
|
24 |
+
// private $google_analytics_ua_refund_pixel;
|
25 |
+
private $google_analytics_4_eec_pixel ;
|
26 |
private $cid_key_ga_ua ;
|
27 |
private $cid_key_ga4 ;
|
28 |
public function __construct( $options )
|
31 |
$this->google_pixel = new Google( $options );
|
32 |
}
|
33 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
34 |
public function inject_order_received_page_dedupe( $order, $order_total, $is_new_customer )
|
35 |
{
|
36 |
+
if ( $this->is_google_ads_active() && wpm_fs()->is__premium_only() ) {
|
37 |
$this->save_gclid_in_order__premium_only( $order );
|
38 |
}
|
39 |
}
|
40 |
|
41 |
public function inject_order_received_page_no_dedupe( $order, $order_total, $is_new_customer )
|
42 |
{
|
43 |
+
if ( $this->is_google_ads_active() && wpm_fs()->is__premium_only() ) {
|
44 |
$this->save_gclid_in_order__premium_only( $order );
|
45 |
}
|
46 |
}
|
classes/pixels/google/class-google.php
CHANGED
@@ -2,405 +2,23 @@
|
|
2 |
|
3 |
namespace WCPM\Classes\Pixels\Google;
|
4 |
|
5 |
-
use
|
6 |
-
use
|
7 |
-
use WCPM\Classes\Pixels\Trait_Shop ;
|
8 |
|
9 |
-
if (
|
10 |
-
|
11 |
-
// Exit if accessed directly
|
12 |
}
|
13 |
|
14 |
-
class Google extends Pixel
|
15 |
-
|
16 |
-
|
17 |
-
public function __construct( $options )
|
18 |
-
{
|
19 |
-
parent::__construct( $options );
|
20 |
-
$this->google_business_vertical = $this->get_google_business_vertical( $this->options['google']['ads']['google_business_vertical'] );
|
21 |
-
$this->pixel_name = 'google';
|
22 |
-
}
|
23 |
-
|
24 |
-
public function get_order_item_data( $order_item )
|
25 |
-
{
|
26 |
-
$product = $order_item->get_product();
|
27 |
-
|
28 |
-
if ( !is_object( $product ) ) {
|
29 |
-
wc_get_logger()->debug( 'get_order_item_data received an order item which is not a valid product: ' . $order_item->get_id(), [
|
30 |
-
'source' => 'wpm',
|
31 |
-
] );
|
32 |
-
return [];
|
33 |
-
}
|
34 |
-
|
35 |
-
$dyn_r_ids = $this->get_dyn_r_ids( $product );
|
36 |
-
|
37 |
-
if ( $product->get_type() === 'variation' ) {
|
38 |
-
$parent_product = wc_get_product( $product->get_parent_id() );
|
39 |
-
$name = $parent_product->get_name();
|
40 |
-
} else {
|
41 |
-
$name = $product->get_name();
|
42 |
-
}
|
43 |
-
|
44 |
-
return [
|
45 |
-
'id' => (string) $dyn_r_ids[$this->get_ga_id_type()],
|
46 |
-
'name' => (string) $name,
|
47 |
-
'quantity' => (int) $order_item['quantity'],
|
48 |
-
'affiliation' => (string) get_bloginfo( 'name' ),
|
49 |
-
'brand' => (string) $this->get_brand_name( $product->get_id() ),
|
50 |
-
'category' => implode( ',', $this->get_product_category( $product->get_id() ) ),
|
51 |
-
'category_array' => $this->get_product_category( $product->get_id() ),
|
52 |
-
'variant' => ( (string) ($product->get_type() === 'variation') ? $this->get_formatted_variant_text( $product ) : '' ),
|
53 |
-
'price' => (double) $this->wpm_get_order_item_price( $order_item, $product ),
|
54 |
-
];
|
55 |
-
}
|
56 |
-
|
57 |
-
public function get_ga_id_type()
|
58 |
-
{
|
59 |
-
$ga_id_type = 'post_id';
|
60 |
-
$ga_id_type = apply_filters_deprecated(
|
61 |
-
'wooptpm_product_id_type_for_google_analytics',
|
62 |
-
[ $ga_id_type ],
|
63 |
-
'1.13.0',
|
64 |
-
'wpm_product_id_type_for_google_analytics'
|
65 |
-
);
|
66 |
-
// Change the output of the product ID type for Google Analytics
|
67 |
-
return apply_filters( 'wpm_product_id_type_for_google_analytics', $ga_id_type );
|
68 |
-
}
|
69 |
-
|
70 |
-
public function google_active()
|
71 |
-
{
|
72 |
-
|
73 |
-
if ( $this->options_obj->google->analytics->universal->property_id ) {
|
74 |
-
return true;
|
75 |
-
} elseif ( $this->options_obj->google->analytics->ga4->measurement_id ) {
|
76 |
-
return true;
|
77 |
-
} elseif ( $this->options_obj->google->ads->conversion_id ) {
|
78 |
-
return true;
|
79 |
-
} else {
|
80 |
-
return false;
|
81 |
-
}
|
82 |
-
|
83 |
-
}
|
84 |
-
|
85 |
-
public function is_google_ads_active()
|
86 |
-
{
|
87 |
-
|
88 |
-
if ( $this->options['google']['ads']['conversion_id'] ) {
|
89 |
-
return true;
|
90 |
-
} else {
|
91 |
-
return false;
|
92 |
-
}
|
93 |
-
|
94 |
-
}
|
95 |
-
|
96 |
-
public function is_google_analytics_active()
|
97 |
-
{
|
98 |
-
|
99 |
-
if ( $this->is_google_analytics_ua_active() || $this->is_google_analytics_4_active() ) {
|
100 |
-
return true;
|
101 |
-
} else {
|
102 |
-
return false;
|
103 |
-
}
|
104 |
-
|
105 |
-
}
|
106 |
-
|
107 |
-
public function is_google_analytics_ua_active()
|
108 |
-
{
|
109 |
-
|
110 |
-
if ( $this->options_obj->google->analytics->universal->property_id ) {
|
111 |
-
return true;
|
112 |
-
} else {
|
113 |
-
return false;
|
114 |
-
}
|
115 |
-
|
116 |
-
}
|
117 |
-
|
118 |
-
protected function is_google_analytics_4_active()
|
119 |
-
{
|
120 |
-
|
121 |
-
if ( $this->options_obj->google->analytics->ga4->measurement_id ) {
|
122 |
-
return true;
|
123 |
-
} else {
|
124 |
-
return false;
|
125 |
-
}
|
126 |
-
|
127 |
-
}
|
128 |
-
|
129 |
-
public function is_google_analytics_4_mp_active()
|
130 |
-
{
|
131 |
-
|
132 |
-
if ( $this->options_obj->google->analytics->ga4->measurement_id && $this->options_obj->google->analytics->ga4->api_secret ) {
|
133 |
-
return true;
|
134 |
-
} else {
|
135 |
-
return false;
|
136 |
-
}
|
137 |
-
|
138 |
-
}
|
139 |
-
|
140 |
-
public function wpm_get_order_item_price( $order_item, $product )
|
141 |
-
{
|
142 |
-
|
143 |
-
if ( ( new Environment_Check( $this->options ) )->is_woo_discount_rules_active() ) {
|
144 |
-
$item_value = $order_item->get_meta( '_advanced_woo_discount_item_total_discount' );
|
145 |
-
|
146 |
-
if ( is_array( $item_value ) && array_key_exists( 'discounted_price', $item_value ) && 0 != $item_value['discounted_price'] ) {
|
147 |
-
return (double) $item_value['discounted_price'];
|
148 |
-
} elseif ( is_array( $item_value ) && array_key_exists( 'initial_price', $item_value ) && 0 != $item_value['initial_price'] ) {
|
149 |
-
return (double) $item_value['initial_price'];
|
150 |
-
} else {
|
151 |
-
return (double) $product->get_price();
|
152 |
-
}
|
153 |
-
|
154 |
-
} else {
|
155 |
-
return (double) $product->get_price();
|
156 |
-
}
|
157 |
-
|
158 |
-
}
|
159 |
-
|
160 |
-
public function add_categories_to_ga4_product_items( $item_details_array, $categories )
|
161 |
-
{
|
162 |
-
$categories = array_unique( $categories );
|
163 |
-
|
164 |
-
if ( count( $categories ) > 0 ) {
|
165 |
-
$max_categories = 5;
|
166 |
-
$item_details_array['item_category'] = $categories[0];
|
167 |
-
$max = ( count( $categories ) > $max_categories ? $max_categories : count( $categories ) );
|
168 |
-
for ( $i = 1 ; $i < $max ; $i++ ) {
|
169 |
-
$item_details_array['item_category' . ($i + 1)] = $categories[$i];
|
170 |
-
}
|
171 |
-
}
|
172 |
-
|
173 |
-
return $item_details_array;
|
174 |
-
}
|
175 |
-
|
176 |
-
public function get_google_business_vertical( $id )
|
177 |
-
{
|
178 |
-
$verticals = [
|
179 |
-
0 => 'retail',
|
180 |
-
1 => 'education',
|
181 |
-
2 => 'flights',
|
182 |
-
3 => 'hotel_rental',
|
183 |
-
4 => 'jobs',
|
184 |
-
5 => 'local',
|
185 |
-
6 => 'real_estate',
|
186 |
-
7 => 'travel',
|
187 |
-
8 => 'custom',
|
188 |
-
];
|
189 |
-
return $verticals[$id];
|
190 |
-
}
|
191 |
-
|
192 |
-
public function get_google_ads_conversion_ids( $purchase = false )
|
193 |
-
{
|
194 |
-
$this->google_ads_conversion_identifiers[$this->options['google']['ads']['conversion_id']] = $this->options['google']['ads']['conversion_label'];
|
195 |
-
$this->google_ads_conversion_identifiers = apply_filters_deprecated(
|
196 |
-
'wgact_google_ads_conversion_identifiers',
|
197 |
-
[ $this->google_ads_conversion_identifiers ],
|
198 |
-
'1.10.2',
|
199 |
-
'wooptpm_google_ads_conversion_identifiers'
|
200 |
-
);
|
201 |
-
$this->google_ads_conversion_identifiers = apply_filters_deprecated(
|
202 |
-
'wooptpm_google_ads_conversion_identifiers',
|
203 |
-
[ $this->google_ads_conversion_identifiers ],
|
204 |
-
'1.13.0',
|
205 |
-
'wpm_google_ads_conversion_identifiers'
|
206 |
-
);
|
207 |
-
$this->google_ads_conversion_identifiers = apply_filters( 'wpm_google_ads_conversion_identifiers', $this->google_ads_conversion_identifiers );
|
208 |
-
$formatted_conversion_ids = [];
|
209 |
-
|
210 |
-
if ( $purchase ) {
|
211 |
-
foreach ( $this->google_ads_conversion_identifiers as $conversion_id => $conversion_label ) {
|
212 |
-
$conversion_id = $this->extract_google_ads_id( $conversion_id );
|
213 |
-
if ( $conversion_id ) {
|
214 |
-
$formatted_conversion_ids['AW-' . $conversion_id] = $conversion_label;
|
215 |
-
}
|
216 |
-
}
|
217 |
-
} else {
|
218 |
-
foreach ( $this->google_ads_conversion_identifiers as $conversion_id => $conversion_label ) {
|
219 |
-
$conversion_id = $this->extract_google_ads_id( $conversion_id );
|
220 |
-
if ( $conversion_id ) {
|
221 |
-
$formatted_conversion_ids['AW-' . $conversion_id] = '';
|
222 |
-
}
|
223 |
-
}
|
224 |
-
}
|
225 |
-
|
226 |
-
return $formatted_conversion_ids;
|
227 |
-
}
|
228 |
-
|
229 |
-
protected function extract_google_ads_id( $string )
|
230 |
-
{
|
231 |
-
$re = '/\\d{9,11}/';
|
232 |
-
|
233 |
-
if ( $string ) {
|
234 |
-
preg_match(
|
235 |
-
$re,
|
236 |
-
$string,
|
237 |
-
$matches,
|
238 |
-
PREG_OFFSET_CAPTURE,
|
239 |
-
0
|
240 |
-
);
|
241 |
-
if ( is_array( $matches[0] ) ) {
|
242 |
-
return $matches[0][0];
|
243 |
-
}
|
244 |
-
}
|
245 |
-
|
246 |
-
return '';
|
247 |
-
}
|
248 |
-
|
249 |
-
public function get_google_ads_enhanced_conversion_data( $order )
|
250 |
-
{
|
251 |
-
$customer_data = [];
|
252 |
-
if ( $order->get_billing_email() ) {
|
253 |
-
$customer_data['email'] = (string) $order->get_billing_email();
|
254 |
-
}
|
255 |
-
if ( $order->get_billing_phone() ) {
|
256 |
-
$customer_data['phone_number'] = $this->get_e164_formatted_phone_number( (string) $order->get_billing_phone(), (string) $order->get_billing_country() );
|
257 |
-
}
|
258 |
-
|
259 |
-
if ( $this->are_billing_and_shipping_addresses_equal( $order ) ) {
|
260 |
-
$customer_data['address'] = $this->get_billing_address_details( $order );
|
261 |
-
} else {
|
262 |
-
$customer_data['address'][] = $this->get_billing_address_details( $order );
|
263 |
-
$customer_data['address'][] = $this->get_shipping_address_details( $order );
|
264 |
-
}
|
265 |
-
|
266 |
-
return $customer_data;
|
267 |
-
}
|
268 |
-
|
269 |
-
protected function get_billing_address_details( $order )
|
270 |
-
{
|
271 |
-
$customer_data = [];
|
272 |
-
if ( $order->get_billing_first_name() ) {
|
273 |
-
$customer_data['first_name'] = (string) $order->get_billing_first_name();
|
274 |
-
}
|
275 |
-
if ( $order->get_billing_last_name() ) {
|
276 |
-
$customer_data['last_name'] = (string) $order->get_billing_last_name();
|
277 |
-
}
|
278 |
-
if ( $order->get_billing_address_1() ) {
|
279 |
-
$customer_data['street'] = (string) $order->get_billing_address_1();
|
280 |
-
}
|
281 |
-
if ( $order->get_billing_city() ) {
|
282 |
-
$customer_data['city'] = (string) $order->get_billing_city();
|
283 |
-
}
|
284 |
-
if ( $order->get_billing_state() ) {
|
285 |
-
$customer_data['region'] = (string) $order->get_billing_state();
|
286 |
-
}
|
287 |
-
if ( $order->get_billing_postcode() ) {
|
288 |
-
$customer_data['postal_code'] = (string) $order->get_billing_postcode();
|
289 |
-
}
|
290 |
-
if ( $order->get_billing_country() ) {
|
291 |
-
$customer_data['country'] = (string) $order->get_billing_country();
|
292 |
-
}
|
293 |
-
return $customer_data;
|
294 |
-
}
|
295 |
-
|
296 |
-
protected function get_shipping_address_details( $order )
|
297 |
-
{
|
298 |
-
$customer_data = [];
|
299 |
-
if ( $order->get_shipping_first_name() ) {
|
300 |
-
$customer_data['first_name'] = (string) $order->get_shipping_first_name();
|
301 |
-
}
|
302 |
-
if ( $order->get_shipping_last_name() ) {
|
303 |
-
$customer_data['last_name'] = (string) $order->get_shipping_last_name();
|
304 |
-
}
|
305 |
-
if ( $order->get_shipping_address_1() ) {
|
306 |
-
$customer_data['street'] = (string) $order->get_shipping_address_1();
|
307 |
-
}
|
308 |
-
if ( $order->get_shipping_city() ) {
|
309 |
-
$customer_data['city'] = (string) $order->get_shipping_city();
|
310 |
-
}
|
311 |
-
if ( $order->get_shipping_state() ) {
|
312 |
-
$customer_data['region'] = (string) $order->get_shipping_state();
|
313 |
-
}
|
314 |
-
if ( $order->get_shipping_postcode() ) {
|
315 |
-
$customer_data['postal_code'] = (string) $order->get_shipping_postcode();
|
316 |
-
}
|
317 |
-
if ( $order->get_shipping_country() ) {
|
318 |
-
$customer_data['country'] = (string) $order->get_shipping_country();
|
319 |
-
}
|
320 |
-
return $customer_data;
|
321 |
-
}
|
322 |
-
|
323 |
-
private function are_billing_and_shipping_addresses_equal( $order )
|
324 |
-
{
|
325 |
-
|
326 |
-
if ( $order->get_billing_first_name() === $order->get_shipping_first_name() && $order->get_billing_last_name() === $order->get_shipping_last_name() && $order->get_billing_address_1() === $order->get_shipping_address_1() && $order->get_billing_city() === $order->get_shipping_city() && $order->get_billing_state() === $order->get_shipping_state() && $order->get_billing_postcode() === $order->get_shipping_postcode() && $order->get_billing_country() === $order->get_shipping_country() ) {
|
327 |
-
return true;
|
328 |
-
} else {
|
329 |
-
return false;
|
330 |
-
}
|
331 |
-
|
332 |
-
}
|
333 |
-
|
334 |
-
public function get_gmc_language()
|
335 |
-
{
|
336 |
-
return strtoupper( substr( get_locale(), 0, 2 ) );
|
337 |
-
}
|
338 |
-
|
339 |
-
// https://developers.google.com/gtagjs/devguide/linker
|
340 |
-
public function get_google_linker_settings()
|
341 |
-
{
|
342 |
-
$linker_settings = apply_filters_deprecated(
|
343 |
-
'wooptpm_google_cross_domain_linker_settings',
|
344 |
-
[ null ],
|
345 |
-
'1.13.0',
|
346 |
-
'wpm_google_cross_domain_linker_settings'
|
347 |
-
);
|
348 |
-
return apply_filters( 'wpm_google_cross_domain_linker_settings', $linker_settings );
|
349 |
-
}
|
350 |
-
|
351 |
-
public function get_ga4_parameters( $id )
|
352 |
-
{
|
353 |
-
$ga_4_parameters = [];
|
354 |
-
if ( $this->options_obj->google->user_id && is_user_logged_in() ) {
|
355 |
-
$ga_4_parameters = [
|
356 |
-
'user_id' => get_current_user_id(),
|
357 |
-
];
|
358 |
-
}
|
359 |
-
$ga_4_parameters = apply_filters_deprecated(
|
360 |
-
'wooptpm_ga_4_parameters',
|
361 |
-
[ $ga_4_parameters, $id ],
|
362 |
-
'1.13.0',
|
363 |
-
'wpm_ga_4_parameters'
|
364 |
-
);
|
365 |
-
return apply_filters( 'wpm_ga_4_parameters', $ga_4_parameters, $id );
|
366 |
-
}
|
367 |
-
|
368 |
-
public function get_ga_ua_parameters( $id )
|
369 |
-
{
|
370 |
-
$ga_ua_parameters = [
|
371 |
-
'anonymize_ip' => true,
|
372 |
-
'link_attribution' => (bool) $this->options_obj->google->analytics->link_attribution,
|
373 |
-
];
|
374 |
-
if ( $this->options_obj->google->user_id && is_user_logged_in() ) {
|
375 |
-
$ga_ua_parameters['user_id'] = get_current_user_id();
|
376 |
-
}
|
377 |
-
$ga_ua_parameters = apply_filters_deprecated(
|
378 |
-
'woopt_pm_analytics_parameters',
|
379 |
-
[ $ga_ua_parameters, $id ],
|
380 |
-
'1.10.10',
|
381 |
-
'wooptpm_ga_ua_parameters'
|
382 |
-
);
|
383 |
-
$ga_ua_parameters = apply_filters_deprecated(
|
384 |
-
'wooptpm_ga_ua_parameters',
|
385 |
-
[ $ga_ua_parameters, $id ],
|
386 |
-
'1.13.0',
|
387 |
-
'wpm_ga_ua_parameters'
|
388 |
-
);
|
389 |
-
return apply_filters( 'wpm_ga_ua_parameters', $ga_ua_parameters, $id );
|
390 |
-
}
|
391 |
-
|
392 |
-
public function get_all_refund_products( $refund )
|
393 |
-
{
|
394 |
-
$data = [];
|
395 |
-
$item_index = 1;
|
396 |
-
foreach ( $refund->get_items() as $item_id => $item ) {
|
397 |
-
// $product = new WC_Product($refund_item->get_product_id());
|
398 |
-
$order_item_data = $this->google->get_order_item_data( $item );
|
399 |
-
$data['pr' . $item_index . 'id'] = $order_item_data['id'];
|
400 |
-
$data['pr' . $item_index . 'qt'] = -1 * $order_item_data['quantity'];
|
401 |
-
$item_index++;
|
402 |
-
}
|
403 |
-
return $data;
|
404 |
-
}
|
405 |
|
406 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2 |
|
3 |
namespace WCPM\Classes\Pixels\Google;
|
4 |
|
5 |
+
use WCPM\Classes\Pixels\Pixel;
|
6 |
+
use WCPM\Classes\Pixels\Trait_Shop;
|
|
|
7 |
|
8 |
+
if (!defined('ABSPATH')) {
|
9 |
+
exit; // Exit if accessed directly
|
|
|
10 |
}
|
11 |
|
12 |
+
class Google extends Pixel {
|
13 |
+
use Trait_Google;
|
14 |
+
use Trait_Shop;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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__construct($options);
|
19 |
+
|
20 |
+
$this->google_business_vertical = $this->get_google_business_vertical($this->options['google']['ads']['google_business_vertical']);
|
21 |
+
|
22 |
+
$this->pixel_name = 'google';
|
23 |
+
}
|
24 |
+
}
|
classes/pixels/google/trait-google.php
CHANGED
@@ -2,8 +2,10 @@
|
|
2 |
|
3 |
namespace WCPM\Classes\Pixels\Google;
|
4 |
|
|
|
|
|
|
|
5 |
use WCPM\Classes\Admin\Environment_Check ;
|
6 |
-
use WCPM\Classes\Pixels\Trait_Shop ;
|
7 |
|
8 |
if ( !defined( 'ABSPATH' ) ) {
|
9 |
exit;
|
@@ -12,7 +14,6 @@ if ( !defined( 'ABSPATH' ) ) {
|
|
12 |
|
13 |
trait Trait_Google
|
14 |
{
|
15 |
-
use Trait_Shop ;
|
16 |
protected $google_ads_conversion_identifiers ;
|
17 |
protected function get_ga_id_type()
|
18 |
{
|
@@ -248,75 +249,81 @@ trait Trait_Google
|
|
248 |
if ( $order->get_billing_phone() ) {
|
249 |
$customer_data['phone_number'] = $this->get_e164_formatted_phone_number( (string) $order->get_billing_phone(), (string) $order->get_billing_country() );
|
250 |
}
|
251 |
-
|
252 |
-
if ( $this->are_billing_and_shipping_addresses_equal( $order ) ) {
|
253 |
-
$customer_data['address'] = $this->get_billing_address_details( $order );
|
254 |
-
} else {
|
255 |
-
$customer_data['address'][] = $this->get_billing_address_details( $order );
|
256 |
-
$customer_data['address'][] = $this->get_shipping_address_details( $order );
|
257 |
-
}
|
258 |
-
|
259 |
-
return $customer_data;
|
260 |
-
}
|
261 |
-
|
262 |
-
protected function get_billing_address_details( $order )
|
263 |
-
{
|
264 |
-
$customer_data = [];
|
265 |
if ( $order->get_billing_first_name() ) {
|
266 |
$customer_data['first_name'] = (string) $order->get_billing_first_name();
|
267 |
}
|
268 |
if ( $order->get_billing_last_name() ) {
|
269 |
$customer_data['last_name'] = (string) $order->get_billing_last_name();
|
270 |
}
|
271 |
-
|
272 |
-
|
273 |
-
|
274 |
-
|
275 |
-
|
276 |
-
|
277 |
-
|
278 |
-
|
279 |
-
|
280 |
-
|
281 |
-
|
282 |
-
|
283 |
-
|
284 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
285 |
}
|
|
|
286 |
return $customer_data;
|
287 |
}
|
288 |
|
289 |
-
|
290 |
{
|
291 |
-
|
292 |
-
|
293 |
-
$
|
294 |
-
|
295 |
-
|
296 |
-
|
297 |
-
|
298 |
-
if ( $order->get_shipping_address_1() ) {
|
299 |
-
$customer_data['street'] = (string) $order->get_shipping_address_1();
|
300 |
}
|
301 |
-
if ( $order->get_shipping_city() ) {
|
302 |
-
$customer_data['city'] = (string) $order->get_shipping_city();
|
303 |
-
}
|
304 |
-
if ( $order->get_shipping_state() ) {
|
305 |
-
$customer_data['region'] = (string) $order->get_shipping_state();
|
306 |
-
}
|
307 |
-
if ( $order->get_shipping_postcode() ) {
|
308 |
-
$customer_data['postal_code'] = (string) $order->get_shipping_postcode();
|
309 |
-
}
|
310 |
-
if ( $order->get_shipping_country() ) {
|
311 |
-
$customer_data['country'] = (string) $order->get_shipping_country();
|
312 |
-
}
|
313 |
-
return $customer_data;
|
314 |
}
|
315 |
|
316 |
private function are_billing_and_shipping_addresses_equal( $order )
|
317 |
{
|
318 |
|
319 |
-
if ( $order->
|
320 |
return true;
|
321 |
} else {
|
322 |
return false;
|
2 |
|
3 |
namespace WCPM\Classes\Pixels\Google;
|
4 |
|
5 |
+
use libphonenumber\NumberParseException ;
|
6 |
+
use libphonenumber\PhoneNumberFormat ;
|
7 |
+
use libphonenumber\PhoneNumberUtil ;
|
8 |
use WCPM\Classes\Admin\Environment_Check ;
|
|
|
9 |
|
10 |
if ( !defined( 'ABSPATH' ) ) {
|
11 |
exit;
|
14 |
|
15 |
trait Trait_Google
|
16 |
{
|
|
|
17 |
protected $google_ads_conversion_identifiers ;
|
18 |
protected function get_ga_id_type()
|
19 |
{
|
249 |
if ( $order->get_billing_phone() ) {
|
250 |
$customer_data['phone_number'] = $this->get_e164_formatted_phone_number( (string) $order->get_billing_phone(), (string) $order->get_billing_country() );
|
251 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
252 |
if ( $order->get_billing_first_name() ) {
|
253 |
$customer_data['first_name'] = (string) $order->get_billing_first_name();
|
254 |
}
|
255 |
if ( $order->get_billing_last_name() ) {
|
256 |
$customer_data['last_name'] = (string) $order->get_billing_last_name();
|
257 |
}
|
258 |
+
|
259 |
+
if ( $this->are_billing_and_shipping_addresses_equal( $order ) ) {
|
260 |
+
if ( $order->get_billing_address_1() ) {
|
261 |
+
$customer_data['home_address']['street'] = (string) $order->get_billing_address_1();
|
262 |
+
}
|
263 |
+
if ( $order->get_billing_city() ) {
|
264 |
+
$customer_data['home_address']['city'] = (string) $order->get_billing_city();
|
265 |
+
}
|
266 |
+
if ( $order->get_billing_state() ) {
|
267 |
+
$customer_data['home_address']['region'] = (string) $order->get_billing_state();
|
268 |
+
}
|
269 |
+
if ( $order->get_billing_postcode() ) {
|
270 |
+
$customer_data['home_address']['postal_code'] = (string) $order->get_billing_postcode();
|
271 |
+
}
|
272 |
+
if ( $order->get_billing_country() ) {
|
273 |
+
$customer_data['home_address']['country'] = (string) $order->get_billing_country();
|
274 |
+
}
|
275 |
+
} else {
|
276 |
+
if ( $order->get_billing_address_1() ) {
|
277 |
+
$customer_data['address'][0]['street'] = (string) $order->get_billing_address_1();
|
278 |
+
}
|
279 |
+
if ( $order->get_billing_city() ) {
|
280 |
+
$customer_data['address'][0]['city'] = (string) $order->get_billing_city();
|
281 |
+
}
|
282 |
+
if ( $order->get_billing_state() ) {
|
283 |
+
$customer_data['address'][0]['region'] = (string) $order->get_billing_state();
|
284 |
+
}
|
285 |
+
if ( $order->get_billing_postcode() ) {
|
286 |
+
$customer_data['address'][0]['postal_code'] = (string) $order->get_billing_postcode();
|
287 |
+
}
|
288 |
+
if ( $order->get_billing_country() ) {
|
289 |
+
$customer_data['address'][0]['country'] = (string) $order->get_billing_country();
|
290 |
+
}
|
291 |
+
if ( $order->get_shipping_address_1() ) {
|
292 |
+
$customer_data['address'][1]['street'] = (string) $order->get_shipping_address_1();
|
293 |
+
}
|
294 |
+
if ( $order->get_shipping_city() ) {
|
295 |
+
$customer_data['address'][1]['city'] = (string) $order->get_shipping_city();
|
296 |
+
}
|
297 |
+
if ( $order->get_shipping_state() ) {
|
298 |
+
$customer_data['address'][1]['region'] = (string) $order->get_shipping_state();
|
299 |
+
}
|
300 |
+
if ( $order->get_shipping_postcode() ) {
|
301 |
+
$customer_data['address'][1]['postal_code'] = (string) $order->get_shipping_postcode();
|
302 |
+
}
|
303 |
+
if ( $order->get_shipping_country() ) {
|
304 |
+
$customer_data['address'][1]['country'] = (string) $order->get_shipping_country();
|
305 |
+
}
|
306 |
}
|
307 |
+
|
308 |
return $customer_data;
|
309 |
}
|
310 |
|
311 |
+
private function get_e164_formatted_phone_number( $number, $country )
|
312 |
{
|
313 |
+
try {
|
314 |
+
$phone_util = PhoneNumberUtil::getInstance();
|
315 |
+
$number_parsed = $phone_util->parse( $number, $country );
|
316 |
+
return $phone_util->format( $number_parsed, PhoneNumberFormat::E164 );
|
317 |
+
} catch ( NumberParseException $e ) {
|
318 |
+
error_log( $e );
|
319 |
+
return $number;
|
|
|
|
|
320 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
321 |
}
|
322 |
|
323 |
private function are_billing_and_shipping_addresses_equal( $order )
|
324 |
{
|
325 |
|
326 |
+
if ( $order->get_billing_address_1() === $order->get_shipping_address_1() && $order->get_billing_city() === $order->get_shipping_city() && $order->get_billing_state() === $order->get_shipping_state() && $order->get_billing_postcode() === $order->get_shipping_postcode() && $order->get_billing_country() === $order->get_shipping_country() ) {
|
327 |
return true;
|
328 |
} else {
|
329 |
return false;
|
classes/pixels/trait-product.php
CHANGED
@@ -3,14 +3,12 @@
|
|
3 |
namespace WCPM\Classes\Pixels;
|
4 |
|
5 |
use WCPM\Classes\Admin\Environment_Check;
|
6 |
-
use WCPM\Classes\Pixels\Google\Google;
|
7 |
|
8 |
if (!defined('ABSPATH')) {
|
9 |
exit; // Exit if accessed directly
|
10 |
}
|
11 |
|
12 |
trait Trait_Product {
|
13 |
-
|
14 |
protected function get_formatted_variant_text( $product ) {
|
15 |
$variant_text_array = [];
|
16 |
|
@@ -27,8 +25,7 @@ trait Trait_Product {
|
|
27 |
}
|
28 |
|
29 |
protected function get_variation_or_product_id( $item, $variations_output = true ) {
|
30 |
-
|
31 |
-
if (0 <> $item['variation_id'] && true === $variations_output) {
|
32 |
return $item['variation_id'];
|
33 |
} else {
|
34 |
return $item['product_id'];
|
@@ -38,13 +35,19 @@ trait Trait_Product {
|
|
38 |
// https://stackoverflow.com/a/56278308/4688612
|
39 |
// https://stackoverflow.com/a/39034036/4688612
|
40 |
public function get_brand_name( $product_id ) {
|
|
|
|
|
|
|
|
|
41 |
|
42 |
$brand_taxonomy = 'pa_brand';
|
43 |
|
44 |
if (( new Environment_Check($this->options) )->is_yith_wc_brands_active()) {
|
45 |
$brand_taxonomy = 'yith_product_brand';
|
46 |
-
}
|
47 |
-
$
|
|
|
|
|
48 |
}
|
49 |
|
50 |
$brand_taxonomy = apply_filters_deprecated('wooptpm_custom_brand_taxonomy', [$brand_taxonomy], '1.13.0', 'wpm_custom_brand_taxonomy');
|
@@ -52,6 +55,10 @@ trait Trait_Product {
|
|
52 |
// Use custom brand_taxonomy
|
53 |
$brand_taxonomy = apply_filters('wpm_custom_brand_taxonomy', $brand_taxonomy);
|
54 |
|
|
|
|
|
|
|
|
|
55 |
if ($this->get_brand_by_taxonomy($product_id, $brand_taxonomy)) {
|
56 |
return $this->get_brand_by_taxonomy($product_id, $brand_taxonomy);
|
57 |
} elseif ($this->get_brand_by_taxonomy($product_id, 'pa_' . $brand_taxonomy)) {
|
@@ -62,7 +69,6 @@ trait Trait_Product {
|
|
62 |
}
|
63 |
|
64 |
public function get_brand_by_taxonomy( $product_id, $taxonomy ) {
|
65 |
-
|
66 |
if (taxonomy_exists($taxonomy)) {
|
67 |
$brand_names = wp_get_post_terms($product_id, $taxonomy, ['fields' => 'names']);
|
68 |
return reset($brand_names);
|
@@ -73,19 +79,13 @@ trait Trait_Product {
|
|
73 |
|
74 |
// get an array with all product categories
|
75 |
public function get_product_category( $product_id ) {
|
76 |
-
|
77 |
-
if ($this->is_variable_product_by_id($product_id)) {
|
78 |
-
$product = wc_get_product($product_id);
|
79 |
-
$product_id = $product->get_parent_id();
|
80 |
-
}
|
81 |
-
|
82 |
$prod_cats = get_the_terms($product_id, 'product_cat');
|
83 |
$prod_cats_output = [];
|
84 |
|
85 |
// only continue with the loop if one or more product categories have been set for the product
|
86 |
if (!empty($prod_cats)) {
|
87 |
foreach ((array) $prod_cats as $key) {
|
88 |
-
$prod_cats_output
|
89 |
}
|
90 |
|
91 |
// apply filter to the $prod_cats_output array
|
@@ -95,15 +95,7 @@ trait Trait_Product {
|
|
95 |
return $prod_cats_output;
|
96 |
}
|
97 |
|
98 |
-
protected function is_variable_product_by_id( $product_id ) {
|
99 |
-
|
100 |
-
$product = wc_get_product($product_id);
|
101 |
-
|
102 |
-
return $product->get_type() === 'variable';
|
103 |
-
}
|
104 |
-
|
105 |
protected function get_compiled_product_id( $product_id, $product_sku, $options, $channel = '' ) {
|
106 |
-
|
107 |
// depending on setting use product IDs or SKUs
|
108 |
if (0 == $this->options['google']['ads']['product_identifier'] || 'ga_ua' === $channel || 'ga_4' === $channel) {
|
109 |
return (string) $product_id;
|
@@ -121,7 +113,6 @@ trait Trait_Product {
|
|
121 |
}
|
122 |
|
123 |
protected function get_dyn_r_ids( $product ) {
|
124 |
-
|
125 |
$dyn_r_ids = [
|
126 |
'post_id' => (string) $product->get_id(),
|
127 |
'sku' => (string) $product->get_sku() ? $product->get_sku() : $product->get_id(),
|
@@ -135,7 +126,6 @@ trait Trait_Product {
|
|
135 |
}
|
136 |
|
137 |
protected function log_problematic_product_id( $product_id = 0 ) {
|
138 |
-
|
139 |
wc_get_logger()->debug(
|
140 |
'WooCommerce detects the page ID ' . $product_id . ' as product, but when invoked by wc_get_product( ' . $product_id . ' ) it returns no product object',
|
141 |
['source' => 'wpm']
|
@@ -158,6 +148,7 @@ trait Trait_Product {
|
|
158 |
|
159 |
$dyn_r_ids = $this->get_dyn_r_ids($product);
|
160 |
$product_id_compiled = $dyn_r_ids[$this->get_dyn_r_id_type()];
|
|
|
161 |
array_push($order_items_array, $product_id_compiled);
|
162 |
} else {
|
163 |
|
@@ -169,7 +160,6 @@ trait Trait_Product {
|
|
169 |
}
|
170 |
|
171 |
protected function get_order_items_formatted_for_purchase_event( $order ) {
|
172 |
-
|
173 |
$order_items = $this->wpm_get_order_items($order);
|
174 |
$order_items_formatted = [];
|
175 |
|
@@ -185,6 +175,7 @@ trait Trait_Product {
|
|
185 |
|
186 |
$dyn_r_ids = $this->get_dyn_r_ids($product);
|
187 |
$product_id_compiled = $dyn_r_ids[$this->get_dyn_r_id_type()];
|
|
|
188 |
|
189 |
$product_details['id'] = $product_id_compiled;
|
190 |
$product_details['name'] = $product->get_name();
|
@@ -193,6 +184,8 @@ trait Trait_Product {
|
|
193 |
$product_details['brand'] = $this->get_brand_name($product_id);
|
194 |
$product_details['category'] = implode(',', $this->get_product_category($product_id));
|
195 |
|
|
|
|
|
196 |
if ($product->is_type('variation')) {
|
197 |
$product_details['variant'] = $this->get_formatted_variant_text($product);
|
198 |
|
@@ -205,6 +198,7 @@ trait Trait_Product {
|
|
205 |
}
|
206 |
|
207 |
$order_items_formatted[] = $product_details;
|
|
|
208 |
} else {
|
209 |
|
210 |
$this->log_problematic_product_id($product_id);
|
@@ -214,7 +208,9 @@ trait Trait_Product {
|
|
214 |
return $order_items_formatted;
|
215 |
}
|
216 |
|
|
|
217 |
protected function get_dyn_r_id_type( $pixel_name = null ) {
|
|
|
218 |
|
219 |
if ($pixel_name) {
|
220 |
$this->pixel_name = $pixel_name;
|
@@ -230,7 +226,7 @@ trait Trait_Product {
|
|
230 |
$this->dyn_r_id_type = 'gla';
|
231 |
}
|
232 |
|
233 |
-
//
|
234 |
$this->dyn_r_id_type = apply_filters_deprecated('wooptpm_product_id_type_for_' . $this->pixel_name, [$this->dyn_r_id_type], '1.13.0', 'wpm_product_id_type_for_');
|
235 |
$this->dyn_r_id_type = apply_filters('wpm_product_id_type_for_' . $this->pixel_name, $this->dyn_r_id_type);
|
236 |
|
@@ -238,16 +234,11 @@ trait Trait_Product {
|
|
238 |
}
|
239 |
|
240 |
protected function wpm_get_order_items( $order ) {
|
241 |
-
|
242 |
$order_items = apply_filters_deprecated('wooptpm_order_items', [$order->get_items(), $order], '1.13.0', 'wpm_order_items');
|
243 |
-
|
244 |
-
// Give option to filter order items
|
245 |
-
// then return
|
246 |
return apply_filters('wpm_order_items', $order_items, $order);
|
247 |
}
|
248 |
|
249 |
protected function get_front_end_order_items( $order ) {
|
250 |
-
|
251 |
$order_items = $this->wpm_get_order_items($order);
|
252 |
$order_items_formatted = [];
|
253 |
|
@@ -268,7 +259,7 @@ trait Trait_Product {
|
|
268 |
'variation_id' => $order_item_data['variation_id'],
|
269 |
'name' => $order_item_data['name'],
|
270 |
'quantity' => $order_item_data['quantity'],
|
271 |
-
'price' =>
|
272 |
'subtotal' => (float) number_format($order_item_data['subtotal'], 2, '.', ''),
|
273 |
'subtotal_tax' => (float) number_format($order_item_data['subtotal_tax'], 2, '.', ''),
|
274 |
'total' => (float) number_format($order_item_data['total'], 2, '.', ''),
|
@@ -289,23 +280,50 @@ trait Trait_Product {
|
|
289 |
}
|
290 |
|
291 |
public function get_product_data_layer_script( $product, $set_position = true, $meta_tag = false ) {
|
292 |
-
|
293 |
if (!is_object($product)) {
|
|
|
|
|
294 |
wc_get_logger()->debug('get_product_data_layer_script received an invalid product', ['source' => 'wpm']);
|
|
|
295 |
return '';
|
296 |
}
|
297 |
|
298 |
$data = $this->get_product_details_for_datalayer($product);
|
299 |
|
300 |
-
//
|
301 |
-
|
|
|
302 |
$tag = $meta_tag ? "meta name='wpm-dataLayer-meta' content='" . $product->get_id() . "'" : "input type='hidden'";
|
303 |
|
|
|
|
|
|
|
|
|
|
|
|
|
304 |
$this->get_product_data_layer_script_html_part_1($tag, $product, $data, $set_position, $meta_tag);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
305 |
}
|
306 |
|
307 |
protected function get_product_data_layer_script_html_part_1( $tag, $product, $data, $set_position, $meta_tag ) {
|
308 |
-
|
309 |
if ($meta_tag) {
|
310 |
?>
|
311 |
<meta name="pm-dataLayer-meta" content="<?php esc_html_e($product->get_id()); ?>" class="wpmProductId"
|
@@ -318,22 +336,24 @@ trait Trait_Product {
|
|
318 |
}
|
319 |
|
320 |
?>
|
321 |
-
<script>
|
322 |
-
|
323 |
window.wpmDataLayer.products[<?php esc_html_e($product->get_id()); ?>] = <?php echo wp_json_encode($data); ?>;
|
324 |
<?php $set_position ? $this->get_product_data_layer_script_html_part_2($product) : ''; ?>
|
325 |
</script>
|
326 |
<?php
|
|
|
327 |
}
|
328 |
|
329 |
protected function get_product_data_layer_script_html_part_2( $product ) {
|
330 |
?>
|
331 |
window.wpmDataLayer.products[<?php esc_html_e($product->get_id()); ?>]['position'] = window.wpmDataLayer.position++
|
332 |
<?php
|
|
|
333 |
}
|
334 |
|
335 |
-
public function get_product_details_for_datalayer( $product ) {
|
336 |
|
|
|
337 |
global $woocommerce_wpml;
|
338 |
|
339 |
$dyn_r_ids = $this->get_dyn_r_ids($product);
|
@@ -353,11 +373,11 @@ trait Trait_Product {
|
|
353 |
'category' => $this->get_product_category($product->get_id()),
|
354 |
'quantity' => 1,
|
355 |
'dyn_r_ids' => $dyn_r_ids,
|
356 |
-
'isVariable' => $product->get_type()
|
357 |
'isVariation' => false,
|
358 |
];
|
359 |
|
360 |
-
if ($product->get_type()
|
361 |
|
362 |
$parent_product = wc_get_product($product->get_parent_id());
|
363 |
if ($parent_product) {
|
3 |
namespace WCPM\Classes\Pixels;
|
4 |
|
5 |
use WCPM\Classes\Admin\Environment_Check;
|
|
|
6 |
|
7 |
if (!defined('ABSPATH')) {
|
8 |
exit; // Exit if accessed directly
|
9 |
}
|
10 |
|
11 |
trait Trait_Product {
|
|
|
12 |
protected function get_formatted_variant_text( $product ) {
|
13 |
$variant_text_array = [];
|
14 |
|
25 |
}
|
26 |
|
27 |
protected function get_variation_or_product_id( $item, $variations_output = true ) {
|
28 |
+
if (0 <> $item['variation_id'] && true == $variations_output) {
|
|
|
29 |
return $item['variation_id'];
|
30 |
} else {
|
31 |
return $item['product_id'];
|
35 |
// https://stackoverflow.com/a/56278308/4688612
|
36 |
// https://stackoverflow.com/a/39034036/4688612
|
37 |
public function get_brand_name( $product_id ) {
|
38 |
+
// return $this->get_brand_by_taxonomy($product_id, 'product_brand') ?: // for Woocommerce Brands plugin
|
39 |
+
// $this->get_brand_by_taxonomy($product_id, 'yith_product_brand') ?: // for YITH WooCommerce Brands plugin
|
40 |
+
// $this->get_brand_by_taxonomy($product_id, 'pa_brand') ?: // for a custom product attribute
|
41 |
+
// '';
|
42 |
|
43 |
$brand_taxonomy = 'pa_brand';
|
44 |
|
45 |
if (( new Environment_Check($this->options) )->is_yith_wc_brands_active()) {
|
46 |
$brand_taxonomy = 'yith_product_brand';
|
47 |
+
} else {
|
48 |
+
if (( new Environment_Check($this->options) )->is_woocommerce_brands_active()) {
|
49 |
+
$brand_taxonomy = 'product_brand';
|
50 |
+
}
|
51 |
}
|
52 |
|
53 |
$brand_taxonomy = apply_filters_deprecated('wooptpm_custom_brand_taxonomy', [$brand_taxonomy], '1.13.0', 'wpm_custom_brand_taxonomy');
|
55 |
// Use custom brand_taxonomy
|
56 |
$brand_taxonomy = apply_filters('wpm_custom_brand_taxonomy', $brand_taxonomy);
|
57 |
|
58 |
+
// return $this->get_brand_by_taxonomy($product_id, $brand_taxonomy) ?:
|
59 |
+
// $this->get_brand_by_taxonomy($product_id, 'pa_' . $brand_taxonomy) ?:
|
60 |
+
// '';
|
61 |
+
|
62 |
if ($this->get_brand_by_taxonomy($product_id, $brand_taxonomy)) {
|
63 |
return $this->get_brand_by_taxonomy($product_id, $brand_taxonomy);
|
64 |
} elseif ($this->get_brand_by_taxonomy($product_id, 'pa_' . $brand_taxonomy)) {
|
69 |
}
|
70 |
|
71 |
public function get_brand_by_taxonomy( $product_id, $taxonomy ) {
|
|
|
72 |
if (taxonomy_exists($taxonomy)) {
|
73 |
$brand_names = wp_get_post_terms($product_id, $taxonomy, ['fields' => 'names']);
|
74 |
return reset($brand_names);
|
79 |
|
80 |
// get an array with all product categories
|
81 |
public function get_product_category( $product_id ) {
|
|
|
|
|
|
|
|
|
|
|
|
|
82 |
$prod_cats = get_the_terms($product_id, 'product_cat');
|
83 |
$prod_cats_output = [];
|
84 |
|
85 |
// only continue with the loop if one or more product categories have been set for the product
|
86 |
if (!empty($prod_cats)) {
|
87 |
foreach ((array) $prod_cats as $key) {
|
88 |
+
array_push($prod_cats_output, $key->name);
|
89 |
}
|
90 |
|
91 |
// apply filter to the $prod_cats_output array
|
95 |
return $prod_cats_output;
|
96 |
}
|
97 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
98 |
protected function get_compiled_product_id( $product_id, $product_sku, $options, $channel = '' ) {
|
|
|
99 |
// depending on setting use product IDs or SKUs
|
100 |
if (0 == $this->options['google']['ads']['product_identifier'] || 'ga_ua' === $channel || 'ga_4' === $channel) {
|
101 |
return (string) $product_id;
|
113 |
}
|
114 |
|
115 |
protected function get_dyn_r_ids( $product ) {
|
|
|
116 |
$dyn_r_ids = [
|
117 |
'post_id' => (string) $product->get_id(),
|
118 |
'sku' => (string) $product->get_sku() ? $product->get_sku() : $product->get_id(),
|
126 |
}
|
127 |
|
128 |
protected function log_problematic_product_id( $product_id = 0 ) {
|
|
|
129 |
wc_get_logger()->debug(
|
130 |
'WooCommerce detects the page ID ' . $product_id . ' as product, but when invoked by wc_get_product( ' . $product_id . ' ) it returns no product object',
|
131 |
['source' => 'wpm']
|
148 |
|
149 |
$dyn_r_ids = $this->get_dyn_r_ids($product);
|
150 |
$product_id_compiled = $dyn_r_ids[$this->get_dyn_r_id_type()];
|
151 |
+
// $product_id_compiled = $this->get_compiled_product_id($product_id, $product->get_sku(), $this->options, '');
|
152 |
array_push($order_items_array, $product_id_compiled);
|
153 |
} else {
|
154 |
|
160 |
}
|
161 |
|
162 |
protected function get_order_items_formatted_for_purchase_event( $order ) {
|
|
|
163 |
$order_items = $this->wpm_get_order_items($order);
|
164 |
$order_items_formatted = [];
|
165 |
|
175 |
|
176 |
$dyn_r_ids = $this->get_dyn_r_ids($product);
|
177 |
$product_id_compiled = $dyn_r_ids[$this->get_dyn_r_id_type()];
|
178 |
+
// $product_id_compiled = $this->get_compiled_product_id($product_id, $product->get_sku(), $this->options, '');
|
179 |
|
180 |
$product_details['id'] = $product_id_compiled;
|
181 |
$product_details['name'] = $product->get_name();
|
184 |
$product_details['brand'] = $this->get_brand_name($product_id);
|
185 |
$product_details['category'] = implode(',', $this->get_product_category($product_id));
|
186 |
|
187 |
+
// error_log('type: ' . $product->get_type());
|
188 |
+
|
189 |
if ($product->is_type('variation')) {
|
190 |
$product_details['variant'] = $this->get_formatted_variant_text($product);
|
191 |
|
198 |
}
|
199 |
|
200 |
$order_items_formatted[] = $product_details;
|
201 |
+
// array_push($order_items_formatted, $product_details);
|
202 |
} else {
|
203 |
|
204 |
$this->log_problematic_product_id($product_id);
|
208 |
return $order_items_formatted;
|
209 |
}
|
210 |
|
211 |
+
|
212 |
protected function get_dyn_r_id_type( $pixel_name = null ) {
|
213 |
+
// $dyn_r_id_type = '';
|
214 |
|
215 |
if ($pixel_name) {
|
216 |
$this->pixel_name = $pixel_name;
|
226 |
$this->dyn_r_id_type = 'gla';
|
227 |
}
|
228 |
|
229 |
+
// if you want to change the dyn_r_id type for Google programmatically
|
230 |
$this->dyn_r_id_type = apply_filters_deprecated('wooptpm_product_id_type_for_' . $this->pixel_name, [$this->dyn_r_id_type], '1.13.0', 'wpm_product_id_type_for_');
|
231 |
$this->dyn_r_id_type = apply_filters('wpm_product_id_type_for_' . $this->pixel_name, $this->dyn_r_id_type);
|
232 |
|
234 |
}
|
235 |
|
236 |
protected function wpm_get_order_items( $order ) {
|
|
|
237 |
$order_items = apply_filters_deprecated('wooptpm_order_items', [$order->get_items(), $order], '1.13.0', 'wpm_order_items');
|
|
|
|
|
|
|
238 |
return apply_filters('wpm_order_items', $order_items, $order);
|
239 |
}
|
240 |
|
241 |
protected function get_front_end_order_items( $order ) {
|
|
|
242 |
$order_items = $this->wpm_get_order_items($order);
|
243 |
$order_items_formatted = [];
|
244 |
|
259 |
'variation_id' => $order_item_data['variation_id'],
|
260 |
'name' => $order_item_data['name'],
|
261 |
'quantity' => $order_item_data['quantity'],
|
262 |
+
'price' => $this->wpm_get_order_item_price($order_item, $product),
|
263 |
'subtotal' => (float) number_format($order_item_data['subtotal'], 2, '.', ''),
|
264 |
'subtotal_tax' => (float) number_format($order_item_data['subtotal_tax'], 2, '.', ''),
|
265 |
'total' => (float) number_format($order_item_data['total'], 2, '.', ''),
|
280 |
}
|
281 |
|
282 |
public function get_product_data_layer_script( $product, $set_position = true, $meta_tag = false ) {
|
|
|
283 |
if (!is_object($product)) {
|
284 |
+
|
285 |
+
// $this->log_problematic_product_id();
|
286 |
wc_get_logger()->debug('get_product_data_layer_script received an invalid product', ['source' => 'wpm']);
|
287 |
+
|
288 |
return '';
|
289 |
}
|
290 |
|
291 |
$data = $this->get_product_details_for_datalayer($product);
|
292 |
|
293 |
+
// if placed in <head> it must be a <meta> tag else, it can be an <input> tag
|
294 |
+
// $tag = $meta_tag ? "meta" : "input";
|
295 |
+
// added name and content to meta in order to pass W3 validation test at https://validator.w3.org/nu/
|
296 |
$tag = $meta_tag ? "meta name='wpm-dataLayer-meta' content='" . $product->get_id() . "'" : "input type='hidden'";
|
297 |
|
298 |
+
// $html = "
|
299 |
+
// <$tag class='wpmProductId' data-id='" . $product->get_id() . "'>
|
300 |
+
// <script type=\"text/javascript\" data-cfasync=\"false\">
|
301 |
+
// window.wpmDataLayer.products = window.wpmDataLayer.products || {};
|
302 |
+
// window.wpmDataLayer.products[" . $product->get_id() . "] = " . wp_json_encode($data) . ";";
|
303 |
+
|
304 |
$this->get_product_data_layer_script_html_part_1($tag, $product, $data, $set_position, $meta_tag);
|
305 |
+
|
306 |
+
// $html = '
|
307 |
+
// <' . $tag . ' class="wpmProductId" data-id="' . $product->get_id() . '">
|
308 |
+
// <script type="text/javascript" data-cfasync="false">
|
309 |
+
// window.wpmDataLayer.products = window.wpmDataLayer.products || {};
|
310 |
+
// window.wpmDataLayer.products[' . $product->get_id() . '] = ' . wp_json_encode($data) . ';';
|
311 |
+
|
312 |
+
// if (true === $set_position) {
|
313 |
+
//
|
314 |
+
//// $html .= "
|
315 |
+
//// window.wpmDataLayer.products[{$product->get_id()}]['position'] = window.wpmDataLayer.position++;";
|
316 |
+
////
|
317 |
+
// $this->get_product_data_layer_script_html_part_2($product);
|
318 |
+
// }
|
319 |
+
|
320 |
+
// $html .= '</script>';
|
321 |
+
// echo '</script>';
|
322 |
+
|
323 |
+
// return $html;
|
324 |
}
|
325 |
|
326 |
protected function get_product_data_layer_script_html_part_1( $tag, $product, $data, $set_position, $meta_tag ) {
|
|
|
327 |
if ($meta_tag) {
|
328 |
?>
|
329 |
<meta name="pm-dataLayer-meta" content="<?php esc_html_e($product->get_id()); ?>" class="wpmProductId"
|
336 |
}
|
337 |
|
338 |
?>
|
339 |
+
<script type="text/javascript" data-cfasync="false">
|
340 |
+
window.wpmDataLayer.products = window.wpmDataLayer.products || {};
|
341 |
window.wpmDataLayer.products[<?php esc_html_e($product->get_id()); ?>] = <?php echo wp_json_encode($data); ?>;
|
342 |
<?php $set_position ? $this->get_product_data_layer_script_html_part_2($product) : ''; ?>
|
343 |
</script>
|
344 |
<?php
|
345 |
+
|
346 |
}
|
347 |
|
348 |
protected function get_product_data_layer_script_html_part_2( $product ) {
|
349 |
?>
|
350 |
window.wpmDataLayer.products[<?php esc_html_e($product->get_id()); ?>]['position'] = window.wpmDataLayer.position++
|
351 |
<?php
|
352 |
+
|
353 |
}
|
354 |
|
|
|
355 |
|
356 |
+
public function get_product_details_for_datalayer( $product ) {
|
357 |
global $woocommerce_wpml;
|
358 |
|
359 |
$dyn_r_ids = $this->get_dyn_r_ids($product);
|
373 |
'category' => $this->get_product_category($product->get_id()),
|
374 |
'quantity' => 1,
|
375 |
'dyn_r_ids' => $dyn_r_ids,
|
376 |
+
'isVariable' => $product->get_type() == 'variable',
|
377 |
'isVariation' => false,
|
378 |
];
|
379 |
|
380 |
+
if ($product->get_type() == 'variation') {
|
381 |
|
382 |
$parent_product = wc_get_product($product->get_parent_id());
|
383 |
if ($parent_product) {
|
classes/pixels/trait-shop.php
CHANGED
@@ -2,288 +2,382 @@
|
|
2 |
|
3 |
namespace WCPM\Classes\Pixels;
|
4 |
|
5 |
-
use
|
6 |
-
use libphonenumber\PhoneNumberFormat;
|
7 |
-
use libphonenumber\PhoneNumberUtil;
|
8 |
-
use WC_Geolocation;
|
9 |
|
10 |
-
if (!defined('ABSPATH')) {
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
trait Trait_Shop {
|
15 |
-
|
16 |
-
protected function get_list_name_suffix() {
|
17 |
-
$list_suffix = '';
|
18 |
-
|
19 |
-
if (is_product_category()) {
|
20 |
-
|
21 |
-
$category = get_queried_object();
|
22 |
-
$list_suffix = ' | ' . $category->name;
|
23 |
-
$list_suffix = $this->add_parent_category_name($category, $list_suffix);
|
24 |
-
} else {
|
25 |
-
if (is_product_tag()) {
|
26 |
-
$tag = get_queried_object();
|
27 |
-
$list_suffix = ' | ' . $tag->name;
|
28 |
-
}
|
29 |
-
}
|
30 |
-
|
31 |
-
return $list_suffix;
|
32 |
-
}
|
33 |
-
|
34 |
-
protected function add_parent_category_name( $category, $list_suffix ) {
|
35 |
-
if ($category->parent > 0) {
|
36 |
-
|
37 |
-
$parent_category = get_term_by('id', $category->parent, 'product_cat');
|
38 |
-
$list_suffix = ' | ' . $parent_category->name . $list_suffix;
|
39 |
-
$list_suffix = $this->add_parent_category_name($parent_category, $list_suffix);
|
40 |
-
}
|
41 |
-
|
42 |
-
return $list_suffix;
|
43 |
-
}
|
44 |
-
|
45 |
-
protected function get_list_id_suffix() {
|
46 |
-
$list_suffix = '';
|
47 |
-
|
48 |
-
if (is_product_category()) {
|
49 |
-
$category = get_queried_object();
|
50 |
-
$list_suffix = '.' . $category->slug;
|
51 |
-
$list_suffix = $this->add_parent_category_id($category, $list_suffix);
|
52 |
-
} else {
|
53 |
-
if (is_product_tag()) {
|
54 |
-
$tag = get_queried_object();
|
55 |
-
$list_suffix = '.' . $tag->slug;
|
56 |
-
}
|
57 |
-
}
|
58 |
-
|
59 |
-
return $list_suffix;
|
60 |
-
}
|
61 |
-
|
62 |
-
protected function add_parent_category_id( $category, $list_suffix ) {
|
63 |
-
if ($category->parent > 0) {
|
64 |
-
|
65 |
-
$parent_category = get_term_by('id', $category->parent, 'product_cat');
|
66 |
-
$list_suffix = '.' . $parent_category->slug . $list_suffix;
|
67 |
-
$list_suffix = $this->add_parent_category_id($parent_category, $list_suffix);
|
68 |
-
}
|
69 |
-
|
70 |
-
return $list_suffix;
|
71 |
-
}
|
72 |
-
|
73 |
-
// https://stackoverflow.com/a/49616130/4688612
|
74 |
-
protected function get_order_from_order_received_page() {
|
75 |
-
if ($this->get_order_from_query_vars()) {
|
76 |
-
return $this->get_order_from_query_vars();
|
77 |
-
} else {
|
78 |
-
if ($this->get_order_with_url_order_key()) {
|
79 |
-
return $this->get_order_with_url_order_key();
|
80 |
-
} else {
|
81 |
-
return false;
|
82 |
-
}
|
83 |
-
}
|
84 |
-
}
|
85 |
-
|
86 |
-
protected function wpm_get_order_total( $order ) {
|
87 |
-
|
88 |
-
$order_total = 0 == $this->options_obj->shop->order_total_logic ? $order->get_subtotal() - $order->get_total_discount() : $order->get_total();
|
89 |
-
|
90 |
-
// filter to adjust the order value
|
91 |
-
$order_total = apply_filters_deprecated('wgact_conversion_value_filter', [$order_total, $order], '1.10.2', 'wooptpm_conversion_value_filter');
|
92 |
-
$order_total = apply_filters_deprecated('wooptpm_conversion_value_filter', [$order_total, $order], '1.13.0', 'wpm_conversion_value_filter');
|
93 |
-
$order_total = apply_filters('wpm_conversion_value_filter', $order_total, $order);
|
94 |
-
|
95 |
-
return number_format((float) $order_total, 2, '.', '');
|
96 |
-
|
97 |
-
}
|
98 |
-
|
99 |
-
protected function get_order_from_query_vars() {
|
100 |
-
global $wp;
|
101 |
-
|
102 |
-
$order_id = absint($wp->query_vars['order-received']);
|
103 |
-
|
104 |
-
if ($order_id && 0 != $order_id && wc_get_order($order_id)) {
|
105 |
-
|
106 |
-
return wc_get_order($order_id);
|
107 |
-
} else {
|
108 |
-
|
109 |
-
wc_get_logger()->debug(
|
110 |
-
'WooCommerce couldn\'t retrieve the order ID from $wp->query_vars[\'order-received\']',
|
111 |
-
['source' => 'wpm']
|
112 |
-
);
|
113 |
-
|
114 |
-
wc_get_logger()->debug(
|
115 |
-
print_r($wp->query_vars, true),
|
116 |
-
['source' => 'wpm']
|
117 |
-
);
|
118 |
-
|
119 |
-
return false;
|
120 |
-
}
|
121 |
-
}
|
122 |
-
|
123 |
-
protected function get_order_with_url_order_key() {
|
124 |
-
|
125 |
-
$_get = filter_input_array(INPUT_GET, FILTER_SANITIZE_FULL_SPECIAL_CHARS);
|
126 |
-
|
127 |
-
if (isset($_get['key'])) {
|
128 |
-
$order_key = $_get['key'];
|
129 |
-
return wc_get_order(wc_get_order_id_by_order_key($order_key));
|
130 |
-
} else {
|
131 |
-
|
132 |
-
wc_get_logger()->debug(
|
133 |
-
'WooCommerce couldn\'t retrieve the order ID from order key in the URL',
|
134 |
-
['source' => 'wpm']
|
135 |
-
);
|
136 |
-
|
137 |
-
$order_key = $_get['key'] ? $_get['key'] : '';
|
138 |
-
wc_get_logger()->debug(
|
139 |
-
'URL order key: ' . $order_key,
|
140 |
-
['source' => 'wpm']
|
141 |
-
);
|
142 |
-
|
143 |
-
return false;
|
144 |
-
}
|
145 |
-
}
|
146 |
-
|
147 |
-
protected function get_order_currency( $order ) {
|
148 |
-
// use the right function to get the currency depending on the WooCommerce version
|
149 |
-
return $this->woocommerce_3_and_above() ? $order->get_currency() : $order->get_order_currency();
|
150 |
-
}
|
151 |
-
|
152 |
-
protected function woocommerce_3_and_above() {
|
153 |
-
global $woocommerce;
|
154 |
-
if (version_compare($woocommerce->version, 3.0, '>=')) {
|
155 |
-
return true;
|
156 |
-
} else {
|
157 |
-
return false;
|
158 |
-
}
|
159 |
-
}
|
160 |
-
|
161 |
-
// https://stackoverflow.com/a/46216073/4688612
|
162 |
-
// https://github.com/woocommerce/woocommerce/wiki/wc_get_orders-and-WC_Order_Query#description
|
163 |
-
protected function is_existing_customer( $order, $value = 0 ) {
|
164 |
-
|
165 |
-
if (is_numeric($value)) { // Based on user ID (registered users)
|
166 |
-
$meta_key = '_customer_user';
|
167 |
-
$meta_value = 0 == $value ? get_current_user_id() : (int) $value;
|
168 |
-
} else { // Based on billing email (Guest users)
|
169 |
-
$meta_key = '_billing_email';
|
170 |
-
$meta_value = sanitize_email($value);
|
171 |
-
}
|
172 |
-
|
173 |
-
$orders = wc_get_orders([
|
174 |
-
'return' => 'ids',
|
175 |
-
'meta_key' => $meta_key,
|
176 |
-
'meta_value' => $meta_value,
|
177 |
-
// 'orderby' => 'date',
|
178 |
-
// 'order' => 'DESC',
|
179 |
-
'post_status' => wc_get_is_paid_statuses(),
|
180 |
-
'limit' => 1,
|
181 |
-
]);
|
182 |
-
|
183 |
-
// Return a boolean value based on orders count
|
184 |
-
return count($orders) > 0;
|
185 |
-
}
|
186 |
-
|
187 |
-
protected function get_user_ip() {
|
188 |
-
|
189 |
-
if ($this->is_localhost()) {
|
190 |
-
$ip = WC_Geolocation::get_external_ip_address();
|
191 |
-
} else {
|
192 |
-
$ip = WC_Geolocation::get_ip_address();
|
193 |
-
}
|
194 |
-
|
195 |
-
// only set the IP if it is a public address
|
196 |
-
$ip = filter_var($ip, FILTER_VALIDATE_IP, FILTER_FLAG_NO_PRIV_RANGE | FILTER_FLAG_NO_RES_RANGE);
|
197 |
-
|
198 |
-
// Remove the IPv6 to IPv4 mapping in case the IP contains one
|
199 |
-
// and return the IP plain public IPv4 or IPv6 IP
|
200 |
-
// https://en.wikipedia.org/wiki/IPv6_address
|
201 |
-
return str_replace('::ffff:', '', $ip);
|
202 |
-
}
|
203 |
-
|
204 |
-
protected function get_visitor_country() {
|
205 |
-
|
206 |
-
$location = WC_Geolocation::geolocate_ip($this->get_user_ip());
|
207 |
-
|
208 |
-
return $location['country'];
|
209 |
-
}
|
210 |
-
|
211 |
-
protected function is_localhost() {
|
212 |
-
|
213 |
-
$_server = filter_input_array(INPUT_SERVER, FILTER_SANITIZE_FULL_SPECIAL_CHARS);
|
214 |
-
|
215 |
-
// If the IP is local, return true, else false
|
216 |
-
// https://stackoverflow.com/a/13818647/4688612
|
217 |
-
return !filter_var(
|
218 |
-
$_server['REMOTE_ADDR'],
|
219 |
-
FILTER_VALIDATE_IP,
|
220 |
-
FILTER_FLAG_IPV4 | FILTER_FLAG_IPV6 | FILTER_FLAG_NO_PRIV_RANGE | FILTER_FLAG_NO_RES_RANGE
|
221 |
-
);
|
222 |
-
}
|
223 |
-
|
224 |
-
protected function get_user_email( $algo = null ) {
|
225 |
-
|
226 |
-
if (is_user_logged_in()) {
|
227 |
-
$current_user = wp_get_current_user();
|
228 |
-
$email = $current_user->user_email;
|
229 |
-
} elseif (is_order_received_page()) {
|
230 |
-
$order = $this->get_order_from_order_received_page();
|
231 |
-
|
232 |
-
if ($order) {
|
233 |
-
$email = $order->get_billing_email();
|
234 |
-
} else {
|
235 |
-
$email = '';
|
236 |
-
}
|
237 |
-
} else {
|
238 |
-
$email = '';
|
239 |
-
}
|
240 |
-
|
241 |
-
// encrypt email
|
242 |
-
if ($email && $algo && in_array($algo, hash_algos(), true)) {
|
243 |
-
$email = hash($algo, $email);
|
244 |
-
}
|
245 |
-
|
246 |
-
return $email;
|
247 |
-
}
|
248 |
-
|
249 |
-
private function get_e164_formatted_phone_number( $number, $country ) {
|
250 |
-
try {
|
251 |
-
$phone_util = PhoneNumberUtil::getInstance();
|
252 |
-
$number_parsed = $phone_util->parse($number, $country);
|
253 |
-
return $phone_util->format($number_parsed, PhoneNumberFormat::E164);
|
254 |
-
} catch (NumberParseException $e) {
|
255 |
-
error_log($e);
|
256 |
-
return $number;
|
257 |
-
}
|
258 |
-
}
|
259 |
-
|
260 |
-
protected function track_user( $user_id = null ) {
|
261 |
-
|
262 |
-
$user = null;
|
263 |
-
|
264 |
-
if (0 === $user_id) { // If anonymous visitor then track
|
265 |
-
return true;
|
266 |
-
} elseif ($user_id && 0 <= $user_id) { // If user ID is known, get the user
|
267 |
-
$user = get_user_by('id', $user_id);
|
268 |
-
} elseif (null === $user_id && is_user_logged_in()) { // If user id is not given, but the user is logged in, get the user
|
269 |
-
$user = wp_get_current_user();
|
270 |
-
}
|
271 |
-
|
272 |
-
// Find out if the user has a role that is restricted from tracking
|
273 |
-
if ($user) {
|
274 |
-
|
275 |
-
foreach ($user->roles as $role) {
|
276 |
-
if (in_array($role, $this->options_obj->shop->disable_tracking_for, true)) {
|
277 |
-
return false;
|
278 |
-
}
|
279 |
-
}
|
280 |
-
}
|
281 |
-
|
282 |
-
return true;
|
283 |
-
}
|
284 |
-
|
285 |
-
protected function do_not_track_user( $user_id = null ) {
|
286 |
-
return !$this->track_user($user_id);
|
287 |
-
}
|
288 |
}
|
289 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
10 |
}
|
11 |
|
12 |
+
trait Trait_Shop
|
13 |
+
{
|
14 |
+
protected function get_formatted_script_tag_new( $components )
|
15 |
+
{
|
16 |
+
$allowed_protocols = [
|
17 |
+
'http' => [],
|
18 |
+
'https' => [],
|
19 |
+
];
|
20 |
+
echo PHP_EOL ;
|
21 |
+
|
22 |
+
if ( $components['src'] ) {
|
23 |
+
echo "\t" . '<script ' . wp_kses( $this->print_script_components( $components ), [], $allowed_protocols ) . '></script>' ;
|
24 |
+
} else {
|
25 |
+
echo "\t" . '<script ' . wp_kses( $this->print_script_components( $components ), [], $allowed_protocols ) . '>' ;
|
26 |
+
}
|
27 |
+
|
28 |
+
echo PHP_EOL ;
|
29 |
+
}
|
30 |
+
|
31 |
+
protected function print_script_components( $components )
|
32 |
+
{
|
33 |
+
$attributes[] = $this->get_script_async_defer( $components );
|
34 |
+
$attributes[] = $this->get_script_src( $components['src'] );
|
35 |
+
$attributes[] = $this->get_script_type_value( $components['cookie_category'] );
|
36 |
+
$attributes[] = $this->get_script_cookie_category( $components['cookie_category'] );
|
37 |
+
$attributes[] = $this->get_script_data_wpm_pixel_name( $components['pixel_name'] );
|
38 |
+
$attributes[] = $this->get_script_cfasync( $components['inject_cfasync'] );
|
39 |
+
$attributes[] = $this->get_script_cookiebot_cookieconsent( $components );
|
40 |
+
return implode( ' ', array_filter( $attributes ) );
|
41 |
+
}
|
42 |
+
|
43 |
+
protected function get_script_cookiebot_cookieconsent( $components )
|
44 |
+
{
|
45 |
+
if ( array_key_exists( 'cookiebot-cookieconsent', $components ) && $components['cookiebot-cookieconsent'] ) {
|
46 |
+
return 'data-cookieconsent="ignore"';
|
47 |
+
}
|
48 |
+
}
|
49 |
+
|
50 |
+
protected function get_script_cfasync( $cfasync )
|
51 |
+
{
|
52 |
+
if ( $cfasync ) {
|
53 |
+
return 'data-cfasync="false"';
|
54 |
+
}
|
55 |
+
}
|
56 |
+
|
57 |
+
protected function get_script_data_wpm_pixel_name( $pixel_name )
|
58 |
+
{
|
59 |
+
return 'data-wpm-pixel-name="' . $pixel_name . '"';
|
60 |
+
}
|
61 |
+
|
62 |
+
protected function get_script_src( $src )
|
63 |
+
{
|
64 |
+
|
65 |
+
if ( $src ) {
|
66 |
+
if ( !$this->options_obj->shop->cookie_consent_mgmt->explicit_consent ) {
|
67 |
+
return $this->print_script_src_orig( $src );
|
68 |
+
}
|
69 |
+
return $this->print_script_src_data_wpm( $src );
|
70 |
+
}
|
71 |
+
|
72 |
+
}
|
73 |
+
|
74 |
+
protected function print_script_src_orig( $src )
|
75 |
+
{
|
76 |
+
return 'src="' . $src . '"';
|
77 |
+
}
|
78 |
+
|
79 |
+
protected function print_script_src_data_wpm( $src )
|
80 |
+
{
|
81 |
+
return 'data-wpm-src="' . $src . '"';
|
82 |
+
}
|
83 |
+
|
84 |
+
private function get_script_async_defer( $components )
|
85 |
+
{
|
86 |
+
if ( $components['src'] ) {
|
87 |
+
// A script tag can't have both async and defer attributes,
|
88 |
+
// therefore fall back to a default if both are set.
|
89 |
+
// Otherwise, use the one that is set.
|
90 |
+
|
91 |
+
if ( $components['async'] && $components['defer'] ) {
|
92 |
+
return 'async';
|
93 |
+
} else {
|
94 |
+
|
95 |
+
if ( $components['async'] ) {
|
96 |
+
return 'async';
|
97 |
+
} else {
|
98 |
+
if ( $components['defer'] ) {
|
99 |
+
return 'defer';
|
100 |
+
}
|
101 |
+
}
|
102 |
+
|
103 |
+
}
|
104 |
+
|
105 |
+
}
|
106 |
+
}
|
107 |
+
|
108 |
+
public function get_script_type_value( $cookie_category )
|
109 |
+
{
|
110 |
+
return 'type="text/javascript"';
|
111 |
+
}
|
112 |
+
|
113 |
+
protected function get_script_cookie_category( $cookie_category )
|
114 |
+
{
|
115 |
+
return 'data-wpm-cookie-category="' . $cookie_category . '"';
|
116 |
+
}
|
117 |
+
|
118 |
+
protected function get_list_name_suffix()
|
119 |
+
{
|
120 |
+
$list_suffix = '';
|
121 |
+
|
122 |
+
if ( is_product_category() ) {
|
123 |
+
$category = get_queried_object();
|
124 |
+
$list_suffix = ' | ' . $category->name;
|
125 |
+
$list_suffix = $this->add_parent_category_name( $category, $list_suffix );
|
126 |
+
} else {
|
127 |
+
|
128 |
+
if ( is_product_tag() ) {
|
129 |
+
$tag = get_queried_object();
|
130 |
+
$list_suffix = ' | ' . $tag->name;
|
131 |
+
}
|
132 |
+
|
133 |
+
}
|
134 |
+
|
135 |
+
return $list_suffix;
|
136 |
+
}
|
137 |
+
|
138 |
+
protected function add_parent_category_name( $category, $list_suffix )
|
139 |
+
{
|
140 |
+
|
141 |
+
if ( $category->parent > 0 ) {
|
142 |
+
$parent_category = get_term_by( 'id', $category->parent, 'product_cat' );
|
143 |
+
$list_suffix = ' | ' . $parent_category->name . $list_suffix;
|
144 |
+
$list_suffix = $this->add_parent_category_name( $parent_category, $list_suffix );
|
145 |
+
}
|
146 |
+
|
147 |
+
return $list_suffix;
|
148 |
+
}
|
149 |
+
|
150 |
+
protected function get_list_id_suffix()
|
151 |
+
{
|
152 |
+
$list_suffix = '';
|
153 |
+
|
154 |
+
if ( is_product_category() ) {
|
155 |
+
$category = get_queried_object();
|
156 |
+
$list_suffix = '.' . $category->slug;
|
157 |
+
$list_suffix = $this->add_parent_category_id( $category, $list_suffix );
|
158 |
+
} else {
|
159 |
+
|
160 |
+
if ( is_product_tag() ) {
|
161 |
+
$tag = get_queried_object();
|
162 |
+
$list_suffix = '.' . $tag->slug;
|
163 |
+
}
|
164 |
+
|
165 |
+
}
|
166 |
+
|
167 |
+
return $list_suffix;
|
168 |
+
}
|
169 |
+
|
170 |
+
protected function add_parent_category_id( $category, $list_suffix )
|
171 |
+
{
|
172 |
+
|
173 |
+
if ( $category->parent > 0 ) {
|
174 |
+
$parent_category = get_term_by( 'id', $category->parent, 'product_cat' );
|
175 |
+
$list_suffix = '.' . $parent_category->slug . $list_suffix;
|
176 |
+
$list_suffix = $this->add_parent_category_id( $parent_category, $list_suffix );
|
177 |
+
}
|
178 |
+
|
179 |
+
return $list_suffix;
|
180 |
+
}
|
181 |
+
|
182 |
+
// https://stackoverflow.com/a/49616130/4688612
|
183 |
+
protected function get_order_from_order_received_page()
|
184 |
+
{
|
185 |
+
|
186 |
+
if ( $this->get_order_from_query_vars() ) {
|
187 |
+
return $this->get_order_from_query_vars();
|
188 |
+
} else {
|
189 |
+
|
190 |
+
if ( $this->get_order_with_url_order_key() ) {
|
191 |
+
return $this->get_order_with_url_order_key();
|
192 |
+
} else {
|
193 |
+
return false;
|
194 |
+
}
|
195 |
+
|
196 |
+
}
|
197 |
+
|
198 |
+
}
|
199 |
+
|
200 |
+
protected function wpm_get_order_total( $order )
|
201 |
+
{
|
202 |
+
$order_total = ( 0 == $this->options_obj->shop->order_total_logic ? $order->get_subtotal() - $order->get_total_discount() : $order->get_total() );
|
203 |
+
// filter to adjust the order value
|
204 |
+
$order_total = apply_filters_deprecated(
|
205 |
+
'wgact_conversion_value_filter',
|
206 |
+
[ $order_total, $order ],
|
207 |
+
'1.10.2',
|
208 |
+
'wooptpm_conversion_value_filter'
|
209 |
+
);
|
210 |
+
$order_total = apply_filters_deprecated(
|
211 |
+
'wooptpm_conversion_value_filter',
|
212 |
+
[ $order_total, $order ],
|
213 |
+
'1.13.0',
|
214 |
+
'wpm_conversion_value_filter'
|
215 |
+
);
|
216 |
+
$order_total = apply_filters( 'wpm_conversion_value_filter', $order_total, $order );
|
217 |
+
return number_format(
|
218 |
+
(double) $order_total,
|
219 |
+
2,
|
220 |
+
'.',
|
221 |
+
''
|
222 |
+
);
|
223 |
+
}
|
224 |
+
|
225 |
+
protected function get_order_from_query_vars()
|
226 |
+
{
|
227 |
+
global $wp ;
|
228 |
+
$order_id = absint( $wp->query_vars['order-received'] );
|
229 |
+
|
230 |
+
if ( $order_id && 0 != $order_id && wc_get_order( $order_id ) ) {
|
231 |
+
return wc_get_order( $order_id );
|
232 |
+
} else {
|
233 |
+
wc_get_logger()->debug( 'WooCommerce couldn\'t retrieve the order ID from $wp->query_vars[\'order-received\']', [
|
234 |
+
'source' => 'wpm',
|
235 |
+
] );
|
236 |
+
wc_get_logger()->debug( print_r( $wp->query_vars, true ), [
|
237 |
+
'source' => 'wpm',
|
238 |
+
] );
|
239 |
+
return false;
|
240 |
+
}
|
241 |
+
|
242 |
+
}
|
243 |
+
|
244 |
+
protected function get_order_with_url_order_key()
|
245 |
+
{
|
246 |
+
$_get = filter_input_array( INPUT_GET, FILTER_SANITIZE_STRING );
|
247 |
+
|
248 |
+
if ( isset( $_get['key'] ) ) {
|
249 |
+
$order_key = $_get['key'];
|
250 |
+
return wc_get_order( wc_get_order_id_by_order_key( $order_key ) );
|
251 |
+
} else {
|
252 |
+
wc_get_logger()->debug( 'WooCommerce couldn\'t retrieve the order ID from order key in the URL', [
|
253 |
+
'source' => 'wpm',
|
254 |
+
] );
|
255 |
+
$order_key = ( $_get['key'] ? $_get['key'] : '' );
|
256 |
+
wc_get_logger()->debug( 'URL order key: ' . $order_key, [
|
257 |
+
'source' => 'wpm',
|
258 |
+
] );
|
259 |
+
return false;
|
260 |
+
}
|
261 |
+
|
262 |
+
}
|
263 |
+
|
264 |
+
protected function get_order_currency( $order )
|
265 |
+
{
|
266 |
+
// use the right function to get the currency depending on the WooCommerce version
|
267 |
+
return ( $this->woocommerce_3_and_above() ? $order->get_currency() : $order->get_order_currency() );
|
268 |
+
}
|
269 |
+
|
270 |
+
protected function woocommerce_3_and_above()
|
271 |
+
{
|
272 |
+
global $woocommerce ;
|
273 |
+
|
274 |
+
if ( version_compare( $woocommerce->version, 3.0, '>=' ) ) {
|
275 |
+
return true;
|
276 |
+
} else {
|
277 |
+
return false;
|
278 |
+
}
|
279 |
+
|
280 |
+
}
|
281 |
+
|
282 |
+
// https://stackoverflow.com/a/46216073/4688612
|
283 |
+
// https://github.com/woocommerce/woocommerce/wiki/wc_get_orders-and-WC_Order_Query#description
|
284 |
+
protected function is_existing_customer( $order, $value = 0 )
|
285 |
+
{
|
286 |
+
|
287 |
+
if ( is_numeric( $value ) ) {
|
288 |
+
// Based on user ID (registered users)
|
289 |
+
$meta_key = '_customer_user';
|
290 |
+
$meta_value = ( 0 == $value ? get_current_user_id() : (int) $value );
|
291 |
+
} else {
|
292 |
+
// Based on billing email (Guest users)
|
293 |
+
$meta_key = '_billing_email';
|
294 |
+
$meta_value = sanitize_email( $value );
|
295 |
+
}
|
296 |
+
|
297 |
+
$orders = wc_get_orders( [
|
298 |
+
'return' => 'ids',
|
299 |
+
'meta_key' => $meta_key,
|
300 |
+
'meta_value' => $meta_value,
|
301 |
+
'post_status' => wc_get_is_paid_statuses(),
|
302 |
+
'limit' => 1,
|
303 |
+
] );
|
304 |
+
// Return a boolean value based on orders count
|
305 |
+
return count( $orders ) > 0;
|
306 |
+
}
|
307 |
+
|
308 |
+
// https://stackoverflow.com/a/46216073/4688612
|
309 |
+
// protected function is_existing_customer( $order, $value = 0 ) {
|
310 |
+
// global $wpdb;
|
311 |
+
//
|
312 |
+
// // Based on user ID (registered users)
|
313 |
+
// if (is_numeric($value)) {
|
314 |
+
// $meta_key = '_customer_user';
|
315 |
+
// $meta_value = 0 == $value ? get_current_user_id() : (int) $value;
|
316 |
+
// } else { // Based on billing email (Guest users)
|
317 |
+
// $meta_key = '_billing_email';
|
318 |
+
// $meta_value = sanitize_email($value);
|
319 |
+
// }
|
320 |
+
//
|
321 |
+
// $paid_order_statuses = array_map('esc_sql', wc_get_is_paid_statuses());
|
322 |
+
//
|
323 |
+
// $count = $wpdb->get_var($wpdb->prepare("
|
324 |
+
// SELECT COUNT(p.ID) FROM {$wpdb->prefix}posts AS p
|
325 |
+
// INNER JOIN {$wpdb->prefix}postmeta AS pm ON p.ID = pm.post_id
|
326 |
+
// WHERE p.post_status IN ( 'wc-" . implode("','wc-", $paid_order_statuses) . "' )
|
327 |
+
// AND p.post_type LIKE 'shop_order'
|
328 |
+
// AND p.ID <> {$order->get_id()}
|
329 |
+
// AND pm.meta_key = '%s'
|
330 |
+
// AND pm.meta_value = %s
|
331 |
+
// LIMIT 1
|
332 |
+
// ", $meta_key, $meta_value)
|
333 |
+
// );
|
334 |
+
//
|
335 |
+
// // Return a boolean value based on orders count
|
336 |
+
// return $count > 0;
|
337 |
+
// }
|
338 |
+
protected function get_visitor_country()
|
339 |
+
{
|
340 |
+
|
341 |
+
if ( $this->is_localhost() ) {
|
342 |
+
$this->ip = WC_Geolocation::get_external_ip_address();
|
343 |
+
} else {
|
344 |
+
$this->ip = WC_Geolocation::get_ip_address();
|
345 |
+
}
|
346 |
+
|
347 |
+
$location = WC_Geolocation::geolocate_ip( $this->ip );
|
348 |
+
return $location['country'];
|
349 |
+
}
|
350 |
+
|
351 |
+
protected function is_localhost()
|
352 |
+
{
|
353 |
+
$_server = filter_input_array( INPUT_SERVER, FILTER_SANITIZE_STRING );
|
354 |
+
return in_array( $_server['REMOTE_ADDR'], [ '127.0.0.1', '::1' ], true );
|
355 |
+
}
|
356 |
+
|
357 |
+
protected function get_user_email( $algo = '' )
|
358 |
+
{
|
359 |
+
|
360 |
+
if ( is_user_logged_in() ) {
|
361 |
+
$current_user = wp_get_current_user();
|
362 |
+
$email = $current_user->user_email;
|
363 |
+
} elseif ( is_order_received_page() ) {
|
364 |
+
$order = $this->get_order_from_order_received_page();
|
365 |
+
|
366 |
+
if ( $order ) {
|
367 |
+
$email = $order->get_billing_email();
|
368 |
+
} else {
|
369 |
+
$email = '';
|
370 |
+
}
|
371 |
+
|
372 |
+
} else {
|
373 |
+
$email = '';
|
374 |
+
}
|
375 |
+
|
376 |
+
// encrypt email
|
377 |
+
if ( $email && in_array( $algo, hash_algos(), true ) ) {
|
378 |
+
$email = hash( $algo, $email );
|
379 |
+
}
|
380 |
+
return $email;
|
381 |
+
}
|
382 |
+
|
383 |
+
}
|
css/admin.css
CHANGED
@@ -47,7 +47,7 @@
|
|
47 |
.developer-banner {
|
48 |
background: #f3f5f6;
|
49 |
color: #0071a1;
|
50 |
-
padding:
|
51 |
margin-bottom: 20px;
|
52 |
border-radius: 3px;
|
53 |
border-style: solid;
|
@@ -174,4 +174,4 @@ input:checked + .slider:before {
|
|
174 |
text-decoration: none;
|
175 |
margin-left: 5px;
|
176 |
margin-right: 5px;
|
177 |
-
}
|
47 |
.developer-banner {
|
48 |
background: #f3f5f6;
|
49 |
color: #0071a1;
|
50 |
+
padding: 0px 10px;
|
51 |
margin-bottom: 20px;
|
52 |
border-radius: 3px;
|
53 |
border-style: solid;
|
174 |
text-decoration: none;
|
175 |
margin-left: 5px;
|
176 |
margin-right: 5px;
|
177 |
+
}
|
js/admin/wpm-admin-freemius.p1.min.js
CHANGED
@@ -1,2 +1,2 @@
|
|
1 |
-
(()=>{var e={
|
2 |
//# sourceMappingURL=wpm-admin-freemius.p1.min.js.map
|
1 |
+
(()=>{var e={309:()=>{!function(){try{new MutationObserver((function(e){e.forEach((function(e){"class"===e.attributeName&&jQuery(e.target).prop(e.attributeName).includes("disabled")&&jQuery(".fs-modal").find(".button-deactivate").removeClass("disabled")}))})).observe(jQuery(".fs-modal").find(".button-deactivate")[0],{attributes:!0})}catch(e){console.error(e)}}()}},t={};function r(o){var a=t[o];if(void 0!==a)return a.exports;var n=t[o]={exports:{}};return e[o](n,n.exports,r),n.exports}r.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return r.d(t,{a:t}),t},r.d=(e,t)=>{for(var o in t)r.o(t,o)&&!r.o(e,o)&&Object.defineProperty(e,o,{enumerable:!0,get:t[o]})},r.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),(()=>{"use strict";r(309)})()})();
|
2 |
//# sourceMappingURL=wpm-admin-freemius.p1.min.js.map
|
js/admin/wpm-admin-freemius.p1.min.js.map
CHANGED
@@ -1 +1 @@
|
|
1 |
-
{"version":3,"file":"wpm-admin-freemius.p1.min.js","mappings":"
|
1 |
+
{"version":3,"file":"wpm-admin-freemius.p1.min.js","mappings":"uBAAA,WACC,IAEgB,IAAIA,kBAAiB,SAAUC,GAC7CA,EAAUC,SAAQ,SAAUC,GACI,UAA3BA,EAASC,eACSC,OAAOF,EAASG,QAAQC,KAAKJ,EAASC,eACxCI,SAAS,aAC3BH,OAAO,aAAaI,KAAK,sBAAsBC,YAAY,kBAMtDC,QAAQN,OAAO,aAAaI,KAAK,sBAAsB,GAAI,CACnEG,YAAY,IAGZ,MAAOC,GACRC,QAAQD,MAAMA,IAnBhB,KCCIE,EAA2B,GAG/B,SAASC,EAAoBC,GAE5B,IAAIC,EAAeH,EAAyBE,GAC5C,QAAqBE,IAAjBD,EACH,OAAOA,EAAaE,QAGrB,IAAIC,EAASN,EAAyBE,GAAY,CAGjDG,QAAS,IAOV,OAHAE,EAAoBL,GAAUI,EAAQA,EAAOD,QAASJ,GAG/CK,EAAOD,QCpBfJ,EAAoBO,EAAKF,IACxB,IAAIG,EAASH,GAAUA,EAAOI,WAC7B,IAAOJ,EAAiB,QACxB,IAAM,EAEP,OADAL,EAAoBU,EAAEF,EAAQ,CAAEG,EAAGH,IAC5BA,GCLRR,EAAoBU,EAAI,CAACN,EAASQ,KACjC,IAAI,IAAIC,KAAOD,EACXZ,EAAoBc,EAAEF,EAAYC,KAASb,EAAoBc,EAAEV,EAASS,IAC5EE,OAAOC,eAAeZ,EAASS,EAAK,CAAEI,YAAY,EAAMC,IAAKN,EAAWC,MCJ3Eb,EAAoBc,EAAI,CAACK,EAAK5B,IAAUwB,OAAOK,UAAUC,eAAeC,KAAKH,EAAK5B,G","sources":["webpack://WooCommerce Pixel Manager/./src/js/admin/freemius-keep-deactivate-button-enabled.js","webpack://WooCommerce Pixel Manager/webpack/bootstrap","webpack://WooCommerce Pixel Manager/webpack/runtime/compat get default export","webpack://WooCommerce Pixel Manager/webpack/runtime/define property getters","webpack://WooCommerce Pixel Manager/webpack/runtime/hasOwnProperty shorthand"],"sourcesContent":["(function () {\n\ttry {\n\n\t\tlet observer = new MutationObserver(function (mutations) {\n\t\t\tmutations.forEach(function (mutation) {\n\t\t\t\tif (mutation.attributeName === \"class\") {\n\t\t\t\t\tlet attributeValue = jQuery(mutation.target).prop(mutation.attributeName);\n\t\t\t\t\tif (attributeValue.includes('disabled')) {\n\t\t\t\t\t\tjQuery('.fs-modal').find('.button-deactivate').removeClass('disabled');\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t});\n\t\t});\n\n\t\tobserver.observe(jQuery('.fs-modal').find('.button-deactivate')[0], {\n\t\t\tattributes: true\n\t\t});\n\n\t} catch (error) {\n\t\tconsole.error(error);\n\t}\n})();\n","// The module cache\nvar __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tvar cachedModule = __webpack_module_cache__[moduleId];\n\tif (cachedModule !== undefined) {\n\t\treturn cachedModule.exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\t// no module.id needed\n\t\t// no module.loaded needed\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId](module, module.exports, __webpack_require__);\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n","// getDefaultExport function for compatibility with non-harmony modules\n__webpack_require__.n = (module) => {\n\tvar getter = module && module.__esModule ?\n\t\t() => (module['default']) :\n\t\t() => (module);\n\t__webpack_require__.d(getter, { a: getter });\n\treturn getter;\n};","// define getter functions for harmony exports\n__webpack_require__.d = (exports, definition) => {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))"],"names":["MutationObserver","mutations","forEach","mutation","attributeName","jQuery","target","prop","includes","find","removeClass","observe","attributes","error","console","__webpack_module_cache__","__webpack_require__","moduleId","cachedModule","undefined","exports","module","__webpack_modules__","n","getter","__esModule","d","a","definition","key","o","Object","defineProperty","enumerable","get","obj","prototype","hasOwnProperty","call"],"sourceRoot":""}
|
js/admin/wpm-admin.p1.min.js
CHANGED
@@ -1,2 +1,2 @@
|
|
1 |
-
(()=>{var e={
|
2 |
//# sourceMappingURL=wpm-admin.p1.min.js.map
|
1 |
+
(()=>{var e={331:()=>{jQuery((function(){function e(e,t){e.preventDefault();let n={action:"wpm_dismissed_notice_handler",set:t};jQuery.post(ajaxurl,n,(function(e){})),jQuery(".wpm-rating-success-notice").remove()}jQuery(".wpm-rating-success-notice").show(),jQuery(document).on("click","#wpm-rate-it",(function(t){e(t,"rating_done"),window.open("https://wordpress.org/support/view/plugin-reviews/woocommerce-google-adwords-conversion-tracking-tag?rate=5#postform","_blank").focus()})),jQuery(document).on("click","#wpm-already-did",(function(t){e(t,"rating_done")})),jQuery(document).on("click","#wpm-maybe-later",(function(t){e(t,"later")}))}))},178:()=>{function e(e){jQuery.post(ajaxurl,e,(function(e){location.reload()}))}jQuery((function(){jQuery(document).on("click",".incompatible-plugin-error-dismissal-button",(function(t){t.preventDefault(),e({action:"environment_check_handler",disable_warning:jQuery(this).data("plugin-slug")})})),jQuery(document).on("click","#wpm-wp-rocket-js-concatenation-disable",(function(t){t.preventDefault(),e({action:"environment_check_handler",set:"disable_wp_rocket_javascript_concatenation"})})),jQuery(document).on("click","#wpm-dismiss-wp-rocket-js-concatenation-error",(function(t){t.preventDefault(),e({action:"environment_check_handler",set:"dismiss_wp_rocket_javascript_concatenation_error"})})),jQuery(document).on("click","#wpm-litespeed-inline-js-dom-ready-disable",(function(t){t.preventDefault(),e({action:"environment_check_handler",set:"disable_litespeed_inline_js_dom_ready"})})),jQuery(document).on("click","#wpm-dismiss-litespeed-inline-js-dom-ready-error",(function(t){t.preventDefault(),e({action:"environment_check_handler",set:"dismiss_litespeed_inline_js_dom_ready"})})),jQuery(document).on("click","#wpm-paypal-standard-error-dismissal-button",(function(t){t.preventDefault(),e({action:"environment_check_handler",set:"dismiss_paypal_standard_warning"})}))}))},649:()=>{jQuery((function(){jQuery("#debug-info-button").click((function(){jQuery("#debug-info-textarea").select(),document.execCommand("copy")})),jQuery("#wpm_pro_version_demo").on("click",(function(){jQuery("#submit").click()}))}))},740:()=>{function e(){jQuery("#script-blocker-notice").hide()}e(),jQuery((function(){e()}))},110:()=>{function e(){const e=window.location.search,t=new URLSearchParams(e);return!!t.get("section")&&{section:t.get("section"),subsection:t.get("subsection")}}function t(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"";const i=window.location.search,s=new URLSearchParams(i);s.delete("section"),s.delete("subsection");let a="section="+e;a+=t?"&subsection="+t:"",history.pushState("","wpm"+e,document.location.pathname+"?page=wpm&"+a),jQuery('input[name ="_wp_http_referer"]').val(n()+"?page=wpm&"+a+"&settings-updated=true")}function n(){return new URL(jQuery("#wp-admin-canonical").attr("href")).pathname}jQuery((function(){let n=[],i={};if(jQuery(".section").closest("tr").hide(),jQuery(".section").each((function(){n.push({slug:jQuery(this).data("sectionSlug"),title:jQuery(this).data("sectionTitle")})})),jQuery(".subsection").each((function(){i[jQuery(this).data("sectionSlug")]=i[jQuery(this).data("sectionSlug")]||[],i[jQuery(this).data("sectionSlug")].push({title:jQuery(this).data("subsectionTitle"),slug:jQuery(this).data("subsectionSlug")})})),n.forEach((function(e){jQuery(".nav-tab-wrapper").append('<a href="#" class="nav-tab" data-section-slug="'+e.slug+'">'+e.title+"</a>")})),jQuery(".nav-tab-wrapper").after(function(e){let t=Object.keys(e),n="";return t.forEach((function(t){n+='<ul class="subnav-tabs" data-section-slug="'+t+'">',e[t].forEach((function(e){n+='<li class="subnav-li subnav-li-inactive" data-subsection-slug="'+e.slug+'">'+e.title+"</li>"})),n+="</ul>"})),n}(i)),jQuery(".nav-tab-wrapper a").on("click",(function(e){e.preventDefault(),jQuery(this).addClass("nav-tab-active").siblings().removeClass("nav-tab-active");let s=jQuery(this).data("section-slug");!function(e,n){jQuery("#wpm_settings_form > h2").nextUntil(".submit").andSelf().hide(),jQuery(".subnav-tabs").hide(),jQuery(".subnav-tabs[data-section-slug="+e+"]").show();let i=n.findIndex((t=>t.slug===e));jQuery("div[data-section-slug="+e+"]").closest("table").prevAll("h2:first").next().nextUntil("h2, .submit").andSelf().show(),t(n[i].slug)}(s,n),s in i&&jQuery("ul[data-section-slug="+s+"]").children(":first").trigger("click")})),jQuery(".subnav-li").on("click",(function(e){var n,i;e.preventDefault(),jQuery(this).addClass("subnav-li-active").removeClass("subnav-li-inactive").siblings().addClass("subnav-li-inactive").removeClass("subnav-li-active"),n=jQuery(this).parent().data("section-slug"),i=jQuery(this).data("subsection-slug"),jQuery("#wpm_settings_form > h2").nextUntil(".submit").andSelf().hide(),jQuery("[data-section-slug="+n+"][data-subsection-slug="+i+"]").closest("tr").siblings().andSelf().hide(),jQuery("[data-section-slug="+n+"][data-subsection-slug="+i+"]").closest("table").show(),jQuery("[data-section-slug="+n+"][data-subsection-slug="+i+"]").closest("tr").nextUntil(jQuery("[data-section-slug="+n+"][data-subsection-slug]").closest("tr")).show(),t(n,i)})),e()){let t=e();jQuery("a[data-section-slug="+t.section+"]").trigger("click"),!1!==t.subsection&&jQuery("ul[data-section-slug="+t.section+"]").children("[data-subsection-slug="+t.subsection+"]").trigger("click")}else jQuery("a[data-section-slug="+n[0].slug+"]").trigger("click")}))}},t={};function n(i){var s=t[i];if(void 0!==s)return s.exports;var a=t[i]={exports:{}};return e[i](a,a.exports,n),a.exports}n.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t},n.d=(e,t)=>{for(var i in t)n.o(t,i)&&!n.o(e,i)&&Object.defineProperty(e,i,{enumerable:!0,get:t[i]})},n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),(()=>{"use strict";n(331),n(178),n(649),n(740),n(110)})()})();
|
2 |
//# sourceMappingURL=wpm-admin.p1.min.js.map
|
js/admin/wpm-admin.p1.min.js.map
CHANGED
@@ -1 +1 @@
|
|
1 |
-
{"version":3,"file":"wpm-admin.p1.min.js","mappings":"sBAAAA,QAAO,WAqBN,SAASC,EAAcC,EAAGC,GAEzBD,EAAEE,iBAEF,IAAIC,EAAO,CACV,OAAU,+BACV,IAAUF,GAGXH,OAAOM,KAAKC,QAASF,GAAM,SAAUG,OAIrCR,OAAO,8BAA8BS,SAhCtCT,OAAO,8BAA8BU,OAGrCV,OAAOW,UAAUC,GAAG,QAAS,gBAAgB,SAAUV,GACtDD,EAAcC,EAAG,eAEPW,OAAOC,KAAK,uHAAwH,UAC1IC,WAGLf,OAAOW,UAAUC,GAAG,QAAS,oBAAoB,SAAUV,GAC1DD,EAAcC,EAAG,kBAIlBF,OAAOW,UAAUC,GAAG,QAAS,oBAAoB,SAAUV,GAC1DD,EAAcC,EAAG,gB,SC2DnB,SAASc,EAAmBX,GAC3BL,OAAOM,KAAKC,QAASF,GAAM,SAAUG,GAGpCS,SAASC,YAjFXlB,QAAO,WAGNA,OAAOW,UAAUC,GAAG,QAAS,+CAA+C,SAAUV,GACrFA,EAAEE,iBAOFY,EALW,CACV,OAAmB,4BACnB,gBAA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G/B,SAASC,EAAoBC,GAE5B,IAAIC,EAAeH,EAAyBE,GAC5C,QAAqBE,IAAjBD,EACH,OAAOA,EAAaE,QAGrB,IAAIC,EAASN,EAAyBE,GAAY,CAGjDG,QAAS,IAOV,OAHAE,EAAoBL,GAAUI,EAAQA,EAAOD,QAASJ,GAG/CK,EAAOD,QCpBfJ,EAAoBO,EAAKF,IACxB,IAAIG,EAASH,GAAUA,EAAOI,WAC7B,IAAOJ,EAAiB,QACxB,IAAM,EAEP,OADAL,EAAoBU,EAAEF,EAAQ,CAAEG,EAAGH,IAC5BA,GCLRR,EAAoBU,EAAI,CAACN,EAASQ,KACjC,IAAI,IAAIC,KAAOD,EACXZ,EAAoBc,EAAEF,EAAYC,KAASb,EAAoBc,EAAEV,EAASS,IAC5EnC,OAAOqC,eAAeX,EAASS,EAAK,CAAEG,YAAY,EAAM7D,IAAKyD,EAAWC,MCJ3Eb,EAAoBc,EAAI,CAACG,EAAKC,IAAUxC,OAAOyC,UAAUC,eAAeC,KAAKJ,EAAKC,G","sources":["webpack://WooCommerce-Pixel-Manager/./src/js/admin/ask-for-rating.js","webpack://WooCommerce-Pixel-Manager/./src/js/admin/environment-check.js","webpack://WooCommerce-Pixel-Manager/./src/js/admin/helpers.js","webpack://WooCommerce-Pixel-Manager/./src/js/admin/script-blocker-warning.js","webpack://WooCommerce-Pixel-Manager/./src/js/admin/tabs.js","webpack://WooCommerce-Pixel-Manager/webpack/bootstrap","webpack://WooCommerce-Pixel-Manager/webpack/runtime/compat get default export","webpack://WooCommerce-Pixel-Manager/webpack/runtime/define property getters","webpack://WooCommerce-Pixel-Manager/webpack/runtime/hasOwnProperty shorthand"],"sourcesContent":["jQuery(function () {\n\n\tjQuery('.wpm-rating-success-notice').show();\n\n\t// go and rate it or already done\n\tjQuery(document).on('click', '#wpm-rate-it', function (e) {\n\t\tprocess_click(e, 'rating_done');\n\n\t\tlet win = window.open('https://wordpress.org/support/view/plugin-reviews/woocommerce-google-adwords-conversion-tracking-tag?rate=5#postform', '_blank');\n\t\twin.focus();\n\t});\n\n\tjQuery(document).on('click', '#wpm-already-did', function (e) {\n\t\tprocess_click(e, 'rating_done');\n\t});\n\n\t// maybe rate later\n\tjQuery(document).on('click', '#wpm-maybe-later', function (e) {\n\t\tprocess_click(e, 'later');\n\t});\n\n\tfunction process_click(e, set) {\n\n\t\te.preventDefault();\n\n\t\tlet data = {\n\t\t\t'action': 'wpm_dismissed_notice_handler',\n\t\t\t'set' : set\n\t\t};\n\n\t\tjQuery.post(ajaxurl, data, function (response) {\n\t\t\t// console.log('Got this from the server: ' + response);\n\t\t\t// console.log('update rating done');\n\t\t});\n\t\tjQuery('.wpm-rating-success-notice').remove();\n\t}\n});\n","jQuery(function () {\n\n\t// disable incompatible plugin warning\n\tjQuery(document).on('click', '.incompatible-plugin-error-dismissal-button', function (e) {\n\t\te.preventDefault();\n\n\t\tlet data = {\n\t\t\t'action' : 'environment_check_handler',\n\t\t\t'disable_warning': jQuery(this).data('plugin-slug'),\n\t\t};\n\n\t\twpm_send_ajax_data(data);\n\t});\n\n\n\t// disable WP Rocket JavaScript concatenation\n\tjQuery(document).on('click', '#wpm-wp-rocket-js-concatenation-disable', function (e) {\n\t\te.preventDefault();\n\n\t\tlet data = {\n\t\t\t'action': 'environment_check_handler',\n\t\t\t'set' : 'disable_wp_rocket_javascript_concatenation'\n\t\t};\n\n\t\twpm_send_ajax_data(data);\n\t});\n\n\t// dismiss WP Rocket JavaScript concatenation error\n\tjQuery(document).on('click', '#wpm-dismiss-wp-rocket-js-concatenation-error', function (e) {\n\t\te.preventDefault();\n\n\t\tlet data = {\n\t\t\t'action': 'environment_check_handler',\n\t\t\t'set' : 'dismiss_wp_rocket_javascript_concatenation_error'\n\t\t};\n\n\t\twpm_send_ajax_data(data);\n\t});\n\n\t// disable WP Rocket JavaScript concatenation\n\tjQuery(document).on('click', '#wpm-litespeed-inline-js-dom-ready-disable', function (e) {\n\t\te.preventDefault();\n\n\t\tlet data = {\n\t\t\t'action': 'environment_check_handler',\n\t\t\t'set' : 'disable_litespeed_inline_js_dom_ready'\n\t\t};\n\n\t\twpm_send_ajax_data(data);\n\t});\n\n\t// dismiss WP Rocket JavaScript concatenation error\n\tjQuery(document).on('click', '#wpm-dismiss-litespeed-inline-js-dom-ready-error', function (e) {\n\t\te.preventDefault();\n\n\t\tlet data = {\n\t\t\t'action': 'environment_check_handler',\n\t\t\t'set' : 'dismiss_litespeed_inline_js_dom_ready'\n\t\t};\n\n\t\twpm_send_ajax_data(data);\n\t});\n\n\t// dismiss PayPal standard payment gateway warning\n\tjQuery(document).on('click', '#wpm-paypal-standard-error-dismissal-button', function (e) {\n\t\te.preventDefault();\n\n\t\tlet data = {\n\t\t\t'action': 'environment_check_handler',\n\t\t\t'set' : 'dismiss_paypal_standard_warning'\n\t\t};\n\n\t\twpm_send_ajax_data(data);\n\t});\n\n});\n\nfunction wpm_send_ajax_data(data) {\n\tjQuery.post(ajaxurl, data, function (response) {\n\t\t// console.log('Got this from the server: ' + response);\n\t\t// console.log('update rating done');\n\t\tlocation.reload();\n\t});\n}\n","jQuery(function () {\n\n\t// copy debug info textarea\n\tjQuery(\"#debug-info-button\").click(function () {\n\t\tjQuery(\"#debug-info-textarea\").select();\n\t\tdocument.execCommand('copy');\n\t});\n\n\tjQuery(\"#wpm_pro_version_demo\").on('click', function () {\n\t\tjQuery(\"#submit\").click();\n\t});\n});\n","function wpm_hide_script_blocker_warning() {\n\tjQuery('#script-blocker-notice').hide();\n}\n\n// try to hide as soon as this script is loaded\n// might be too early in some cases, as the HTML is not rendered yet\nwpm_hide_script_blocker_warning();\n\n// if all other earlier attempts to hide did fail\n// run the function after entire DOM has been loaded\njQuery(function () {\n\twpm_hide_script_blocker_warning();\n});\n","jQuery(function () {\n\n\tlet sections = [];\n\tlet subsections = {};\n\n\t// hide unnecessary elements\n\tjQuery('.section').closest('tr').hide();\n\n\t// collect information on sections\n\tjQuery('.section').each(function () {\n\t\tsections.push({\n\t\t\t'slug' : jQuery(this).data('sectionSlug'),\n\t\t\t'title': jQuery(this).data('sectionTitle'),\n\t\t});\n\t});\n\n\t// collect information on subsections\n\tjQuery('.subsection').each(function () {\n\n\t\tsubsections[jQuery(this).data('sectionSlug')] = subsections[jQuery(this).data('sectionSlug')] || [];\n\n\t\tsubsections[jQuery(this).data('sectionSlug')].push({\n\t\t\t'title': jQuery(this).data('subsectionTitle'),\n\t\t\t'slug' : jQuery(this).data('subsectionSlug')\n\t\t});\n\t});\n\n\t// create tabs for sections\n\tsections.forEach(\n\t\tfunction (section) {\n\t\t\tjQuery(\".nav-tab-wrapper\").append(\"<a href=\\\"#\\\" class=\\\"nav-tab\\\" data-section-slug=\\\"\" + section['slug'] + \"\\\">\" + section['title'] + \"</a>\");\n\t\t});\n\n\t// create tabs for each subsections\n\tjQuery(\".nav-tab-wrapper\").after(createSubtabUlHtml(subsections));\n\n\t// create on-click events on section tabs that toggle the views\n\tjQuery(\".nav-tab-wrapper a\").on('click', function (e) {\n\t\te.preventDefault();\n\n\t\t// show clicked tab as active\n\t\tjQuery(this).addClass(\"nav-tab-active\").siblings().removeClass(\"nav-tab-active\");\n\n\t\t// toggle the sections visible / invisible based on clicked tab\n\n\t\tlet sectionSlug = jQuery(this).data('section-slug')\n\t\ttoggleSections(sectionSlug, sections);\n\n\t\t// if subsection exists, click on first subsection\n\t\tif (sectionSlug in subsections) {\n\t\t\tjQuery(\"ul[data-section-slug=\" + sectionSlug + \"]\").children(':first').trigger('click')\n\t\t}\n\t});\n\n\t// create on-click events on subsection tabs that toggle the views\n\tjQuery(\".subnav-li\").on('click', function (e) {\n\t\te.preventDefault();\n\n\t\t// jQuery(this).hide();\n\t\tjQuery(this)\n\t\t\t.addClass('subnav-li-active').removeClass('subnav-li-inactive')\n\t\t\t.siblings()\n\t\t\t.addClass('subnav-li-inactive').removeClass('subnav-li-active');\n\n\t\ttoggleSubsection(jQuery(this).parent().data('section-slug'), jQuery(this).data('subsection-slug'));\n\t});\n\n\t// if someone access a plugin tab by deep link, open the right tab\n\t// or fallback to default (first tab)\n\n\t// if deeplink is being opened open the according section and subsection\n\tif (getSectionParams()) {\n\n\t\tlet sectionParams = getSectionParams();\n\n\t\tjQuery(\"a[data-section-slug=\" + sectionParams['section'] + \"]\").trigger('click');\n\n\t\tif (sectionParams['subsection'] !== false) {\n\t\t\tjQuery(\"ul[data-section-slug=\" + sectionParams['section'] + \"]\").children(\"[data-subsection-slug=\" + sectionParams['subsection'] + \"]\").trigger('click')\n\t\t}\n\t} else {\n\t\tjQuery(\"a[data-section-slug=\" + sections[0]['slug'] + \"]\").trigger('click');\n\t}\n});\n\n// creates the html with all subsection elements\nfunction createSubtabUlHtml(subsections) {\n\n\tlet subsectionsKeys = Object.keys(subsections);\n\n\tlet html = '';\n\n\tsubsectionsKeys.forEach(function (subsectionKey) {\n\t\thtml += '<ul class=\"subnav-tabs\" data-section-slug=\"' + subsectionKey + '\">';\n\n\t\tlet subtabs = subsections[subsectionKey];\n\n\t\tsubtabs.forEach(function (subtab) {\n\t\t\thtml += '<li class=\"subnav-li subnav-li-inactive\" data-subsection-slug=\"' + subtab['slug'] + '\">' + subtab['title'] + '</li>'\n\t\t});\n\n\t\thtml += '</ul>';\n\t});\n\n\treturn html;\n}\n\n// if section (and subsection) URL parameters are set,\n// return them, otherwise return false\nfunction getSectionParams() {\n\tconst queryString = window.location.search;\n\tconst urlParams = new URLSearchParams(queryString);\n\n\tif (urlParams.get('section')) {\n\t\treturn {\n\t\t\t'section' : urlParams.get('section'),\n\t\t\t'subsection': urlParams.get('subsection')\n\t\t};\n\t} else {\n\t\treturn false;\n\t}\n}\n\n// toggles the sections\nfunction toggleSections(sectionSlug, sections) {\n\n\tjQuery(\"#wpm_settings_form > h2\").nextUntil(\".submit\").andSelf().hide();\n\tjQuery(\".subnav-tabs\").hide();\n\tjQuery(\".subnav-tabs[data-section-slug=\" + sectionSlug + \"]\").show();\n\n\tlet sectionPos = sections.findIndex((arrayElement) => arrayElement['slug'] === sectionSlug);\n\n\tjQuery(\"div[data-section-slug=\" + sectionSlug + \"]\").closest(\"table\").prevAll(\"h2:first\").next().nextUntil(\"h2, .submit\").andSelf().show();\n\n\t// set the URL with the active tab parameter\n\tsetUrl(sections[sectionPos]['slug']);\n}\n\nfunction toggleSubsection(sectionSlug, subsectionSlug) {\n\n\tjQuery(\"#wpm_settings_form > h2\").nextUntil(\".submit\").andSelf().hide();\n\tjQuery(\"[data-section-slug=\" + sectionSlug + \"][data-subsection-slug=\" + subsectionSlug + \"]\").closest(\"tr\").siblings().andSelf().hide();\n\n\tjQuery(\"[data-section-slug=\" + sectionSlug + \"][data-subsection-slug=\" + subsectionSlug + \"]\").closest(\"table\").show();\n\tjQuery(\"[data-section-slug=\" + sectionSlug + \"][data-subsection-slug=\" + subsectionSlug + \"]\").closest(\"tr\").nextUntil(jQuery(\"[data-section-slug=\" + sectionSlug + \"][data-subsection-slug]\").closest('tr')).show();\n\n\t// set the URL with the active tab parameter\n\tsetUrl(sectionSlug, subsectionSlug);\n}\n\n// sets the new URL parameters\nfunction setUrl(sectionSlug, subsectionSlug = \"\") {\n\n\tconst queryString = window.location.search;\n\tconst urlParams = new URLSearchParams(queryString);\n\n\turlParams.delete('section');\n\turlParams.delete('subsection');\n\n\tlet newParams = \"section=\" + sectionSlug;\n\tnewParams += subsectionSlug ? \"&subsection=\" + subsectionSlug : \"\";\n\n\thistory.pushState('', 'wpm' + sectionSlug, document.location.pathname + \"?page=wpm&\" + newParams);\n\n\t// make WP remember which was the selected tab on a save and return to the same tab after saving\n\tjQuery('input[name =\"_wp_http_referer\"]').val(getAdminPath() + \"?page=wpm&\" + newParams + \"&settings-updated=true\");\n}\n\nfunction getAdminPath() {\n\tlet url = new URL(jQuery('#wp-admin-canonical').attr('href'));\n\treturn url.pathname;\n}\n","// The module cache\nvar __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tvar cachedModule = __webpack_module_cache__[moduleId];\n\tif (cachedModule !== undefined) {\n\t\treturn cachedModule.exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\t// no module.id needed\n\t\t// no module.loaded needed\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId](module, module.exports, __webpack_require__);\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n","// getDefaultExport function for compatibility with non-harmony modules\n__webpack_require__.n = (module) => {\n\tvar getter = module && module.__esModule ?\n\t\t() => (module['default']) :\n\t\t() => (module);\n\t__webpack_require__.d(getter, { a: getter });\n\treturn getter;\n};","// define getter functions for harmony exports\n__webpack_require__.d = (exports, definition) => {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))"],"names":["jQuery","process_click","e","set","preventDefault","data","post","ajaxurl","response","remove","show","document","on","window","open","focus","wpm_send_ajax_data","location","reload","this","click","select","execCommand","wpm_hide_script_blocker_warning","hide","getSectionParams","queryString","search","urlParams","URLSearchParams","get","setUrl","sectionSlug","subsectionSlug","delete","newParams","history","pushState","pathname","val","getAdminPath","URL","attr","sections","subsections","closest","each","push","forEach","section","append","after","subsectionsKeys","Object","keys","html","subsectionKey","subtab","createSubtabUlHtml","addClass","siblings","removeClass","nextUntil","andSelf","sectionPos","findIndex","arrayElement","prevAll","next","toggleSections","children","trigger","parent","sectionParams","__webpack_module_cache__","__webpack_require__","moduleId","cachedModule","undefined","exports","module","__webpack_modules__","n","getter","__esModule","d","a","definition","key","o","defineProperty","enumerable","obj","prop","prototype","hasOwnProperty","call"],"sourceRoot":""}
|
1 |
+
{"version":3,"file":"wpm-admin.p1.min.js","mappings":"sBAAAA,QAAO,WAqBN,SAASC,EAAcC,EAAGC,GAEzBD,EAAEE,iBAEF,IAAIC,EA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el Manager/./src/js/admin/ask-for-rating.js","webpack://WooCommerce Pixel Manager/./src/js/admin/environment-check.js","webpack://WooCommerce Pixel Manager/./src/js/admin/helpers.js","webpack://WooCommerce Pixel Manager/./src/js/admin/script-blocker-warning.js","webpack://WooCommerce Pixel Manager/./src/js/admin/tabs.js","webpack://WooCommerce Pixel Manager/webpack/bootstrap","webpack://WooCommerce Pixel Manager/webpack/runtime/compat get default export","webpack://WooCommerce Pixel Manager/webpack/runtime/define property getters","webpack://WooCommerce Pixel Manager/webpack/runtime/hasOwnProperty shorthand"],"sourcesContent":["jQuery(function () {\n\n\tjQuery('.wpm-rating-success-notice').show();\n\n\t// go and rate it or already done\n\tjQuery(document).on('click', '#wpm-rate-it', function (e) {\n\t\tprocess_click(e, 'rating_done');\n\n\t\tlet win = window.open('https://wordpress.org/support/view/plugin-reviews/woocommerce-google-adwords-conversion-tracking-tag?rate=5#postform', '_blank');\n\t\twin.focus();\n\t});\n\n\tjQuery(document).on('click', '#wpm-already-did', function (e) {\n\t\tprocess_click(e, 'rating_done');\n\t});\n\n\t// maybe rate later\n\tjQuery(document).on('click', '#wpm-maybe-later', function (e) {\n\t\tprocess_click(e, 'later');\n\t});\n\n\tfunction process_click(e, set) {\n\n\t\te.preventDefault();\n\n\t\tlet data = {\n\t\t\t'action': 'wpm_dismissed_notice_handler',\n\t\t\t'set' : set\n\t\t};\n\n\t\tjQuery.post(ajaxurl, data, function (response) {\n\t\t\t// console.log('Got this from the server: ' + response);\n\t\t\t// console.log('update rating done');\n\t\t});\n\t\tjQuery('.wpm-rating-success-notice').remove();\n\t}\n});\n","jQuery(function () {\n\n\t// disable incompatible plugin warning\n\tjQuery(document).on('click', '.incompatible-plugin-error-dismissal-button', function (e) {\n\t\te.preventDefault();\n\n\t\tlet data = {\n\t\t\t'action' : 'environment_check_handler',\n\t\t\t'disable_warning': jQuery(this).data('plugin-slug'),\n\t\t};\n\n\t\twpm_send_ajax_data(data);\n\t});\n\n\n\t// disable WP Rocket JavaScript concatenation\n\tjQuery(document).on('click', '#wpm-wp-rocket-js-concatenation-disable', function (e) {\n\t\te.preventDefault();\n\n\t\tlet data = {\n\t\t\t'action': 'environment_check_handler',\n\t\t\t'set' : 'disable_wp_rocket_javascript_concatenation'\n\t\t};\n\n\t\twpm_send_ajax_data(data);\n\t});\n\n\t// dismiss WP Rocket JavaScript concatenation error\n\tjQuery(document).on('click', '#wpm-dismiss-wp-rocket-js-concatenation-error', function (e) {\n\t\te.preventDefault();\n\n\t\tlet data = {\n\t\t\t'action': 'environment_check_handler',\n\t\t\t'set' : 'dismiss_wp_rocket_javascript_concatenation_error'\n\t\t};\n\n\t\twpm_send_ajax_data(data);\n\t});\n\n\t// disable WP Rocket JavaScript concatenation\n\tjQuery(document).on('click', '#wpm-litespeed-inline-js-dom-ready-disable', function (e) {\n\t\te.preventDefault();\n\n\t\tlet data = {\n\t\t\t'action': 'environment_check_handler',\n\t\t\t'set' : 'disable_litespeed_inline_js_dom_ready'\n\t\t};\n\n\t\twpm_send_ajax_data(data);\n\t});\n\n\t// dismiss WP Rocket JavaScript concatenation error\n\tjQuery(document).on('click', '#wpm-dismiss-litespeed-inline-js-dom-ready-error', function (e) {\n\t\te.preventDefault();\n\n\t\tlet data = {\n\t\t\t'action': 'environment_check_handler',\n\t\t\t'set' : 'dismiss_litespeed_inline_js_dom_ready'\n\t\t};\n\n\t\twpm_send_ajax_data(data);\n\t});\n\n\t// dismiss PayPal standard payment gateway warning\n\tjQuery(document).on('click', '#wpm-paypal-standard-error-dismissal-button', function (e) {\n\t\te.preventDefault();\n\n\t\tlet data = {\n\t\t\t'action': 'environment_check_handler',\n\t\t\t'set' : 'dismiss_paypal_standard_warning'\n\t\t};\n\n\t\twpm_send_ajax_data(data);\n\t});\n\n});\n\nfunction wpm_send_ajax_data(data) {\n\tjQuery.post(ajaxurl, data, function (response) {\n\t\t// console.log('Got this from the server: ' + response);\n\t\t// console.log('update rating done');\n\t\tlocation.reload();\n\t});\n}\n","jQuery(function () {\n\n\t// copy debug info textarea\n\tjQuery(\"#debug-info-button\").click(function () {\n\t\tjQuery(\"#debug-info-textarea\").select();\n\t\tdocument.execCommand('copy');\n\t});\n\n\tjQuery(\"#wpm_pro_version_demo\").on('click', function () {\n\t\tjQuery(\"#submit\").click();\n\t});\n});\n","function wpm_hide_script_blocker_warning() {\n\tjQuery('#script-blocker-notice').hide();\n}\n\n// try to hide as soon as this script is loaded\n// might be too early in some cases, as the HTML is not rendered yet\nwpm_hide_script_blocker_warning();\n\n// if all other earlier attempts to hide did fail\n// run the function after entire DOM has been loaded\njQuery(function () {\n\twpm_hide_script_blocker_warning();\n});\n","jQuery(function () {\n\n\tlet sections = [];\n\tlet subsections = {};\n\n\t// hide unnecessary elements\n\tjQuery('.section').closest('tr').hide();\n\n\t// collect information on sections\n\tjQuery('.section').each(function () {\n\t\tsections.push({\n\t\t\t'slug' : jQuery(this).data('sectionSlug'),\n\t\t\t'title': jQuery(this).data('sectionTitle'),\n\t\t});\n\t});\n\n\t// collect information on subsections\n\tjQuery('.subsection').each(function () {\n\n\t\tsubsections[jQuery(this).data('sectionSlug')] = subsections[jQuery(this).data('sectionSlug')] || [];\n\n\t\tsubsections[jQuery(this).data('sectionSlug')].push({\n\t\t\t'title': jQuery(this).data('subsectionTitle'),\n\t\t\t'slug' : jQuery(this).data('subsectionSlug')\n\t\t});\n\t});\n\n\t// create tabs for sections\n\tsections.forEach(\n\t\tfunction (section) {\n\t\t\tjQuery(\".nav-tab-wrapper\").append(\"<a href=\\\"#\\\" class=\\\"nav-tab\\\" data-section-slug=\\\"\" + section['slug'] + \"\\\">\" + section['title'] + \"</a>\");\n\t\t});\n\n\t// create tabs for each subsections\n\tjQuery(\".nav-tab-wrapper\").after(createSubtabUlHtml(subsections));\n\n\t// create on-click events on section tabs that toggle the views\n\tjQuery(\".nav-tab-wrapper a\").on('click', function (e) {\n\t\te.preventDefault();\n\n\t\t// show clicked tab as active\n\t\tjQuery(this).addClass(\"nav-tab-active\").siblings().removeClass(\"nav-tab-active\");\n\n\t\t// toggle the sections visible / invisible based on clicked tab\n\n\t\tlet sectionSlug = jQuery(this).data('section-slug')\n\t\ttoggleSections(sectionSlug, sections);\n\n\t\t// if subsection exists, click on first subsection\n\t\tif (sectionSlug in subsections) {\n\t\t\tjQuery(\"ul[data-section-slug=\" + sectionSlug + \"]\").children(':first').trigger('click')\n\t\t}\n\t});\n\n\t// create on-click events on subsection tabs that toggle the views\n\tjQuery(\".subnav-li\").on('click', function (e) {\n\t\te.preventDefault();\n\n\t\t// jQuery(this).hide();\n\t\tjQuery(this)\n\t\t\t.addClass('subnav-li-active').removeClass('subnav-li-inactive')\n\t\t\t.siblings()\n\t\t\t.addClass('subnav-li-inactive').removeClass('subnav-li-active');\n\n\t\ttoggleSubsection(jQuery(this).parent().data('section-slug'), jQuery(this).data('subsection-slug'));\n\t});\n\n\t// if someone access a plugin tab by deep link, open the right tab\n\t// or fallback to default (first tab)\n\n\t// if deeplink is being opened open the according section and subsection\n\tif (getSectionParams()) {\n\n\t\tlet sectionParams = getSectionParams();\n\n\t\tjQuery(\"a[data-section-slug=\" + sectionParams['section'] + \"]\").trigger('click');\n\n\t\tif (sectionParams['subsection'] !== false) {\n\t\t\tjQuery(\"ul[data-section-slug=\" + sectionParams['section'] + \"]\").children(\"[data-subsection-slug=\" + sectionParams['subsection'] + \"]\").trigger('click')\n\t\t}\n\t} else {\n\t\tjQuery(\"a[data-section-slug=\" + sections[0]['slug'] + \"]\").trigger('click');\n\t}\n});\n\n// creates the html with all subsection elements\nfunction createSubtabUlHtml(subsections) {\n\n\tlet subsectionsKeys = Object.keys(subsections);\n\n\tlet html = '';\n\n\tsubsectionsKeys.forEach(function (subsectionKey) {\n\t\thtml += '<ul class=\"subnav-tabs\" data-section-slug=\"' + subsectionKey + '\">';\n\n\t\tlet subtabs = subsections[subsectionKey];\n\n\t\tsubtabs.forEach(function (subtab) {\n\t\t\thtml += '<li class=\"subnav-li subnav-li-inactive\" data-subsection-slug=\"' + subtab['slug'] + '\">' + subtab['title'] + '</li>'\n\t\t});\n\n\t\thtml += '</ul>';\n\t});\n\n\treturn html;\n}\n\n// if section (and subsection) URL parameters are set,\n// return them, otherwise return false\nfunction getSectionParams() {\n\tconst queryString = window.location.search;\n\tconst urlParams = new URLSearchParams(queryString);\n\n\tif (urlParams.get('section')) {\n\t\treturn {\n\t\t\t'section' : urlParams.get('section'),\n\t\t\t'subsection': urlParams.get('subsection')\n\t\t};\n\t} else {\n\t\treturn false;\n\t}\n}\n\n// toggles the sections\nfunction toggleSections(sectionSlug, sections) {\n\n\tjQuery(\"#wpm_settings_form > h2\").nextUntil(\".submit\").andSelf().hide();\n\tjQuery(\".subnav-tabs\").hide();\n\tjQuery(\".subnav-tabs[data-section-slug=\" + sectionSlug + \"]\").show();\n\n\tlet sectionPos = sections.findIndex((arrayElement) => arrayElement['slug'] === sectionSlug);\n\n\tjQuery(\"div[data-section-slug=\" + sectionSlug + \"]\").closest(\"table\").prevAll(\"h2:first\").next().nextUntil(\"h2, .submit\").andSelf().show();\n\n\t// set the URL with the active tab parameter\n\tsetUrl(sections[sectionPos]['slug']);\n}\n\nfunction toggleSubsection(sectionSlug, subsectionSlug) {\n\n\tjQuery(\"#wpm_settings_form > h2\").nextUntil(\".submit\").andSelf().hide();\n\tjQuery(\"[data-section-slug=\" + sectionSlug + \"][data-subsection-slug=\" + subsectionSlug + \"]\").closest(\"tr\").siblings().andSelf().hide();\n\n\tjQuery(\"[data-section-slug=\" + sectionSlug + \"][data-subsection-slug=\" + subsectionSlug + \"]\").closest(\"table\").show();\n\tjQuery(\"[data-section-slug=\" + sectionSlug + \"][data-subsection-slug=\" + subsectionSlug + \"]\").closest(\"tr\").nextUntil(jQuery(\"[data-section-slug=\" + sectionSlug + \"][data-subsection-slug]\").closest('tr')).show();\n\n\t// set the URL with the active tab parameter\n\tsetUrl(sectionSlug, subsectionSlug);\n}\n\n// sets the new URL parameters\nfunction setUrl(sectionSlug, subsectionSlug = \"\") {\n\n\tconst queryString = window.location.search;\n\tconst urlParams = new URLSearchParams(queryString);\n\n\turlParams.delete('section');\n\turlParams.delete('subsection');\n\n\tlet newParams = \"section=\" + sectionSlug;\n\tnewParams += subsectionSlug ? \"&subsection=\" + subsectionSlug : \"\";\n\n\thistory.pushState('', 'wpm' + sectionSlug, document.location.pathname + \"?page=wpm&\" + newParams);\n\n\t// make WP remember which was the selected tab on a save and return to the same tab after saving\n\tjQuery('input[name =\"_wp_http_referer\"]').val(getAdminPath() + \"?page=wpm&\" + newParams + \"&settings-updated=true\");\n}\n\nfunction getAdminPath() {\n\tlet url = new URL(jQuery('#wp-admin-canonical').attr('href'));\n\treturn url.pathname;\n}\n","// The module cache\nvar __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tvar cachedModule = __webpack_module_cache__[moduleId];\n\tif (cachedModule !== undefined) {\n\t\treturn cachedModule.exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\t// no module.id needed\n\t\t// no module.loaded needed\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId](module, module.exports, __webpack_require__);\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n","// getDefaultExport function for compatibility with non-harmony modules\n__webpack_require__.n = (module) => {\n\tvar getter = module && module.__esModule ?\n\t\t() => (module['default']) :\n\t\t() => (module);\n\t__webpack_require__.d(getter, { a: getter });\n\treturn getter;\n};","// define getter functions for harmony exports\n__webpack_require__.d = (exports, definition) => {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))"],"names":["jQuery","process_click","e","set","preventDefault","data","post","ajaxurl","response","remove","show","document","on","window","open","focus","wpm_send_ajax_data","location","reload","this","click","select","execCommand","wpm_hide_script_blocker_warning","hide","getSectionParams","queryString","search","urlParams","URLSearchParams","get","setUrl","sectionSlug","subsectionSlug","delete","newParams","history","pushState","pathname","val","getAdminPath","URL","attr","sections","subsections","closest","each","push","forEach","section","append","after","subsectionsKeys","Object","keys","html","subsectionKey","subtab","createSubtabUlHtml","addClass","siblings","removeClass","nextUntil","andSelf","sectionPos","findIndex","arrayElement","prevAll","next","toggleSections","children","trigger","parent","sectionParams","__webpack_module_cache__","__webpack_require__","moduleId","cachedModule","undefined","exports","module","__webpack_modules__","n","getter","__esModule","d","a","definition","key","o","defineProperty","enumerable","obj","prop","prototype","hasOwnProperty","call"],"sourceRoot":""}
|
js/public/facebook.js
ADDED
@@ -0,0 +1,307 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/**
|
2 |
+
* Add functions for Facebook
|
3 |
+
* */
|
4 |
+
|
5 |
+
(function (wpm, $, undefined) {
|
6 |
+
|
7 |
+
let fBUserData
|
8 |
+
|
9 |
+
wpm.loadFacebookPixel = function () {
|
10 |
+
|
11 |
+
try {
|
12 |
+
if (wpmDataLayer?.pixels?.facebook?.pixel_id) {
|
13 |
+
|
14 |
+
wpmDataLayer.pixels.facebook.loaded = true
|
15 |
+
|
16 |
+
// @formatter:off
|
17 |
+
!function(f,b,e,v,n,t,s)
|
18 |
+
{if(f.fbq)return;n=f.fbq=function(){n.callMethod?
|
19 |
+
n.callMethod.apply(n,arguments):n.queue.push(arguments)};
|
20 |
+
if(!f._fbq)f._fbq=n;n.push=n;n.loaded=!0;n.version='2.0';
|
21 |
+
n.queue=[];t=b.createElement(e);t.async=!0;
|
22 |
+
t.src=v;s=b.getElementsByTagName(e)[0];
|
23 |
+
s.parentNode.insertBefore(t,s)}(window, document,'script',
|
24 |
+
'https://connect.facebook.net/en_US/fbevents.js');
|
25 |
+
// @formatter:on
|
26 |
+
|
27 |
+
fbq("init", wpmDataLayer.pixels.facebook.pixel_id)
|
28 |
+
fbq("track", "PageView")
|
29 |
+
}
|
30 |
+
} catch (e) {
|
31 |
+
console.error(e)
|
32 |
+
}
|
33 |
+
}
|
34 |
+
|
35 |
+
wpm.getRandomEventId = function () {
|
36 |
+
return (Math.random() + 1).toString(36).substring(2)
|
37 |
+
}
|
38 |
+
|
39 |
+
wpm.getFbUserData = function () {
|
40 |
+
// We need the first one for InitiateCheckout
|
41 |
+
// where getting the user_data from the browser is too slow
|
42 |
+
// using wpm.getCookie(), so we cache the user_data earlier.
|
43 |
+
// And we need the second one because the ViewContent hit happens too fast
|
44 |
+
// after adding a variation to the cart because the function to cache
|
45 |
+
// the user_data is too slow. But we can get the user_data using wpm.getCookie()
|
46 |
+
// because we don't move away from the page and can wait for the browser
|
47 |
+
// to get it.
|
48 |
+
if (fBUserData) {
|
49 |
+
return fBUserData
|
50 |
+
} else {
|
51 |
+
return wpm.getFbUserDataFromBrowser()
|
52 |
+
}
|
53 |
+
}
|
54 |
+
|
55 |
+
wpm.setFbUserData = function () {
|
56 |
+
fBUserData = wpm.getFbUserDataFromBrowser()
|
57 |
+
}
|
58 |
+
|
59 |
+
wpm.getFbUserDataFromBrowser = function () {
|
60 |
+
return {
|
61 |
+
fbp : wpm.getCookie("_fbp"),
|
62 |
+
fbc : wpm.getCookie("_fbc"),
|
63 |
+
client_user_agent: navigator.userAgent,
|
64 |
+
}
|
65 |
+
}
|
66 |
+
|
67 |
+
wpm.fbViewContent = function (product) {
|
68 |
+
|
69 |
+
try {
|
70 |
+
if (!wpmDataLayer?.pixels?.facebook?.loaded) return
|
71 |
+
|
72 |
+
let eventId = wpm.getRandomEventId()
|
73 |
+
|
74 |
+
fbq("track", "ViewContent", {
|
75 |
+
content_type: "product",
|
76 |
+
content_name: product.name,
|
77 |
+
// content_category: product.category,
|
78 |
+
content_ids: product.dyn_r_ids[wpmDataLayer.pixels.facebook.dynamic_remarketing.id_type],
|
79 |
+
currency : wpmDataLayer.shop.currency,
|
80 |
+
value : product.price,
|
81 |
+
}, {
|
82 |
+
eventID: eventId,
|
83 |
+
})
|
84 |
+
|
85 |
+
product["currency"] = wpmDataLayer.shop.currency
|
86 |
+
|
87 |
+
jQuery(document).trigger("wpmFbCapiEvent", {
|
88 |
+
event_name : "ViewContent",
|
89 |
+
event_id : eventId,
|
90 |
+
user_data : wpm.getFbUserData(),
|
91 |
+
product_data : product,
|
92 |
+
product_id : product.dyn_r_ids[wpmDataLayer.pixels.facebook.dynamic_remarketing.id_type],
|
93 |
+
event_source_url: window.location.href,
|
94 |
+
})
|
95 |
+
} catch (e) {
|
96 |
+
console.error(e)
|
97 |
+
}
|
98 |
+
}
|
99 |
+
|
100 |
+
wpm.facebookContentIds = function () {
|
101 |
+
let prodIds = []
|
102 |
+
|
103 |
+
for (const [key, item] of Object.entries(wpmDataLayer.order.items)) {
|
104 |
+
|
105 |
+
if (wpmDataLayer?.general?.variationsOutput && 0 !== item.variation_id) {
|
106 |
+
prodIds.push(String(wpmDataLayer.products[item.variation_id].dyn_r_ids[wpmDataLayer.pixels.facebook.dynamic_remarketing.id_type]))
|
107 |
+
} else {
|
108 |
+
prodIds.push(String(wpmDataLayer.products[item.id].dyn_r_ids[wpmDataLayer.pixels.facebook.dynamic_remarketing.id_type]))
|
109 |
+
}
|
110 |
+
}
|
111 |
+
|
112 |
+
return prodIds
|
113 |
+
}
|
114 |
+
|
115 |
+
}(window.wpm = window.wpm || {}, jQuery));
|
116 |
+
|
117 |
+
|
118 |
+
/**
|
119 |
+
* Execute as soon as possible
|
120 |
+
* */
|
121 |
+
|
122 |
+
(function () {
|
123 |
+
|
124 |
+
jQuery(document).on("wpmLoadPixels", function () {
|
125 |
+
|
126 |
+
if (wpm.canIFire("ads", "facebook-ads") && !wpmDataLayer?.pixels?.facebook?.loaded) wpm.loadFacebookPixel()
|
127 |
+
|
128 |
+
})
|
129 |
+
|
130 |
+
})()
|
131 |
+
|
132 |
+
|
133 |
+
/**
|
134 |
+
* All event listeners
|
135 |
+
* */
|
136 |
+
|
137 |
+
// AddToCart event
|
138 |
+
jQuery(document).on("wpmAddToCart", function (event, product) {
|
139 |
+
|
140 |
+
try {
|
141 |
+
if (!wpmDataLayer?.pixels?.facebook?.loaded) return
|
142 |
+
|
143 |
+
let eventId = wpm.getRandomEventId()
|
144 |
+
|
145 |
+
// console.log('eventId: ' + eventId);
|
146 |
+
|
147 |
+
fbq("track", "AddToCart", {
|
148 |
+
content_type: "product",
|
149 |
+
content_name: product.name,
|
150 |
+
content_ids : product.dyn_r_ids[wpmDataLayer.pixels.facebook.dynamic_remarketing.id_type],
|
151 |
+
value : parseFloat(product.quantity * product.price),
|
152 |
+
currency : product.currency,
|
153 |
+
}, {
|
154 |
+
eventID: eventId,
|
155 |
+
})
|
156 |
+
|
157 |
+
|
158 |
+
product["currency"] = wpmDataLayer.shop.currency
|
159 |
+
|
160 |
+
jQuery(document).trigger("wpmFbCapiEvent", {
|
161 |
+
event_name : "AddToCart",
|
162 |
+
event_id : eventId,
|
163 |
+
user_data : wpm.getFbUserData(),
|
164 |
+
product_data : product,
|
165 |
+
product_id : product.dyn_r_ids[wpmDataLayer.pixels.facebook.dynamic_remarketing.id_type],
|
166 |
+
event_source_url: window.location.href,
|
167 |
+
})
|
168 |
+
} catch (e) {
|
169 |
+
console.error(e)
|
170 |
+
}
|
171 |
+
})
|
172 |
+
|
173 |
+
// InitiateCheckout event
|
174 |
+
jQuery(document).on("wpmBeginCheckout", function (event) {
|
175 |
+
|
176 |
+
try {
|
177 |
+
// console.log('firing facebook ads InitiateCheckout event');
|
178 |
+
|
179 |
+
if (!wpmDataLayer?.pixels?.facebook?.loaded) return
|
180 |
+
|
181 |
+
let eventId = wpm.getRandomEventId()
|
182 |
+
|
183 |
+
fbq("track", "InitiateCheckout", {}, {
|
184 |
+
eventID: eventId,
|
185 |
+
})
|
186 |
+
|
187 |
+
jQuery(document).trigger("wpmFbCapiEvent", {
|
188 |
+
event_name : "InitiateCheckout",
|
189 |
+
event_id : eventId,
|
190 |
+
user_data : wpm.getFbUserData(),
|
191 |
+
event_source_url: window.location.href,
|
192 |
+
})
|
193 |
+
} catch (e) {
|
194 |
+
console.error(e)
|
195 |
+
}
|
196 |
+
})
|
197 |
+
|
198 |
+
// AddToWishlist event
|
199 |
+
jQuery(document).on("wpmAddToWishlist", function (event, product) {
|
200 |
+
|
201 |
+
try {
|
202 |
+
// console.log('firing facebook ads AddToWishlist event');
|
203 |
+
// console.log(product);
|
204 |
+
|
205 |
+
if (!wpmDataLayer?.pixels?.facebook?.loaded) return
|
206 |
+
|
207 |
+
let eventId = wpm.getRandomEventId()
|
208 |
+
|
209 |
+
fbq("track", "AddToWishlist", {
|
210 |
+
content_type: "product",
|
211 |
+
content_name: product.name,
|
212 |
+
content_ids : product.dyn_r_ids[wpmDataLayer.pixels.facebook.dynamic_remarketing.id_type],
|
213 |
+
value : parseFloat(product.quantity * product.price),
|
214 |
+
currency : product.currency,
|
215 |
+
}, {
|
216 |
+
eventID: eventId,
|
217 |
+
})
|
218 |
+
|
219 |
+
|
220 |
+
product["currency"] = wpmDataLayer.shop.currency
|
221 |
+
|
222 |
+
jQuery(document).trigger("wpmFbCapiEvent", {
|
223 |
+
event_name : "AddToWishlist",
|
224 |
+
event_id : eventId,
|
225 |
+
user_data : wpm.getFbUserData(),
|
226 |
+
product_data : product,
|
227 |
+
product_id : product.dyn_r_ids[wpmDataLayer.pixels.facebook.dynamic_remarketing.id_type],
|
228 |
+
event_source_url: window.location.href,
|
229 |
+
})
|
230 |
+
} catch (e) {
|
231 |
+
console.error(e)
|
232 |
+
}
|
233 |
+
})
|
234 |
+
|
235 |
+
// ViewContent event
|
236 |
+
jQuery(document).on("wpmViewItem", function (event, product) {
|
237 |
+
|
238 |
+
try {
|
239 |
+
// console.log('firing facebook ads ViewContent event');
|
240 |
+
// console.log(product);
|
241 |
+
|
242 |
+
if (!wpmDataLayer?.pixels?.facebook?.loaded) return
|
243 |
+
|
244 |
+
wpm.fbViewContent(product)
|
245 |
+
} catch (e) {
|
246 |
+
console.error(e)
|
247 |
+
}
|
248 |
+
})
|
249 |
+
|
250 |
+
// view search event
|
251 |
+
jQuery(document).on("wpmSearch", function () {
|
252 |
+
|
253 |
+
try {
|
254 |
+
if (!wpmDataLayer?.pixels?.facebook?.loaded) return
|
255 |
+
|
256 |
+
let eventId = wpm.getRandomEventId()
|
257 |
+
|
258 |
+
fbq("track", "Search", {}, {
|
259 |
+
eventID: eventId,
|
260 |
+
})
|
261 |
+
|
262 |
+
jQuery(document).trigger("wpmFbCapiEvent", {
|
263 |
+
event_name : "Search",
|
264 |
+
event_id : eventId,
|
265 |
+
user_data : wpm.getFbUserData(),
|
266 |
+
event_source_url: window.location.href,
|
267 |
+
})
|
268 |
+
} catch (e) {
|
269 |
+
console.error(e)
|
270 |
+
}
|
271 |
+
})
|
272 |
+
|
273 |
+
// load always event
|
274 |
+
jQuery(document).on("wpmLoadAlways", function () {
|
275 |
+
|
276 |
+
try {
|
277 |
+
if (!wpmDataLayer?.pixels?.facebook?.loaded) return
|
278 |
+
|
279 |
+
wpm.setFbUserData()
|
280 |
+
} catch (e) {
|
281 |
+
console.error(e)
|
282 |
+
}
|
283 |
+
})
|
284 |
+
|
285 |
+
// view order received page event
|
286 |
+
// https://developers.pinterest.com/docs/tag/conversion/
|
287 |
+
jQuery(document).on("wpmOrderReceivedPage", function () {
|
288 |
+
|
289 |
+
try {
|
290 |
+
if (!wpmDataLayer?.pixels?.facebook?.loaded) return
|
291 |
+
|
292 |
+
fbq("track", "Purchase",
|
293 |
+
{
|
294 |
+
content_type: "product",
|
295 |
+
value : wpmDataLayer.order.value_filtered,
|
296 |
+
currency : wpmDataLayer.order.currency,
|
297 |
+
content_ids : wpm.facebookContentIds(),
|
298 |
+
},
|
299 |
+
{eventID: wpmDataLayer.order.id},
|
300 |
+
)
|
301 |
+
|
302 |
+
|
303 |
+
// console.log(wpm.facebookContentIds())
|
304 |
+
} catch (e) {
|
305 |
+
console.error(e)
|
306 |
+
}
|
307 |
+
})
|
js/public/google-ads.js
ADDED
@@ -0,0 +1,305 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/**
|
2 |
+
* Add functions for Google Ads
|
3 |
+
* */
|
4 |
+
|
5 |
+
(function (wpm, $, undefined) {
|
6 |
+
|
7 |
+
let conversionIdentifiers = []
|
8 |
+
|
9 |
+
wpm.getGoogleAdsConversionIdentifiersWithLabel = function () {
|
10 |
+
for (const [key, item] of Object.entries(wpmDataLayer.pixels.google.ads.conversionIds)) {
|
11 |
+
conversionIdentifiers.push(key + "/" + item)
|
12 |
+
}
|
13 |
+
return conversionIdentifiers
|
14 |
+
}
|
15 |
+
|
16 |
+
wpm.getGoogleAdsConversionIdentifiers = function () {
|
17 |
+
|
18 |
+
let conversionIdentifiers = []
|
19 |
+
for (const [key, item] of Object.entries(wpmDataLayer.pixels.google.ads.conversionIds)) {
|
20 |
+
conversionIdentifiers.push(key)
|
21 |
+
}
|
22 |
+
|
23 |
+
return conversionIdentifiers
|
24 |
+
}
|
25 |
+
|
26 |
+
wpm.getGoogleAdsRegularOrderItems = function () {
|
27 |
+
// "id" : "gla_34",
|
28 |
+
// "quantity": 1,
|
29 |
+
// "price" : 45
|
30 |
+
|
31 |
+
let orderItems = []
|
32 |
+
|
33 |
+
for (const [key, item] of Object.entries(wpmDataLayer.order.items)) {
|
34 |
+
|
35 |
+
let orderItem
|
36 |
+
|
37 |
+
orderItem = {
|
38 |
+
quantity: item.quantity,
|
39 |
+
price : item.price,
|
40 |
+
}
|
41 |
+
|
42 |
+
if (wpmDataLayer?.general?.variationsOutput && 0 !== item.variation_id) {
|
43 |
+
|
44 |
+
orderItem.id = String(wpmDataLayer.products[item.variation_id].dyn_r_ids[wpmDataLayer.pixels.google.ads.dynamic_remarketing.id_type])
|
45 |
+
orderItems.push(orderItem)
|
46 |
+
} else {
|
47 |
+
|
48 |
+
orderItem.id = String(wpmDataLayer.products[item.id].dyn_r_ids[wpmDataLayer.pixels.google.ads.dynamic_remarketing.id_type])
|
49 |
+
orderItems.push(orderItem)
|
50 |
+
}
|
51 |
+
}
|
52 |
+
|
53 |
+
return orderItems
|
54 |
+
}
|
55 |
+
|
56 |
+
wpm.getGoogleAdsDynamicRemarketingOrderItems = function () {
|
57 |
+
// "id" : "gla_34",
|
58 |
+
// "quantity" : 1,
|
59 |
+
// "price" : 45,
|
60 |
+
// "google_business_vertical": "retail"
|
61 |
+
|
62 |
+
let orderItems = []
|
63 |
+
|
64 |
+
for (const [key, item] of Object.entries(wpmDataLayer.order.items)) {
|
65 |
+
|
66 |
+
let orderItem
|
67 |
+
|
68 |
+
orderItem = {
|
69 |
+
quantity : item.quantity,
|
70 |
+
price : item.price,
|
71 |
+
google_business_vertical: wpmDataLayer.pixels.google.ads.google_business_vertical,
|
72 |
+
}
|
73 |
+
|
74 |
+
if (wpmDataLayer?.general?.variationsOutput && 0 !== item.variation_id) {
|
75 |
+
|
76 |
+
orderItem.id = String(wpmDataLayer.products[item.variation_id].dyn_r_ids[wpmDataLayer.pixels.google.ads.dynamic_remarketing.id_type])
|
77 |
+
orderItems.push(orderItem)
|
78 |
+
} else {
|
79 |
+
|
80 |
+
orderItem.id = String(wpmDataLayer.products[item.id].dyn_r_ids[wpmDataLayer.pixels.google.ads.dynamic_remarketing.id_type])
|
81 |
+
orderItems.push(orderItem)
|
82 |
+
}
|
83 |
+
}
|
84 |
+
|
85 |
+
return orderItems
|
86 |
+
}
|
87 |
+
|
88 |
+
}(window.wpm = window.wpm || {}, jQuery))
|
89 |
+
|
90 |
+
|
91 |
+
/**
|
92 |
+
* All event listeners
|
93 |
+
* */
|
94 |
+
|
95 |
+
// view_item_list event
|
96 |
+
jQuery(document).on("wpmViewItemList", function (event, product) {
|
97 |
+
|
98 |
+
try {
|
99 |
+
if(jQuery.isEmptyObject(wpmDataLayer?.pixels?.google?.ads?.conversionIds)) return
|
100 |
+
if (!wpmDataLayer?.pixels?.google?.ads?.dynamic_remarketing?.status) return
|
101 |
+
if (!wpm.googleConfigConditionsMet("ads")) return
|
102 |
+
|
103 |
+
|
104 |
+
if (
|
105 |
+
wpmDataLayer?.general?.variationsOutput &&
|
106 |
+
product.isVariable &&
|
107 |
+
wpmDataLayer.pixels.google.ads.dynamic_remarketing.send_events_with_parent_ids === false
|
108 |
+
) return
|
109 |
+
|
110 |
+
// try to prevent that WC sends cached hits to Google
|
111 |
+
if (!product) return
|
112 |
+
|
113 |
+
wpm.gtagLoaded().then(function () {
|
114 |
+
gtag("event", "view_item_list", {
|
115 |
+
send_to: wpm.getGoogleAdsConversionIdentifiers(),
|
116 |
+
items : [{
|
117 |
+
id : product.dyn_r_ids[wpmDataLayer.pixels.google.ads.dynamic_remarketing.id_type],
|
118 |
+
google_business_vertical: wpmDataLayer.pixels.google.ads.google_business_vertical,
|
119 |
+
}],
|
120 |
+
})
|
121 |
+
})
|
122 |
+
} catch (e) {
|
123 |
+
console.error(e)
|
124 |
+
}
|
125 |
+
})
|
126 |
+
|
127 |
+
// add_to_cart event
|
128 |
+
jQuery(document).on("wpmAddToCart", function (event, product) {
|
129 |
+
|
130 |
+
try {
|
131 |
+
if(jQuery.isEmptyObject(wpmDataLayer?.pixels?.google?.ads?.conversionIds)) return
|
132 |
+
if (!wpmDataLayer?.pixels?.google?.ads?.dynamic_remarketing?.status) return
|
133 |
+
if (!wpm.googleConfigConditionsMet("ads")) return
|
134 |
+
|
135 |
+
wpm.gtagLoaded().then(function () {
|
136 |
+
gtag("event", "add_to_cart", {
|
137 |
+
send_to: wpm.getGoogleAdsConversionIdentifiers(),
|
138 |
+
value : product.quantity * product.price,
|
139 |
+
items : [{
|
140 |
+
id : product.dyn_r_ids[wpmDataLayer.pixels.google.ads.dynamic_remarketing.id_type],
|
141 |
+
quantity : product.quantity,
|
142 |
+
price : product.price,
|
143 |
+
google_business_vertical: wpmDataLayer.pixels.google.ads.google_business_vertical,
|
144 |
+
}],
|
145 |
+
})
|
146 |
+
})
|
147 |
+
} catch (e) {
|
148 |
+
console.error(e)
|
149 |
+
}
|
150 |
+
})
|
151 |
+
|
152 |
+
// view_item event
|
153 |
+
jQuery(document).on("wpmViewItem", function (event, product) {
|
154 |
+
|
155 |
+
try {
|
156 |
+
if(jQuery.isEmptyObject(wpmDataLayer?.pixels?.google?.ads?.conversionIds)) return
|
157 |
+
if (!wpmDataLayer?.pixels?.google?.ads?.dynamic_remarketing?.status) return
|
158 |
+
if (!wpm.googleConfigConditionsMet("ads")) return
|
159 |
+
|
160 |
+
|
161 |
+
wpm.gtagLoaded().then(function () {
|
162 |
+
gtag("event", "view_item", {
|
163 |
+
send_to: wpm.getGoogleAdsConversionIdentifiers(),
|
164 |
+
value : (product.quantity ? product.quantity : 1) * product.price,
|
165 |
+
items : [{
|
166 |
+
id : product.dyn_r_ids[wpmDataLayer.pixels.google.ads.dynamic_remarketing.id_type],
|
167 |
+
quantity : (product.quantity ? product.quantity : 1),
|
168 |
+
price : product.price,
|
169 |
+
google_business_vertical: wpmDataLayer.pixels.google.ads.google_business_vertical,
|
170 |
+
}],
|
171 |
+
})
|
172 |
+
})
|
173 |
+
} catch (e) {
|
174 |
+
console.error(e)
|
175 |
+
}
|
176 |
+
})
|
177 |
+
|
178 |
+
|
179 |
+
// view search event
|
180 |
+
jQuery(document).on("wpmSearch", function () {
|
181 |
+
|
182 |
+
try {
|
183 |
+
if(jQuery.isEmptyObject(wpmDataLayer?.pixels?.google?.ads?.conversionIds)) return
|
184 |
+
if (!wpmDataLayer?.pixels?.google?.ads?.dynamic_remarketing?.status) return
|
185 |
+
if (!wpm.googleConfigConditionsMet("ads")) return
|
186 |
+
|
187 |
+
|
188 |
+
let products = []
|
189 |
+
|
190 |
+
for (const [key, product] of Object.entries(wpmDataLayer.products)) {
|
191 |
+
|
192 |
+
if (
|
193 |
+
wpmDataLayer?.general?.variationsOutput &&
|
194 |
+
product.isVariable &&
|
195 |
+
wpmDataLayer.pixels.google.ads.dynamic_remarketing.send_events_with_parent_ids === false
|
196 |
+
) return
|
197 |
+
|
198 |
+
products.push({
|
199 |
+
id : product.dyn_r_ids[wpmDataLayer.pixels.google.ads.dynamic_remarketing.id_type],
|
200 |
+
google_business_vertical: wpmDataLayer.pixels.google.ads.google_business_vertical,
|
201 |
+
})
|
202 |
+
}
|
203 |
+
|
204 |
+
// console.log(products);
|
205 |
+
|
206 |
+
wpm.gtagLoaded().then(function () {
|
207 |
+
gtag("event", "view_search_results", {
|
208 |
+
send_to: wpm.getGoogleAdsConversionIdentifiers(),
|
209 |
+
// value : 1 * product.price,
|
210 |
+
items: products,
|
211 |
+
})
|
212 |
+
})
|
213 |
+
} catch (e) {
|
214 |
+
console.error(e)
|
215 |
+
}
|
216 |
+
})
|
217 |
+
|
218 |
+
|
219 |
+
// view order received page event
|
220 |
+
// TODO distinguish with or without cart data active
|
221 |
+
jQuery(document).on("wpmOrderReceivedPage", function () {
|
222 |
+
|
223 |
+
try {
|
224 |
+
if(jQuery.isEmptyObject(wpmDataLayer?.pixels?.google?.ads?.conversionIds)) return
|
225 |
+
if (!wpmDataLayer?.pixels?.google?.ads?.dynamic_remarketing?.status) return
|
226 |
+
if (!wpm.googleConfigConditionsMet("ads")) return
|
227 |
+
|
228 |
+
wpm.gtagLoaded().then(function () {
|
229 |
+
gtag("event", "purchase", {
|
230 |
+
send_to: wpm.getGoogleAdsConversionIdentifiers(),
|
231 |
+
value : wpmDataLayer.order.value_filtered,
|
232 |
+
items : wpm.getGoogleAdsDynamicRemarketingOrderItems(),
|
233 |
+
})
|
234 |
+
})
|
235 |
+
|
236 |
+
// console.log(wpm.getGoogleAdsDynamicRemarketingOrderItems())
|
237 |
+
} catch (e) {
|
238 |
+
console.error(e)
|
239 |
+
}
|
240 |
+
})
|
241 |
+
|
242 |
+
// user log in event
|
243 |
+
jQuery(document).on("wpmLogin", function () {
|
244 |
+
|
245 |
+
try {
|
246 |
+
if(jQuery.isEmptyObject(wpmDataLayer?.pixels?.google?.ads?.conversionIds)) return
|
247 |
+
if (!wpmDataLayer?.pixels?.google?.ads?.dynamic_remarketing?.status) return
|
248 |
+
if (!wpm.googleConfigConditionsMet("ads")) return
|
249 |
+
|
250 |
+
|
251 |
+
wpm.gtagLoaded().then(function () {
|
252 |
+
gtag("event", "login", {
|
253 |
+
send_to: wpm.getGoogleAdsConversionIdentifiers(),
|
254 |
+
})
|
255 |
+
})
|
256 |
+
} catch (e) {
|
257 |
+
console.error(e)
|
258 |
+
}
|
259 |
+
})
|
260 |
+
|
261 |
+
// view order received page event
|
262 |
+
// new_customer parameter: https://support.google.com/google-ads/answer/9917012
|
263 |
+
jQuery(document).on("wpmOrderReceivedPage", function () {
|
264 |
+
|
265 |
+
try {
|
266 |
+
if(jQuery.isEmptyObject(wpmDataLayer?.pixels?.google?.ads?.conversionIds)) return
|
267 |
+
if (!wpm.googleConfigConditionsMet("ads")) return
|
268 |
+
|
269 |
+
let data_basic = {}
|
270 |
+
let data_with_cart = {}
|
271 |
+
|
272 |
+
data_basic = {
|
273 |
+
send_to : wpm.getGoogleAdsConversionIdentifiersWithLabel(),
|
274 |
+
transaction_id: wpmDataLayer.order.number,
|
275 |
+
value : wpmDataLayer.order.value_filtered,
|
276 |
+
currency : wpmDataLayer.order.currency,
|
277 |
+
new_customer : wpmDataLayer.order.new_customer,
|
278 |
+
}
|
279 |
+
|
280 |
+
if (wpmDataLayer?.order?.aw_merchant_id) {
|
281 |
+
data_with_cart = {
|
282 |
+
discount : wpmDataLayer.order.discount,
|
283 |
+
aw_merchant_id : wpmDataLayer.order.aw_merchant_id,
|
284 |
+
aw_feed_country : wpmDataLayer.order.aw_feed_country,
|
285 |
+
aw_feed_language: wpmDataLayer.order.aw_feed_language,
|
286 |
+
items : wpm.getGoogleAdsRegularOrderItems(),
|
287 |
+
}
|
288 |
+
}
|
289 |
+
|
290 |
+
wpm.gtagLoaded().then(function () {
|
291 |
+
gtag("event", "conversion", {...data_basic, ...data_with_cart})
|
292 |
+
})
|
293 |
+
|
294 |
+
// console.log({...data_basic,...data_with_cart})
|
295 |
+
|
296 |
+
// console.log(wpm.getGoogleAdsOrderItems())
|
297 |
+
} catch (e) {
|
298 |
+
console.error(e)
|
299 |
+
}
|
300 |
+
})
|
301 |
+
|
302 |
+
|
303 |
+
|
304 |
+
|
305 |
+
|
js/public/google-ga-4.js
ADDED
@@ -0,0 +1,83 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/**
|
2 |
+
* Add functions for Google Analytics 4
|
3 |
+
* */
|
4 |
+
|
5 |
+
(function (wpm, $, undefined) {
|
6 |
+
|
7 |
+
wpm.getGA4OrderItems = function () {
|
8 |
+
|
9 |
+
// "item_id" : "34",
|
10 |
+
// "item_name" : "Hoodie",
|
11 |
+
// "quantity" : 1,
|
12 |
+
// "item_brand" : "",
|
13 |
+
// "item_variant" : "Color: blue | Logo: yes",
|
14 |
+
// "price" : 45,
|
15 |
+
// "currency" : "CHF",
|
16 |
+
// "item_category": "Hoodies"
|
17 |
+
|
18 |
+
|
19 |
+
let orderItems = []
|
20 |
+
|
21 |
+
for (const [key, item] of Object.entries(wpmDataLayer.order.items)) {
|
22 |
+
|
23 |
+
let orderItem
|
24 |
+
|
25 |
+
orderItem = {
|
26 |
+
quantity : item.quantity,
|
27 |
+
price : item.price,
|
28 |
+
item_name : item.name,
|
29 |
+
currency : wpmDataLayer.order.currency,
|
30 |
+
item_category: wpmDataLayer.products[item.id].category.join("/"),
|
31 |
+
}
|
32 |
+
|
33 |
+
if (wpmDataLayer?.general?.variationsOutput && 0 !== item.variation_id) {
|
34 |
+
|
35 |
+
orderItem.item_id = String(wpmDataLayer.products[item.variation_id].dyn_r_ids[wpmDataLayer.pixels.google.analytics.id_type])
|
36 |
+
orderItem.item_variant = wpmDataLayer.products[item.variation_id].variant_name
|
37 |
+
orderItem.item_brand = wpmDataLayer.products[item.variation_id].brand
|
38 |
+
orderItems.push(orderItem)
|
39 |
+
} else {
|
40 |
+
|
41 |
+
orderItem.item_id = String(wpmDataLayer.products[item.id].dyn_r_ids[wpmDataLayer.pixels.google.analytics.id_type])
|
42 |
+
orderItem.item_brand = wpmDataLayer.products[item.id].brand
|
43 |
+
orderItems.push(orderItem)
|
44 |
+
}
|
45 |
+
}
|
46 |
+
|
47 |
+
return orderItems
|
48 |
+
}
|
49 |
+
|
50 |
+
}(window.wpm = window.wpm || {}, jQuery))
|
51 |
+
|
52 |
+
|
53 |
+
/**
|
54 |
+
* All event listeners
|
55 |
+
* */
|
56 |
+
|
57 |
+
|
58 |
+
// view order received page event
|
59 |
+
jQuery(document).on("wpmOrderReceivedPage", function () {
|
60 |
+
|
61 |
+
try {
|
62 |
+
if (!wpmDataLayer?.pixels?.google?.analytics?.ga4?.measurement_id) return
|
63 |
+
if (wpmDataLayer?.pixels?.google?.analytics?.ga4?.mp_active) return
|
64 |
+
if (!wpm.googleConfigConditionsMet("analytics")) return
|
65 |
+
|
66 |
+
wpm.gtagLoaded().then(function () {
|
67 |
+
gtag("event", "purchase", {
|
68 |
+
send_to : [wpmDataLayer.pixels.google.analytics.ga4.measurement_id],
|
69 |
+
transaction_id: wpmDataLayer.order.number,
|
70 |
+
affiliation : wpmDataLayer.order.affiliation,
|
71 |
+
currency : wpmDataLayer.order.currency,
|
72 |
+
value : wpmDataLayer.order.value_regular,
|
73 |
+
discount : wpmDataLayer.order.discount,
|
74 |
+
tax : wpmDataLayer.order.tax,
|
75 |
+
shipping : wpmDataLayer.order.shipping,
|
76 |
+
coupon : wpmDataLayer.order.coupon,
|
77 |
+
items : wpm.getGA4OrderItems(),
|
78 |
+
})
|
79 |
+
})
|
80 |
+
} catch (e) {
|
81 |
+
console.error(e)
|
82 |
+
}
|
83 |
+
})
|
js/public/google-ga-ua.js
ADDED
@@ -0,0 +1,89 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/**
|
2 |
+
* Add functions for Google Analytics Universal
|
3 |
+
* */
|
4 |
+
|
5 |
+
(function (wpm, $, undefined) {
|
6 |
+
|
7 |
+
wpm.getGAUAOrderItems = function () {
|
8 |
+
|
9 |
+
// "id" : "34",
|
10 |
+
// "name" : "Hoodie",
|
11 |
+
// "brand" : "",
|
12 |
+
// "category" : "Hoodies",
|
13 |
+
// "list_position": 1,
|
14 |
+
// "price" : 45,
|
15 |
+
// "quantity" : 1,
|
16 |
+
// "variant" : "Color: blue | Logo: yes"
|
17 |
+
|
18 |
+
|
19 |
+
let orderItems = [],
|
20 |
+
list_position = 1
|
21 |
+
|
22 |
+
for (const [key, item] of Object.entries(wpmDataLayer.order.items)) {
|
23 |
+
|
24 |
+
let orderItem
|
25 |
+
|
26 |
+
orderItem = {
|
27 |
+
quantity : item.quantity,
|
28 |
+
price : item.price,
|
29 |
+
item_name : item.name,
|
30 |
+
currency : wpmDataLayer.order.currency,
|
31 |
+
item_category: wpmDataLayer.products[item.id].category.join("/"),
|
32 |
+
list_position: list_position,
|
33 |
+
}
|
34 |
+
|
35 |
+
if (wpmDataLayer?.general?.variationsOutput && 0 !== item.variation_id) {
|
36 |
+
|
37 |
+
orderItem.id = String(wpmDataLayer.products[item.variation_id].dyn_r_ids[wpmDataLayer.pixels.google.analytics.id_type])
|
38 |
+
orderItem.variant = wpmDataLayer.products[item.variation_id].variant_name
|
39 |
+
orderItem.item_brand = wpmDataLayer.products[item.variation_id].brand
|
40 |
+
orderItems.push(orderItem)
|
41 |
+
} else {
|
42 |
+
|
43 |
+
orderItem.id = String(wpmDataLayer.products[item.id].dyn_r_ids[wpmDataLayer.pixels.google.analytics.id_type])
|
44 |
+
orderItem.item_brand = wpmDataLayer.products[item.id].brand
|
45 |
+
orderItems.push(orderItem)
|
46 |
+
}
|
47 |
+
|
48 |
+
list_position++
|
49 |
+
}
|
50 |
+
|
51 |
+
return orderItems
|
52 |
+
}
|
53 |
+
|
54 |
+
}(window.wpm = window.wpm || {}, jQuery))
|
55 |
+
|
56 |
+
|
57 |
+
/**
|
58 |
+
* All event listeners
|
59 |
+
* */
|
60 |
+
|
61 |
+
|
62 |
+
// view order received page event
|
63 |
+
jQuery(document).on("wpmOrderReceivedPage", function () {
|
64 |
+
|
65 |
+
try {
|
66 |
+
if (!wpmDataLayer?.pixels?.google?.analytics?.universal?.property_id) return
|
67 |
+
if (wpmDataLayer?.pixels?.google?.analytics?.universal?.mp_active) return
|
68 |
+
if (!wpm.googleConfigConditionsMet("analytics")) return
|
69 |
+
|
70 |
+
wpm.gtagLoaded().then(function () {
|
71 |
+
gtag("event", "purchase", {
|
72 |
+
send_to : [wpmDataLayer.pixels.google.analytics.universal.property_id],
|
73 |
+
transaction_id: wpmDataLayer.order.number,
|
74 |
+
affiliation : wpmDataLayer.order.affiliation,
|
75 |
+
currency : wpmDataLayer.order.currency,
|
76 |
+
value : wpmDataLayer.order.value_regular,
|
77 |
+
discount : wpmDataLayer.order.discount,
|
78 |
+
tax : wpmDataLayer.order.tax,
|
79 |
+
shipping : wpmDataLayer.order.shipping,
|
80 |
+
coupon : wpmDataLayer.order.coupon,
|
81 |
+
items : wpm.getGAUAOrderItems(),
|
82 |
+
})
|
83 |
+
})
|
84 |
+
|
85 |
+
// console.log(wpm.getGAUAOrderItems())
|
86 |
+
} catch (e) {
|
87 |
+
console.error(e)
|
88 |
+
}
|
89 |
+
})
|
js/public/google-optimize.js
ADDED
@@ -0,0 +1,34 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
(function (wpm, $, undefined) {
|
2 |
+
|
3 |
+
wpm.load_google_optimize_pixel = function () {
|
4 |
+
|
5 |
+
try {
|
6 |
+
if (wpmDataLayer?.pixels?.google?.optimize?.container_id) {
|
7 |
+
|
8 |
+
wpmDataLayer.pixels.google.optimize.loaded = true
|
9 |
+
|
10 |
+
wpm.loadScriptAndCacheIt("https://www.googleoptimize.com/optimize.js?id=" + wpmDataLayer.pixels.google.optimize.container_id)
|
11 |
+
// .done(function (script, textStatus) {
|
12 |
+
// console.log('Google Optimize loaded')
|
13 |
+
// });
|
14 |
+
}
|
15 |
+
} catch (e) {
|
16 |
+
console.error(e)
|
17 |
+
}
|
18 |
+
}
|
19 |
+
|
20 |
+
}(window.wpm = window.wpm || {}, jQuery));
|
21 |
+
|
22 |
+
|
23 |
+
(function () {
|
24 |
+
|
25 |
+
jQuery(document).on("wpmLoadPixels", function () {
|
26 |
+
|
27 |
+
if (wpm.canIFire("analytics", "google-optimize") && !wpmDataLayer?.pixels?.google?.optimize?.loaded) wpm.load_google_optimize_pixel()
|
28 |
+
|
29 |
+
})
|
30 |
+
|
31 |
+
})()
|
32 |
+
|
33 |
+
|
34 |
+
|
js/public/google.js
ADDED
@@ -0,0 +1,279 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/**
|
2 |
+
* Add functions for Google
|
3 |
+
* */
|
4 |
+
|
5 |
+
(function (wpm, $, undefined) {
|
6 |
+
|
7 |
+
wpm.googleConfigConditionsMet = function (type) {
|
8 |
+
// always returns true if Google Consent Mode is active
|
9 |
+
if (wpmDataLayer?.pixels?.google?.consent_mode?.active) {
|
10 |
+
return true
|
11 |
+
} else if (wpm.getConsentValues().mode === "category") {
|
12 |
+
return wpm.getConsentValues().categories[type] === true
|
13 |
+
} else if (wpm.getConsentValues().mode === "pixel") {
|
14 |
+
return wpm.getConsentValues().pixels.includes("google-" + type)
|
15 |
+
} else {
|
16 |
+
return false
|
17 |
+
}
|
18 |
+
}
|
19 |
+
|
20 |
+
wpm.getVisitorConsentStatusAndUpdateGoogleConsentSettings = function (google_consent_settings) {
|
21 |
+
|
22 |
+
if (wpm.getConsentValues().mode === "category") {
|
23 |
+
if (wpm.getConsentValues().categories.analytics) google_consent_settings.analytics_storage = "granted"
|
24 |
+
if (wpm.getConsentValues().categories.ads) google_consent_settings.ad_storage = "granted"
|
25 |
+
} else if ((wpm.getConsentValues().mode === "pixel")) {
|
26 |
+
google_consent_settings.analytics_storage = wpm.getConsentValues().pixels.includes("google-analytics") ? "granted" : "denied"
|
27 |
+
google_consent_settings.ad_storage = wpm.getConsentValues().pixels.includes("google-ads") ? "granted" : "denied"
|
28 |
+
}
|
29 |
+
|
30 |
+
return google_consent_settings
|
31 |
+
}
|
32 |
+
|
33 |
+
wpm.updateGoogleConsentMode = function (analytics = true, ads = true) {
|
34 |
+
|
35 |
+
try {
|
36 |
+
if (
|
37 |
+
!window.gtag ||
|
38 |
+
!wpmDataLayer.shop.cookie_consent_mgmt.explicit_consent
|
39 |
+
) return
|
40 |
+
|
41 |
+
gtag("consent", "update", {
|
42 |
+
analytics_storage: analytics ? "granted" : "denied",
|
43 |
+
ad_storage : ads ? "granted" : "denied",
|
44 |
+
})
|
45 |
+
} catch (e) {
|
46 |
+
console.error(e)
|
47 |
+
}
|
48 |
+
}
|
49 |
+
|
50 |
+
wpm.fireGtagGoogleAds = function () {
|
51 |
+
try {
|
52 |
+
wpmDataLayer.pixels.google.ads.state = "loading"
|
53 |
+
|
54 |
+
if (wpmDataLayer?.pixels?.google?.ads?.enhanced_conversions?.active) {
|
55 |
+
for (const [key, item] of Object.entries(wpmDataLayer.pixels.google.ads.conversionIds)) {
|
56 |
+
gtag("config", key, {"allow_enhanced_conversions": true})
|
57 |
+
}
|
58 |
+
} else {
|
59 |
+
for (const [key, item] of Object.entries(wpmDataLayer.pixels.google.ads.conversionIds)) {
|
60 |
+
gtag("config", key)
|
61 |
+
}
|
62 |
+
}
|
63 |
+
|
64 |
+
if (wpmDataLayer?.pixels?.google?.ads?.conversionIds && wpmDataLayer?.pixels?.google?.ads?.phone_conversion_label && wpmDataLayer?.pixels?.google?.ads?.phone_conversion_number) {
|
65 |
+
gtag("config", Object.keys(wpmDataLayer.pixels.google.ads.conversionIds)[0] + "/" + wpmDataLayer.pixels.google.ads.phone_conversion_label, {
|
66 |
+
phone_conversion_number: wpmDataLayer.pixels.google.ads.phone_conversion_number,
|
67 |
+
})
|
68 |
+
}
|
69 |
+
|
70 |
+
// ! enhanced_conversion_data needs to be var
|
71 |
+
// https://support.google.com/google-ads/answer/9888145#zippy=%2Cvalidate-your-implementation-using-chrome-developer-tools
|
72 |
+
if ("order_received_page" === wpmDataLayer.shop.page_type && wpmDataLayer?.order?.google?.ads?.enhanced_conversion_data) {
|
73 |
+
window.enhanced_conversion_data = wpmDataLayer.order.google.ads.enhanced_conversion_data
|
74 |
+
}
|
75 |
+
|
76 |
+
wpmDataLayer.pixels.google.ads.state = "ready"
|
77 |
+
} catch (e) {
|
78 |
+
console.error(e)
|
79 |
+
}
|
80 |
+
}
|
81 |
+
|
82 |
+
wpm.fireGtagGoogleAnalyticsUA = function () {
|
83 |
+
try {
|
84 |
+
wpmDataLayer.pixels.google.analytics.universal.state = "loading"
|
85 |
+
|
86 |
+
gtag("config", wpmDataLayer.pixels.google.analytics.universal.property_id, wpmDataLayer.pixels.google.analytics.universal.parameters)
|
87 |
+
wpmDataLayer.pixels.google.analytics.universal.state = "ready"
|
88 |
+
} catch (e) {
|
89 |
+
console.error(e)
|
90 |
+
}
|
91 |
+
}
|
92 |
+
|
93 |
+
wpm.fireGtagGoogleAnalyticsGA4 = function () {
|
94 |
+
try {
|
95 |
+
wpmDataLayer.pixels.google.analytics.ga4.state = "loading"
|
96 |
+
|
97 |
+
gtag("config", wpmDataLayer.pixels.google.analytics.ga4.measurement_id, wpmDataLayer.pixels.google.analytics.ga4.parameters)
|
98 |
+
wpmDataLayer.pixels.google.analytics.ga4.state = "ready"
|
99 |
+
} catch (e) {
|
100 |
+
console.error(e)
|
101 |
+
}
|
102 |
+
}
|
103 |
+
|
104 |
+
wpm.isGoogleActive = function () {
|
105 |
+
if (
|
106 |
+
wpmDataLayer?.pixels?.google?.analytics?.universal?.property_id ||
|
107 |
+
wpmDataLayer?.pixels?.google?.analytics?.ga4?.measurement_id ||
|
108 |
+
!jQuery.isEmptyObject(wpmDataLayer?.pixels?.google?.ads?.conversionIds)
|
109 |
+
) {
|
110 |
+
return true
|
111 |
+
} else {
|
112 |
+
return false
|
113 |
+
}
|
114 |
+
}
|
115 |
+
|
116 |
+
wpm.getGoogleGtagId = function () {
|
117 |
+
if (wpmDataLayer?.pixels?.google?.analytics?.universal?.property_id) {
|
118 |
+
return wpmDataLayer.pixels.google.analytics.universal.property_id
|
119 |
+
} else if (wpmDataLayer?.pixels?.google?.analytics?.ga4?.measurement_id) {
|
120 |
+
return wpmDataLayer.pixels.google.analytics.ga4.measurement_id
|
121 |
+
} else {
|
122 |
+
return Object.keys(wpmDataLayer.pixels.google.ads.conversionIds)[0]
|
123 |
+
}
|
124 |
+
}
|
125 |
+
|
126 |
+
wpm.loadGoogle = function () {
|
127 |
+
|
128 |
+
if (wpm.isGoogleActive()) {
|
129 |
+
|
130 |
+
wpmDataLayer.pixels.google.state = "loading"
|
131 |
+
|
132 |
+
wpm.loadScriptAndCacheIt("https://www.googletagmanager.com/gtag/js?id=" + wpm.getGoogleGtagId())
|
133 |
+
.done(function (script, textStatus) {
|
134 |
+
try {
|
135 |
+
// console.log('Google Optimize loaded')
|
136 |
+
// alert('Google Optimize loaded')
|
137 |
+
|
138 |
+
// Initiate Google dataLayer and gtag
|
139 |
+
window.dataLayer = window.dataLayer || []
|
140 |
+
window.gtag = function gtag() {
|
141 |
+
dataLayer.push(arguments)
|
142 |
+
}
|
143 |
+
|
144 |
+
// Google Consent Mode
|
145 |
+
if (wpmDataLayer?.pixels?.google?.consent_mode?.active) {
|
146 |
+
|
147 |
+
let google_consent_settings = {
|
148 |
+
"ad_storage" : wpmDataLayer.pixels.google.consent_mode.ad_storage,
|
149 |
+
"analytics_storage": wpmDataLayer.pixels.google.consent_mode.analytics_storage,
|
150 |
+
"wait_for_update" : wpmDataLayer.pixels.google.consent_mode.wait_for_update,
|
151 |
+
}
|
152 |
+
|
153 |
+
if (wpmDataLayer?.pixels?.google?.consent_mode?.region) {
|
154 |
+
google_consent_settings.region = wpmDataLayer.pixels.google.consent_mode.region
|
155 |
+
}
|
156 |
+
google_consent_settings = wpm.getVisitorConsentStatusAndUpdateGoogleConsentSettings(google_consent_settings)
|
157 |
+
|
158 |
+
gtag("consent", "default", google_consent_settings)
|
159 |
+
gtag("set", "ads_data_redaction", wpmDataLayer.pixels.google.consent_mode.ads_data_redaction)
|
160 |
+
gtag("set", "url_passthrough", wpmDataLayer.pixels.google.consent_mode.url_passthrough)
|
161 |
+
}
|
162 |
+
|
163 |
+
// Google Linker
|
164 |
+
// https://developers.google.com/gtagjs/devguide/linker
|
165 |
+
if (wpmDataLayer?.pixels?.google?.linker?.settings) {
|
166 |
+
gtag("set", "linker", wpmDataLayer.pixels.google.linker.settings)
|
167 |
+
}
|
168 |
+
|
169 |
+
gtag("js", new Date())
|
170 |
+
|
171 |
+
if (wpm.googleConfigConditionsMet("ads") && !jQuery.isEmptyObject(wpmDataLayer?.pixels?.google?.ads?.conversionIds)) wpm.fireGtagGoogleAds()
|
172 |
+
if (wpm.googleConfigConditionsMet("analytics") && wpmDataLayer?.pixels?.google?.analytics?.universal?.property_id) wpm.fireGtagGoogleAnalyticsUA()
|
173 |
+
if (wpm.googleConfigConditionsMet("analytics") && wpmDataLayer?.pixels?.google?.analytics?.ga4?.measurement_id) wpm.fireGtagGoogleAnalyticsGA4()
|
174 |
+
|
175 |
+
wpmDataLayer.pixels.google.state = "ready"
|
176 |
+
} catch (e) {
|
177 |
+
console.error(e)
|
178 |
+
}
|
179 |
+
})
|
180 |
+
}
|
181 |
+
}
|
182 |
+
|
183 |
+
wpm.canGoogleLoad = function () {
|
184 |
+
|
185 |
+
if (wpmDataLayer?.pixels?.google?.consent_mode?.active) {
|
186 |
+
return true
|
187 |
+
} else if ("category" === wpm.getConsentValues().mode) {
|
188 |
+
return !!(wpm.getConsentValues().categories["ads"] || wpm.getConsentValues().categories["analytics"])
|
189 |
+
} else if ("pixel" === wpm.getConsentValues().mode) {
|
190 |
+
return wpm.getConsentValues().pixels.includes("google-ads") || wpm.getConsentValues().pixels.includes("google-analytics")
|
191 |
+
} else {
|
192 |
+
console.error("Couldn't find a valid load condition for Google mode in wpmConsentValues")
|
193 |
+
return false
|
194 |
+
}
|
195 |
+
}
|
196 |
+
|
197 |
+
wpm.gtagLoaded = function () {
|
198 |
+
return new Promise(function (resolve, reject) {
|
199 |
+
|
200 |
+
if (typeof wpmDataLayer?.pixels?.google?.state === "undefined") reject()
|
201 |
+
|
202 |
+
let startTime = 0
|
203 |
+
let timeout = 5000
|
204 |
+
let frequency = 200;
|
205 |
+
|
206 |
+
(function wait() {
|
207 |
+
if (wpmDataLayer?.pixels?.google?.state === "ready") return resolve()
|
208 |
+
if (startTime >= timeout) return reject()
|
209 |
+
startTime += frequency
|
210 |
+
setTimeout(wait, frequency)
|
211 |
+
})()
|
212 |
+
})
|
213 |
+
}
|
214 |
+
|
215 |
+
// wpm.gtagLoadednew = function () {
|
216 |
+
// return Promise.race([
|
217 |
+
// new Promise(function (resolve, reject) {
|
218 |
+
//
|
219 |
+
// if (typeof wpmDataLayer?.pixels?.google?.state === "undefined") reject();
|
220 |
+
//
|
221 |
+
//
|
222 |
+
// (function wait() {
|
223 |
+
// if (wpmDataLayer?.pixels?.google?.state === "ready") return resolve()
|
224 |
+
// if (to >= 1000) return reject()
|
225 |
+
// setTimeout(wait, 100)
|
226 |
+
// })()
|
227 |
+
// }),
|
228 |
+
// new Promise(function (resolve, reject) {
|
229 |
+
// setTimeout(() => reject(), 1000)
|
230 |
+
// }),
|
231 |
+
// ],
|
232 |
+
// )
|
233 |
+
// // .then((value) => {console.log("race then value: " + value)})
|
234 |
+
// .catch(
|
235 |
+
// (value) => {
|
236 |
+
// console.log("race catch value: " + value)
|
237 |
+
// return Promise.reject()
|
238 |
+
// })
|
239 |
+
// }
|
240 |
+
|
241 |
+
|
242 |
+
// const promise1 = new Promise((resolve, reject) => {
|
243 |
+
// setTimeout(resolve, 500, "one")
|
244 |
+
// })
|
245 |
+
//
|
246 |
+
// const promise2 = new Promise((resolve, reject) => {
|
247 |
+
// setTimeout(reject, 100, "two")
|
248 |
+
// })
|
249 |
+
//
|
250 |
+
// let onlyRunIfResolves = function () {
|
251 |
+
// return Promise.race([promise1, promise2])
|
252 |
+
// .catch(() => {
|
253 |
+
// })
|
254 |
+
// }
|
255 |
+
//
|
256 |
+
// onlyRunIfResolves()
|
257 |
+
// .then(() => {
|
258 |
+
// console.log("running function")
|
259 |
+
// })
|
260 |
+
|
261 |
+
|
262 |
+
}(window.wpm = window.wpm || {}, jQuery));
|
263 |
+
|
264 |
+
|
265 |
+
(function () {
|
266 |
+
|
267 |
+
jQuery(document).on("wpmLoadPixels", function () {
|
268 |
+
|
269 |
+
if (
|
270 |
+
wpm.canGoogleLoad() &&
|
271 |
+
(typeof wpmDataLayer?.pixels?.google?.state === "undefined")
|
272 |
+
) {
|
273 |
+
wpm.loadGoogle()
|
274 |
+
}
|
275 |
+
})
|
276 |
+
|
277 |
+
// return wpmDataLayer?.pixels?.google?.state === "undefined";
|
278 |
+
|
279 |
+
})()
|
js/public/hotjar.js
ADDED
@@ -0,0 +1,39 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
(function (wpm, $, undefined) {
|
2 |
+
|
3 |
+
wpm.load_hotjar_pixel = function () {
|
4 |
+
|
5 |
+
if (wpmDataLayer?.pixels?.hotjar?.site_id) {
|
6 |
+
|
7 |
+
// console.log('hotjar loaded');
|
8 |
+
|
9 |
+
wpmDataLayer.pixels.hotjar.loaded = true;
|
10 |
+
|
11 |
+
// @formatter:off
|
12 |
+
(function(h,o,t,j,a,r){
|
13 |
+
h.hj=h.hj||function(){(h.hj.q=h.hj.q||[]).push(arguments)};
|
14 |
+
h._hjSettings={hjid:wpmDataLayer.pixels.hotjar.site_id,hjsv:6};
|
15 |
+
a=o.getElementsByTagName('head')[0];
|
16 |
+
r=o.createElement('script');r.async=1;
|
17 |
+
r.src=t+h._hjSettings.hjid+j+h._hjSettings.hjsv;
|
18 |
+
a.appendChild(r);
|
19 |
+
})(window,document,'https://static.hotjar.com/c/hotjar-','.js?sv=');
|
20 |
+
// @formatter:on
|
21 |
+
|
22 |
+
}
|
23 |
+
}
|
24 |
+
|
25 |
+
}(window.wpm = window.wpm || {}, jQuery));
|
26 |
+
|
27 |
+
|
28 |
+
(function () {
|
29 |
+
|
30 |
+
jQuery(document).on("wpmLoadPixels", function () {
|
31 |
+
|
32 |
+
if (wpm.canIFire("analytics", "hotjar") && !wpmDataLayer?.pixels?.hotjar?.loaded) wpm.load_hotjar_pixel()
|
33 |
+
|
34 |
+
})
|
35 |
+
|
36 |
+
})()
|
37 |
+
|
38 |
+
|
39 |
+
|
js/public/main-free.js
ADDED
@@ -0,0 +1,27 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/**
|
2 |
+
* Load all free scripts first
|
3 |
+
*/
|
4 |
+
|
5 |
+
require("./wpm")
|
6 |
+
|
7 |
+
/**
|
8 |
+
* Load all free scripts
|
9 |
+
*/
|
10 |
+
|
11 |
+
require("./google")
|
12 |
+
require("./google-ga-ua")
|
13 |
+
require("./google-ga-4")
|
14 |
+
require("./google-ads")
|
15 |
+
require("./facebook")
|
16 |
+
require("./hotjar")
|
17 |
+
require("./google-optimize")
|
18 |
+
|
19 |
+
/**
|
20 |
+
* Execute the wpm loader. It makes sure that the script flow gets exectuded correctly, no matter how JS "optimizers" shuffle the code.
|
21 |
+
*/
|
22 |
+
|
23 |
+
require("./wpm-loader")
|
24 |
+
|
25 |
+
// console.log('WooCommerce Pixel Manager free version')
|
26 |
+
|
27 |
+
|
js/public/main-premium.js
ADDED
@@ -0,0 +1,57 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
// TODO Try using the webpack ignore plugin to remove premium imports during compilation
|
2 |
+
// https://webpack.js.org/plugins/ignore-plugin/
|
3 |
+
// https://stackoverflow.com/questions/65004054/webpack-ignoreplugin-on-multiple-modules
|
4 |
+
// https://stackoverflow.com/questions/61822069/conditional-import-import-if-exists
|
5 |
+
// https://stackoverflow.com/questions/36367532/how-can-i-conditionally-import-an-es6-module
|
6 |
+
|
7 |
+
|
8 |
+
// console.log(ENV)
|
9 |
+
// if (ENV.tier === 'pro') {
|
10 |
+
// console.log('tier')
|
11 |
+
// }
|
12 |
+
|
13 |
+
/**
|
14 |
+
* Load all essential scripts first
|
15 |
+
*/
|
16 |
+
|
17 |
+
require("./wpm")
|
18 |
+
require("./wpm__premium_only")
|
19 |
+
require("./google__premium_only")
|
20 |
+
|
21 |
+
/**
|
22 |
+
* Load all free scripts
|
23 |
+
*/
|
24 |
+
|
25 |
+
require("./google")
|
26 |
+
require("./google-ga-ua")
|
27 |
+
require("./google-ga-4")
|
28 |
+
require("./google-ads")
|
29 |
+
require("./facebook")
|
30 |
+
require("./hotjar")
|
31 |
+
require("./google-optimize")
|
32 |
+
|
33 |
+
/**
|
34 |
+
* Load all premium scripts
|
35 |
+
*/
|
36 |
+
|
37 |
+
require("./google-ga-ua-eec__premium_only")
|
38 |
+
require("./google-ga-4-eec__premium_only")
|
39 |
+
require("./tiktok__premium_only")
|
40 |
+
require("./snapchat__premium_only")
|
41 |
+
require("./pinterest__premium_only")
|
42 |
+
require("./facebook__premium_only")
|
43 |
+
require("./microsoft-ads__premium_only.js")
|
44 |
+
require("./twitter__premium_only.js")
|
45 |
+
require("./google-ads__premium_only.js")
|
46 |
+
|
47 |
+
|
48 |
+
/**
|
49 |
+
* Execute the wpm loader. It makes sure that the script flow gets exectuded correctly, no matter how JS "optimizers" shuffle the code.
|
50 |
+
*/
|
51 |
+
|
52 |
+
require("./wpm-loader")
|
53 |
+
|
54 |
+
|
55 |
+
// console.log('WooCommerce Pixel Manager premium version')
|
56 |
+
|
57 |
+
|
js/public/main.js
ADDED
@@ -0,0 +1,33 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
// TODO Try using the webpack ignore plugin to remove premium imports during compilation
|
2 |
+
// https://webpack.js.org/plugins/ignore-plugin/
|
3 |
+
// https://stackoverflow.com/questions/65004054/webpack-ignoreplugin-on-multiple-modules
|
4 |
+
// https://stackoverflow.com/questions/61822069/conditional-import-import-if-exists
|
5 |
+
// https://stackoverflow.com/questions/36367532/how-can-i-conditionally-import-an-es6-module
|
6 |
+
|
7 |
+
// import wpm from "./wpm.js"
|
8 |
+
// import wpm_premium from "./wpm__premium_only.js"
|
9 |
+
// import google_premium from "./google__premium_only.js"
|
10 |
+
|
11 |
+
// require("./wpm.js")
|
12 |
+
require("./wpm__premium_only.js")
|
13 |
+
require("./google__premium_only.js")
|
14 |
+
|
15 |
+
// if (ENV.tier === 'pro') {
|
16 |
+
// console.log('Yo!')
|
17 |
+
//
|
18 |
+
// }
|
19 |
+
|
20 |
+
import google_ads from "./google-ads.js"
|
21 |
+
import facebook from "./facebook.js"
|
22 |
+
import hotjar from "./hotjar.js"
|
23 |
+
import google_optimize from "./google-optimize.js"
|
24 |
+
|
25 |
+
import google_ga_ua_eec_premium from "./google-ga-ua-eec__premium_only.js"
|
26 |
+
import google_ga_4_eec_premium from "./google-ga-4-eec__premium_only.js"
|
27 |
+
import tiktok_premium from "./tiktok__premium_only.js"
|
28 |
+
import snapchat_premium from "./snapchat__premium_only.js"
|
29 |
+
import pinterest_premium from "./pinterest__premium_only.js"
|
30 |
+
import facebook_premium from "./facebook__premium_only.js"
|
31 |
+
|
32 |
+
|
33 |
+
// console.log('WooCommerce Pixel Manager premium version')
|
js/public/wpm-loader.js
ADDED
@@ -0,0 +1,17 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/**
|
2 |
+
* After wpm is loaded
|
3 |
+
* we first check if wpmDataLayer is loaded,
|
4 |
+
* and as soon as it is, we load the pixels,
|
5 |
+
* and as soon as the page load is complete,
|
6 |
+
* we fire the wpmLoad event.
|
7 |
+
*/
|
8 |
+
wpm.wpmDataLayerExists()
|
9 |
+
.then(function () {
|
10 |
+
jQuery(document).trigger("wpmPreLoadPixels", {})
|
11 |
+
})
|
12 |
+
.then(function () {
|
13 |
+
wpm.pageLoaded().then(function () {
|
14 |
+
jQuery(document).trigger("wpmLoad", {})
|
15 |
+
})
|
16 |
+
})
|
17 |
+
|
js/public/wpm-public.p1.min.js
CHANGED
@@ -1,2 +1,2 @@
|
|
1 |
-
(()=>{var e={164:()=>{jQuery(document).on("wpmLoadPixels",(function(){var e,t,o,a,r,n;null===(e=wpmDataLayer)||void 0===e||null===(t=e.pixels)||void 0===t||null===(o=t.facebook)||void 0===o||!o.pixel_id||null!==(a=wpmDataLayer)&&void 0!==a&&null!==(r=a.pixels)&&void 0!==r&&null!==(n=r.facebook)&&void 0!==n&&n.loaded||wpm.canIFire("ads","facebook-ads")&&wpm.loadFacebookPixel()})),jQuery(document).on("wpmAddToCart",(function(e,t){try{var o,a,r;if(null===(o=wpmDataLayer)||void 0===o||null===(a=o.pixels)||void 0===a||null===(r=a.facebook)||void 0===r||!r.loaded)return;let e=wpm.getRandomEventId();fbq("track","AddToCart",{content_type:"product",content_name:t.name,content_ids:t.dyn_r_ids[wpmDataLayer.pixels.facebook.dynamic_remarketing.id_type],value:parseFloat(t.quantity*t.price),currency:t.currency},{eventID:e}),t.currency=wpmDataLayer.shop.currency,jQuery(document).trigger("wpmFbCapiEvent",{event_name:"AddToCart",event_id:e,user_data:wpm.getFbUserData(),product_data:t,product_id:t.dyn_r_ids[wpmDataLayer.pixels.facebook.dynamic_remarketing.id_type],event_source_url:window.location.href})}catch(e){console.error(e)}})),jQuery(document).on("wpmBeginCheckout",(function(e){try{var t,o,a;if(null===(t=wpmDataLayer)||void 0===t||null===(o=t.pixels)||void 0===o||null===(a=o.facebook)||void 0===a||!a.loaded)return;let e=wpm.getRandomEventId();fbq("track","InitiateCheckout",{},{eventID:e}),jQuery(document).trigger("wpmFbCapiEvent",{event_name:"InitiateCheckout",event_id:e,user_data:wpm.getFbUserData(),event_source_url:window.location.href})}catch(e){console.error(e)}})),jQuery(document).on("wpmAddToWishlist",(function(e,t){try{var o,a,r;if(null===(o=wpmDataLayer)||void 0===o||null===(a=o.pixels)||void 0===a||null===(r=a.facebook)||void 0===r||!r.loaded)return;let e=wpm.getRandomEventId();fbq("track","AddToWishlist",{content_type:"product",content_name:t.name,content_ids:t.dyn_r_ids[wpmDataLayer.pixels.facebook.dynamic_remarketing.id_type],value:parseFloat(t.quantity*t.price),currency:t.currency},{eventID:e}),t.currency=wpmDataLayer.shop.currency,jQuery(document).trigger("wpmFbCapiEvent",{event_name:"AddToWishlist",event_id:e,user_data:wpm.getFbUserData(),product_data:t,product_id:t.dyn_r_ids[wpmDataLayer.pixels.facebook.dynamic_remarketing.id_type],event_source_url:window.location.href})}catch(e){console.error(e)}})),jQuery(document).on("wpmViewItem",(function(e,t){try{var o,a,r;if(null===(o=wpmDataLayer)||void 0===o||null===(a=o.pixels)||void 0===a||null===(r=a.facebook)||void 0===r||!r.loaded)return;wpm.fbViewContent(t)}catch(e){console.error(e)}})),jQuery(document).on("wpmSearch",(function(){try{var e,t,o;if(null===(e=wpmDataLayer)||void 0===e||null===(t=e.pixels)||void 0===t||null===(o=t.facebook)||void 0===o||!o.loaded)return;let a=wpm.getRandomEventId();fbq("track","Search",{},{eventID:a}),jQuery(document).trigger("wpmFbCapiEvent",{event_name:"Search",event_id:a,user_data:wpm.getFbUserData(),event_source_url:window.location.href})}catch(e){console.error(e)}})),jQuery(document).on("wpmLoadAlways",(function(){try{var e,t,o;if(null===(e=wpmDataLayer)||void 0===e||null===(t=e.pixels)||void 0===t||null===(o=t.facebook)||void 0===o||!o.loaded)return;wpm.setFbUserData()}catch(e){console.error(e)}})),jQuery(document).on("wpmOrderReceivedPage",(function(){try{var e,t,o;if(null===(e=wpmDataLayer)||void 0===e||null===(t=e.pixels)||void 0===t||null===(o=t.facebook)||void 0===o||!o.loaded)return;fbq("track","Purchase",{content_type:"product",value:wpmDataLayer.order.value_filtered,currency:wpmDataLayer.order.currency,content_ids:wpm.facebookContentIds()},{eventID:wpmDataLayer.order.id})}catch(e){console.error(e)}}))},1:()=>{!function(e,t,o){let a;e.loadFacebookPixel=function(){try{wpmDataLayer.pixels.facebook.loaded=!0,e=window,t=document,o="script",e.fbq||(a=e.fbq=function(){a.callMethod?a.callMethod.apply(a,arguments):a.queue.push(arguments)},e._fbq||(e._fbq=a),a.push=a,a.loaded=!0,a.version="2.0",a.queue=[],(r=t.createElement(o)).async=!0,r.src="https://connect.facebook.net/en_US/fbevents.js",(n=t.getElementsByTagName(o)[0]).parentNode.insertBefore(r,n)),fbq("init",wpmDataLayer.pixels.facebook.pixel_id),fbq("track","PageView")}catch(o){console.error(o)}var e,t,o,a,r,n},e.getRandomEventId=function(){return(Math.random()+1).toString(36).substring(2)},e.getFbUserData=function(){return a||e.getFbUserDataFromBrowser()},e.setFbUserData=function(){a=e.getFbUserDataFromBrowser()},e.getFbUserDataFromBrowser=function(){return{fbp:e.getCookie("_fbp"),fbc:e.getCookie("_fbc"),client_user_agent:navigator.userAgent}},e.fbViewContent=function(t){try{var o,a,r;if(null===(o=wpmDataLayer)||void 0===o||null===(a=o.pixels)||void 0===a||null===(r=a.facebook)||void 0===r||!r.loaded)return;let n=e.getRandomEventId();fbq("track","ViewContent",{content_type:"product",content_name:t.name,content_ids:t.dyn_r_ids[wpmDataLayer.pixels.facebook.dynamic_remarketing.id_type],currency:wpmDataLayer.shop.currency,value:t.price},{eventID:n}),t.currency=wpmDataLayer.shop.currency,jQuery(document).trigger("wpmFbCapiEvent",{event_name:"ViewContent",event_id:n,user_data:e.getFbUserData(),product_data:t,product_id:t.dyn_r_ids[wpmDataLayer.pixels.facebook.dynamic_remarketing.id_type],event_source_url:window.location.href})}catch(e){console.error(e)}},e.facebookContentIds=function(){let e=[];for(const[a,r]of Object.entries(wpmDataLayer.order.items)){var t,o;null!==(t=wpmDataLayer)&&void 0!==t&&null!==(o=t.general)&&void 0!==o&&o.variationsOutput&&0!==r.variation_id?e.push(String(wpmDataLayer.products[r.variation_id].dyn_r_ids[wpmDataLayer.pixels.facebook.dynamic_remarketing.id_type])):e.push(String(wpmDataLayer.products[r.id].dyn_r_ids[wpmDataLayer.pixels.facebook.dynamic_remarketing.id_type]))}return e}}(window.wpm=window.wpm||{},jQuery)},12:(e,t,o)=>{o(1),o(164)},165:()=>{jQuery(document).on("wpmViewItemList",(function(e,t){try{var o,a,r,n,i,s,d,l,c,u,p;if(jQuery.isEmptyObject(null===(o=wpmDataLayer)||void 0===o||null===(a=o.pixels)||void 0===a||null===(r=a.google)||void 0===r||null===(n=r.ads)||void 0===n?void 0:n.conversionIds))return;if(null===(i=wpmDataLayer)||void 0===i||null===(s=i.pixels)||void 0===s||null===(d=s.google)||void 0===d||null===(l=d.ads)||void 0===l||null===(c=l.dynamic_remarketing)||void 0===c||!c.status)return;if(!wpm.googleConfigConditionsMet("ads"))return;if(null!==(u=wpmDataLayer)&&void 0!==u&&null!==(p=u.general)&&void 0!==p&&p.variationsOutput&&t.isVariable&&!1===wpmDataLayer.pixels.google.ads.dynamic_remarketing.send_events_with_parent_ids)return;if(!t)return;wpm.gtagLoaded().then((function(){gtag("event","view_item_list",{send_to:wpm.getGoogleAdsConversionIdentifiers(),items:[{id:t.dyn_r_ids[wpmDataLayer.pixels.google.ads.dynamic_remarketing.id_type],google_business_vertical:wpmDataLayer.pixels.google.ads.google_business_vertical}]})}))}catch(e){console.error(e)}})),jQuery(document).on("wpmAddToCart",(function(e,t){try{var o,a,r,n,i,s,d,l,c;if(jQuery.isEmptyObject(null===(o=wpmDataLayer)||void 0===o||null===(a=o.pixels)||void 0===a||null===(r=a.google)||void 0===r||null===(n=r.ads)||void 0===n?void 0:n.conversionIds))return;if(null===(i=wpmDataLayer)||void 0===i||null===(s=i.pixels)||void 0===s||null===(d=s.google)||void 0===d||null===(l=d.ads)||void 0===l||null===(c=l.dynamic_remarketing)||void 0===c||!c.status)return;if(!wpm.googleConfigConditionsMet("ads"))return;wpm.gtagLoaded().then((function(){gtag("event","add_to_cart",{send_to:wpm.getGoogleAdsConversionIdentifiers(),value:t.quantity*t.price,items:[{id:t.dyn_r_ids[wpmDataLayer.pixels.google.ads.dynamic_remarketing.id_type],quantity:t.quantity,price:t.price,google_business_vertical:wpmDataLayer.pixels.google.ads.google_business_vertical}]})}))}catch(e){console.error(e)}})),jQuery(document).on("wpmViewItem",(function(e,t){try{var o,a,r,n,i,s,d,l,c;if(jQuery.isEmptyObject(null===(o=wpmDataLayer)||void 0===o||null===(a=o.pixels)||void 0===a||null===(r=a.google)||void 0===r||null===(n=r.ads)||void 0===n?void 0:n.conversionIds))return;if(null===(i=wpmDataLayer)||void 0===i||null===(s=i.pixels)||void 0===s||null===(d=s.google)||void 0===d||null===(l=d.ads)||void 0===l||null===(c=l.dynamic_remarketing)||void 0===c||!c.status)return;if(!wpm.googleConfigConditionsMet("ads"))return;wpm.gtagLoaded().then((function(){gtag("event","view_item",{send_to:wpm.getGoogleAdsConversionIdentifiers(),value:(t.quantity?t.quantity:1)*t.price,items:[{id:t.dyn_r_ids[wpmDataLayer.pixels.google.ads.dynamic_remarketing.id_type],quantity:t.quantity?t.quantity:1,price:t.price,google_business_vertical:wpmDataLayer.pixels.google.ads.google_business_vertical}]})}))}catch(e){console.error(e)}})),jQuery(document).on("wpmSearch",(function(){try{var e,t,o,a,r,n,i,s,d;if(jQuery.isEmptyObject(null===(e=wpmDataLayer)||void 0===e||null===(t=e.pixels)||void 0===t||null===(o=t.google)||void 0===o||null===(a=o.ads)||void 0===a?void 0:a.conversionIds))return;if(null===(r=wpmDataLayer)||void 0===r||null===(n=r.pixels)||void 0===n||null===(i=n.google)||void 0===i||null===(s=i.ads)||void 0===s||null===(d=s.dynamic_remarketing)||void 0===d||!d.status)return;if(!wpm.googleConfigConditionsMet("ads"))return;let u=[];for(const[e,t]of Object.entries(wpmDataLayer.products)){var l,c;if(null!==(l=wpmDataLayer)&&void 0!==l&&null!==(c=l.general)&&void 0!==c&&c.variationsOutput&&t.isVariable&&!1===wpmDataLayer.pixels.google.ads.dynamic_remarketing.send_events_with_parent_ids)return;u.push({id:t.dyn_r_ids[wpmDataLayer.pixels.google.ads.dynamic_remarketing.id_type],google_business_vertical:wpmDataLayer.pixels.google.ads.google_business_vertical})}wpm.gtagLoaded().then((function(){gtag("event","view_search_results",{send_to:wpm.getGoogleAdsConversionIdentifiers(),items:u})}))}catch(e){console.error(e)}})),jQuery(document).on("wpmOrderReceivedPage",(function(){try{var e,t,o,a,r,n,i,s,d;if(jQuery.isEmptyObject(null===(e=wpmDataLayer)||void 0===e||null===(t=e.pixels)||void 0===t||null===(o=t.google)||void 0===o||null===(a=o.ads)||void 0===a?void 0:a.conversionIds))return;if(null===(r=wpmDataLayer)||void 0===r||null===(n=r.pixels)||void 0===n||null===(i=n.google)||void 0===i||null===(s=i.ads)||void 0===s||null===(d=s.dynamic_remarketing)||void 0===d||!d.status)return;if(!wpm.googleConfigConditionsMet("ads"))return;wpm.gtagLoaded().then((function(){gtag("event","purchase",{send_to:wpm.getGoogleAdsConversionIdentifiers(),value:wpmDataLayer.order.value_filtered,items:wpm.getGoogleAdsDynamicRemarketingOrderItems()})}))}catch(e){console.error(e)}})),jQuery(document).on("wpmLogin",(function(){try{var e,t,o,a,r,n,i,s,d;if(jQuery.isEmptyObject(null===(e=wpmDataLayer)||void 0===e||null===(t=e.pixels)||void 0===t||null===(o=t.google)||void 0===o||null===(a=o.ads)||void 0===a?void 0:a.conversionIds))return;if(null===(r=wpmDataLayer)||void 0===r||null===(n=r.pixels)||void 0===n||null===(i=n.google)||void 0===i||null===(s=i.ads)||void 0===s||null===(d=s.dynamic_remarketing)||void 0===d||!d.status)return;if(!wpm.googleConfigConditionsMet("ads"))return;wpm.gtagLoaded().then((function(){gtag("event","login",{send_to:wpm.getGoogleAdsConversionIdentifiers()})}))}catch(e){console.error(e)}})),jQuery(document).on("wpmOrderReceivedPage",(function(){try{var e,t,o,a,r,n;if(jQuery.isEmptyObject(null===(e=wpmDataLayer)||void 0===e||null===(t=e.pixels)||void 0===t||null===(o=t.google)||void 0===o||null===(a=o.ads)||void 0===a?void 0:a.conversionIds))return;if(!wpm.googleConfigConditionsMet("ads"))return;let i={},s={};i={send_to:wpm.getGoogleAdsConversionIdentifiersWithLabel(),transaction_id:wpmDataLayer.order.number,value:wpmDataLayer.order.value_filtered,currency:wpmDataLayer.order.currency,new_customer:wpmDataLayer.order.new_customer},null!==(r=wpmDataLayer)&&void 0!==r&&null!==(n=r.order)&&void 0!==n&&n.aw_merchant_id&&(s={discount:wpmDataLayer.order.discount,aw_merchant_id:wpmDataLayer.order.aw_merchant_id,aw_feed_country:wpmDataLayer.order.aw_feed_country,aw_feed_language:wpmDataLayer.order.aw_feed_language,items:wpm.getGoogleAdsRegularOrderItems()}),wpm.gtagLoaded().then((function(){gtag("event","conversion",{...i,...s})}))}catch(e){console.error(e)}}))},42:()=>{!function(e,t,o){let a=[];e.getGoogleAdsConversionIdentifiersWithLabel=function(){for(const[e,t]of Object.entries(wpmDataLayer.pixels.google.ads.conversionIds))a.push(e+"/"+t);return a},e.getGoogleAdsConversionIdentifiers=function(){let e=[];for(const[t,o]of Object.entries(wpmDataLayer.pixels.google.ads.conversionIds))e.push(t);return e},e.getGoogleAdsRegularOrderItems=function(){let e=[];for(const[a,r]of Object.entries(wpmDataLayer.order.items)){var t,o;let a;a={quantity:r.quantity,price:r.price},null!==(t=wpmDataLayer)&&void 0!==t&&null!==(o=t.general)&&void 0!==o&&o.variationsOutput&&0!==r.variation_id?(a.id=String(wpmDataLayer.products[r.variation_id].dyn_r_ids[wpmDataLayer.pixels.google.ads.dynamic_remarketing.id_type]),e.push(a)):(a.id=String(wpmDataLayer.products[r.id].dyn_r_ids[wpmDataLayer.pixels.google.ads.dynamic_remarketing.id_type]),e.push(a))}return e},e.getGoogleAdsDynamicRemarketingOrderItems=function(){let e=[];for(const[a,r]of Object.entries(wpmDataLayer.order.items)){var t,o;let a;a={quantity:r.quantity,price:r.price,google_business_vertical:wpmDataLayer.pixels.google.ads.google_business_vertical},null!==(t=wpmDataLayer)&&void 0!==t&&null!==(o=t.general)&&void 0!==o&&o.variationsOutput&&0!==r.variation_id?(a.id=String(wpmDataLayer.products[r.variation_id].dyn_r_ids[wpmDataLayer.pixels.google.ads.dynamic_remarketing.id_type]),e.push(a)):(a.id=String(wpmDataLayer.products[r.id].dyn_r_ids[wpmDataLayer.pixels.google.ads.dynamic_remarketing.id_type]),e.push(a))}return e}}(window.wpm=window.wpm||{},jQuery)},190:(e,t,o)=>{o(42),o(165)},625:()=>{jQuery(document).on("wpmOrderReceivedPage",(function(){try{var e,t,o,a,r,n,i,s,d,l;if(null===(e=wpmDataLayer)||void 0===e||null===(t=e.pixels)||void 0===t||null===(o=t.google)||void 0===o||null===(a=o.analytics)||void 0===a||null===(r=a.universal)||void 0===r||!r.property_id)return;if(null!==(n=wpmDataLayer)&&void 0!==n&&null!==(i=n.pixels)&&void 0!==i&&null!==(s=i.google)&&void 0!==s&&null!==(d=s.analytics)&&void 0!==d&&null!==(l=d.universal)&&void 0!==l&&l.mp_active)return;if(!wpm.googleConfigConditionsMet("analytics"))return;wpm.gtagLoaded().then((function(){gtag("event","purchase",{send_to:[wpmDataLayer.pixels.google.analytics.universal.property_id],transaction_id:wpmDataLayer.order.number,affiliation:wpmDataLayer.order.affiliation,currency:wpmDataLayer.order.currency,value:wpmDataLayer.order.value_regular,discount:wpmDataLayer.order.discount,tax:wpmDataLayer.order.tax,shipping:wpmDataLayer.order.shipping,coupon:wpmDataLayer.order.coupon,items:wpm.getGAUAOrderItems()})}))}catch(e){console.error(e)}}))},19:()=>{!function(e,t,o){e.getGAUAOrderItems=function(){let e=[],t=1;for(const[r,n]of Object.entries(wpmDataLayer.order.items)){var o,a;let r;r={quantity:n.quantity,price:n.price,name:n.name,currency:wpmDataLayer.order.currency,category:wpmDataLayer.products[n.id].category.join("/"),list_position:t},null!==(o=wpmDataLayer)&&void 0!==o&&null!==(a=o.general)&&void 0!==a&&a.variationsOutput&&0!==n.variation_id?(r.id=String(wpmDataLayer.products[n.variation_id].dyn_r_ids[wpmDataLayer.pixels.google.analytics.id_type]),r.variant=wpmDataLayer.products[n.variation_id].variant_name,r.brand=wpmDataLayer.products[n.variation_id].brand):(r.id=String(wpmDataLayer.products[n.id].dyn_r_ids[wpmDataLayer.pixels.google.analytics.id_type]),r.brand=wpmDataLayer.products[n.id].brand),e.push(r),t++}return e}}(window.wpm=window.wpm||{},jQuery)},562:(e,t,o)=>{o(19),o(625)},572:()=>{jQuery(document).on("wpmOrderReceivedPage",(function(){try{var e,t,o,a,r,n,i,s,d,l;if(null===(e=wpmDataLayer)||void 0===e||null===(t=e.pixels)||void 0===t||null===(o=t.google)||void 0===o||null===(a=o.analytics)||void 0===a||null===(r=a.ga4)||void 0===r||!r.measurement_id)return;if(null!==(n=wpmDataLayer)&&void 0!==n&&null!==(i=n.pixels)&&void 0!==i&&null!==(s=i.google)&&void 0!==s&&null!==(d=s.analytics)&&void 0!==d&&null!==(l=d.ga4)&&void 0!==l&&l.mp_active)return;if(!wpm.googleConfigConditionsMet("analytics"))return;wpm.gtagLoaded().then((function(){gtag("event","purchase",{send_to:[wpmDataLayer.pixels.google.analytics.ga4.measurement_id],transaction_id:wpmDataLayer.order.number,affiliation:wpmDataLayer.order.affiliation,currency:wpmDataLayer.order.currency,value:wpmDataLayer.order.value_regular,discount:wpmDataLayer.order.discount,tax:wpmDataLayer.order.tax,shipping:wpmDataLayer.order.shipping,coupon:wpmDataLayer.order.coupon,items:wpm.getGA4OrderItems()})}))}catch(e){console.error(e)}}))},228:()=>{!function(e,t,o){e.getGA4OrderItems=function(){let e=[];for(const[a,r]of Object.entries(wpmDataLayer.order.items)){var t,o;let a;a={quantity:r.quantity,price:r.price,item_name:r.name,currency:wpmDataLayer.order.currency,item_category:wpmDataLayer.products[r.id].category.join("/")},null!==(t=wpmDataLayer)&&void 0!==t&&null!==(o=t.general)&&void 0!==o&&o.variationsOutput&&0!==r.variation_id?(a.item_id=String(wpmDataLayer.products[r.variation_id].dyn_r_ids[wpmDataLayer.pixels.google.analytics.id_type]),a.item_variant=wpmDataLayer.products[r.variation_id].variant_name,a.item_brand=wpmDataLayer.products[r.variation_id].brand):(a.item_id=String(wpmDataLayer.products[r.id].dyn_r_ids[wpmDataLayer.pixels.google.analytics.id_type]),a.item_brand=wpmDataLayer.products[r.id].brand),e.push(a)}return e}}(window.wpm=window.wpm||{},jQuery)},522:(e,t,o)=>{o(228),o(572)},774:(e,t,o)=>{o(562),o(522)},294:()=>{jQuery(document).on("wpmLoadPixels",(function(){var e,t,o;void 0===(null===(e=wpmDataLayer)||void 0===e||null===(t=e.pixels)||void 0===t||null===(o=t.google)||void 0===o?void 0:o.state)&&(wpm.canGoogleLoad()?wpm.loadGoogle():wpm.logPreventedPixelLoading("google","analytics / ads"))}))},860:()=>{!function(e,t,o){e.googleConfigConditionsMet=function(t){var o,a,r,n;return!(null===(o=wpmDataLayer)||void 0===o||null===(a=o.pixels)||void 0===a||null===(r=a.google)||void 0===r||null===(n=r.consent_mode)||void 0===n||!n.active)||("category"===e.getConsentValues().mode?!0===e.getConsentValues().categories[t]:"pixel"===e.getConsentValues().mode&&e.getConsentValues().pixels.includes("google-"+t))},e.getVisitorConsentStatusAndUpdateGoogleConsentSettings=function(t){return"category"===e.getConsentValues().mode?(e.getConsentValues().categories.analytics&&(t.analytics_storage="granted"),e.getConsentValues().categories.ads&&(t.ad_storage="granted")):"pixel"===e.getConsentValues().mode&&(t.analytics_storage=e.getConsentValues().pixels.includes("google-analytics")?"granted":"denied",t.ad_storage=e.getConsentValues().pixels.includes("google-ads")?"granted":"denied"),t},e.updateGoogleConsentMode=function(){let e=!(arguments.length>0&&arguments[0]!==o)||arguments[0],t=!(arguments.length>1&&arguments[1]!==o)||arguments[1];try{if(!window.gtag||!wpmDataLayer.shop.cookie_consent_mgmt.explicit_consent)return;gtag("consent","update",{analytics_storage:e?"granted":"denied",ad_storage:t?"granted":"denied"})}catch(e){console.error(e)}},e.fireGtagGoogleAds=function(){try{var e,t,o,a,r,n,i,s,d,l,c,u,p,g,m,y,w,v,f,_,h;if(wpmDataLayer.pixels.google.ads.state="loading",null!==(e=wpmDataLayer)&&void 0!==e&&null!==(t=e.pixels)&&void 0!==t&&null!==(o=t.google)&&void 0!==o&&null!==(a=o.ads)&&void 0!==a&&null!==(r=a.enhanced_conversions)&&void 0!==r&&r.active)for(const[e,t]of Object.entries(wpmDataLayer.pixels.google.ads.conversionIds))gtag("config",e,{allow_enhanced_conversions:!0});else for(const[e,t]of Object.entries(wpmDataLayer.pixels.google.ads.conversionIds))gtag("config",e);null!==(n=wpmDataLayer)&&void 0!==n&&null!==(i=n.pixels)&&void 0!==i&&null!==(s=i.google)&&void 0!==s&&null!==(d=s.ads)&&void 0!==d&&d.conversionIds&&null!==(l=wpmDataLayer)&&void 0!==l&&null!==(c=l.pixels)&&void 0!==c&&null!==(u=c.google)&&void 0!==u&&null!==(p=u.ads)&&void 0!==p&&p.phone_conversion_label&&null!==(g=wpmDataLayer)&&void 0!==g&&null!==(m=g.pixels)&&void 0!==m&&null!==(y=m.google)&&void 0!==y&&null!==(w=y.ads)&&void 0!==w&&w.phone_conversion_number&>ag("config",Object.keys(wpmDataLayer.pixels.google.ads.conversionIds)[0]+"/"+wpmDataLayer.pixels.google.ads.phone_conversion_label,{phone_conversion_number:wpmDataLayer.pixels.google.ads.phone_conversion_number}),"order_received_page"===wpmDataLayer.shop.page_type&&null!==(v=wpmDataLayer)&&void 0!==v&&null!==(f=v.order)&&void 0!==f&&null!==(_=f.google)&&void 0!==_&&null!==(h=_.ads)&&void 0!==h&&h.enhanced_conversion_data&&(window.enhanced_conversion_data=wpmDataLayer.order.google.ads.enhanced_conversion_data),wpmDataLayer.pixels.google.ads.state="ready"}catch(e){console.error(e)}},e.fireGtagGoogleAnalyticsUA=function(){try{wpmDataLayer.pixels.google.analytics.universal.state="loading",gtag("config",wpmDataLayer.pixels.google.analytics.universal.property_id,wpmDataLayer.pixels.google.analytics.universal.parameters),wpmDataLayer.pixels.google.analytics.universal.state="ready"}catch(e){console.error(e)}},e.fireGtagGoogleAnalyticsGA4=function(){try{wpmDataLayer.pixels.google.analytics.ga4.state="loading",gtag("config",wpmDataLayer.pixels.google.analytics.ga4.measurement_id,wpmDataLayer.pixels.google.analytics.ga4.parameters),wpmDataLayer.pixels.google.analytics.ga4.state="ready"}catch(e){console.error(e)}},e.isGoogleActive=function(){var e,t,o,a,r,n,i,s,d,l,c,u,p,g;return!(!(null!==(e=wpmDataLayer)&&void 0!==e&&null!==(t=e.pixels)&&void 0!==t&&null!==(o=t.google)&&void 0!==o&&null!==(a=o.analytics)&&void 0!==a&&null!==(r=a.universal)&&void 0!==r&&r.property_id||null!==(n=wpmDataLayer)&&void 0!==n&&null!==(i=n.pixels)&&void 0!==i&&null!==(s=i.google)&&void 0!==s&&null!==(d=s.analytics)&&void 0!==d&&null!==(l=d.ga4)&&void 0!==l&&l.measurement_id)&&jQuery.isEmptyObject(null===(c=wpmDataLayer)||void 0===c||null===(u=c.pixels)||void 0===u||null===(p=u.google)||void 0===p||null===(g=p.ads)||void 0===g?void 0:g.conversionIds))},e.getGoogleGtagId=function(){var e,t,o,a,r,n,i,s,d,l;return null!==(e=wpmDataLayer)&&void 0!==e&&null!==(t=e.pixels)&&void 0!==t&&null!==(o=t.google)&&void 0!==o&&null!==(a=o.analytics)&&void 0!==a&&null!==(r=a.universal)&&void 0!==r&&r.property_id?wpmDataLayer.pixels.google.analytics.universal.property_id:null!==(n=wpmDataLayer)&&void 0!==n&&null!==(i=n.pixels)&&void 0!==i&&null!==(s=i.google)&&void 0!==s&&null!==(d=s.analytics)&&void 0!==d&&null!==(l=d.ga4)&&void 0!==l&&l.measurement_id?wpmDataLayer.pixels.google.analytics.ga4.measurement_id:Object.keys(wpmDataLayer.pixels.google.ads.conversionIds)[0]},e.loadGoogle=function(){e.isGoogleActive()&&(wpmDataLayer.pixels.google.state="loading",e.loadScriptAndCacheIt("https://www.googletagmanager.com/gtag/js?id="+e.getGoogleGtagId()).done((function(t,o){try{var a,r,n,i,s,d,l,c,u,p,g,m,y,w,v,f,_,h,L,D,C,b;if(window.dataLayer=window.dataLayer||[],window.gtag=function(){dataLayer.push(arguments)},null!==(a=wpmDataLayer)&&void 0!==a&&null!==(r=a.pixels)&&void 0!==r&&null!==(n=r.google)&&void 0!==n&&null!==(i=n.consent_mode)&&void 0!==i&&i.active){var x,j,k,I;let t={ad_storage:wpmDataLayer.pixels.google.consent_mode.ad_storage,analytics_storage:wpmDataLayer.pixels.google.consent_mode.analytics_storage,wait_for_update:wpmDataLayer.pixels.google.consent_mode.wait_for_update};null!==(x=wpmDataLayer)&&void 0!==x&&null!==(j=x.pixels)&&void 0!==j&&null!==(k=j.google)&&void 0!==k&&null!==(I=k.consent_mode)&&void 0!==I&&I.region&&(t.region=wpmDataLayer.pixels.google.consent_mode.region),t=e.getVisitorConsentStatusAndUpdateGoogleConsentSettings(t),gtag("consent","default",t),gtag("set","ads_data_redaction",wpmDataLayer.pixels.google.consent_mode.ads_data_redaction),gtag("set","url_passthrough",wpmDataLayer.pixels.google.consent_mode.url_passthrough)}null!==(s=wpmDataLayer)&&void 0!==s&&null!==(d=s.pixels)&&void 0!==d&&null!==(l=d.google)&&void 0!==l&&null!==(c=l.linker)&&void 0!==c&&c.settings&>ag("set","linker",wpmDataLayer.pixels.google.linker.settings),gtag("js",new Date),jQuery.isEmptyObject(null===(u=wpmDataLayer)||void 0===u||null===(p=u.pixels)||void 0===p||null===(g=p.google)||void 0===g||null===(m=g.ads)||void 0===m?void 0:m.conversionIds)||(e.googleConfigConditionsMet("ads")?e.fireGtagGoogleAds():e.logPreventedPixelLoading("google-ads","ads")),null!==(y=wpmDataLayer)&&void 0!==y&&null!==(w=y.pixels)&&void 0!==w&&null!==(v=w.google)&&void 0!==v&&null!==(f=v.analytics)&&void 0!==f&&null!==(_=f.universal)&&void 0!==_&&_.property_id&&(e.googleConfigConditionsMet("analytics")?e.fireGtagGoogleAnalyticsUA():e.logPreventedPixelLoading("google-universal-analytics","analytics")),null!==(h=wpmDataLayer)&&void 0!==h&&null!==(L=h.pixels)&&void 0!==L&&null!==(D=L.google)&&void 0!==D&&null!==(C=D.analytics)&&void 0!==C&&null!==(b=C.ga4)&&void 0!==b&&b.measurement_id&&(e.googleConfigConditionsMet("analytics")?e.fireGtagGoogleAnalyticsGA4():e.logPreventedPixelLoading("ga4","analytics")),wpmDataLayer.pixels.google.state="ready"}catch(e){console.error(e)}})))},e.canGoogleLoad=function(){var t,o,a,r;return!(null===(t=wpmDataLayer)||void 0===t||null===(o=t.pixels)||void 0===o||null===(a=o.google)||void 0===a||null===(r=a.consent_mode)||void 0===r||!r.active)||("category"===e.getConsentValues().mode?!(!e.getConsentValues().categories.ads&&!e.getConsentValues().categories.analytics):"pixel"===e.getConsentValues().mode?e.getConsentValues().pixels.includes("google-ads")||e.getConsentValues().pixels.includes("google-analytics"):(console.error("Couldn't find a valid load condition for Google mode in wpmConsentValues"),!1))},e.gtagLoaded=function(){return new Promise((function(e,t){var o,a,r;void 0===(null===(o=wpmDataLayer)||void 0===o||null===(a=o.pixels)||void 0===a||null===(r=a.google)||void 0===r?void 0:r.state)&&t();let n=0;!function o(){var a,r,i;return"ready"===(null===(a=wpmDataLayer)||void 0===a||null===(r=a.pixels)||void 0===r||null===(i=r.google)||void 0===i?void 0:i.state)?e():n>=5e3?t():(n+=200,void setTimeout(o,200))}()}))}}(window.wpm=window.wpm||{},jQuery)},580:(e,t,o)=>{o(860),o(294)},69:(e,t,o)=>{o(580),o(190),o(774),o(463)},945:()=>{jQuery(document).on("wpmLoadPixels",(function(){var e,t,o,a,r,n,i,s;null===(e=wpmDataLayer)||void 0===e||null===(t=e.pixels)||void 0===t||null===(o=t.google)||void 0===o||null===(a=o.optimize)||void 0===a||!a.container_id||null!==(r=wpmDataLayer)&&void 0!==r&&null!==(n=r.pixels)&&void 0!==n&&null!==(i=n.google)&&void 0!==i&&null!==(s=i.optimize)&&void 0!==s&&s.loaded||wpm.canIFire("analytics","google-optimize")&&wpm.load_google_optimize_pixel()}))},962:()=>{!function(e,t,o){e.load_google_optimize_pixel=function(){try{wpmDataLayer.pixels.google.optimize.loaded=!0,e.loadScriptAndCacheIt("https://www.googleoptimize.com/optimize.js?id="+wpmDataLayer.pixels.google.optimize.container_id)}catch(e){console.error(e)}}}(window.wpm=window.wpm||{},jQuery)},463:(e,t,o)=>{o(962),o(945)},300:()=>{jQuery(document).on("wpmLoadPixels",(function(){var e,t,o,a,r,n,i,s,d;null===(e=wpmDataLayer)||void 0===e||null===(t=e.pixels)||void 0===t||null===(o=t.hotjar)||void 0===o||!o.site_id||null!==(a=wpmDataLayer)&&void 0!==a&&null!==(r=a.pixels)&&void 0!==r&&null!==(n=r.hotjar)&&void 0!==n&&n.loaded||!wpm.canIFire("analytics","hotjar")||null!==(i=wpmDataLayer)&&void 0!==i&&null!==(s=i.pixels)&&void 0!==s&&null!==(d=s.hotjar)&&void 0!==d&&d.loaded||wpm.load_hotjar_pixel()}))},376:()=>{!function(e,t,o){e.load_hotjar_pixel=function(){try{wpmDataLayer.pixels.hotjar.loaded=!0,e=window,t=document,e.hj=e.hj||function(){(e.hj.q=e.hj.q||[]).push(arguments)},e._hjSettings={hjid:wpmDataLayer.pixels.hotjar.site_id,hjsv:6},o=t.getElementsByTagName("head")[0],(a=t.createElement("script")).async=1,a.src="https://static.hotjar.com/c/hotjar-"+e._hjSettings.hjid+".js?sv="+e._hjSettings.hjsv,o.appendChild(a)}catch(e){console.error(e)}var e,t,o,a}}(window.wpm=window.wpm||{},jQuery)},787:(e,t,o)=>{o(376),o(300)},299:()=>{jQuery(document).on("click",".remove_from_cart_button, .remove",(function(){try{let e=new URL(jQuery(this).attr("href")),t=wpm.getProductIdByCartItemKeyUrl(e);wpm.removeProductFromCart(t)}catch(e){console.error(e)}})),jQuery(document).on("click",".add_to_cart_button:not(.product_type_variable), .ajax_add_to_cart, .single_add_to_cart_button",(function(){try{if("product"===wpmDataLayer.shop.page_type){if(void 0!==jQuery(this).attr("href")&&jQuery(this).attr("href").includes("add-to-cart")){let e=1,t=jQuery(this).data("product_id");wpm.addProductToCart(t,e)}else if("simple"===wpmDataLayer.shop.product_type){let e=Number(jQuery(".input-text.qty").val());e||0===e||(e=1);let t=jQuery(this).val();wpm.addProductToCart(t,e)}else if("variable"===wpmDataLayer.shop.product_type){let e=Number(jQuery(".input-text.qty").val());e||0===e||(e=1);let t=jQuery("[name='variation_id']").val();wpm.addProductToCart(t,e)}else if("grouped"===wpmDataLayer.shop.product_type)jQuery(".woocommerce-grouped-product-list-item").each((function(){let e=Number(jQuery(this).find(".input-text.qty").val());e||0===e||(e=1);let t=jQuery(this).attr("class"),o=wpm.getPostIdFromString(t);wpm.addProductToCart(o,e)}));else if("bundle"===wpmDataLayer.shop.product_type){let e=Number(jQuery(".input-text.qty").val());e||0===e||(e=1);let t=jQuery("input[name=add-to-cart]").val();wpm.addProductToCart(t,e)}}else{let e=1,t=jQuery(this).data("product_id");wpm.addProductToCart(t,e)}}catch(e){console.error(e)}})),jQuery(document).one("click","a:not(.add_to_cart_button, .ajax_add_to_cart, .single_add_to_cart_button)",(function(e){try{if(jQuery(e.target).closest("a").attr("href")){let t=jQuery(e.target).closest("a").attr("href");if(t.includes("add-to-cart=")){let e=t.match(/(add-to-cart=)(\d+)/);e&&wpm.addProductToCart(e[2],1)}}}catch(e){console.error(e)}})),jQuery(document).on("click",".woocommerce-LoopProduct-link, .wc-block-grid__product, .product, .product-small, .type-product",(function(){try{let e=jQuery(this).nextAll(".wpmProductId:first").data("id");if(e){if(e=getIdBasedOndVariationsOutputSetting(e),!e)throw Error("Wasn't able to retrieve a productId");if(wpmDataLayer.products&&wpmDataLayer.products[e]){let t=wpm.getProductDetailsFormattedForEvent(e);jQuery(document).trigger("wpmSelectContentGaUa",t),jQuery(document).trigger("wpmSelectItem",t)}}}catch(e){console.error(e)}})),jQuery(document).one("click",".checkout-button, .cart-checkout-button, .button.checkout",(function(){jQuery(document).trigger("wpmBeginCheckout")})),jQuery(document).on("input","#billing_email",(function(){wpm.isEmail(jQuery(this).val())&&(wpm.fireCheckoutProgress(2),wpm.emailSelected=!0)})),jQuery(document).on("click",".wc_payment_methods",(function(){!1===wpm.paymentMethodSelected&&wpm.fireCheckoutProgress(3),wpm.fireCheckoutOption(3,jQuery("input[name='payment_method']:checked").val()),wpm.paymentMethodSelected=!0})),jQuery(document).one("click","#place_order",(function(){!1===wpm.emailSelected&&wpm.fireCheckoutProgress(2),!1===wpm.paymentMethodSelected&&(wpm.fireCheckoutProgress(3),wpm.fireCheckoutOption(3,jQuery("input[name='payment_method']:checked").val())),wpm.fireCheckoutProgress(4)})),jQuery(document).on("click","[name='update_cart']",(function(){try{jQuery(".cart_item").each((function(){let e=new URL(jQuery(this).find(".product-remove").find("a").attr("href")),t=wpm.getProductIdByCartItemKeyUrl(e),o=jQuery(this).find(".qty").val();0===o?wpm.removeProductFromCart(t):o<wpmDataLayer.cart[t].quantity?wpm.removeProductFromCart(t,wpmDataLayer.cart[t].quantity-o):o>wpmDataLayer.cart[t].quantity&&wpm.addProductToCart(t,o-wpmDataLayer.cart[t].quantity)}))}catch(e){console.error(e),wpm.getCartItemsFromBackend()}})),jQuery(document).on("click",".add_to_wishlist, .wl-add-to",(function(){try{let e;if(jQuery(this).data("productid")?e=jQuery(this).data("productid"):jQuery(this).data("product-id")&&(e=jQuery(this).data("product-id")),!e)throw Error("Wasn't able to retrieve a productId");let t=wpm.getProductDetailsFormattedForEvent(e);jQuery(document).trigger("wpmAddToWishlist",t)}catch(e){console.error(e)}})),jQuery(document).on("updated_cart_totals",(function(){jQuery(document).trigger("wpmViewCart")})),jQuery(".single_variation_wrap").on("show_variation",(function(e,t){try{let e=getIdBasedOndVariationsOutputSetting(t.variation_id);if(!e)throw Error("Wasn't able to retrieve a productId");if(wpmDataLayer.products&&wpmDataLayer.products[e]){let t=wpm.getProductDetailsFormattedForEvent(e);jQuery(document).trigger("wpmViewItem",t)}}catch(e){console.error(e)}})),jQuery(".single_variation_wrap").on("hide_variation",(function(){try{var e,t;let o=jQuery("body").attr("class").match(/(postid-)(\d+)/)[2];if(!o)throw Error("Wasn't able to retrieve a productId");if("variable"===wpmDataLayer.shop.product_type&&null!==(e=wpmDataLayer)&&void 0!==e&&null!==(t=e.general)&&void 0!==t&&t.variationsOutput)for(const[e,t]of Object.entries(wpmDataLayer.products))if("parentId"in t){o=t.id;break}if(wpmDataLayer.products&&wpmDataLayer.products[o]){let e=wpm.getProductDetailsFormattedForEvent(o);jQuery(document).trigger("wpmViewItem",e)}}catch(e){console.error(e)}})),jQuery(window).on("wpmLoad",(function(){try{wpm.doesWooCommerceCartExist()&&wpm.getCartItems()}catch(e){console.error(e)}})),jQuery(window).on("wpmLoad",(function(){wpmDataLayer.products=wpmDataLayer.products||{};let e=wpm.getAddToCartLinkProductIds();wpm.getProductsFromBackend(e)})),jQuery(window).on("wpmLoad",(function(){if(!wpm.getCookie("wpmReferrer"))if(document.referrer){let e=new URL(document.referrer).hostname;e!==window.location.host?wpm.setCookie("wpmReferrer",e):wpm.setCookie("wpmReferrer","")}else wpm.setCookie("wpmReferrer","")})),jQuery(window).on("wpmLoad",(function(){try{var e;if("undefined"!=typeof wpmDataLayer&&(null===(e=wpmDataLayer)||void 0===e||!e.wpmLoadFired)){var t,o;if(jQuery(document).trigger("wpmLoadAlways"),"product"===wpmDataLayer.shop.page_type&&"variable"!==wpmDataLayer.shop.product_type&&wpm.getMainProductIdFromProductPage()){let e=wpm.getProductDataForViewItemEvent(wpm.getMainProductIdFromProductPage());jQuery(document).trigger("wpmViewItem",e)}else"product_category"===wpmDataLayer.shop.page_type?jQuery(document).trigger("wpmCategory"):"search"===wpmDataLayer.shop.page_type?jQuery(document).trigger("wpmSearch"):"cart"===wpmDataLayer.shop.page_type?jQuery(document).trigger("wpmViewCart"):"order_received_page"===wpmDataLayer.shop.page_type&&wpmDataLayer.order?wpm.isOrderIdStored(wpmDataLayer.order.id)||(jQuery(document).trigger("wpmOrderReceivedPage"),wpm.writeOrderIdToStorage(wpmDataLayer.order.id)):jQuery(document).trigger("wpmEverywhereElse");null!==(t=wpmDataLayer)&&void 0!==t&&null!==(o=t.user)&&void 0!==o&&o.id&&!wpm.hasLoginEventFired()&&(jQuery(document).trigger("wpmLogin"),wpm.setLoginEventFired()),wpmDataLayer.wpmLoadFired=!0}}catch(e){console.error(e)}})),jQuery(window).on("wpmPreLoadPixels",(function(){var e,t,o;null!==(e=wpmDataLayer)&&void 0!==e&&null!==(t=e.shop)&&void 0!==t&&null!==(o=t.cookie_consent_mgmt)&&void 0!==o&&o.explicit_consent&&wpm.updateConsentCookieValues(!0),jQuery(document).trigger("wpmLoadPixels",{})}))},584:()=>{!function(e,t,o){const a="_wpm_order_ids",r="_wpm_endpoint_available",n="/wp-json/";function i(){return""!==e.getCookie(a)}e.emailSelected=!1,e.paymentMethodSelected=!1,e.useRestEndpoint=function(){return e.isSessionStorageAvailable()&&e.isRestEndpointAvailable()&&e.isBelowRestErrorThreshold()},e.isBelowRestErrorThreshold=function(){return window.sessionStorage.getItem(0)<=10},e.isRestEndpointAvailable=function(){if(window.sessionStorage.getItem(r))return JSON.parse(window.sessionStorage.getItem(r));e.testEndpoint()},e.isSessionStorageAvailable=function(){return!!window.sessionStorage},e.testEndpoint=function(){let e=arguments.length>0&&arguments[0]!==o?arguments[0]:location.protocol+"//"+location.host+n,t=arguments.length>1&&arguments[1]!==o?arguments[1]:r;jQuery.ajax(e,{type:"HEAD",timeout:1e3,statusCode:{200:function(e){window.sessionStorage.setItem(t,JSON.stringify(!0))},404:function(e){window.sessionStorage.setItem(t,JSON.stringify(!1))},0:function(e){window.sessionStorage.setItem(t,JSON.stringify(!1))}}}).then((e=>{}))},e.isWpmRestEndpointAvailable=function(){let t=arguments.length>0&&arguments[0]!==o?arguments[0]:r;return!!e.getCookie(t)},e.writeOrderIdToStorage=function(t){if(window.Storage)if(null===localStorage.getItem(a)){let e=[];e.push(t),window.localStorage.setItem(a,JSON.stringify(e))}else{let e=JSON.parse(localStorage.getItem(a));e.includes(t)||(e.push(t),window.localStorage.setItem(a,JSON.stringify(e)))}else{let o=new Date;o.setDate(o.getDate()+365);let r=[];i()&&(r=JSON.parse(e.getCookie(a))),r.includes(t)||(r.push(t),document.cookie="_wpm_order_ids="+JSON.stringify(r)+";expires="+o.toUTCString())}"function"==typeof e.storeOrderIdOnServer&&wpmDataLayer.orderDeduplication&&e.storeOrderIdOnServer(t)},e.isOrderIdStored=function(t){return wpmDataLayer.orderDeduplication?window.Storage?null!==localStorage.getItem(a)&&JSON.parse(localStorage.getItem(a)).includes(t):!!i()&&JSON.parse(e.getCookie(a)).includes(t):(console.log("order duplication prevention: off"),!1)},e.isEmail=function(e){return/^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/.test(e)},e.removeProductFromCart=function(t){let a=arguments.length>1&&arguments[1]!==o?arguments[1]:null;try{if(!t)throw Error("Wasn't able to retrieve a productId");if(!(t=getIdBasedOndVariationsOutputSetting(t)))throw Error("Wasn't able to retrieve a productId");let o;if(o=null==a?wpmDataLayer.cart[t].quantity:a,wpmDataLayer.cart[t]){let r=e.getProductDetailsFormattedForEvent(t,o);jQuery(document).trigger("wpmRemoveFromCart",r),null==a||wpmDataLayer.cart[t].quantity===a?(delete wpmDataLayer.cart[t],sessionStorage&&sessionStorage.setItem("wpmDataLayerCart",JSON.stringify(wpmDataLayer.cart))):(wpmDataLayer.cart[t].quantity=wpmDataLayer.cart[t].quantity-o,sessionStorage&&sessionStorage.setItem("wpmDataLayerCart",JSON.stringify(wpmDataLayer.cart)))}}catch(e){console.error(e)}},getIdBasedOndVariationsOutputSetting=function(e){try{var t,o;return null!==(t=wpmDataLayer)&&void 0!==t&&null!==(o=t.general)&&void 0!==o&&o.variationsOutput?e:wpmDataLayer.products[e].isVariation?wpmDataLayer.products[e].parentId:e}catch(e){console.error(e)}},e.addProductToCart=function(t,o){try{var a;if(!t)throw Error("Wasn't able to retrieve a productId");if(!(t=getIdBasedOndVariationsOutputSetting(t)))throw Error("Wasn't able to retrieve a productId");if(null!==(a=wpmDataLayer)&&void 0!==a&&a.products[t]){var r;let a=e.getProductDetailsFormattedForEvent(t,o);jQuery(document).trigger("wpmAddToCart",a),null!==(r=wpmDataLayer)&&void 0!==r&&r.cart[t]?wpmDataLayer.cart[t].quantity=wpmDataLayer.cart[t].quantity+o:("cart"in wpmDataLayer||(wpmDataLayer.cart={}),wpmDataLayer.cart[t]=e.getProductDetailsFormattedForEvent(t,o)),sessionStorage&&sessionStorage.setItem("wpmDataLayerCart",JSON.stringify(wpmDataLayer.cart))}}catch(t){console.error(t),e.getCartItemsFromBackend()}},e.getCartItems=function(){sessionStorage?sessionStorage.getItem("wpmDataLayerCart")&&"order_received_page"!==wpmDataLayer.shop.page_type?e.saveCartObjectToDataLayer(JSON.parse(sessionStorage.getItem("wpmDataLayerCart"))):sessionStorage.setItem("wpmDataLayerCart",JSON.stringify({})):e.getCartItemsFromBackend()},e.getCartItemsFromBackend=function(){try{let t={action:"wpm_get_cart_items"};jQuery.ajax({type:"get",dataType:"json",url:e.ajax_url,data:t,success:function(t){t.cart||(t.cart={}),e.saveCartObjectToDataLayer(t.cart),sessionStorage&&sessionStorage.setItem("wpmDataLayerCart",JSON.stringify(t.cart))}})}catch(e){console.error(e)}},e.getProductsFromBackend=function(t){if((t=t.filter((e=>!wpmDataLayer.products.hasOwnProperty(e))))&&0!==t.length)try{let o={action:"wpm_get_product_ids",productIds:t};jQuery.ajax({type:"get",dataType:"json",url:e.ajax_url,data:o,success:function(e){wpmDataLayer.products=Object.assign({},wpmDataLayer.products,e)},error:function(e){console.log(e)}})}catch(e){console.error(e)}},e.saveCartObjectToDataLayer=function(e){wpmDataLayer.cart=e,wpmDataLayer.products=Object.assign({},wpmDataLayer.products,e)},e.fireCheckoutOption=function(e){let t=arguments.length>1&&arguments[1]!==o?arguments[1]:null,a=arguments.length>2&&arguments[2]!==o?arguments[2]:null,r={step:e,checkout_option:t,value:a};jQuery(document).trigger("wpmFireCheckoutOption",r)},e.fireCheckoutProgress=function(e){let t={step:e};jQuery(document).trigger("wpmFireCheckoutProgress",t)},e.getPostIdFromString=function(e){try{return e.match(/(post-)(\d+)/)[2]}catch(e){console.error(e)}},e.triggerViewItemList=function(t){if(!t)throw Error("Wasn't able to retrieve a productId");if(!(t=getIdBasedOndVariationsOutputSetting(t)))throw Error("Wasn't able to retrieve a productId");jQuery(document).trigger("wpmViewItemList",e.getProductDataForViewItemEvent(t))},e.getProductDataForViewItemEvent=function(t){if(!t)throw Error("Wasn't able to retrieve a productId");try{if(wpmDataLayer.products[t])return e.getProductDetailsFormattedForEvent(t)}catch(e){console.error(e)}},e.getMainProductIdFromProductPage=function(){try{return["simple","variable","grouped","composite","bundle"].indexOf(wpmDataLayer.shop.product_type)>=0&&jQuery(".wpmProductId:first").data("id")}catch(e){console.error(e)}},e.viewItemListTriggerTestMode=function(e){jQuery(e).css({position:"relative"}),jQuery(e).append('<div id="viewItemListTriggerOverlay"></div>'),jQuery(e).find("#viewItemListTriggerOverlay").css({"z-index":"10",display:"block",position:"absolute",height:"100%",top:"0",left:"0",right:"0",opacity:wpmDataLayer.viewItemListTrigger.opacity,"background-color":wpmDataLayer.viewItemListTrigger.backgroundColor})},e.getSearchTermFromUrl=function(){try{return new URLSearchParams(window.location.search).get("s")}catch(e){console.error(e)}};let s,d={};e.observerCallback=function(t,o){t.forEach((t=>{try{let a,r=jQuery(t.target).data("ioid");if(a=jQuery(t.target).next(".wpmProductId").length?jQuery(t.target).next(".wpmProductId").data("id"):jQuery(t.target).find(".wpmProductId").data("id"),!a)throw Error("wpmProductId element not found");t.isIntersecting?d[r]=setTimeout((()=>{e.triggerViewItemList(a),wpmDataLayer.viewItemListTrigger.testMode&&e.viewItemListTriggerTestMode(t.target),!1===wpmDataLayer.viewItemListTrigger.repeat&&o.unobserve(t.target)}),wpmDataLayer.viewItemListTrigger.timeout):(clearTimeout(d[r]),wpmDataLayer.viewItemListTrigger.testMode&&jQuery(t.target).find("#viewItemListTriggerOverlay").remove())}catch(e){console.error(e)}}))};let l,c=0;e.startIntersectionObserverToWatch=function(){try{e.urlHasParameter("vildemomode")&&(wpmDataLayer.viewItemListTrigger.testMode=!0),s=new IntersectionObserver(e.observerCallback,{threshold:wpmDataLayer.viewItemListTrigger.threshold}),l=jQuery(".wpmProductId").map((function(e,t){return jQuery(t).parent().hasClass("type-product")||jQuery(t).parent().hasClass("product")||jQuery(t).parent().hasClass("product-item-inner")?jQuery(t).parent():jQuery(t).prev().hasClass("wc-block-grid__product")||jQuery(t).prev().hasClass("product")||jQuery(t).prev().hasClass("product-small")||jQuery(t).prev().hasClass("woocommerce-LoopProduct-link")?jQuery(this).prev():jQuery(t).closest(".product").length?jQuery(t).closest(".product"):void 0})),l.each((function(e,t){jQuery(t[0]).data("ioid",c++),s.observe(t[0])}))}catch(e){console.error(e)}},e.startProductsMutationObserverToWatch=function(){try{let e=jQuery(".wpmProductId:eq(0)").parents().has(jQuery(".wpmProductId:eq(1)").parents()).first();e.length&&u.observe(e[0],{attributes:!0,childList:!0,characterData:!0})}catch(e){console.error(e)}};let u=new MutationObserver((function(e){e.forEach((function(e){let t=e.addedNodes;null!==t&&jQuery(t).each((function(){(jQuery(this).hasClass("type-product")||jQuery(this).hasClass("product-small")||jQuery(this).hasClass("wc-block-grid__product"))&&p(this)&&(jQuery(this).data("ioid",c++),s.observe(this))}))}))})),p=function(e){return!(!jQuery(e).find(".wpmProductId").length&&!jQuery(e).siblings(".wpmProductId").length)};e.setCookie=function(e){let t=arguments.length>1&&arguments[1]!==o?arguments[1]:"",a=arguments.length>2&&arguments[2]!==o?arguments[2]:null;if(a){let o=new Date;o.setTime(o.getTime()+24*a*60*60*1e3);let r="expires="+o.toUTCString();document.cookie=e+"="+t+";"+r+";path=/"}else document.cookie=e+"="+t+";path=/"},e.getCookie=function(e){let t=e+"=",o=decodeURIComponent(document.cookie).split(";");for(let e=0;e<o.length;e++){let a=o[e];for(;" "==a.charAt(0);)a=a.substring(1);if(0==a.indexOf(t))return a.substring(t.length,a.length)}return""},e.getWpmSessionData=function(){if(window.sessionStorage){let e=window.sessionStorage.getItem("_wpm");return null!==e?JSON.parse(e):{}}return{}},e.setWpmSessionData=function(e){window.sessionStorage&&window.sessionStorage.setItem("_wpm",JSON.stringify(e))},e.storeOrderIdOnServer=function(t){try{let o={action:"wpm_purchase_pixels_fired",order_id:t,nonce:e.nonce};jQuery.ajax({type:"post",dataType:"json",url:e.ajax_url,data:o,success:function(e){!1===e.success&&console.log(e)},error:function(e){console.log(e)}})}catch(e){console.error(e)}},e.getProductIdByCartItemKeyUrl=function(e){let t,o=new URLSearchParams(e.search).get("remove_item");return t=0===wpmDataLayer.cartItemKeys[o].variation_id?wpmDataLayer.cartItemKeys[o].product_id:wpmDataLayer.cartItemKeys[o].variation_id,t},e.getAddToCartLinkProductIds=function(){return jQuery("a").map((function(){let e=jQuery(this).attr("href");if(e&&e.includes("?add-to-cart=")){let t=e.match(/(add-to-cart=)(\d+)/);if(t)return t[2]}})).get()},e.getProductDetailsFormattedForEvent=function(e){let t=arguments.length>1&&arguments[1]!==o?arguments[1]:1,a={id:e.toString(),dyn_r_ids:wpmDataLayer.products[e].dyn_r_ids,name:wpmDataLayer.products[e].name,list_name:wpmDataLayer.shop.list_name,brand:wpmDataLayer.products[e].brand,category:wpmDataLayer.products[e].category,variant:wpmDataLayer.products[e].variant,list_position:wpmDataLayer.products[e].position,quantity:t,price:wpmDataLayer.products[e].price,currency:wpmDataLayer.shop.currency,isVariable:wpmDataLayer.products[e].isVariable,isVariation:wpmDataLayer.products[e].isVariation,parentId:wpmDataLayer.products[e].parentId};return a.isVariation&&(a.parentId_dyn_r_ids=wpmDataLayer.products[e].parentId_dyn_r_ids),a},e.setReferrerToCookie=function(){e.getCookie("wpmReferrer")||e.setCookie("wpmReferrer",document.referrer)},e.getReferrerFromCookie=function(){return e.getCookie("wpmReferrer")?e.getCookie("wpmReferrer"):null},e.getClidFromBrowser=function(){let t,a=arguments.length>0&&arguments[0]!==o?arguments[0]:"gclid";return t={gclid:"_gcl_aw",dclid:"_gcl_dc"},e.getCookie(t[a])?e.getCookie(t[a]).match(/(GCL.[\d]*.)(.*)/)[2]:""},e.getUserAgent=function(){return navigator.userAgent},e.getViewPort=function(){return{width:Math.max(document.documentElement.clientWidth||0,window.innerWidth||0),height:Math.max(document.documentElement.clientHeight||0,window.innerHeight||0)}};let g=function(){let t=e.getCookie("cmplz_statistics"),o=e.getCookie("cmplz_marketing");return!(!e.getCookie("cmplz_consent_status")&&!e.getCookie("cmplz_banner-status"))&&{analytics:"allow"===t,ads:"allow"===o,visitorHasChosen:!0}},m=function(){let t=e.getCookie("cookielawinfo-checkbox-analytics")||e.getCookie("cookielawinfo-checkbox-analytiques"),o=e.getCookie("cookielawinfo-checkbox-advertisement")||e.getCookie("cookielawinfo-checkbox-publicite"),a=e.getCookie("CookieLawInfoConsent");return!(!t&&!o)&&{analytics:"yes"===t,ads:"yes"===o,visitorHasChosen:!!a}},y={categories:{},pixels:[],mode:"category",visitorHasChosen:!1};e.getConsentValues=function(){return y},e.setConsentValueCategories=function(){let e=arguments.length>0&&arguments[0]!==o&&arguments[0],t=arguments.length>1&&arguments[1]!==o&&arguments[1];y.categories.analytics=e,y.categories.ads=t},e.updateConsentCookieValues=function(){let t,a=arguments.length>0&&arguments[0]!==o&&arguments[0];if(t=e.getCookie("CookieConsent"))t=decodeURI(t),y.categories.analytics=t.indexOf("statistics:true")>=0,y.categories.ads=t.indexOf("marketing:true")>=0,y.visitorHasChosen=!0;else if(t=e.getCookie("CookieScriptConsent"))t=JSON.parse(t),"reject"===t.action?(y.categories.analytics=!1,y.categories.ads=!1):2===t.categories.length?(y.categories.analytics=!0,y.categories.ads=!0):(y.categories.analytics=t.categories.indexOf("performance")>=0,y.categories.ads=t.categories.indexOf("targeting")>=0),y.visitorHasChosen=!0;else if(t=e.getCookie("borlabs-cookie")){var r,n,i,s,d,l,c,u;t=decodeURI(t),t=JSON.parse(t),y.categories.analytics=!(null===(r=t)||void 0===r||null===(n=r.consents)||void 0===n||!n.statistics),y.categories.ads=!(null===(i=t)||void 0===i||null===(s=i.consents)||void 0===s||!s.marketing),y.visitorHasChosen=!0,y.pixels=[...(null===(d=t)||void 0===d||null===(l=d.consents)||void 0===l?void 0:l.statistics)||[],...(null===(c=t)||void 0===c||null===(u=c.consents)||void 0===u?void 0:u.marketing)||[]],y.mode="pixel"}else(t=g())?(y.categories.analytics=!0===t.analytics,y.categories.ads=!0===t.ads,y.visitorHasChosen=t.visitorHasChosen):(t=e.getCookie("cookie_notice_accepted"))?(y.categories.analytics=!0,y.categories.ads=!0,y.visitorHasChosen=!0):(t=e.getCookie("hu-consent"))?(t=JSON.parse(t),y.categories.analytics=!!t.categories[3],y.categories.ads=!!t.categories[4],y.visitorHasChosen=!0):(t=m())?(y.categories.analytics=!0===t.analytics,y.categories.ads=!0===t.ads,y.visitorHasChosen=!0===t.visitorHasChosen):(t=e.getCookie("moove_gdpr_popup"))?(t=JSON.parse(t),y.categories.analytics="1"===t.thirdparty,y.categories.ads="1"===t.advanced,y.visitorHasChosen=!0):(y.categories.analytics=!a,y.categories.ads=!a)},e.updateConsentCookieValues(),e.setConsentDefaultValuesToExplicit=function(){y.categories={analytics:!1,ads:!1}},e.canIFire=function(t,o){let a;return"category"===y.mode?a=!!y.categories[t]:"pixel"===y.mode?a=y.pixels.includes(o):(console.error("Couldn't find a valid consent mode in wpmConsentValues"),a=!1),!!a||(e.logPreventedPixelLoading(o,t),!1)},e.logPreventedPixelLoading=function(e,t){var o,a,r;null!==(o=wpmDataLayer)&&void 0!==o&&null!==(a=o.shop)&&void 0!==a&&null!==(r=a.cookie_consent_mgmt)&&void 0!==r&&r.explicit_consent?console.log('WooCommerce Pixel Manager: The "'+e+" (category: "+t+')" pixel has not fired because you have not given consent for it yet. (WPM is in explicit consent mode.)'):console.log('WooCommerce Pixel Manager: The "'+e+" (category: "+t+')" pixel has not fired because you have removed consent for this pixel. (WPM is in implicit consent mode.)')},e.scriptTagObserver=new MutationObserver((o=>{o.forEach((o=>{let{addedNodes:a}=o;[...a].forEach((o=>{t(o).data("wpm-cookie-category")&&(e.shouldScriptBeActive(o)?e.unblockScript(o):e.blockScript(o))}))}))})),e.scriptTagObserver.observe(document.head,{childList:!0,subtree:!0}),window.addEventListener("DOMContentLoaded",(()=>e.scriptTagObserver.disconnect())),e.shouldScriptBeActive=function(e){var o,a,r,n;return!((wpmDataLayer.shop.cookie_consent_mgmt.explicit_consent||y.visitorHasChosen)&&("category"!==y.mode||!t(e).data("wpm-cookie-category").split(",").some((e=>y.categories[e])))&&("pixel"!==y.mode||!y.pixels.includes(t(e).data("wpm-pixel-name")))&&("pixel"!==y.mode||"google"!==t(e).data("wpm-pixel-name")||!["google-analytics","google-ads"].some((e=>y.pixels.includes(e))))&&(null===(o=wpmDataLayer)||void 0===o||null===(a=o.pixels)||void 0===a||null===(r=a.google)||void 0===r||null===(n=r.consent_mode)||void 0===n||!n.active||"google"!==t(e).data("wpm-pixel-name")))},e.unblockScript=function(e){let a=arguments.length>1&&arguments[1]!==o&&arguments[1];a&&t(e).remove();let r=t(e).data("wpm-src");r&&t(e).attr("src",r),e.type="text/javascript",a&&t(e).appendTo("head"),jQuery(document).trigger("wpmPreLoadPixels",{})},e.blockScript=function(e){let a=arguments.length>1&&arguments[1]!==o&&arguments[1];a&&t(e).remove(),t(e).attr("src")&&t(e).removeAttr("src"),e.type="blocked/javascript",a&&t(e).appendTo("head")},e.unblockAllScripts=function(){let a=!(arguments.length>0&&arguments[0]!==o)||arguments[0],r=!(arguments.length>1&&arguments[1]!==o)||arguments[1];t.each(t('script[type="blocked/javascript"]'),(function(o,n){(t(n).data("wpm-cookie-category").includes("analytics")&&a||t(n).data("wpm-cookie-category").includes("ads")&&r)&&e.unblockScript(n,!0)})),jQuery(document).trigger("wpmPreLoadPixels",{})},e.unblockSelectedPixels=function(){t.each(t('script[type="blocked/javascript"]'),(function(o,a){(y.pixels.includes(t(a).data("wpm-pixel-name"))||"google"===t(a).data("wpm-pixel-name")&&["google-analytics","google-ads"].some((e=>y.pixels.includes(e))))&&e.unblockScript(a,!0)})),jQuery(document).trigger("wpmPreLoadPixels",{})},window.addEventListener("borlabs-cookie-consent-saved",(function(){e.updateConsentCookieValues(),"pixel"===y.mode?(e.unblockSelectedPixels(),e.updateGoogleConsentMode(y.pixels.includes("google-analytics"),y.pixels.includes("google-ads"))):(e.unblockAllScripts(y.categories.analytics,y.categories.ads),e.updateGoogleConsentMode(y.categories.analytics,y.categories.ads))})),window.addEventListener("CookiebotOnAccept",(function(){Cookiebot.consent.statistics&&(y.categories.analytics=!0),Cookiebot.consent.marketing&&(y.categories.ads=!0),e.unblockAllScripts(y.categories.analytics,y.categories.ads),e.updateGoogleConsentMode(y.categories.analytics,y.categories.ads)}),!1),window.addEventListener("CookieScriptAccept",(function(t){t.detail.categories.includes("performance")&&(y.categories.analytics=!0),t.detail.categories.includes("targeting")&&(y.categories.ads=!0),e.unblockAllScripts(y.categories.analytics,y.categories.ads),e.updateGoogleConsentMode(y.categories.analytics,y.categories.ads)})),window.addEventListener("CookieScriptAcceptAll",(function(){e.unblockAllScripts(!0,!0),e.updateGoogleConsentMode(!0,!0)})),document.addEventListener("cmplzStatusChange",(function(){e.updateConsentCookieValues(),e.unblockAllScripts(y.categories.analytics,y.categories.ads),e.updateGoogleConsentMode(y.categories.analytics,y.categories.ads)})),document.addEventListener("setCookieNotice",(function(){e.updateConsentCookieValues(),e.unblockAllScripts(y.categories.analytics,y.categories.ads),e.updateGoogleConsentMode(y.categories.analytics,y.categories.ads)})),e.huObserver=new MutationObserver((function(t){t.forEach((t=>{let{addedNodes:o}=t;[...o].forEach((t=>{"hu"===t.id&&jQuery(".hu-cookies-save").on("click",(function(){e.updateConsentCookieValues(),e.unblockAllScripts(y.categories.analytics,y.categories.ads),e.updateGoogleConsentMode(y.categories.analytics,y.categories.ads)}))}))}))})),window.hu&&e.huObserver.observe(document.documentElement||document.body,{childList:!0,subtree:!0}),e.version=function(){console.log(wpmDataLayer.version)},e.loadScriptAndCacheIt=function(e,t){return t=jQuery.extend(t||{},{dataType:"script",cache:!0,url:e}),jQuery.ajax(t)},e.getOrderItemPrice=function(e){return(e.total+e.total_tax)/e.quantity},e.hasLoginEventFired=function(){let t=e.getWpmSessionData();return null==t?void 0:t.loginEventFired},e.setLoginEventFired=function(){let t=e.getWpmSessionData();t.loginEventFired=!0,e.setWpmSessionData(t)},e.wpmDataLayerExists=function(){return new Promise((function(e){!function t(){if("undefined"!=typeof wpmDataLayer)return e();setTimeout(t,50)}()}))},e.jQueryExists=function(){return new Promise((function(e){!function t(){if("undefined"!=typeof jQuery)return e();setTimeout(t,100)}()}))},e.pageLoaded=function(){return new Promise((function(e){!function t(){if("complete"===document.readyState)return e();setTimeout(t,50)}()}))},e.pageReady=function(){return new Promise((function(e){!function t(){if("interactive"===document.readyState||"complete"===document.readyState)return e();setTimeout(t,50)}()}))},e.isMiniCartActive=function(){if(window.sessionStorage){for(const[e,t]of Object.entries(window.sessionStorage))if(e.includes("wc_fragments"))return!0;return!1}return!1},e.doesWooCommerceCartExist=function(){return document.cookie.includes("woocommerce_items_in_cart")},e.urlHasParameter=function(e){return new URLSearchParams(window.location.search).has(e)},window.wpmLoaded={}}(window.wpm=window.wpm||{},jQuery)},534:(e,t,o)=>{o(584)},207:()=>{wpm.wpmDataLayerExists().then((function(){console.log("WooCommerce Pixel Manager: "+(wpmDataLayer.version.pro?"Pro":"Free")+" Version "+wpmDataLayer.version.number+" loaded"),jQuery(document).trigger("wpmPreLoadPixels",{})})).then((function(){wpm.pageLoaded().then((function(){jQuery(document).trigger("wpmLoad",{})}))})),wpm.pageReady().then((function(){wpm.wpmDataLayerExists().then((function(){wpm.startIntersectionObserverToWatch(),wpm.startProductsMutationObserverToWatch()}))}))}},t={};function o(a){var r=t[a];if(void 0!==r)return r.exports;var n=t[a]={exports:{}};return e[a](n,n.exports,o),n.exports}o(534),wpm.jQueryExists().then((function(){o(299),o(69),o(12),o(787),o(207)}))})();
|
2 |
//# sourceMappingURL=wpm-public.p1.min.js.map
|
1 |
+
(()=>{var e={785:()=>{!function(e,t,a){let o;e.loadFacebookPixel=function(){try{var e,t,a;null!==(e=wpmDataLayer)&&void 0!==e&&null!==(t=e.pixels)&&void 0!==t&&null!==(a=t.facebook)&&void 0!==a&&a.pixel_id&&(wpmDataLayer.pixels.facebook.loaded=!0,o=window,r=document,n="script",o.fbq||(i=o.fbq=function(){i.callMethod?i.callMethod.apply(i,arguments):i.queue.push(arguments)},o._fbq||(o._fbq=i),i.push=i,i.loaded=!0,i.version="2.0",i.queue=[],(s=r.createElement(n)).async=!0,s.src="https://connect.facebook.net/en_US/fbevents.js",(d=r.getElementsByTagName(n)[0]).parentNode.insertBefore(s,d)),fbq("init",wpmDataLayer.pixels.facebook.pixel_id),fbq("track","PageView"))}catch(n){console.error(n)}var o,r,n,i,s,d},e.getRandomEventId=function(){return(Math.random()+1).toString(36).substring(2)},e.getFbUserData=function(){return o||e.getFbUserDataFromBrowser()},e.setFbUserData=function(){o=e.getFbUserDataFromBrowser()},e.getFbUserDataFromBrowser=function(){return{fbp:e.getCookie("_fbp"),fbc:e.getCookie("_fbc"),client_user_agent:navigator.userAgent}},e.fbViewContent=function(t){try{var a,o,r;if(null===(a=wpmDataLayer)||void 0===a||null===(o=a.pixels)||void 0===o||null===(r=o.facebook)||void 0===r||!r.loaded)return;let n=e.getRandomEventId();fbq("track","ViewContent",{content_type:"product",content_name:t.name,content_ids:t.dyn_r_ids[wpmDataLayer.pixels.facebook.dynamic_remarketing.id_type],currency:wpmDataLayer.shop.currency,value:t.price},{eventID:n}),t.currency=wpmDataLayer.shop.currency,jQuery(document).trigger("wpmFbCapiEvent",{event_name:"ViewContent",event_id:n,user_data:e.getFbUserData(),product_data:t,product_id:t.dyn_r_ids[wpmDataLayer.pixels.facebook.dynamic_remarketing.id_type],event_source_url:window.location.href})}catch(e){console.error(e)}},e.facebookContentIds=function(){let e=[];for(const[o,r]of Object.entries(wpmDataLayer.order.items)){var t,a;null!==(t=wpmDataLayer)&&void 0!==t&&null!==(a=t.general)&&void 0!==a&&a.variationsOutput&&0!==r.variation_id?e.push(String(wpmDataLayer.products[r.variation_id].dyn_r_ids[wpmDataLayer.pixels.facebook.dynamic_remarketing.id_type])):e.push(String(wpmDataLayer.products[r.id].dyn_r_ids[wpmDataLayer.pixels.facebook.dynamic_remarketing.id_type]))}return e}}(window.wpm=window.wpm||{},jQuery),jQuery(document).on("wpmLoadPixels",(function(){var e,t,a;!wpm.canIFire("ads","facebook-ads")||null!==(e=wpmDataLayer)&&void 0!==e&&null!==(t=e.pixels)&&void 0!==t&&null!==(a=t.facebook)&&void 0!==a&&a.loaded||wpm.loadFacebookPixel()})),jQuery(document).on("wpmAddToCart",(function(e,t){try{var a,o,r;if(null===(a=wpmDataLayer)||void 0===a||null===(o=a.pixels)||void 0===o||null===(r=o.facebook)||void 0===r||!r.loaded)return;let e=wpm.getRandomEventId();fbq("track","AddToCart",{content_type:"product",content_name:t.name,content_ids:t.dyn_r_ids[wpmDataLayer.pixels.facebook.dynamic_remarketing.id_type],value:parseFloat(t.quantity*t.price),currency:t.currency},{eventID:e}),t.currency=wpmDataLayer.shop.currency,jQuery(document).trigger("wpmFbCapiEvent",{event_name:"AddToCart",event_id:e,user_data:wpm.getFbUserData(),product_data:t,product_id:t.dyn_r_ids[wpmDataLayer.pixels.facebook.dynamic_remarketing.id_type],event_source_url:window.location.href})}catch(e){console.error(e)}})),jQuery(document).on("wpmBeginCheckout",(function(e){try{var t,a,o;if(null===(t=wpmDataLayer)||void 0===t||null===(a=t.pixels)||void 0===a||null===(o=a.facebook)||void 0===o||!o.loaded)return;let e=wpm.getRandomEventId();fbq("track","InitiateCheckout",{},{eventID:e}),jQuery(document).trigger("wpmFbCapiEvent",{event_name:"InitiateCheckout",event_id:e,user_data:wpm.getFbUserData(),event_source_url:window.location.href})}catch(e){console.error(e)}})),jQuery(document).on("wpmAddToWishlist",(function(e,t){try{var a,o,r;if(null===(a=wpmDataLayer)||void 0===a||null===(o=a.pixels)||void 0===o||null===(r=o.facebook)||void 0===r||!r.loaded)return;let e=wpm.getRandomEventId();fbq("track","AddToWishlist",{content_type:"product",content_name:t.name,content_ids:t.dyn_r_ids[wpmDataLayer.pixels.facebook.dynamic_remarketing.id_type],value:parseFloat(t.quantity*t.price),currency:t.currency},{eventID:e}),t.currency=wpmDataLayer.shop.currency,jQuery(document).trigger("wpmFbCapiEvent",{event_name:"AddToWishlist",event_id:e,user_data:wpm.getFbUserData(),product_data:t,product_id:t.dyn_r_ids[wpmDataLayer.pixels.facebook.dynamic_remarketing.id_type],event_source_url:window.location.href})}catch(e){console.error(e)}})),jQuery(document).on("wpmViewItem",(function(e,t){try{var a,o,r;if(null===(a=wpmDataLayer)||void 0===a||null===(o=a.pixels)||void 0===o||null===(r=o.facebook)||void 0===r||!r.loaded)return;wpm.fbViewContent(t)}catch(e){console.error(e)}})),jQuery(document).on("wpmSearch",(function(){try{var e,t,a;if(null===(e=wpmDataLayer)||void 0===e||null===(t=e.pixels)||void 0===t||null===(a=t.facebook)||void 0===a||!a.loaded)return;let o=wpm.getRandomEventId();fbq("track","Search",{},{eventID:o}),jQuery(document).trigger("wpmFbCapiEvent",{event_name:"Search",event_id:o,user_data:wpm.getFbUserData(),event_source_url:window.location.href})}catch(e){console.error(e)}})),jQuery(document).on("wpmLoadAlways",(function(){try{var e,t,a;if(null===(e=wpmDataLayer)||void 0===e||null===(t=e.pixels)||void 0===t||null===(a=t.facebook)||void 0===a||!a.loaded)return;wpm.setFbUserData()}catch(e){console.error(e)}})),jQuery(document).on("wpmOrderReceivedPage",(function(){try{var e,t,a;if(null===(e=wpmDataLayer)||void 0===e||null===(t=e.pixels)||void 0===t||null===(a=t.facebook)||void 0===a||!a.loaded)return;fbq("track","Purchase",{content_type:"product",value:wpmDataLayer.order.value_filtered,currency:wpmDataLayer.order.currency,content_ids:wpm.facebookContentIds()},{eventID:wpmDataLayer.order.id})}catch(e){console.error(e)}}))},234:()=>{!function(e,t,a){let o=[];e.getGoogleAdsConversionIdentifiersWithLabel=function(){for(const[e,t]of Object.entries(wpmDataLayer.pixels.google.ads.conversionIds))o.push(e+"/"+t);return o},e.getGoogleAdsConversionIdentifiers=function(){let e=[];for(const[t,a]of Object.entries(wpmDataLayer.pixels.google.ads.conversionIds))e.push(t);return e},e.getGoogleAdsRegularOrderItems=function(){let e=[];for(const[o,r]of Object.entries(wpmDataLayer.order.items)){var t,a;let o;o={quantity:r.quantity,price:r.price},null!==(t=wpmDataLayer)&&void 0!==t&&null!==(a=t.general)&&void 0!==a&&a.variationsOutput&&0!==r.variation_id?(o.id=String(wpmDataLayer.products[r.variation_id].dyn_r_ids[wpmDataLayer.pixels.google.ads.dynamic_remarketing.id_type]),e.push(o)):(o.id=String(wpmDataLayer.products[r.id].dyn_r_ids[wpmDataLayer.pixels.google.ads.dynamic_remarketing.id_type]),e.push(o))}return e},e.getGoogleAdsDynamicRemarketingOrderItems=function(){let e=[];for(const[o,r]of Object.entries(wpmDataLayer.order.items)){var t,a;let o;o={quantity:r.quantity,price:r.price,google_business_vertical:wpmDataLayer.pixels.google.ads.google_business_vertical},null!==(t=wpmDataLayer)&&void 0!==t&&null!==(a=t.general)&&void 0!==a&&a.variationsOutput&&0!==r.variation_id?(o.id=String(wpmDataLayer.products[r.variation_id].dyn_r_ids[wpmDataLayer.pixels.google.ads.dynamic_remarketing.id_type]),e.push(o)):(o.id=String(wpmDataLayer.products[r.id].dyn_r_ids[wpmDataLayer.pixels.google.ads.dynamic_remarketing.id_type]),e.push(o))}return e}}(window.wpm=window.wpm||{},jQuery),jQuery(document).on("wpmViewItemList",(function(e,t){try{var a,o,r,n,i,s,d,l,c,u,p;if(jQuery.isEmptyObject(null===(a=wpmDataLayer)||void 0===a||null===(o=a.pixels)||void 0===o||null===(r=o.google)||void 0===r||null===(n=r.ads)||void 0===n?void 0:n.conversionIds))return;if(null===(i=wpmDataLayer)||void 0===i||null===(s=i.pixels)||void 0===s||null===(d=s.google)||void 0===d||null===(l=d.ads)||void 0===l||null===(c=l.dynamic_remarketing)||void 0===c||!c.status)return;if(!wpm.googleConfigConditionsMet("ads"))return;if(null!==(u=wpmDataLayer)&&void 0!==u&&null!==(p=u.general)&&void 0!==p&&p.variationsOutput&&t.isVariable&&!1===wpmDataLayer.pixels.google.ads.dynamic_remarketing.send_events_with_parent_ids)return;if(!t)return;wpm.gtagLoaded().then((function(){gtag("event","view_item_list",{send_to:wpm.getGoogleAdsConversionIdentifiers(),items:[{id:t.dyn_r_ids[wpmDataLayer.pixels.google.ads.dynamic_remarketing.id_type],google_business_vertical:wpmDataLayer.pixels.google.ads.google_business_vertical}]})}))}catch(e){console.error(e)}})),jQuery(document).on("wpmAddToCart",(function(e,t){try{var a,o,r,n,i,s,d,l,c;if(jQuery.isEmptyObject(null===(a=wpmDataLayer)||void 0===a||null===(o=a.pixels)||void 0===o||null===(r=o.google)||void 0===r||null===(n=r.ads)||void 0===n?void 0:n.conversionIds))return;if(null===(i=wpmDataLayer)||void 0===i||null===(s=i.pixels)||void 0===s||null===(d=s.google)||void 0===d||null===(l=d.ads)||void 0===l||null===(c=l.dynamic_remarketing)||void 0===c||!c.status)return;if(!wpm.googleConfigConditionsMet("ads"))return;wpm.gtagLoaded().then((function(){gtag("event","add_to_cart",{send_to:wpm.getGoogleAdsConversionIdentifiers(),value:t.quantity*t.price,items:[{id:t.dyn_r_ids[wpmDataLayer.pixels.google.ads.dynamic_remarketing.id_type],quantity:t.quantity,price:t.price,google_business_vertical:wpmDataLayer.pixels.google.ads.google_business_vertical}]})}))}catch(e){console.error(e)}})),jQuery(document).on("wpmViewItem",(function(e,t){try{var a,o,r,n,i,s,d,l,c;if(jQuery.isEmptyObject(null===(a=wpmDataLayer)||void 0===a||null===(o=a.pixels)||void 0===o||null===(r=o.google)||void 0===r||null===(n=r.ads)||void 0===n?void 0:n.conversionIds))return;if(null===(i=wpmDataLayer)||void 0===i||null===(s=i.pixels)||void 0===s||null===(d=s.google)||void 0===d||null===(l=d.ads)||void 0===l||null===(c=l.dynamic_remarketing)||void 0===c||!c.status)return;if(!wpm.googleConfigConditionsMet("ads"))return;wpm.gtagLoaded().then((function(){gtag("event","view_item",{send_to:wpm.getGoogleAdsConversionIdentifiers(),value:(t.quantity?t.quantity:1)*t.price,items:[{id:t.dyn_r_ids[wpmDataLayer.pixels.google.ads.dynamic_remarketing.id_type],quantity:t.quantity?t.quantity:1,price:t.price,google_business_vertical:wpmDataLayer.pixels.google.ads.google_business_vertical}]})}))}catch(e){console.error(e)}})),jQuery(document).on("wpmSearch",(function(){try{var e,t,a,o,r,n,i,s,d;if(jQuery.isEmptyObject(null===(e=wpmDataLayer)||void 0===e||null===(t=e.pixels)||void 0===t||null===(a=t.google)||void 0===a||null===(o=a.ads)||void 0===o?void 0:o.conversionIds))return;if(null===(r=wpmDataLayer)||void 0===r||null===(n=r.pixels)||void 0===n||null===(i=n.google)||void 0===i||null===(s=i.ads)||void 0===s||null===(d=s.dynamic_remarketing)||void 0===d||!d.status)return;if(!wpm.googleConfigConditionsMet("ads"))return;let u=[];for(const[e,t]of Object.entries(wpmDataLayer.products)){var l,c;if(null!==(l=wpmDataLayer)&&void 0!==l&&null!==(c=l.general)&&void 0!==c&&c.variationsOutput&&t.isVariable&&!1===wpmDataLayer.pixels.google.ads.dynamic_remarketing.send_events_with_parent_ids)return;u.push({id:t.dyn_r_ids[wpmDataLayer.pixels.google.ads.dynamic_remarketing.id_type],google_business_vertical:wpmDataLayer.pixels.google.ads.google_business_vertical})}wpm.gtagLoaded().then((function(){gtag("event","view_search_results",{send_to:wpm.getGoogleAdsConversionIdentifiers(),items:u})}))}catch(e){console.error(e)}})),jQuery(document).on("wpmOrderReceivedPage",(function(){try{var e,t,a,o,r,n,i,s,d;if(jQuery.isEmptyObject(null===(e=wpmDataLayer)||void 0===e||null===(t=e.pixels)||void 0===t||null===(a=t.google)||void 0===a||null===(o=a.ads)||void 0===o?void 0:o.conversionIds))return;if(null===(r=wpmDataLayer)||void 0===r||null===(n=r.pixels)||void 0===n||null===(i=n.google)||void 0===i||null===(s=i.ads)||void 0===s||null===(d=s.dynamic_remarketing)||void 0===d||!d.status)return;if(!wpm.googleConfigConditionsMet("ads"))return;wpm.gtagLoaded().then((function(){gtag("event","purchase",{send_to:wpm.getGoogleAdsConversionIdentifiers(),value:wpmDataLayer.order.value_filtered,items:wpm.getGoogleAdsDynamicRemarketingOrderItems()})}))}catch(e){console.error(e)}})),jQuery(document).on("wpmLogin",(function(){try{var e,t,a,o,r,n,i,s,d;if(jQuery.isEmptyObject(null===(e=wpmDataLayer)||void 0===e||null===(t=e.pixels)||void 0===t||null===(a=t.google)||void 0===a||null===(o=a.ads)||void 0===o?void 0:o.conversionIds))return;if(null===(r=wpmDataLayer)||void 0===r||null===(n=r.pixels)||void 0===n||null===(i=n.google)||void 0===i||null===(s=i.ads)||void 0===s||null===(d=s.dynamic_remarketing)||void 0===d||!d.status)return;if(!wpm.googleConfigConditionsMet("ads"))return;wpm.gtagLoaded().then((function(){gtag("event","login",{send_to:wpm.getGoogleAdsConversionIdentifiers()})}))}catch(e){console.error(e)}})),jQuery(document).on("wpmOrderReceivedPage",(function(){try{var e,t,a,o,r,n;if(jQuery.isEmptyObject(null===(e=wpmDataLayer)||void 0===e||null===(t=e.pixels)||void 0===t||null===(a=t.google)||void 0===a||null===(o=a.ads)||void 0===o?void 0:o.conversionIds))return;if(!wpm.googleConfigConditionsMet("ads"))return;let i={},s={};i={send_to:wpm.getGoogleAdsConversionIdentifiersWithLabel(),transaction_id:wpmDataLayer.order.number,value:wpmDataLayer.order.value_filtered,currency:wpmDataLayer.order.currency,new_customer:wpmDataLayer.order.new_customer},null!==(r=wpmDataLayer)&&void 0!==r&&null!==(n=r.order)&&void 0!==n&&n.aw_merchant_id&&(s={discount:wpmDataLayer.order.discount,aw_merchant_id:wpmDataLayer.order.aw_merchant_id,aw_feed_country:wpmDataLayer.order.aw_feed_country,aw_feed_language:wpmDataLayer.order.aw_feed_language,items:wpm.getGoogleAdsRegularOrderItems()}),wpm.gtagLoaded().then((function(){gtag("event","conversion",{...i,...s})}))}catch(e){console.error(e)}}))},464:()=>{!function(e,t,a){e.getGA4OrderItems=function(){let e=[];for(const[o,r]of Object.entries(wpmDataLayer.order.items)){var t,a;let o;o={quantity:r.quantity,price:r.price,item_name:r.name,currency:wpmDataLayer.order.currency,item_category:wpmDataLayer.products[r.id].category.join("/")},null!==(t=wpmDataLayer)&&void 0!==t&&null!==(a=t.general)&&void 0!==a&&a.variationsOutput&&0!==r.variation_id?(o.item_id=String(wpmDataLayer.products[r.variation_id].dyn_r_ids[wpmDataLayer.pixels.google.analytics.id_type]),o.item_variant=wpmDataLayer.products[r.variation_id].variant_name,o.item_brand=wpmDataLayer.products[r.variation_id].brand,e.push(o)):(o.item_id=String(wpmDataLayer.products[r.id].dyn_r_ids[wpmDataLayer.pixels.google.analytics.id_type]),o.item_brand=wpmDataLayer.products[r.id].brand,e.push(o))}return e}}(window.wpm=window.wpm||{},jQuery),jQuery(document).on("wpmOrderReceivedPage",(function(){try{var e,t,a,o,r,n,i,s,d,l;if(null===(e=wpmDataLayer)||void 0===e||null===(t=e.pixels)||void 0===t||null===(a=t.google)||void 0===a||null===(o=a.analytics)||void 0===o||null===(r=o.ga4)||void 0===r||!r.measurement_id)return;if(null!==(n=wpmDataLayer)&&void 0!==n&&null!==(i=n.pixels)&&void 0!==i&&null!==(s=i.google)&&void 0!==s&&null!==(d=s.analytics)&&void 0!==d&&null!==(l=d.ga4)&&void 0!==l&&l.mp_active)return;if(!wpm.googleConfigConditionsMet("analytics"))return;wpm.gtagLoaded().then((function(){gtag("event","purchase",{send_to:[wpmDataLayer.pixels.google.analytics.ga4.measurement_id],transaction_id:wpmDataLayer.order.number,affiliation:wpmDataLayer.order.affiliation,currency:wpmDataLayer.order.currency,value:wpmDataLayer.order.value_regular,discount:wpmDataLayer.order.discount,tax:wpmDataLayer.order.tax,shipping:wpmDataLayer.order.shipping,coupon:wpmDataLayer.order.coupon,items:wpm.getGA4OrderItems()})}))}catch(e){console.error(e)}}))},354:()=>{!function(e,t,a){e.getGAUAOrderItems=function(){let e=[],t=1;for(const[r,n]of Object.entries(wpmDataLayer.order.items)){var a,o;let r;r={quantity:n.quantity,price:n.price,item_name:n.name,currency:wpmDataLayer.order.currency,item_category:wpmDataLayer.products[n.id].category.join("/"),list_position:t},null!==(a=wpmDataLayer)&&void 0!==a&&null!==(o=a.general)&&void 0!==o&&o.variationsOutput&&0!==n.variation_id?(r.id=String(wpmDataLayer.products[n.variation_id].dyn_r_ids[wpmDataLayer.pixels.google.analytics.id_type]),r.variant=wpmDataLayer.products[n.variation_id].variant_name,r.item_brand=wpmDataLayer.products[n.variation_id].brand,e.push(r)):(r.id=String(wpmDataLayer.products[n.id].dyn_r_ids[wpmDataLayer.pixels.google.analytics.id_type]),r.item_brand=wpmDataLayer.products[n.id].brand,e.push(r)),t++}return e}}(window.wpm=window.wpm||{},jQuery),jQuery(document).on("wpmOrderReceivedPage",(function(){try{var e,t,a,o,r,n,i,s,d,l;if(null===(e=wpmDataLayer)||void 0===e||null===(t=e.pixels)||void 0===t||null===(a=t.google)||void 0===a||null===(o=a.analytics)||void 0===o||null===(r=o.universal)||void 0===r||!r.property_id)return;if(null!==(n=wpmDataLayer)&&void 0!==n&&null!==(i=n.pixels)&&void 0!==i&&null!==(s=i.google)&&void 0!==s&&null!==(d=s.analytics)&&void 0!==d&&null!==(l=d.universal)&&void 0!==l&&l.mp_active)return;if(!wpm.googleConfigConditionsMet("analytics"))return;wpm.gtagLoaded().then((function(){gtag("event","purchase",{send_to:[wpmDataLayer.pixels.google.analytics.universal.property_id],transaction_id:wpmDataLayer.order.number,affiliation:wpmDataLayer.order.affiliation,currency:wpmDataLayer.order.currency,value:wpmDataLayer.order.value_regular,discount:wpmDataLayer.order.discount,tax:wpmDataLayer.order.tax,shipping:wpmDataLayer.order.shipping,coupon:wpmDataLayer.order.coupon,items:wpm.getGAUAOrderItems()})}))}catch(e){console.error(e)}}))},497:()=>{!function(e,t,a){e.load_google_optimize_pixel=function(){try{var t,a,o,r;null!==(t=wpmDataLayer)&&void 0!==t&&null!==(a=t.pixels)&&void 0!==a&&null!==(o=a.google)&&void 0!==o&&null!==(r=o.optimize)&&void 0!==r&&r.container_id&&(wpmDataLayer.pixels.google.optimize.loaded=!0,e.loadScriptAndCacheIt("https://www.googleoptimize.com/optimize.js?id="+wpmDataLayer.pixels.google.optimize.container_id))}catch(e){console.error(e)}}}(window.wpm=window.wpm||{},jQuery),jQuery(document).on("wpmLoadPixels",(function(){var e,t,a,o;!wpm.canIFire("analytics","google-optimize")||null!==(e=wpmDataLayer)&&void 0!==e&&null!==(t=e.pixels)&&void 0!==t&&null!==(a=t.google)&&void 0!==a&&null!==(o=a.optimize)&&void 0!==o&&o.loaded||wpm.load_google_optimize_pixel()}))},577:()=>{!function(e,t,a){e.googleConfigConditionsMet=function(t){var a,o,r,n;return!(null===(a=wpmDataLayer)||void 0===a||null===(o=a.pixels)||void 0===o||null===(r=o.google)||void 0===r||null===(n=r.consent_mode)||void 0===n||!n.active)||("category"===e.getConsentValues().mode?!0===e.getConsentValues().categories[t]:"pixel"===e.getConsentValues().mode&&e.getConsentValues().pixels.includes("google-"+t))},e.getVisitorConsentStatusAndUpdateGoogleConsentSettings=function(t){return"category"===e.getConsentValues().mode?(e.getConsentValues().categories.analytics&&(t.analytics_storage="granted"),e.getConsentValues().categories.ads&&(t.ad_storage="granted")):"pixel"===e.getConsentValues().mode&&(t.analytics_storage=e.getConsentValues().pixels.includes("google-analytics")?"granted":"denied",t.ad_storage=e.getConsentValues().pixels.includes("google-ads")?"granted":"denied"),t},e.updateGoogleConsentMode=function(){let e=!(arguments.length>0&&arguments[0]!==a)||arguments[0],t=!(arguments.length>1&&arguments[1]!==a)||arguments[1];try{if(!window.gtag||!wpmDataLayer.shop.cookie_consent_mgmt.explicit_consent)return;gtag("consent","update",{analytics_storage:e?"granted":"denied",ad_storage:t?"granted":"denied"})}catch(e){console.error(e)}},e.fireGtagGoogleAds=function(){try{var e,t,a,o,r,n,i,s,d,l,c,u,p,g,m,y,w,v,f,_,h;if(wpmDataLayer.pixels.google.ads.state="loading",null!==(e=wpmDataLayer)&&void 0!==e&&null!==(t=e.pixels)&&void 0!==t&&null!==(a=t.google)&&void 0!==a&&null!==(o=a.ads)&&void 0!==o&&null!==(r=o.enhanced_conversions)&&void 0!==r&&r.active)for(const[e,t]of Object.entries(wpmDataLayer.pixels.google.ads.conversionIds))gtag("config",e,{allow_enhanced_conversions:!0});else for(const[e,t]of Object.entries(wpmDataLayer.pixels.google.ads.conversionIds))gtag("config",e);null!==(n=wpmDataLayer)&&void 0!==n&&null!==(i=n.pixels)&&void 0!==i&&null!==(s=i.google)&&void 0!==s&&null!==(d=s.ads)&&void 0!==d&&d.conversionIds&&null!==(l=wpmDataLayer)&&void 0!==l&&null!==(c=l.pixels)&&void 0!==c&&null!==(u=c.google)&&void 0!==u&&null!==(p=u.ads)&&void 0!==p&&p.phone_conversion_label&&null!==(g=wpmDataLayer)&&void 0!==g&&null!==(m=g.pixels)&&void 0!==m&&null!==(y=m.google)&&void 0!==y&&null!==(w=y.ads)&&void 0!==w&&w.phone_conversion_number&>ag("config",Object.keys(wpmDataLayer.pixels.google.ads.conversionIds)[0]+"/"+wpmDataLayer.pixels.google.ads.phone_conversion_label,{phone_conversion_number:wpmDataLayer.pixels.google.ads.phone_conversion_number}),"order_received_page"===wpmDataLayer.shop.page_type&&null!==(v=wpmDataLayer)&&void 0!==v&&null!==(f=v.order)&&void 0!==f&&null!==(_=f.google)&&void 0!==_&&null!==(h=_.ads)&&void 0!==h&&h.enhanced_conversion_data&&(window.enhanced_conversion_data=wpmDataLayer.order.google.ads.enhanced_conversion_data),wpmDataLayer.pixels.google.ads.state="ready"}catch(e){console.error(e)}},e.fireGtagGoogleAnalyticsUA=function(){try{wpmDataLayer.pixels.google.analytics.universal.state="loading",gtag("config",wpmDataLayer.pixels.google.analytics.universal.property_id,wpmDataLayer.pixels.google.analytics.universal.parameters),wpmDataLayer.pixels.google.analytics.universal.state="ready"}catch(e){console.error(e)}},e.fireGtagGoogleAnalyticsGA4=function(){try{wpmDataLayer.pixels.google.analytics.ga4.state="loading",gtag("config",wpmDataLayer.pixels.google.analytics.ga4.measurement_id,wpmDataLayer.pixels.google.analytics.ga4.parameters),wpmDataLayer.pixels.google.analytics.ga4.state="ready"}catch(e){console.error(e)}},e.isGoogleActive=function(){var e,t,a,o,r,n,i,s,d,l,c,u,p,g;return!(!(null!==(e=wpmDataLayer)&&void 0!==e&&null!==(t=e.pixels)&&void 0!==t&&null!==(a=t.google)&&void 0!==a&&null!==(o=a.analytics)&&void 0!==o&&null!==(r=o.universal)&&void 0!==r&&r.property_id||null!==(n=wpmDataLayer)&&void 0!==n&&null!==(i=n.pixels)&&void 0!==i&&null!==(s=i.google)&&void 0!==s&&null!==(d=s.analytics)&&void 0!==d&&null!==(l=d.ga4)&&void 0!==l&&l.measurement_id)&&jQuery.isEmptyObject(null===(c=wpmDataLayer)||void 0===c||null===(u=c.pixels)||void 0===u||null===(p=u.google)||void 0===p||null===(g=p.ads)||void 0===g?void 0:g.conversionIds))},e.getGoogleGtagId=function(){var e,t,a,o,r,n,i,s,d,l;return null!==(e=wpmDataLayer)&&void 0!==e&&null!==(t=e.pixels)&&void 0!==t&&null!==(a=t.google)&&void 0!==a&&null!==(o=a.analytics)&&void 0!==o&&null!==(r=o.universal)&&void 0!==r&&r.property_id?wpmDataLayer.pixels.google.analytics.universal.property_id:null!==(n=wpmDataLayer)&&void 0!==n&&null!==(i=n.pixels)&&void 0!==i&&null!==(s=i.google)&&void 0!==s&&null!==(d=s.analytics)&&void 0!==d&&null!==(l=d.ga4)&&void 0!==l&&l.measurement_id?wpmDataLayer.pixels.google.analytics.ga4.measurement_id:Object.keys(wpmDataLayer.pixels.google.ads.conversionIds)[0]},e.loadGoogle=function(){e.isGoogleActive()&&(wpmDataLayer.pixels.google.state="loading",e.loadScriptAndCacheIt("https://www.googletagmanager.com/gtag/js?id="+e.getGoogleGtagId()).done((function(t,a){try{var o,r,n,i,s,d,l,c,u,p,g,m,y,w,v,f,_,h,L,D,C,j;if(window.dataLayer=window.dataLayer||[],window.gtag=function(){dataLayer.push(arguments)},null!==(o=wpmDataLayer)&&void 0!==o&&null!==(r=o.pixels)&&void 0!==r&&null!==(n=r.google)&&void 0!==n&&null!==(i=n.consent_mode)&&void 0!==i&&i.active){var b,x,k,I;let t={ad_storage:wpmDataLayer.pixels.google.consent_mode.ad_storage,analytics_storage:wpmDataLayer.pixels.google.consent_mode.analytics_storage,wait_for_update:wpmDataLayer.pixels.google.consent_mode.wait_for_update};null!==(b=wpmDataLayer)&&void 0!==b&&null!==(x=b.pixels)&&void 0!==x&&null!==(k=x.google)&&void 0!==k&&null!==(I=k.consent_mode)&&void 0!==I&&I.region&&(t.region=wpmDataLayer.pixels.google.consent_mode.region),t=e.getVisitorConsentStatusAndUpdateGoogleConsentSettings(t),gtag("consent","default",t),gtag("set","ads_data_redaction",wpmDataLayer.pixels.google.consent_mode.ads_data_redaction),gtag("set","url_passthrough",wpmDataLayer.pixels.google.consent_mode.url_passthrough)}null!==(s=wpmDataLayer)&&void 0!==s&&null!==(d=s.pixels)&&void 0!==d&&null!==(l=d.google)&&void 0!==l&&null!==(c=l.linker)&&void 0!==c&&c.settings&>ag("set","linker",wpmDataLayer.pixels.google.linker.settings),gtag("js",new Date),e.googleConfigConditionsMet("ads")&&!jQuery.isEmptyObject(null===(u=wpmDataLayer)||void 0===u||null===(p=u.pixels)||void 0===p||null===(g=p.google)||void 0===g||null===(m=g.ads)||void 0===m?void 0:m.conversionIds)&&e.fireGtagGoogleAds(),e.googleConfigConditionsMet("analytics")&&null!==(y=wpmDataLayer)&&void 0!==y&&null!==(w=y.pixels)&&void 0!==w&&null!==(v=w.google)&&void 0!==v&&null!==(f=v.analytics)&&void 0!==f&&null!==(_=f.universal)&&void 0!==_&&_.property_id&&e.fireGtagGoogleAnalyticsUA(),e.googleConfigConditionsMet("analytics")&&null!==(h=wpmDataLayer)&&void 0!==h&&null!==(L=h.pixels)&&void 0!==L&&null!==(D=L.google)&&void 0!==D&&null!==(C=D.analytics)&&void 0!==C&&null!==(j=C.ga4)&&void 0!==j&&j.measurement_id&&e.fireGtagGoogleAnalyticsGA4(),wpmDataLayer.pixels.google.state="ready"}catch(e){console.error(e)}})))},e.canGoogleLoad=function(){var t,a,o,r;return!(null===(t=wpmDataLayer)||void 0===t||null===(a=t.pixels)||void 0===a||null===(o=a.google)||void 0===o||null===(r=o.consent_mode)||void 0===r||!r.active)||("category"===e.getConsentValues().mode?!(!e.getConsentValues().categories.ads&&!e.getConsentValues().categories.analytics):"pixel"===e.getConsentValues().mode?e.getConsentValues().pixels.includes("google-ads")||e.getConsentValues().pixels.includes("google-analytics"):(console.error("Couldn't find a valid load condition for Google mode in wpmConsentValues"),!1))},e.gtagLoaded=function(){return new Promise((function(e,t){var a,o,r;void 0===(null===(a=wpmDataLayer)||void 0===a||null===(o=a.pixels)||void 0===o||null===(r=o.google)||void 0===r?void 0:r.state)&&t();let n=0;!function a(){var o,r,i;return"ready"===(null===(o=wpmDataLayer)||void 0===o||null===(r=o.pixels)||void 0===r||null===(i=r.google)||void 0===i?void 0:i.state)?e():n>=5e3?t():(n+=200,void setTimeout(a,200))}()}))}}(window.wpm=window.wpm||{},jQuery),jQuery(document).on("wpmLoadPixels",(function(){var e,t,a;wpm.canGoogleLoad()&&void 0===(null===(e=wpmDataLayer)||void 0===e||null===(t=e.pixels)||void 0===t||null===(a=t.google)||void 0===a?void 0:a.state)&&wpm.loadGoogle()}))},570:()=>{!function(e,t,a){e.load_hotjar_pixel=function(){var e,t,a,o,r,n,i;null!==(e=wpmDataLayer)&&void 0!==e&&null!==(t=e.pixels)&&void 0!==t&&null!==(a=t.hotjar)&&void 0!==a&&a.site_id&&(wpmDataLayer.pixels.hotjar.loaded=!0,o=window,r=document,o.hj=o.hj||function(){(o.hj.q=o.hj.q||[]).push(arguments)},o._hjSettings={hjid:wpmDataLayer.pixels.hotjar.site_id,hjsv:6},n=r.getElementsByTagName("head")[0],(i=r.createElement("script")).async=1,i.src="https://static.hotjar.com/c/hotjar-"+o._hjSettings.hjid+".js?sv="+o._hjSettings.hjsv,n.appendChild(i))}}(window.wpm=window.wpm||{},jQuery),jQuery(document).on("wpmLoadPixels",(function(){var e,t,a;!wpm.canIFire("analytics","hotjar")||null!==(e=wpmDataLayer)&&void 0!==e&&null!==(t=e.pixels)&&void 0!==t&&null!==(a=t.hotjar)&&void 0!==a&&a.loaded||wpm.load_hotjar_pixel()}))},560:()=>{wpm.wpmDataLayerExists().then((function(){jQuery(document).trigger("wpmPreLoadPixels",{})})).then((function(){wpm.pageLoaded().then((function(){jQuery(document).trigger("wpmLoad",{})}))}))},230:()=>{!function(e,t,a){const o="_wpm_order_ids",r="_wpm_endpoint_available",n="/wp-json/";function i(){return""!==e.getCookie(o)}e.emailSelected=!1,e.paymentMethodSelected=!1,e.useRestEndpoint=function(){return e.isSessionStorageAvailable()&&e.isRestEndpointAvailable()&&e.isBelowRestErrorThreshold()},e.isBelowRestErrorThreshold=function(){return window.sessionStorage.getItem(0)<=10},e.isRestEndpointAvailable=function(){if(window.sessionStorage.getItem(r))return JSON.parse(window.sessionStorage.getItem(r));e.testEndpoint()},e.isSessionStorageAvailable=function(){return!!window.sessionStorage},e.testEndpoint=function(){let e=arguments.length>0&&arguments[0]!==a?arguments[0]:location.protocol+"//"+location.host+n,t=arguments.length>1&&arguments[1]!==a?arguments[1]:r;jQuery.ajax(e,{type:"HEAD",timeout:1e3,statusCode:{200:function(e){window.sessionStorage.setItem(t,JSON.stringify(!0))},404:function(e){window.sessionStorage.setItem(t,JSON.stringify(!1))},0:function(e){window.sessionStorage.setItem(t,JSON.stringify(!1))}}}).then((e=>{}))},e.isWpmRestEndpointAvailable=function(){let t=arguments.length>0&&arguments[0]!==a?arguments[0]:r;return!!e.getCookie(t)},e.writeOrderIdToStorage=function(t){if(window.Storage)if(null===localStorage.getItem(o)){let e=[];e.push(t),window.localStorage.setItem(o,JSON.stringify(e))}else{let e=JSON.parse(localStorage.getItem(o));e.includes(t)||(e.push(t),window.localStorage.setItem(o,JSON.stringify(e)))}else{let a=new Date;a.setDate(a.getDate()+365);let r=[];i()&&(r=JSON.parse(e.getCookie(o))),r.includes(t)||(r.push(t),document.cookie="_wpm_order_ids="+JSON.stringify(r)+";expires="+a.toUTCString())}"function"==typeof e.storeOrderIdOnServer&&wpmDataLayer.orderDeduplication&&e.storeOrderIdOnServer(t)},e.isOrderIdStored=function(t){return wpmDataLayer.orderDeduplication?window.Storage?null!==localStorage.getItem(o)&&JSON.parse(localStorage.getItem(o)).includes(t):!!i()&&JSON.parse(e.getCookie(o)).includes(t):(console.log("order duplication prevention: off"),!1)},e.isEmail=function(e){return/^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/.test(e)},e.removeProductFromCart=function(t){let o=arguments.length>1&&arguments[1]!==a?arguments[1]:null;try{if(!t)throw Error("Wasn't able to retrieve a productId");if(!(t=getIdBasedOndVariationsOutputSetting(t)))throw Error("Wasn't able to retrieve a productId");let a;if(a=null==o?wpmDataLayer.cart[t].quantity:o,wpmDataLayer.cart[t]){let r=e.getProductDetailsFormattedForEvent(t,a);jQuery(document).trigger("wpmRemoveFromCart",r),null==o||wpmDataLayer.cart[t].quantity===o?(delete wpmDataLayer.cart[t],sessionStorage&&sessionStorage.setItem("wpmDataLayerCart",JSON.stringify(wpmDataLayer.cart))):(wpmDataLayer.cart[t].quantity=wpmDataLayer.cart[t].quantity-a,sessionStorage&&sessionStorage.setItem("wpmDataLayerCart",JSON.stringify(wpmDataLayer.cart)))}}catch(e){console.error(e)}},getIdBasedOndVariationsOutputSetting=function(e){try{var t,a;return null!==(t=wpmDataLayer)&&void 0!==t&&null!==(a=t.general)&&void 0!==a&&a.variationsOutput?e:wpmDataLayer.products[e].isVariation?wpmDataLayer.products[e].parentId:e}catch(e){console.error(e)}},e.addProductToCart=function(t,o){try{if(!t)throw Error("Wasn't able to retrieve a productId");if(!(t=getIdBasedOndVariationsOutputSetting(t)))throw Error("Wasn't able to retrieve a productId");if(wpmDataLayer.products[t]){let r=e.getProductDetailsFormattedForEvent(t,o);jQuery(document).trigger("wpmAddToCart",r),wpmDataLayer.cart!==a&&wpmDataLayer.cart[t]!==a?(wpmDataLayer.cart[t].quantity=wpmDataLayer.cart[t].quantity+o,sessionStorage&&sessionStorage.setItem("wpmDataLayerCart",JSON.stringify(wpmDataLayer.cart))):wpmDataLayer.cart?(wpmDataLayer.cart[t]=e.getProductDetailsFormattedForEvent(t,o),sessionStorage&&sessionStorage.setItem("wpmDataLayerCart",JSON.stringify(wpmDataLayer.cart))):(wpmDataLayer.cart={[t]:e.getProductDetailsFormattedForEvent(t,o)},sessionStorage&&sessionStorage.setItem("wpmDataLayerCart",JSON.stringify(wpmDataLayer.cart)))}}catch(t){console.error(t),e.getCartItemsFromBackend()}},e.getCartItems=function(){sessionStorage?sessionStorage.getItem("wpmDataLayerCart")&&"order_received_page"!==wpmDataLayer.shop.page_type?e.saveCartObjectToDataLayer(JSON.parse(sessionStorage.getItem("wpmDataLayerCart"))):sessionStorage.setItem("wpmDataLayerCart",JSON.stringify({})):e.getCartItemsFromBackend()},e.getCartItemsFromBackend=function(){try{let t={action:"wpm_get_cart_items"};jQuery.ajax({type:"get",dataType:"json",url:e.ajax_url,data:t,success:function(t){t.cart||(t.cart={}),e.saveCartObjectToDataLayer(t.cart),sessionStorage&&sessionStorage.setItem("wpmDataLayerCart",JSON.stringify(t.cart))}})}catch(e){console.error(e)}},e.getProductsFromBackend=function(t){if((t=t.filter((e=>!wpmDataLayer.products.hasOwnProperty(e))))&&0!==t.length)try{let a={action:"wpm_get_product_ids",productIds:t};jQuery.ajax({type:"get",dataType:"json",url:e.ajax_url,data:a,success:function(e){wpmDataLayer.products=Object.assign({},wpmDataLayer.products,e)},error:function(e){console.log(e)}})}catch(e){console.error(e)}},e.saveCartObjectToDataLayer=function(e){wpmDataLayer.cart=e,wpmDataLayer.products=Object.assign({},wpmDataLayer.products,e)},e.fireCheckoutOption=function(e){let t=arguments.length>1&&arguments[1]!==a?arguments[1]:null,o=arguments.length>2&&arguments[2]!==a?arguments[2]:null,r={step:e,checkout_option:t,value:o};jQuery(document).trigger("wpmFireCheckoutOption",r)},e.fireCheckoutProgress=function(e){let t={step:e};jQuery(document).trigger("wpmFireCheckoutProgress",t)},e.getPostIdFromString=function(e){try{return e.match(/(post-)(\d+)/)[2]}catch(e){console.error(e)}},e.triggerViewItemList=function(t){if(!t)throw Error("Wasn't able to retrieve a productId");if(!(t=getIdBasedOndVariationsOutputSetting(t)))throw Error("Wasn't able to retrieve a productId");jQuery(document).trigger("wpmViewItemList",e.getProductDataForViewItemEvent(t))},e.getProductDataForViewItemEvent=function(t){if(!t)throw Error("Wasn't able to retrieve a productId");try{if(wpmDataLayer.products[t])return e.getProductDetailsFormattedForEvent(t)}catch(e){console.error(e)}},e.getMainProductIdFromProductPage=function(){try{return["simple","variable","grouped","composite","bundle"].indexOf(wpmDataLayer.shop.product_type)>=0&&jQuery(".wpmProductId:first").data("id")}catch(e){console.error(e)}},e.viewItemListTriggerTestMode=function(e){jQuery(e).css({position:"relative"}),jQuery(e).append('<div id="viewItemListTriggerOverlay"></div>'),jQuery(e).find("#viewItemListTriggerOverlay").css({"z-index":"10",display:"block",position:"absolute",height:"100%",top:"0",left:"0",right:"0",opacity:wpmDataLayer.viewItemListTrigger.opacity,"background-color":wpmDataLayer.viewItemListTrigger.backgroundColor})},e.getSearchTermFromUrl=function(){try{return new URLSearchParams(window.location.search).get("s")}catch(e){console.error(e)}};let s,d={};e.observerCallback=function(t,a){t.forEach((t=>{try{let o,r=jQuery(t.target).data("ioid");if(o=jQuery(t.target).next(".wpmProductId").length?jQuery(t.target).next(".wpmProductId").data("id"):jQuery(t.target).find(".wpmProductId").data("id"),!o)throw Error("wpmProductId element not found");t.isIntersecting?d[r]=setTimeout((()=>{e.triggerViewItemList(o),wpmDataLayer.viewItemListTrigger.testMode&&e.viewItemListTriggerTestMode(t.target),!1===wpmDataLayer.viewItemListTrigger.repeat&&a.unobserve(t.target)}),wpmDataLayer.viewItemListTrigger.timeout):(clearTimeout(d[r]),wpmDataLayer.viewItemListTrigger.testMode&&jQuery(t.target).find("#viewItemListTriggerOverlay").remove())}catch(e){console.error(e)}}))};let l,c=0;e.startIntersectionObserverToWatch=function(){try{new URLSearchParams(window.location.search).has("vildemomode")&&(wpmDataLayer.viewItemListTrigger.testMode=!0),s=new IntersectionObserver(e.observerCallback,{threshold:wpmDataLayer.viewItemListTrigger.threshold}),l=jQuery(".wpmProductId").map((function(e,t){return jQuery(t).parent().hasClass("type-product")||jQuery(t).parent().hasClass("product")||jQuery(t).parent().hasClass("product-item-inner")?jQuery(t).parent():jQuery(t).prev().hasClass("wc-block-grid__product")||jQuery(t).prev().hasClass("product")||jQuery(t).prev().hasClass("product-small")||jQuery(t).prev().hasClass("woocommerce-LoopProduct-link")?jQuery(this).prev():jQuery(t).closest(".product").length?jQuery(t).closest(".product"):void 0})),l.each((function(e,t){jQuery(t[0]).data("ioid",c++),s.observe(t[0])}))}catch(e){console.error(e)}},e.startProductsMutationObserverToWatch=function(){try{let e=jQuery(".wpmProductId:eq(0)").parents().has(jQuery(".wpmProductId:eq(1)").parents()).first();e.length&&u.observe(e[0],{attributes:!0,childList:!0,characterData:!0})}catch(e){console.error(e)}};let u=new MutationObserver((function(e){e.forEach((function(e){let t=e.addedNodes;null!==t&&jQuery(t).each((function(){(jQuery(this).hasClass("type-product")||jQuery(this).hasClass("product-small")||jQuery(this).hasClass("wc-block-grid__product"))&&p(this)&&(jQuery(this).data("ioid",c++),s.observe(this))}))}))})),p=function(e){return!(!jQuery(e).find(".wpmProductId").length&&!jQuery(e).siblings(".wpmProductId").length)};e.setCookie=function(e){let t=arguments.length>1&&arguments[1]!==a?arguments[1]:"",o=arguments.length>2&&arguments[2]!==a?arguments[2]:null;if(o){let a=new Date;a.setTime(a.getTime()+24*o*60*60*1e3);let r="expires="+a.toUTCString();document.cookie=e+"="+t+";"+r+";path=/"}else document.cookie=e+"="+t+";path=/"},e.getCookie=function(e){let t=e+"=",a=decodeURIComponent(document.cookie).split(";");for(let e=0;e<a.length;e++){let o=a[e];for(;" "==o.charAt(0);)o=o.substring(1);if(0==o.indexOf(t))return o.substring(t.length,o.length)}return""},e.getWpmSessionData=function(){if(window.sessionStorage){let e=window.sessionStorage.getItem("_wpm");return null!==e?JSON.parse(e):{}}return{}},e.setWpmSessionData=function(e){window.sessionStorage&&window.sessionStorage.setItem("_wpm",JSON.stringify(e))},e.storeOrderIdOnServer=function(t){try{let a={action:"wpm_purchase_pixels_fired",order_id:t,nonce:e.nonce};jQuery.ajax({type:"post",dataType:"json",url:e.ajax_url,data:a,success:function(e){!1===e.success&&console.log(e)},error:function(e){console.log(e)}})}catch(e){console.error(e)}},e.getProductIdByCartItemKeyUrl=function(e){let t=new URLSearchParams(e.search).get("remove_item"),a=null;return a=0===wpmDataLayer.cartItemKeys[t].variation_id?wpmDataLayer.cartItemKeys[t].product_id:wpmDataLayer.cartItemKeys[t].variation_id,a},e.getAddToCartLinkProductIds=function(){return jQuery("a").map((function(){let e=jQuery(this).attr("href");if(e&&e.includes("?add-to-cart=")){let t=e.match(/(add-to-cart=)(\d+)/);if(t)return t[2]}})).get()},e.getProductDetailsFormattedForEvent=function(e){let t=arguments.length>1&&arguments[1]!==a?arguments[1]:1,o={id:e.toString(),dyn_r_ids:wpmDataLayer.products[e].dyn_r_ids,name:wpmDataLayer.products[e].name,list_name:wpmDataLayer.shop.list_name,brand:wpmDataLayer.products[e].brand,category:wpmDataLayer.products[e].category,variant:wpmDataLayer.products[e].variant,list_position:wpmDataLayer.products[e].position,quantity:t,price:wpmDataLayer.products[e].price,currency:wpmDataLayer.shop.currency,isVariable:wpmDataLayer.products[e].isVariable,isVariation:wpmDataLayer.products[e].isVariation,parentId:wpmDataLayer.products[e].parentId};return o.isVariation&&(o.parentId_dyn_r_ids=wpmDataLayer.products[e].parentId_dyn_r_ids),o},e.setReferrerToCookie=function(){e.getCookie("wpmReferrer")||e.setCookie("wpmReferrer",document.referrer)},e.getReferrerFromCookie=function(){return e.getCookie("wpmReferrer")?e.getCookie("wpmReferrer"):null},e.getClidFromBrowser=function(){let t,o=arguments.length>0&&arguments[0]!==a?arguments[0]:"gclid";return t={gclid:"_gcl_aw",dclid:"_gcl_dc"},e.getCookie(t[o])?e.getCookie(t[o]).match(/(GCL.[\d]*.)(.*)/)[2]:""},e.getUserAgent=function(){return navigator.userAgent},e.getViewPort=function(){return{width:Math.max(document.documentElement.clientWidth||0,window.innerWidth||0),height:Math.max(document.documentElement.clientHeight||0,window.innerHeight||0)}};let g=function(){let t=e.getCookie("cmplz_statistics"),a=e.getCookie("cmplz_marketing");return!(!e.getCookie("cmplz_consent_status")&&!e.getCookie("cmplz_banner-status"))&&{analytics:"allow"===t,ads:"allow"===a,visitorHasChosen:!0}},m=function(){let t=e.getCookie("cookielawinfo-checkbox-analytics"),a=e.getCookie("cookielawinfo-checkbox-advertisement"),o=e.getCookie("CookieLawInfoConsent");return!(!t&&!a)&&{analytics:"yes"===t,ads:"yes"===a,visitorHasChosen:!!o}},y={categories:{},pixels:[],mode:"category",visitorHasChosen:!1};e.getConsentValues=function(){return y},e.setConsentValueCategories=function(){let e=arguments.length>0&&arguments[0]!==a&&arguments[0],t=arguments.length>1&&arguments[1]!==a&&arguments[1];y.categories.analytics=e,y.categories.ads=t},e.updateConsentCookieValues=function(){let t,o=arguments.length>0&&arguments[0]!==a&&arguments[0];if(t=e.getCookie("CookieConsent"))t=decodeURI(t),y.categories.analytics=t.indexOf("statistics:true")>=0,y.categories.ads=t.indexOf("marketing:true")>=0,y.visitorHasChosen=!0;else if(t=e.getCookie("CookieScriptConsent"))t=JSON.parse(t),"reject"===t.action?(y.categories.analytics=!1,y.categories.ads=!1):2===t.categories.length?(y.categories.analytics=!0,y.categories.ads=!0):(y.categories.analytics=t.categories.indexOf("performance")>=0,y.categories.ads=t.categories.indexOf("targeting")>=0),y.visitorHasChosen=!0;else if(t=e.getCookie("borlabs-cookie")){var r,n,i,s,d,l,c,u;t=decodeURI(t),t=JSON.parse(t),y.categories.analytics=!(null===(r=t)||void 0===r||null===(n=r.consents)||void 0===n||!n.statistics),y.categories.ads=!(null===(i=t)||void 0===i||null===(s=i.consents)||void 0===s||!s.marketing),y.visitorHasChosen=!0,y.pixels=[...(null===(d=t)||void 0===d||null===(l=d.consents)||void 0===l?void 0:l.statistics)||[],...(null===(c=t)||void 0===c||null===(u=c.consents)||void 0===u?void 0:u.marketing)||[]],y.mode="pixel"}else(t=g())?(y.categories.analytics=!0===t.analytics,y.categories.ads=!0===t.ads,y.visitorHasChosen=t.visitorHasChosen):(t=e.getCookie("cookie_notice_accepted"))?(y.categories.analytics=!0,y.categories.ads=!0,y.visitorHasChosen=!0):(t=e.getCookie("hu-consent"))?(t=JSON.parse(t),y.categories.analytics=!!t.categories[3],y.categories.ads=!!t.categories[4],y.visitorHasChosen=!0):(t=m())?(y.categories.analytics=!0===t.analytics,y.categories.ads=!0===t.ads,y.visitorHasChosen=!0===t.visitorHasChosen):(t=e.getCookie("moove_gdpr_popup"))?(t=JSON.parse(t),y.categories.analytics="1"===t.thirdparty,y.categories.ads="1"===t.advanced,y.visitorHasChosen=!0):(y.categories.analytics=!o,y.categories.ads=!o)},e.updateConsentCookieValues(),e.setConsentDefaultValuesToExplicit=function(){y.categories={analytics:!1,ads:!1}},e.canIFire=function(e,t){return"category"===y.mode?!!y.categories[e]:"pixel"===y.mode?y.pixels.includes(t):(console.error("Couldn't find a valid consent mode in wpmConsentValues"),!1)},e.scriptTagObserver=new MutationObserver((a=>{a.forEach((a=>{let{addedNodes:o}=a;[...o].forEach((a=>{t(a).data("wpm-cookie-category")&&(e.shouldScriptBeActive(a)?e.unblockScript(a):e.blockScript(a))}))}))})),e.scriptTagObserver.observe(document.head,{childList:!0,subtree:!0}),window.addEventListener("DOMContentLoaded",(()=>e.scriptTagObserver.disconnect())),e.shouldScriptBeActive=function(e){var a,o,r,n;return!((wpmDataLayer.shop.cookie_consent_mgmt.explicit_consent||y.visitorHasChosen)&&("category"!==y.mode||!t(e).data("wpm-cookie-category").split(",").some((e=>y.categories[e])))&&("pixel"!==y.mode||!y.pixels.includes(t(e).data("wpm-pixel-name")))&&("pixel"!==y.mode||"google"!==t(e).data("wpm-pixel-name")||!["google-analytics","google-ads"].some((e=>y.pixels.includes(e))))&&(null===(a=wpmDataLayer)||void 0===a||null===(o=a.pixels)||void 0===o||null===(r=o.google)||void 0===r||null===(n=r.consent_mode)||void 0===n||!n.active||"google"!==t(e).data("wpm-pixel-name")))},e.unblockScript=function(e){let o=arguments.length>1&&arguments[1]!==a&&arguments[1];o&&t(e).remove();let r=t(e).data("wpm-src");r&&t(e).attr("src",r),e.type="text/javascript",o&&t(e).appendTo("head"),jQuery(document).trigger("wpmPreLoadPixels",{})},e.blockScript=function(e){let o=arguments.length>1&&arguments[1]!==a&&arguments[1];o&&t(e).remove(),t(e).attr("src")&&t(e).removeAttr("src"),e.type="blocked/javascript",o&&t(e).appendTo("head")},e.unblockAllScripts=function(){let o=!(arguments.length>0&&arguments[0]!==a)||arguments[0],r=!(arguments.length>1&&arguments[1]!==a)||arguments[1];t.each(t('script[type="blocked/javascript"]'),(function(a,n){(t(n).data("wpm-cookie-category").includes("analytics")&&o||t(n).data("wpm-cookie-category").includes("ads")&&r)&&e.unblockScript(n,!0)})),jQuery(document).trigger("wpmPreLoadPixels",{})},e.unblockSelectedPixels=function(){t.each(t('script[type="blocked/javascript"]'),(function(a,o){(y.pixels.includes(t(o).data("wpm-pixel-name"))||"google"===t(o).data("wpm-pixel-name")&&["google-analytics","google-ads"].some((e=>y.pixels.includes(e))))&&e.unblockScript(o,!0)})),jQuery(document).trigger("wpmPreLoadPixels",{})},window.addEventListener("borlabs-cookie-consent-saved",(function(t){e.updateConsentCookieValues(),"pixel"===y.mode?(e.unblockSelectedPixels(),e.updateGoogleConsentMode(y.pixels.includes("google-analytics"),y.pixels.includes("google-ads"))):(e.unblockAllScripts(y.categories.analytics,y.categories.ads),e.updateGoogleConsentMode(y.categories.analytics,y.categories.ads))})),window.addEventListener("CookiebotOnAccept",(function(t){Cookiebot.consent.statistics&&(y.categories.analytics=!0),Cookiebot.consent.marketing&&(y.categories.ads=!0),e.unblockAllScripts(y.categories.analytics,y.categories.ads),e.updateGoogleConsentMode(y.categories.analytics,y.categories.ads)}),!1),window.addEventListener("CookieScriptAccept",(function(t){t.detail.categories.includes("performance")&&(y.categories.analytics=!0),t.detail.categories.includes("targeting")&&(y.categories.ads=!0),e.unblockAllScripts(y.categories.analytics,y.categories.ads),e.updateGoogleConsentMode(y.categories.analytics,y.categories.ads)})),window.addEventListener("CookieScriptAcceptAll",(function(t){e.unblockAllScripts(!0,!0),e.updateGoogleConsentMode(!0,!0)})),document.addEventListener("cmplzStatusChange",(function(t){e.updateConsentCookieValues(),e.unblockAllScripts(y.categories.analytics,y.categories.ads),e.updateGoogleConsentMode(y.categories.analytics,y.categories.ads)})),document.addEventListener("setCookieNotice",(function(t){e.updateConsentCookieValues(),e.unblockAllScripts(y.categories.analytics,y.categories.ads),e.updateGoogleConsentMode(y.categories.analytics,y.categories.ads)})),e.huObserver=new MutationObserver((function(t){t.forEach((t=>{let{addedNodes:a}=t;[...a].forEach((t=>{"hu"===t.id&&jQuery(".hu-cookies-save").on("click",(function(t){e.updateConsentCookieValues(),e.unblockAllScripts(y.categories.analytics,y.categories.ads),e.updateGoogleConsentMode(y.categories.analytics,y.categories.ads)}))}))}))})),window.hu&&e.huObserver.observe(document.documentElement||document.body,{childList:!0,subtree:!0}),e.version=function(){console.log(wpmDataLayer.version)},e.loadScriptAndCacheIt=function(e,t){return t=jQuery.extend(t||{},{dataType:"script",cache:!0,url:e}),jQuery.ajax(t)},e.getOrderItemPrice=function(e){return(e.total+e.total_tax)/e.quantity},e.hasLoginEventFired=function(){let t=e.getWpmSessionData();return null==t?void 0:t.loginEventFired},e.setLoginEventFired=function(){let t=e.getWpmSessionData();t.loginEventFired=!0,e.setWpmSessionData(t)},e.wpmDataLayerExists=function(){return new Promise((function(e){!function t(){if("undefined"!=typeof wpmDataLayer)return e();setTimeout(t,50)}()}))},e.pageLoaded=function(){return new Promise((function(e){!function t(){if("complete"===document.readyState)return e();setTimeout(t,50)}()}))},window.wpmLoaded={}}(window.wpm=window.wpm||{},jQuery),jQuery((function(){wpm.wpmDataLayerExists().then((function(){wpm.startIntersectionObserverToWatch(),wpm.startProductsMutationObserverToWatch()}))})),jQuery(document).on("click",".remove_from_cart_button, .remove",(function(e){try{let e=new URL(jQuery(this).attr("href")),t=wpm.getProductIdByCartItemKeyUrl(e);wpm.removeProductFromCart(t)}catch(e){console.error(e)}})),jQuery(document).on("click",".add_to_cart_button:not(.product_type_variable), .ajax_add_to_cart, .single_add_to_cart_button",(function(e){try{if("product"===wpmDataLayer.shop.page_type){if(void 0!==jQuery(this).attr("href")&&jQuery(this).attr("href").includes("add-to-cart")){let e=1,t=jQuery(this).data("product_id");wpm.addProductToCart(t,e)}else if("simple"===wpmDataLayer.shop.product_type){let e=Number(jQuery(".input-text.qty").val());e||0===e||(e=1);let t=jQuery(this).val();wpm.addProductToCart(t,e)}else if("variable"===wpmDataLayer.shop.product_type){let e=Number(jQuery(".input-text.qty").val());e||0===e||(e=1);let t=jQuery("[name='variation_id']").val();wpm.addProductToCart(t,e)}else if("grouped"===wpmDataLayer.shop.product_type)jQuery(".woocommerce-grouped-product-list-item").each((function(){let e=Number(jQuery(this).find(".input-text.qty").val());e||0===e||(e=1);let t=jQuery(this).attr("class"),a=wpm.getPostIdFromString(t);wpm.addProductToCart(a,e)}));else if("bundle"===wpmDataLayer.shop.product_type){let e=Number(jQuery(".input-text.qty").val());e||0===e||(e=1);let t=jQuery("input[name=add-to-cart]").val();wpm.addProductToCart(t,e)}}else{let e=1,t=jQuery(this).data("product_id");wpm.addProductToCart(t,e)}}catch(e){console.error(e)}})),jQuery(document).one("click","a:not(.add_to_cart_button, .ajax_add_to_cart, .single_add_to_cart_button)",(function(e){try{if(jQuery(e.target).closest("a").attr("href")){let t=jQuery(e.target).closest("a").attr("href");if(t.includes("add-to-cart=")){let e=t.match(/(add-to-cart=)(\d+)/);e&&wpm.addProductToCart(e[2],1)}}}catch(e){console.error(e)}})),jQuery(document).on("click",".woocommerce-LoopProduct-link, .wc-block-grid__product, .product, .product-small, .type-product",(function(e){try{let e=jQuery(this).nextAll(".wpmProductId:first").data("id");if(e){if(e=getIdBasedOndVariationsOutputSetting(e),!e)throw Error("Wasn't able to retrieve a productId");if(wpmDataLayer.products&&wpmDataLayer.products[e]){let t=wpm.getProductDetailsFormattedForEvent(e);jQuery(document).trigger("wpmSelectContentGaUa",t),jQuery(document).trigger("wpmSelectItem",t)}}}catch(e){console.error(e)}})),jQuery(document).one("click",".checkout-button, .cart-checkout-button, .button.checkout",(function(e){jQuery(document).trigger("wpmBeginCheckout")})),jQuery(document).on("input","#billing_email",(function(){wpm.isEmail(jQuery(this).val())&&(wpm.fireCheckoutProgress(2),wpm.emailSelected=!0)})),jQuery(document).on("click",".wc_payment_methods",(function(){!1===wpm.paymentMethodSelected&&wpm.fireCheckoutProgress(3),wpm.fireCheckoutOption(3,jQuery("input[name='payment_method']:checked").val()),wpm.paymentMethodSelected=!0})),jQuery(document).one("click","#place_order",(function(){!1===wpm.emailSelected&&wpm.fireCheckoutProgress(2),!1===wpm.paymentMethodSelected&&(wpm.fireCheckoutProgress(3),wpm.fireCheckoutOption(3,jQuery("input[name='payment_method']:checked").val())),wpm.fireCheckoutProgress(4)})),jQuery(document).on("click","[name='update_cart']",(function(e){try{jQuery(".cart_item").each((function(){let e=new URL(jQuery(this).find(".product-remove").find("a").attr("href")),t=wpm.getProductIdByCartItemKeyUrl(e),a=jQuery(this).find(".qty").val();0===a?wpm.removeProductFromCart(t):a<wpmDataLayer.cart[t].quantity?wpm.removeProductFromCart(t,wpmDataLayer.cart[t].quantity-a):a>wpmDataLayer.cart[t].quantity&&wpm.addProductToCart(t,a-wpmDataLayer.cart[t].quantity)}))}catch(e){console.error(e),wpm.getCartItemsFromBackend()}})),jQuery(document).on("click",".add_to_wishlist, .wl-add-to",(function(){try{let e;if(jQuery(this).data("productid")?e=jQuery(this).data("productid"):jQuery(this).data("product-id")&&(e=jQuery(this).data("product-id")),!e)throw Error("Wasn't able to retrieve a productId");let t=wpm.getProductDetailsFormattedForEvent(e);jQuery(document).trigger("wpmAddToWishlist",t)}catch(e){console.error(e)}})),jQuery(document).on("updated_cart_totals",(function(){jQuery(document).trigger("wpmViewCart")})),jQuery(window).on("wpmLoad",(function(){try{JSON.parse(sessionStorage.getItem("wpmMiniCartActive"))&&JSON.parse(sessionStorage.getItem("wpmFirstPageLoad"))&&!0===wpmDataLayer.shop.mini_cart.track?wpm.getCartItems():sessionStorage.setItem("wpmFirstPageLoad",JSON.stringify(!0))}catch(e){console.error(e)}})),jQuery(window).on("wpmLoad",(function(){wpmDataLayer.products=wpmDataLayer.products||{};let e=wpm.getAddToCartLinkProductIds();wpm.getProductsFromBackend(e)})),jQuery(window).on("wpmLoad",(function(){if(!wpm.getCookie("wpmReferrer"))if(document.referrer){let e=new URL(document.referrer).hostname;e!==window.location.host?wpm.setCookie("wpmReferrer",e):wpm.setCookie("wpmReferrer","")}else wpm.setCookie("wpmReferrer","")})),jQuery(window).on("wpmLoad",(function(){try{var e;if("undefined"!=typeof wpmDataLayer&&(null===(e=wpmDataLayer)||void 0===e||!e.wpmLoadFired)){if(jQuery(document).trigger("wpmLoadAlways"),"product"===wpmDataLayer.shop.page_type&&"variable"!==wpmDataLayer.shop.product_type&&wpm.getMainProductIdFromProductPage()){let e=wpm.getProductDataForViewItemEvent(wpm.getMainProductIdFromProductPage());jQuery(document).trigger("wpmViewItem",e)}else"product_category"===wpmDataLayer.shop.page_type?jQuery(document).trigger("wpmCategory"):"search"===wpmDataLayer.shop.page_type?jQuery(document).trigger("wpmSearch"):"cart"===wpmDataLayer.shop.page_type?jQuery(document).trigger("wpmViewCart"):"order_received_page"===wpmDataLayer.shop.page_type&&wpmDataLayer.order?wpm.isOrderIdStored(wpmDataLayer.order.id)||(jQuery(document).trigger("wpmOrderReceivedPage"),wpm.writeOrderIdToStorage(wpmDataLayer.order.id)):jQuery(document).trigger("wpmEverywhereElse");wpmDataLayer.user.id&&!wpm.hasLoginEventFired()&&(jQuery(document).trigger("wpmLogin"),wpm.setLoginEventFired()),jQuery(document).ajaxSend((function(e,t,a){a.url.includes("get_refreshed_fragments")&&sessionStorage&&(sessionStorage.getItem("wpmMiniCartActive")||sessionStorage.setItem("wpmMiniCartActive",JSON.stringify(!0)))})),wpmDataLayer.wpmLoadFired=!0}}catch(e){console.error(e)}})),jQuery(window).on("wpmPreLoadPixels",(function(){var e,t,a;null!==(e=wpmDataLayer)&&void 0!==e&&null!==(t=e.shop)&&void 0!==t&&null!==(a=t.cookie_consent_mgmt)&&void 0!==a&&a.explicit_consent&&wpm.updateConsentCookieValues(!0),jQuery(document).trigger("wpmLoadPixels",{})})),jQuery((function(){jQuery(".single_variation_wrap").on("show_variation",(function(e,t){try{let e=getIdBasedOndVariationsOutputSetting(t.variation_id);if(!e)throw Error("Wasn't able to retrieve a productId");if(wpmDataLayer.products&&wpmDataLayer.products[e]){let t=wpm.getProductDetailsFormattedForEvent(e);jQuery(document).trigger("wpmViewItem",t)}}catch(e){console.error(e)}}))}))}},t={};function a(o){var r=t[o];if(void 0!==r)return r.exports;var n=t[o]={exports:{}};return e[o](n,n.exports,a),n.exports}a(230),a(577),a(354),a(464),a(234),a(785),a(570),a(497),a(560)})();
|
2 |
//# sourceMappingURL=wpm-public.p1.min.js.map
|
js/public/wpm-public.p1.min.js.map
CHANGED
@@ -1 +1 @@
|
|
1 |
-
{"version":3,"file":"wpm-public.p1.min.js","mappings":"sBAKAA,OAAOC,UAAUC,GAAG,iBAAiB,WAAY,gBAEhC,QAAZ,EAAAC,oBAAA,mBAAcC,cAAd,mBAAsBC,gBAAtB,UAAgCC,UAAY,UAACH,oBAAD,iBAAC,EAAcC,cAAf,iBAAC,EAAsBC,gBAAvB,OAAC,EAAgCE,QAC5EC,IAAIC,SAAS,MAAO,iBAAiBD,IAAIE,uBAK/CV,OAAOC,UAAUC,GAAG,gBAAgB,SAAUS,EAAOC,GAEpD,IAAI,UACH,GAAI,UAACT,oBAAD,iBAAC,EAAcC,cAAf,iBAAC,EAAsBC,gBAAvB,QAAC,EAAgCE,OAAQ,OAE7C,IAAIM,EAAUL,IAAIM,mBAIlBC,IAAI,QAAS,YAAa,CACzBC,aAAc,UACdC,aAAcL,EAAQM,KACtBC,YAAcP,EAAQQ,UAAUjB,aAAaC,OAAOC,SAASgB,oBAAoBC,SACjFC,MAAcC,WAAWZ,EAAQ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,GAE5B,IAAIC,EAAeH,EAAyBE,GAC5C,QAAqBna,IAAjBoa,EACH,OAAOA,EAAaC,QAGrB,IAAIC,EAASL,EAAyBE,GAAY,CAGjDE,QAAS,IAOV,OAHAE,EAAoBJ,GAAUG,EAAQA,EAAOD,QAASH,GAG/CI,EAAOD,QCjBf3X,EAAQ,KAGRrF,IAAIoc,eAAerW,MAAK,WAEvBV,EAAQ,KAERA,EAAQ,IACRA,EAAQ,IACRA,EAAQ,KAuBRA,EAAQ,S","sources":["webpack://WooCommerce-Pixel-Manager/./src/js/public/facebook/event_listeners.js","webpack://WooCommerce-Pixel-Manager/./src/js/public/facebook/functions.js","webpack://WooCommerce-Pixel-Manager/./src/js/public/facebook/loader.js","webpack://WooCommerce-Pixel-Manager/./src/js/public/google/ads/event_listeners.js","webpack://WooCommerce-Pixel-Manager/./src/js/public/google/ads/functions.js","webpack://WooCommerce-Pixel-Manager/./src/js/public/google/ads/loader.js","webpack://WooCommerce-Pixel-Manager/./src/js/public/google/analytics/ga3/event_listeners.js","webpack://WooCommerce-Pixel-Manager/./src/js/public/google/analytics/ga3/functions.js","webpack://WooCommerce-Pixel-Manager/./src/js/public/google/analytics/ga3/loader.js","webpack://WooCommerce-Pixel-Manager/./src/js/public/google/analytics/ga4/event_listeners.js","webpack://WooCommerce-Pixel-Manager/./src/js/public/google/analytics/ga4/functions.js","webpack://WooCommerce-Pixel-Manager/./src/js/public/google/analytics/ga4/loader.js","webpack://WooCommerce-Pixel-Manager/./src/js/public/google/analytics/loader.js","webpack://WooCommerce-Pixel-Manager/./src/js/public/google/base/event_listeners.js","webpack://WooCommerce-Pixel-Manager/./src/js/public/google/base/functions.js","webpack://WooCommerce-Pixel-Manager/./src/js/public/google/base/loader.js","webpack://WooCommerce-Pixel-Manager/./src/js/public/google/loader.js","webpack://WooCommerce-Pixel-Manager/./src/js/public/google/optimize/event_listeners.js","webpack://WooCommerce-Pixel-Manager/./src/js/public/google/optimize/functions.js","webpack://WooCommerce-Pixel-Manager/./src/js/public/google/optimize/loader.js","webpack://WooCommerce-Pixel-Manager/./src/js/public/hotjar/event_listeners.js","webpack://WooCommerce-Pixel-Manager/./src/js/public/hotjar/functions.js","webpack://WooCommerce-Pixel-Manager/./src/js/public/hotjar/loader.js","webpack://WooCommerce-Pixel-Manager/./src/js/public/wpm/event_listeners.js","webpack://WooCommerce-Pixel-Manager/./src/js/public/wpm/functions.js","webpack://WooCommerce-Pixel-Manager/./src/js/public/wpm/functions_loader.js","webpack://WooCommerce-Pixel-Manager/./src/js/public/wpm/init.js","webpack://WooCommerce-Pixel-Manager/webpack/bootstrap","webpack://WooCommerce-Pixel-Manager/./src/js/public/main.js"],"sourcesContent":["/**\n * All event listeners\n * */\n\n// Load pixel event\njQuery(document).on(\"wpmLoadPixels\", function () {\n\n\tif (wpmDataLayer?.pixels?.facebook?.pixel_id && !wpmDataLayer?.pixels?.facebook?.loaded) {\n\t\tif (wpm.canIFire(\"ads\", \"facebook-ads\")) wpm.loadFacebookPixel()\n\t}\n})\n\n// AddToCart event\njQuery(document).on(\"wpmAddToCart\", function (event, product) {\n\n\ttry {\n\t\tif (!wpmDataLayer?.pixels?.facebook?.loaded) return\n\n\t\tlet eventId = wpm.getRandomEventId()\n\n\t\t// console.log('eventId: ' + eventId);\n\n\t\tfbq(\"track\", \"AddToCart\", {\n\t\t\tcontent_type: \"product\",\n\t\t\tcontent_name: product.name,\n\t\t\tcontent_ids : product.dyn_r_ids[wpmDataLayer.pixels.facebook.dynamic_remarketing.id_type],\n\t\t\tvalue : parseFloat(product.quantity * product.price),\n\t\t\tcurrency : product.currency,\n\t\t}, {\n\t\t\teventID: eventId,\n\t\t})\n\n\n\t\tproduct[\"currency\"] = wpmDataLayer.shop.currency\n\n\t\tjQuery(document).trigger(\"wpmFbCapiEvent\", {\n\t\t\tevent_name : \"AddToCart\",\n\t\t\tevent_id : eventId,\n\t\t\tuser_data : wpm.getFbUserData(),\n\t\t\tproduct_data : product,\n\t\t\tproduct_id : product.dyn_r_ids[wpmDataLayer.pixels.facebook.dynamic_remarketing.id_type],\n\t\t\tevent_source_url: window.location.href,\n\t\t})\n\t} catch (e) {\n\t\tconsole.error(e)\n\t}\n})\n\n// InitiateCheckout event\njQuery(document).on(\"wpmBeginCheckout\", function (event) {\n\n\ttry {\n\t\t// console.log('firing facebook ads InitiateCheckout event');\n\n\t\tif (!wpmDataLayer?.pixels?.facebook?.loaded) return\n\n\t\tlet eventId = wpm.getRandomEventId()\n\n\t\tfbq(\"track\", \"InitiateCheckout\", {}, {\n\t\t\teventID: eventId,\n\t\t})\n\n\t\tjQuery(document).trigger(\"wpmFbCapiEvent\", {\n\t\t\tevent_name : \"InitiateCheckout\",\n\t\t\tevent_id : eventId,\n\t\t\tuser_data : wpm.getFbUserData(),\n\t\t\tevent_source_url: window.location.href,\n\t\t})\n\t} catch (e) {\n\t\tconsole.error(e)\n\t}\n})\n\n// AddToWishlist event\njQuery(document).on(\"wpmAddToWishlist\", function (event, product) {\n\n\ttry {\n\t\t// console.log('firing facebook ads AddToWishlist event');\n\t\t// console.log(product);\n\n\t\tif (!wpmDataLayer?.pixels?.facebook?.loaded) return\n\n\t\tlet eventId = wpm.getRandomEventId()\n\n\t\tfbq(\"track\", \"AddToWishlist\", {\n\t\t\tcontent_type: \"product\",\n\t\t\tcontent_name: product.name,\n\t\t\tcontent_ids : product.dyn_r_ids[wpmDataLayer.pixels.facebook.dynamic_remarketing.id_type],\n\t\t\tvalue : parseFloat(product.quantity * product.price),\n\t\t\tcurrency : product.currency,\n\t\t}, {\n\t\t\teventID: eventId,\n\t\t})\n\n\n\t\tproduct[\"currency\"] = wpmDataLayer.shop.currency\n\n\t\tjQuery(document).trigger(\"wpmFbCapiEvent\", {\n\t\t\tevent_name : \"AddToWishlist\",\n\t\t\tevent_id : eventId,\n\t\t\tuser_data : wpm.getFbUserData(),\n\t\t\tproduct_data : product,\n\t\t\tproduct_id : product.dyn_r_ids[wpmDataLayer.pixels.facebook.dynamic_remarketing.id_type],\n\t\t\tevent_source_url: window.location.href,\n\t\t})\n\t} catch (e) {\n\t\tconsole.error(e)\n\t}\n})\n\n// ViewContent event\njQuery(document).on(\"wpmViewItem\", function (event, product) {\n\n\ttry {\n\t\t// console.log('firing facebook ads ViewContent event');\n\t\t// console.log(product);\n\n\t\tif (!wpmDataLayer?.pixels?.facebook?.loaded) return\n\n\t\twpm.fbViewContent(product)\n\t} catch (e) {\n\t\tconsole.error(e)\n\t}\n})\n\n// view search event\njQuery(document).on(\"wpmSearch\", function () {\n\n\ttry {\n\t\tif (!wpmDataLayer?.pixels?.facebook?.loaded) return\n\n\t\tlet eventId = wpm.getRandomEventId()\n\n\t\tfbq(\"track\", \"Search\", {}, {\n\t\t\teventID: eventId,\n\t\t})\n\n\t\tjQuery(document).trigger(\"wpmFbCapiEvent\", {\n\t\t\tevent_name : \"Search\",\n\t\t\tevent_id : eventId,\n\t\t\tuser_data : wpm.getFbUserData(),\n\t\t\tevent_source_url: window.location.href,\n\t\t})\n\t} catch (e) {\n\t\tconsole.error(e)\n\t}\n})\n\n// load always event\njQuery(document).on(\"wpmLoadAlways\", function () {\n\n\ttry {\n\t\tif (!wpmDataLayer?.pixels?.facebook?.loaded) return\n\n\t\twpm.setFbUserData()\n\t} catch (e) {\n\t\tconsole.error(e)\n\t}\n})\n\n// view order received page event\n// https://developers.pinterest.com/docs/tag/conversion/\njQuery(document).on(\"wpmOrderReceivedPage\", function () {\n\n\ttry {\n\t\tif (!wpmDataLayer?.pixels?.facebook?.loaded) return\n\n\t\tfbq(\"track\", \"Purchase\",\n\t\t\t{\n\t\t\t\tcontent_type: \"product\",\n\t\t\t\tvalue : wpmDataLayer.order.value_filtered,\n\t\t\t\tcurrency : wpmDataLayer.order.currency,\n\t\t\t\tcontent_ids : wpm.facebookContentIds(),\n\t\t\t},\n\t\t\t{eventID: wpmDataLayer.order.id},\n\t\t)\n\n\n\t\t// console.log(wpm.facebookContentIds())\n\t} catch (e) {\n\t\tconsole.error(e)\n\t}\n})\n","/**\n * Add functions for Facebook\n * */\n\n(function (wpm, $, undefined) {\n\n\tlet fBUserData\n\n\twpm.loadFacebookPixel = function () {\n\n\t\ttry {\n\t\t\twpmDataLayer.pixels.facebook.loaded = true\n\n\t\t\t// @formatter:off\n\t\t\t!function(f,b,e,v,n,t,s)\n\t\t\t{if(f.fbq)return;n=f.fbq=function(){n.callMethod?\n\t\t\t\tn.callMethod.apply(n,arguments):n.queue.push(arguments)};\n\t\t\t\tif(!f._fbq)f._fbq=n;n.push=n;n.loaded=!0;n.version='2.0';\n\t\t\t\tn.queue=[];t=b.createElement(e);t.async=!0;\n\t\t\t\tt.src=v;s=b.getElementsByTagName(e)[0];\n\t\t\t\ts.parentNode.insertBefore(t,s)}(window, document,'script',\n\t\t\t\t'https://connect.facebook.net/en_US/fbevents.js');\n\t\t\t// @formatter:on\n\n\t\t\tfbq(\"init\", wpmDataLayer.pixels.facebook.pixel_id)\n\t\t\tfbq(\"track\", \"PageView\")\n\n\t\t} catch (e) {\n\t\t\tconsole.error(e)\n\t\t}\n\t}\n\n\twpm.getRandomEventId = function () {\n\t\treturn (Math.random() + 1).toString(36).substring(2)\n\t}\n\n\twpm.getFbUserData = function () {\n\t\t// We need the first one for InitiateCheckout\n\t\t// where getting the user_data from the browser is too slow\n\t\t// using wpm.getCookie(), so we cache the user_data earlier.\n\t\t// And we need the second one because the ViewContent hit happens too fast\n\t\t// after adding a variation to the cart because the function to cache\n\t\t// the user_data is too slow. But we can get the user_data using wpm.getCookie()\n\t\t// because we don't move away from the page and can wait for the browser\n\t\t// to get it.\n\t\tif (fBUserData) {\n\t\t\treturn fBUserData\n\t\t} else {\n\t\t\treturn wpm.getFbUserDataFromBrowser()\n\t\t}\n\t}\n\n\twpm.setFbUserData = function () {\n\t\tfBUserData = wpm.getFbUserDataFromBrowser()\n\t}\n\n\twpm.getFbUserDataFromBrowser = function () {\n\t\treturn {\n\t\t\tfbp : wpm.getCookie(\"_fbp\"),\n\t\t\tfbc : wpm.getCookie(\"_fbc\"),\n\t\t\tclient_user_agent: navigator.userAgent,\n\t\t}\n\t}\n\n\twpm.fbViewContent = function (product) {\n\n\t\ttry {\n\t\t\tif (!wpmDataLayer?.pixels?.facebook?.loaded) return\n\n\t\t\tlet eventId = wpm.getRandomEventId()\n\n\t\t\tfbq(\"track\", \"ViewContent\", {\n\t\t\t\tcontent_type: \"product\",\n\t\t\t\tcontent_name: product.name,\n\t\t\t\t// content_category: product.category,\n\t\t\t\tcontent_ids: product.dyn_r_ids[wpmDataLayer.pixels.facebook.dynamic_remarketing.id_type],\n\t\t\t\tcurrency : wpmDataLayer.shop.currency,\n\t\t\t\tvalue : product.price,\n\t\t\t}, {\n\t\t\t\teventID: eventId,\n\t\t\t})\n\n\t\t\tproduct[\"currency\"] = wpmDataLayer.shop.currency\n\n\t\t\tjQuery(document).trigger(\"wpmFbCapiEvent\", {\n\t\t\t\tevent_name : \"ViewContent\",\n\t\t\t\tevent_id : eventId,\n\t\t\t\tuser_data : wpm.getFbUserData(),\n\t\t\t\tproduct_data : product,\n\t\t\t\tproduct_id : product.dyn_r_ids[wpmDataLayer.pixels.facebook.dynamic_remarketing.id_type],\n\t\t\t\tevent_source_url: window.location.href,\n\t\t\t})\n\t\t} catch (e) {\n\t\t\tconsole.error(e)\n\t\t}\n\t}\n\n\twpm.facebookContentIds = function () {\n\t\tlet prodIds = []\n\n\t\tfor (const [key, item] of Object.entries(wpmDataLayer.order.items)) {\n\n\t\t\tif (wpmDataLayer?.general?.variationsOutput && 0 !== item.variation_id) {\n\t\t\t\tprodIds.push(String(wpmDataLayer.products[item.variation_id].dyn_r_ids[wpmDataLayer.pixels.facebook.dynamic_remarketing.id_type]))\n\t\t\t} else {\n\t\t\t\tprodIds.push(String(wpmDataLayer.products[item.id].dyn_r_ids[wpmDataLayer.pixels.facebook.dynamic_remarketing.id_type]))\n\t\t\t}\n\t\t}\n\n\t\treturn prodIds\n\t}\n\n}(window.wpm = window.wpm || {}, jQuery));\n","/**\n * Facebook loader\n */\n\nrequire(\"./functions\")\nrequire(\"./event_listeners\")\n\n// #if process.env.TIER === 'premium'\n// require(\"./functions_premium\")\n// require(\"./event_listeners_premium\")\n// #endif\n\n","/**\n * Load Google Ads event listeners\n * */\n\n// view_item_list event\njQuery(document).on(\"wpmViewItemList\", function (event, product) {\n\n\ttry {\n\t\tif(jQuery.isEmptyObject(wpmDataLayer?.pixels?.google?.ads?.conversionIds)) return\n\t\tif (!wpmDataLayer?.pixels?.google?.ads?.dynamic_remarketing?.status) return\n\t\tif (!wpm.googleConfigConditionsMet(\"ads\")) return\n\n\n\t\tif (\n\t\t\twpmDataLayer?.general?.variationsOutput &&\n\t\t\tproduct.isVariable &&\n\t\t\twpmDataLayer.pixels.google.ads.dynamic_remarketing.send_events_with_parent_ids === false\n\t\t) return\n\n\t\t// try to prevent that WC sends cached hits to Google\n\t\tif (!product) return\n\n\t\twpm.gtagLoaded().then(function () {\n\t\t\tgtag(\"event\", \"view_item_list\", {\n\t\t\t\tsend_to: wpm.getGoogleAdsConversionIdentifiers(),\n\t\t\t\titems : [{\n\t\t\t\t\tid : product.dyn_r_ids[wpmDataLayer.pixels.google.ads.dynamic_remarketing.id_type],\n\t\t\t\t\tgoogle_business_vertical: wpmDataLayer.pixels.google.ads.google_business_vertical,\n\t\t\t\t}],\n\t\t\t})\n\t\t})\n\t} catch (e) {\n\t\tconsole.error(e)\n\t}\n})\n\n// add_to_cart event\njQuery(document).on(\"wpmAddToCart\", function (event, product) {\n\n\ttry {\n\t\tif(jQuery.isEmptyObject(wpmDataLayer?.pixels?.google?.ads?.conversionIds)) return\n\t\tif (!wpmDataLayer?.pixels?.google?.ads?.dynamic_remarketing?.status) return\n\t\tif (!wpm.googleConfigConditionsMet(\"ads\")) return\n\n\t\twpm.gtagLoaded().then(function () {\n\t\t\tgtag(\"event\", \"add_to_cart\", {\n\t\t\t\tsend_to: wpm.getGoogleAdsConversionIdentifiers(),\n\t\t\t\tvalue : product.quantity * product.price,\n\t\t\t\titems : [{\n\t\t\t\t\tid : product.dyn_r_ids[wpmDataLayer.pixels.google.ads.dynamic_remarketing.id_type],\n\t\t\t\t\tquantity : product.quantity,\n\t\t\t\t\tprice : product.price,\n\t\t\t\t\tgoogle_business_vertical: wpmDataLayer.pixels.google.ads.google_business_vertical,\n\t\t\t\t}],\n\t\t\t})\n\t\t})\n\t} catch (e) {\n\t\tconsole.error(e)\n\t}\n})\n\n// view_item event\njQuery(document).on(\"wpmViewItem\", function (event, product) {\n\n\ttry {\n\t\tif(jQuery.isEmptyObject(wpmDataLayer?.pixels?.google?.ads?.conversionIds)) return\n\t\tif (!wpmDataLayer?.pixels?.google?.ads?.dynamic_remarketing?.status) return\n\t\tif (!wpm.googleConfigConditionsMet(\"ads\")) return\n\n\n\t\twpm.gtagLoaded().then(function () {\n\t\t\tgtag(\"event\", \"view_item\", {\n\t\t\t\tsend_to: wpm.getGoogleAdsConversionIdentifiers(),\n\t\t\t\tvalue : (product.quantity ? product.quantity : 1) * product.price,\n\t\t\t\titems : [{\n\t\t\t\t\tid : product.dyn_r_ids[wpmDataLayer.pixels.google.ads.dynamic_remarketing.id_type],\n\t\t\t\t\tquantity : (product.quantity ? product.quantity : 1),\n\t\t\t\t\tprice : product.price,\n\t\t\t\t\tgoogle_business_vertical: wpmDataLayer.pixels.google.ads.google_business_vertical,\n\t\t\t\t}],\n\t\t\t})\n\t\t})\n\t} catch (e) {\n\t\tconsole.error(e)\n\t}\n})\n\n\n// view search event\njQuery(document).on(\"wpmSearch\", function () {\n\n\ttry {\n\t\tif(jQuery.isEmptyObject(wpmDataLayer?.pixels?.google?.ads?.conversionIds)) return\n\t\tif (!wpmDataLayer?.pixels?.google?.ads?.dynamic_remarketing?.status) return\n\t\tif (!wpm.googleConfigConditionsMet(\"ads\")) return\n\n\n\t\tlet products = []\n\n\t\tfor (const [key, product] of Object.entries(wpmDataLayer.products)) {\n\n\t\t\tif (\n\t\t\t\twpmDataLayer?.general?.variationsOutput &&\n\t\t\t\tproduct.isVariable &&\n\t\t\t\twpmDataLayer.pixels.google.ads.dynamic_remarketing.send_events_with_parent_ids === false\n\t\t\t) return\n\n\t\t\tproducts.push({\n\t\t\t\tid : product.dyn_r_ids[wpmDataLayer.pixels.google.ads.dynamic_remarketing.id_type],\n\t\t\t\tgoogle_business_vertical: wpmDataLayer.pixels.google.ads.google_business_vertical,\n\t\t\t})\n\t\t}\n\n\t\t// console.log(products);\n\n\t\twpm.gtagLoaded().then(function () {\n\t\t\tgtag(\"event\", \"view_search_results\", {\n\t\t\t\tsend_to: wpm.getGoogleAdsConversionIdentifiers(),\n\t\t\t\t// value : 1 * product.price,\n\t\t\t\titems: products,\n\t\t\t})\n\t\t})\n\t} catch (e) {\n\t\tconsole.error(e)\n\t}\n})\n\n\n// view order received page event\n// TODO distinguish with or without cart data active\njQuery(document).on(\"wpmOrderReceivedPage\", function () {\n\n\ttry {\n\t\tif(jQuery.isEmptyObject(wpmDataLayer?.pixels?.google?.ads?.conversionIds)) return\n\t\tif (!wpmDataLayer?.pixels?.google?.ads?.dynamic_remarketing?.status) return\n\t\tif (!wpm.googleConfigConditionsMet(\"ads\")) return\n\n\t\twpm.gtagLoaded().then(function () {\n\t\t\tgtag(\"event\", \"purchase\", {\n\t\t\t\tsend_to: wpm.getGoogleAdsConversionIdentifiers(),\n\t\t\t\tvalue : wpmDataLayer.order.value_filtered,\n\t\t\t\titems : wpm.getGoogleAdsDynamicRemarketingOrderItems(),\n\t\t\t})\n\t\t})\n\n\t\t// console.log(wpm.getGoogleAdsDynamicRemarketingOrderItems())\n\t} catch (e) {\n\t\tconsole.error(e)\n\t}\n})\n\n// user log in event\njQuery(document).on(\"wpmLogin\", function () {\n\n\ttry {\n\t\tif(jQuery.isEmptyObject(wpmDataLayer?.pixels?.google?.ads?.conversionIds)) return\n\t\tif (!wpmDataLayer?.pixels?.google?.ads?.dynamic_remarketing?.status) return\n\t\tif (!wpm.googleConfigConditionsMet(\"ads\")) return\n\n\n\t\twpm.gtagLoaded().then(function () {\n\t\t\tgtag(\"event\", \"login\", {\n\t\t\t\tsend_to: wpm.getGoogleAdsConversionIdentifiers(),\n\t\t\t})\n\t\t})\n\t} catch (e) {\n\t\tconsole.error(e)\n\t}\n})\n\n// view order received page event\n// new_customer parameter: https://support.google.com/google-ads/answer/9917012\njQuery(document).on(\"wpmOrderReceivedPage\", function () {\n\n\ttry {\n\t\tif(jQuery.isEmptyObject(wpmDataLayer?.pixels?.google?.ads?.conversionIds)) return\n\t\tif (!wpm.googleConfigConditionsMet(\"ads\")) return\n\n\t\tlet data_basic = {}\n\t\tlet data_with_cart = {}\n\n\t\tdata_basic = {\n\t\t\tsend_to : wpm.getGoogleAdsConversionIdentifiersWithLabel(),\n\t\t\ttransaction_id: wpmDataLayer.order.number,\n\t\t\tvalue : wpmDataLayer.order.value_filtered,\n\t\t\tcurrency : wpmDataLayer.order.currency,\n\t\t\tnew_customer : wpmDataLayer.order.new_customer,\n\t\t}\n\n\t\tif (wpmDataLayer?.order?.aw_merchant_id) {\n\t\t\tdata_with_cart = {\n\t\t\t\tdiscount : wpmDataLayer.order.discount,\n\t\t\t\taw_merchant_id : wpmDataLayer.order.aw_merchant_id,\n\t\t\t\taw_feed_country : wpmDataLayer.order.aw_feed_country,\n\t\t\t\taw_feed_language: wpmDataLayer.order.aw_feed_language,\n\t\t\t\titems : wpm.getGoogleAdsRegularOrderItems(),\n\t\t\t}\n\t\t}\n\n\t\twpm.gtagLoaded().then(function () {\n\t\t\tgtag(\"event\", \"conversion\", {...data_basic, ...data_with_cart})\n\t\t})\n\n\t\t// console.log({...data_basic,...data_with_cart})\n\n\t\t// console.log(wpm.getGoogleAdsOrderItems())\n\t} catch (e) {\n\t\tconsole.error(e)\n\t}\n})\n\n\n\n\n\n","/**\n * Load Google Ads functions\n * */\n\n(function (wpm, $, undefined) {\n\n\tlet conversionIdentifiers = []\n\n\twpm.getGoogleAdsConversionIdentifiersWithLabel = function () {\n\t\tfor (const [key, item] of Object.entries(wpmDataLayer.pixels.google.ads.conversionIds)) {\n\t\t\tconversionIdentifiers.push(key + \"/\" + item)\n\t\t}\n\t\treturn conversionIdentifiers\n\t}\n\n\twpm.getGoogleAdsConversionIdentifiers = function () {\n\n\t\tlet conversionIdentifiers = []\n\t\tfor (const [key, item] of Object.entries(wpmDataLayer.pixels.google.ads.conversionIds)) {\n\t\t\tconversionIdentifiers.push(key)\n\t\t}\n\n\t\treturn conversionIdentifiers\n\t}\n\n\twpm.getGoogleAdsRegularOrderItems = function () {\n\t\t// \"id\" : \"gla_34\",\n\t\t// \"quantity\": 1,\n\t\t// \"price\" : 45\n\n\t\tlet orderItems = []\n\n\t\tfor (const [key, item] of Object.entries(wpmDataLayer.order.items)) {\n\n\t\t\tlet orderItem\n\n\t\t\torderItem = {\n\t\t\t\tquantity: item.quantity,\n\t\t\t\tprice : item.price,\n\t\t\t}\n\n\t\t\tif (wpmDataLayer?.general?.variationsOutput && 0 !== item.variation_id) {\n\n\t\t\t\torderItem.id = String(wpmDataLayer.products[item.variation_id].dyn_r_ids[wpmDataLayer.pixels.google.ads.dynamic_remarketing.id_type])\n\t\t\t\torderItems.push(orderItem)\n\t\t\t} else {\n\n\t\t\t\torderItem.id = String(wpmDataLayer.products[item.id].dyn_r_ids[wpmDataLayer.pixels.google.ads.dynamic_remarketing.id_type])\n\t\t\t\torderItems.push(orderItem)\n\t\t\t}\n\t\t}\n\n\t\treturn orderItems\n\t}\n\n\twpm.getGoogleAdsDynamicRemarketingOrderItems = function () {\n\t\t// \"id\" : \"gla_34\",\n\t\t// \"quantity\" : 1,\n\t\t// \"price\" : 45,\n\t\t// \"google_business_vertical\": \"retail\"\n\n\t\tlet orderItems = []\n\n\t\tfor (const [key, item] of Object.entries(wpmDataLayer.order.items)) {\n\n\t\t\tlet orderItem\n\n\t\t\torderItem = {\n\t\t\t\tquantity : item.quantity,\n\t\t\t\tprice : item.price,\n\t\t\t\tgoogle_business_vertical: wpmDataLayer.pixels.google.ads.google_business_vertical,\n\t\t\t}\n\n\t\t\tif (wpmDataLayer?.general?.variationsOutput && 0 !== item.variation_id) {\n\n\t\t\t\torderItem.id = String(wpmDataLayer.products[item.variation_id].dyn_r_ids[wpmDataLayer.pixels.google.ads.dynamic_remarketing.id_type])\n\t\t\t\torderItems.push(orderItem)\n\t\t\t} else {\n\n\t\t\t\torderItem.id = String(wpmDataLayer.products[item.id].dyn_r_ids[wpmDataLayer.pixels.google.ads.dynamic_remarketing.id_type])\n\t\t\t\torderItems.push(orderItem)\n\t\t\t}\n\t\t}\n\n\t\treturn orderItems\n\t}\n\n}(window.wpm = window.wpm || {}, jQuery))\n","/**\n * Load Google Ads\n */\n\n\nrequire(\"./functions\")\nrequire(\"./event_listeners\")\n","/**\n * Load Google Universal Analytics (GA3) event listeners\n * */\n\n\n// view order received page event\njQuery(document).on(\"wpmOrderReceivedPage\", function () {\n\n\ttry {\n\t\tif (!wpmDataLayer?.pixels?.google?.analytics?.universal?.property_id) return\n\t\tif (wpmDataLayer?.pixels?.google?.analytics?.universal?.mp_active) return\n\t\tif (!wpm.googleConfigConditionsMet(\"analytics\")) return\n\n\t\twpm.gtagLoaded().then(function () {\n\t\t\tgtag(\"event\", \"purchase\", {\n\t\t\t\tsend_to : [wpmDataLayer.pixels.google.analytics.universal.property_id],\n\t\t\t\ttransaction_id: wpmDataLayer.order.number,\n\t\t\t\taffiliation : wpmDataLayer.order.affiliation,\n\t\t\t\tcurrency : wpmDataLayer.order.currency,\n\t\t\t\tvalue : wpmDataLayer.order.value_regular,\n\t\t\t\tdiscount : wpmDataLayer.order.discount,\n\t\t\t\ttax : wpmDataLayer.order.tax,\n\t\t\t\tshipping : wpmDataLayer.order.shipping,\n\t\t\t\tcoupon : wpmDataLayer.order.coupon,\n\t\t\t\titems : wpm.getGAUAOrderItems(),\n\t\t\t})\n\t\t})\n\n\t\t// console.log(wpm.getGAUAOrderItems())\n\t} catch (e) {\n\t\tconsole.error(e)\n\t}\n})\n","/**\n * Add functions for Google Analytics Universal\n * */\n\n(function (wpm, $, undefined) {\n\n\twpm.getGAUAOrderItems = function () {\n\n\t\t// \"id\" : \"34\",\n\t\t// \"name\" : \"Hoodie\",\n\t\t// \"brand\" : \"\",\n\t\t// \"category\" : \"Hoodies\",\n\t\t// \"list_position\": 1,\n\t\t// \"price\" : 45,\n\t\t// \"quantity\" : 1,\n\t\t// \"variant\" : \"Color: blue | Logo: yes\"\n\n\n\t\tlet orderItems = [],\n\t\t\tlist_position = 1\n\n\t\tfor (const [key, item] of Object.entries(wpmDataLayer.order.items)) {\n\n\t\t\tlet orderItem\n\n\t\t\torderItem = {\n\t\t\t\tquantity : item.quantity,\n\t\t\t\tprice : item.price,\n\t\t\t\tname : item.name,\n\t\t\t\tcurrency : wpmDataLayer.order.currency,\n\t\t\t\tcategory : wpmDataLayer.products[item.id].category.join(\"/\"),\n\t\t\t\tlist_position: list_position,\n\t\t\t}\n\n\t\t\tif (wpmDataLayer?.general?.variationsOutput && 0 !== item.variation_id) {\n\n\t\t\t\torderItem.id = String(wpmDataLayer.products[item.variation_id].dyn_r_ids[wpmDataLayer.pixels.google.analytics.id_type])\n\t\t\t\torderItem.variant = wpmDataLayer.products[item.variation_id].variant_name\n\t\t\t\torderItem.brand = wpmDataLayer.products[item.variation_id].brand\n\t\t\t} else {\n\n\t\t\t\torderItem.id = String(wpmDataLayer.products[item.id].dyn_r_ids[wpmDataLayer.pixels.google.analytics.id_type])\n\t\t\t\torderItem.brand = wpmDataLayer.products[item.id].brand\n\t\t\t}\n\n\t\t\torderItems.push(orderItem)\n\t\t\tlist_position++\n\t\t}\n\n\t\treturn orderItems\n\t}\n\n}(window.wpm = window.wpm || {}, jQuery))\n","/**\n * Google Universal Analytics (GA3) loader\n */\n\nrequire(\"./functions\")\nrequire(\"./event_listeners\")\n\n// #if process.env.TIER === 'premium'\n// require(\"./functions_premium\")\n// require(\"./event_listeners_premium\")\n// #endif\n","/**\n * Load GA4 event listeners\n * */\n\n\n// view order received page event\njQuery(document).on(\"wpmOrderReceivedPage\", function () {\n\n\ttry {\n\t\tif (!wpmDataLayer?.pixels?.google?.analytics?.ga4?.measurement_id) return\n\t\tif (wpmDataLayer?.pixels?.google?.analytics?.ga4?.mp_active) return\n\t\tif (!wpm.googleConfigConditionsMet(\"analytics\")) return\n\n\t\twpm.gtagLoaded().then(function () {\n\t\t\tgtag(\"event\", \"purchase\", {\n\t\t\t\tsend_to : [wpmDataLayer.pixels.google.analytics.ga4.measurement_id],\n\t\t\t\ttransaction_id: wpmDataLayer.order.number,\n\t\t\t\taffiliation : wpmDataLayer.order.affiliation,\n\t\t\t\tcurrency : wpmDataLayer.order.currency,\n\t\t\t\tvalue : wpmDataLayer.order.value_regular,\n\t\t\t\tdiscount : wpmDataLayer.order.discount,\n\t\t\t\ttax : wpmDataLayer.order.tax,\n\t\t\t\tshipping : wpmDataLayer.order.shipping,\n\t\t\t\tcoupon : wpmDataLayer.order.coupon,\n\t\t\t\titems : wpm.getGA4OrderItems(),\n\t\t\t})\n\t\t})\n\t} catch (e) {\n\t\tconsole.error(e)\n\t}\n})\n","/**\n * Load GA4 functions\n * */\n\n(function (wpm, $, undefined) {\n\n\twpm.getGA4OrderItems = function () {\n\n\t\t// \"item_id\" : \"34\",\n\t\t// \"item_name\" : \"Hoodie\",\n\t\t// \"quantity\" : 1,\n\t\t// \"item_brand\" : \"\",\n\t\t// \"item_variant\" : \"Color: blue | Logo: yes\",\n\t\t// \"price\" : 45,\n\t\t// \"currency\" : \"CHF\",\n\t\t// \"item_category\": \"Hoodies\"\n\n\n\t\tlet orderItems = []\n\n\t\tfor (const [key, item] of Object.entries(wpmDataLayer.order.items)) {\n\n\t\t\tlet orderItem\n\n\t\t\torderItem = {\n\t\t\t\tquantity : item.quantity,\n\t\t\t\tprice : item.price,\n\t\t\t\titem_name : item.name,\n\t\t\t\tcurrency : wpmDataLayer.order.currency,\n\t\t\t\titem_category: wpmDataLayer.products[item.id].category.join(\"/\"),\n\t\t\t}\n\n\t\t\tif (wpmDataLayer?.general?.variationsOutput && 0 !== item.variation_id) {\n\n\t\t\t\torderItem.item_id = String(wpmDataLayer.products[item.variation_id].dyn_r_ids[wpmDataLayer.pixels.google.analytics.id_type])\n\t\t\t\torderItem.item_variant = wpmDataLayer.products[item.variation_id].variant_name\n\t\t\t\torderItem.item_brand = wpmDataLayer.products[item.variation_id].brand\n\t\t\t} else {\n\n\t\t\t\torderItem.item_id = String(wpmDataLayer.products[item.id].dyn_r_ids[wpmDataLayer.pixels.google.analytics.id_type])\n\t\t\t\torderItem.item_brand = wpmDataLayer.products[item.id].brand\n\t\t\t}\n\n\t\t\torderItems.push(orderItem)\n\t\t}\n\n\t\treturn orderItems\n\t}\n\n}(window.wpm = window.wpm || {}, jQuery))\n","/**\n * GA4 loader\n */\n\nrequire(\"./functions\")\nrequire(\"./event_listeners\")\n\n// #if process.env.TIER === 'premium'\n// require(\"./functions_premium\")\n// require(\"./event_listeners_premium\")\n// #endif\n","/**\n * Google Analytics loader\n */\n\nrequire(\"./ga3/loader\")\nrequire(\"./ga4/loader\")\n","/**\n * Load Google base event listeners\n */\n\n// Pixel load event listener\njQuery(document).on(\"wpmLoadPixels\", function () {\n\n\tif (typeof wpmDataLayer?.pixels?.google?.state === \"undefined\") {\n\t\tif (wpm.canGoogleLoad()) {\n\t\t\twpm.loadGoogle()\n\t\t} else {\n\t\t\twpm.logPreventedPixelLoading(\"google\", \"analytics / ads\")\n\t\t}\n\t}\n})\n","/**\n * Load Google base functions\n */\n\n(function (wpm, $, undefined) {\n\n\twpm.googleConfigConditionsMet = function (type) {\n\t\t// always returns true if Google Consent Mode is active\n\t\tif (wpmDataLayer?.pixels?.google?.consent_mode?.active) {\n\t\t\treturn true\n\t\t} else if (wpm.getConsentValues().mode === \"category\") {\n\t\t\treturn wpm.getConsentValues().categories[type] === true\n\t\t} else if (wpm.getConsentValues().mode === \"pixel\") {\n\t\t\treturn wpm.getConsentValues().pixels.includes(\"google-\" + type)\n\t\t} else {\n\t\t\treturn false\n\t\t}\n\t}\n\n\twpm.getVisitorConsentStatusAndUpdateGoogleConsentSettings = function (google_consent_settings) {\n\n\t\tif (wpm.getConsentValues().mode === \"category\") {\n\t\t\tif (wpm.getConsentValues().categories.analytics) google_consent_settings.analytics_storage = \"granted\"\n\t\t\tif (wpm.getConsentValues().categories.ads) google_consent_settings.ad_storage = \"granted\"\n\t\t} else if ((wpm.getConsentValues().mode === \"pixel\")) {\n\t\t\tgoogle_consent_settings.analytics_storage = wpm.getConsentValues().pixels.includes(\"google-analytics\") ? \"granted\" : \"denied\"\n\t\t\tgoogle_consent_settings.ad_storage = wpm.getConsentValues().pixels.includes(\"google-ads\") ? \"granted\" : \"denied\"\n\t\t}\n\n\t\treturn google_consent_settings\n\t}\n\n\twpm.updateGoogleConsentMode = function (analytics = true, ads = true) {\n\n\t\ttry {\n\t\t\tif (\n\t\t\t\t!window.gtag ||\n\t\t\t\t!wpmDataLayer.shop.cookie_consent_mgmt.explicit_consent\n\t\t\t) return\n\n\t\t\tgtag(\"consent\", \"update\", {\n\t\t\t\tanalytics_storage: analytics ? \"granted\" : \"denied\",\n\t\t\t\tad_storage : ads ? \"granted\" : \"denied\",\n\t\t\t})\n\t\t} catch (e) {\n\t\t\tconsole.error(e)\n\t\t}\n\t}\n\n\twpm.fireGtagGoogleAds = function () {\n\t\ttry {\n\t\t\twpmDataLayer.pixels.google.ads.state = \"loading\"\n\n\t\t\tif (wpmDataLayer?.pixels?.google?.ads?.enhanced_conversions?.active) {\n\t\t\t\tfor (const [key, item] of Object.entries(wpmDataLayer.pixels.google.ads.conversionIds)) {\n\t\t\t\t\tgtag(\"config\", key, {\"allow_enhanced_conversions\": true})\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tfor (const [key, item] of Object.entries(wpmDataLayer.pixels.google.ads.conversionIds)) {\n\t\t\t\t\tgtag(\"config\", key)\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (wpmDataLayer?.pixels?.google?.ads?.conversionIds && wpmDataLayer?.pixels?.google?.ads?.phone_conversion_label && wpmDataLayer?.pixels?.google?.ads?.phone_conversion_number) {\n\t\t\t\tgtag(\"config\", Object.keys(wpmDataLayer.pixels.google.ads.conversionIds)[0] + \"/\" + wpmDataLayer.pixels.google.ads.phone_conversion_label, {\n\t\t\t\t\tphone_conversion_number: wpmDataLayer.pixels.google.ads.phone_conversion_number,\n\t\t\t\t})\n\t\t\t}\n\n\t\t\t// ! enhanced_conversion_data needs to be var\n\t\t\t// https://support.google.com/google-ads/answer/9888145#zippy=%2Cvalidate-your-implementation-using-chrome-developer-tools\n\t\t\tif (\"order_received_page\" === wpmDataLayer.shop.page_type && wpmDataLayer?.order?.google?.ads?.enhanced_conversion_data) {\n\t\t\t\twindow.enhanced_conversion_data = wpmDataLayer.order.google.ads.enhanced_conversion_data\n\t\t\t}\n\n\t\t\twpmDataLayer.pixels.google.ads.state = \"ready\"\n\t\t} catch (e) {\n\t\t\tconsole.error(e)\n\t\t}\n\t}\n\n\twpm.fireGtagGoogleAnalyticsUA = function () {\n\t\ttry {\n\t\t\twpmDataLayer.pixels.google.analytics.universal.state = \"loading\"\n\n\t\t\tgtag(\"config\", wpmDataLayer.pixels.google.analytics.universal.property_id, wpmDataLayer.pixels.google.analytics.universal.parameters)\n\t\t\twpmDataLayer.pixels.google.analytics.universal.state = \"ready\"\n\t\t} catch (e) {\n\t\t\tconsole.error(e)\n\t\t}\n\t}\n\n\twpm.fireGtagGoogleAnalyticsGA4 = function () {\n\t\ttry {\n\t\t\twpmDataLayer.pixels.google.analytics.ga4.state = \"loading\"\n\n\t\t\tgtag(\"config\", wpmDataLayer.pixels.google.analytics.ga4.measurement_id, wpmDataLayer.pixels.google.analytics.ga4.parameters)\n\t\t\twpmDataLayer.pixels.google.analytics.ga4.state = \"ready\"\n\t\t} catch (e) {\n\t\t\tconsole.error(e)\n\t\t}\n\t}\n\n\twpm.isGoogleActive = function () {\n\t\tif (\n\t\t\twpmDataLayer?.pixels?.google?.analytics?.universal?.property_id ||\n\t\t\twpmDataLayer?.pixels?.google?.analytics?.ga4?.measurement_id ||\n\t\t\t!jQuery.isEmptyObject(wpmDataLayer?.pixels?.google?.ads?.conversionIds)\n\t\t) {\n\t\t\treturn true\n\t\t} else {\n\t\t\treturn false\n\t\t}\n\t}\n\n\twpm.getGoogleGtagId = function () {\n\t\tif (wpmDataLayer?.pixels?.google?.analytics?.universal?.property_id) {\n\t\t\treturn wpmDataLayer.pixels.google.analytics.universal.property_id\n\t\t} else if (wpmDataLayer?.pixels?.google?.analytics?.ga4?.measurement_id) {\n\t\t\treturn wpmDataLayer.pixels.google.analytics.ga4.measurement_id\n\t\t} else {\n\t\t\treturn Object.keys(wpmDataLayer.pixels.google.ads.conversionIds)[0]\n\t\t}\n\t}\n\n\twpm.loadGoogle = function () {\n\n\t\tif (wpm.isGoogleActive()) {\n\n\t\t\twpmDataLayer.pixels.google.state = \"loading\"\n\n\t\t\twpm.loadScriptAndCacheIt(\"https://www.googletagmanager.com/gtag/js?id=\" + wpm.getGoogleGtagId())\n\t\t\t\t.done(function (script, textStatus) {\n\t\t\t\t\ttry {\n\t\t\t\t\t\t// console.log('Google Optimize loaded')\n\t\t\t\t\t\t// alert('Google Optimize loaded')\n\n\t\t\t\t\t\t// Initiate Google dataLayer and gtag\n\t\t\t\t\t\twindow.dataLayer = window.dataLayer || []\n\t\t\t\t\t\twindow.gtag = function gtag() {\n\t\t\t\t\t\t\tdataLayer.push(arguments)\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t// Google Consent Mode\n\t\t\t\t\t\tif (wpmDataLayer?.pixels?.google?.consent_mode?.active) {\n\n\t\t\t\t\t\t\tlet google_consent_settings = {\n\t\t\t\t\t\t\t\t\"ad_storage\" : wpmDataLayer.pixels.google.consent_mode.ad_storage,\n\t\t\t\t\t\t\t\t\"analytics_storage\": wpmDataLayer.pixels.google.consent_mode.analytics_storage,\n\t\t\t\t\t\t\t\t\"wait_for_update\" : wpmDataLayer.pixels.google.consent_mode.wait_for_update,\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\tif (wpmDataLayer?.pixels?.google?.consent_mode?.region) {\n\t\t\t\t\t\t\t\tgoogle_consent_settings.region = wpmDataLayer.pixels.google.consent_mode.region\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tgoogle_consent_settings = wpm.getVisitorConsentStatusAndUpdateGoogleConsentSettings(google_consent_settings)\n\n\t\t\t\t\t\t\tgtag(\"consent\", \"default\", google_consent_settings)\n\t\t\t\t\t\t\tgtag(\"set\", \"ads_data_redaction\", wpmDataLayer.pixels.google.consent_mode.ads_data_redaction)\n\t\t\t\t\t\t\tgtag(\"set\", \"url_passthrough\", wpmDataLayer.pixels.google.consent_mode.url_passthrough)\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t// Google Linker\n\t\t\t\t\t\t// https://developers.google.com/gtagjs/devguide/linker\n\t\t\t\t\t\tif (wpmDataLayer?.pixels?.google?.linker?.settings) {\n\t\t\t\t\t\t\tgtag(\"set\", \"linker\", wpmDataLayer.pixels.google.linker.settings)\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tgtag(\"js\", new Date())\n\n\t\t\t\t\t\t// Google Ads loader\n\t\t\t\t\t\tif (!jQuery.isEmptyObject(wpmDataLayer?.pixels?.google?.ads?.conversionIds)) { // Only run if the pixel has set up\n\t\t\t\t\t\t\tif (wpm.googleConfigConditionsMet(\"ads\")) { \t\t\t\t\t\t\t// Only run if cookie consent has been given\n\t\t\t\t\t\t\t\twpm.fireGtagGoogleAds()\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\twpm.logPreventedPixelLoading(\"google-ads\", \"ads\")\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\n\n\t\t\t\t\t\t// Google Universal Analytics loader\n\t\t\t\t\t\tif (wpmDataLayer?.pixels?.google?.analytics?.universal?.property_id) { \t\t// Only run if the pixel has set up\n\t\t\t\t\t\t\tif (wpm.googleConfigConditionsMet(\"analytics\")) {\t\t\t\t\t\t// Only run if cookie consent has been given\n\t\t\t\t\t\t\t\twpm.fireGtagGoogleAnalyticsUA()\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\twpm.logPreventedPixelLoading(\"google-universal-analytics\", \"analytics\")\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t// GA4 loader\n\t\t\t\t\t\tif (wpmDataLayer?.pixels?.google?.analytics?.ga4?.measurement_id) { \t\t\t// Only run if the pixel has set up\n\t\t\t\t\t\t\tif (wpm.googleConfigConditionsMet(\"analytics\")) {\t\t\t\t\t\t// Only run if cookie consent has been given\n\t\t\t\t\t\t\t\twpm.fireGtagGoogleAnalyticsGA4()\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\twpm.logPreventedPixelLoading(\"ga4\", \"analytics\")\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\twpmDataLayer.pixels.google.state = \"ready\"\n\t\t\t\t\t} catch (e) {\n\t\t\t\t\t\tconsole.error(e)\n\t\t\t\t\t}\n\t\t\t\t})\n\t\t}\n\t}\n\n\twpm.canGoogleLoad = function () {\n\n\t\tif (wpmDataLayer?.pixels?.google?.consent_mode?.active) {\n\t\t\treturn true\n\t\t} else if (\"category\" === wpm.getConsentValues().mode) {\n\t\t\treturn !!(wpm.getConsentValues().categories[\"ads\"] || wpm.getConsentValues().categories[\"analytics\"])\n\t\t} else if (\"pixel\" === wpm.getConsentValues().mode) {\n\t\t\treturn wpm.getConsentValues().pixels.includes(\"google-ads\") || wpm.getConsentValues().pixels.includes(\"google-analytics\")\n\t\t} else {\n\t\t\tconsole.error(\"Couldn't find a valid load condition for Google mode in wpmConsentValues\")\n\t\t\treturn false\n\t\t}\n\t}\n\n\twpm.gtagLoaded = function () {\n\t\treturn new Promise(function (resolve, reject) {\n\n\t\t\tif (typeof wpmDataLayer?.pixels?.google?.state === \"undefined\") reject()\n\n\t\t\tlet startTime = 0\n\t\t\tlet timeout = 5000\n\t\t\tlet frequency = 200;\n\n\t\t\t(function wait() {\n\t\t\t\tif (wpmDataLayer?.pixels?.google?.state === \"ready\") return resolve()\n\t\t\t\tif (startTime >= timeout) return reject()\n\t\t\t\tstartTime += frequency\n\t\t\t\tsetTimeout(wait, frequency)\n\t\t\t})()\n\t\t})\n\t}\n\n\t// wpm.gtagLoadednew = function () {\n\t// \treturn Promise.race([\n\t// \t\t\tnew Promise(function (resolve, reject) {\n\t//\n\t// \t\t\t\tif (typeof wpmDataLayer?.pixels?.google?.state === \"undefined\") reject();\n\t//\n\t//\n\t// \t\t\t\t(function wait() {\n\t// \t\t\t\t\tif (wpmDataLayer?.pixels?.google?.state === \"ready\") return resolve()\n\t// \t\t\t\t\tif (to >= 1000) return reject()\n\t// \t\t\t\t\tsetTimeout(wait, 100)\n\t// \t\t\t\t})()\n\t// \t\t\t}),\n\t// \t\t\tnew Promise(function (resolve, reject) {\n\t// \t\t\t\tsetTimeout(() => reject(), 1000)\n\t// \t\t\t}),\n\t// \t\t],\n\t// \t)\n\t// \t\t// .then((value) => {console.log(\"race then value: \" + value)})\n\t// \t\t.catch(\n\t// \t\t\t(value) => {\n\t// \t\t\t\tconsole.log(\"race catch value: \" + value)\n\t// \t\t\t\treturn Promise.reject()\n\t// \t\t\t})\n\t// }\n\n\n\t// const promise1 = new Promise((resolve, reject) => {\n\t// \tsetTimeout(resolve, 500, \"one\")\n\t// })\n\t//\n\t// const promise2 = new Promise((resolve, reject) => {\n\t// \tsetTimeout(reject, 100, \"two\")\n\t// })\n\t//\n\t// let onlyRunIfResolves = function () {\n\t// \treturn Promise.race([promise1, promise2])\n\t// \t\t.catch(() => {\n\t// \t\t})\n\t// }\n\t//\n\t// onlyRunIfResolves()\n\t// \t.then(() => {\n\t// \t\tconsole.log(\"running function\")\n\t// \t})\n\n\n}(window.wpm = window.wpm || {}, jQuery));\n","/**\n * Load Google base\n */\n\n// Load base\nrequire(\"./functions\")\nrequire(\"./event_listeners\")\n\n// #if process.env.TIER === 'premium'\n// require(\"./functions_premium\")\n// require(\"./event_listeners_premium\")\n// #endif\n","/**\n * Load Google\n */\n\n// Load base\nrequire(\"./base/loader\")\n\n//Load additional Google libraries\nrequire(\"./ads/loader\")\nrequire(\"./analytics/loader\")\nrequire(\"./optimize/loader\")\n\n\n","/**\n * Load Google Optimize event listeners\n */\n\njQuery(document).on(\"wpmLoadPixels\", function () {\n\n\tif (wpmDataLayer?.pixels?.google?.optimize?.container_id && !wpmDataLayer?.pixels?.google?.optimize?.loaded) {\n\t\tif (wpm.canIFire(\"analytics\", \"google-optimize\")) wpm.load_google_optimize_pixel()\n\t}\n})\n","/**\n * Load Google Optimize functions\n */\n\n\n(function (wpm, $, undefined) {\n\n\twpm.load_google_optimize_pixel = function () {\n\n\t\ttry {\n\t\t\twpmDataLayer.pixels.google.optimize.loaded = true\n\n\t\t\twpm.loadScriptAndCacheIt(\"https://www.googleoptimize.com/optimize.js?id=\" + wpmDataLayer.pixels.google.optimize.container_id)\n\t\t\t// .done(function (script, textStatus) {\n\t\t\t// \t\tconsole.log('Google Optimize loaded')\n\t\t\t// });\n\n\t\t} catch (e) {\n\t\t\tconsole.error(e)\n\t\t}\n\t}\n\n}(window.wpm = window.wpm || {}, jQuery));\n","/**\n * Load Google Optimize\n */\n\nrequire(\"./functions\")\nrequire(\"./event_listeners\")\n","/**\n * Load Hotjar event listeners\n */\n\n// Pixel load event listener\njQuery(document).on(\"wpmLoadPixels\", function () {\n\n\tif (wpmDataLayer?.pixels?.hotjar?.site_id && !wpmDataLayer?.pixels?.hotjar?.loaded) {\n\t\tif (wpm.canIFire(\"analytics\", \"hotjar\") && !wpmDataLayer?.pixels?.hotjar?.loaded) wpm.load_hotjar_pixel()\n\t}\n})\n","/**\n * Load Hotjar functions\n */\n\n(function (wpm, $, undefined) {\n\n\twpm.load_hotjar_pixel = function () {\n\n\t\ttry {\n\t\t\twpmDataLayer.pixels.hotjar.loaded = true;\n\n\t\t\t// @formatter:off\n\t\t\t(function(h,o,t,j,a,r){\n\t\t\t\th.hj=h.hj||function(){(h.hj.q=h.hj.q||[]).push(arguments)};\n\t\t\t\th._hjSettings={hjid:wpmDataLayer.pixels.hotjar.site_id,hjsv:6};\n\t\t\t\ta=o.getElementsByTagName('head')[0];\n\t\t\t\tr=o.createElement('script');r.async=1;\n\t\t\t\tr.src=t+h._hjSettings.hjid+j+h._hjSettings.hjsv;\n\t\t\t\ta.appendChild(r);\n\t\t\t})(window,document,'https://static.hotjar.com/c/hotjar-','.js?sv=');\n\t\t\t// @formatter:on\n\n\t\t} catch (e) {\n\t\t\tconsole.error(e)\n\t\t}\n\t}\n\n}(window.wpm = window.wpm || {}, jQuery));\n","/**\n * Hotjar loader\n */\n\nrequire(\"./functions\")\nrequire(\"./event_listeners\")\n","/**\n * Register event listeners\n */\n\n// remove_from_cart event\njQuery(document).on(\"click\", \".remove_from_cart_button, .remove\", function () {\n\t// jQuery('.remove_from_cart_button, .remove').on('click', function (e) {\n\n\ttry {\n\t\t// console.log('remove_from_cart: ' + jQuery(this).data('product_id'));\n\n\t\tlet url = new URL(jQuery(this).attr(\"href\"))\n\t\tlet productId = wpm.getProductIdByCartItemKeyUrl(url)\n\n\t\twpm.removeProductFromCart(productId)\n\n\t} catch (e) {\n\t\tconsole.error(e)\n\t}\n})\n\n\n// add_to_cart event\njQuery(document).on(\"click\", \".add_to_cart_button:not(.product_type_variable), .ajax_add_to_cart, .single_add_to_cart_button\", function () {\n\t// jQuery('.add_to_cart_button:not(.product_type_variable), .ajax_add_to_cart, .js-ajax-add-to-cart, .single_add_to_cart_button, .btn_color-2').on('click', function (e) {\n\n\ttry {\n\t\t// console.log('add_to_cart');\n\n\t\tif (wpmDataLayer.shop.page_type === \"product\") {\n\n\t\t\t// first process related and upsell products\n\t\t\tif (typeof jQuery(this).attr(\"href\") !== \"undefined\" && jQuery(this).attr(\"href\").includes(\"add-to-cart\")) {\n\t\t\t\t// console.log('add-to-cart on upsell and related products');\n\t\t\t\tlet quantity = 1\n\t\t\t\tlet productId = jQuery(this).data(\"product_id\")\n\t\t\t\t// console.log('productId: ' + productId);\n\t\t\t\twpm.addProductToCart(productId, quantity)\n\t\t\t} else {\n\n\t\t\t\tif (wpmDataLayer.shop.product_type === \"simple\") {\n\n\t\t\t\t\t// console.log('test');\n\t\t\t\t\tlet quantity = Number(jQuery(\".input-text.qty\").val())\n\n\t\t\t\t\tif (!quantity && quantity !== 0) quantity = 1\n\n\t\t\t\t\tlet productId = jQuery(this).val()\n\n\t\t\t\t\t// console.log('productId: ' + productId);\n\t\t\t\t\t// console.log('quantity: ' + quantity);\n\n\t\t\t\t\twpm.addProductToCart(productId, quantity)\n\n\t\t\t\t} else if (wpmDataLayer.shop.product_type === \"variable\") {\n\n\t\t\t\t\t// console.log('variable');\n\n\t\t\t\t\tlet quantity = Number(jQuery(\".input-text.qty\").val())\n\n\t\t\t\t\tif (!quantity && quantity !== 0) quantity = 1\n\n\t\t\t\t\tlet productId = jQuery(\"[name='variation_id']\").val()\n\n\t\t\t\t\t// console.log('productId: ' + productId);\n\t\t\t\t\t// console.log('quantity: ' + quantity);\n\n\t\t\t\t\twpm.addProductToCart(productId, quantity)\n\n\t\t\t\t} else if (wpmDataLayer.shop.product_type === \"grouped\") {\n\n\t\t\t\t\t// console.log('grouped');\n\n\t\t\t\t\tjQuery(\".woocommerce-grouped-product-list-item\").each(function () {\n\n\t\t\t\t\t\tlet quantity = Number(jQuery(this).find(\".input-text.qty\").val())\n\n\t\t\t\t\t\tif (!quantity && quantity !== 0) quantity = 1\n\n\t\t\t\t\t\tlet classes = jQuery(this).attr(\"class\")\n\t\t\t\t\t\tlet productId = wpm.getPostIdFromString(classes)\n\n\t\t\t\t\t\t// console.log('productId: ' + productId);\n\t\t\t\t\t\t// console.log('quantity: ' + quantity);\n\n\t\t\t\t\t\twpm.addProductToCart(productId, quantity)\n\t\t\t\t\t})\n\t\t\t\t} else if (wpmDataLayer.shop.product_type === \"bundle\") {\n\n\t\t\t\t\t// console.log('bundle');\n\n\t\t\t\t\tlet quantity = Number(jQuery(\".input-text.qty\").val())\n\n\t\t\t\t\tif (!quantity && quantity !== 0) quantity = 1\n\n\t\t\t\t\tlet productId = jQuery(\"input[name=add-to-cart]\").val()\n\n\t\t\t\t\t// console.log('productId: ' + productId);\n\t\t\t\t\t// console.log('quantity: ' + quantity);\n\n\t\t\t\t\twpm.addProductToCart(productId, quantity)\n\t\t\t\t}\n\t\t\t}\n\t\t} else {\n\n\t\t\t// console.log('non product page');\n\n\t\t\tlet quantity = 1\n\t\t\tlet productId = jQuery(this).data(\"product_id\")\n\t\t\t// console.log('productId: ' + productId);\n\t\t\twpm.addProductToCart(productId, quantity)\n\t\t}\n\t} catch (e) {\n\t\tconsole.error(e)\n\t}\n})\n\n// if someone clicks anywhere on a custom /?add-to-cart=123 link\n// trigger the add to cart event\n// body.one('click', function (e) {\n//\n// try {\n// if (jQuery(this)[0].URL) {\n//\n// let href = new URL(jQuery(this)[0].URL);\n// let searchParams = new URLSearchParams(href.search);\n//\n// if (searchParams.has('add-to-cart')) {\n// // console.log('non product page, /?add-to-cart=123 link');\n//\n// let productId = searchParams.get('add-to-cart');\n// wpm.addProductToCart(productId, 1);\n// }\n// }\n// } catch (e) {\n// console.error(e);\n// }\n// });\n\n\n/**\n * If someone clicks anywhere on a custom /?add-to-cart=123 link\n * trigger the add to cart event\n */\njQuery(document).one(\"click\", \"a:not(.add_to_cart_button, .ajax_add_to_cart, .single_add_to_cart_button)\", function (event) {\n\t// jQuery('a:not(.add_to_cart_button, .ajax_add_to_cart, .single_add_to_cart_button)').one('click', function (event) {\n\n\ttry {\n\t\tif (jQuery(event.target).closest(\"a\").attr(\"href\")) {\n\n\t\t\tlet href = jQuery(event.target).closest(\"a\").attr(\"href\")\n\n\t\t\tif (href.includes(\"add-to-cart=\")) {\n\t\t\t\tlet matches = href.match(/(add-to-cart=)(\\d+)/)\n\t\t\t\t// console.log('pid: ' + matches[2])\n\t\t\t\tif (matches) wpm.addProductToCart(matches[2], 1)\n\t\t\t}\n\t\t}\n\t} catch (e) {\n\t\tconsole.error(e)\n\t}\n})\n\n// select_content GA UA event\n// select_item GA 4 event\n// jQuery(document).on('click', '.woocommerce-LoopProduct-link, .wc-block-grid__product, .product-small.box', function (e) {\njQuery(document).on(\"click\", \".woocommerce-LoopProduct-link, .wc-block-grid__product, .product, .product-small, .type-product\", function () {\n\t// jQuery('.woocommerce-LoopProduct-link, .wc-block-grid__product, .product, .product-small, .type-product').on('click', function (e) {\n\n\ttry {\n\n\t\t/**\n\t\t *\n\t\t * On some pages the event fires multiple times, and on product pages\n\t\t * even on page load. Using e.stopPropagation helps to prevent this,\n\t\t * but I dont know why. We don't even have to use this, since only a real\n\t\t * product click yields a valid productId. So we filter the invalid click\n\t\t * events out later down the code. I'll keep it that way because this is\n\t\t * the most compatible way across shops.\n\t\t * e.stopPropagation();\n\t\t * */\n\n\t\t\t// console.log('select_content and select_item');\n\n\t\tlet productId = jQuery(this).nextAll(\".wpmProductId:first\").data(\"id\")\n\t\t// console.log('select_content and select_item: ' + productId);\n\n\n\t\t/**\n\t\t * On product pages, for some reason, the click event is triggered on the main product on page load.\n\t\t * In that case no ID is found. But we can discard it, since we only want to trigger the event on\n\t\t * related products, which are found below.\n\t\t */\n\n\t\tif (productId) {\n\n\t\t\t// console.log('select_content and select_item: ' + productId);\n\n\t\t\tproductId = getIdBasedOndVariationsOutputSetting(productId)\n\n\t\t\tif (!productId) throw Error(\"Wasn't able to retrieve a productId\")\n\n\t\t\t// console.log('prodid: ' + productId);\n\n\t\t\tif (wpmDataLayer.products && wpmDataLayer.products[productId]) {\n\n\t\t\t\tlet product = wpm.getProductDetailsFormattedForEvent(productId)\n\n\t\t\t\tjQuery(document).trigger(\"wpmSelectContentGaUa\", product)\n\t\t\t\tjQuery(document).trigger(\"wpmSelectItem\", product)\n\t\t\t}\n\t\t}\n\t} catch (e) {\n\t\tconsole.error(e)\n\t}\n})\n\n// begin_checkout event\njQuery(document).one(\"click\", \".checkout-button, .cart-checkout-button, .button.checkout\", function () {\n\t// jQuery('.checkout-button, .cart-checkout-button, .button.checkout').one('click', function (e) {\n\t// console.log('begin_checkout');\n\n\tjQuery(document).trigger(\"wpmBeginCheckout\")\n})\n\n\n// checkout_progress event\n// track checkout option event: entered valid billing email\njQuery(document).on(\"input\", \"#billing_email\", function () {\n\t// jQuery('#billing_email').on('input', function () {\n\n\tif (wpm.isEmail(jQuery(this).val())) {\n\t\t// wpm.fireCheckoutOption(2);\n\t\twpm.fireCheckoutProgress(2)\n\t\twpm.emailSelected = true\n\t}\n})\n\n// track checkout option event: purchase click\njQuery(document).on(\"click\", \".wc_payment_methods\", function () {\n\t// jQuery('.wc_payment_methods').on('click', function () {\n\n\tif (false === wpm.paymentMethodSelected) {\n\t\twpm.fireCheckoutProgress(3)\n\t}\n\n\twpm.fireCheckoutOption(3, jQuery(\"input[name='payment_method']:checked\").val())\n\twpm.paymentMethodSelected = true\n})\n\n// track checkout option event: purchase click\njQuery(document).one(\"click\", \"#place_order\", function () {\n\t// jQuery('#place_order').one('click', function () {\n\n\tif (false === wpm.emailSelected) {\n\t\twpm.fireCheckoutProgress(2)\n\t}\n\n\tif (false === wpm.paymentMethodSelected) {\n\t\twpm.fireCheckoutProgress(3)\n\t\twpm.fireCheckoutOption(3, jQuery(\"input[name='payment_method']:checked\").val())\n\t}\n\n\twpm.fireCheckoutProgress(4)\n})\n\n// update cart event\njQuery(document).on(\"click\", \"[name='update_cart']\", function () {\n\t// jQuery(\"[name='update_cart']\").on('click', function (e) {\n\n\ttry {\n\t\tjQuery(\".cart_item\").each(function () {\n\n\t\t\t// let productId = jQuery(this).find('[data-product_id]').data('product_id');\n\n\t\t\tlet url = new URL(jQuery(this).find(\".product-remove\").find(\"a\").attr(\"href\"))\n\t\t\tlet productId = wpm.getProductIdByCartItemKeyUrl(url)\n\n\n\t\t\tlet quantity = jQuery(this).find(\".qty\").val()\n\n\t\t\tif (quantity === 0) {\n\t\t\t\twpm.removeProductFromCart(productId)\n\t\t\t} else if (quantity < wpmDataLayer.cart[productId].quantity) {\n\t\t\t\twpm.removeProductFromCart(productId, wpmDataLayer.cart[productId].quantity - quantity)\n\t\t\t} else if (quantity > wpmDataLayer.cart[productId].quantity) {\n\t\t\t\twpm.addProductToCart(productId, quantity - wpmDataLayer.cart[productId].quantity)\n\t\t\t}\n\t\t})\n\t} catch (e) {\n\t\tconsole.error(e)\n\t\twpm.getCartItemsFromBackend()\n\t}\n})\n\n\n// add_to_wishlist\njQuery(document).on(\"click\", \".add_to_wishlist, .wl-add-to\", function () {\n\t// jQuery('.add_to_wishlist, .wl-add-to').on('click', function () {\n\n\ttry {\n\t\t// console.log('add_to_wishlist');\n\t\t// console.log('this:' + jQuery(this).data('product-id'));\n\n\t\tlet productId\n\n\t\tif (jQuery(this).data(\"productid\")) { // for the WooCommerce wishlist plugin\n\t\t\tproductId = jQuery(this).data(\"productid\")\n\t\t} else if (jQuery(this).data(\"product-id\")) { // for the YITH wishlist plugin\n\t\t\tproductId = jQuery(this).data(\"product-id\")\n\t\t}\n\n\t\tif (!productId) throw Error(\"Wasn't able to retrieve a productId\")\n\n\t\tlet product = wpm.getProductDetailsFormattedForEvent(productId)\n\n\t\t// console.log('add_to_wishlist');\n\t\t// console.log(product);\n\n\t\tjQuery(document).trigger(\"wpmAddToWishlist\", product)\n\t} catch (e) {\n\t\tconsole.error(e)\n\t}\n})\n\njQuery(document).on(\"updated_cart_totals\", function () {\n\tjQuery(document).trigger(\"wpmViewCart\")\n})\n\n\n/**\n * Called when the user selects all the required dropdowns / attributes\n *\n * Has to be hooked after document ready\n *\n * https://stackoverflow.com/a/27849208/4688612\n * https://stackoverflow.com/a/65065335/4688612\n */\njQuery(\".single_variation_wrap\").on(\"show_variation\", function (event, variation) {\n\n\ttry {\n\t\tlet productId = getIdBasedOndVariationsOutputSetting(variation.variation_id)\n\n\t\tif (!productId) throw Error(\"Wasn't able to retrieve a productId\")\n\n\t\tif (wpmDataLayer.products && wpmDataLayer.products[productId]) {\n\n\t\t\t// console.log('productId: ' + productId);\n\n\t\t\tlet product = wpm.getProductDetailsFormattedForEvent(productId)\n\n\t\t\tjQuery(document).trigger(\"wpmViewItem\", product)\n\t\t}\n\t} catch (e) {\n\t\tconsole.error(e)\n\t}\n})\n\n/**\n * Called on variable products when no selection has been done yet\n * or when the visitor deselects his choice.\n *\n * Has to be hooked after document ready\n */\n\njQuery(\".single_variation_wrap\").on(\"hide_variation\", function () {\n\n\ttry {\n\t\tlet classes = jQuery(\"body\").attr(\"class\")\n\t\tlet productId = classes.match(/(postid-)(\\d+)/)[2]\n\n\t\tif (!productId) throw Error(\"Wasn't able to retrieve a productId\")\n\n\t\t/**\n\t\t * If we have a variable product with no preset,\n\t\t * and variations output is enabled,\n\t\t * then we send a viewItem event with the first\n\t\t * variation we find for the parent.\n\t\t * If variations output is disabled,\n\t\t * we just send the parent ID.\n\t\t */\n\t\tif (\n\t\t\t\"variable\" === wpmDataLayer.shop.product_type &&\n\t\t\twpmDataLayer?.general?.variationsOutput\n\t\t) {\n\t\t\tfor (const [key, product] of Object.entries(wpmDataLayer.products)) {\n\t\t\t\tif (\"parentId\" in product) {\n\t\t\t\t\t// console.log('pid: ' + value.parentId)\n\t\t\t\t\tproductId = product.id\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tif (wpmDataLayer.products && wpmDataLayer.products[productId]) {\n\n\t\t\t// console.log('productId: ' + productId);\n\n\t\t\tlet product = wpm.getProductDetailsFormattedForEvent(productId)\n\n\t\t\tjQuery(document).trigger(\"wpmViewItem\", product)\n\t\t}\n\n\t} catch (e) {\n\t\tconsole.error(e)\n\t}\n})\n\n\n/**\n * Set up wpm events\n */\n\n\n// populate the wpmDataLayer with the cart items\njQuery(window).on(\"wpmLoad\", function () {\n\n\ttry {\n\t\t// When a new session is initiated there are no items in the cart,\n\t\t// so we can save the call to get the cart items\n\t\tif (wpm.doesWooCommerceCartExist()) wpm.getCartItems()\n\n\t} catch (e) {\n\t\tconsole.error(e)\n\t}\n})\n\n// get all add-to-cart= products from backend\njQuery(window).on(\"wpmLoad\", function () {\n\n\twpmDataLayer.products = wpmDataLayer.products || {}\n\n\t// scan page for add-to-cart= links\n\tlet productIds = wpm.getAddToCartLinkProductIds()\n\n\twpm.getProductsFromBackend(productIds)\n})\n\n/**\n * Save the referrer into a cookie\n */\n\njQuery(window).on(\"wpmLoad\", function () {\n\n\t// can't use session storage as we can't read it from the server\n\tif (!wpm.getCookie(\"wpmReferrer\")) {\n\n\t\tif (document.referrer) {\n\t\t\tlet referrerUrl = new URL(document.referrer)\n\t\t\tlet referrerHostname = referrerUrl.hostname\n\n\t\t\tif (referrerHostname !== window.location.host) {\n\t\t\t\twpm.setCookie(\"wpmReferrer\", referrerHostname)\n\t\t\t} else {\n\t\t\t\twpm.setCookie(\"wpmReferrer\", \"\")\n\t\t\t}\n\n\t\t} else {\n\t\t\twpm.setCookie(\"wpmReferrer\", \"\")\n\t\t}\n\t}\n})\n\n\n/**\n * Create our own load event in order to better handle script flow execution when JS \"optimizers\" shuffle the code.\n */\n\njQuery(window).on(\"wpmLoad\", function () {\n\ttry {\n\t\tif (typeof wpmDataLayer != \"undefined\" && !wpmDataLayer?.wpmLoadFired) {\n\n\t\t\tjQuery(document).trigger(\"wpmLoadAlways\")\n\n\t\t\tif (\"product\" === wpmDataLayer.shop.page_type && wpmDataLayer.shop.product_type !== \"variable\" && wpm.getMainProductIdFromProductPage()) {\n\n\t\t\t\tlet product = wpm.getProductDataForViewItemEvent(wpm.getMainProductIdFromProductPage())\n\t\t\t\tjQuery(document).trigger(\"wpmViewItem\", product)\n\n\t\t\t} else if (\"product_category\" === wpmDataLayer.shop.page_type) {\n\n\t\t\t\tjQuery(document).trigger(\"wpmCategory\")\n\n\t\t\t} else if (\"search\" === wpmDataLayer.shop.page_type) {\n\n\t\t\t\tjQuery(document).trigger(\"wpmSearch\")\n\n\t\t\t} else if (\"cart\" === wpmDataLayer.shop.page_type) {\n\n\t\t\t\tjQuery(document).trigger(\"wpmViewCart\")\n\n\t\t\t} else if (\"order_received_page\" === wpmDataLayer.shop.page_type && wpmDataLayer.order) {\n\n\t\t\t\tif (!wpm.isOrderIdStored(wpmDataLayer.order.id)) {\n\n\t\t\t\t\tjQuery(document).trigger(\"wpmOrderReceivedPage\")\n\t\t\t\t\twpm.writeOrderIdToStorage(wpmDataLayer.order.id)\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tjQuery(document).trigger(\"wpmEverywhereElse\")\n\t\t\t}\n\n\t\t\tif (wpmDataLayer?.user?.id && !wpm.hasLoginEventFired()) {\n\t\t\t\tjQuery(document).trigger(\"wpmLogin\")\n\t\t\t\twpm.setLoginEventFired()\n\t\t\t}\n\n\t\t\t// /**\n\t\t\t// * Load mini cart fragments into a wpm session storage key,\n\t\t\t// * after the document load event.\n\t\t\t// */\n\t\t\t// jQuery(document).ajaxSend(function (event, jqxhr, settings) {\n\t\t\t// \t// console.log('settings.url: ' + settings.url);\n\t\t\t//\n\t\t\t// \tif (settings.url.includes(\"get_refreshed_fragments\") && sessionStorage) {\n\t\t\t// \t\tif (!sessionStorage.getItem(\"wpmMiniCartActive\")) {\n\t\t\t// \t\t\tsessionStorage.setItem(\"wpmMiniCartActive\", JSON.stringify(true))\n\t\t\t// \t\t}\n\t\t\t// \t}\n\t\t\t// })\n\n\t\t\twpmDataLayer.wpmLoadFired = true\n\t\t}\n\n\t} catch (e) {\n\t\tconsole.error(e)\n\t}\n})\n\n// jQuery(window).on(\"load\", function () {\n// \tjQuery(document).trigger(\"wpmLoad\", {})\n// })\n\njQuery(window).on(\"wpmPreLoadPixels\", function () {\n\n\tif (wpmDataLayer?.shop?.cookie_consent_mgmt?.explicit_consent) {\n\t\twpm.updateConsentCookieValues(true)\n\t}\n\tjQuery(document).trigger(\"wpmLoadPixels\", {})\n})\n","/**\n * Create a wpm namespace under which all functions are declared\n */\n\n// https://stackoverflow.com/a/5947280/4688612\n(function (wpm, $, undefined) {\n\n\tconst wpmDeduper = {\n\t\tkeyName : \"_wpm_order_ids\",\n\t\tcookieExpiresDays: 365,\n\t}\n\n\tconst wpmRestSettings = {\n\t\t// cookiesAvailable : '_wpm_cookies_are_available',\n\t\tcookieWpmRestEndpointAvailable: \"_wpm_endpoint_available\",\n\t\trestEndpoint : \"/wp-json/\",\n\t\trestFails : 0,\n\t\trestFailsThreshold : 10,\n\t}\n\n\twpm.emailSelected = false\n\twpm.paymentMethodSelected = false\n\n\t// wpm.checkIfCookiesAvailable = function () {\n\t//\n\t// // read the cookie if previously set, if it is return true, otherwise continue\n\t// if (wpm.getCookie(wpmRestSettings.cookiesAvailable)) {\n\t// return true;\n\t// }\n\t//\n\t// // set the cookie for the session\n\t// Cookies.set(wpmRestSettings.cookiesAvailable, true);\n\t//\n\t// // read cookie, true if ok, false if not ok\n\t// return !!wpm.getCookie(wpmRestSettings.cookiesAvailable);\n\t// }\n\n\twpm.useRestEndpoint = function () {\n\n\t\t// only if sessionStorage is available\n\n\t\t// only if REST API endpoint is generally accessible\n\t\t// check in sessionStorage if we checked before and return answer\n\t\t// otherwise check if the endpoint is available, save answer in sessionStorage and return answer\n\n\t\t// only if not too many REST API errors happened\n\n\t\treturn wpm.isSessionStorageAvailable() &&\n\t\t\twpm.isRestEndpointAvailable() &&\n\t\t\twpm.isBelowRestErrorThreshold()\n\t}\n\n\twpm.isBelowRestErrorThreshold = function () {\n\t\treturn window.sessionStorage.getItem(wpmRestSettings.restFails) <= wpmRestSettings.restFailsThreshold\n\t}\n\n\twpm.isRestEndpointAvailable = function () {\n\n\t\tif (window.sessionStorage.getItem(wpmRestSettings.cookieWpmRestEndpointAvailable)) {\n\t\t\treturn JSON.parse(window.sessionStorage.getItem(wpmRestSettings.cookieWpmRestEndpointAvailable))\n\t\t} else {\n\t\t\t// return wpm.testEndpoint();\n\t\t\t// just set the value whenever possible in order not to wait or block the main thread\n\t\t\twpm.testEndpoint()\n\t\t}\n\t}\n\n\twpm.isSessionStorageAvailable = function () {\n\n\t\treturn !!window.sessionStorage\n\t}\n\n\twpm.testEndpoint = function (\n\t\turl = location.protocol + \"//\" + location.host + wpmRestSettings.restEndpoint,\n\t\tcookieName = wpmRestSettings.cookieWpmRestEndpointAvailable,\n\t) {\n\t\t// console.log('testing endpoint');\n\n\t\tjQuery.ajax(url, {\n\t\t\ttype : \"HEAD\",\n\t\t\ttimeout: 1000,\n\t\t\t// async: false,\n\t\t\tstatusCode: {\n\t\t\t\t200: function (response) {\n\t\t\t\t\t// Cookies.set(cookieName, true);\n\t\t\t\t\t// console.log('endpoint works');\n\t\t\t\t\twindow.sessionStorage.setItem(cookieName, JSON.stringify(true))\n\t\t\t\t},\n\t\t\t\t404: function (response) {\n\t\t\t\t\t// Cookies.set(cookieName, false);\n\t\t\t\t\t// console.log('endpoint doesn\\'t work');\n\t\t\t\t\twindow.sessionStorage.setItem(cookieName, JSON.stringify(false))\n\t\t\t\t},\n\t\t\t\t0 : function (response) {\n\t\t\t\t\t// Cookies.set(cookieName, false);\n\t\t\t\t\t// console.log('endpoint doesn\\'t work');\n\t\t\t\t\twindow.sessionStorage.setItem(cookieName, JSON.stringify(false))\n\t\t\t\t},\n\t\t\t},\n\t\t}).then(response => {\n\t\t\t// console.log('test done')\n\t\t\t// console.log('result: ' + JSON.parse(window.sessionStorage.getItem(cookieName)));\n\t\t\t// return JSON.parse(window.sessionStorage.getItem(cookieName));\n\t\t})\n\t}\n\n\twpm.isWpmRestEndpointAvailable = function (cookieName = wpmRestSettings.cookieWpmRestEndpointAvailable) {\n\n\t\treturn !!wpm.getCookie(cookieName)\n\t}\n\n\twpm.writeOrderIdToStorage = function (orderId, expireDays = 365) {\n\n\t\t// save the order ID in the browser storage\n\n\t\tif (!window.Storage) {\n\t\t\tlet expiresDate = new Date()\n\t\t\texpiresDate.setDate(expiresDate.getDate() + wpmDeduper.cookieExpiresDays)\n\n\t\t\tlet ids = []\n\t\t\tif (checkCookie()) {\n\t\t\t\tids = JSON.parse(wpm.getCookie(wpmDeduper.keyName))\n\t\t\t}\n\n\t\t\tif (!ids.includes(orderId)) {\n\t\t\t\tids.push(orderId)\n\t\t\t\tdocument.cookie = wpmDeduper.keyName + \"=\" + JSON.stringify(ids) + \";expires=\" + expiresDate.toUTCString()\n\t\t\t}\n\n\t\t} else {\n\t\t\tif (localStorage.getItem(wpmDeduper.keyName) === null) {\n\t\t\t\tlet ids = []\n\t\t\t\tids.push(orderId)\n\t\t\t\twindow.localStorage.setItem(wpmDeduper.keyName, JSON.stringify(ids))\n\n\t\t\t} else {\n\t\t\t\tlet ids = JSON.parse(localStorage.getItem(wpmDeduper.keyName))\n\t\t\t\tif (!ids.includes(orderId)) {\n\t\t\t\t\tids.push(orderId)\n\t\t\t\t\twindow.localStorage.setItem(wpmDeduper.keyName, JSON.stringify(ids))\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tif (typeof wpm.storeOrderIdOnServer === \"function\" && wpmDataLayer.orderDeduplication) {\n\t\t\twpm.storeOrderIdOnServer(orderId)\n\t\t}\n\t}\n\n\tfunction checkCookie() {\n\t\tlet key = wpm.getCookie(wpmDeduper.keyName)\n\t\treturn key !== \"\"\n\t}\n\n\twpm.isOrderIdStored = function (orderId) {\n\n\t\t// console.log('deduper: ' + wpmDataLayer.orderDeduplication);\n\t\tif (wpmDataLayer.orderDeduplication) {\n\t\t\t// console.log('order deduplication: on');\n\t\t\tif (!window.Storage) {\n\n\t\t\t\tif (checkCookie()) {\n\t\t\t\t\tlet ids = JSON.parse(wpm.getCookie(wpmDeduper.keyName))\n\t\t\t\t\treturn ids.includes(orderId)\n\t\t\t\t} else {\n\t\t\t\t\treturn false\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tif (localStorage.getItem(wpmDeduper.keyName) !== null) {\n\t\t\t\t\tlet ids = JSON.parse(localStorage.getItem(wpmDeduper.keyName))\n\t\t\t\t\treturn ids.includes(orderId)\n\t\t\t\t} else {\n\t\t\t\t\treturn false\n\t\t\t\t}\n\t\t\t}\n\t\t} else {\n\t\t\tconsole.log(\"order duplication prevention: off\")\n\t\t\treturn false\n\t\t}\n\t}\n\n\twpm.isEmail = function (email) {\n\t\t// https://emailregex.com/\n\t\tlet regex = /^(([^<>()\\[\\]\\\\.,;:\\s@\"]+(\\.[^<>()\\[\\]\\\\.,;:\\s@\"]+)*)|(\".+\"))@((\\[[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}])|(([a-zA-Z\\-0-9]+\\.)+[a-zA-Z]{2,}))$/\n\t\treturn regex.test(email)\n\t}\n\n\twpm.removeProductFromCart = function (productId, quantityToRemove = null) {\n\t\t// console.log('product_id: ' + productId + ' | quantityToRemove: ' + quantityToRemove);\n\n\t\ttry {\n\n\t\t\tif (!productId) throw Error(\"Wasn't able to retrieve a productId\")\n\n\t\t\tproductId = getIdBasedOndVariationsOutputSetting(productId)\n\n\t\t\tif (!productId) throw Error(\"Wasn't able to retrieve a productId\")\n\n\t\t\tlet quantity\n\n\t\t\tif (quantityToRemove == null) {\n\t\t\t\tquantity = wpmDataLayer.cart[productId].quantity\n\t\t\t} else {\n\t\t\t\tquantity = quantityToRemove\n\t\t\t}\n\n\t\t\t// console.log('product_id: ' + productId + ' | qty: ' + quantity);\n\t\t\t// console.log(productId);\n\t\t\t// console.log(wpmDataLayer.cart);\n\t\t\t// console.log(wpmDataLayer.cart[productId]);\n\n\t\t\tif (wpmDataLayer.cart[productId]) {\n\n\t\t\t\t// let product = {\n\t\t\t\t// id : productId.toString(),\n\t\t\t\t// dyn_r_ids: wpmDataLayer.cart[productId].dyn_r_ids,\n\t\t\t\t// name : wpmDataLayer.cart[productId].name,\n\t\t\t\t// // list_name: wpmDataLayer.shop.list_name, // doesn't make sense on mini_cart\n\t\t\t\t// brand : wpmDataLayer.cart[productId].brand,\n\t\t\t\t// category: wpmDataLayer.cart[productId].category,\n\t\t\t\t// variant : wpmDataLayer.cart[productId].variant,\n\t\t\t\t// // list_position: wpmDataLayer.cart[productId].position, // doesn't make sense on mini_cart\n\t\t\t\t// quantity : quantity,\n\t\t\t\t// price : wpmDataLayer.cart[productId].price,\n\t\t\t\t// isVariation: wpmDataLayer.products[productId].isVariation,\n\t\t\t\t// };\n\t\t\t\t//\n\t\t\t\t// if (product.isVariation) product['parentId_dyn_r_ids'] = wpmDataLayer.products[productId].parentId_dyn_r_ids;\n\n\t\t\t\tlet product = wpm.getProductDetailsFormattedForEvent(productId, quantity)\n\n\t\t\t\t// console.log('removing');\n\t\t\t\t// console.log(data);\n\n\t\t\t\tjQuery(document).trigger(\"wpmRemoveFromCart\", product)\n\n\t\t\t\tif (quantityToRemove == null || wpmDataLayer.cart[productId].quantity === quantityToRemove) {\n\t\t\t\t\tdelete wpmDataLayer.cart[productId]\n\t\t\t\t\tif (sessionStorage) sessionStorage.setItem(\"wpmDataLayerCart\", JSON.stringify(wpmDataLayer.cart))\n\t\t\t\t} else {\n\t\t\t\t\twpmDataLayer.cart[productId].quantity = wpmDataLayer.cart[productId].quantity - quantity\n\t\t\t\t\tif (sessionStorage) sessionStorage.setItem(\"wpmDataLayerCart\", JSON.stringify(wpmDataLayer.cart))\n\t\t\t\t}\n\t\t\t}\n\t\t} catch (e) {\n\t\t\tconsole.error(e)\n\t\t\t// console.log('getting cart from back end');\n\t\t\t// wpm.getCartItemsFromBackend();\n\t\t\t// console.log('getting cart from back end done');\n\n\t\t}\n\t}\n\n\tgetIdBasedOndVariationsOutputSetting = function (productId) {\n\n\t\ttry {\n\t\t\tif (wpmDataLayer?.general?.variationsOutput) {\n\t\t\t\t// console.log('test');\n\t\t\t\treturn productId\n\t\t\t} else {\n\t\t\t\tif (wpmDataLayer.products[productId].isVariation) {\n\t\t\t\t\treturn wpmDataLayer.products[productId].parentId\n\t\t\t\t} else {\n\t\t\t\t\treturn productId\n\t\t\t\t}\n\t\t\t}\n\t\t} catch (e) {\n\t\t\tconsole.error(e)\n\t\t}\n\t}\n\n\t// add_to_cart\n\twpm.addProductToCart = function (productId, quantity) {\n\n\t\ttry {\n\t\t\t// console.log('productId: ' + productId + ' | qty: ' + quantity);\n\t\t\t// console.log('productId: ' + productId + ' | variationId: ' + variationId + ' | qty: ' + quantity);\n\n\t\t\tif (!productId) throw Error(\"Wasn't able to retrieve a productId\")\n\n\t\t\tproductId = getIdBasedOndVariationsOutputSetting(productId)\n\n\t\t\tif (!productId) throw Error(\"Wasn't able to retrieve a productId\")\n\n\t\t\tif (wpmDataLayer?.products[productId]) {\n\n\t\t\t\tlet product = wpm.getProductDetailsFormattedForEvent(productId, quantity)\n\n\t\t\t\t// console.log(productId)\n\t\t\t\t// console.log(wpmDataLayer.cart)\n\n\t\t\t\tjQuery(document).trigger(\"wpmAddToCart\", product)\n\n\t\t\t\t// add product to cart wpmDataLayer['cart']\n\n\t\t\t\t// if the product already exists in the object, only add the additional quantity\n\t\t\t\t// otherwise create that product object in the wpmDataLayer['cart']\n\t\t\t\tif (wpmDataLayer?.cart[productId]) {\n\t\t\t\t\twpmDataLayer.cart[productId].quantity = wpmDataLayer.cart[productId].quantity + quantity\n\t\t\t\t} else {\n\n\t\t\t\t\tif (!(\"cart\" in wpmDataLayer)) wpmDataLayer.cart = {}\n\t\t\t\t\twpmDataLayer.cart[productId] = wpm.getProductDetailsFormattedForEvent(productId, quantity)\n\t\t\t\t}\n\n\t\t\t\tif (sessionStorage) sessionStorage.setItem(\"wpmDataLayerCart\", JSON.stringify(wpmDataLayer.cart))\n\t\t\t}\n\t\t} catch (e) {\n\t\t\tconsole.error(e)\n\n\t\t\t// fallback if wpmDataLayer.cart and wpmDataLayer.products got out of sync in case cart caching has an issue\n\t\t\twpm.getCartItemsFromBackend()\n\t\t}\n\t}\n\n\twpm.getCartItems = function () {\n\n\t\t// console.log('get cart items');\n\n\t\tif (sessionStorage) {\n\t\t\tif (!sessionStorage.getItem(\"wpmDataLayerCart\") || wpmDataLayer.shop.page_type === \"order_received_page\") {\n\t\t\t\tsessionStorage.setItem(\"wpmDataLayerCart\", JSON.stringify({}))\n\t\t\t} else {\n\t\t\t\twpm.saveCartObjectToDataLayer(JSON.parse(sessionStorage.getItem(\"wpmDataLayerCart\")))\n\t\t\t}\n\t\t} else {\n\t\t\twpm.getCartItemsFromBackend()\n\t\t}\n\t}\n\n\t// get all cart items from the backend\n\twpm.getCartItemsFromBackend = function () {\n\t\ttry {\n\t\t\tlet data = {\n\t\t\t\taction: \"wpm_get_cart_items\",\n\t\t\t}\n\n\t\t\tjQuery.ajax(\n\t\t\t\t{\n\t\t\t\t\ttype : \"get\",\n\t\t\t\t\tdataType: \"json\",\n\t\t\t\t\t// url : ajax_object.ajax_url,\n\t\t\t\t\turl : wpm.ajax_url,\n\t\t\t\t\tdata : data,\n\t\t\t\t\tsuccess: function (cartItems) {\n\n\t\t\t\t\t\t// save all cart items into wpmDataLayer\n\n\t\t\t\t\t\tif (!cartItems[\"cart\"]) cartItems[\"cart\"] = {}\n\n\t\t\t\t\t\twpm.saveCartObjectToDataLayer(cartItems[\"cart\"])\n\t\t\t\t\t\tif (sessionStorage) sessionStorage.setItem(\"wpmDataLayerCart\", JSON.stringify(cartItems[\"cart\"]))\n\t\t\t\t\t},\n\t\t\t\t})\n\t\t} catch (e) {\n\t\t\tconsole.error(e)\n\t\t}\n\t}\n\n\twpm.getProductsFromBackend = function (productIds) {\n\t\t// console.log('getting pids from back-end: ' + productIds)\n\t\t// get productIds from the backend\n\n\t\t// reduce productIds by products already in the dataLayer\n\t\tproductIds = productIds.filter(item => !wpmDataLayer.products.hasOwnProperty(item))\n\n\t\t// if no products IDs are in the object, don't try to get anything from the server\n\t\tif (!productIds || productIds.length === 0) return\n\n\t\ttry {\n\t\t\tlet data = {\n\t\t\t\taction : \"wpm_get_product_ids\",\n\t\t\t\tproductIds: productIds,\n\t\t\t}\n\n\t\t\tjQuery.ajax(\n\t\t\t\t{\n\t\t\t\t\ttype : \"get\",\n\t\t\t\t\tdataType: \"json\",\n\t\t\t\t\t// url : ajax_object.ajax_url,\n\t\t\t\t\turl : wpm.ajax_url,\n\t\t\t\t\tdata : data,\n\t\t\t\t\tsuccess: function (products) {\n\n\t\t\t\t\t\t// merge products into wpmDataLayer.products\n\t\t\t\t\t\twpmDataLayer.products = Object.assign({}, wpmDataLayer.products, products)\n\t\t\t\t\t},\n\t\t\t\t\terror : function (response) {\n\t\t\t\t\t\tconsole.log(response)\n\t\t\t\t\t},\n\t\t\t\t})\n\t\t} catch (e) {\n\t\t\tconsole.error(e)\n\t\t}\n\t}\n\n\twpm.saveCartObjectToDataLayer = function (cartObject) {\n\t\twpmDataLayer.cart = cartObject\n\t\twpmDataLayer.products = Object.assign({}, wpmDataLayer.products, cartObject)\n\t}\n\n\twpm.fireCheckoutOption = function (step, checkout_option = null, value = null) {\n\n\t\tlet data = {\n\t\t\tstep : step,\n\t\t\tcheckout_option: checkout_option,\n\t\t\tvalue : value,\n\t\t}\n\n\t\tjQuery(document).trigger(\"wpmFireCheckoutOption\", data)\n\t}\n\n\twpm.fireCheckoutProgress = function (step) {\n\n\t\tlet data = {\n\t\t\tstep: step,\n\t\t}\n\n\t\tjQuery(document).trigger(\"wpmFireCheckoutProgress\", data)\n\t}\n\n\twpm.getPostIdFromString = function (string) {\n\t\t// console.log(string);\n\t\ttry {\n\t\t\treturn string.match(/(post-)(\\d+)/)[2]\n\t\t} catch (e) {\n\t\t\tconsole.error(e)\n\t\t}\n\t}\n\n\twpm.triggerViewItemList = function (productId) {\n\n\t\t// productId = null;\n\n\t\tif (!productId) throw Error(\"Wasn't able to retrieve a productId\")\n\n\t\tproductId = getIdBasedOndVariationsOutputSetting(productId)\n\n\t\tif (!productId) throw Error(\"Wasn't able to retrieve a productId\")\n\n\t\tjQuery(document).trigger(\"wpmViewItemList\", wpm.getProductDataForViewItemEvent(productId))\n\t}\n\n\twpm.getProductDataForViewItemEvent = function (productId) {\n\n\t\tif (!productId) throw Error(\"Wasn't able to retrieve a productId\")\n\n\t\ttry {\n\t\t\tif (wpmDataLayer.products[productId]) {\n\n\t\t\t\treturn wpm.getProductDetailsFormattedForEvent(productId)\n\t\t\t}\n\t\t} catch (e) {\n\t\t\tconsole.error(e)\n\t\t}\n\t}\n\twpm.getMainProductIdFromProductPage = function () {\n\t\ttry {\n\t\t\tif ([\"simple\", \"variable\", \"grouped\", \"composite\", \"bundle\"].indexOf(wpmDataLayer.shop.product_type) >= 0) {\n\t\t\t\treturn jQuery(\".wpmProductId:first\").data(\"id\")\n\t\t\t} else {\n\t\t\t\treturn false\n\t\t\t}\n\t\t} catch (e) {\n\t\t\tconsole.error(e)\n\t\t}\n\t}\n\n\twpm.viewItemListTriggerTestMode = function (target) {\n\n\t\tjQuery(target).css({\"position\": \"relative\"})\n\t\tjQuery(target).append(\"<div id=\\\"viewItemListTriggerOverlay\\\"></div>\")\n\t\tjQuery(target).find(\"#viewItemListTriggerOverlay\").css({\n\t\t\t\"z-index\" : \"10\",\n\t\t\t\"display\" : \"block\",\n\t\t\t\"position\" : \"absolute\",\n\t\t\t\"height\" : \"100%\",\n\t\t\t\"top\" : \"0\",\n\t\t\t\"left\" : \"0\",\n\t\t\t\"right\" : \"0\",\n\t\t\t\"opacity\" : wpmDataLayer.viewItemListTrigger.opacity,\n\t\t\t\"background-color\": wpmDataLayer.viewItemListTrigger.backgroundColor,\n\t\t})\n\t}\n\n\twpm.getSearchTermFromUrl = function () {\n\t\ttry {\n\t\t\tlet urlParameters = new URLSearchParams(window.location.search)\n\t\t\treturn urlParameters.get(\"s\")\n\t\t} catch (e) {\n\t\t\tconsole.error(e)\n\t\t}\n\t}\n\n\t// we need this to track timeouts for intersection observers\n\tlet ioTimeouts = {}\n\n\twpm.observerCallback = function (entries, observer) {\n\n\t\tentries.forEach((entry) => {\n\n\t\t\ttry {\n\t\t\t\tlet productId\n\n\t\t\t\tlet elementId = jQuery(entry.target).data(\"ioid\")\n\n\t\t\t\t// Get the productId from next element, if wpmProductId is a sibling, like in Gutenberg blocks\n\t\t\t\t// otherwise go search in children, like in regular WC loop items\n\t\t\t\tif (jQuery(entry.target).next(\".wpmProductId\").length) {\n\t\t\t\t\t// console.log('test 1');\n\t\t\t\t\tproductId = jQuery(entry.target).next(\".wpmProductId\").data(\"id\")\n\t\t\t\t} else {\n\t\t\t\t\tproductId = jQuery(entry.target).find(\".wpmProductId\").data(\"id\")\n\t\t\t\t}\n\n\t\t\t\t// productId = null;\n\n\t\t\t\tif (!productId) throw Error(\"wpmProductId element not found\")\n\n\t\t\t\tif (entry.isIntersecting) {\n\n\t\t\t\t\t// console.log('prodid: ' + productId);\n\t\t\t\t\tioTimeouts[elementId] = setTimeout(() => {\n\t\t\t\t\t\t// console.log('prodid: ' + productId);\n\t\t\t\t\t\twpm.triggerViewItemList(productId)\n\t\t\t\t\t\tif (wpmDataLayer.viewItemListTrigger.testMode) wpm.viewItemListTriggerTestMode(entry.target)\n\t\t\t\t\t\tif (wpmDataLayer.viewItemListTrigger.repeat === false) observer.unobserve(entry.target)\n\t\t\t\t\t}, wpmDataLayer.viewItemListTrigger.timeout)\n\n\t\t\t\t} else {\n\n\t\t\t\t\tclearTimeout(ioTimeouts[elementId])\n\t\t\t\t\tif (wpmDataLayer.viewItemListTrigger.testMode) jQuery(entry.target).find(\"#viewItemListTriggerOverlay\").remove()\n\t\t\t\t}\n\t\t\t} catch (e) {\n\t\t\t\tconsole.error(e)\n\t\t\t}\n\t\t})\n\t}\n\n\t// fire view_item_list only on products that have become visible\n\tlet io\n\tlet ioid = 0\n\tlet allIoElementsToWatch\n\n\tlet getAllElementsToWatch = function () {\n\n\t\tallIoElementsToWatch = jQuery(\".wpmProductId\")\n\t\t\t.map(function (i, elem) {\n\t\t\t\t// console.log(elem);\n\t\t\t\tif (\n\t\t\t\t\tjQuery(elem).parent().hasClass(\"type-product\") ||\n\t\t\t\t\tjQuery(elem).parent().hasClass(\"product\") ||\n\t\t\t\t\tjQuery(elem).parent().hasClass(\"product-item-inner\")\n\t\t\t\t) {\n\t\t\t\t\t// console.log(elem);\n\t\t\t\t\treturn jQuery(elem).parent()\n\t\t\t\t} else if (\n\t\t\t\t\tjQuery(elem).prev().hasClass(\"wc-block-grid__product\") ||\n\t\t\t\t\tjQuery(elem).prev().hasClass(\"product\") ||\n\t\t\t\t\tjQuery(elem).prev().hasClass(\"product-small\") ||\n\t\t\t\t\tjQuery(elem).prev().hasClass(\"woocommerce-LoopProduct-link\")\n\t\t\t\t) {\n\t\t\t\t\treturn jQuery(this).prev()\n\t\t\t\t} else if (jQuery(elem).closest(\".product\").length) {\n\t\t\t\t\treturn jQuery(elem).closest(\".product\")\n\t\t\t\t}\n\t\t\t})\n\t}\n\n\twpm.startIntersectionObserverToWatch = function () {\n\n\t\ttry {\n\t\t\t// enable view_item_list test mode from browser\n\t\t\tif (wpm.urlHasParameter(\"vildemomode\")) wpmDataLayer.viewItemListTrigger.testMode = true\n\n\t\t\t// set up intersection observer\n\t\t\tio = new IntersectionObserver(wpm.observerCallback, {\n\t\t\t\tthreshold: wpmDataLayer.viewItemListTrigger.threshold,\n\t\t\t})\n\n\t\t\tgetAllElementsToWatch()\n\n\t\t\t// console.log(allElementsToWatch);\n\n\t\t\tallIoElementsToWatch.each(function (i, elem) {\n\t\t\t\t// console.log(elem[0]);\n\t\t\t\t// jQuery(elem[0]).attr('data-ioid', ioid++);\n\t\t\t\tjQuery(elem[0]).data(\"ioid\", ioid++)\n\n\t\t\t\tio.observe(elem[0])\n\t\t\t})\n\t\t} catch (e) {\n\t\t\tconsole.error(e)\n\t\t}\n\t}\n\n\t// watch DOM for new lazy loaded products and add them to the intersection observer\n\twpm.startProductsMutationObserverToWatch = function () {\n\n\t\ttry {\n\t\t\t// Pass in the target node, as well as the observer options\n\n\t\t\t// selects the most common parent node\n\t\t\t// https://stackoverflow.com/a/7648323/4688612\n\t\t\tlet productsNode = jQuery(\".wpmProductId:eq(0)\").parents().has(jQuery(\".wpmProductId:eq(1)\").parents()).first()\n\n\t\t\tif (productsNode.length) {\n\t\t\t\tproductsMutationObserver.observe(productsNode[0], {\n\t\t\t\t\tattributes : true,\n\t\t\t\t\tchildList : true,\n\t\t\t\t\tcharacterData: true,\n\t\t\t\t})\n\t\t\t}\n\t\t} catch (e) {\n\t\t\tconsole.error(e)\n\t\t}\n\t}\n\n\t// Create an observer instance\n\tlet productsMutationObserver = new MutationObserver(function (mutations) {\n\n\t\tmutations.forEach(function (mutation) {\n\t\t\tlet newNodes = mutation.addedNodes // DOM NodeList\n\t\t\tif (newNodes !== null) { // If there are new nodes added\n\t\t\t\tlet nodes = jQuery(newNodes) // jQuery set\n\t\t\t\tnodes.each(function () {\n\t\t\t\t\tif (\n\t\t\t\t\t\tjQuery(this).hasClass(\"type-product\") ||\n\t\t\t\t\t\tjQuery(this).hasClass(\"product-small\") ||\n\t\t\t\t\t\tjQuery(this).hasClass(\"wc-block-grid__product\")\n\t\t\t\t\t) {\n\t\t\t\t\t\t// check if the node has a child or sibling wpmProductId\n\t\t\t\t\t\t// if yes add it to the intersectionObserver\n\t\t\t\t\t\tif (hasWpmProductIdElement(this)) {\n\t\t\t\t\t\t\tjQuery(this).data(\"ioid\", ioid++)\n\t\t\t\t\t\t\tio.observe(this)\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t})\n\t\t\t}\n\t\t})\n\t})\n\n\tlet hasWpmProductIdElement = function (elem) {\n\t\treturn !!(jQuery(elem).find(\".wpmProductId\").length ||\n\t\t\tjQuery(elem).siblings(\".wpmProductId\").length)\n\t}\n\n\twpm.setCookie = function (cookieName, cookieValue = \"\", expiryDays = null) {\n\t\tif (expiryDays) {\n\t\t\tlet d = new Date()\n\t\t\td.setTime(d.getTime() + (expiryDays * 24 * 60 * 60 * 1000))\n\t\t\tlet expires = \"expires=\" + d.toUTCString()\n\t\t\tdocument.cookie = cookieName + \"=\" + cookieValue + \";\" + expires + \";path=/\"\n\t\t} else {\n\t\t\tdocument.cookie = cookieName + \"=\" + cookieValue + \";path=/\"\n\t\t}\n\t}\n\n\twpm.getCookie = function (cookieName) {\n\t\tlet name = cookieName + \"=\"\n\t\tlet decodedCookie = decodeURIComponent(document.cookie)\n\t\tlet ca = decodedCookie.split(\";\")\n\t\tfor (let i = 0; i < ca.length; i++) {\n\t\t\tlet c = ca[i]\n\t\t\twhile (c.charAt(0) == \" \") {\n\t\t\t\tc = c.substring(1)\n\t\t\t}\n\t\t\tif (c.indexOf(name) == 0) {\n\t\t\t\treturn c.substring(name.length, c.length)\n\t\t\t}\n\t\t}\n\t\treturn \"\"\n\t}\n\n\twpm.getWpmSessionData = function () {\n\t\tif (window.sessionStorage) {\n\n\t\t\tlet data = window.sessionStorage.getItem(\"_wpm\")\n\t\t\tif (data !== null) {\n\t\t\t\treturn JSON.parse(data)\n\t\t\t} else {\n\t\t\t\treturn {}\n\t\t\t}\n\t\t} else {\n\t\t\treturn {}\n\t\t}\n\t}\n\n\twpm.setWpmSessionData = function (data) {\n\t\tif (window.sessionStorage) {\n\t\t\twindow.sessionStorage.setItem(\"_wpm\", JSON.stringify(data))\n\t\t}\n\t}\n\n\twpm.storeOrderIdOnServer = function (orderId) {\n\n\t\t// console.log('saving wpm_purchase_pixels_fired');\n\n\t\t// console.log('url: ' + wpm_premium_only_ajax_object.ajax_url);\n\t\t// console.log('nonce: ' + wpm_premium_only_ajax_object.nonce);\n\t\t// console.log('url: ' + wpm.ajax_url);\n\t\t// console.log('nonce: ' + wpm.nonce);\n\n\t\ttry {\n\t\t\t// save the state in the database\n\t\t\tlet data = {\n\t\t\t\taction : \"wpm_purchase_pixels_fired\",\n\t\t\t\torder_id: orderId,\n\t\t\t\t// nonce : ajax_object.nonce,\n\t\t\t\tnonce: wpm.nonce,\n\t\t\t}\n\n\t\t\tjQuery.ajax(\n\t\t\t\t{\n\t\t\t\t\ttype : \"post\",\n\t\t\t\t\tdataType: \"json\",\n\t\t\t\t\t// url : ajax_object.ajax_url,\n\t\t\t\t\turl : wpm.ajax_url,\n\t\t\t\t\tdata : data,\n\t\t\t\t\tsuccess: function (response) {\n\t\t\t\t\t\tif (response.success === false) {\n\t\t\t\t\t\t\tconsole.log(response)\n\t\t\t\t\t\t}\n\t\t\t\t\t},\n\t\t\t\t\terror : function (response) {\n\t\t\t\t\t\tconsole.log(response)\n\t\t\t\t\t},\n\t\t\t\t})\n\t\t} catch (e) {\n\t\t\tconsole.error(e)\n\t\t}\n\t}\n\n\twpm.getProductIdByCartItemKeyUrl = function (url) {\n\t\tlet searchParams = new URLSearchParams(url.search)\n\t\tlet cartItemKey = searchParams.get(\"remove_item\")\n\n\t\tlet productId\n\n\t\tif (wpmDataLayer.cartItemKeys[cartItemKey][\"variation_id\"] === 0) {\n\t\t\tproductId = wpmDataLayer.cartItemKeys[cartItemKey][\"product_id\"]\n\t\t} else {\n\t\t\tproductId = wpmDataLayer.cartItemKeys[cartItemKey][\"variation_id\"]\n\t\t}\n\n\t\treturn productId\n\t}\n\n\twpm.getAddToCartLinkProductIds = function () {\n\t\treturn jQuery(\"a\").map(function () {\n\t\t\tlet href = jQuery(this).attr(\"href\")\n\n\t\t\tif (href && href.includes(\"?add-to-cart=\")) {\n\t\t\t\tlet matches = href.match(/(add-to-cart=)(\\d+)/)\n\t\t\t\tif (matches) return matches[2]\n\t\t\t}\n\t\t}).get()\n\t}\n\n\twpm.getProductDetailsFormattedForEvent = function (productId, quantity = 1) {\n\n\t\t// console.log(wpmDataLayer.products[productId].dyn_r_ids)\n\n\t\tlet product = {\n\t\t\tid : productId.toString(),\n\t\t\tdyn_r_ids : wpmDataLayer.products[productId].dyn_r_ids,\n\t\t\tname : wpmDataLayer.products[productId].name,\n\t\t\tlist_name : wpmDataLayer.shop.list_name,\n\t\t\tbrand : wpmDataLayer.products[productId].brand,\n\t\t\tcategory : wpmDataLayer.products[productId].category,\n\t\t\tvariant : wpmDataLayer.products[productId].variant,\n\t\t\tlist_position: wpmDataLayer.products[productId].position,\n\t\t\tquantity : quantity,\n\t\t\tprice : wpmDataLayer.products[productId].price,\n\t\t\tcurrency : wpmDataLayer.shop.currency,\n\t\t\tisVariable : wpmDataLayer.products[productId].isVariable,\n\t\t\tisVariation : wpmDataLayer.products[productId].isVariation,\n\t\t\tparentId : wpmDataLayer.products[productId].parentId,\n\t\t}\n\n\t\tif (product.isVariation) product[\"parentId_dyn_r_ids\"] = wpmDataLayer.products[productId].parentId_dyn_r_ids\n\n\t\treturn product\n\t}\n\n\twpm.setReferrerToCookie = function () {\n\t\t// can't use session storage as we can't read it from the server\n\t\tif (!wpm.getCookie(\"wpmReferrer\")) {\n\t\t\twpm.setCookie(\"wpmReferrer\", document.referrer)\n\t\t}\n\t}\n\n\twpm.getReferrerFromCookie = function () {\n\t\tif (wpm.getCookie(\"wpmReferrer\")) {\n\t\t\treturn wpm.getCookie(\"wpmReferrer\")\n\t\t} else {\n\t\t\treturn null\n\t\t}\n\t}\n\n\twpm.getClidFromBrowser = function (clidId = \"gclid\") {\n\n\t\tlet clidCookieId\n\n\t\tclidCookieId = {\n\t\t\tgclid: \"_gcl_aw\",\n\t\t\tdclid: \"_gcl_dc\",\n\t\t}\n\n\t\tif (wpm.getCookie(clidCookieId[clidId])) {\n\t\t\tlet clidCookie = wpm.getCookie(clidCookieId[clidId])\n\t\t\tlet matches = clidCookie.match(/(GCL.[\\d]*.)(.*)/)\n\t\t\treturn matches[2]\n\t\t} else {\n\t\t\treturn \"\"\n\t\t}\n\t}\n\n\twpm.getUserAgent = function () {\n\t\treturn navigator.userAgent\n\t}\n\n\twpm.getViewPort = function () {\n\t\treturn {\n\t\t\twidth : Math.max(document.documentElement.clientWidth || 0, window.innerWidth || 0),\n\t\t\theight: Math.max(document.documentElement.clientHeight || 0, window.innerHeight || 0),\n\t\t}\n\t}\n\n\t/*\n\t* Handle Cookie Management Platforms\n\t* */\n\n\tlet getComplianzCookies = function () {\n\n\t\tlet cmplz_statistics = wpm.getCookie(\"cmplz_statistics\")\n\t\tlet cmplz_marketing = wpm.getCookie(\"cmplz_marketing\")\n\t\tlet cmplz_consent_status = wpm.getCookie(\"cmplz_consent_status\") || wpm.getCookie(\"cmplz_banner-status\")\n\n\n\t\tif (cmplz_consent_status) {\n\t\t\treturn {\n\t\t\t\tanalytics : cmplz_statistics === \"allow\",\n\t\t\t\tads : cmplz_marketing === \"allow\",\n\t\t\t\tvisitorHasChosen: true,\n\t\t\t}\n\t\t} else {\n\t\t\treturn false\n\t\t}\n\t}\n\n\tlet getCookieLawInfoCookies = function () {\n\n\t\tlet analyticsCookie = wpm.getCookie(\"cookielawinfo-checkbox-analytics\") || wpm.getCookie(\"cookielawinfo-checkbox-analytiques\")\n\t\tlet adsCookie = wpm.getCookie(\"cookielawinfo-checkbox-advertisement\") || wpm.getCookie(\"cookielawinfo-checkbox-publicite\")\n\t\tlet visitorHasChosen = wpm.getCookie(\"CookieLawInfoConsent\")\n\n\t\tif (analyticsCookie || adsCookie) {\n\n\t\t\treturn {\n\t\t\t\tanalytics : analyticsCookie === \"yes\",\n\t\t\t\tads : adsCookie === \"yes\",\n\t\t\t\tvisitorHasChosen: !!visitorHasChosen,\n\t\t\t}\n\t\t} else {\n\t\t\treturn false\n\t\t}\n\t}\n\n\n\tlet\n\t\twpmConsentValues = {}\n\twpmConsentValues.categories = {}\n\twpmConsentValues.pixels = []\n\twpmConsentValues.mode = \"category\"\n\twpmConsentValues.visitorHasChosen = false\n\n\twpm.getConsentValues = function () {\n\t\treturn wpmConsentValues\n\t}\n\n\twpm.setConsentValueCategories = function (analytics = false, ads = false) {\n\t\twpmConsentValues.categories.analytics = analytics\n\t\twpmConsentValues.categories.ads = ads\n\t}\n\n\twpm.updateConsentCookieValues = function (explicitConsent = false) {\n\n\t\t// ad_storage\n\t\t// analytics_storage\n\t\t// functionality_storage\n\t\t// personalization_storage\n\t\t// security_storage\n\n\t\t// console.log('exp cons: ' + explicitConsent)\n\n\t\tlet cookie\n\n\t\tif (cookie = wpm.getCookie(\"CookieConsent\")) {\n\t\t\t// Cookiebot\n\t\t\t// https://wordpress.org/plugins/cookiebot/\n\t\t\tcookie = decodeURI(cookie)\n\n\t\t\t// console.log(cookie.indexOf('statistics:true'))\n\t\t\t// console.log(cookie.indexOf('marketing:true'))\n\n\t\t\twpmConsentValues.categories.analytics = cookie.indexOf(\"statistics:true\") >= 0\n\t\t\twpmConsentValues.categories.ads = cookie.indexOf(\"marketing:true\") >= 0\n\t\t\twpmConsentValues.visitorHasChosen = true\n\n\t\t} else if (cookie = wpm.getCookie(\"CookieScriptConsent\")) {\n\t\t\t// Cookie Script\n\t\t\t// https://wordpress.org/plugins/cookie-script-com/\n\n\t\t\tcookie = JSON.parse(cookie)\n\n\t\t\t// console.log(cookie)\n\t\t\t// console.log(cookie.action)\n\t\t\t// console.log('cat length: ' + cookie.categories.length)\n\t\t\t// console.log(cookie.categories.indexOf('performance'))\n\n\t\t\tif (cookie.action === \"reject\") {\n\t\t\t\twpmConsentValues.categories.analytics = false\n\t\t\t\twpmConsentValues.categories.ads = false\n\t\t\t} else if (cookie.categories.length === 2) {\n\t\t\t\twpmConsentValues.categories.analytics = true\n\t\t\t\twpmConsentValues.categories.ads = true\n\t\t\t} else {\n\t\t\t\twpmConsentValues.categories.analytics = cookie.categories.indexOf(\"performance\") >= 0\n\t\t\t\twpmConsentValues.categories.ads = cookie.categories.indexOf(\"targeting\") >= 0\n\t\t\t}\n\n\t\t\twpmConsentValues.visitorHasChosen = true\n\n\t\t\t// console.log(wpmConsentValues)\n\n\t\t} else if (cookie = wpm.getCookie(\"borlabs-cookie\")) {\n\t\t\t// Borlabs Cookie\n\t\t\t// https://borlabs.io/borlabs-cookie/\n\n\t\t\tcookie = decodeURI(cookie)\n\t\t\tcookie = JSON.parse(cookie)\n\n\t\t\twpmConsentValues.categories.analytics = !!cookie?.consents?.statistics\n\t\t\twpmConsentValues.categories.ads = !!cookie?.consents?.marketing\n\t\t\twpmConsentValues.visitorHasChosen = true\n\t\t\twpmConsentValues.pixels = [...cookie?.consents?.statistics || [], ...cookie?.consents?.marketing || []]\n\t\t\twpmConsentValues.mode = \"pixel\"\n\n\t\t} else if (cookie = getComplianzCookies()) {\n\t\t\t// Complianz Cookie\n\t\t\t// https://wordpress.org/plugins/complianz-gdpr/\n\n\t\t\t// console.log(cookie)\n\n\t\t\twpmConsentValues.categories.analytics = cookie.analytics === true\n\t\t\twpmConsentValues.categories.ads = cookie.ads === true\n\t\t\twpmConsentValues.visitorHasChosen = cookie.visitorHasChosen\n\n\t\t\t// console.log(wpmConsentValues)\n\n\t\t} else if (cookie = wpm.getCookie(\"cookie_notice_accepted\")) {\n\t\t\t// Cookie Compliance (free version)\n\t\t\t// https://wordpress.org/plugins/cookie-notice/\n\n\t\t\twpmConsentValues.categories.analytics = true\n\t\t\twpmConsentValues.categories.ads = true\n\t\t\twpmConsentValues.visitorHasChosen = true\n\n\t\t} else if (cookie = wpm.getCookie(\"hu-consent\")) {\n\t\t\t// Cookie Compliance (pro version)\n\t\t\t// https://wordpress.org/plugins/cookie-notice/\n\n\t\t\tcookie = JSON.parse(cookie)\n\n\t\t\twpmConsentValues.categories.analytics = !!cookie.categories[\"3\"]\n\t\t\twpmConsentValues.categories.ads = !!cookie.categories[\"4\"]\n\t\t\twpmConsentValues.visitorHasChosen = true\n\n\t\t} else if (cookie = getCookieLawInfoCookies()) {\n\t\t\t// CookieYes, GDPR Cookie Consent (Cookie Law Info)\n\t\t\t// https://wordpress.org/plugins/cookie-law-info/\n\n\t\t\twpmConsentValues.categories.analytics = cookie.analytics === true\n\t\t\twpmConsentValues.categories.ads = cookie.ads === true\n\t\t\twpmConsentValues.visitorHasChosen = cookie.visitorHasChosen === true\n\n\t\t} else if (cookie = wpm.getCookie(\"moove_gdpr_popup\")) {\n\t\t\t// GDPR Cookie Compliance Plugin by Moove Agency\n\t\t\t// https://wordpress.org/plugins/gdpr-cookie-compliance/\n\t\t\t// TODO write documentation on how to set up the plugin in order for this to work properly\n\n\t\t\tcookie = JSON.parse(cookie)\n\t\t\t// console.log('moove cookie thirdparty: ' + cookie.thirdparty)\n\t\t\t// console.log('moove cookie advanced: ' + cookie.advanced)\n\n\t\t\twpmConsentValues.categories.analytics = cookie.thirdparty === \"1\"\n\t\t\twpmConsentValues.categories.ads = cookie.advanced === \"1\"\n\t\t\twpmConsentValues.visitorHasChosen = true\n\n\t\t\t// console.log(wpmConsentValues)\n\n\t\t} else {\n\t\t\t// consentValues.categories.analytics = true\n\t\t\t// consentValues.categories.ads = true\n\n\t\t\twpmConsentValues.categories.analytics = !explicitConsent\n\t\t\twpmConsentValues.categories.ads = !explicitConsent\n\t\t}\n\t}\n\n\twpm.updateConsentCookieValues()\n\n\twpm.setConsentDefaultValuesToExplicit = function () {\n\t\twpmConsentValues.categories = {\n\t\t\tanalytics: false,\n\t\t\tads : false,\n\t\t}\n\t}\n\n\twpm.canIFire = function (category, pixelName) {\n\n\t\tlet canIFireMode\n\n\t\tif (\"category\" === wpmConsentValues.mode) {\n\t\t\tcanIFireMode = !!wpmConsentValues.categories[category]\n\t\t} else if (\"pixel\" === wpmConsentValues.mode) {\n\t\t\tcanIFireMode = wpmConsentValues.pixels.includes(pixelName)\n\t\t} else {\n\t\t\tconsole.error(\"Couldn't find a valid consent mode in wpmConsentValues\")\n\t\t\tcanIFireMode = false\n\t\t}\n\n\t\tif (canIFireMode) {\n\t\t\treturn true\n\t\t} else {\n\t\t\tif (true || wpm.urlHasParameter(\"debugConsentMode\")) {\n\t\t\t\twpm.logPreventedPixelLoading(pixelName, category)\n\t\t\t}\n\n\t\t\treturn false\n\t\t}\n\t}\n\n\twpm.logPreventedPixelLoading = function (pixelName, category) {\n\t\tif (wpmDataLayer?.shop?.cookie_consent_mgmt?.explicit_consent) {\n\t\t\tconsole.log(\"WooCommerce Pixel Manager: The \\\"\" + pixelName + \" (category: \" + category + \")\\\" pixel has not fired because you have not given consent for it yet. (WPM is in explicit consent mode.)\")\n\t\t} else {\n\t\t\tconsole.log(\"WooCommerce Pixel Manager: The \\\"\" + pixelName + \" (category: \" + category + \")\\\" pixel has not fired because you have removed consent for this pixel. (WPM is in implicit consent mode.)\")\n\t\t}\n\t}\n\n\t/**\n\t * Runs through each script in <head> and blocks / unblocks it according to the plugin settings\n\t * and user consent.\n\t */\n\n\t// https://stackoverflow.com/q/65453565/4688612\n\twpm.scriptTagObserver = new MutationObserver((mutations) => {\n\t\tmutations.forEach(({addedNodes}) => {\n\t\t\t[...addedNodes]\n\t\t\t\t.forEach(node => {\n\n\t\t\t\t\tif ($(node).data(\"wpm-cookie-category\")) {\n\n\t\t\t\t\t\t// console.log(node)\n\n\t\t\t\t\t\t// If the pixel category has been approved > unblock\n\t\t\t\t\t\t// If the pixel belongs to more than one category, then unblock if one of the categories has been approved\n\t\t\t\t\t\t// If no category has been approved, but the Google Consent Mode is active, then only unblock the Google scripts\n\n\t\t\t\t\t\tif (wpm.shouldScriptBeActive(node)) {\n\t\t\t\t\t\t\twpm.unblockScript(node)\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\twpm.blockScript(node)\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t})\n\t\t})\n\t})\n\n\twpm.scriptTagObserver.observe(document.head, {childList: true, subtree: true})\n\twindow.addEventListener(\"DOMContentLoaded\", () => wpm.scriptTagObserver.disconnect())\n\n\twpm.shouldScriptBeActive = function (node) {\n\n\t\tif (\n\t\t\twpmDataLayer.shop.cookie_consent_mgmt.explicit_consent ||\n\t\t\twpmConsentValues.visitorHasChosen\n\t\t) {\n\n\t\t\tif (wpmConsentValues.mode === \"category\" && $(node).data(\"wpm-cookie-category\").split(\",\").some(element => wpmConsentValues.categories[element])) {\n\t\t\t\treturn true\n\t\t\t} else if (wpmConsentValues.mode === \"pixel\" && wpmConsentValues.pixels.includes($(node).data(\"wpm-pixel-name\"))) {\n\t\t\t\treturn true\n\t\t\t} else if (wpmConsentValues.mode === \"pixel\" && $(node).data(\"wpm-pixel-name\") === \"google\" && [\"google-analytics\", \"google-ads\"].some(element => wpmConsentValues.pixels.includes(element))) {\n\t\t\t\treturn true\n\t\t\t} else if (wpmDataLayer?.pixels?.google?.consent_mode?.active && $(node).data(\"wpm-pixel-name\") === \"google\") {\n\t\t\t\treturn true\n\t\t\t} else {\n\t\t\t\treturn false\n\t\t\t}\n\t\t} else {\n\t\t\treturn true\n\t\t}\n\t}\n\n\n\twpm.unblockScript = function (scriptNode, removeAttach = false) {\n\n\t\tif (removeAttach) $(scriptNode).remove()\n\n\t\tlet wpmSrc = $(scriptNode).data(\"wpm-src\")\n\t\tif (wpmSrc) $(scriptNode).attr(\"src\", wpmSrc)\n\n\t\tscriptNode.type = \"text/javascript\"\n\n\t\tif (removeAttach) $(scriptNode).appendTo(\"head\")\n\n\t\tjQuery(document).trigger(\"wpmPreLoadPixels\", {})\n\t}\n\n\twpm.blockScript = function (scriptNode, removeAttach = false) {\n\n\t\tif (removeAttach) $(scriptNode).remove()\n\n\t\tif ($(scriptNode).attr(\"src\")) $(scriptNode).removeAttr(\"src\")\n\t\tscriptNode.type = \"blocked/javascript\"\n\n\t\tif (removeAttach) $(scriptNode).appendTo(\"head\")\n\t}\n\n\twpm.unblockAllScripts = function (analytics = true, ads = true) {\n\t\t// console.log('unblocking all scripts')\n\n\t\t$.each(\n\t\t\t$(\"script[type=\\\"blocked/javascript\\\"]\"), function (index, scriptNode) {\n\n\t\t\t\tif ($(scriptNode).data(\"wpm-cookie-category\").includes(\"analytics\") && analytics) {\n\t\t\t\t\twpm.unblockScript(scriptNode, true)\n\t\t\t\t} else if ($(scriptNode).data(\"wpm-cookie-category\").includes(\"ads\") && ads) {\n\t\t\t\t\twpm.unblockScript(scriptNode, true)\n\t\t\t\t}\n\t\t\t})\n\n\t\tjQuery(document).trigger(\"wpmPreLoadPixels\", {})\n\t}\n\n\twpm.unblockSelectedPixels = function () {\n\t\t$.each(\n\t\t\t$(\"script[type=\\\"blocked/javascript\\\"]\"), function (index, node) {\n\n\t\t\t\tif (wpmConsentValues.pixels.includes($(node).data(\"wpm-pixel-name\"))) {\n\t\t\t\t\twpm.unblockScript(node, true)\n\t\t\t\t} else if ($(node).data(\"wpm-pixel-name\") === \"google\" && [\"google-analytics\", \"google-ads\"].some(element => wpmConsentValues.pixels.includes(element))) {\n\t\t\t\t\twpm.unblockScript(node, true)\n\t\t\t\t}\n\t\t\t})\n\n\t\tjQuery(document).trigger(\"wpmPreLoadPixels\", {})\n\t}\n\n\n\t/**\n\t * Block or unblock scripts for each CMP immediately after cookie consent has been updated\n\t * by the visitor.\n\t */\n\n\t// Borlabs Cookie\n\t// If visitor accepts cookies in Borlabs Cookie unblock the scripts\n\twindow.addEventListener(\"borlabs-cookie-consent-saved\", function () {\n\n\t\twpm.updateConsentCookieValues()\n\n\t\tif (wpmConsentValues.mode === \"pixel\") {\n\n\t\t\twpm.unblockSelectedPixels()\n\t\t\twpm.updateGoogleConsentMode(wpmConsentValues.pixels.includes(\"google-analytics\"), wpmConsentValues.pixels.includes(\"google-ads\"))\n\t\t} else {\n\n\t\t\twpm.unblockAllScripts(wpmConsentValues.categories.analytics, wpmConsentValues.categories.ads)\n\t\t\twpm.updateGoogleConsentMode(wpmConsentValues.categories.analytics, wpmConsentValues.categories.ads)\n\t\t}\n\t})\n\n\t// Cookiebot\n\t// If visitor accepts cookies in Cookiebot unblock the scripts\n\t// https://www.cookiebot.com/en/developer/\n\twindow.addEventListener(\"CookiebotOnAccept\", function () {\n\t\tif (Cookiebot.consent.statistics) wpmConsentValues.categories.analytics = true\n\t\tif (Cookiebot.consent.marketing) wpmConsentValues.categories.ads = true\n\n\t\twpm.unblockAllScripts(wpmConsentValues.categories.analytics, wpmConsentValues.categories.ads)\n\t\twpm.updateGoogleConsentMode(wpmConsentValues.categories.analytics, wpmConsentValues.categories.ads)\n\n\t}, false)\n\n\t/**\n\t * Cookie Script\n\t * If visitor accepts cookies in Cookie Script unblock the scripts\n\t * https://support.cookie-script.com/article/20-custom-events\n\t */\n\twindow.addEventListener(\"CookieScriptAccept\", function (e) {\n\t\tif (e.detail.categories.includes(\"performance\")) wpmConsentValues.categories.analytics = true\n\t\tif (e.detail.categories.includes(\"targeting\")) wpmConsentValues.categories.ads = true\n\n\t\twpm.unblockAllScripts(wpmConsentValues.categories.analytics, wpmConsentValues.categories.ads)\n\t\twpm.updateGoogleConsentMode(wpmConsentValues.categories.analytics, wpmConsentValues.categories.ads)\n\t})\n\n\t/**\n\t * Cookie Script\n\t * If visitor accepts cookies in Cookie Script unblock the scripts\n\t * https://support.cookie-script.com/\n\t */\n\twindow.addEventListener(\"CookieScriptAcceptAll\", function () {\n\t\twpm.unblockAllScripts(true, true)\n\t\twpm.updateGoogleConsentMode(true, true)\n\t})\n\n\t// Complianz Cookie\n\t// If visitor accepts cookies in Complianz unblock the scripts\n\tdocument.addEventListener(\"cmplzStatusChange\", function () {\n\n\t\twpm.updateConsentCookieValues()\n\n\t\t// console.log(wpmConsentValues)\n\n\t\twpm.unblockAllScripts(wpmConsentValues.categories.analytics, wpmConsentValues.categories.ads)\n\t\twpm.updateGoogleConsentMode(wpmConsentValues.categories.analytics, wpmConsentValues.categories.ads)\n\t})\n\n\t// Cookie Compliance by hu-manity.co (free and pro)\n\t// If visitor accepts cookies in Cookie Notice by hu-manity.co unblock the scripts (free version)\n\t// https://wordpress.org/support/topic/events-on-consent-change/#post-15202792\n\tdocument.addEventListener(\"setCookieNotice\", function () {\n\n\t\twpm.updateConsentCookieValues()\n\n\t\t// console.log(wpmConsentValues)\n\n\t\twpm.unblockAllScripts(wpmConsentValues.categories.analytics, wpmConsentValues.categories.ads)\n\t\twpm.updateGoogleConsentMode(wpmConsentValues.categories.analytics, wpmConsentValues.categories.ads)\n\t})\n\n\t/**\n\t * Cookie Compliance by hu-manity.co (free and pro)\n\t * If visitor accepts cookies in Cookie Notice by hu-manity.co unblock the scripts (pro version)\n\t * https://wordpress.org/support/topic/events-on-consent-change/#post-15202792\n\t * Because Cookie Notice has no documented API or event that is being triggered on consent save or update\n\t * we have to solve this by using a mutation observer.\n\t *\n\t * @type {MutationObserver}\n\t */\n\n\twpm.huObserver = new MutationObserver(function (mutations) {\n\t\tmutations.forEach(({addedNodes}) => {\n\t\t\t[...addedNodes]\n\t\t\t\t.forEach(node => {\n\n\t\t\t\t\tif (node.id === \"hu\") {\n\n\t\t\t\t\t\tjQuery(\".hu-cookies-save\").on(\"click\", function () {\n\t\t\t\t\t\t\twpm.updateConsentCookieValues()\n\t\t\t\t\t\t\twpm.unblockAllScripts(wpmConsentValues.categories.analytics, wpmConsentValues.categories.ads)\n\t\t\t\t\t\t\twpm.updateGoogleConsentMode(wpmConsentValues.categories.analytics, wpmConsentValues.categories.ads)\n\t\t\t\t\t\t})\n\t\t\t\t\t}\n\t\t\t\t})\n\t\t})\n\t})\n\n\tif (window.hu) {\n\t\twpm.huObserver.observe(document.documentElement || document.body, {childList: true, subtree: true})\n\t}\n\n\twpm.version = function () {\n\t\tconsole.log(wpmDataLayer.version)\n\t}\n\n\t// https://api.jquery.com/jquery.getscript/\n\twpm.loadScriptAndCacheIt = function (url, options) {\n\n\t\t// Allow user to set any option except for dataType, cache, and url\n\t\toptions = jQuery.extend(options || {}, {\n\t\t\tdataType: \"script\",\n\t\t\tcache : true,\n\t\t\turl : url,\n\t\t})\n\n\t\t// Use $.ajax() since it is more flexible than $.getScript\n\t\t// Return the jqXHR object so we can chain callbacks\n\t\treturn jQuery.ajax(options)\n\t}\n\n\twpm.getOrderItemPrice = function (orderItem) {\n\t\treturn (orderItem.total + orderItem.total_tax) / orderItem.quantity\n\t}\n\n\twpm.hasLoginEventFired = function () {\n\t\tlet data = wpm.getWpmSessionData()\n\t\treturn data?.loginEventFired\n\t}\n\n\twpm.setLoginEventFired = function () {\n\t\tlet data = wpm.getWpmSessionData()\n\t\tdata[\"loginEventFired\"] = true\n\t\twpm.setWpmSessionData(data)\n\t}\n\n\twpm.wpmDataLayerExists = function () {\n\t\treturn new Promise(function (resolve) {\n\t\t\t(function waitForVar() {\n\t\t\t\tif (typeof wpmDataLayer !== \"undefined\") return resolve()\n\t\t\t\tsetTimeout(waitForVar, 50)\n\t\t\t})()\n\t\t})\n\t}\n\n\twpm.jQueryExists = function () {\n\t\treturn new Promise(function (resolve) {\n\t\t\t(function waitForjQuery() {\n\t\t\t\tif (typeof jQuery !== \"undefined\") return resolve()\n\t\t\t\tsetTimeout(waitForjQuery, 100)\n\t\t\t})()\n\t\t})\n\t}\n\n\twpm.pageLoaded = function () {\n\t\treturn new Promise(function (resolve) {\n\t\t\t(function waitForVar() {\n\t\t\t\tif (\"complete\" === document.readyState) return resolve()\n\t\t\t\tsetTimeout(waitForVar, 50)\n\t\t\t})()\n\t\t})\n\t}\n\n\twpm.pageReady = function () {\n\t\treturn new Promise(function (resolve) {\n\t\t\t(function waitForVar() {\n\t\t\t\tif (\"interactive\" === document.readyState || \"complete\" === document.readyState) return resolve()\n\t\t\t\tsetTimeout(waitForVar, 50)\n\t\t\t})()\n\t\t})\n\t}\n\n\twpm.isMiniCartActive = function () {\n\t\tif (window.sessionStorage) {\n\t\t\tfor (const [key, value] of Object.entries(window.sessionStorage)) {\n\t\t\t\tif (key.includes(\"wc_fragments\")) {\n\t\t\t\t\treturn true\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn false\n\t\t} else {\n\t\t\treturn false\n\t\t}\n\t}\n\n\twpm.doesWooCommerceCartExist = function () {\n\t\treturn document.cookie.includes(\"woocommerce_items_in_cart\")\n\t}\n\n\twpm.urlHasParameter = function (parameter) {\n\t\tlet urlParams = new URLSearchParams(window.location.search)\n\t\treturn urlParams.has(parameter)\n\t}\n\n\t// wpm['load'] = {\n\t// base: true\n\t// };\n\n\twindow[\"wpmLoaded\"] = {}\n\n\t// return {\n\t// writeOrderIdToStorage : writeOrderIdToStorage,\n\t// isOrderIdStored : isOrderIdStored,\n\t// isEmail : isEmail,\n\t// removeProductFromCart : removeProductFromCart,\n\t// getViewItemProducts : getViewItemProducts,\n\t// addProductToCart : addProductToCart,\n\t// getCartItemsFromBackEnd: getCartItemsFromBackEnd,\n\t// fireCheckoutOption : fireCheckoutOption,\n\t// getCartItems : getCartItems\n\t// }\n\n}(window.wpm = window.wpm || {}, jQuery))\n","/**\n * Load all WPM functions\n *\n * Ignore event listeners. They need to be loaded after\n * we made sure that jQuery has been loaded.\n */\n\nrequire(\"./functions\")\n\n// #if process.env.TIER === 'premium'\n// require(\"./functions_premium\")\n// #endif\n","/**\n * After wpm is loaded\n * we first check if wpmDataLayer is loaded,\n * and as soon as it is, we load the pixels,\n * and as soon as the page load is complete,\n * we fire the wpmLoad event.\n *\n * @param {{pro:bool}} wpmDataLayer.version\n *\n * https://stackoverflow.com/a/25868457/4688612\n * https://stackoverflow.com/a/44093516/4688612\n */\n\nwpm.wpmDataLayerExists()\n\t.then(function () {\n\t\tconsole.log(\"WooCommerce Pixel Manager: \" + (wpmDataLayer.version.pro ? \"Pro\" : \"Free\") +\" Version \" + wpmDataLayer.version.number + \" loaded\")\n\t\tjQuery(document).trigger(\"wpmPreLoadPixels\", {})\n\t})\n\t.then(function () {\n\t\twpm.pageLoaded().then(function () {\n\t\t\tjQuery(document).trigger(\"wpmLoad\", {})\n\t\t})\n\t})\n\n\n\n/**\n * Run when page is ready\n *\n */\n\nwpm.pageReady().then(function () {\n\n\t/**\n\t * Run as soon as wpm namespace is loaded\n\t */\n\n\twpm.wpmDataLayerExists()\n\t\t.then(function () {\n\t\t\t// watch for products visible in viewport\n\t\t\twpm.startIntersectionObserverToWatch()\n\n\t\t\t// watch for lazy loaded products\n\t\t\twpm.startProductsMutationObserverToWatch()\n\t\t})\n})\n\n","// The module cache\nvar __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tvar cachedModule = __webpack_module_cache__[moduleId];\n\tif (cachedModule !== undefined) {\n\t\treturn cachedModule.exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\t// no module.id needed\n\t\t// no module.loaded needed\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId](module, module.exports, __webpack_require__);\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n","/**\n * Load all essential scripts first\n */\n\nrequire(\"./wpm/functions_loader\")\n\n// Only load the event listeners after jQuery has been loaded for sure\nwpm.jQueryExists().then(function () {\n\n\trequire(\"./wpm/event_listeners\")\n\n\trequire(\"./google/loader\")\n\trequire(\"./facebook/loader\")\n\trequire(\"./hotjar/loader\")\n\n\n\t/**\n\t * Load all premium scripts\n\t */\n\n\t// #if process.env.TIER === 'premium'\n// \trequire(\"./microsoft-ads/loader\")\n// \trequire(\"./pinterest/loader\")\n// \trequire(\"./snapchat/loader\")\n// \trequire(\"./tiktok/loader\")\n// \trequire(\"./twitter/loader\")\n\t// #endif\n\n\n\t/**\n\t * Initiate WPM.\n\t *\n\t * It makes sure that the script flow gets executed correctly,\n\t * no matter how JS \"optimizers\" shuffle the code.\n\t */\n\n\trequire(\"./wpm/init\")\n})\n\n"],"names":["jQuery","document","on","wpmDataLayer","pixels","facebook","pixel_id","loaded","wpm","canIFire","loadFacebookPixel","event","product","eventId","getRandomEventId","fbq","content_type","content_name","name","content_ids","dyn_r_ids","dynamic_remarketing","id_type","value","parseFloat","quantity","price","currency","eventID","shop","trigger","event_name","event_id","user_data","getFbUserData","product_data","product_id","event_source_url","window","location","href","e","console","error","fbViewContent","setFbUserData","order","value_filtered","facebookContentIds","id","$","undefined","fBUserData","f","b","n","callMethod","apply","arguments","queue","push","_fbq","version","t","createElement","async","src","s","getElementsByTagName","parentNode","insertBefore","Math","random","toString","substring","getFbUserDataFromBrowser","fbp","getCookie","fbc","client_user_agent","navigator","userAgent","prodIds","key","item","Object","entries","items","general","variationsOutput","variation_id","String","products","require","isEmptyObject","google","ads","conversionIds","status","googleConfigConditionsMet","isVariable","send_events_with_parent_ids","gtagLoaded","then","gtag","send_to","getGoogleAdsConversionIdentifiers","google_business_vertical","getGoogleAdsDynamicRemarketingOrderItems","data_basic","data_with_cart","getGoogleAdsConversionIdentifiersWithLabel","transaction_id","number","new_customer","aw_merchant_id","discount","aw_feed_country","aw_feed_language","getGoogleAdsRegularOrderItems","conversionIdentifiers","orderItems","orderItem","analytics","universal","property_id","mp_active","affiliation","value_regular","tax","shipping","coupon","getGAUAOrderItems","list_position","category","join","variant","variant_name","brand","ga4","measurement_id","getGA4OrderItems","item_name","item_category","item_id","item_variant","item_brand","state","canGoogleLoad","loadGoogle","logPreventedPixelLoading","type","consent_mode","active","getConsentValues","mode","categories","includes","getVisitorConsentStatusAndUpdateGoogleConsentSettings","google_consent_settings","analytics_storage","ad_storage","updateGoogleConsentMode","cookie_consent_mgmt","explicit_consent","fireGtagGoogleAds","enhanced_conversions","phone_conversion_label","phone_conversion_number","keys","page_type","enhanced_conversion_data","fireGtagGoogleAnalyticsUA","parameters","fireGtagGoogleAnalyticsGA4","isGoogleActive","getGoogleGtagId","loadScriptAndCacheIt","done","script","textStatus","dataLayer","wait_for_update","region","ads_data_redaction","url_passthrough","linker","settings","Date","Promise","resolve","reject","startTime","wait","setTimeout","optimize","container_id","load_google_optimize_pixel","hotjar","site_id","load_hotjar_pixel","h","o","hj","q","_hjSettings","hjid","hjsv","a","r","appendChild","url","URL","this","attr","productId","getProductIdByCartItemKeyUrl","removeProductFromCart","data","addProductToCart","product_type","Number","val","each","find","classes","getPostIdFromString","one","target","closest","matches","match","nextAll","getIdBasedOndVariationsOutputSetting","Error","getProductDetailsFormattedForEvent","isEmail","fireCheckoutProgress","emailSelected","paymentMethodSelected","fireCheckoutOption","cart","getCartItemsFromBackend","variation","doesWooCommerceCartExist","getCartItems","productIds","getAddToCartLinkProductIds","getProductsFromBackend","referrer","referrerHostname","hostname","host","setCookie","wpmLoadFired","getMainProductIdFromProductPage","getProductDataForViewItemEvent","isOrderIdStored","writeOrderIdToStorage","user","hasLoginEventFired","setLoginEventFired","updateConsentCookieValues","wpmDeduper","wpmRestSettings","checkCookie","useRestEndpoint","isSessionStorageAvailable","isRestEndpointAvailable","isBelowRestErrorThreshold","sessionStorage","getItem","JSON","parse","testEndpoint","protocol","cookieName","ajax","timeout","statusCode","response","setItem","stringify","isWpmRestEndpointAvailable","orderId","Storage","localStorage","ids","expiresDate","setDate","getDate","cookie","toUTCString","storeOrderIdOnServer","orderDeduplication","log","email","test","quantityToRemove","isVariation","parentId","saveCartObjectToDataLayer","action","dataType","ajax_url","success","cartItems","filter","hasOwnProperty","length","assign","cartObject","step","checkout_option","string","triggerViewItemList","indexOf","viewItemListTriggerTestMode","css","append","viewItemListTrigger","opacity","backgroundColor","getSearchTermFromUrl","URLSearchParams","search","get","io","ioTimeouts","observerCallback","observer","forEach","entry","elementId","next","isIntersecting","testMode","repeat","unobserve","clearTimeout","remove","allIoElementsToWatch","ioid","startIntersectionObserverToWatch","urlHasParameter","IntersectionObserver","threshold","map","i","elem","parent","hasClass","prev","observe","startProductsMutationObserverToWatch","productsNode","parents","has","first","productsMutationObserver","attributes","childList","characterData","MutationObserver","mutations","mutation","newNodes","addedNodes","hasWpmProductIdElement","siblings","cookieValue","expiryDays","d","setTime","getTime","expires","ca","decodeURIComponent","split","c","charAt","getWpmSessionData","setWpmSessionData","order_id","nonce","cartItemKey","cartItemKeys","list_name","position","parentId_dyn_r_ids","setReferrerToCookie","getReferrerFromCookie","getClidFromBrowser","clidCookieId","clidId","gclid","dclid","getUserAgent","getViewPort","width","max","documentElement","clientWidth","innerWidth","height","clientHeight","innerHeight","getComplianzCookies","cmplz_statistics","cmplz_marketing","visitorHasChosen","getCookieLawInfoCookies","analyticsCookie","adsCookie","wpmConsentValues","setConsentValueCategories","explicitConsent","decodeURI","consents","statistics","marketing","thirdparty","advanced","setConsentDefaultValuesToExplicit","pixelName","canIFireMode","scriptTagObserver","node","shouldScriptBeActive","unblockScript","blockScript","head","subtree","addEventListener","disconnect","some","element","scriptNode","removeAttach","wpmSrc","appendTo","removeAttr","unblockAllScripts","index","unblockSelectedPixels","Cookiebot","consent","detail","huObserver","hu","body","options","extend","cache","getOrderItemPrice","total","total_tax","loginEventFired","wpmDataLayerExists","waitForVar","jQueryExists","waitForjQuery","pageLoaded","readyState","pageReady","isMiniCartActive","parameter","pro","__webpack_module_cache__","__webpack_require__","moduleId","cachedModule","exports","module","__webpack_modules__"],"sourceRoot":""}
|
1 |
+
{"version":3,"file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mD,QAAQ,gBAAiB,OAS3CD,QAAO,WAQNA,OAAO,0BAA0BwB,GAAG,kBAAkB,SAAUE,EAAOmX,GAEtE,IACC,IAAI9M,EAAYG,qCAAqC2M,EAAUzX,cAE/D,IAAK2K,EAAW,MAAME,MAAM,uCAE5B,GAAI3P,aAAagF,UAAYhF,aAAagF,SAASyK,GAAY,CAI9D,IAAI7M,EAAUjD,IAAImQ,mCAAmCL,GAErD/L,OAAOlD,UAAUmD,QAAQ,cAAef,IAExC,MAAOnC,GACRkB,QAAQC,MAAMnB,YC12Db+b,EAA2B,GAG/B,SAASC,EAAoBC,GAE5B,IAAIC,EAAeH,EAAyBE,GAC5C,QAAqB7c,IAAjB8c,EACH,OAAOA,EAAaC,QAGrB,IAAIC,EAASL,EAAyBE,GAAY,CAGjDE,QAAS,IAOV,OAHAE,EAAoBJ,GAAUG,EAAQA,EAAOD,QAASH,GAG/CI,EAAOD,QCjBfG,EAAQ,KAMRA,EAAQ,KACRA,EAAQ,KACRA,EAAQ,KACRA,EAAQ,KACRA,EAAQ,KACRA,EAAQ,KACRA,EAAQ,KAMRA,EAAQ,M","sources":["webpack://WooCommerce Pixel Manager/./src/js/public/facebook.js","webpack://WooCommerce Pixel Manager/./src/js/public/google-ads.js","webpack://WooCommerce Pixel Manager/./src/js/public/google-ga-4.js","webpack://WooCommerce Pixel Manager/./src/js/public/google-ga-ua.js","webpack://WooCommerce Pixel Manager/./src/js/public/google-optimize.js","webpack://WooCommerce Pixel Manager/./src/js/public/google.js","webpack://WooCommerce Pixel Manager/./src/js/public/hotjar.js","webpack://WooCommerce Pixel Manager/./src/js/public/wpm-loader.js","webpack://WooCommerce Pixel Manager/./src/js/public/wpm.js","webpack://WooCommerce Pixel Manager/webpack/bootstrap","webpack://WooCommerce Pixel Manager/./src/js/public/main-free.js"],"sourcesContent":["/**\n * Add functions for Facebook\n * */\n\n(function (wpm, $, undefined) {\n\n\tlet fBUserData\n\n\twpm.loadFacebookPixel = function () {\n\n\t\ttry {\n\t\t\tif (wpmDataLayer?.pixels?.facebook?.pixel_id) {\n\n\t\t\t\twpmDataLayer.pixels.facebook.loaded = true\n\n\t\t\t\t// @formatter:off\n \t\t\t!function(f,b,e,v,n,t,s)\n \t\t\t{if(f.fbq)return;n=f.fbq=function(){n.callMethod?\n \t\t\t\tn.callMethod.apply(n,arguments):n.queue.push(arguments)};\n \t\t\t\tif(!f._fbq)f._fbq=n;n.push=n;n.loaded=!0;n.version='2.0';\n \t\t\t\tn.queue=[];t=b.createElement(e);t.async=!0;\n \t\t\t\tt.src=v;s=b.getElementsByTagName(e)[0];\n \t\t\t\ts.parentNode.insertBefore(t,s)}(window, document,'script',\n \t\t\t\t'https://connect.facebook.net/en_US/fbevents.js');\n \t\t\t// @formatter:on\n\n\t\t\t\tfbq(\"init\", wpmDataLayer.pixels.facebook.pixel_id)\n\t\t\t\tfbq(\"track\", \"PageView\")\n\t\t\t}\n\t\t} catch (e) {\n\t\t\tconsole.error(e)\n\t\t}\n\t}\n\n\twpm.getRandomEventId = function () {\n\t\treturn (Math.random() + 1).toString(36).substring(2)\n\t}\n\n\twpm.getFbUserData = function () {\n\t\t// We need the first one for InitiateCheckout\n\t\t// where getting the user_data from the browser is too slow\n\t\t// using wpm.getCookie(), so we cache the user_data earlier.\n\t\t// And we need the second one because the ViewContent hit happens too fast\n\t\t// after adding a variation to the cart because the function to cache\n\t\t// the user_data is too slow. But we can get the user_data using wpm.getCookie()\n\t\t// because we don't move away from the page and can wait for the browser\n\t\t// to get it.\n\t\tif (fBUserData) {\n\t\t\treturn fBUserData\n\t\t} else {\n\t\t\treturn wpm.getFbUserDataFromBrowser()\n\t\t}\n\t}\n\n\twpm.setFbUserData = function () {\n\t\tfBUserData = wpm.getFbUserDataFromBrowser()\n\t}\n\n\twpm.getFbUserDataFromBrowser = function () {\n\t\treturn {\n\t\t\tfbp : wpm.getCookie(\"_fbp\"),\n\t\t\tfbc : wpm.getCookie(\"_fbc\"),\n\t\t\tclient_user_agent: navigator.userAgent,\n\t\t}\n\t}\n\n\twpm.fbViewContent = function (product) {\n\n\t\ttry {\n\t\t\tif (!wpmDataLayer?.pixels?.facebook?.loaded) return\n\n\t\t\tlet eventId = wpm.getRandomEventId()\n\n\t\t\tfbq(\"track\", \"ViewContent\", {\n\t\t\t\tcontent_type: \"product\",\n\t\t\t\tcontent_name: product.name,\n\t\t\t\t// content_category: product.category,\n\t\t\t\tcontent_ids: product.dyn_r_ids[wpmDataLayer.pixels.facebook.dynamic_remarketing.id_type],\n\t\t\t\tcurrency : wpmDataLayer.shop.currency,\n\t\t\t\tvalue : product.price,\n\t\t\t}, {\n\t\t\t\teventID: eventId,\n\t\t\t})\n\n\t\t\tproduct[\"currency\"] = wpmDataLayer.shop.currency\n\n\t\t\tjQuery(document).trigger(\"wpmFbCapiEvent\", {\n\t\t\t\tevent_name : \"ViewContent\",\n\t\t\t\tevent_id : eventId,\n\t\t\t\tuser_data : wpm.getFbUserData(),\n\t\t\t\tproduct_data : product,\n\t\t\t\tproduct_id : product.dyn_r_ids[wpmDataLayer.pixels.facebook.dynamic_remarketing.id_type],\n\t\t\t\tevent_source_url: window.location.href,\n\t\t\t})\n\t\t} catch (e) {\n\t\t\tconsole.error(e)\n\t\t}\n\t}\n\n\twpm.facebookContentIds = function () {\n\t\tlet prodIds = []\n\n\t\tfor (const [key, item] of Object.entries(wpmDataLayer.order.items)) {\n\n\t\t\tif (wpmDataLayer?.general?.variationsOutput && 0 !== item.variation_id) {\n\t\t\t\tprodIds.push(String(wpmDataLayer.products[item.variation_id].dyn_r_ids[wpmDataLayer.pixels.facebook.dynamic_remarketing.id_type]))\n\t\t\t} else {\n\t\t\t\tprodIds.push(String(wpmDataLayer.products[item.id].dyn_r_ids[wpmDataLayer.pixels.facebook.dynamic_remarketing.id_type]))\n\t\t\t}\n\t\t}\n\n\t\treturn prodIds\n\t}\n\n}(window.wpm = window.wpm || {}, jQuery));\n\n\n/**\n * Execute as soon as possible\n * */\n\n(function () {\n\n\tjQuery(document).on(\"wpmLoadPixels\", function () {\n\n\t\tif (wpm.canIFire(\"ads\", \"facebook-ads\") && !wpmDataLayer?.pixels?.facebook?.loaded) wpm.loadFacebookPixel()\n\n\t})\n\n})()\n\n\n/**\n * All event listeners\n * */\n\n// AddToCart event\njQuery(document).on(\"wpmAddToCart\", function (event, product) {\n\n\ttry {\n\t\tif (!wpmDataLayer?.pixels?.facebook?.loaded) return\n\n\t\tlet eventId = wpm.getRandomEventId()\n\n\t\t// console.log('eventId: ' + eventId);\n\n\t\tfbq(\"track\", \"AddToCart\", {\n\t\t\tcontent_type: \"product\",\n\t\t\tcontent_name: product.name,\n\t\t\tcontent_ids : product.dyn_r_ids[wpmDataLayer.pixels.facebook.dynamic_remarketing.id_type],\n\t\t\tvalue : parseFloat(product.quantity * product.price),\n\t\t\tcurrency : product.currency,\n\t\t}, {\n\t\t\teventID: eventId,\n\t\t})\n\n\n\t\tproduct[\"currency\"] = wpmDataLayer.shop.currency\n\n\t\tjQuery(document).trigger(\"wpmFbCapiEvent\", {\n\t\t\tevent_name : \"AddToCart\",\n\t\t\tevent_id : eventId,\n\t\t\tuser_data : wpm.getFbUserData(),\n\t\t\tproduct_data : product,\n\t\t\tproduct_id : product.dyn_r_ids[wpmDataLayer.pixels.facebook.dynamic_remarketing.id_type],\n\t\t\tevent_source_url: window.location.href,\n\t\t})\n\t} catch (e) {\n\t\tconsole.error(e)\n\t}\n})\n\n// InitiateCheckout event\njQuery(document).on(\"wpmBeginCheckout\", function (event) {\n\n\ttry {\n\t\t// console.log('firing facebook ads InitiateCheckout event');\n\n\t\tif (!wpmDataLayer?.pixels?.facebook?.loaded) return\n\n\t\tlet eventId = wpm.getRandomEventId()\n\n\t\tfbq(\"track\", \"InitiateCheckout\", {}, {\n\t\t\teventID: eventId,\n\t\t})\n\n\t\tjQuery(document).trigger(\"wpmFbCapiEvent\", {\n\t\t\tevent_name : \"InitiateCheckout\",\n\t\t\tevent_id : eventId,\n\t\t\tuser_data : wpm.getFbUserData(),\n\t\t\tevent_source_url: window.location.href,\n\t\t})\n\t} catch (e) {\n\t\tconsole.error(e)\n\t}\n})\n\n// AddToWishlist event\njQuery(document).on(\"wpmAddToWishlist\", function (event, product) {\n\n\ttry {\n\t\t// console.log('firing facebook ads AddToWishlist event');\n\t\t// console.log(product);\n\n\t\tif (!wpmDataLayer?.pixels?.facebook?.loaded) return\n\n\t\tlet eventId = wpm.getRandomEventId()\n\n\t\tfbq(\"track\", \"AddToWishlist\", {\n\t\t\tcontent_type: \"product\",\n\t\t\tcontent_name: product.name,\n\t\t\tcontent_ids : product.dyn_r_ids[wpmDataLayer.pixels.facebook.dynamic_remarketing.id_type],\n\t\t\tvalue : parseFloat(product.quantity * product.price),\n\t\t\tcurrency : product.currency,\n\t\t}, {\n\t\t\teventID: eventId,\n\t\t})\n\n\n\t\tproduct[\"currency\"] = wpmDataLayer.shop.currency\n\n\t\tjQuery(document).trigger(\"wpmFbCapiEvent\", {\n\t\t\tevent_name : \"AddToWishlist\",\n\t\t\tevent_id : eventId,\n\t\t\tuser_data : wpm.getFbUserData(),\n\t\t\tproduct_data : product,\n\t\t\tproduct_id : product.dyn_r_ids[wpmDataLayer.pixels.facebook.dynamic_remarketing.id_type],\n\t\t\tevent_source_url: window.location.href,\n\t\t})\n\t} catch (e) {\n\t\tconsole.error(e)\n\t}\n})\n\n// ViewContent event\njQuery(document).on(\"wpmViewItem\", function (event, product) {\n\n\ttry {\n\t\t// console.log('firing facebook ads ViewContent event');\n\t\t// console.log(product);\n\n\t\tif (!wpmDataLayer?.pixels?.facebook?.loaded) return\n\n\t\twpm.fbViewContent(product)\n\t} catch (e) {\n\t\tconsole.error(e)\n\t}\n})\n\n// view search event\njQuery(document).on(\"wpmSearch\", function () {\n\n\ttry {\n\t\tif (!wpmDataLayer?.pixels?.facebook?.loaded) return\n\n\t\tlet eventId = wpm.getRandomEventId()\n\n\t\tfbq(\"track\", \"Search\", {}, {\n\t\t\teventID: eventId,\n\t\t})\n\n\t\tjQuery(document).trigger(\"wpmFbCapiEvent\", {\n\t\t\tevent_name : \"Search\",\n\t\t\tevent_id : eventId,\n\t\t\tuser_data : wpm.getFbUserData(),\n\t\t\tevent_source_url: window.location.href,\n\t\t})\n\t} catch (e) {\n\t\tconsole.error(e)\n\t}\n})\n\n// load always event\njQuery(document).on(\"wpmLoadAlways\", function () {\n\n\ttry {\n\t\tif (!wpmDataLayer?.pixels?.facebook?.loaded) return\n\n\t\twpm.setFbUserData()\n\t} catch (e) {\n\t\tconsole.error(e)\n\t}\n})\n\n// view order received page event\n// https://developers.pinterest.com/docs/tag/conversion/\njQuery(document).on(\"wpmOrderReceivedPage\", function () {\n\n\ttry {\n\t\tif (!wpmDataLayer?.pixels?.facebook?.loaded) return\n\n\t\tfbq(\"track\", \"Purchase\",\n\t\t\t{\n\t\t\t\tcontent_type: \"product\",\n\t\t\t\tvalue : wpmDataLayer.order.value_filtered,\n\t\t\t\tcurrency : wpmDataLayer.order.currency,\n\t\t\t\tcontent_ids : wpm.facebookContentIds(),\n\t\t\t},\n\t\t\t{eventID: wpmDataLayer.order.id},\n\t\t)\n\n\n\t\t// console.log(wpm.facebookContentIds())\n\t} catch (e) {\n\t\tconsole.error(e)\n\t}\n})\n","/**\n * Add functions for Google Ads\n * */\n\n(function (wpm, $, undefined) {\n\n\tlet conversionIdentifiers = []\n\n\twpm.getGoogleAdsConversionIdentifiersWithLabel = function () {\n\t\tfor (const [key, item] of Object.entries(wpmDataLayer.pixels.google.ads.conversionIds)) {\n\t\t\tconversionIdentifiers.push(key + \"/\" + item)\n\t\t}\n\t\treturn conversionIdentifiers\n\t}\n\n\twpm.getGoogleAdsConversionIdentifiers = function () {\n\n\t\tlet conversionIdentifiers = []\n\t\tfor (const [key, item] of Object.entries(wpmDataLayer.pixels.google.ads.conversionIds)) {\n\t\t\tconversionIdentifiers.push(key)\n\t\t}\n\n\t\treturn conversionIdentifiers\n\t}\n\n\twpm.getGoogleAdsRegularOrderItems = function () {\n\t\t// \"id\" : \"gla_34\",\n\t\t// \"quantity\": 1,\n\t\t// \"price\" : 45\n\n\t\tlet orderItems = []\n\n\t\tfor (const [key, item] of Object.entries(wpmDataLayer.order.items)) {\n\n\t\t\tlet orderItem\n\n\t\t\torderItem = {\n\t\t\t\tquantity: item.quantity,\n\t\t\t\tprice : item.price,\n\t\t\t}\n\n\t\t\tif (wpmDataLayer?.general?.variationsOutput && 0 !== item.variation_id) {\n\n\t\t\t\torderItem.id = String(wpmDataLayer.products[item.variation_id].dyn_r_ids[wpmDataLayer.pixels.google.ads.dynamic_remarketing.id_type])\n\t\t\t\torderItems.push(orderItem)\n\t\t\t} else {\n\n\t\t\t\torderItem.id = String(wpmDataLayer.products[item.id].dyn_r_ids[wpmDataLayer.pixels.google.ads.dynamic_remarketing.id_type])\n\t\t\t\torderItems.push(orderItem)\n\t\t\t}\n\t\t}\n\n\t\treturn orderItems\n\t}\n\n\twpm.getGoogleAdsDynamicRemarketingOrderItems = function () {\n\t\t// \"id\" : \"gla_34\",\n\t\t// \"quantity\" : 1,\n\t\t// \"price\" : 45,\n\t\t// \"google_business_vertical\": \"retail\"\n\n\t\tlet orderItems = []\n\n\t\tfor (const [key, item] of Object.entries(wpmDataLayer.order.items)) {\n\n\t\t\tlet orderItem\n\n\t\t\torderItem = {\n\t\t\t\tquantity : item.quantity,\n\t\t\t\tprice : item.price,\n\t\t\t\tgoogle_business_vertical: wpmDataLayer.pixels.google.ads.google_business_vertical,\n\t\t\t}\n\n\t\t\tif (wpmDataLayer?.general?.variationsOutput && 0 !== item.variation_id) {\n\n\t\t\t\torderItem.id = String(wpmDataLayer.products[item.variation_id].dyn_r_ids[wpmDataLayer.pixels.google.ads.dynamic_remarketing.id_type])\n\t\t\t\torderItems.push(orderItem)\n\t\t\t} else {\n\n\t\t\t\torderItem.id = String(wpmDataLayer.products[item.id].dyn_r_ids[wpmDataLayer.pixels.google.ads.dynamic_remarketing.id_type])\n\t\t\t\torderItems.push(orderItem)\n\t\t\t}\n\t\t}\n\n\t\treturn orderItems\n\t}\n\n}(window.wpm = window.wpm || {}, jQuery))\n\n\n/**\n * All event listeners\n * */\n\n// view_item_list event\njQuery(document).on(\"wpmViewItemList\", function (event, product) {\n\n\ttry {\n\t\tif(jQuery.isEmptyObject(wpmDataLayer?.pixels?.google?.ads?.conversionIds)) return\n\t\tif (!wpmDataLayer?.pixels?.google?.ads?.dynamic_remarketing?.status) return\n\t\tif (!wpm.googleConfigConditionsMet(\"ads\")) return\n\n\n\t\tif (\n\t\t\twpmDataLayer?.general?.variationsOutput &&\n\t\t\tproduct.isVariable &&\n\t\t\twpmDataLayer.pixels.google.ads.dynamic_remarketing.send_events_with_parent_ids === false\n\t\t) return\n\n\t\t// try to prevent that WC sends cached hits to Google\n\t\tif (!product) return\n\n\t\twpm.gtagLoaded().then(function () {\n\t\t gtag(\"event\", \"view_item_list\", {\n \t\t\tsend_to: wpm.getGoogleAdsConversionIdentifiers(),\n \t\t\titems : [{\n \t\t\t\tid : product.dyn_r_ids[wpmDataLayer.pixels.google.ads.dynamic_remarketing.id_type],\n \t\t\t\tgoogle_business_vertical: wpmDataLayer.pixels.google.ads.google_business_vertical,\n \t\t\t}],\n \t\t})\n\t\t})\n\t} catch (e) {\n\t\tconsole.error(e)\n\t}\n})\n\n// add_to_cart event\njQuery(document).on(\"wpmAddToCart\", function (event, product) {\n\n\ttry {\n\t\tif(jQuery.isEmptyObject(wpmDataLayer?.pixels?.google?.ads?.conversionIds)) return\n\t\tif (!wpmDataLayer?.pixels?.google?.ads?.dynamic_remarketing?.status) return\n\t\tif (!wpm.googleConfigConditionsMet(\"ads\")) return\n\n\t\twpm.gtagLoaded().then(function () {\n\t\t gtag(\"event\", \"add_to_cart\", {\n \t\t\tsend_to: wpm.getGoogleAdsConversionIdentifiers(),\n \t\t\tvalue : product.quantity * product.price,\n \t\t\titems : [{\n \t\t\t\tid : product.dyn_r_ids[wpmDataLayer.pixels.google.ads.dynamic_remarketing.id_type],\n \t\t\t\tquantity : product.quantity,\n \t\t\t\tprice : product.price,\n \t\t\t\tgoogle_business_vertical: wpmDataLayer.pixels.google.ads.google_business_vertical,\n \t\t\t}],\n \t\t})\n\t\t})\n\t} catch (e) {\n\t\tconsole.error(e)\n\t}\n})\n\n// view_item event\njQuery(document).on(\"wpmViewItem\", function (event, product) {\n\n\ttry {\n\t\tif(jQuery.isEmptyObject(wpmDataLayer?.pixels?.google?.ads?.conversionIds)) return\n\t\tif (!wpmDataLayer?.pixels?.google?.ads?.dynamic_remarketing?.status) return\n\t\tif (!wpm.googleConfigConditionsMet(\"ads\")) return\n\n\n\t\twpm.gtagLoaded().then(function () {\n\t\t gtag(\"event\", \"view_item\", {\n \t\t\tsend_to: wpm.getGoogleAdsConversionIdentifiers(),\n \t\t\tvalue : (product.quantity ? product.quantity : 1) * product.price,\n \t\t\titems : [{\n \t\t\t\tid : product.dyn_r_ids[wpmDataLayer.pixels.google.ads.dynamic_remarketing.id_type],\n \t\t\t\tquantity : (product.quantity ? product.quantity : 1),\n \t\t\t\tprice : product.price,\n \t\t\t\tgoogle_business_vertical: wpmDataLayer.pixels.google.ads.google_business_vertical,\n \t\t\t}],\n \t\t})\n\t\t})\n\t} catch (e) {\n\t\tconsole.error(e)\n\t}\n})\n\n\n// view search event\njQuery(document).on(\"wpmSearch\", function () {\n\n\ttry {\n\t\tif(jQuery.isEmptyObject(wpmDataLayer?.pixels?.google?.ads?.conversionIds)) return\n\t\tif (!wpmDataLayer?.pixels?.google?.ads?.dynamic_remarketing?.status) return\n\t\tif (!wpm.googleConfigConditionsMet(\"ads\")) return\n\n\n\t\tlet products = []\n\n\t\tfor (const [key, product] of Object.entries(wpmDataLayer.products)) {\n\n\t\t\tif (\n\t\t\t\twpmDataLayer?.general?.variationsOutput &&\n\t\t\t\tproduct.isVariable &&\n\t\t\t\twpmDataLayer.pixels.google.ads.dynamic_remarketing.send_events_with_parent_ids === false\n\t\t\t) return\n\n\t\t\tproducts.push({\n\t\t\t\tid : product.dyn_r_ids[wpmDataLayer.pixels.google.ads.dynamic_remarketing.id_type],\n\t\t\t\tgoogle_business_vertical: wpmDataLayer.pixels.google.ads.google_business_vertical,\n\t\t\t})\n\t\t}\n\n\t\t// console.log(products);\n\n\t\twpm.gtagLoaded().then(function () {\n\t\t\tgtag(\"event\", \"view_search_results\", {\n \t\t\tsend_to: wpm.getGoogleAdsConversionIdentifiers(),\n \t\t\t// value : 1 * product.price,\n \t\t\titems: products,\n \t\t})\n\t\t})\n\t} catch (e) {\n\t\tconsole.error(e)\n\t}\n})\n\n\n// view order received page event\n// TODO distinguish with or without cart data active\njQuery(document).on(\"wpmOrderReceivedPage\", function () {\n\n\ttry {\n\t\tif(jQuery.isEmptyObject(wpmDataLayer?.pixels?.google?.ads?.conversionIds)) return\n\t\tif (!wpmDataLayer?.pixels?.google?.ads?.dynamic_remarketing?.status) return\n\t\tif (!wpm.googleConfigConditionsMet(\"ads\")) return\n\n\t\twpm.gtagLoaded().then(function () {\n\t\t gtag(\"event\", \"purchase\", {\n \t\t\tsend_to: wpm.getGoogleAdsConversionIdentifiers(),\n \t\t\tvalue : wpmDataLayer.order.value_filtered,\n \t\t\titems : wpm.getGoogleAdsDynamicRemarketingOrderItems(),\n \t\t})\n\t\t})\n\n\t\t// console.log(wpm.getGoogleAdsDynamicRemarketingOrderItems())\n\t} catch (e) {\n\t\tconsole.error(e)\n\t}\n})\n\n// user log in event\njQuery(document).on(\"wpmLogin\", function () {\n\n\ttry {\n\t\tif(jQuery.isEmptyObject(wpmDataLayer?.pixels?.google?.ads?.conversionIds)) return\n\t\tif (!wpmDataLayer?.pixels?.google?.ads?.dynamic_remarketing?.status) return\n\t\tif (!wpm.googleConfigConditionsMet(\"ads\")) return\n\n\n\t\twpm.gtagLoaded().then(function () {\n\t\t gtag(\"event\", \"login\", {\n \t\t\tsend_to: wpm.getGoogleAdsConversionIdentifiers(),\n \t\t})\n\t\t})\n\t} catch (e) {\n\t\tconsole.error(e)\n\t}\n})\n\n// view order received page event\n// new_customer parameter: https://support.google.com/google-ads/answer/9917012\njQuery(document).on(\"wpmOrderReceivedPage\", function () {\n\n\ttry {\n\t\tif(jQuery.isEmptyObject(wpmDataLayer?.pixels?.google?.ads?.conversionIds)) return\n\t\tif (!wpm.googleConfigConditionsMet(\"ads\")) return\n\n\t\tlet data_basic = {}\n\t\tlet data_with_cart = {}\n\n\t\tdata_basic = {\n\t\t\tsend_to : wpm.getGoogleAdsConversionIdentifiersWithLabel(),\n\t\t\ttransaction_id: wpmDataLayer.order.number,\n\t\t\tvalue : wpmDataLayer.order.value_filtered,\n\t\t\tcurrency : wpmDataLayer.order.currency,\n\t\t\tnew_customer : wpmDataLayer.order.new_customer,\n\t\t}\n\n\t\tif (wpmDataLayer?.order?.aw_merchant_id) {\n\t\t\tdata_with_cart = {\n\t\t\t\tdiscount : wpmDataLayer.order.discount,\n\t\t\t\taw_merchant_id : wpmDataLayer.order.aw_merchant_id,\n\t\t\t\taw_feed_country : wpmDataLayer.order.aw_feed_country,\n\t\t\t\taw_feed_language: wpmDataLayer.order.aw_feed_language,\n\t\t\t\titems : wpm.getGoogleAdsRegularOrderItems(),\n\t\t\t}\n\t\t}\n\n\t\twpm.gtagLoaded().then(function () {\n\t\t\tgtag(\"event\", \"conversion\", {...data_basic, ...data_with_cart})\n\t\t})\n\n\t\t// console.log({...data_basic,...data_with_cart})\n\n\t\t// console.log(wpm.getGoogleAdsOrderItems())\n\t} catch (e) {\n\t\tconsole.error(e)\n\t}\n})\n\n\n\n\n\n","/**\n * Add functions for Google Analytics 4\n * */\n\n(function (wpm, $, undefined) {\n\n\twpm.getGA4OrderItems = function () {\n\n\t\t// \"item_id\" : \"34\",\n\t\t// \"item_name\" : \"Hoodie\",\n\t\t// \"quantity\" : 1,\n\t\t// \"item_brand\" : \"\",\n\t\t// \"item_variant\" : \"Color: blue | Logo: yes\",\n\t\t// \"price\" : 45,\n\t\t// \"currency\" : \"CHF\",\n\t\t// \"item_category\": \"Hoodies\"\n\n\n\t\tlet orderItems = []\n\n\t\tfor (const [key, item] of Object.entries(wpmDataLayer.order.items)) {\n\n\t\t\tlet orderItem\n\n\t\t\torderItem = {\n\t\t\t\tquantity : item.quantity,\n\t\t\t\tprice : item.price,\n\t\t\t\titem_name : item.name,\n\t\t\t\tcurrency : wpmDataLayer.order.currency,\n\t\t\t\titem_category: wpmDataLayer.products[item.id].category.join(\"/\"),\n\t\t\t}\n\n\t\t\tif (wpmDataLayer?.general?.variationsOutput && 0 !== item.variation_id) {\n\n\t\t\t\torderItem.item_id = String(wpmDataLayer.products[item.variation_id].dyn_r_ids[wpmDataLayer.pixels.google.analytics.id_type])\n\t\t\t\torderItem.item_variant = wpmDataLayer.products[item.variation_id].variant_name\n\t\t\t\torderItem.item_brand = wpmDataLayer.products[item.variation_id].brand\n\t\t\t\torderItems.push(orderItem)\n\t\t\t} else {\n\n\t\t\t\torderItem.item_id = String(wpmDataLayer.products[item.id].dyn_r_ids[wpmDataLayer.pixels.google.analytics.id_type])\n\t\t\t\torderItem.item_brand = wpmDataLayer.products[item.id].brand\n\t\t\t\torderItems.push(orderItem)\n\t\t\t}\n\t\t}\n\n\t\treturn orderItems\n\t}\n\n}(window.wpm = window.wpm || {}, jQuery))\n\n\n/**\n * All event listeners\n * */\n\n\n// view order received page event\njQuery(document).on(\"wpmOrderReceivedPage\", function () {\n\n\ttry {\n\t\tif (!wpmDataLayer?.pixels?.google?.analytics?.ga4?.measurement_id) return\n\t\tif (wpmDataLayer?.pixels?.google?.analytics?.ga4?.mp_active) return\n\t\tif (!wpm.googleConfigConditionsMet(\"analytics\")) return\n\n\t\twpm.gtagLoaded().then(function () {\n\t\t gtag(\"event\", \"purchase\", {\n \t\t\tsend_to : [wpmDataLayer.pixels.google.analytics.ga4.measurement_id],\n \t\t\ttransaction_id: wpmDataLayer.order.number,\n \t\t\taffiliation : wpmDataLayer.order.affiliation,\n \t\t\tcurrency : wpmDataLayer.order.currency,\n \t\t\tvalue : wpmDataLayer.order.value_regular,\n \t\t\tdiscount : wpmDataLayer.order.discount,\n \t\t\ttax : wpmDataLayer.order.tax,\n \t\t\tshipping : wpmDataLayer.order.shipping,\n \t\t\tcoupon : wpmDataLayer.order.coupon,\n \t\t\titems : wpm.getGA4OrderItems(),\n \t\t})\n\t\t})\n\t} catch (e) {\n\t\tconsole.error(e)\n\t}\n})\n","/**\n * Add functions for Google Analytics Universal\n * */\n\n(function (wpm, $, undefined) {\n\n\twpm.getGAUAOrderItems = function () {\n\n\t\t// \"id\" : \"34\",\n\t\t// \"name\" : \"Hoodie\",\n\t\t// \"brand\" : \"\",\n\t\t// \"category\" : \"Hoodies\",\n\t\t// \"list_position\": 1,\n\t\t// \"price\" : 45,\n\t\t// \"quantity\" : 1,\n\t\t// \"variant\" : \"Color: blue | Logo: yes\"\n\n\n\t\tlet orderItems = [],\n\t\t\tlist_position = 1\n\n\t\tfor (const [key, item] of Object.entries(wpmDataLayer.order.items)) {\n\n\t\t\tlet orderItem\n\n\t\t\torderItem = {\n\t\t\t\tquantity : item.quantity,\n\t\t\t\tprice : item.price,\n\t\t\t\titem_name : item.name,\n\t\t\t\tcurrency : wpmDataLayer.order.currency,\n\t\t\t\titem_category: wpmDataLayer.products[item.id].category.join(\"/\"),\n\t\t\t\tlist_position: list_position,\n\t\t\t}\n\n\t\t\tif (wpmDataLayer?.general?.variationsOutput && 0 !== item.variation_id) {\n\n\t\t\t\torderItem.id = String(wpmDataLayer.products[item.variation_id].dyn_r_ids[wpmDataLayer.pixels.google.analytics.id_type])\n\t\t\t\torderItem.variant = wpmDataLayer.products[item.variation_id].variant_name\n\t\t\t\torderItem.item_brand = wpmDataLayer.products[item.variation_id].brand\n\t\t\t\torderItems.push(orderItem)\n\t\t\t} else {\n\n\t\t\t\torderItem.id = String(wpmDataLayer.products[item.id].dyn_r_ids[wpmDataLayer.pixels.google.analytics.id_type])\n\t\t\t\torderItem.item_brand = wpmDataLayer.products[item.id].brand\n\t\t\t\torderItems.push(orderItem)\n\t\t\t}\n\n\t\t\tlist_position++\n\t\t}\n\n\t\treturn orderItems\n\t}\n\n}(window.wpm = window.wpm || {}, jQuery))\n\n\n/**\n * All event listeners\n * */\n\n\n// view order received page event\njQuery(document).on(\"wpmOrderReceivedPage\", function () {\n\n\ttry {\n\t\tif (!wpmDataLayer?.pixels?.google?.analytics?.universal?.property_id) return\n\t\tif (wpmDataLayer?.pixels?.google?.analytics?.universal?.mp_active) return\n\t\tif (!wpm.googleConfigConditionsMet(\"analytics\")) return\n\n\t\twpm.gtagLoaded().then(function () {\n\t\t gtag(\"event\", \"purchase\", {\n \t\t\tsend_to : [wpmDataLayer.pixels.google.analytics.universal.property_id],\n \t\t\ttransaction_id: wpmDataLayer.order.number,\n \t\t\taffiliation : wpmDataLayer.order.affiliation,\n \t\t\tcurrency : wpmDataLayer.order.currency,\n \t\t\tvalue : wpmDataLayer.order.value_regular,\n \t\t\tdiscount : wpmDataLayer.order.discount,\n \t\t\ttax : wpmDataLayer.order.tax,\n \t\t\tshipping : wpmDataLayer.order.shipping,\n \t\t\tcoupon : wpmDataLayer.order.coupon,\n \t\t\titems : wpm.getGAUAOrderItems(),\n \t\t})\n\t\t})\n\n\t\t// console.log(wpm.getGAUAOrderItems())\n\t} catch (e) {\n\t\tconsole.error(e)\n\t}\n})\n","(function (wpm, $, undefined) {\n\n\twpm.load_google_optimize_pixel = function () {\n\n\t\ttry {\n\t\t\tif (wpmDataLayer?.pixels?.google?.optimize?.container_id) {\n\n\t\t\t\twpmDataLayer.pixels.google.optimize.loaded = true\n\n\t\t\t\twpm.loadScriptAndCacheIt(\"https://www.googleoptimize.com/optimize.js?id=\" + wpmDataLayer.pixels.google.optimize.container_id)\n\t\t\t\t// .done(function (script, textStatus) {\n\t\t\t\t// \t\tconsole.log('Google Optimize loaded')\n\t\t\t\t// });\n\t\t\t}\n\t\t} catch (e) {\n\t\t\tconsole.error(e)\n\t\t}\n\t}\n\n}(window.wpm = window.wpm || {}, jQuery));\n\n\n(function () {\n\n\tjQuery(document).on(\"wpmLoadPixels\", function () {\n\n\t\tif (wpm.canIFire(\"analytics\", \"google-optimize\") && !wpmDataLayer?.pixels?.google?.optimize?.loaded) wpm.load_google_optimize_pixel()\n\n\t})\n\n})()\n\n\n\n","/**\n * Add functions for Google\n * */\n\n(function (wpm, $, undefined) {\n\n\twpm.googleConfigConditionsMet = function (type) {\n\t\t// always returns true if Google Consent Mode is active\n\t\tif (wpmDataLayer?.pixels?.google?.consent_mode?.active) {\n\t\t\treturn true\n\t\t} else if (wpm.getConsentValues().mode === \"category\") {\n\t\t\treturn wpm.getConsentValues().categories[type] === true\n\t\t} else if (wpm.getConsentValues().mode === \"pixel\") {\n\t\t\treturn wpm.getConsentValues().pixels.includes(\"google-\" + type)\n\t\t} else {\n\t\t\treturn false\n\t\t}\n\t}\n\n\twpm.getVisitorConsentStatusAndUpdateGoogleConsentSettings = function (google_consent_settings) {\n\n\t\tif (wpm.getConsentValues().mode === \"category\") {\n\t\t\tif (wpm.getConsentValues().categories.analytics) google_consent_settings.analytics_storage = \"granted\"\n\t\t\tif (wpm.getConsentValues().categories.ads) google_consent_settings.ad_storage = \"granted\"\n\t\t} else if ((wpm.getConsentValues().mode === \"pixel\")) {\n\t\t\tgoogle_consent_settings.analytics_storage = wpm.getConsentValues().pixels.includes(\"google-analytics\") ? \"granted\" : \"denied\"\n\t\t\tgoogle_consent_settings.ad_storage = wpm.getConsentValues().pixels.includes(\"google-ads\") ? \"granted\" : \"denied\"\n\t\t}\n\n\t\treturn google_consent_settings\n\t}\n\n\twpm.updateGoogleConsentMode = function (analytics = true, ads = true) {\n\n\t\ttry {\n\t\t\tif (\n\t\t\t\t!window.gtag ||\n\t\t\t\t!wpmDataLayer.shop.cookie_consent_mgmt.explicit_consent\n\t\t\t) return\n\n\t\t\tgtag(\"consent\", \"update\", {\n\t\t\t\tanalytics_storage: analytics ? \"granted\" : \"denied\",\n\t\t\t\tad_storage : ads ? \"granted\" : \"denied\",\n\t\t\t})\n\t\t} catch (e) {\n\t\t\tconsole.error(e)\n\t\t}\n\t}\n\n\twpm.fireGtagGoogleAds = function () {\n\t\ttry {\n\t\t\twpmDataLayer.pixels.google.ads.state = \"loading\"\n\n\t\t\tif (wpmDataLayer?.pixels?.google?.ads?.enhanced_conversions?.active) {\n\t\t\t\tfor (const [key, item] of Object.entries(wpmDataLayer.pixels.google.ads.conversionIds)) {\n\t\t\t\t\tgtag(\"config\", key, {\"allow_enhanced_conversions\": true})\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tfor (const [key, item] of Object.entries(wpmDataLayer.pixels.google.ads.conversionIds)) {\n\t\t\t\t\tgtag(\"config\", key)\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (wpmDataLayer?.pixels?.google?.ads?.conversionIds && wpmDataLayer?.pixels?.google?.ads?.phone_conversion_label && wpmDataLayer?.pixels?.google?.ads?.phone_conversion_number) {\n\t\t\t\tgtag(\"config\", Object.keys(wpmDataLayer.pixels.google.ads.conversionIds)[0] + \"/\" + wpmDataLayer.pixels.google.ads.phone_conversion_label, {\n\t\t\t\t\tphone_conversion_number: wpmDataLayer.pixels.google.ads.phone_conversion_number,\n\t\t\t\t})\n\t\t\t}\n\n\t\t\t// ! enhanced_conversion_data needs to be var\n\t\t\t// https://support.google.com/google-ads/answer/9888145#zippy=%2Cvalidate-your-implementation-using-chrome-developer-tools\n\t\t\tif (\"order_received_page\" === wpmDataLayer.shop.page_type && wpmDataLayer?.order?.google?.ads?.enhanced_conversion_data) {\n\t\t\t\twindow.enhanced_conversion_data = wpmDataLayer.order.google.ads.enhanced_conversion_data\n\t\t\t}\n\n\t\t\twpmDataLayer.pixels.google.ads.state = \"ready\"\n\t\t} catch (e) {\n\t\t\tconsole.error(e)\n\t\t}\n\t}\n\n\twpm.fireGtagGoogleAnalyticsUA = function () {\n\t\ttry {\n\t\t\twpmDataLayer.pixels.google.analytics.universal.state = \"loading\"\n\n\t\t\tgtag(\"config\", wpmDataLayer.pixels.google.analytics.universal.property_id, wpmDataLayer.pixels.google.analytics.universal.parameters)\n\t\t\twpmDataLayer.pixels.google.analytics.universal.state = \"ready\"\n\t\t} catch (e) {\n\t\t\tconsole.error(e)\n\t\t}\n\t}\n\n\twpm.fireGtagGoogleAnalyticsGA4 = function () {\n\t\ttry {\n\t\t\twpmDataLayer.pixels.google.analytics.ga4.state = \"loading\"\n\n\t\t\tgtag(\"config\", wpmDataLayer.pixels.google.analytics.ga4.measurement_id, wpmDataLayer.pixels.google.analytics.ga4.parameters)\n\t\t\twpmDataLayer.pixels.google.analytics.ga4.state = \"ready\"\n\t\t} catch (e) {\n\t\t\tconsole.error(e)\n\t\t}\n\t}\n\n\twpm.isGoogleActive = function () {\n\t\tif (\n\t\t\twpmDataLayer?.pixels?.google?.analytics?.universal?.property_id ||\n\t\t\twpmDataLayer?.pixels?.google?.analytics?.ga4?.measurement_id ||\n\t\t\t!jQuery.isEmptyObject(wpmDataLayer?.pixels?.google?.ads?.conversionIds)\n\t\t) {\n\t\t\treturn true\n\t\t} else {\n\t\t\treturn false\n\t\t}\n\t}\n\n\twpm.getGoogleGtagId = function () {\n\t\tif (wpmDataLayer?.pixels?.google?.analytics?.universal?.property_id) {\n\t\t\treturn wpmDataLayer.pixels.google.analytics.universal.property_id\n\t\t} else if (wpmDataLayer?.pixels?.google?.analytics?.ga4?.measurement_id) {\n\t\t\treturn wpmDataLayer.pixels.google.analytics.ga4.measurement_id\n\t\t} else {\n\t\t\treturn Object.keys(wpmDataLayer.pixels.google.ads.conversionIds)[0]\n\t\t}\n\t}\n\n\twpm.loadGoogle = function () {\n\n\t\tif (wpm.isGoogleActive()) {\n\n\t\t\twpmDataLayer.pixels.google.state = \"loading\"\n\n\t\t\twpm.loadScriptAndCacheIt(\"https://www.googletagmanager.com/gtag/js?id=\" + wpm.getGoogleGtagId())\n\t\t\t\t.done(function (script, textStatus) {\n\t\t\t\t\ttry {\n\t\t\t\t\t\t// console.log('Google Optimize loaded')\n\t\t\t\t\t\t// alert('Google Optimize loaded')\n\n\t\t\t\t\t\t// Initiate Google dataLayer and gtag\n\t\t\t\t\t\twindow.dataLayer = window.dataLayer || []\n\t\t\t\t\t\twindow.gtag = function gtag() {\n\t\t\t\t\t\t\tdataLayer.push(arguments)\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t// Google Consent Mode\n\t\t\t\t\t\tif (wpmDataLayer?.pixels?.google?.consent_mode?.active) {\n\n\t\t\t\t\t\t\tlet google_consent_settings = {\n\t\t\t\t\t\t\t\t\"ad_storage\" : wpmDataLayer.pixels.google.consent_mode.ad_storage,\n\t\t\t\t\t\t\t\t\"analytics_storage\": wpmDataLayer.pixels.google.consent_mode.analytics_storage,\n\t\t\t\t\t\t\t\t\"wait_for_update\" : wpmDataLayer.pixels.google.consent_mode.wait_for_update,\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\tif (wpmDataLayer?.pixels?.google?.consent_mode?.region) {\n\t\t\t\t\t\t\t\tgoogle_consent_settings.region = wpmDataLayer.pixels.google.consent_mode.region\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tgoogle_consent_settings = wpm.getVisitorConsentStatusAndUpdateGoogleConsentSettings(google_consent_settings)\n\n\t\t\t\t\t\t\tgtag(\"consent\", \"default\", google_consent_settings)\n\t\t\t\t\t\t\tgtag(\"set\", \"ads_data_redaction\", wpmDataLayer.pixels.google.consent_mode.ads_data_redaction)\n\t\t\t\t\t\t\tgtag(\"set\", \"url_passthrough\", wpmDataLayer.pixels.google.consent_mode.url_passthrough)\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t// Google Linker\n\t\t\t\t\t\t// https://developers.google.com/gtagjs/devguide/linker\n\t\t\t\t\t\tif (wpmDataLayer?.pixels?.google?.linker?.settings) {\n\t\t\t\t\t\t\tgtag(\"set\", \"linker\", wpmDataLayer.pixels.google.linker.settings)\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tgtag(\"js\", new Date())\n\n\t\t\t\t\t\tif (wpm.googleConfigConditionsMet(\"ads\") && !jQuery.isEmptyObject(wpmDataLayer?.pixels?.google?.ads?.conversionIds)) wpm.fireGtagGoogleAds()\n\t\t\t\t\t\tif (wpm.googleConfigConditionsMet(\"analytics\") && wpmDataLayer?.pixels?.google?.analytics?.universal?.property_id) wpm.fireGtagGoogleAnalyticsUA()\n\t\t\t\t\t\tif (wpm.googleConfigConditionsMet(\"analytics\") && wpmDataLayer?.pixels?.google?.analytics?.ga4?.measurement_id) wpm.fireGtagGoogleAnalyticsGA4()\n\n\t\t\t\t\t\twpmDataLayer.pixels.google.state = \"ready\"\n\t\t\t\t\t} catch (e) {\n\t\t\t\t\t\tconsole.error(e)\n\t\t\t\t\t}\n\t\t\t\t})\n\t\t}\n\t}\n\n\twpm.canGoogleLoad = function () {\n\n\t\tif (wpmDataLayer?.pixels?.google?.consent_mode?.active) {\n\t\t\treturn true\n\t\t} else if (\"category\" === wpm.getConsentValues().mode) {\n\t\t\treturn !!(wpm.getConsentValues().categories[\"ads\"] || wpm.getConsentValues().categories[\"analytics\"])\n\t\t} else if (\"pixel\" === wpm.getConsentValues().mode) {\n\t\t\treturn wpm.getConsentValues().pixels.includes(\"google-ads\") || wpm.getConsentValues().pixels.includes(\"google-analytics\")\n\t\t} else {\n\t\t\tconsole.error(\"Couldn't find a valid load condition for Google mode in wpmConsentValues\")\n\t\t\treturn false\n\t\t}\n\t}\n\n\twpm.gtagLoaded = function () {\n\t\treturn new Promise(function (resolve, reject) {\n\n\t\t\tif (typeof wpmDataLayer?.pixels?.google?.state === \"undefined\") reject()\n\n\t\t\tlet startTime = 0\n\t\t\tlet timeout = 5000\n\t\t\tlet frequency = 200;\n\n\t\t\t(function wait() {\n\t\t\t\tif (wpmDataLayer?.pixels?.google?.state === \"ready\") return resolve()\n\t\t\t\tif (startTime >= timeout) return reject()\n\t\t\t\tstartTime += frequency\n\t\t\t\tsetTimeout(wait, frequency)\n\t\t\t})()\n\t\t})\n\t}\n\n\t// wpm.gtagLoadednew = function () {\n\t// \treturn Promise.race([\n\t// \t\t\tnew Promise(function (resolve, reject) {\n\t//\n\t// \t\t\t\tif (typeof wpmDataLayer?.pixels?.google?.state === \"undefined\") reject();\n\t//\n\t//\n\t// \t\t\t\t(function wait() {\n\t// \t\t\t\t\tif (wpmDataLayer?.pixels?.google?.state === \"ready\") return resolve()\n\t// \t\t\t\t\tif (to >= 1000) return reject()\n\t// \t\t\t\t\tsetTimeout(wait, 100)\n\t// \t\t\t\t})()\n\t// \t\t\t}),\n\t// \t\t\tnew Promise(function (resolve, reject) {\n\t// \t\t\t\tsetTimeout(() => reject(), 1000)\n\t// \t\t\t}),\n\t// \t\t],\n\t// \t)\n\t// \t\t// .then((value) => {console.log(\"race then value: \" + value)})\n\t// \t\t.catch(\n\t// \t\t\t(value) => {\n\t// \t\t\t\tconsole.log(\"race catch value: \" + value)\n\t// \t\t\t\treturn Promise.reject()\n\t// \t\t\t})\n\t// }\n\n\n\t// const promise1 = new Promise((resolve, reject) => {\n\t// \tsetTimeout(resolve, 500, \"one\")\n\t// })\n\t//\n\t// const promise2 = new Promise((resolve, reject) => {\n\t// \tsetTimeout(reject, 100, \"two\")\n\t// })\n\t//\n\t// let onlyRunIfResolves = function () {\n\t// \treturn Promise.race([promise1, promise2])\n\t// \t\t.catch(() => {\n\t// \t\t})\n\t// }\n\t//\n\t// onlyRunIfResolves()\n\t// \t.then(() => {\n\t// \t\tconsole.log(\"running function\")\n\t// \t})\n\n\n}(window.wpm = window.wpm || {}, jQuery));\n\n\n(function () {\n\n\tjQuery(document).on(\"wpmLoadPixels\", function () {\n\n\t\tif (\n\t\t\twpm.canGoogleLoad() &&\n\t\t\t(typeof wpmDataLayer?.pixels?.google?.state === \"undefined\")\n\t\t) {\n\t\t\twpm.loadGoogle()\n\t\t}\n\t})\n\n\t// return wpmDataLayer?.pixels?.google?.state === \"undefined\";\n\n})()\n","(function (wpm, $, undefined) {\n\n\twpm.load_hotjar_pixel = function () {\n\n\t\tif (wpmDataLayer?.pixels?.hotjar?.site_id) {\n\n\t\t\t// console.log('hotjar loaded');\n\n\t\t\twpmDataLayer.pixels.hotjar.loaded = true;\n\n\t\t\t// @formatter:off\n\t\t\t(function(h,o,t,j,a,r){\n\t\t\t\th.hj=h.hj||function(){(h.hj.q=h.hj.q||[]).push(arguments)};\n\t\t\t\th._hjSettings={hjid:wpmDataLayer.pixels.hotjar.site_id,hjsv:6};\n\t\t\t\ta=o.getElementsByTagName('head')[0];\n\t\t\t\tr=o.createElement('script');r.async=1;\n\t\t\t\tr.src=t+h._hjSettings.hjid+j+h._hjSettings.hjsv;\n\t\t\t\ta.appendChild(r);\n\t\t\t})(window,document,'https://static.hotjar.com/c/hotjar-','.js?sv=');\n\t\t\t// @formatter:on\n\n\t\t}\n\t}\n\n}(window.wpm = window.wpm || {}, jQuery));\n\n\n(function () {\n\n\tjQuery(document).on(\"wpmLoadPixels\", function () {\n\n\t\tif (wpm.canIFire(\"analytics\", \"hotjar\") && !wpmDataLayer?.pixels?.hotjar?.loaded) wpm.load_hotjar_pixel()\n\n\t})\n\n})()\n\n\n\n","/**\n * After wpm is loaded\n * we first check if wpmDataLayer is loaded,\n * and as soon as it is, we load the pixels,\n * and as soon as the page load is complete,\n * we fire the wpmLoad event.\n */\nwpm.wpmDataLayerExists()\n\t.then(function () {\n\t\tjQuery(document).trigger(\"wpmPreLoadPixels\", {})\n\t})\n\t.then(function () {\n\t\twpm.pageLoaded().then(function () {\n\t\t\tjQuery(document).trigger(\"wpmLoad\", {})\n\t\t})\n\t})\n\n","/**\n * Create a wpm namespace under which all functions are declared\n */\n\n// https://stackoverflow.com/a/5947280/4688612\n(function (wpm, $, undefined) {\n\n\tconst wpmDeduper = {\n\t\tkeyName : \"_wpm_order_ids\",\n\t\tcookieExpiresDays: 365,\n\t}\n\n\tconst wpmRestSettings = {\n\t\t// cookiesAvailable : '_wpm_cookies_are_available',\n\t\tcookieWpmRestEndpointAvailable: \"_wpm_endpoint_available\",\n\t\trestEndpoint : \"/wp-json/\",\n\t\trestFails : 0,\n\t\trestFailsThreshold : 10,\n\t}\n\n\twpm.emailSelected = false\n\twpm.paymentMethodSelected = false\n\n\t// wpm.checkIfCookiesAvailable = function () {\n\t//\n\t// // read the cookie if previously set, if it is return true, otherwise continue\n\t// if (wpm.getCookie(wpmRestSettings.cookiesAvailable)) {\n\t// return true;\n\t// }\n\t//\n\t// // set the cookie for the session\n\t// Cookies.set(wpmRestSettings.cookiesAvailable, true);\n\t//\n\t// // read cookie, true if ok, false if not ok\n\t// return !!wpm.getCookie(wpmRestSettings.cookiesAvailable);\n\t// }\n\n\twpm.useRestEndpoint = function () {\n\n\t\t// only if sessionStorage is available\n\n\t\t// only if REST API endpoint is generally accessible\n\t\t// check in sessionStorage if we checked before and return answer\n\t\t// otherwise check if the endpoint is available, save answer in sessionStorage and return answer\n\n\t\t// only if not too many REST API errors happened\n\n\t\treturn wpm.isSessionStorageAvailable() &&\n\t\t\twpm.isRestEndpointAvailable() &&\n\t\t\twpm.isBelowRestErrorThreshold()\n\t}\n\n\twpm.isBelowRestErrorThreshold = function () {\n\t\treturn window.sessionStorage.getItem(wpmRestSettings.restFails) <= wpmRestSettings.restFailsThreshold\n\t}\n\n\twpm.isRestEndpointAvailable = function () {\n\n\t\tif (window.sessionStorage.getItem(wpmRestSettings.cookieWpmRestEndpointAvailable)) {\n\t\t\treturn JSON.parse(window.sessionStorage.getItem(wpmRestSettings.cookieWpmRestEndpointAvailable))\n\t\t} else {\n\t\t\t// return wpm.testEndpoint();\n\t\t\t// just set the value whenever possible in order not to wait or block the main thread\n\t\t\twpm.testEndpoint()\n\t\t}\n\t}\n\n\twpm.isSessionStorageAvailable = function () {\n\n\t\treturn !!window.sessionStorage\n\t}\n\n\twpm.testEndpoint = function (\n\t\turl = location.protocol + \"//\" + location.host + wpmRestSettings.restEndpoint,\n\t\tcookieName = wpmRestSettings.cookieWpmRestEndpointAvailable,\n\t) {\n\t\t// console.log('testing endpoint');\n\n\t\tjQuery.ajax(url, {\n\t\t\ttype : \"HEAD\",\n\t\t\ttimeout: 1000,\n\t\t\t// async: false,\n\t\t\tstatusCode: {\n\t\t\t\t200: function (response) {\n\t\t\t\t\t// Cookies.set(cookieName, true);\n\t\t\t\t\t// console.log('endpoint works');\n\t\t\t\t\twindow.sessionStorage.setItem(cookieName, JSON.stringify(true))\n\t\t\t\t},\n\t\t\t\t404: function (response) {\n\t\t\t\t\t// Cookies.set(cookieName, false);\n\t\t\t\t\t// console.log('endpoint doesn\\'t work');\n\t\t\t\t\twindow.sessionStorage.setItem(cookieName, JSON.stringify(false))\n\t\t\t\t},\n\t\t\t\t0 : function (response) {\n\t\t\t\t\t// Cookies.set(cookieName, false);\n\t\t\t\t\t// console.log('endpoint doesn\\'t work');\n\t\t\t\t\twindow.sessionStorage.setItem(cookieName, JSON.stringify(false))\n\t\t\t\t},\n\t\t\t},\n\t\t}).then(r => {\n\t\t\t// console.log('test done')\n\t\t\t// console.log('result: ' + JSON.parse(window.sessionStorage.getItem(cookieName)));\n\t\t\t// return JSON.parse(window.sessionStorage.getItem(cookieName));\n\t\t})\n\t}\n\n\twpm.isWpmRestEndpointAvailable = function (cookieName = wpmRestSettings.cookieWpmRestEndpointAvailable) {\n\n\t\treturn !!wpm.getCookie(cookieName)\n\t}\n\n\twpm.writeOrderIdToStorage = function (orderId, expireDays = 365) {\n\n\t\t// save the order ID in the browser storage\n\n\t\tif (!window.Storage) {\n\t\t\tlet expiresDate = new Date()\n\t\t\texpiresDate.setDate(expiresDate.getDate() + wpmDeduper.cookieExpiresDays)\n\n\t\t\tlet ids = []\n\t\t\tif (checkCookie()) {\n\t\t\t\tids = JSON.parse(wpm.getCookie(wpmDeduper.keyName))\n\t\t\t}\n\n\t\t\tif (!ids.includes(orderId)) {\n\t\t\t\tids.push(orderId)\n\t\t\t\tdocument.cookie = wpmDeduper.keyName + \"=\" + JSON.stringify(ids) + \";expires=\" + expiresDate.toUTCString()\n\t\t\t}\n\n\t\t} else {\n\t\t\tif (localStorage.getItem(wpmDeduper.keyName) === null) {\n\t\t\t\tlet ids = []\n\t\t\t\tids.push(orderId)\n\t\t\t\twindow.localStorage.setItem(wpmDeduper.keyName, JSON.stringify(ids))\n\n\t\t\t} else {\n\t\t\t\tlet ids = JSON.parse(localStorage.getItem(wpmDeduper.keyName))\n\t\t\t\tif (!ids.includes(orderId)) {\n\t\t\t\t\tids.push(orderId)\n\t\t\t\t\twindow.localStorage.setItem(wpmDeduper.keyName, JSON.stringify(ids))\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tif (typeof wpm.storeOrderIdOnServer === \"function\" && wpmDataLayer.orderDeduplication) {\n\t\t\twpm.storeOrderIdOnServer(orderId)\n\t\t}\n\t}\n\n\tfunction checkCookie() {\n\t\tlet key = wpm.getCookie(wpmDeduper.keyName)\n\t\treturn key !== \"\"\n\t}\n\n\twpm.isOrderIdStored = function (orderId) {\n\n\t\t// console.log('deduper: ' + wpmDataLayer.orderDeduplication);\n\t\tif (wpmDataLayer.orderDeduplication) {\n\t\t\t// console.log('order deduplication: on');\n\t\t\tif (!window.Storage) {\n\n\t\t\t\tif (checkCookie()) {\n\t\t\t\t\tlet ids = JSON.parse(wpm.getCookie(wpmDeduper.keyName))\n\t\t\t\t\treturn ids.includes(orderId)\n\t\t\t\t} else {\n\t\t\t\t\treturn false\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tif (localStorage.getItem(wpmDeduper.keyName) !== null) {\n\t\t\t\t\tlet ids = JSON.parse(localStorage.getItem(wpmDeduper.keyName))\n\t\t\t\t\treturn ids.includes(orderId)\n\t\t\t\t} else {\n\t\t\t\t\treturn false\n\t\t\t\t}\n\t\t\t}\n\t\t} else {\n\t\t\tconsole.log(\"order duplication prevention: off\")\n\t\t\treturn false\n\t\t}\n\t}\n\n\twpm.isEmail = function (email) {\n\t\t// https://emailregex.com/\n\t\tlet regex = /^(([^<>()\\[\\]\\\\.,;:\\s@\"]+(\\.[^<>()\\[\\]\\\\.,;:\\s@\"]+)*)|(\".+\"))@((\\[[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}])|(([a-zA-Z\\-0-9]+\\.)+[a-zA-Z]{2,}))$/\n\t\treturn regex.test(email)\n\t}\n\n\twpm.removeProductFromCart = function (productId, quantityToRemove = null) {\n\t\t// console.log('product_id: ' + productId + ' | quantityToRemove: ' + quantityToRemove);\n\n\t\ttry {\n\n\t\t\tif (!productId) throw Error(\"Wasn't able to retrieve a productId\")\n\n\t\t\tproductId = getIdBasedOndVariationsOutputSetting(productId)\n\n\t\t\tif (!productId) throw Error(\"Wasn't able to retrieve a productId\")\n\n\t\t\tlet quantity\n\n\t\t\tif (quantityToRemove == null) {\n\t\t\t\tquantity = wpmDataLayer.cart[productId].quantity\n\t\t\t} else {\n\t\t\t\tquantity = quantityToRemove\n\t\t\t}\n\n\t\t\t// console.log('product_id: ' + productId + ' | qty: ' + quantity);\n\t\t\t// console.log(productId);\n\t\t\t// console.log(wpmDataLayer.cart);\n\t\t\t// console.log(wpmDataLayer.cart[productId]);\n\n\t\t\tif (wpmDataLayer.cart[productId]) {\n\n\t\t\t\t// let product = {\n\t\t\t\t// id : productId.toString(),\n\t\t\t\t// dyn_r_ids: wpmDataLayer.cart[productId].dyn_r_ids,\n\t\t\t\t// name : wpmDataLayer.cart[productId].name,\n\t\t\t\t// // list_name: wpmDataLayer.shop.list_name, // doesn't make sense on mini_cart\n\t\t\t\t// brand : wpmDataLayer.cart[productId].brand,\n\t\t\t\t// category: wpmDataLayer.cart[productId].category,\n\t\t\t\t// variant : wpmDataLayer.cart[productId].variant,\n\t\t\t\t// // list_position: wpmDataLayer.cart[productId].position, // doesn't make sense on mini_cart\n\t\t\t\t// quantity : quantity,\n\t\t\t\t// price : wpmDataLayer.cart[productId].price,\n\t\t\t\t// isVariation: wpmDataLayer.products[productId].isVariation,\n\t\t\t\t// };\n\t\t\t\t//\n\t\t\t\t// if (product.isVariation) product['parentId_dyn_r_ids'] = wpmDataLayer.products[productId].parentId_dyn_r_ids;\n\n\t\t\t\tlet product = wpm.getProductDetailsFormattedForEvent(productId, quantity)\n\n\t\t\t\t// console.log('removing');\n\t\t\t\t// console.log(data);\n\n\t\t\t\tjQuery(document).trigger(\"wpmRemoveFromCart\", product)\n\n\t\t\t\tif (quantityToRemove == null || wpmDataLayer.cart[productId].quantity === quantityToRemove) {\n\t\t\t\t\tdelete wpmDataLayer.cart[productId]\n\t\t\t\t\tif (sessionStorage) sessionStorage.setItem(\"wpmDataLayerCart\", JSON.stringify(wpmDataLayer.cart))\n\t\t\t\t} else {\n\t\t\t\t\twpmDataLayer.cart[productId].quantity = wpmDataLayer.cart[productId].quantity - quantity\n\t\t\t\t\tif (sessionStorage) sessionStorage.setItem(\"wpmDataLayerCart\", JSON.stringify(wpmDataLayer.cart))\n\t\t\t\t}\n\t\t\t}\n\t\t} catch (e) {\n\t\t\tconsole.error(e)\n\t\t\t// console.log('getting cart from back end');\n\t\t\t// wpm.getCartItemsFromBackend();\n\t\t\t// console.log('getting cart from back end done');\n\n\t\t}\n\t}\n\n\tgetIdBasedOndVariationsOutputSetting = function (productId) {\n\n\t\ttry {\n\t\t\tif (wpmDataLayer?.general?.variationsOutput) {\n\t\t\t\t// console.log('test');\n\t\t\t\treturn productId\n\t\t\t} else {\n\t\t\t\tif (wpmDataLayer.products[productId].isVariation) {\n\t\t\t\t\treturn wpmDataLayer.products[productId].parentId\n\t\t\t\t} else {\n\t\t\t\t\treturn productId\n\t\t\t\t}\n\t\t\t}\n\t\t} catch (e) {\n\t\t\tconsole.error(e)\n\t\t}\n\t}\n\n\t// add_to_cart\n\twpm.addProductToCart = function (productId, quantity) {\n\n\t\ttry {\n\t\t\t// console.log('productId: ' + productId + ' | qty: ' + quantity);\n\t\t\t// console.log('productId: ' + productId + ' | variationId: ' + variationId + ' | qty: ' + quantity);\n\n\t\t\tif (!productId) throw Error(\"Wasn't able to retrieve a productId\")\n\n\t\t\tproductId = getIdBasedOndVariationsOutputSetting(productId)\n\n\t\t\tif (!productId) throw Error(\"Wasn't able to retrieve a productId\")\n\n\t\t\tif (wpmDataLayer.products[productId]) {\n\n\t\t\t\tlet product = wpm.getProductDetailsFormattedForEvent(productId, quantity)\n\n\t\t\t\t// console.log(productId);\n\n\t\t\t\tjQuery(document).trigger(\"wpmAddToCart\", product)\n\n\t\t\t\t// add product to cart wpmDataLayer['cart']\n\n\t\t\t\t// if the product already exists in the object, only add the additional quantity\n\t\t\t\t// otherwise create that product object in the wpmDataLayer['cart']\n\t\t\t\tif (wpmDataLayer.cart !== undefined && wpmDataLayer.cart[productId] !== undefined) {\n\t\t\t\t\twpmDataLayer.cart[productId].quantity = wpmDataLayer.cart[productId].quantity + quantity\n\t\t\t\t\tif (sessionStorage) sessionStorage.setItem(\"wpmDataLayerCart\", JSON.stringify(wpmDataLayer.cart))\n\t\t\t\t} else {\n\n\t\t\t\t\tif (!wpmDataLayer.cart) {\n\n\t\t\t\t\t\t// wpmDataLayer['cart'] = {\n\t\t\t\t\t\t// [productId]: {\n\t\t\t\t\t\t// id : productId,\n\t\t\t\t\t\t// dyn_r_ids : wpmDataLayer.products[productId].dyn_r_ids,\n\t\t\t\t\t\t// name : wpmDataLayer.products[productId].name,\n\t\t\t\t\t\t// brand : wpmDataLayer.products[productId].brand,\n\t\t\t\t\t\t// category : wpmDataLayer.products[productId].category,\n\t\t\t\t\t\t// variant : wpmDataLayer.products[productId].variant,\n\t\t\t\t\t\t// quantity : quantity,\n\t\t\t\t\t\t// price : wpmDataLayer.products[productId].price,\n\t\t\t\t\t\t// isVariation: wpmDataLayer.products[productId].isVariation,\n\t\t\t\t\t\t// parentId : wpmDataLayer.products[productId].parentId,\n\t\t\t\t\t\t// }\n\t\t\t\t\t\t// };\n\t\t\t\t\t\t//\n\t\t\t\t\t\t// if (wpmDataLayer['cart'][productId].isVariation) wpmDataLayer['cart'][productId]['parentId_dyn_r_ids'] = wpmDataLayer.products[productId].parentId_dyn_r_ids;\n\n\t\t\t\t\t\twpmDataLayer[\"cart\"] = {\n\t\t\t\t\t\t\t[productId]: wpm.getProductDetailsFormattedForEvent(productId, quantity),\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tif (sessionStorage) sessionStorage.setItem(\"wpmDataLayerCart\", JSON.stringify(wpmDataLayer.cart))\n\t\t\t\t\t} else {\n\n\t\t\t\t\t\t// wpmDataLayer.cart[productId] = {\n\t\t\t\t\t\t// id : productId,\n\t\t\t\t\t\t// dyn_r_ids : wpmDataLayer.products[productId].dyn_r_ids,\n\t\t\t\t\t\t// name : wpmDataLayer.products[productId].name,\n\t\t\t\t\t\t// brand : wpmDataLayer.products[productId].brand,\n\t\t\t\t\t\t// category : wpmDataLayer.products[productId].category,\n\t\t\t\t\t\t// variant : wpmDataLayer.products[productId].variant,\n\t\t\t\t\t\t// quantity : quantity,\n\t\t\t\t\t\t// price : wpmDataLayer.products[productId].price,\n\t\t\t\t\t\t// isVariation: wpmDataLayer.products[productId].isVariation,\n\t\t\t\t\t\t// parentId : wpmDataLayer.products[productId].parentId,\n\t\t\t\t\t\t// };\n\t\t\t\t\t\t//\n\t\t\t\t\t\t// if (wpmDataLayer.cart[productId].isVariation) wpmDataLayer.cart[productId]['parentId_dyn_r_ids'] = wpmDataLayer.products[productId].parentId_dyn_r_ids;\n\n\t\t\t\t\t\twpmDataLayer.cart[productId] = wpm.getProductDetailsFormattedForEvent(productId, quantity)\n\n\t\t\t\t\t\tif (sessionStorage) sessionStorage.setItem(\"wpmDataLayerCart\", JSON.stringify(wpmDataLayer.cart))\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t} catch (e) {\n\t\t\tconsole.error(e)\n\n\t\t\t// fallback if wpmDataLayer.cart and wpmDataLayer.products got out of sync in case cart caching has an issue\n\t\t\twpm.getCartItemsFromBackend()\n\t\t}\n\t}\n\n\twpm.getCartItems = function () {\n\n\t\t// console.log('get cart items');\n\n\t\tif (sessionStorage) {\n\t\t\tif (!sessionStorage.getItem(\"wpmDataLayerCart\") || wpmDataLayer.shop.page_type === \"order_received_page\") {\n\t\t\t\tsessionStorage.setItem(\"wpmDataLayerCart\", JSON.stringify({}))\n\t\t\t} else {\n\t\t\t\twpm.saveCartObjectToDataLayer(JSON.parse(sessionStorage.getItem(\"wpmDataLayerCart\")))\n\t\t\t}\n\t\t} else {\n\t\t\twpm.getCartItemsFromBackend()\n\t\t}\n\t}\n\n\twpm.getCartItemsFromBackend = function () {\n\t\t// get all cart items from the backend\n\t\ttry {\n\t\t\tlet data = {\n\t\t\t\taction: \"wpm_get_cart_items\",\n\t\t\t}\n\n\t\t\tjQuery.ajax(\n\t\t\t\t{\n\t\t\t\t\ttype : \"get\",\n\t\t\t\t\tdataType: \"json\",\n\t\t\t\t\t// url : ajax_object.ajax_url,\n\t\t\t\t\turl : wpm.ajax_url,\n\t\t\t\t\tdata : data,\n\t\t\t\t\tsuccess: function (cartItems) {\n\n\t\t\t\t\t\t// save all cart items into wpmDataLayer\n\n\t\t\t\t\t\tif (!cartItems[\"cart\"]) cartItems[\"cart\"] = {}\n\n\t\t\t\t\t\twpm.saveCartObjectToDataLayer(cartItems[\"cart\"])\n\t\t\t\t\t\tif (sessionStorage) sessionStorage.setItem(\"wpmDataLayerCart\", JSON.stringify(cartItems[\"cart\"]))\n\t\t\t\t\t},\n\t\t\t\t})\n\t\t} catch (e) {\n\t\t\tconsole.error(e)\n\t\t}\n\t}\n\n\twpm.getProductsFromBackend = function (productIds) {\n\t\t// console.log('getting pids from back-end: ' + productIds)\n\t\t// get productIds from the backend\n\n\t\t// reduce productIds by products already in the dataLayer\n\t\tproductIds = productIds.filter(item => !wpmDataLayer.products.hasOwnProperty(item))\n\n\t\t// if no products IDs are in the object, don't try to get anything from the server\n\t\tif (!productIds || productIds.length === 0) return\n\n\t\ttry {\n\t\t\tlet data = {\n\t\t\t\taction : \"wpm_get_product_ids\",\n\t\t\t\tproductIds: productIds,\n\t\t\t}\n\n\t\t\tjQuery.ajax(\n\t\t\t\t{\n\t\t\t\t\ttype : \"get\",\n\t\t\t\t\tdataType: \"json\",\n\t\t\t\t\t// url : ajax_object.ajax_url,\n\t\t\t\t\turl : wpm.ajax_url,\n\t\t\t\t\tdata : data,\n\t\t\t\t\tsuccess: function (products) {\n\n\t\t\t\t\t\t// merge products into wpmDataLayer.products\n\t\t\t\t\t\twpmDataLayer.products = Object.assign({}, wpmDataLayer.products, products)\n\t\t\t\t\t},\n\t\t\t\t\terror : function (response) {\n\t\t\t\t\t\tconsole.log(response)\n\t\t\t\t\t},\n\t\t\t\t})\n\t\t} catch (e) {\n\t\t\tconsole.error(e)\n\t\t}\n\t}\n\n\twpm.saveCartObjectToDataLayer = function (cartObject) {\n\t\twpmDataLayer.cart = cartObject\n\t\twpmDataLayer.products = Object.assign({}, wpmDataLayer.products, cartObject)\n\t}\n\n\twpm.fireCheckoutOption = function (step, checkout_option = null, value = null) {\n\n\t\tlet data = {\n\t\t\tstep : step,\n\t\t\tcheckout_option: checkout_option,\n\t\t\tvalue : value,\n\t\t}\n\n\t\tjQuery(document).trigger(\"wpmFireCheckoutOption\", data)\n\t}\n\n\twpm.fireCheckoutProgress = function (step) {\n\n\t\tlet data = {\n\t\t\tstep: step,\n\t\t}\n\n\t\tjQuery(document).trigger(\"wpmFireCheckoutProgress\", data)\n\t}\n\n\twpm.getPostIdFromString = function (string) {\n\t\t// console.log(string);\n\t\ttry {\n\t\t\treturn string.match(/(post-)(\\d+)/)[2]\n\t\t} catch (e) {\n\t\t\tconsole.error(e)\n\t\t}\n\t}\n\n\twpm.triggerViewItemList = function (productId) {\n\n\t\t// productId = null;\n\n\t\tif (!productId) throw Error(\"Wasn't able to retrieve a productId\")\n\n\t\tproductId = getIdBasedOndVariationsOutputSetting(productId)\n\n\t\tif (!productId) throw Error(\"Wasn't able to retrieve a productId\")\n\n\t\tjQuery(document).trigger(\"wpmViewItemList\", wpm.getProductDataForViewItemEvent(productId))\n\t}\n\n\twpm.getProductDataForViewItemEvent = function (productId) {\n\n\t\tif (!productId) throw Error(\"Wasn't able to retrieve a productId\")\n\n\t\ttry {\n\t\t\tif (wpmDataLayer.products[productId]) {\n\n\t\t\t\treturn wpm.getProductDetailsFormattedForEvent(productId)\n\t\t\t}\n\t\t} catch (e) {\n\t\t\tconsole.error(e)\n\t\t}\n\t}\n\twpm.getMainProductIdFromProductPage = function () {\n\t\ttry {\n\t\t\tif ([\"simple\", \"variable\", \"grouped\", \"composite\", \"bundle\"].indexOf(wpmDataLayer.shop.product_type) >= 0) {\n\t\t\t\treturn jQuery(\".wpmProductId:first\").data(\"id\")\n\t\t\t} else {\n\t\t\t\treturn false\n\t\t\t}\n\t\t} catch (e) {\n\t\t\tconsole.error(e)\n\t\t}\n\t}\n\n\twpm.viewItemListTriggerTestMode = function (target) {\n\n\t\tjQuery(target).css({\"position\": \"relative\"})\n\t\tjQuery(target).append(\"<div id=\\\"viewItemListTriggerOverlay\\\"></div>\")\n\t\tjQuery(target).find(\"#viewItemListTriggerOverlay\").css({\n\t\t\t\"z-index\" : \"10\",\n\t\t\t\"display\" : \"block\",\n\t\t\t\"position\" : \"absolute\",\n\t\t\t\"height\" : \"100%\",\n\t\t\t\"top\" : \"0\",\n\t\t\t\"left\" : \"0\",\n\t\t\t\"right\" : \"0\",\n\t\t\t\"opacity\" : wpmDataLayer.viewItemListTrigger.opacity,\n\t\t\t\"background-color\": wpmDataLayer.viewItemListTrigger.backgroundColor,\n\t\t})\n\t}\n\n\twpm.getSearchTermFromUrl = function () {\n\t\ttry {\n\t\t\tlet urlParameters = new URLSearchParams(window.location.search)\n\t\t\treturn urlParameters.get(\"s\")\n\t\t} catch (e) {\n\t\t\tconsole.error(e)\n\t\t}\n\t}\n\n\t// we need this to track timeouts for intersection observers\n\tlet ioTimeouts = {}\n\n\twpm.observerCallback = function (entries, observer) {\n\n\t\tentries.forEach((entry) => {\n\n\t\t\ttry {\n\t\t\t\tlet productId\n\n\t\t\t\tlet elementId = jQuery(entry.target).data(\"ioid\")\n\n\t\t\t\t// Get the productId from next element, if wpmProductId is a sibling, like in Gutenberg blocks\n\t\t\t\t// otherwise go search in children, like in regular WC loop items\n\t\t\t\tif (jQuery(entry.target).next(\".wpmProductId\").length) {\n\t\t\t\t\t// console.log('test 1');\n\t\t\t\t\tproductId = jQuery(entry.target).next(\".wpmProductId\").data(\"id\")\n\t\t\t\t} else {\n\t\t\t\t\tproductId = jQuery(entry.target).find(\".wpmProductId\").data(\"id\")\n\t\t\t\t}\n\n\t\t\t\t// productId = null;\n\n\t\t\t\tif (!productId) throw Error(\"wpmProductId element not found\")\n\n\t\t\t\tif (entry.isIntersecting) {\n\n\t\t\t\t\t// console.log('prodid: ' + productId);\n\t\t\t\t\tioTimeouts[elementId] = setTimeout(() => {\n\t\t\t\t\t\t// console.log('prodid: ' + productId);\n\t\t\t\t\t\twpm.triggerViewItemList(productId)\n\t\t\t\t\t\tif (wpmDataLayer.viewItemListTrigger.testMode) wpm.viewItemListTriggerTestMode(entry.target)\n\t\t\t\t\t\tif (wpmDataLayer.viewItemListTrigger.repeat === false) observer.unobserve(entry.target)\n\t\t\t\t\t}, wpmDataLayer.viewItemListTrigger.timeout)\n\n\t\t\t\t} else {\n\n\t\t\t\t\tclearTimeout(ioTimeouts[elementId])\n\t\t\t\t\tif (wpmDataLayer.viewItemListTrigger.testMode) jQuery(entry.target).find(\"#viewItemListTriggerOverlay\").remove()\n\t\t\t\t}\n\t\t\t} catch (e) {\n\t\t\t\tconsole.error(e)\n\t\t\t}\n\t\t})\n\t}\n\n\t// fire view_item_list only on products that have become visible\n\tlet io\n\tlet ioid = 0\n\tlet allIoElementsToWatch\n\n\tlet getAllElementsToWatch = function () {\n\n\t\tallIoElementsToWatch = jQuery(\".wpmProductId\")\n\t\t\t.map(function (i, elem) {\n\t\t\t\t// console.log(elem);\n\t\t\t\tif (\n\t\t\t\t\tjQuery(elem).parent().hasClass(\"type-product\") ||\n\t\t\t\t\tjQuery(elem).parent().hasClass(\"product\") ||\n\t\t\t\t\tjQuery(elem).parent().hasClass(\"product-item-inner\")\n\t\t\t\t) {\n\t\t\t\t\t// console.log(elem);\n\t\t\t\t\treturn jQuery(elem).parent()\n\t\t\t\t} else if (\n\t\t\t\t\tjQuery(elem).prev().hasClass(\"wc-block-grid__product\") ||\n\t\t\t\t\tjQuery(elem).prev().hasClass(\"product\") ||\n\t\t\t\t\tjQuery(elem).prev().hasClass(\"product-small\") ||\n\t\t\t\t\tjQuery(elem).prev().hasClass(\"woocommerce-LoopProduct-link\")\n\t\t\t\t) {\n\t\t\t\t\treturn jQuery(this).prev()\n\t\t\t\t} else if (jQuery(elem).closest(\".product\").length) {\n\t\t\t\t\treturn jQuery(elem).closest(\".product\")\n\t\t\t\t}\n\t\t\t})\n\t}\n\n\twpm.startIntersectionObserverToWatch = function () {\n\n\t\ttry {\n\t\t\t// enable view_item_list test mode from browser\n\t\t\tlet urlParams = new URLSearchParams(window.location.search)\n\t\t\tif (urlParams.has(\"vildemomode\")) wpmDataLayer.viewItemListTrigger.testMode = true\n\n\t\t\t// set up intersection observer\n\t\t\tio = new IntersectionObserver(wpm.observerCallback, {\n\t\t\t\tthreshold: wpmDataLayer.viewItemListTrigger.threshold,\n\t\t\t})\n\n\t\t\tgetAllElementsToWatch()\n\n\t\t\t// console.log(allElementsToWatch);\n\n\t\t\tallIoElementsToWatch.each(function (i, elem) {\n\t\t\t\t// console.log(elem[0]);\n\t\t\t\t// jQuery(elem[0]).attr('data-ioid', ioid++);\n\t\t\t\tjQuery(elem[0]).data(\"ioid\", ioid++)\n\n\t\t\t\tio.observe(elem[0])\n\t\t\t})\n\t\t} catch (e) {\n\t\t\tconsole.error(e)\n\t\t}\n\t}\n\n\t// watch DOM for new lazy loaded products and add them to the intersection observer\n\twpm.startProductsMutationObserverToWatch = function () {\n\n\t\ttry {\n\t\t\t// Pass in the target node, as well as the observer options\n\n\t\t\t// selects the most common parent node\n\t\t\t// https://stackoverflow.com/a/7648323/4688612\n\t\t\tlet productsNode = jQuery(\".wpmProductId:eq(0)\").parents().has(jQuery(\".wpmProductId:eq(1)\").parents()).first()\n\n\t\t\tif (productsNode.length) {\n\t\t\t\tproductsMutationObserver.observe(productsNode[0], {\n\t\t\t\t\tattributes : true,\n\t\t\t\t\tchildList : true,\n\t\t\t\t\tcharacterData: true,\n\t\t\t\t})\n\t\t\t}\n\t\t} catch (e) {\n\t\t\tconsole.error(e)\n\t\t}\n\t}\n\n\t// Create an observer instance\n\tlet productsMutationObserver = new MutationObserver(function (mutations) {\n\n\t\tmutations.forEach(function (mutation) {\n\t\t\tlet newNodes = mutation.addedNodes // DOM NodeList\n\t\t\tif (newNodes !== null) { // If there are new nodes added\n\t\t\t\tlet nodes = jQuery(newNodes) // jQuery set\n\t\t\t\tnodes.each(function () {\n\t\t\t\t\tif (\n\t\t\t\t\t\tjQuery(this).hasClass(\"type-product\") ||\n\t\t\t\t\t\tjQuery(this).hasClass(\"product-small\") ||\n\t\t\t\t\t\tjQuery(this).hasClass(\"wc-block-grid__product\")\n\t\t\t\t\t) {\n\t\t\t\t\t\t// check if the node has a child or sibling wpmProductId\n\t\t\t\t\t\t// if yes add it to the intersectionObserver\n\t\t\t\t\t\tif (hasWpmProductIdElement(this)) {\n\t\t\t\t\t\t\tjQuery(this).data(\"ioid\", ioid++)\n\t\t\t\t\t\t\tio.observe(this)\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t})\n\t\t\t}\n\t\t})\n\t})\n\n\tlet hasWpmProductIdElement = function (elem) {\n\t\treturn !!(jQuery(elem).find(\".wpmProductId\").length ||\n\t\t\tjQuery(elem).siblings(\".wpmProductId\").length)\n\t}\n\n\twpm.setCookie = function (cookieName, cookieValue = \"\", expiryDays = null) {\n\t\tif (expiryDays) {\n\t\t\tlet d = new Date()\n\t\t\td.setTime(d.getTime() + (expiryDays * 24 * 60 * 60 * 1000))\n\t\t\tlet expires = \"expires=\" + d.toUTCString()\n\t\t\tdocument.cookie = cookieName + \"=\" + cookieValue + \";\" + expires + \";path=/\"\n\t\t} else {\n\t\t\tdocument.cookie = cookieName + \"=\" + cookieValue + \";path=/\"\n\t\t}\n\t}\n\n\twpm.getCookie = function (cookieName) {\n\t\tlet name = cookieName + \"=\"\n\t\tlet decodedCookie = decodeURIComponent(document.cookie)\n\t\tlet ca = decodedCookie.split(\";\")\n\t\tfor (let i = 0; i < ca.length; i++) {\n\t\t\tlet c = ca[i]\n\t\t\twhile (c.charAt(0) == \" \") {\n\t\t\t\tc = c.substring(1)\n\t\t\t}\n\t\t\tif (c.indexOf(name) == 0) {\n\t\t\t\treturn c.substring(name.length, c.length)\n\t\t\t}\n\t\t}\n\t\treturn \"\"\n\t}\n\n\twpm.getWpmSessionData = function () {\n\t\tif (window.sessionStorage) {\n\n\t\t\tlet data = window.sessionStorage.getItem(\"_wpm\")\n\t\t\tif (data !== null) {\n\t\t\t\treturn JSON.parse(data)\n\t\t\t} else {\n\t\t\t\treturn {}\n\t\t\t}\n\t\t} else {\n\t\t\treturn {}\n\t\t}\n\t}\n\n\twpm.setWpmSessionData = function (data) {\n\t\tif (window.sessionStorage) {\n\t\t\twindow.sessionStorage.setItem(\"_wpm\", JSON.stringify(data))\n\t\t}\n\t}\n\n\twpm.storeOrderIdOnServer = function (orderId) {\n\n\t\t// console.log('saving wpm_purchase_pixels_fired');\n\n\t\t// console.log('url: ' + wpm_premium_only_ajax_object.ajax_url);\n\t\t// console.log('nonce: ' + wpm_premium_only_ajax_object.nonce);\n\t\t// console.log('url: ' + wpm.ajax_url);\n\t\t// console.log('nonce: ' + wpm.nonce);\n\n\t\ttry {\n\t\t\t// save the state in the database\n\t\t\tlet data = {\n\t\t\t\taction : \"wpm_purchase_pixels_fired\",\n\t\t\t\torder_id: orderId,\n\t\t\t\t// nonce : ajax_object.nonce,\n\t\t\t\tnonce: wpm.nonce,\n\t\t\t}\n\n\t\t\tjQuery.ajax(\n\t\t\t\t{\n\t\t\t\t\ttype : \"post\",\n\t\t\t\t\tdataType: \"json\",\n\t\t\t\t\t// url : ajax_object.ajax_url,\n\t\t\t\t\turl : wpm.ajax_url,\n\t\t\t\t\tdata : data,\n\t\t\t\t\tsuccess: function (response) {\n\t\t\t\t\t\tif (response.success === false) {\n\t\t\t\t\t\t\tconsole.log(response)\n\t\t\t\t\t\t}\n\t\t\t\t\t},\n\t\t\t\t\terror : function (response) {\n\t\t\t\t\t\tconsole.log(response)\n\t\t\t\t\t},\n\t\t\t\t})\n\t\t} catch (e) {\n\t\t\tconsole.error(e)\n\t\t}\n\t}\n\n\twpm.getProductIdByCartItemKeyUrl = function (url) {\n\t\tlet searchParams = new URLSearchParams(url.search)\n\t\tlet cartItemKey = searchParams.get(\"remove_item\")\n\n\t\tlet productId = null\n\n\t\tif (wpmDataLayer.cartItemKeys[cartItemKey][\"variation_id\"] === 0) {\n\t\t\tproductId = wpmDataLayer.cartItemKeys[cartItemKey][\"product_id\"]\n\t\t} else {\n\t\t\tproductId = wpmDataLayer.cartItemKeys[cartItemKey][\"variation_id\"]\n\t\t}\n\n\t\treturn productId\n\t}\n\n\twpm.getAddToCartLinkProductIds = function () {\n\t\treturn jQuery(\"a\").map(function () {\n\t\t\tlet href = jQuery(this).attr(\"href\")\n\n\t\t\tif (href && href.includes(\"?add-to-cart=\")) {\n\t\t\t\tlet matches = href.match(/(add-to-cart=)(\\d+)/)\n\t\t\t\tif (matches) return matches[2]\n\t\t\t}\n\t\t}).get()\n\t}\n\n\twpm.getProductDetailsFormattedForEvent = function (productId, quantity = 1) {\n\n\t\t// console.log(wpmDataLayer.products[productId].dyn_r_ids)\n\n\t\tlet product = {\n\t\t\tid : productId.toString(),\n\t\t\tdyn_r_ids : wpmDataLayer.products[productId].dyn_r_ids,\n\t\t\tname : wpmDataLayer.products[productId].name,\n\t\t\tlist_name : wpmDataLayer.shop.list_name,\n\t\t\tbrand : wpmDataLayer.products[productId].brand,\n\t\t\tcategory : wpmDataLayer.products[productId].category,\n\t\t\tvariant : wpmDataLayer.products[productId].variant,\n\t\t\tlist_position: wpmDataLayer.products[productId].position,\n\t\t\tquantity : quantity,\n\t\t\tprice : wpmDataLayer.products[productId].price,\n\t\t\tcurrency : wpmDataLayer.shop.currency,\n\t\t\tisVariable : wpmDataLayer.products[productId].isVariable,\n\t\t\tisVariation : wpmDataLayer.products[productId].isVariation,\n\t\t\tparentId : wpmDataLayer.products[productId].parentId,\n\t\t}\n\n\t\tif (product.isVariation) product[\"parentId_dyn_r_ids\"] = wpmDataLayer.products[productId].parentId_dyn_r_ids\n\n\t\treturn product\n\t}\n\n\twpm.setReferrerToCookie = function () {\n\t\t// can't use session storage as we can't read it from the server\n\t\tif (!wpm.getCookie(\"wpmReferrer\")) {\n\t\t\twpm.setCookie(\"wpmReferrer\", document.referrer)\n\t\t}\n\t}\n\n\twpm.getReferrerFromCookie = function () {\n\t\tif (wpm.getCookie(\"wpmReferrer\")) {\n\t\t\treturn wpm.getCookie(\"wpmReferrer\")\n\t\t} else {\n\t\t\treturn null\n\t\t}\n\t}\n\n\twpm.getClidFromBrowser = function (clidId = \"gclid\") {\n\n\t\tlet clidCookieId\n\n\t\tclidCookieId = {\n\t\t\tgclid: \"_gcl_aw\",\n\t\t\tdclid: \"_gcl_dc\",\n\t\t}\n\n\t\tif (wpm.getCookie(clidCookieId[clidId])) {\n\t\t\tlet clidCookie = wpm.getCookie(clidCookieId[clidId])\n\t\t\tlet matches = clidCookie.match(/(GCL.[\\d]*.)(.*)/)\n\t\t\treturn matches[2]\n\t\t} else {\n\t\t\treturn \"\"\n\t\t}\n\t}\n\n\twpm.getUserAgent = function () {\n\t\treturn navigator.userAgent\n\t}\n\n\twpm.getViewPort = function () {\n\t\treturn {\n\t\t\twidth : Math.max(document.documentElement.clientWidth || 0, window.innerWidth || 0),\n\t\t\theight: Math.max(document.documentElement.clientHeight || 0, window.innerHeight || 0),\n\t\t}\n\t}\n\n\t/*\n\t* Handle Cookie Management Platforms\n\t* */\n\n\tlet getComplianzCookies = function () {\n\n\t\tlet cmplz_statistics = wpm.getCookie(\"cmplz_statistics\")\n\t\tlet cmplz_marketing = wpm.getCookie(\"cmplz_marketing\")\n\t\tlet cmplz_consent_status = wpm.getCookie(\"cmplz_consent_status\") || wpm.getCookie(\"cmplz_banner-status\")\n\n\n\t\tif (cmplz_consent_status) {\n\t\t\treturn {\n\t\t\t\tanalytics : cmplz_statistics === \"allow\",\n\t\t\t\tads : cmplz_marketing === \"allow\",\n\t\t\t\tvisitorHasChosen: true,\n\t\t\t}\n\t\t} else {\n\t\t\treturn false\n\t\t}\n\t}\n\n\tlet getCookieLawInfoCookies = function () {\n\n\t\tlet analyticsCookie = wpm.getCookie(\"cookielawinfo-checkbox-analytics\")\n\t\tlet adsCookie = wpm.getCookie(\"cookielawinfo-checkbox-advertisement\")\n\t\tlet visitorHasChosen = wpm.getCookie(\"CookieLawInfoConsent\")\n\n\t\tif (analyticsCookie || adsCookie) {\n\n\t\t\treturn {\n\t\t\t\tanalytics : analyticsCookie === \"yes\",\n\t\t\t\tads : adsCookie === \"yes\",\n\t\t\t\tvisitorHasChosen: !!visitorHasChosen,\n\t\t\t}\n\t\t} else {\n\t\t\treturn false\n\t\t}\n\t}\n\n\n\tlet\n\t\twpmConsentValues = {}\n\twpmConsentValues.categories = {}\n\twpmConsentValues.pixels = []\n\twpmConsentValues.mode = \"category\"\n\twpmConsentValues.visitorHasChosen = false\n\n\twpm.getConsentValues = function () {\n\t\treturn wpmConsentValues\n\t}\n\n\twpm.setConsentValueCategories = function (analytics = false, ads = false) {\n\t\twpmConsentValues.categories.analytics = analytics\n\t\twpmConsentValues.categories.ads = ads\n\t}\n\n\twpm.updateConsentCookieValues = function (explicitConsent = false) {\n\n\t\t// ad_storage\n\t\t// analytics_storage\n\t\t// functionality_storage\n\t\t// personalization_storage\n\t\t// security_storage\n\n\t\t// console.log('exp cons: ' + explicitConsent)\n\n\t\tlet cookie\n\n\t\tif (cookie = wpm.getCookie(\"CookieConsent\")) {\n\t\t\t// Cookiebot\n\t\t\t// https://wordpress.org/plugins/cookiebot/\n\t\t\tcookie = decodeURI(cookie)\n\n\t\t\t// console.log(cookie.indexOf('statistics:true'))\n\t\t\t// console.log(cookie.indexOf('marketing:true'))\n\n\t\t\twpmConsentValues.categories.analytics = cookie.indexOf(\"statistics:true\") >= 0\n\t\t\twpmConsentValues.categories.ads = cookie.indexOf(\"marketing:true\") >= 0\n\t\t\twpmConsentValues.visitorHasChosen = true\n\n\t\t} else if (cookie = wpm.getCookie(\"CookieScriptConsent\")) {\n\t\t\t// Cookie Script\n\t\t\t// https://wordpress.org/plugins/cookie-script-com/\n\n\t\t\tcookie = JSON.parse(cookie)\n\n\t\t\t// console.log(cookie)\n\t\t\t// console.log(cookie.action)\n\t\t\t// console.log('cat length: ' + cookie.categories.length)\n\t\t\t// console.log(cookie.categories.indexOf('performance'))\n\n\t\t\tif (cookie.action === \"reject\") {\n\t\t\t\twpmConsentValues.categories.analytics = false\n\t\t\t\twpmConsentValues.categories.ads = false\n\t\t\t} else if (cookie.categories.length === 2) {\n\t\t\t\twpmConsentValues.categories.analytics = true\n\t\t\t\twpmConsentValues.categories.ads = true\n\t\t\t} else {\n\t\t\t\twpmConsentValues.categories.analytics = cookie.categories.indexOf(\"performance\") >= 0\n\t\t\t\twpmConsentValues.categories.ads = cookie.categories.indexOf(\"targeting\") >= 0\n\t\t\t}\n\n\t\t\twpmConsentValues.visitorHasChosen = true\n\n\t\t\t// console.log(wpmConsentValues)\n\n\t\t} else if (cookie = wpm.getCookie(\"borlabs-cookie\")) {\n\t\t\t// Borlabs Cookie\n\t\t\t// https://borlabs.io/borlabs-cookie/\n\n\t\t\tcookie = decodeURI(cookie)\n\t\t\tcookie = JSON.parse(cookie)\n\n\t\t\twpmConsentValues.categories.analytics = !!cookie?.consents?.statistics\n\t\t\twpmConsentValues.categories.ads = !!cookie?.consents?.marketing\n\t\t\twpmConsentValues.visitorHasChosen = true\n\t\t\twpmConsentValues.pixels = [...cookie?.consents?.statistics || [], ...cookie?.consents?.marketing || []]\n\t\t\twpmConsentValues.mode = \"pixel\"\n\n\t\t} else if (cookie = getComplianzCookies()) {\n\t\t\t// Complianz Cookie\n\t\t\t// https://wordpress.org/plugins/complianz-gdpr/\n\n\t\t\t// console.log(cookie)\n\n\t\t\twpmConsentValues.categories.analytics = cookie.analytics === true\n\t\t\twpmConsentValues.categories.ads = cookie.ads === true\n\t\t\twpmConsentValues.visitorHasChosen = cookie.visitorHasChosen\n\n\t\t\t// console.log(wpmConsentValues)\n\n\t\t} else if (cookie = wpm.getCookie(\"cookie_notice_accepted\")) {\n\t\t\t// Cookie Compliance (free version)\n\t\t\t// https://wordpress.org/plugins/cookie-notice/\n\n\t\t\twpmConsentValues.categories.analytics = true\n\t\t\twpmConsentValues.categories.ads = true\n\t\t\twpmConsentValues.visitorHasChosen = true\n\n\t\t} else if (cookie = wpm.getCookie(\"hu-consent\")) {\n\t\t\t// Cookie Compliance (pro version)\n\t\t\t// https://wordpress.org/plugins/cookie-notice/\n\n\t\t\tcookie = JSON.parse(cookie)\n\n\t\t\twpmConsentValues.categories.analytics = !!cookie.categories[\"3\"]\n\t\t\twpmConsentValues.categories.ads = !!cookie.categories[\"4\"]\n\t\t\twpmConsentValues.visitorHasChosen = true\n\n\t\t} else if (cookie = getCookieLawInfoCookies()) {\n\t\t\t// CookieYes, GDPR Cookie Consent (Cookie Law Info)\n\t\t\t// https://wordpress.org/plugins/cookie-law-info/\n\n\t\t\twpmConsentValues.categories.analytics = cookie.analytics === true\n\t\t\twpmConsentValues.categories.ads = cookie.ads === true\n\t\t\twpmConsentValues.visitorHasChosen = cookie.visitorHasChosen === true\n\n\t\t} else if (cookie = wpm.getCookie(\"moove_gdpr_popup\")) {\n\t\t\t// GDPR Cookie Compliance Plugin by Moove Agency\n\t\t\t// https://wordpress.org/plugins/gdpr-cookie-compliance/\n\t\t\t// TODO write documentation on how to set up the plugin in order for this to work properly\n\n\t\t\tcookie = JSON.parse(cookie)\n\t\t\t// console.log('moove cookie thirdparty: ' + cookie.thirdparty)\n\t\t\t// console.log('moove cookie advanced: ' + cookie.advanced)\n\n\t\t\twpmConsentValues.categories.analytics = cookie.thirdparty === \"1\"\n\t\t\twpmConsentValues.categories.ads = cookie.advanced === \"1\"\n\t\t\twpmConsentValues.visitorHasChosen = true\n\n\t\t\t// console.log(wpmConsentValues)\n\n\t\t} else {\n\t\t\t// consentValues.categories.analytics = true\n\t\t\t// consentValues.categories.ads = true\n\n\t\t\twpmConsentValues.categories.analytics = !explicitConsent\n\t\t\twpmConsentValues.categories.ads = !explicitConsent\n\t\t}\n\t}\n\n\twpm.updateConsentCookieValues()\n\n\twpm.setConsentDefaultValuesToExplicit = function () {\n\t\twpmConsentValues.categories = {\n\t\t\tanalytics: false,\n\t\t\tads : false,\n\t\t}\n\t}\n\n\twpm.canIFire = function (category, pixelName) {\n\n\t\tif (\"category\" === wpmConsentValues.mode) {\n\t\t\treturn !!wpmConsentValues.categories[category]\n\t\t} else if (\"pixel\" === wpmConsentValues.mode) {\n\t\t\treturn wpmConsentValues.pixels.includes(pixelName)\n\t\t} else {\n\t\t\tconsole.error(\"Couldn't find a valid consent mode in wpmConsentValues\")\n\t\t\treturn false\n\t\t}\n\t}\n\n\t/**\n\t * Runs through each script in <head> and blocks / unblocks it according to the plugin settings\n\t * and user consent.\n\t */\n\n\t// https://stackoverflow.com/q/65453565/4688612\n\twpm.scriptTagObserver = new MutationObserver((mutations) => {\n\t\tmutations.forEach(({addedNodes}) => {\n\t\t\t[...addedNodes]\n\t\t\t\t.forEach(node => {\n\n\t\t\t\t\tif ($(node).data(\"wpm-cookie-category\")) {\n\n\t\t\t\t\t\t// console.log(node)\n\n\t\t\t\t\t\t// If the pixel category has been approved > unblock\n\t\t\t\t\t\t// If the pixel belongs to more than one category, then unblock if one of the categories has been approved\n\t\t\t\t\t\t// If no category has been approved, but the Google Consent Mode is active, then only unblock the Google scripts\n\n\t\t\t\t\t\tif (wpm.shouldScriptBeActive(node)) {\n\t\t\t\t\t\t\twpm.unblockScript(node)\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\twpm.blockScript(node)\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t})\n\t\t})\n\t})\n\n\twpm.scriptTagObserver.observe(document.head, {childList: true, subtree: true})\n\twindow.addEventListener(\"DOMContentLoaded\", () => wpm.scriptTagObserver.disconnect())\n\n\twpm.shouldScriptBeActive = function (node) {\n\n\t\tif (\n\t\t\twpmDataLayer.shop.cookie_consent_mgmt.explicit_consent ||\n\t\t\twpmConsentValues.visitorHasChosen\n\t\t) {\n\n\t\t\tif (wpmConsentValues.mode === \"category\" && $(node).data(\"wpm-cookie-category\").split(\",\").some(element => wpmConsentValues.categories[element])) {\n\t\t\t\treturn true\n\t\t\t} else if (wpmConsentValues.mode === \"pixel\" && wpmConsentValues.pixels.includes($(node).data(\"wpm-pixel-name\"))) {\n\t\t\t\treturn true\n\t\t\t} else if (wpmConsentValues.mode === \"pixel\" && $(node).data(\"wpm-pixel-name\") === \"google\" && [\"google-analytics\", \"google-ads\"].some(element => wpmConsentValues.pixels.includes(element))) {\n\t\t\t\treturn true\n\t\t\t} else if (wpmDataLayer?.pixels?.google?.consent_mode?.active && $(node).data(\"wpm-pixel-name\") === \"google\") {\n\t\t\t\treturn true\n\t\t\t} else {\n\t\t\t\treturn false\n\t\t\t}\n\t\t} else {\n\t\t\treturn true\n\t\t}\n\t}\n\n\n\twpm.unblockScript = function (scriptNode, removeAttach = false) {\n\n\t\tif (removeAttach) $(scriptNode).remove()\n\n\t\tlet wpmSrc = $(scriptNode).data(\"wpm-src\")\n\t\tif (wpmSrc) $(scriptNode).attr(\"src\", wpmSrc)\n\n\t\tscriptNode.type = \"text/javascript\"\n\n\t\tif (removeAttach) $(scriptNode).appendTo(\"head\")\n\n\t\tjQuery(document).trigger(\"wpmPreLoadPixels\", {})\n\t}\n\n\twpm.blockScript = function (scriptNode, removeAttach = false) {\n\n\t\tif (removeAttach) $(scriptNode).remove()\n\n\t\tif ($(scriptNode).attr(\"src\")) $(scriptNode).removeAttr(\"src\")\n\t\tscriptNode.type = \"blocked/javascript\"\n\n\t\tif (removeAttach) $(scriptNode).appendTo(\"head\")\n\t}\n\n\twpm.unblockAllScripts = function (analytics = true, ads = true) {\n\t\t// console.log('unblocking all scripts')\n\n\t\t$.each(\n\t\t\t$(\"script[type=\\\"blocked/javascript\\\"]\"), function (index, scriptNode) {\n\n\t\t\t\tif ($(scriptNode).data(\"wpm-cookie-category\").includes(\"analytics\") && analytics) {\n\t\t\t\t\twpm.unblockScript(scriptNode, true)\n\t\t\t\t} else if ($(scriptNode).data(\"wpm-cookie-category\").includes(\"ads\") && ads) {\n\t\t\t\t\twpm.unblockScript(scriptNode, true)\n\t\t\t\t}\n\t\t\t})\n\n\t\tjQuery(document).trigger(\"wpmPreLoadPixels\", {})\n\t}\n\n\twpm.unblockSelectedPixels = function () {\n\t\t$.each(\n\t\t\t$(\"script[type=\\\"blocked/javascript\\\"]\"), function (index, node) {\n\n\t\t\t\tif (wpmConsentValues.pixels.includes($(node).data(\"wpm-pixel-name\"))) {\n\t\t\t\t\twpm.unblockScript(node, true)\n\t\t\t\t} else if ($(node).data(\"wpm-pixel-name\") === \"google\" && [\"google-analytics\", \"google-ads\"].some(element => wpmConsentValues.pixels.includes(element))) {\n\t\t\t\t\twpm.unblockScript(node, true)\n\t\t\t\t}\n\t\t\t})\n\n\t\tjQuery(document).trigger(\"wpmPreLoadPixels\", {})\n\t}\n\n\n\t/**\n\t * Block or unblock scripts for each CMP immediately after cookie consent has been updated\n\t * by the visitor.\n\t */\n\n\t// Borlabs Cookie\n\t// If visitor accepts cookies in Borlabs Cookie unblock the scripts\n\twindow.addEventListener(\"borlabs-cookie-consent-saved\", function (e) {\n\n\t\twpm.updateConsentCookieValues()\n\n\t\tif (wpmConsentValues.mode === \"pixel\") {\n\n\t\t\twpm.unblockSelectedPixels()\n\t\t\twpm.updateGoogleConsentMode(wpmConsentValues.pixels.includes(\"google-analytics\"), wpmConsentValues.pixels.includes(\"google-ads\"))\n\t\t} else {\n\n\t\t\twpm.unblockAllScripts(wpmConsentValues.categories.analytics, wpmConsentValues.categories.ads)\n\t\t\twpm.updateGoogleConsentMode(wpmConsentValues.categories.analytics, wpmConsentValues.categories.ads)\n\t\t}\n\t})\n\n\t// Cookiebot\n\t// If visitor accepts cookies in Cookiebot unblock the scripts\n\t// https://www.cookiebot.com/en/developer/\n\twindow.addEventListener(\"CookiebotOnAccept\", function (e) {\n\t\tif (Cookiebot.consent.statistics) wpmConsentValues.categories.analytics = true\n\t\tif (Cookiebot.consent.marketing) wpmConsentValues.categories.ads = true\n\n\t\twpm.unblockAllScripts(wpmConsentValues.categories.analytics, wpmConsentValues.categories.ads)\n\t\twpm.updateGoogleConsentMode(wpmConsentValues.categories.analytics, wpmConsentValues.categories.ads)\n\n\t}, false)\n\n\t/**\n\t * Cookie Script\n\t * If visitor accepts cookies in Cookie Script unblock the scripts\n\t * https://support.cookie-script.com/article/20-custom-events\n\t */\n\twindow.addEventListener(\"CookieScriptAccept\", function (e) {\n\t\tif (e.detail.categories.includes(\"performance\")) wpmConsentValues.categories.analytics = true\n\t\tif (e.detail.categories.includes(\"targeting\")) wpmConsentValues.categories.ads = true\n\n\t\twpm.unblockAllScripts(wpmConsentValues.categories.analytics, wpmConsentValues.categories.ads)\n\t\twpm.updateGoogleConsentMode(wpmConsentValues.categories.analytics, wpmConsentValues.categories.ads)\n\t})\n\n\t/**\n\t * Cookie Script\n\t * If visitor accepts cookies in Cookie Script unblock the scripts\n\t * https://support.cookie-script.com/\n\t */\n\twindow.addEventListener(\"CookieScriptAcceptAll\", function (e) {\n\t\twpm.unblockAllScripts(true, true)\n\t\twpm.updateGoogleConsentMode(true, true)\n\t})\n\n\t// Complianz Cookie\n\t// If visitor accepts cookies in Complianz unblock the scripts\n\tdocument.addEventListener(\"cmplzStatusChange\", function (e) {\n\n\t\twpm.updateConsentCookieValues()\n\n\t\t// console.log(wpmConsentValues)\n\n\t\twpm.unblockAllScripts(wpmConsentValues.categories.analytics, wpmConsentValues.categories.ads)\n\t\twpm.updateGoogleConsentMode(wpmConsentValues.categories.analytics, wpmConsentValues.categories.ads)\n\t})\n\n\t// Cookie Compliance by hu-manity.co (free and pro)\n\t// If visitor accepts cookies in Cookie Notice by hu-manity.co unblock the scripts (free version)\n\t// https://wordpress.org/support/topic/events-on-consent-change/#post-15202792\n\tdocument.addEventListener(\"setCookieNotice\", function (e) {\n\n\t\twpm.updateConsentCookieValues()\n\n\t\t// console.log(wpmConsentValues)\n\n\t\twpm.unblockAllScripts(wpmConsentValues.categories.analytics, wpmConsentValues.categories.ads)\n\t\twpm.updateGoogleConsentMode(wpmConsentValues.categories.analytics, wpmConsentValues.categories.ads)\n\t})\n\n\t/**\n\t * Cookie Compliance by hu-manity.co (free and pro)\n\t * If visitor accepts cookies in Cookie Notice by hu-manity.co unblock the scripts (pro version)\n\t * https://wordpress.org/support/topic/events-on-consent-change/#post-15202792\n\t * Because Cookie Notice has no documented API or event that is being triggered on consent save or update\n\t * we have to solve this by using a mutation observer.\n\t *\n\t * @type {MutationObserver}\n\t */\n\n\twpm.huObserver = new MutationObserver(function (mutations) {\n\t\tmutations.forEach(({addedNodes}) => {\n\t\t\t[...addedNodes]\n\t\t\t\t.forEach(node => {\n\n\t\t\t\t\tif (node.id === \"hu\") {\n\n\t\t\t\t\t\tjQuery(\".hu-cookies-save\").on(\"click\", function (e) {\n\t\t\t\t\t\t\twpm.updateConsentCookieValues()\n\t\t\t\t\t\t\twpm.unblockAllScripts(wpmConsentValues.categories.analytics, wpmConsentValues.categories.ads)\n\t\t\t\t\t\t\twpm.updateGoogleConsentMode(wpmConsentValues.categories.analytics, wpmConsentValues.categories.ads)\n\t\t\t\t\t\t})\n\t\t\t\t\t}\n\t\t\t\t})\n\t\t})\n\t})\n\n\tif (window.hu) {\n\t\twpm.huObserver.observe(document.documentElement || document.body, {childList: true, subtree: true})\n\t}\n\n\twpm.version = function () {\n\t\tconsole.log(wpmDataLayer.version)\n\t}\n\n\t// https://api.jquery.com/jquery.getscript/\n\twpm.loadScriptAndCacheIt = function (url, options) {\n\n\t\t// Allow user to set any option except for dataType, cache, and url\n\t\toptions = jQuery.extend(options || {}, {\n\t\t\tdataType: \"script\",\n\t\t\tcache : true,\n\t\t\turl : url,\n\t\t})\n\n\t\t// Use $.ajax() since it is more flexible than $.getScript\n\t\t// Return the jqXHR object so we can chain callbacks\n\t\treturn jQuery.ajax(options)\n\t}\n\n\twpm.getOrderItemPrice = function (orderItem) {\n\t\treturn (orderItem.total + orderItem.total_tax) / orderItem.quantity\n\t}\n\n\twpm.hasLoginEventFired = function () {\n\t\tlet data = wpm.getWpmSessionData()\n\t\treturn data?.loginEventFired\n\t}\n\n\twpm.setLoginEventFired = function () {\n\t\tlet data = wpm.getWpmSessionData()\n\t\tdata[\"loginEventFired\"] = true\n\t\twpm.setWpmSessionData(data)\n\t}\n\n\twpm.wpmDataLayerExists = function () {\n\t\treturn new Promise(function (resolve) {\n\t\t\t(function waitForVar() {\n\t\t\t\tif (typeof wpmDataLayer !== \"undefined\") return resolve()\n\t\t\t\tsetTimeout(waitForVar, 50)\n\t\t\t})()\n\t\t})\n\t}\n\n\twpm.pageLoaded = function () {\n\t\treturn new Promise(function (resolve) {\n\t\t\t(function waitForVar() {\n\t\t\t\tif (\"complete\" === document.readyState) return resolve()\n\t\t\t\tsetTimeout(waitForVar, 50)\n\t\t\t})()\n\t\t})\n\t}\n\n\t// wpm['load'] = {\n\t// base: true\n\t// };\n\n\twindow[\"wpmLoaded\"] = {}\n\n\t// return {\n\t// writeOrderIdToStorage : writeOrderIdToStorage,\n\t// isOrderIdStored : isOrderIdStored,\n\t// isEmail : isEmail,\n\t// removeProductFromCart : removeProductFromCart,\n\t// getViewItemProducts : getViewItemProducts,\n\t// addProductToCart : addProductToCart,\n\t// getCartItemsFromBackEnd: getCartItemsFromBackEnd,\n\t// fireCheckoutOption : fireCheckoutOption,\n\t// getCartItems : getCartItems\n\t// }\n\n}(window.wpm = window.wpm || {}, jQuery))\n\n/**\n * Run as soon as wpm namespace is loaded\n */\n\n// run when window ready\njQuery(function () {\n// jQuery(window).on('load', function () {\n\n\twpm.wpmDataLayerExists()\n\t\t.then(function () {\n\t\t\t// watch for products visible in viewport\n\t\t\twpm.startIntersectionObserverToWatch()\n\n\t\t\t// watch for lazy loaded products\n\t\t\twpm.startProductsMutationObserverToWatch()\n\t\t})\n\n\t// let products = jQuery(\".products, .product\")\n})\n\n\n/**\n * All event listeners\n * */\n\n// remove_from_cart event\n// body.on('click', '.remove_from_cart_button, .remove', function (e) {\njQuery(document).on(\"click\", \".remove_from_cart_button, .remove\", function (e) {\n\t// jQuery('.remove_from_cart_button, .remove').on('click', function (e) {\n\n\ttry {\n\t\t// console.log('remove_from_cart: ' + jQuery(this).data('product_id'));\n\n\t\tlet url = new URL(jQuery(this).attr(\"href\"))\n\t\tlet productId = wpm.getProductIdByCartItemKeyUrl(url)\n\n\t\twpm.removeProductFromCart(productId)\n\n\t} catch (e) {\n\t\tconsole.error(e)\n\t}\n})\n\n\n// add_to_cart event\n// body.on('click', '.add_to_cart_button:not(.product_type_variable), .ajax_add_to_cart, .single_add_to_cart_button', function (e) {\njQuery(document).on(\"click\", \".add_to_cart_button:not(.product_type_variable), .ajax_add_to_cart, .single_add_to_cart_button\", function (e) {\n\t// jQuery('.add_to_cart_button:not(.product_type_variable), .ajax_add_to_cart, .js-ajax-add-to-cart, .single_add_to_cart_button, .btn_color-2').on('click', function (e) {\n\n\ttry {\n\t\t// console.log('add_to_cart');\n\n\t\tif (wpmDataLayer.shop.page_type === \"product\") {\n\n\t\t\t// first process related and upsell products\n\t\t\tif (typeof jQuery(this).attr(\"href\") !== \"undefined\" && jQuery(this).attr(\"href\").includes(\"add-to-cart\")) {\n\t\t\t\t// console.log('add-to-cart on upsell and related products');\n\t\t\t\tlet quantity = 1\n\t\t\t\tlet productId = jQuery(this).data(\"product_id\")\n\t\t\t\t// console.log('productId: ' + productId);\n\t\t\t\twpm.addProductToCart(productId, quantity)\n\t\t\t} else {\n\n\t\t\t\tif (wpmDataLayer.shop.product_type === \"simple\") {\n\n\t\t\t\t\t// console.log('test');\n\t\t\t\t\tlet quantity = Number(jQuery(\".input-text.qty\").val())\n\n\t\t\t\t\tif (!quantity && quantity !== 0) quantity = 1\n\n\t\t\t\t\tlet productId = jQuery(this).val()\n\n\t\t\t\t\t// console.log('productId: ' + productId);\n\t\t\t\t\t// console.log('quantity: ' + quantity);\n\n\t\t\t\t\twpm.addProductToCart(productId, quantity)\n\n\t\t\t\t} else if (wpmDataLayer.shop.product_type === \"variable\") {\n\n\t\t\t\t\t// console.log('variable');\n\n\t\t\t\t\tlet quantity = Number(jQuery(\".input-text.qty\").val())\n\n\t\t\t\t\tif (!quantity && quantity !== 0) quantity = 1\n\n\t\t\t\t\tlet productId = jQuery(\"[name='variation_id']\").val()\n\n\t\t\t\t\t// console.log('productId: ' + productId);\n\t\t\t\t\t// console.log('quantity: ' + quantity);\n\n\t\t\t\t\twpm.addProductToCart(productId, quantity)\n\n\t\t\t\t} else if (wpmDataLayer.shop.product_type === \"grouped\") {\n\n\t\t\t\t\t// console.log('grouped');\n\n\t\t\t\t\tjQuery(\".woocommerce-grouped-product-list-item\").each(function () {\n\n\t\t\t\t\t\tlet quantity = Number(jQuery(this).find(\".input-text.qty\").val())\n\n\t\t\t\t\t\tif (!quantity && quantity !== 0) quantity = 1\n\n\t\t\t\t\t\tlet classes = jQuery(this).attr(\"class\")\n\t\t\t\t\t\tlet productId = wpm.getPostIdFromString(classes)\n\n\t\t\t\t\t\t// console.log('productId: ' + productId);\n\t\t\t\t\t\t// console.log('quantity: ' + quantity);\n\n\t\t\t\t\t\twpm.addProductToCart(productId, quantity)\n\t\t\t\t\t})\n\t\t\t\t} else if (wpmDataLayer.shop.product_type === \"bundle\") {\n\n\t\t\t\t\t// console.log('bundle');\n\n\t\t\t\t\tlet quantity = Number(jQuery(\".input-text.qty\").val())\n\n\t\t\t\t\tif (!quantity && quantity !== 0) quantity = 1\n\n\t\t\t\t\tlet productId = jQuery(\"input[name=add-to-cart]\").val()\n\n\t\t\t\t\t// console.log('productId: ' + productId);\n\t\t\t\t\t// console.log('quantity: ' + quantity);\n\n\t\t\t\t\twpm.addProductToCart(productId, quantity)\n\t\t\t\t}\n\t\t\t}\n\t\t} else {\n\n\t\t\t// console.log('non product page');\n\n\t\t\tlet quantity = 1\n\t\t\tlet productId = jQuery(this).data(\"product_id\")\n\t\t\t// console.log('productId: ' + productId);\n\t\t\twpm.addProductToCart(productId, quantity)\n\t\t}\n\t} catch (e) {\n\t\tconsole.error(e)\n\t}\n})\n\n// if someone clicks anywhere on a custom /?add-to-cart=123 link\n// trigger the add to cart event\n// body.one('click', function (e) {\n//\n// try {\n// if (jQuery(this)[0].URL) {\n//\n// let href = new URL(jQuery(this)[0].URL);\n// let searchParams = new URLSearchParams(href.search);\n//\n// if (searchParams.has('add-to-cart')) {\n// // console.log('non product page, /?add-to-cart=123 link');\n//\n// let productId = searchParams.get('add-to-cart');\n// wpm.addProductToCart(productId, 1);\n// }\n// }\n// } catch (e) {\n// console.error(e);\n// }\n// });\n\n\n/**\n * If someone clicks anywhere on a custom /?add-to-cart=123 link\n * trigger the add to cart event\n */\n// body.one('click', 'a:not(.add_to_cart_button, .ajax_add_to_cart, .single_add_to_cart_button)', function (event) {\njQuery(document).one(\"click\", \"a:not(.add_to_cart_button, .ajax_add_to_cart, .single_add_to_cart_button)\", function (event) {\n\t// jQuery('a:not(.add_to_cart_button, .ajax_add_to_cart, .single_add_to_cart_button)').one('click', function (event) {\n\n\ttry {\n\t\tif (jQuery(event.target).closest(\"a\").attr(\"href\")) {\n\n\t\t\tlet href = jQuery(event.target).closest(\"a\").attr(\"href\")\n\n\t\t\tif (href.includes(\"add-to-cart=\")) {\n\t\t\t\tlet matches = href.match(/(add-to-cart=)(\\d+)/)\n\t\t\t\t// console.log('pid: ' + matches[2])\n\t\t\t\tif (matches) wpm.addProductToCart(matches[2], 1)\n\t\t\t}\n\t\t}\n\t} catch (e) {\n\t\tconsole.error(e)\n\t}\n})\n\n// select_content GA UA event\n// select_item GA 4 event\n// jQuery(document).on('click', '.woocommerce-LoopProduct-link, .wc-block-grid__product, .product-small.box', function (e) {\n// body.on('click', '.woocommerce-LoopProduct-link, .wc-block-grid__product, .product, .product-small, .type-product', function (e) {\njQuery(document).on(\"click\", \".woocommerce-LoopProduct-link, .wc-block-grid__product, .product, .product-small, .type-product\", function (e) {\n\t// jQuery('.woocommerce-LoopProduct-link, .wc-block-grid__product, .product, .product-small, .type-product').on('click', function (e) {\n\n\ttry {\n\n\t\t// On some pages the event fires multiple times, and on product pages\n\t\t// even on page load. Using e.stopPropagation helps to prevent this,\n\t\t// but I dont know why. We don't even have to use this, since only a real\n\t\t// product click yields a valid productId. So we filter the invalid click\n\t\t// events out later down the code. I'll keep it that way because this is\n\t\t// the most compatible way across shops.\n\t\t// e.stopPropagation();\n\n\t\t// console.log('select_content and select_item');\n\n\t\tlet productId = jQuery(this).nextAll(\".wpmProductId:first\").data(\"id\")\n\t\t// console.log('select_content and select_item: ' + productId);\n\n\n\t\t// On product pages, for some reason, the click event is triggered on the main product on page load.\n\t\t// In that case no ID is found. But we can discard it, since we only want to trigger the event on\n\t\t// related products, which are found below.\n\t\tif (productId) {\n\n\t\t\t// console.log('select_content and select_item: ' + productId);\n\n\t\t\tproductId = getIdBasedOndVariationsOutputSetting(productId)\n\n\t\t\tif (!productId) throw Error(\"Wasn't able to retrieve a productId\")\n\n\t\t\t// console.log('prodid: ' + productId);\n\n\t\t\tif (wpmDataLayer.products && wpmDataLayer.products[productId]) {\n\n\t\t\t\tlet product = wpm.getProductDetailsFormattedForEvent(productId)\n\n\t\t\t\tjQuery(document).trigger(\"wpmSelectContentGaUa\", product)\n\t\t\t\tjQuery(document).trigger(\"wpmSelectItem\", product)\n\t\t\t}\n\t\t}\n\t} catch (e) {\n\t\tconsole.error(e)\n\t}\n})\n\n// begin_checkout event\n// body.one('click', '.checkout-button, .cart-checkout-button, .button.checkout', function (e) {\njQuery(document).one(\"click\", \".checkout-button, .cart-checkout-button, .button.checkout\", function (e) {\n\t// jQuery('.checkout-button, .cart-checkout-button, .button.checkout').one('click', function (e) {\n\t// console.log('begin_checkout');\n\n\tjQuery(document).trigger(\"wpmBeginCheckout\")\n})\n\n\n// checkout_progress event\n// track checkout option event: entered valid billing email\n// body.on('input', '#billing_email', function () {\njQuery(document).on(\"input\", \"#billing_email\", function () {\n\t// jQuery('#billing_email').on('input', function () {\n\n\tif (wpm.isEmail(jQuery(this).val())) {\n\t\t// wpm.fireCheckoutOption(2);\n\t\twpm.fireCheckoutProgress(2)\n\t\twpm.emailSelected = true\n\t}\n})\n\n// track checkout option event: purchase click\n\n// body.on('click', '.wc_payment_methods', function () {\njQuery(document).on(\"click\", \".wc_payment_methods\", function () {\n\t// jQuery('.wc_payment_methods').on('click', function () {\n\n\tif (false === wpm.paymentMethodSelected) {\n\t\twpm.fireCheckoutProgress(3)\n\t}\n\n\twpm.fireCheckoutOption(3, jQuery(\"input[name='payment_method']:checked\").val())\n\twpm.paymentMethodSelected = true\n})\n\n// track checkout option event: purchase click\n// body.one('click', '#place_order', function () {\njQuery(document).one(\"click\", \"#place_order\", function () {\n\t// jQuery('#place_order').one('click', function () {\n\n\tif (false === wpm.emailSelected) {\n\t\twpm.fireCheckoutProgress(2)\n\t}\n\n\tif (false === wpm.paymentMethodSelected) {\n\t\twpm.fireCheckoutProgress(3)\n\t\twpm.fireCheckoutOption(3, jQuery(\"input[name='payment_method']:checked\").val())\n\t}\n\n\twpm.fireCheckoutProgress(4)\n})\n\n// update cart event\n// body.on('click', \"[name='update_cart']\", function (e) {\njQuery(document).on(\"click\", \"[name='update_cart']\", function (e) {\n\t// jQuery(\"[name='update_cart']\").on('click', function (e) {\n\n\ttry {\n\t\tjQuery(\".cart_item\").each(function () {\n\n\t\t\t// let productId = jQuery(this).find('[data-product_id]').data('product_id');\n\n\t\t\tlet url = new URL(jQuery(this).find(\".product-remove\").find(\"a\").attr(\"href\"))\n\t\t\tlet productId = wpm.getProductIdByCartItemKeyUrl(url)\n\n\t\t\t// console.log(productId)\n\n\t\t\tlet quantity = jQuery(this).find(\".qty\").val()\n\n\t\t\tif (quantity === 0) {\n\t\t\t\twpm.removeProductFromCart(productId)\n\t\t\t} else if (quantity < wpmDataLayer.cart[productId].quantity) {\n\t\t\t\twpm.removeProductFromCart(productId, wpmDataLayer.cart[productId].quantity - quantity)\n\t\t\t} else if (quantity > wpmDataLayer.cart[productId].quantity) {\n\t\t\t\twpm.addProductToCart(productId, quantity - wpmDataLayer.cart[productId].quantity)\n\t\t\t}\n\t\t})\n\t} catch (e) {\n\t\tconsole.error(e)\n\t\twpm.getCartItemsFromBackend()\n\t}\n})\n\n\n// add_to_wishlist\n// body.on('click', '.add_to_wishlist, .wl-add-to', function () {\njQuery(document).on(\"click\", \".add_to_wishlist, .wl-add-to\", function () {\n\t// jQuery('.add_to_wishlist, .wl-add-to').on('click', function () {\n\n\ttry {\n\t\t// console.log('add_to_wishlist');\n\t\t// console.log('this:' + jQuery(this).data('product-id'));\n\n\t\tlet productId\n\n\t\tif (jQuery(this).data(\"productid\")) { // for the WooCommerce wishlist plugin\n\t\t\tproductId = jQuery(this).data(\"productid\")\n\t\t} else if (jQuery(this).data(\"product-id\")) { // for the YITH wishlist plugin\n\t\t\tproductId = jQuery(this).data(\"product-id\")\n\t\t}\n\n\t\tif (!productId) throw Error(\"Wasn't able to retrieve a productId\")\n\n\t\tlet product = wpm.getProductDetailsFormattedForEvent(productId)\n\n\t\t// console.log('add_to_wishlist');\n\t\t// console.log(product);\n\n\t\tjQuery(document).trigger(\"wpmAddToWishlist\", product)\n\t} catch (e) {\n\t\tconsole.error(e)\n\t}\n})\n\n// body.on('updated_cart_totals', function () {\njQuery(document).on(\"updated_cart_totals\", function () {\n\tjQuery(document).trigger(\"wpmViewCart\")\n})\n\n\n// populate the wpmDataLayer with the cart items\njQuery(window).on(\"wpmLoad\", function () {\n\t// console.log('getting cart');\n\n\ttry {\n\t\t// console.log('wpmMiniCartActive: ' + JSON.parse(sessionStorage.getItem('wpmMiniCartActive')));\n\t\t// if ( wpmDataLayer.shop.page_type === 'cart' || wpmDataLayer.shop.mini_cart.track === true) {\n\n\t\tif (\n\t\t\tJSON.parse(sessionStorage.getItem(\"wpmMiniCartActive\")) && // if we detected calls to get_refreshed_fragments\n\t\t\tJSON.parse(sessionStorage.getItem(\"wpmFirstPageLoad\")) && // when a new session is initiated there are no items in the cart, so we can save that call\n\t\t\twpmDataLayer.shop.mini_cart.track === true // if shop owner generally allows the plugin to track the mini cart\n\t\t) {\n\t\t\t// console.log('getting cart');\n\t\t\twpm.getCartItems()\n\n\t\t} else {\n\t\t\tsessionStorage.setItem(\"wpmFirstPageLoad\", JSON.stringify(true))\n\t\t}\n\t} catch (e) {\n\t\tconsole.error(e)\n\t}\n})\n\n// get all add-to-cart= products from backend\njQuery(window).on(\"wpmLoad\", function () {\n\n\twpmDataLayer.products = wpmDataLayer.products || {}\n\t// wpmDataLayer.products = {14: 'x', 31: 'x', 16: 'x', 22: 'x', 40: 'x'};\n\n\t// scan page for add-to-cart= links\n\tlet productIds = wpm.getAddToCartLinkProductIds()\n\n\twpm.getProductsFromBackend(productIds)\n})\n\n/**\n * Save the referrer into a cookie\n */\n\njQuery(window).on(\"wpmLoad\", function () {\n\n\t// can't use session storage as we can't read it from the server\n\tif (!wpm.getCookie(\"wpmReferrer\")) {\n\n\t\tif (document.referrer) {\n\t\t\tlet referrerUrl = new URL(document.referrer)\n\t\t\tlet referrerHostname = referrerUrl.hostname\n\n\t\t\tif (referrerHostname !== window.location.host) {\n\t\t\t\twpm.setCookie(\"wpmReferrer\", referrerHostname)\n\t\t\t} else {\n\t\t\t\twpm.setCookie(\"wpmReferrer\", \"\")\n\t\t\t}\n\n\t\t} else {\n\t\t\twpm.setCookie(\"wpmReferrer\", \"\")\n\t\t}\n\t}\n})\n\n\n/**\n * Create our own load event in order to better handle script flow execution when JS \"optimizers\" shuffle the code.\n */\n\njQuery(window).on(\"wpmLoad\", function () {\n\ttry {\n\t\tif (typeof wpmDataLayer != \"undefined\" && !wpmDataLayer?.wpmLoadFired) {\n\n\t\t\tjQuery(document).trigger(\"wpmLoadAlways\")\n\n\t\t\tif (\"product\" === wpmDataLayer.shop.page_type && wpmDataLayer.shop.product_type !== \"variable\" && wpm.getMainProductIdFromProductPage()) {\n\n\t\t\t\tlet product = wpm.getProductDataForViewItemEvent(wpm.getMainProductIdFromProductPage())\n\t\t\t\tjQuery(document).trigger(\"wpmViewItem\", product)\n\n\t\t\t} else if (\"product_category\" === wpmDataLayer.shop.page_type) {\n\n\t\t\t\tjQuery(document).trigger(\"wpmCategory\")\n\n\t\t\t} else if (\"search\" === wpmDataLayer.shop.page_type) {\n\n\t\t\t\tjQuery(document).trigger(\"wpmSearch\")\n\n\t\t\t} else if (\"cart\" === wpmDataLayer.shop.page_type) {\n\n\t\t\t\tjQuery(document).trigger(\"wpmViewCart\")\n\n\t\t\t} else if (\"order_received_page\" === wpmDataLayer.shop.page_type && wpmDataLayer.order) {\n\n\t\t\t\tif (!wpm.isOrderIdStored(wpmDataLayer.order.id)) {\n\n\t\t\t\t\tjQuery(document).trigger(\"wpmOrderReceivedPage\")\n\t\t\t\t\twpm.writeOrderIdToStorage(wpmDataLayer.order.id)\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tjQuery(document).trigger(\"wpmEverywhereElse\")\n\t\t\t}\n\n\t\t\tif (wpmDataLayer.user.id && !wpm.hasLoginEventFired()) {\n\t\t\t\tjQuery(document).trigger(\"wpmLogin\")\n\t\t\t\twpm.setLoginEventFired()\n\t\t\t}\n\n\t\t\t/**\n\t\t\t * Load mini cart fragments into a wpm session storage key,\n\t\t\t * after the document load event.\n\t\t\t */\n\t\t\tjQuery(document).ajaxSend(function (event, jqxhr, settings) {\n\t\t\t\t// console.log('settings.url: ' + settings.url);\n\n\t\t\t\tif (settings.url.includes(\"get_refreshed_fragments\") && sessionStorage) {\n\t\t\t\t\tif (!sessionStorage.getItem(\"wpmMiniCartActive\")) {\n\t\t\t\t\t\tsessionStorage.setItem(\"wpmMiniCartActive\", JSON.stringify(true))\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t})\n\n\t\t\twpmDataLayer.wpmLoadFired = true\n\t\t}\n\n\t} catch (e) {\n\t\tconsole.error(e)\n\t}\n})\n\n// jQuery(window).on(\"load\", function () {\n// \tjQuery(document).trigger(\"wpmLoad\", {})\n// })\n\njQuery(window).on(\"wpmPreLoadPixels\", function () {\n\n\tif (wpmDataLayer?.shop?.cookie_consent_mgmt?.explicit_consent) {\n\t\twpm.updateConsentCookieValues(true)\n\t}\n\tjQuery(document).trigger(\"wpmLoadPixels\", {})\n})\n\n\n/**\n * Events that only work after document ready state,\n * such as jQuery(\".single_variation_wrap\").on(\"show_variation\", function(){})\n */\n\njQuery(function () {\n\n\t/**\n\t * Fired when the user selects all the required dropdowns / attributes\n\t * Can only be hooked into after document ready\n\t * https://stackoverflow.com/a/27849208/4688612\n\t * https://stackoverflow.com/a/65065335/4688612\n\t */\n\tjQuery(\".single_variation_wrap\").on(\"show_variation\", function (event, variation) {\n\n\t\ttry {\n\t\t\tlet productId = getIdBasedOndVariationsOutputSetting(variation.variation_id)\n\n\t\t\tif (!productId) throw Error(\"Wasn't able to retrieve a productId\")\n\n\t\t\tif (wpmDataLayer.products && wpmDataLayer.products[productId]) {\n\n\t\t\t\t// console.log('productId: ' + productId);\n\n\t\t\t\tlet product = wpm.getProductDetailsFormattedForEvent(productId)\n\n\t\t\t\tjQuery(document).trigger(\"wpmViewItem\", product)\n\t\t\t}\n\t\t} catch (e) {\n\t\t\tconsole.error(e)\n\t\t}\n\t})\n\n\n})\n","// The module cache\nvar __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tvar cachedModule = __webpack_module_cache__[moduleId];\n\tif (cachedModule !== undefined) {\n\t\treturn cachedModule.exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\t// no module.id needed\n\t\t// no module.loaded needed\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId](module, module.exports, __webpack_require__);\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n","/**\n * Load all free scripts first\n */\n\nrequire(\"./wpm\")\n\n/**\n * Load all free scripts\n */\n\nrequire(\"./google\")\nrequire(\"./google-ga-ua\")\nrequire(\"./google-ga-4\")\nrequire(\"./google-ads\")\nrequire(\"./facebook\")\nrequire(\"./hotjar\")\nrequire(\"./google-optimize\")\n\n/**\n * Execute the wpm loader. It makes sure that the script flow gets exectuded correctly, no matter how JS \"optimizers\" shuffle the code.\n */\n\nrequire(\"./wpm-loader\")\n\n// console.log('WooCommerce Pixel Manager free version')\n\n\n"],"names":["wpm","$","undefined","fBUserData","loadFacebookPixel","wpmDataLayer","pixels","facebook","pixel_id","loaded","f","window","b","document","e","fbq","n","callMethod","apply","arguments","queue","push","_fbq","version","t","createElement","async","src","s","getElementsByTagName","parentNode","insertBefore","console","error","getRandomEventId","Math","random","toString","substring","getFbUserData","getFbUserDataFromBrowser","setFbUserData","fbp","getCookie","fbc","client_user_agent","navigator","userAgent","fbViewContent","product","eventId","content_type","content_name","name","content_ids","dyn_r_ids","dynamic_remarketing","id_type","currency","shop","value","price","eventID","jQuery","trigger","event_name","event_id","user_data","product_data","product_id","event_source_url","location","href","facebookContentIds","prodIds","key","item","Object","entries","order","items","general","variationsOutput","variation_id","String","products","id","on","canIFire","event","parseFloat","quantity","value_filtered","conversionIdentifiers","getGoogleAdsConversionIdentifiersWithLabel","google","ads","conversionIds","getGoogleAdsConversionIdentifiers","getGoogleAdsRegularOrderItems","orderItems","orderItem","getGoogleAdsDynamicRemarketingOrderItems","google_business_vertical","isEmptyObject","status","googleConfigConditionsMet","isVariable","send_events_with_parent_ids","gtagLoaded","then","gtag","send_to","data_basic","data_with_cart","transaction_id","number","new_customer","aw_merchant_id","discount","aw_feed_country","aw_feed_language","getGA4OrderItems","item_name","item_category","category","join","item_id","analytics","item_variant","variant_name","item_brand","brand","ga4","measurement_id","mp_active","affiliation","value_regular","tax","shipping","coupon","getGAUAOrderItems","list_position","variant","universal","property_id","load_google_optimize_pixel","optimize","container_id","loadScriptAndCacheIt","type","consent_mode","active","getConsentValues","mode","categories","includes","getVisitorConsentStatusAndUpdateGoogleConsentSettings","google_consent_settings","analytics_storage","ad_storage","updateGoogleConsentMode","cookie_consent_mgmt","explicit_consent","fireGtagGoogleAds","state","enhanced_conversions","phone_conversion_label","phone_conversion_number","keys","page_type","enhanced_conversion_data","fireGtagGoogleAnalyticsUA","parameters","fireGtagGoogleAnalyticsGA4","isGoogleActive","getGoogleGtagId","loadGoogle","done","script","textStatus","dataLayer","wait_for_update","region","ads_data_redaction","url_passthrough","linker","settings","Date","canGoogleLoad","Promise","resolve","reject","startTime","wait","setTimeout","load_hotjar_pixel","h","o","a","r","hotjar","site_id","hj","q","_hjSettings","hjid","hjsv","appendChild","wpmDataLayerExists","pageLoaded","wpmDeduper","wpmRestSettings","checkCookie","emailSelected","paymentMethodSelected","useRestEndpoint","isSessionStorageAvailable","isRestEndpointAvailable","isBelowRestErrorThreshold","sessionStorage","getItem","JSON","parse","testEndpoint","url","protocol","host","cookieName","ajax","timeout","statusCode","response","setItem","stringify","isWpmRestEndpointAvailable","writeOrderIdToStorage","orderId","Storage","localStorage","ids","expiresDate","setDate","getDate","cookie","toUTCString","storeOrderIdOnServer","orderDeduplication","isOrderIdStored","log","isEmail","email","test","removeProductFromCart","productId","quantityToRemove","Error","getIdBasedOndVariationsOutputSetting","cart","getProductDetailsFormattedForEvent","isVariation","parentId","addProductToCart","getCartItemsFromBackend","getCartItems","saveCartObjectToDataLayer","data","action","dataType","ajax_url","success","cartItems","getProductsFromBackend","productIds","filter","hasOwnProperty","length","assign","cartObject","fireCheckoutOption","step","checkout_option","fireCheckoutProgress","getPostIdFromString","string","match","triggerViewItemList","getProductDataForViewItemEvent","getMainProductIdFromProductPage","indexOf","product_type","viewItemListTriggerTestMode","target","css","append","find","viewItemListTrigger","opacity","backgroundColor","getSearchTermFromUrl","URLSearchParams","search","get","io","ioTimeouts","observerCallback","observer","forEach","entry","elementId","next","isIntersecting","testMode","repeat","unobserve","clearTimeout","remove","allIoElementsToWatch","ioid","startIntersectionObserverToWatch","has","IntersectionObserver","threshold","map","i","elem","parent","hasClass","prev","this","closest","each","observe","startProductsMutationObserverToWatch","productsNode","parents","first","productsMutationObserver","attributes","childList","characterData","MutationObserver","mutations","mutation","newNodes","addedNodes","hasWpmProductIdElement","siblings","setCookie","cookieValue","expiryDays","d","setTime","getTime","expires","ca","decodeURIComponent","split","c","charAt","getWpmSessionData","setWpmSessionData","order_id","nonce","getProductIdByCartItemKeyUrl","cartItemKey","cartItemKeys","getAddToCartLinkProductIds","attr","matches","list_name","position","parentId_dyn_r_ids","setReferrerToCookie","referrer","getReferrerFromCookie","getClidFromBrowser","clidCookieId","clidId","gclid","dclid","getUserAgent","getViewPort","width","max","documentElement","clientWidth","innerWidth","height","clientHeight","innerHeight","getComplianzCookies","cmplz_statistics","cmplz_marketing","visitorHasChosen","getCookieLawInfoCookies","analyticsCookie","adsCookie","wpmConsentValues","setConsentValueCategories","updateConsentCookieValues","explicitConsent","decodeURI","consents","statistics","marketing","thirdparty","advanced","setConsentDefaultValuesToExplicit","pixelName","scriptTagObserver","node","shouldScriptBeActive","unblockScript","blockScript","head","subtree","addEventListener","disconnect","some","element","scriptNode","removeAttach","wpmSrc","appendTo","removeAttr","unblockAllScripts","index","unblockSelectedPixels","Cookiebot","consent","detail","huObserver","hu","body","options","extend","cache","getOrderItemPrice","total","total_tax","hasLoginEventFired","loginEventFired","setLoginEventFired","waitForVar","readyState","URL","Number","val","classes","one","nextAll","mini_cart","track","referrerHostname","hostname","wpmLoadFired","user","ajaxSend","jqxhr","variation","__webpack_module_cache__","__webpack_require__","moduleId","cachedModule","exports","module","__webpack_modules__","require"],"sourceRoot":""}
|
js/public/wpm-public__premium_only.p1.min.js
ADDED
@@ -0,0 +1,2 @@
|
|
|
|
|
1 |
+
(()=>{var e={785:()=>{!function(e,t,a){let o;e.loadFacebookPixel=function(){try{var e,t,a;null!==(e=wpmDataLayer)&&void 0!==e&&null!==(t=e.pixels)&&void 0!==t&&null!==(a=t.facebook)&&void 0!==a&&a.pixel_id&&(wpmDataLayer.pixels.facebook.loaded=!0,o=window,r=document,i="script",o.fbq||(n=o.fbq=function(){n.callMethod?n.callMethod.apply(n,arguments):n.queue.push(arguments)},o._fbq||(o._fbq=n),n.push=n,n.loaded=!0,n.version="2.0",n.queue=[],(l=r.createElement(i)).async=!0,l.src="https://connect.facebook.net/en_US/fbevents.js",(d=r.getElementsByTagName(i)[0]).parentNode.insertBefore(l,d)),fbq("init",wpmDataLayer.pixels.facebook.pixel_id),fbq("track","PageView"))}catch(i){console.error(i)}var o,r,i,n,l,d},e.getRandomEventId=function(){return(Math.random()+1).toString(36).substring(2)},e.getFbUserData=function(){return o||e.getFbUserDataFromBrowser()},e.setFbUserData=function(){o=e.getFbUserDataFromBrowser()},e.getFbUserDataFromBrowser=function(){return{fbp:e.getCookie("_fbp"),fbc:e.getCookie("_fbc"),client_user_agent:navigator.userAgent}},e.fbViewContent=function(t){try{var a,o,r;if(null===(a=wpmDataLayer)||void 0===a||null===(o=a.pixels)||void 0===o||null===(r=o.facebook)||void 0===r||!r.loaded)return;let i=e.getRandomEventId();fbq("track","ViewContent",{content_type:"product",content_name:t.name,content_ids:t.dyn_r_ids[wpmDataLayer.pixels.facebook.dynamic_remarketing.id_type],currency:wpmDataLayer.shop.currency,value:t.price},{eventID:i}),t.currency=wpmDataLayer.shop.currency,jQuery(document).trigger("wpmFbCapiEvent",{event_name:"ViewContent",event_id:i,user_data:e.getFbUserData(),product_data:t,product_id:t.dyn_r_ids[wpmDataLayer.pixels.facebook.dynamic_remarketing.id_type],event_source_url:window.location.href})}catch(e){console.error(e)}},e.facebookContentIds=function(){let e=[];for(const[o,r]of Object.entries(wpmDataLayer.order.items)){var t,a;null!==(t=wpmDataLayer)&&void 0!==t&&null!==(a=t.general)&&void 0!==a&&a.variationsOutput&&0!==r.variation_id?e.push(String(wpmDataLayer.products[r.variation_id].dyn_r_ids[wpmDataLayer.pixels.facebook.dynamic_remarketing.id_type])):e.push(String(wpmDataLayer.products[r.id].dyn_r_ids[wpmDataLayer.pixels.facebook.dynamic_remarketing.id_type]))}return e}}(window.wpm=window.wpm||{},jQuery),jQuery(document).on("wpmLoadPixels",(function(){var e,t,a;!wpm.canIFire("ads","facebook-ads")||null!==(e=wpmDataLayer)&&void 0!==e&&null!==(t=e.pixels)&&void 0!==t&&null!==(a=t.facebook)&&void 0!==a&&a.loaded||wpm.loadFacebookPixel()})),jQuery(document).on("wpmAddToCart",(function(e,t){try{var a,o,r;if(null===(a=wpmDataLayer)||void 0===a||null===(o=a.pixels)||void 0===o||null===(r=o.facebook)||void 0===r||!r.loaded)return;let e=wpm.getRandomEventId();fbq("track","AddToCart",{content_type:"product",content_name:t.name,content_ids:t.dyn_r_ids[wpmDataLayer.pixels.facebook.dynamic_remarketing.id_type],value:parseFloat(t.quantity*t.price),currency:t.currency},{eventID:e}),t.currency=wpmDataLayer.shop.currency,jQuery(document).trigger("wpmFbCapiEvent",{event_name:"AddToCart",event_id:e,user_data:wpm.getFbUserData(),product_data:t,product_id:t.dyn_r_ids[wpmDataLayer.pixels.facebook.dynamic_remarketing.id_type],event_source_url:window.location.href})}catch(e){console.error(e)}})),jQuery(document).on("wpmBeginCheckout",(function(e){try{var t,a,o;if(null===(t=wpmDataLayer)||void 0===t||null===(a=t.pixels)||void 0===a||null===(o=a.facebook)||void 0===o||!o.loaded)return;let e=wpm.getRandomEventId();fbq("track","InitiateCheckout",{},{eventID:e}),jQuery(document).trigger("wpmFbCapiEvent",{event_name:"InitiateCheckout",event_id:e,user_data:wpm.getFbUserData(),event_source_url:window.location.href})}catch(e){console.error(e)}})),jQuery(document).on("wpmAddToWishlist",(function(e,t){try{var a,o,r;if(null===(a=wpmDataLayer)||void 0===a||null===(o=a.pixels)||void 0===o||null===(r=o.facebook)||void 0===r||!r.loaded)return;let e=wpm.getRandomEventId();fbq("track","AddToWishlist",{content_type:"product",content_name:t.name,content_ids:t.dyn_r_ids[wpmDataLayer.pixels.facebook.dynamic_remarketing.id_type],value:parseFloat(t.quantity*t.price),currency:t.currency},{eventID:e}),t.currency=wpmDataLayer.shop.currency,jQuery(document).trigger("wpmFbCapiEvent",{event_name:"AddToWishlist",event_id:e,user_data:wpm.getFbUserData(),product_data:t,product_id:t.dyn_r_ids[wpmDataLayer.pixels.facebook.dynamic_remarketing.id_type],event_source_url:window.location.href})}catch(e){console.error(e)}})),jQuery(document).on("wpmViewItem",(function(e,t){try{var a,o,r;if(null===(a=wpmDataLayer)||void 0===a||null===(o=a.pixels)||void 0===o||null===(r=o.facebook)||void 0===r||!r.loaded)return;wpm.fbViewContent(t)}catch(e){console.error(e)}})),jQuery(document).on("wpmSearch",(function(){try{var e,t,a;if(null===(e=wpmDataLayer)||void 0===e||null===(t=e.pixels)||void 0===t||null===(a=t.facebook)||void 0===a||!a.loaded)return;let o=wpm.getRandomEventId();fbq("track","Search",{},{eventID:o}),jQuery(document).trigger("wpmFbCapiEvent",{event_name:"Search",event_id:o,user_data:wpm.getFbUserData(),event_source_url:window.location.href})}catch(e){console.error(e)}})),jQuery(document).on("wpmLoadAlways",(function(){try{var e,t,a;if(null===(e=wpmDataLayer)||void 0===e||null===(t=e.pixels)||void 0===t||null===(a=t.facebook)||void 0===a||!a.loaded)return;wpm.setFbUserData()}catch(e){console.error(e)}})),jQuery(document).on("wpmOrderReceivedPage",(function(){try{var e,t,a;if(null===(e=wpmDataLayer)||void 0===e||null===(t=e.pixels)||void 0===t||null===(a=t.facebook)||void 0===a||!a.loaded)return;fbq("track","Purchase",{content_type:"product",value:wpmDataLayer.order.value_filtered,currency:wpmDataLayer.order.currency,content_ids:wpm.facebookContentIds()},{eventID:wpmDataLayer.order.id})}catch(e){console.error(e)}}))},317:()=>{!function(e,t,a){e.setFacebookIdentifiersOnServer=function(){try{let t={action:"wpm_facebook_set_session_identifiers",nonce:e.nonce,fbp:e.getCookie("_fbp"),fbc:e.getCookie("_fbc")};if(t.fbp&&window.sessionStorage&&window.sessionStorage.getItem("wpm_fb_session_id_"+t.fbp+"_set"))return;jQuery.ajax({type:"post",dataType:"json",url:e.ajax_url,data:t,success:function(e){window.sessionStorage&&!0===e.success&&window.sessionStorage.setItem("wpm_fb_session_id_"+t.fbp+"_set",JSON.stringify(!0))},error:function(e){}})}catch(e){console.error(e)}}}(window.wpm=window.wpm||{},jQuery),jQuery(document).on("wpmAddToWishlist",(function(e,t){try{var a,o,r;if(null===(a=wpmDataLayer)||void 0===a||null===(o=a.pixels)||void 0===o||null===(r=o.facebook)||void 0===r||!r.loaded)return;fbq("track","AddToWishlist",{content_name:t.name,content_category:t.category,content_ids:t.dyn_r_ids[wpmDataLayer.pixels.facebook.dynamic_remarketing.id_type],currency:t.currency,value:t.price})}catch(e){console.error(e)}})),jQuery(document).on("wpmFbCapiEvent",(function(e,t){try{if(!wpmDataLayer.pixels.facebook.capi)return;let e={action:"wpm_facebook_capi_event",data:t,nonce:wpm.nonce};jQuery.ajax({type:"post",dataType:"json",url:wpm.ajax_url,data:e,success:function(e){},error:function(e){}})}catch(e){console.error(e)}})),jQuery(window).on("wpmLoadAlways",(function(){try{var e,t,a;null!==(e=wpmDataLayer)&&void 0!==e&&null!==(t=e.pixels)&&void 0!==t&&null!==(a=t.facebook)&&void 0!==a&&a.pixel_id&&wpmDataLayer.pixels.facebook.capi&&["cart","checkout"].indexOf(wpmDataLayer.shop.page_type)>=0&&wpm.setFacebookIdentifiersOnServer()}catch(e){console.error(e)}}))},234:()=>{!function(e,t,a){let o=[];e.getGoogleAdsConversionIdentifiersWithLabel=function(){for(const[e,t]of Object.entries(wpmDataLayer.pixels.google.ads.conversionIds))o.push(e+"/"+t);return o},e.getGoogleAdsConversionIdentifiers=function(){let e=[];for(const[t,a]of Object.entries(wpmDataLayer.pixels.google.ads.conversionIds))e.push(t);return e},e.getGoogleAdsRegularOrderItems=function(){let e=[];for(const[o,r]of Object.entries(wpmDataLayer.order.items)){var t,a;let o;o={quantity:r.quantity,price:r.price},null!==(t=wpmDataLayer)&&void 0!==t&&null!==(a=t.general)&&void 0!==a&&a.variationsOutput&&0!==r.variation_id?(o.id=String(wpmDataLayer.products[r.variation_id].dyn_r_ids[wpmDataLayer.pixels.google.ads.dynamic_remarketing.id_type]),e.push(o)):(o.id=String(wpmDataLayer.products[r.id].dyn_r_ids[wpmDataLayer.pixels.google.ads.dynamic_remarketing.id_type]),e.push(o))}return e},e.getGoogleAdsDynamicRemarketingOrderItems=function(){let e=[];for(const[o,r]of Object.entries(wpmDataLayer.order.items)){var t,a;let o;o={quantity:r.quantity,price:r.price,google_business_vertical:wpmDataLayer.pixels.google.ads.google_business_vertical},null!==(t=wpmDataLayer)&&void 0!==t&&null!==(a=t.general)&&void 0!==a&&a.variationsOutput&&0!==r.variation_id?(o.id=String(wpmDataLayer.products[r.variation_id].dyn_r_ids[wpmDataLayer.pixels.google.ads.dynamic_remarketing.id_type]),e.push(o)):(o.id=String(wpmDataLayer.products[r.id].dyn_r_ids[wpmDataLayer.pixels.google.ads.dynamic_remarketing.id_type]),e.push(o))}return e}}(window.wpm=window.wpm||{},jQuery),jQuery(document).on("wpmViewItemList",(function(e,t){try{var a,o,r,i,n,l,d,s,c,u,p;if(jQuery.isEmptyObject(null===(a=wpmDataLayer)||void 0===a||null===(o=a.pixels)||void 0===o||null===(r=o.google)||void 0===r||null===(i=r.ads)||void 0===i?void 0:i.conversionIds))return;if(null===(n=wpmDataLayer)||void 0===n||null===(l=n.pixels)||void 0===l||null===(d=l.google)||void 0===d||null===(s=d.ads)||void 0===s||null===(c=s.dynamic_remarketing)||void 0===c||!c.status)return;if(!wpm.googleConfigConditionsMet("ads"))return;if(null!==(u=wpmDataLayer)&&void 0!==u&&null!==(p=u.general)&&void 0!==p&&p.variationsOutput&&t.isVariable&&!1===wpmDataLayer.pixels.google.ads.dynamic_remarketing.send_events_with_parent_ids)return;if(!t)return;wpm.gtagLoaded().then((function(){gtag("event","view_item_list",{send_to:wpm.getGoogleAdsConversionIdentifiers(),items:[{id:t.dyn_r_ids[wpmDataLayer.pixels.google.ads.dynamic_remarketing.id_type],google_business_vertical:wpmDataLayer.pixels.google.ads.google_business_vertical}]})}))}catch(e){console.error(e)}})),jQuery(document).on("wpmAddToCart",(function(e,t){try{var a,o,r,i,n,l,d,s,c;if(jQuery.isEmptyObject(null===(a=wpmDataLayer)||void 0===a||null===(o=a.pixels)||void 0===o||null===(r=o.google)||void 0===r||null===(i=r.ads)||void 0===i?void 0:i.conversionIds))return;if(null===(n=wpmDataLayer)||void 0===n||null===(l=n.pixels)||void 0===l||null===(d=l.google)||void 0===d||null===(s=d.ads)||void 0===s||null===(c=s.dynamic_remarketing)||void 0===c||!c.status)return;if(!wpm.googleConfigConditionsMet("ads"))return;wpm.gtagLoaded().then((function(){gtag("event","add_to_cart",{send_to:wpm.getGoogleAdsConversionIdentifiers(),value:t.quantity*t.price,items:[{id:t.dyn_r_ids[wpmDataLayer.pixels.google.ads.dynamic_remarketing.id_type],quantity:t.quantity,price:t.price,google_business_vertical:wpmDataLayer.pixels.google.ads.google_business_vertical}]})}))}catch(e){console.error(e)}})),jQuery(document).on("wpmViewItem",(function(e,t){try{var a,o,r,i,n,l,d,s,c;if(jQuery.isEmptyObject(null===(a=wpmDataLayer)||void 0===a||null===(o=a.pixels)||void 0===o||null===(r=o.google)||void 0===r||null===(i=r.ads)||void 0===i?void 0:i.conversionIds))return;if(null===(n=wpmDataLayer)||void 0===n||null===(l=n.pixels)||void 0===l||null===(d=l.google)||void 0===d||null===(s=d.ads)||void 0===s||null===(c=s.dynamic_remarketing)||void 0===c||!c.status)return;if(!wpm.googleConfigConditionsMet("ads"))return;wpm.gtagLoaded().then((function(){gtag("event","view_item",{send_to:wpm.getGoogleAdsConversionIdentifiers(),value:(t.quantity?t.quantity:1)*t.price,items:[{id:t.dyn_r_ids[wpmDataLayer.pixels.google.ads.dynamic_remarketing.id_type],quantity:t.quantity?t.quantity:1,price:t.price,google_business_vertical:wpmDataLayer.pixels.google.ads.google_business_vertical}]})}))}catch(e){console.error(e)}})),jQuery(document).on("wpmSearch",(function(){try{var e,t,a,o,r,i,n,l,d;if(jQuery.isEmptyObject(null===(e=wpmDataLayer)||void 0===e||null===(t=e.pixels)||void 0===t||null===(a=t.google)||void 0===a||null===(o=a.ads)||void 0===o?void 0:o.conversionIds))return;if(null===(r=wpmDataLayer)||void 0===r||null===(i=r.pixels)||void 0===i||null===(n=i.google)||void 0===n||null===(l=n.ads)||void 0===l||null===(d=l.dynamic_remarketing)||void 0===d||!d.status)return;if(!wpm.googleConfigConditionsMet("ads"))return;let u=[];for(const[e,t]of Object.entries(wpmDataLayer.products)){var s,c;if(null!==(s=wpmDataLayer)&&void 0!==s&&null!==(c=s.general)&&void 0!==c&&c.variationsOutput&&t.isVariable&&!1===wpmDataLayer.pixels.google.ads.dynamic_remarketing.send_events_with_parent_ids)return;u.push({id:t.dyn_r_ids[wpmDataLayer.pixels.google.ads.dynamic_remarketing.id_type],google_business_vertical:wpmDataLayer.pixels.google.ads.google_business_vertical})}wpm.gtagLoaded().then((function(){gtag("event","view_search_results",{send_to:wpm.getGoogleAdsConversionIdentifiers(),items:u})}))}catch(e){console.error(e)}})),jQuery(document).on("wpmOrderReceivedPage",(function(){try{var e,t,a,o,r,i,n,l,d;if(jQuery.isEmptyObject(null===(e=wpmDataLayer)||void 0===e||null===(t=e.pixels)||void 0===t||null===(a=t.google)||void 0===a||null===(o=a.ads)||void 0===o?void 0:o.conversionIds))return;if(null===(r=wpmDataLayer)||void 0===r||null===(i=r.pixels)||void 0===i||null===(n=i.google)||void 0===n||null===(l=n.ads)||void 0===l||null===(d=l.dynamic_remarketing)||void 0===d||!d.status)return;if(!wpm.googleConfigConditionsMet("ads"))return;wpm.gtagLoaded().then((function(){gtag("event","purchase",{send_to:wpm.getGoogleAdsConversionIdentifiers(),value:wpmDataLayer.order.value_filtered,items:wpm.getGoogleAdsDynamicRemarketingOrderItems()})}))}catch(e){console.error(e)}})),jQuery(document).on("wpmLogin",(function(){try{var e,t,a,o,r,i,n,l,d;if(jQuery.isEmptyObject(null===(e=wpmDataLayer)||void 0===e||null===(t=e.pixels)||void 0===t||null===(a=t.google)||void 0===a||null===(o=a.ads)||void 0===o?void 0:o.conversionIds))return;if(null===(r=wpmDataLayer)||void 0===r||null===(i=r.pixels)||void 0===i||null===(n=i.google)||void 0===n||null===(l=n.ads)||void 0===l||null===(d=l.dynamic_remarketing)||void 0===d||!d.status)return;if(!wpm.googleConfigConditionsMet("ads"))return;wpm.gtagLoaded().then((function(){gtag("event","login",{send_to:wpm.getGoogleAdsConversionIdentifiers()})}))}catch(e){console.error(e)}})),jQuery(document).on("wpmOrderReceivedPage",(function(){try{var e,t,a,o,r,i;if(jQuery.isEmptyObject(null===(e=wpmDataLayer)||void 0===e||null===(t=e.pixels)||void 0===t||null===(a=t.google)||void 0===a||null===(o=a.ads)||void 0===o?void 0:o.conversionIds))return;if(!wpm.googleConfigConditionsMet("ads"))return;let n={},l={};n={send_to:wpm.getGoogleAdsConversionIdentifiersWithLabel(),transaction_id:wpmDataLayer.order.number,value:wpmDataLayer.order.value_filtered,currency:wpmDataLayer.order.currency,new_customer:wpmDataLayer.order.new_customer},null!==(r=wpmDataLayer)&&void 0!==r&&null!==(i=r.order)&&void 0!==i&&i.aw_merchant_id&&(l={discount:wpmDataLayer.order.discount,aw_merchant_id:wpmDataLayer.order.aw_merchant_id,aw_feed_country:wpmDataLayer.order.aw_feed_country,aw_feed_language:wpmDataLayer.order.aw_feed_language,items:wpm.getGoogleAdsRegularOrderItems()}),wpm.gtagLoaded().then((function(){gtag("event","conversion",{...n,...l})}))}catch(e){console.error(e)}}))},403:()=>{window.wpm=window.wpm||{},jQuery},172:()=>{!function(e,t,a){e.getCartItemsGa4=function(){let t=[];for(const[a,o]of Object.entries(wpmDataLayer.cart)){let a={item_id:o.dyn_r_ids[wpmDataLayer.pixels.google.analytics.id_type],item_name:o.name,quantity:o.quantity,item_brand:o.brand,item_variant:o.variant,price:o.price,currency:wpmDataLayer.shop.currency};a=e.getFormattedGA4Categories(a,o.category),t.push(a)}return t}}(window.wpm=window.wpm||{},jQuery),jQuery(document).on("wpmViewItemList",(function(e,t){try{var a,o,r,i,n,l,d,s,c;if(null===(a=wpmDataLayer)||void 0===a||null===(o=a.pixels)||void 0===o||null===(r=o.google)||void 0===r||null===(i=r.analytics)||void 0===i||!i.eec)return;if(null===(n=wpmDataLayer)||void 0===n||null===(l=n.pixels)||void 0===l||null===(d=l.google)||void 0===d||null===(s=d.analytics)||void 0===s||null===(c=s.ga4)||void 0===c||!c.measurement_id)return;if(!wpm.googleConfigConditionsMet("analytics"))return;let e={item_id:t.dyn_r_ids[wpmDataLayer.pixels.google.analytics.id_type],item_name:t.name,index:t.list_position,item_list_name:wpmDataLayer.shop.list_name,item_list_id:wpmDataLayer.shop.list_id,item_brand:t.brand,item_variant:t.variant,price:t.price,currency:wpmDataLayer.shop.currency,quantity:t.quantity};e=wpm.getFormattedGA4Categories(e,t.category),wpm.gtagLoaded().then((function(){gtag("event","view_item_list",{send_to:wpmDataLayer.pixels.google.analytics.ga4.measurement_id,items:[e],item_list_name:wpmDataLayer.shop.list_name,item_list_id:wpmDataLayer.shop.list_id})}))}catch(e){console.error(e)}})),jQuery(document).on("wpmSelectItem",(function(e,t){try{var a,o,r,i,n,l,d,s,c;if(null===(a=wpmDataLayer)||void 0===a||null===(o=a.pixels)||void 0===o||null===(r=o.google)||void 0===r||null===(i=r.analytics)||void 0===i||!i.eec)return;if(null===(n=wpmDataLayer)||void 0===n||null===(l=n.pixels)||void 0===l||null===(d=l.google)||void 0===d||null===(s=d.analytics)||void 0===s||null===(c=s.ga4)||void 0===c||!c.measurement_id)return;if(!wpm.googleConfigConditionsMet("analytics"))return;let e={item_id:t.dyn_r_ids[wpmDataLayer.pixels.google.analytics.id_type],item_name:t.name,index:t.list_position,item_list_name:wpmDataLayer.shop.list_name,item_list_id:wpmDataLayer.shop.list_id,item_brand:t.brand,item_variant:t.variant,price:t.price,currency:wpmDataLayer.shop.currency,quantity:t.quantity};e=wpm.getFormattedGA4Categories(e,t.category),wpm.gtagLoaded().then((function(){gtag("event","select_item",{send_to:wpmDataLayer.pixels.google.analytics.ga4.measurement_id,items:[e]})}))}catch(e){console.error(e)}})),jQuery(document).on("wpmAddToCart",(function(e,t){try{var a,o,r,i,n,l,d,s,c;if(null===(a=wpmDataLayer)||void 0===a||null===(o=a.pixels)||void 0===o||null===(r=o.google)||void 0===r||null===(i=r.analytics)||void 0===i||!i.eec)return;if(null===(n=wpmDataLayer)||void 0===n||null===(l=n.pixels)||void 0===l||null===(d=l.google)||void 0===d||null===(s=d.analytics)||void 0===s||null===(c=s.ga4)||void 0===c||!c.measurement_id)return;if(!wpm.googleConfigConditionsMet("analytics"))return;let e={item_name:t.name,item_id:t.dyn_r_ids[wpmDataLayer.pixels.google.analytics.id_type],item_list_name:wpmDataLayer.shop.list_name,item_list_id:wpmDataLayer.shop.list_id,item_brand:t.brand,item_variant:t.variant,price:t.price,currency:wpmDataLayer.shop.currency,quantity:t.quantity};e=wpm.getFormattedGA4Categories(e,t.category),wpm.gtagLoaded().then((function(){gtag("event","add_to_cart",{send_to:wpmDataLayer.pixels.google.analytics.ga4.measurement_id,currency:wpmDataLayer.shop.currency,items:[e]})}))}catch(e){console.error(e)}})),jQuery(document).on("wpmViewItem",(function(e,t){try{var a,o,r,i,n,l,d,s,c;if(null===(a=wpmDataLayer)||void 0===a||null===(o=a.pixels)||void 0===o||null===(r=o.google)||void 0===r||null===(i=r.analytics)||void 0===i||!i.eec)return;if(null===(n=wpmDataLayer)||void 0===n||null===(l=n.pixels)||void 0===l||null===(d=l.google)||void 0===d||null===(s=d.analytics)||void 0===s||null===(c=s.ga4)||void 0===c||!c.measurement_id)return;if(!wpm.googleConfigConditionsMet("analytics"))return;let e={item_id:t.dyn_r_ids[wpmDataLayer.pixels.google.analytics.id_type],item_name:t.name,item_brand:t.brand,item_variant:t.variant,price:t.price,currency:wpmDataLayer.shop.currency,quantity:1,item_list_name:wpmDataLayer.shop.list_name,item_list_id:wpmDataLayer.shop.list_id};e=wpm.getFormattedGA4Categories(e,t.category),wpm.gtagLoaded().then((function(){gtag("event","view_item",{send_to:wpmDataLayer.pixels.google.analytics.ga4.measurement_id,currency:wpmDataLayer.shop.currency,items:[e]})}))}catch(e){console.error(e)}})),jQuery(document).on("wpmAddToWishlist",(function(e,t){try{var a,o,r,i,n,l,d,s,c;if(null===(a=wpmDataLayer)||void 0===a||null===(o=a.pixels)||void 0===o||null===(r=o.google)||void 0===r||null===(i=r.analytics)||void 0===i||!i.eec)return;if(null===(n=wpmDataLayer)||void 0===n||null===(l=n.pixels)||void 0===l||null===(d=l.google)||void 0===d||null===(s=d.analytics)||void 0===s||null===(c=s.ga4)||void 0===c||!c.measurement_id)return;if(!wpm.googleConfigConditionsMet("analytics"))return;let e={item_id:t.dyn_r_ids[wpmDataLayer.pixels.google.analytics.id_type],item_name:t.name,quantity:1,item_brand:t.brand,item_variant:t.variant,price:t.price,currency:wpmDataLayer.shop.currency};e=wpm.getFormattedGA4Categories(e,t.category),wpm.gtagLoaded().then((function(){gtag("event","add_to_wishlist",{send_to:wpmDataLayer.pixels.google.analytics.ga4.measurement_id,currency:wpmDataLayer.shop.currency,items:[e]})}))}catch(e){console.error(e)}})),jQuery(document).on("wpmRemoveFromCart",(function(e,t){try{var a,o,r,i,n,l,d,s,c;if(null===(a=wpmDataLayer)||void 0===a||null===(o=a.pixels)||void 0===o||null===(r=o.google)||void 0===r||null===(i=r.analytics)||void 0===i||!i.eec)return;if(null===(n=wpmDataLayer)||void 0===n||null===(l=n.pixels)||void 0===l||null===(d=l.google)||void 0===d||null===(s=d.analytics)||void 0===s||null===(c=s.ga4)||void 0===c||!c.measurement_id)return;if(!wpm.googleConfigConditionsMet("analytics"))return;let e={item_id:t.dyn_r_ids[wpmDataLayer.pixels.google.analytics.id_type],item_name:t.name,item_brand:t.brand,item_variant:t.variant,price:t.price,currency:wpmDataLayer.shop.currency,quantity:t.quantity};e=wpm.getFormattedGA4Categories(e,t.category),wpm.gtagLoaded().then((function(){gtag("event","remove_from_cart",{send_to:wpmDataLayer.pixels.google.analytics.ga4.measurement_id,currency:wpmDataLayer.shop.currency,items:[e]})}))}catch(e){console.error(e)}})),jQuery(document).on("wpmBeginCheckout",(function(e){try{var t,a,o,r,i,n,l,d,s;if(null===(t=wpmDataLayer)||void 0===t||null===(a=t.pixels)||void 0===a||null===(o=a.google)||void 0===o||null===(r=o.analytics)||void 0===r||!r.eec)return;if(null===(i=wpmDataLayer)||void 0===i||null===(n=i.pixels)||void 0===n||null===(l=n.google)||void 0===l||null===(d=l.analytics)||void 0===d||null===(s=d.ga4)||void 0===s||!s.measurement_id)return;if(!wpm.googleConfigConditionsMet("analytics"))return;wpm.gtagLoaded().then((function(){gtag("event","begin_checkout",{send_to:wpmDataLayer.pixels.google.analytics.ga4.measurement_id,currency:wpmDataLayer.shop.currency,items:wpm.getCartItemsGa4()})}))}catch(e){console.error(e)}})),jQuery(document).on("wpmViewCart",(function(e){try{var t,a,o,r,i,n,l,d,s;if(null===(t=wpmDataLayer)||void 0===t||null===(a=t.pixels)||void 0===a||null===(o=a.google)||void 0===o||null===(r=o.analytics)||void 0===r||!r.eec)return;if(null===(i=wpmDataLayer)||void 0===i||null===(n=i.pixels)||void 0===n||null===(l=n.google)||void 0===l||null===(d=l.analytics)||void 0===d||null===(s=d.ga4)||void 0===s||!s.measurement_id)return;if(!wpm.googleConfigConditionsMet("analytics"))return;if(jQuery.isEmptyObject(wpmDataLayer.cart))return;let e=[],c=null;for(const[t,a]of Object.entries(wpmDataLayer.cart)){let t={item_id:a.dyn_r_ids[wpmDataLayer.pixels.google.analytics.id_type],item_name:a.name,quantity:a.quantity,item_brand:a.brand,item_list_name:wpmDataLayer.shop.list_name,item_list_id:wpmDataLayer.shop.list_id,item_variant:a.variant,price:a.price,currency:wpmDataLayer.shop.currency};t=wpm.getFormattedGA4Categories(t,a.category),e.push(t),c+=a.quantity*a.price}wpm.gtagLoaded().then((function(){gtag("event","view_cart",{send_to:wpmDataLayer.pixels.google.analytics.ga4.measurement_id,currency:wpmDataLayer.shop.currency,value:c.toFixed(2),items:e})}))}catch(e){console.error(e)}})),jQuery(document).on("wpmSearch",(function(){try{var e,t,a,o,r,i,n,l,d;if(null===(e=wpmDataLayer)||void 0===e||null===(t=e.pixels)||void 0===t||null===(a=t.google)||void 0===a||null===(o=a.analytics)||void 0===o||!o.eec)return;if(null===(r=wpmDataLayer)||void 0===r||null===(i=r.pixels)||void 0===i||null===(n=i.google)||void 0===n||null===(l=n.analytics)||void 0===l||null===(d=l.ga4)||void 0===d||!d.measurement_id)return;if(!wpm.googleConfigConditionsMet("analytics"))return;let s=[];for(const[e,t]of Object.entries(wpmDataLayer.products)){let e={item_id:t.dyn_r_ids[wpmDataLayer.pixels.google.analytics.id_type],item_name:t.name,quantity:1,index:t.position,item_brand:t.brand,item_list_name:wpmDataLayer.shop.list_name,item_list_id:wpmDataLayer.shop.list_id,item_variant:t.variant,price:t.price,currency:wpmDataLayer.shop.currency};e=wpm.getFormattedGA4Categories(e,t.category),s.push(e)}wpm.gtagLoaded().then((function(){gtag("event","view_search_results",{send_to:wpmDataLayer.pixels.google.analytics.ga4.measurement_id,search_term:wpm.getSearchTermFromUrl(),items:s})}))}catch(e){console.error(e)}})),jQuery(document).on("wpmLogin",(function(){try{var e,t,a,o,r,i,n,l,d;if(null===(e=wpmDataLayer)||void 0===e||null===(t=e.pixels)||void 0===t||null===(a=t.google)||void 0===a||null===(o=a.analytics)||void 0===o||!o.eec)return;if(null===(r=wpmDataLayer)||void 0===r||null===(i=r.pixels)||void 0===i||null===(n=i.google)||void 0===n||null===(l=n.analytics)||void 0===l||null===(d=l.ga4)||void 0===d||!d.measurement_id)return;if(!wpm.googleConfigConditionsMet("analytics"))return;wpm.gtagLoaded().then((function(){gtag("event","login",{send_to:wpmDataLayer.pixels.google.analytics.ga4.measurement_id})}))}catch(e){console.error(e)}}))},464:()=>{!function(e,t,a){e.getGA4OrderItems=function(){let e=[];for(const[o,r]of Object.entries(wpmDataLayer.order.items)){var t,a;let o;o={quantity:r.quantity,price:r.price,item_name:r.name,currency:wpmDataLayer.order.currency,item_category:wpmDataLayer.products[r.id].category.join("/")},null!==(t=wpmDataLayer)&&void 0!==t&&null!==(a=t.general)&&void 0!==a&&a.variationsOutput&&0!==r.variation_id?(o.item_id=String(wpmDataLayer.products[r.variation_id].dyn_r_ids[wpmDataLayer.pixels.google.analytics.id_type]),o.item_variant=wpmDataLayer.products[r.variation_id].variant_name,o.item_brand=wpmDataLayer.products[r.variation_id].brand,e.push(o)):(o.item_id=String(wpmDataLayer.products[r.id].dyn_r_ids[wpmDataLayer.pixels.google.analytics.id_type]),o.item_brand=wpmDataLayer.products[r.id].brand,e.push(o))}return e}}(window.wpm=window.wpm||{},jQuery),jQuery(document).on("wpmOrderReceivedPage",(function(){try{var e,t,a,o,r,i,n,l,d,s;if(null===(e=wpmDataLayer)||void 0===e||null===(t=e.pixels)||void 0===t||null===(a=t.google)||void 0===a||null===(o=a.analytics)||void 0===o||null===(r=o.ga4)||void 0===r||!r.measurement_id)return;if(null!==(i=wpmDataLayer)&&void 0!==i&&null!==(n=i.pixels)&&void 0!==n&&null!==(l=n.google)&&void 0!==l&&null!==(d=l.analytics)&&void 0!==d&&null!==(s=d.ga4)&&void 0!==s&&s.mp_active)return;if(!wpm.googleConfigConditionsMet("analytics"))return;wpm.gtagLoaded().then((function(){gtag("event","purchase",{send_to:[wpmDataLayer.pixels.google.analytics.ga4.measurement_id],transaction_id:wpmDataLayer.order.number,affiliation:wpmDataLayer.order.affiliation,currency:wpmDataLayer.order.currency,value:wpmDataLayer.order.value_regular,discount:wpmDataLayer.order.discount,tax:wpmDataLayer.order.tax,shipping:wpmDataLayer.order.shipping,coupon:wpmDataLayer.order.coupon,items:wpm.getGA4OrderItems()})}))}catch(e){console.error(e)}}))},271:()=>{!function(e,t,a){e.getCartItemsGaUa=function(){let e=[];for(const[t,a]of Object.entries(wpmDataLayer.cart))e.push({id:a.dyn_r_ids[wpmDataLayer.pixels.google.analytics.id_type],name:a.name,brand:a.brand,category:a.category.join(","),price:a.price,quantity:a.quantity,variant:a.variant});return e}}(window.wpm=window.wpm||{},jQuery),jQuery(document).on("wpmViewItemList",(function(e,t){try{var a,o,r,i,n,l,d,s,c;if(null===(a=wpmDataLayer)||void 0===a||null===(o=a.pixels)||void 0===o||null===(r=o.google)||void 0===r||null===(i=r.analytics)||void 0===i||!i.eec)return;if(null===(n=wpmDataLayer)||void 0===n||null===(l=n.pixels)||void 0===l||null===(d=l.google)||void 0===d||null===(s=d.analytics)||void 0===s||null===(c=s.universal)||void 0===c||!c.property_id)return;if(!wpm.googleConfigConditionsMet("analytics"))return;wpm.gtagLoaded().then((function(){gtag("event","view_item_list",{send_to:wpmDataLayer.pixels.google.analytics.universal.property_id,items:[{id:t.dyn_r_ids[wpmDataLayer.pixels.google.analytics.id_type],name:t.name,brand:t.brand,category:t.category.join(","),list_name:wpmDataLayer.shop.list_name,list_position:t.list_position,price:t.price,quantity:t.quantity,variant:t.variant}]})}))}catch(e){console.error(e)}})),jQuery(document).on("wpmSelectContentGaUa",(function(e,t){try{var a,o,r,i,n,l,d,s,c;if(null===(a=wpmDataLayer)||void 0===a||null===(o=a.pixels)||void 0===o||null===(r=o.google)||void 0===r||null===(i=r.analytics)||void 0===i||!i.eec)return;if(null===(n=wpmDataLayer)||void 0===n||null===(l=n.pixels)||void 0===l||null===(d=l.google)||void 0===d||null===(s=d.analytics)||void 0===s||null===(c=s.universal)||void 0===c||!c.property_id)return;if(!wpm.googleConfigConditionsMet("analytics"))return;wpm.gtagLoaded().then((function(){gtag("event","select_content",{send_to:wpmDataLayer.pixels.google.analytics.universal.property_id,content_type:"product",items:[{id:t.dyn_r_ids[wpmDataLayer.pixels.google.analytics.id_type],name:t.name,list_name:wpmDataLayer.shop.list_name,brand:t.brand,category:t.category.join(","),variant:t.variant,list_position:t.list_position,quantity:t.quantity,price:t.price}]})}))}catch(e){console.error(e)}})),jQuery(document).on("wpmAddToCart",(function(e,t){try{var a,o,r,i,n,l,d,s,c;if(null===(a=wpmDataLayer)||void 0===a||null===(o=a.pixels)||void 0===o||null===(r=o.google)||void 0===r||null===(i=r.analytics)||void 0===i||!i.eec)return;if(null===(n=wpmDataLayer)||void 0===n||null===(l=n.pixels)||void 0===l||null===(d=l.google)||void 0===d||null===(s=d.analytics)||void 0===s||null===(c=s.universal)||void 0===c||!c.property_id)return;if(!wpm.googleConfigConditionsMet("analytics"))return;wpm.gtagLoaded().then((function(){gtag("event","add_to_cart",{send_to:wpmDataLayer.pixels.google.analytics.universal.property_id,currency:wpmDataLayer.shop.currency,items:[{id:t.dyn_r_ids[wpmDataLayer.pixels.google.analytics.id_type],name:t.name,list_name:wpmDataLayer.shop.list_name,brand:t.brand,category:t.category.join(","),variant:t.variant,list_position:t.list_position,quantity:t.quantity,price:t.price}]})}))}catch(e){console.error(e)}})),jQuery(document).on("wpmViewItem",(function(e,t){try{var a,o,r,i,n,l,d,s,c;if(null===(a=wpmDataLayer)||void 0===a||null===(o=a.pixels)||void 0===o||null===(r=o.google)||void 0===r||null===(i=r.analytics)||void 0===i||!i.eec)return;if(null===(n=wpmDataLayer)||void 0===n||null===(l=n.pixels)||void 0===l||null===(d=l.google)||void 0===d||null===(s=d.analytics)||void 0===s||null===(c=s.universal)||void 0===c||!c.property_id)return;if(!wpm.googleConfigConditionsMet("analytics"))return;wpm.gtagLoaded().then((function(){gtag("event","view_item",{send_to:wpmDataLayer.pixels.google.analytics.universal.property_id,items:[{id:t.dyn_r_ids[wpmDataLayer.pixels.google.analytics.id_type],name:t.name,list_name:wpmDataLayer.shop.list_name,brand:t.brand,category:t.category.join(","),variant:t.variant,list_position:1,quantity:1,price:t.price}]})}))}catch(e){console.error(e)}})),jQuery(document).on("wpmAddToWishlist",(function(e,t){try{var a,o,r,i,n,l,d,s,c;if(null===(a=wpmDataLayer)||void 0===a||null===(o=a.pixels)||void 0===o||null===(r=o.google)||void 0===r||null===(i=r.analytics)||void 0===i||!i.eec)return;if(null===(n=wpmDataLayer)||void 0===n||null===(l=n.pixels)||void 0===l||null===(d=l.google)||void 0===d||null===(s=d.analytics)||void 0===s||null===(c=s.universal)||void 0===c||!c.property_id)return;if(!wpm.googleConfigConditionsMet("analytics"))return;wpm.gtagLoaded().then((function(){gtag("event","add_to_wishlist",{send_to:wpmDataLayer.pixels.google.analytics.universal.property_id,items:[{id:t.dyn_r_ids[wpmDataLayer.pixels.google.analytics.id_type],name:t.name,brand:t.brand,category:t.category.join(","),list_name:wpmDataLayer.shop.list_name,list_position:t.position,price:t.price,quantity:1,variant:t.variant}]})}))}catch(e){console.error(e)}})),jQuery(document).on("wpmRemoveFromCart",(function(e,t){try{var a,o,r,i,n,l,d,s,c;if(null===(a=wpmDataLayer)||void 0===a||null===(o=a.pixels)||void 0===o||null===(r=o.google)||void 0===r||null===(i=r.analytics)||void 0===i||!i.eec)return;if(null===(n=wpmDataLayer)||void 0===n||null===(l=n.pixels)||void 0===l||null===(d=l.google)||void 0===d||null===(s=d.analytics)||void 0===s||null===(c=s.universal)||void 0===c||!c.property_id)return;if(!wpm.googleConfigConditionsMet("analytics"))return;wpm.gtagLoaded().then((function(){gtag("event","remove_from_cart",{send_to:wpmDataLayer.pixels.google.analytics.universal.property_id,currency:wpmDataLayer.shop.currency,items:[{id:t.dyn_r_ids[wpmDataLayer.pixels.google.analytics.id_type],name:t.name,list_name:wpmDataLayer.shop.list_name,brand:t.brand,category:t.category.join(","),variant:t.variant,quantity:t.quantity,price:t.price}]})}))}catch(e){console.error(e)}})),jQuery(document).on("wpmBeginCheckout",(function(e){try{var t,a,o,r,i,n,l,d,s;if(null===(t=wpmDataLayer)||void 0===t||null===(a=t.pixels)||void 0===a||null===(o=a.google)||void 0===o||null===(r=o.analytics)||void 0===r||!r.eec)return;if(null===(i=wpmDataLayer)||void 0===i||null===(n=i.pixels)||void 0===n||null===(l=n.google)||void 0===l||null===(d=l.analytics)||void 0===d||null===(s=d.universal)||void 0===s||!s.property_id)return;if(!wpm.googleConfigConditionsMet("analytics"))return;wpm.gtagLoaded().then((function(){gtag("event","begin_checkout",{send_to:wpmDataLayer.pixels.google.analytics.universal.property_id,currency:wpmDataLayer.shop.currency,items:wpm.getCartItemsGaUa()})}))}catch(e){console.error(e)}})),jQuery(document).on("wpmFireCheckoutOption",(function(e,t){try{var a,o,r,i,n,l,d,s,c;if(null===(a=wpmDataLayer)||void 0===a||null===(o=a.pixels)||void 0===o||null===(r=o.google)||void 0===r||null===(i=r.analytics)||void 0===i||!i.eec)return;if(null===(n=wpmDataLayer)||void 0===n||null===(l=n.pixels)||void 0===l||null===(d=l.google)||void 0===d||null===(s=d.analytics)||void 0===s||null===(c=s.universal)||void 0===c||!c.property_id)return;if(!wpm.googleConfigConditionsMet("analytics"))return;wpm.gtagLoaded().then((function(){gtag("event","set_checkout_option",{send_to:wpmDataLayer.pixels.google.analytics.universal.property_id,checkout_step:t.step,checkout_option:t.checkout_option,value:t.value})}))}catch(e){console.error(e)}})),jQuery(document).on("wpmFireCheckoutProgress",(function(e,t){try{var a,o,r,i,n,l,d,s,c;if(null===(a=wpmDataLayer)||void 0===a||null===(o=a.pixels)||void 0===o||null===(r=o.google)||void 0===r||null===(i=r.analytics)||void 0===i||!i.eec)return;if(null===(n=wpmDataLayer)||void 0===n||null===(l=n.pixels)||void 0===l||null===(d=l.google)||void 0===d||null===(s=d.analytics)||void 0===s||null===(c=s.universal)||void 0===c||!c.property_id)return;if(!wpm.googleConfigConditionsMet("analytics"))return;wpm.gtagLoaded().then((function(){gtag("event","checkout_progress",{send_to:wpmDataLayer.pixels.google.analytics.universal.property_id,checkout_step:t.step})}))}catch(e){console.error(e)}})),jQuery(document).on("wpmSearch",(function(){try{var e,t,a,o,r,i,n,l,d;if(null===(e=wpmDataLayer)||void 0===e||null===(t=e.pixels)||void 0===t||null===(a=t.google)||void 0===a||null===(o=a.analytics)||void 0===o||!o.eec)return;if(null===(r=wpmDataLayer)||void 0===r||null===(i=r.pixels)||void 0===i||null===(n=i.google)||void 0===n||null===(l=n.analytics)||void 0===l||null===(d=l.universal)||void 0===d||!d.property_id)return;if(!wpm.googleConfigConditionsMet("analytics"))return;let s=[];for(const[e,t]of Object.entries(wpmDataLayer.products))s.push({id:t.dyn_r_ids[wpmDataLayer.pixels.google.analytics.id_type],name:t.name,quantity:1,list_position:t.position,brand:t.brand,category:t.category.join(","),list_name:wpmDataLayer.shop.list_name,variant:t.variant,price:t.price});wpm.gtagLoaded().then((function(){gtag("event","view_search_results",{send_to:wpmDataLayer.pixels.google.analytics.universal.property_id,search_term:wpm.getSearchTermFromUrl(),items:s})}))}catch(e){console.error(e)}})),jQuery(document).on("wpmLogin",(function(){try{var e,t,a,o,r,i,n,l,d;if(null===(e=wpmDataLayer)||void 0===e||null===(t=e.pixels)||void 0===t||null===(a=t.google)||void 0===a||null===(o=a.analytics)||void 0===o||!o.eec)return;if(null===(r=wpmDataLayer)||void 0===r||null===(i=r.pixels)||void 0===i||null===(n=i.google)||void 0===n||null===(l=n.analytics)||void 0===l||null===(d=l.universal)||void 0===d||!d.property_id)return;if(!wpm.googleConfigConditionsMet("analytics"))return;wpm.gtagLoaded().then((function(){gtag("event","login",{send_to:wpmDataLayer.pixels.google.analytics.universal.property_id})}))}catch(e){console.error(e)}}))},354:()=>{!function(e,t,a){e.getGAUAOrderItems=function(){let e=[],t=1;for(const[r,i]of Object.entries(wpmDataLayer.order.items)){var a,o;let r;r={quantity:i.quantity,price:i.price,item_name:i.name,currency:wpmDataLayer.order.currency,item_category:wpmDataLayer.products[i.id].category.join("/"),list_position:t},null!==(a=wpmDataLayer)&&void 0!==a&&null!==(o=a.general)&&void 0!==o&&o.variationsOutput&&0!==i.variation_id?(r.id=String(wpmDataLayer.products[i.variation_id].dyn_r_ids[wpmDataLayer.pixels.google.analytics.id_type]),r.variant=wpmDataLayer.products[i.variation_id].variant_name,r.item_brand=wpmDataLayer.products[i.variation_id].brand,e.push(r)):(r.id=String(wpmDataLayer.products[i.id].dyn_r_ids[wpmDataLayer.pixels.google.analytics.id_type]),r.item_brand=wpmDataLayer.products[i.id].brand,e.push(r)),t++}return e}}(window.wpm=window.wpm||{},jQuery),jQuery(document).on("wpmOrderReceivedPage",(function(){try{var e,t,a,o,r,i,n,l,d,s;if(null===(e=wpmDataLayer)||void 0===e||null===(t=e.pixels)||void 0===t||null===(a=t.google)||void 0===a||null===(o=a.analytics)||void 0===o||null===(r=o.universal)||void 0===r||!r.property_id)return;if(null!==(i=wpmDataLayer)&&void 0!==i&&null!==(n=i.pixels)&&void 0!==n&&null!==(l=n.google)&&void 0!==l&&null!==(d=l.analytics)&&void 0!==d&&null!==(s=d.universal)&&void 0!==s&&s.mp_active)return;if(!wpm.googleConfigConditionsMet("analytics"))return;wpm.gtagLoaded().then((function(){gtag("event","purchase",{send_to:[wpmDataLayer.pixels.google.analytics.universal.property_id],transaction_id:wpmDataLayer.order.number,affiliation:wpmDataLayer.order.affiliation,currency:wpmDataLayer.order.currency,value:wpmDataLayer.order.value_regular,discount:wpmDataLayer.order.discount,tax:wpmDataLayer.order.tax,shipping:wpmDataLayer.order.shipping,coupon:wpmDataLayer.order.coupon,items:wpm.getGAUAOrderItems()})}))}catch(e){console.error(e)}}))},497:()=>{!function(e,t,a){e.load_google_optimize_pixel=function(){try{var t,a,o,r;null!==(t=wpmDataLayer)&&void 0!==t&&null!==(a=t.pixels)&&void 0!==a&&null!==(o=a.google)&&void 0!==o&&null!==(r=o.optimize)&&void 0!==r&&r.container_id&&(wpmDataLayer.pixels.google.optimize.loaded=!0,e.loadScriptAndCacheIt("https://www.googleoptimize.com/optimize.js?id="+wpmDataLayer.pixels.google.optimize.container_id))}catch(e){console.error(e)}}}(window.wpm=window.wpm||{},jQuery),jQuery(document).on("wpmLoadPixels",(function(){var e,t,a,o;!wpm.canIFire("analytics","google-optimize")||null!==(e=wpmDataLayer)&&void 0!==e&&null!==(t=e.pixels)&&void 0!==t&&null!==(a=t.google)&&void 0!==a&&null!==(o=a.optimize)&&void 0!==o&&o.loaded||wpm.load_google_optimize_pixel()}))},577:()=>{!function(e,t,a){e.googleConfigConditionsMet=function(t){var a,o,r,i;return!(null===(a=wpmDataLayer)||void 0===a||null===(o=a.pixels)||void 0===o||null===(r=o.google)||void 0===r||null===(i=r.consent_mode)||void 0===i||!i.active)||("category"===e.getConsentValues().mode?!0===e.getConsentValues().categories[t]:"pixel"===e.getConsentValues().mode&&e.getConsentValues().pixels.includes("google-"+t))},e.getVisitorConsentStatusAndUpdateGoogleConsentSettings=function(t){return"category"===e.getConsentValues().mode?(e.getConsentValues().categories.analytics&&(t.analytics_storage="granted"),e.getConsentValues().categories.ads&&(t.ad_storage="granted")):"pixel"===e.getConsentValues().mode&&(t.analytics_storage=e.getConsentValues().pixels.includes("google-analytics")?"granted":"denied",t.ad_storage=e.getConsentValues().pixels.includes("google-ads")?"granted":"denied"),t},e.updateGoogleConsentMode=function(){let e=!(arguments.length>0&&arguments[0]!==a)||arguments[0],t=!(arguments.length>1&&arguments[1]!==a)||arguments[1];try{if(!window.gtag||!wpmDataLayer.shop.cookie_consent_mgmt.explicit_consent)return;gtag("consent","update",{analytics_storage:e?"granted":"denied",ad_storage:t?"granted":"denied"})}catch(e){console.error(e)}},e.fireGtagGoogleAds=function(){try{var e,t,a,o,r,i,n,l,d,s,c,u,p,m,y,g,w,v,_,f,L;if(wpmDataLayer.pixels.google.ads.state="loading",null!==(e=wpmDataLayer)&&void 0!==e&&null!==(t=e.pixels)&&void 0!==t&&null!==(a=t.google)&&void 0!==a&&null!==(o=a.ads)&&void 0!==o&&null!==(r=o.enhanced_conversions)&&void 0!==r&&r.active)for(const[e,t]of Object.entries(wpmDataLayer.pixels.google.ads.conversionIds))gtag("config",e,{allow_enhanced_conversions:!0});else for(const[e,t]of Object.entries(wpmDataLayer.pixels.google.ads.conversionIds))gtag("config",e);null!==(i=wpmDataLayer)&&void 0!==i&&null!==(n=i.pixels)&&void 0!==n&&null!==(l=n.google)&&void 0!==l&&null!==(d=l.ads)&&void 0!==d&&d.conversionIds&&null!==(s=wpmDataLayer)&&void 0!==s&&null!==(c=s.pixels)&&void 0!==c&&null!==(u=c.google)&&void 0!==u&&null!==(p=u.ads)&&void 0!==p&&p.phone_conversion_label&&null!==(m=wpmDataLayer)&&void 0!==m&&null!==(y=m.pixels)&&void 0!==y&&null!==(g=y.google)&&void 0!==g&&null!==(w=g.ads)&&void 0!==w&&w.phone_conversion_number&>ag("config",Object.keys(wpmDataLayer.pixels.google.ads.conversionIds)[0]+"/"+wpmDataLayer.pixels.google.ads.phone_conversion_label,{phone_conversion_number:wpmDataLayer.pixels.google.ads.phone_conversion_number}),"order_received_page"===wpmDataLayer.shop.page_type&&null!==(v=wpmDataLayer)&&void 0!==v&&null!==(_=v.order)&&void 0!==_&&null!==(f=_.google)&&void 0!==f&&null!==(L=f.ads)&&void 0!==L&&L.enhanced_conversion_data&&(window.enhanced_conversion_data=wpmDataLayer.order.google.ads.enhanced_conversion_data),wpmDataLayer.pixels.google.ads.state="ready"}catch(e){console.error(e)}},e.fireGtagGoogleAnalyticsUA=function(){try{wpmDataLayer.pixels.google.analytics.universal.state="loading",gtag("config",wpmDataLayer.pixels.google.analytics.universal.property_id,wpmDataLayer.pixels.google.analytics.universal.parameters),wpmDataLayer.pixels.google.analytics.universal.state="ready"}catch(e){console.error(e)}},e.fireGtagGoogleAnalyticsGA4=function(){try{wpmDataLayer.pixels.google.analytics.ga4.state="loading",gtag("config",wpmDataLayer.pixels.google.analytics.ga4.measurement_id,wpmDataLayer.pixels.google.analytics.ga4.parameters),wpmDataLayer.pixels.google.analytics.ga4.state="ready"}catch(e){console.error(e)}},e.isGoogleActive=function(){var e,t,a,o,r,i,n,l,d,s,c,u,p,m;return!(!(null!==(e=wpmDataLayer)&&void 0!==e&&null!==(t=e.pixels)&&void 0!==t&&null!==(a=t.google)&&void 0!==a&&null!==(o=a.analytics)&&void 0!==o&&null!==(r=o.universal)&&void 0!==r&&r.property_id||null!==(i=wpmDataLayer)&&void 0!==i&&null!==(n=i.pixels)&&void 0!==n&&null!==(l=n.google)&&void 0!==l&&null!==(d=l.analytics)&&void 0!==d&&null!==(s=d.ga4)&&void 0!==s&&s.measurement_id)&&jQuery.isEmptyObject(null===(c=wpmDataLayer)||void 0===c||null===(u=c.pixels)||void 0===u||null===(p=u.google)||void 0===p||null===(m=p.ads)||void 0===m?void 0:m.conversionIds))},e.getGoogleGtagId=function(){var e,t,a,o,r,i,n,l,d,s;return null!==(e=wpmDataLayer)&&void 0!==e&&null!==(t=e.pixels)&&void 0!==t&&null!==(a=t.google)&&void 0!==a&&null!==(o=a.analytics)&&void 0!==o&&null!==(r=o.universal)&&void 0!==r&&r.property_id?wpmDataLayer.pixels.google.analytics.universal.property_id:null!==(i=wpmDataLayer)&&void 0!==i&&null!==(n=i.pixels)&&void 0!==n&&null!==(l=n.google)&&void 0!==l&&null!==(d=l.analytics)&&void 0!==d&&null!==(s=d.ga4)&&void 0!==s&&s.measurement_id?wpmDataLayer.pixels.google.analytics.ga4.measurement_id:Object.keys(wpmDataLayer.pixels.google.ads.conversionIds)[0]},e.loadGoogle=function(){e.isGoogleActive()&&(wpmDataLayer.pixels.google.state="loading",e.loadScriptAndCacheIt("https://www.googletagmanager.com/gtag/js?id="+e.getGoogleGtagId()).done((function(t,a){try{var o,r,i,n,l,d,s,c,u,p,m,y,g,w,v,_,f,L,h,D,x,k;if(window.dataLayer=window.dataLayer||[],window.gtag=function(){dataLayer.push(arguments)},null!==(o=wpmDataLayer)&&void 0!==o&&null!==(r=o.pixels)&&void 0!==r&&null!==(i=r.google)&&void 0!==i&&null!==(n=i.consent_mode)&&void 0!==n&&n.active){var C,j,b,I;let t={ad_storage:wpmDataLayer.pixels.google.consent_mode.ad_storage,analytics_storage:wpmDataLayer.pixels.google.consent_mode.analytics_storage,wait_for_update:wpmDataLayer.pixels.google.consent_mode.wait_for_update};null!==(C=wpmDataLayer)&&void 0!==C&&null!==(j=C.pixels)&&void 0!==j&&null!==(b=j.google)&&void 0!==b&&null!==(I=b.consent_mode)&&void 0!==I&&I.region&&(t.region=wpmDataLayer.pixels.google.consent_mode.region),t=e.getVisitorConsentStatusAndUpdateGoogleConsentSettings(t),gtag("consent","default",t),gtag("set","ads_data_redaction",wpmDataLayer.pixels.google.consent_mode.ads_data_redaction),gtag("set","url_passthrough",wpmDataLayer.pixels.google.consent_mode.url_passthrough)}null!==(l=wpmDataLayer)&&void 0!==l&&null!==(d=l.pixels)&&void 0!==d&&null!==(s=d.google)&&void 0!==s&&null!==(c=s.linker)&&void 0!==c&&c.settings&>ag("set","linker",wpmDataLayer.pixels.google.linker.settings),gtag("js",new Date),e.googleConfigConditionsMet("ads")&&!jQuery.isEmptyObject(null===(u=wpmDataLayer)||void 0===u||null===(p=u.pixels)||void 0===p||null===(m=p.google)||void 0===m||null===(y=m.ads)||void 0===y?void 0:y.conversionIds)&&e.fireGtagGoogleAds(),e.googleConfigConditionsMet("analytics")&&null!==(g=wpmDataLayer)&&void 0!==g&&null!==(w=g.pixels)&&void 0!==w&&null!==(v=w.google)&&void 0!==v&&null!==(_=v.analytics)&&void 0!==_&&null!==(f=_.universal)&&void 0!==f&&f.property_id&&e.fireGtagGoogleAnalyticsUA(),e.googleConfigConditionsMet("analytics")&&null!==(L=wpmDataLayer)&&void 0!==L&&null!==(h=L.pixels)&&void 0!==h&&null!==(D=h.google)&&void 0!==D&&null!==(x=D.analytics)&&void 0!==x&&null!==(k=x.ga4)&&void 0!==k&&k.measurement_id&&e.fireGtagGoogleAnalyticsGA4(),wpmDataLayer.pixels.google.state="ready"}catch(e){console.error(e)}})))},e.canGoogleLoad=function(){var t,a,o,r;return!(null===(t=wpmDataLayer)||void 0===t||null===(a=t.pixels)||void 0===a||null===(o=a.google)||void 0===o||null===(r=o.consent_mode)||void 0===r||!r.active)||("category"===e.getConsentValues().mode?!(!e.getConsentValues().categories.ads&&!e.getConsentValues().categories.analytics):"pixel"===e.getConsentValues().mode?e.getConsentValues().pixels.includes("google-ads")||e.getConsentValues().pixels.includes("google-analytics"):(console.error("Couldn't find a valid load condition for Google mode in wpmConsentValues"),!1))},e.gtagLoaded=function(){return new Promise((function(e,t){var a,o,r;void 0===(null===(a=wpmDataLayer)||void 0===a||null===(o=a.pixels)||void 0===o||null===(r=o.google)||void 0===r?void 0:r.state)&&t();let i=0;!function a(){var o,r,n;return"ready"===(null===(o=wpmDataLayer)||void 0===o||null===(r=o.pixels)||void 0===r||null===(n=r.google)||void 0===n?void 0:n.state)?e():i>=5e3?t():(i+=200,void setTimeout(a,200))}()}))}}(window.wpm=window.wpm||{},jQuery),jQuery(document).on("wpmLoadPixels",(function(){var e,t,a;wpm.canGoogleLoad()&&void 0===(null===(e=wpmDataLayer)||void 0===e||null===(t=e.pixels)||void 0===t||null===(a=t.google)||void 0===a?void 0:a.state)&&wpm.loadGoogle()}))},385:()=>{!function(e,t,a){e.getFormattedGA4Categories=function(e,t){if(t=Array.from(new Set(t)),Array.isArray(t)&&t.length){e.item_category=t[0];let a=t.length>5?5:t.length;for(let o=1;o<a;o++)e["item_category"+(o+1)]=t[o]}return e},e.setGoogleCidOnServer=function(){try{var t,a,o,r,i,n,l,d,s,c;let u=[];null!==(t=wpmDataLayer)&&void 0!==t&&null!==(a=t.pixels)&&void 0!==a&&null!==(o=a.google)&&void 0!==o&&null!==(r=o.analytics)&&void 0!==r&&null!==(i=r.ga4)&&void 0!==i&&i.measurement_id&&u.push(wpmDataLayer.pixels.google.analytics.ga4.measurement_id),null!==(n=wpmDataLayer)&&void 0!==n&&null!==(l=n.pixels)&&void 0!==l&&null!==(d=l.google)&&void 0!==d&&null!==(s=d.analytics)&&void 0!==s&&null!==(c=s.universal)&&void 0!==c&&c.property_id&&u.push(wpmDataLayer.pixels.google.analytics.universal.property_id),e.gtagLoaded().then((function(){gtag("get",u[0],"client_id",(t=>{let a={action:"wpm_google_analytics_set_session_data",target_ids:u,client_id:t,referrer:e.getReferrerFromCookie(),gclid:e.getClidFromBrowser("gclid"),userAgent:e.getUserAgent(),viewPortWidth:e.getViewPort().width,viewPortHeight:e.getViewPort().height};jQuery.ajax({type:"post",dataType:"json",url:e.ajax_url,data:a,success:function(a){!0===a.success&&(window.sessionStorage?u.forEach((e=>{window.sessionStorage.setItem("_wpm_ga_cid_set",JSON.stringify(!0)),window.sessionStorage.setItem("wpm_cid_"+e+"_"+t+"_set",JSON.stringify(!0))})):u.forEach((a=>{e.setCookie("wpm_cid_"+a+"_"+t+"_set",!0)})))},error:function(e){console.error(e)}})}))}))}catch(e){console.error(e)}}}(window.wpm=window.wpm||{},jQuery),jQuery(window).on("wpmLoadAlways",(function(){try{var e,t,a,o,r,i,n,l,d,s,c,u,p,m,y,g;null===(e=wpmDataLayer)||void 0===e||null===(t=e.pixels)||void 0===t||null===(a=t.google)||void 0===a||null===(o=a.analytics)||void 0===o||!o.eec||null!==(r=window)&&void 0!==r&&null!==(i=r.sessionStorage)&&void 0!==i&&i.getItem("_wpm_ga_cid_set",JSON.parse(!0))||!(null!==(n=wpmDataLayer)&&void 0!==n&&null!==(l=n.pixels)&&void 0!==l&&null!==(d=l.google)&&void 0!==d&&null!==(s=d.analytics)&&void 0!==s&&null!==(c=s.universal)&&void 0!==c&&c.property_id||null!==(u=wpmDataLayer)&&void 0!==u&&null!==(p=u.pixels)&&void 0!==p&&null!==(m=p.google)&&void 0!==m&&null!==(y=m.analytics)&&void 0!==y&&null!==(g=y.ga4)&&void 0!==g&&g.measurement_id)||["product","cart","checkout"].indexOf(wpmDataLayer.shop.page_type)>=0&&wpm.setGoogleCidOnServer()}catch(e){console.error(e)}}))},570:()=>{!function(e,t,a){e.load_hotjar_pixel=function(){var e,t,a;null!==(e=wpmDataLayer)&&void 0!==e&&null!==(t=e.pixels)&&void 0!==t&&null!==(a=t.hotjar)&&void 0!==a&&a.site_id&&(wpmDataLayer.pixels.hotjar.loaded=!0,function(e,t,a,o,r,i){e.hj=e.hj||function(){(e.hj.q=e.hj.q||[]).push(arguments)},e._hjSettings={hjid:wpmDataLayer.pixels.hotjar.site_id,hjsv:6},r=t.getElementsByTagName("head")[0],(i=t.createElement("script")).async=1,i.src="https://static.hotjar.com/c/hotjar-"+e._hjSettings.hjid+".js?sv="+e._hjSettings.hjsv,r.appendChild(i)}(window,document))}}(window.wpm=window.wpm||{},jQuery),jQuery(document).on("wpmLoadPixels",(function(){var e,t,a;!wpm.canIFire("analytics","hotjar")||null!==(e=wpmDataLayer)&&void 0!==e&&null!==(t=e.pixels)&&void 0!==t&&null!==(a=t.hotjar)&&void 0!==a&&a.loaded||wpm.load_hotjar_pixel()}))},623:()=>{!function(e,t,a){e.load_bing_pixel=function(){try{var e,t,a;null!==(e=wpmDataLayer)&&void 0!==e&&null!==(t=e.pixels)&&void 0!==t&&null!==(a=t.bing)&&void 0!==a&&a.uet_tag_id&&(wpmDataLayer.pixels.bing.loaded=!0,window.uetq=window.uetq||[],o=window,r=document,i="script",o[n="uetq"]=o[n]||[],l=function(){var e={ti:wpmDataLayer.pixels.bing.uet_tag_id};e.q=o[n],o[n]=new UET(e),o[n].push("pageLoad")},(d=r.createElement(i)).src="//bat.bing.com/bat.js",d.async=1,d.onload=d.onreadystatechange=function(){var e=this.readyState;e&&"loaded"!==e&&"complete"!==e||(l(),d.onload=d.onreadystatechange=null)},(s=r.getElementsByTagName(i)[0]).parentNode.insertBefore(d,s))}catch(e){console.error(e)}var o,r,i,n,l,d,s},e.bing_purchase_ecomm_prodids=function(){let e=[];for(const[o,r]of Object.entries(wpmDataLayer.order.items)){var t,a;null!==(t=wpmDataLayer)&&void 0!==t&&null!==(a=t.general)&&void 0!==a&&a.variationsOutput&&0!==r.variation_id?e.push(String(wpmDataLayer.products[r.variation_id].dyn_r_ids[wpmDataLayer.pixels.bing.dynamic_remarketing.id_type])):e.push(String(wpmDataLayer.products[r.id].dyn_r_ids[wpmDataLayer.pixels.bing.dynamic_remarketing.id_type]))}return e},e.bing_purchase_items=function(){let e=[];for(const[o,r]of Object.entries(wpmDataLayer.order.items)){var t,a;let o;o={quantity:r.quantity,price:r.price},null!==(t=wpmDataLayer)&&void 0!==t&&null!==(a=t.general)&&void 0!==a&&a.variationsOutput&&0!==r.variation_id?(o.id=String(wpmDataLayer.products[r.variation_id].dyn_r_ids[wpmDataLayer.pixels.bing.dynamic_remarketing.id_type]),e.push(o)):(o.id=String(wpmDataLayer.products[r.id].dyn_r_ids[wpmDataLayer.pixels.bing.dynamic_remarketing.id_type]),e.push(o))}return e}}(window.wpm=window.wpm||{},jQuery),jQuery(document).on("wpmLoadPixels",(function(){var e,t,a;!wpm.canIFire("ads","bing-ads")||null!==(e=wpmDataLayer)&&void 0!==e&&null!==(t=e.pixels)&&void 0!==t&&null!==(a=t.bing)&&void 0!==a&&a.loaded||wpm.load_bing_pixel()})),jQuery(document).on("wpmAddToCart",(function(e,t){try{var a,o,r;if(null===(a=wpmDataLayer)||void 0===a||null===(o=a.pixels)||void 0===o||null===(r=o.bing)||void 0===r||!r.loaded)return;window.uetq.push("event","",{ecomm_pagetype:"cart",ecomm_prodid:t.dyn_r_ids[wpmDataLayer.pixels.bing.dynamic_remarketing.id_type]})}catch(e){console.error(e)}})),jQuery(document).on("wpmViewItem",(function(e,t){try{var a,o,r;if(null===(a=wpmDataLayer)||void 0===a||null===(o=a.pixels)||void 0===o||null===(r=o.bing)||void 0===r||!r.loaded)return;window.uetq.push("event","",{ecomm_pagetype:"product",ecomm_prodid:t.dyn_r_ids[wpmDataLayer.pixels.bing.dynamic_remarketing.id_type]})}catch(e){console.error(e)}})),jQuery(document).on("wpmCategory",(function(){try{var e,t,a;if(null===(e=wpmDataLayer)||void 0===e||null===(t=e.pixels)||void 0===t||null===(a=t.bing)||void 0===a||!a.loaded)return;window.uetq.push("event","",{ecomm_pagetype:"category"})}catch(e){console.error(e)}})),jQuery(document).on("wpmSearch",(function(){try{var e,t,a;if(null===(e=wpmDataLayer)||void 0===e||null===(t=e.pixels)||void 0===t||null===(a=t.bing)||void 0===a||!a.loaded)return;window.uetq.push("event","",{ecomm_pagetype:"searchresults"})}catch(e){console.error(e)}})),jQuery(document).on("wpmOrderReceivedPage",(function(){try{var e,t,a;if(null===(e=wpmDataLayer)||void 0===e||null===(t=e.pixels)||void 0===t||null===(a=t.bing)||void 0===a||!a.loaded)return;window.uetq.push("event","purchase",{ecomm_pagetype:"purchase",ecomm_prodid:wpm.bing_purchase_ecomm_prodids(),revenue_value:wpmDataLayer.order.value_filtered,currency:wpmDataLayer.order.currency,items:wpm.bing_purchase_items()})}catch(e){console.error(e)}}))},699:()=>{!function(e,t,a){e.getPinterestProductData=function(e){return e.isVariation?{product_name:e.name,product_variant_id:e.dyn_r_ids[wpmDataLayer.pixels.pinterest.dynamic_remarketing.id_type],product_id:e.parentId_dyn_r_ids[wpmDataLayer.pixels.pinterest.dynamic_remarketing.id_type],product_category:e.category,product_variant:e.variant,product_price:e.price,product_quantity:e.quantity,product_brand:e.brand}:{product_name:e.name,product_id:e.dyn_r_ids[wpmDataLayer.pixels.pinterest.dynamic_remarketing.id_type],product_category:e.category,product_price:e.price,product_quantity:e.quantity,product_brand:e.brand}},e.pinterestFormattedOrderItems=function(){let e=[];for(const[o,r]of Object.entries(wpmDataLayer.order.items)){var t,a;let i;i={product_category:wpmDataLayer.products[o].category.join(","),product_quantity:r.quantity,product_price:r.price},null!==(t=wpmDataLayer)&&void 0!==t&&null!==(a=t.general)&&void 0!==a&&a.variationsOutput&&0!==r.variation_id?(i.product_id=String(wpmDataLayer.products[r.variation_id].dyn_r_ids[wpmDataLayer.pixels.pinterest.dynamic_remarketing.id_type]),i.product_name=wpmDataLayer.products[r.variation_id].name,e.push(i)):(i.product_id=String(wpmDataLayer.products[r.id].dyn_r_ids[wpmDataLayer.pixels.pinterest.dynamic_remarketing.id_type]),i.product_name=wpmDataLayer.products[r.id].name,e.push(i))}return e},e.loadPinterestPixel=function(){try{var t,a,o;null!==(t=wpmDataLayer)&&void 0!==t&&null!==(a=t.pixels)&&void 0!==a&&null!==(o=a.pinterest)&&void 0!==o&&o.pixel_id&&(wpmDataLayer.pixels.pinterest.loaded=!0,function(e){if(!window.pintrk){window.pintrk=function(){window.pintrk.queue.push(Array.prototype.slice.call(arguments))};var t=window.pintrk;t.queue=[],t.version="3.0";var a=document.createElement("script");a.async=!0,a.src="https://s.pinimg.com/ct/core.js";var o=document.getElementsByTagName("script")[0];o.parentNode.insertBefore(a,o)}}(),e.pinterestLoadEvent(),pintrk("page"))}catch(e){console.error(e)}},e.pinterestLoadEvent=function(){try{var e,t,a;(wpmDataLayer.general.userLoggedIn||"order_received_page"===wpmDataLayer.shop.page_type)&&null!==(e=wpmDataLayer)&&void 0!==e&&null!==(t=e.pixels)&&void 0!==t&&null!==(a=t.pinterest)&&void 0!==a&&a.enhanced_match?pintrk("load",wpmDataLayer.pixels.pinterest.pixel_id,{em:wpmDataLayer.pixels.pinterest.enhanced_match_email}):pintrk("load",wpmDataLayer.pixels.pinterest.pixel_id)}catch(e){console.error(e)}}}(window.wpm=window.wpm||{},jQuery),jQuery(document).on("wpmLoadPixels",(function(){var e,t,a;!wpm.canIFire("ads","pinterest-ads")||null!==(e=wpmDataLayer)&&void 0!==e&&null!==(t=e.pixels)&&void 0!==t&&null!==(a=t.pinterest)&&void 0!==a&&a.loaded||wpm.loadPinterestPixel()})),jQuery(document).on("wpmAddToCart",(function(e,t){try{var a,o,r;if(null===(a=wpmDataLayer)||void 0===a||null===(o=a.pixels)||void 0===o||null===(r=o.pinterest)||void 0===r||!r.loaded)return;pintrk("track","addtocart",{value:parseFloat(t.quantity*t.price),currency:t.currency,line_items:[wpm.getPinterestProductData(t)]})}catch(e){console.error(e)}})),jQuery(document).on("wpmViewItem",(function(e,t){try{var a,o,r;if(null===(a=wpmDataLayer)||void 0===a||null===(o=a.pixels)||void 0===o||null===(r=o.pinterest)||void 0===r||!r.loaded)return;pintrk("track","pagevisit",{currency:t.currency,line_items:[wpm.getPinterestProductData(t)]})}catch(e){console.error(e)}})),jQuery(document).on("wpmViewItem",(function(e,t){try{var a,o,r;if(null===(a=wpmDataLayer)||void 0===a||null===(o=a.pixels)||void 0===o||null===(r=o.pinterest)||void 0===r||!r.loaded)return;let e=wpm.getPinterestProductData(t);pintrk("track","pagevisit",{currency:t.currency,line_items:[e]})}catch(e){console.error(e)}})),jQuery(document).on("wpmSearch",(function(){try{var e,t,a;if(null===(e=wpmDataLayer)||void 0===e||null===(t=e.pixels)||void 0===t||null===(a=t.pinterest)||void 0===a||!a.loaded)return;let o=new URLSearchParams(window.location.search);pintrk("track","search",{search_query:o.get("s")})}catch(e){console.error(e)}})),jQuery(document).on("wpmCategory",(function(){try{var e,t,a;if(null===(e=wpmDataLayer)||void 0===e||null===(t=e.pixels)||void 0===t||null===(a=t.pinterest)||void 0===a||!a.loaded)return;pintrk("track","viewcategory")}catch(e){console.error(e)}})),jQuery(document).on("wpmOrderReceivedPage",(function(){try{var e,t,a;if(null===(e=wpmDataLayer)||void 0===e||null===(t=e.pixels)||void 0===t||null===(a=t.pinterest)||void 0===a||!a.loaded)return;pintrk("track","checkout",{value:wpmDataLayer.order.value_filtered,order_quantity:wpmDataLayer.order.quantity,currency:wpmDataLayer.order.currency,order_id:wpmDataLayer.order.id,line_items:wpm.pinterestFormattedOrderItems()})}catch(e){console.error(e)}}))},986:()=>{!function(e,t,a){e.snapchatGetEmail=function(){var e,t;let a={};var o;return null!==(e=wpmDataLayer)&&void 0!==e&&null!==(t=e.user)&&void 0!==t&&t.email_sha256&&(a.user_hashed_email=null===(o=wpmDataLayer.user)||void 0===o?void 0:o.email_sha256),a},e.loadSnapchatPixel=function(){try{var t,a,o;null!==(t=wpmDataLayer)&&void 0!==t&&null!==(a=t.pixels)&&void 0!==a&&null!==(o=a.snapchat)&&void 0!==o&&o.pixel_id&&(wpmDataLayer.pixels.snapchat.loaded=!0,function(e,t,a){if(!e.snaptr){var o=e.snaptr=function(){o.handleRequest?o.handleRequest.apply(o,arguments):o.queue.push(arguments)};o.queue=[];var i="script";r=t.createElement(i),r.async=!0,r.src="https://sc-static.net/scevent.min.js";var n=t.getElementsByTagName(i)[0];n.parentNode.insertBefore(r,n)}}(window,document),snaptr("init",wpmDataLayer.pixels.snapchat.pixel_id,e.snapchatGetEmail()),snaptr("track","PAGE_VIEW"))}catch(e){console.error(e)}},e.getSnapchatOrderItemIds=function(){let e=[];for(const[o,r]of Object.entries(wpmDataLayer.order.items)){var t,a;null!==(t=wpmDataLayer)&&void 0!==t&&null!==(a=t.general)&&void 0!==a&&a.variationsOutput&&0!==r.variation_id?e.push(String(wpmDataLayer.products[r.variation_id].dyn_r_ids[wpmDataLayer.pixels.snapchat.dynamic_remarketing.id_type])):e.push(String(wpmDataLayer.products[r.id].dyn_r_ids[wpmDataLayer.pixels.snapchat.dynamic_remarketing.id_type]))}return e}}(window.wpm=window.wpm||{},jQuery),jQuery(document).on("wpmLoadPixels",(function(){var e,t,a;!wpm.canIFire("ads","snapchat-ads")||null!==(e=wpmDataLayer)&&void 0!==e&&null!==(t=e.pixels)&&void 0!==t&&null!==(a=t.snapchat)&&void 0!==a&&a.loaded||wpm.loadSnapchatPixel()})),jQuery(document).on("wpmAddToCart",(function(e,t){try{var a,o,r;if(null===(a=wpmDataLayer)||void 0===a||null===(o=a.pixels)||void 0===o||null===(r=o.snapchat)||void 0===r||!r.loaded)return;snaptr("track","ADD_CART",{item_ids:[t.dyn_r_ids[wpmDataLayer.pixels.snapchat.dynamic_remarketing.id_type]]})}catch(e){console.error(e)}})),jQuery(document).on("wpmViewItem",(function(e,t){try{var a,o,r;if(null===(a=wpmDataLayer)||void 0===a||null===(o=a.pixels)||void 0===o||null===(r=o.snapchat)||void 0===r||!r.loaded)return;snaptr("track","VIEW_CONTENT",{item_ids:[t.dyn_r_ids[wpmDataLayer.pixels.snapchat.dynamic_remarketing.id_type]]})}catch(e){console.error(e)}})),jQuery(document).on("wpmOrderReceivedPage",(function(){try{var e,t,a;if(null===(e=wpmDataLayer)||void 0===e||null===(t=e.pixels)||void 0===t||null===(a=t.snapchat)||void 0===a||!a.loaded)return;snaptr("track","PURCHASE",{currency:wpmDataLayer.order.currency,price:wpmDataLayer.order.value_filtered,transaction_id:wpmDataLayer.order.id,item_ids:wpm.getSnapchatOrderItemIds()})}catch(e){console.error(e)}}))},657:()=>{!function(e,t,a){e.loadTikTokPixel=function(){try{var e,t,a;null!==(e=wpmDataLayer)&&void 0!==e&&null!==(t=e.pixels)&&void 0!==t&&null!==(a=t.tiktok)&&void 0!==a&&a.pixel_id&&(wpmDataLayer.pixels.tiktok.loaded=!0,function(e,t,a){e.TiktokAnalyticsObject=a;var o=e[a]=e[a]||[];o.methods=["page","track","identify","instances","debug","on","off","once","ready","alias","group","enableCookie","disableCookie"],o.setAndDefer=function(e,t){e[t]=function(){e.push([t].concat(Array.prototype.slice.call(arguments,0)))}};for(var r=0;r<o.methods.length;r++)o.setAndDefer(o,o.methods[r]);o.instance=function(e){for(var t=o._i[e]||[],a=0;a<o.methods.length;a++)o.setAndDefer(t,o.methods[a]);return t},o.load=function(e,t){var r="https://analytics.tiktok.com/i18n/pixel/events.js";o._i=o._i||{},o._i[e]=[],o._i[e]._u=r,o._t=o._t||{},o._t[e]=+new Date,o._o=o._o||{},o._o[e]=t||{};var i=document.createElement("script");i.type="text/javascript",i.async=!0,i.src=r+"?sdkid="+e+"&lib="+a;var n=document.getElementsByTagName("script")[0];n.parentNode.insertBefore(i,n)},o.load(wpmDataLayer.pixels.tiktok.pixel_id),o.page()}(window,document,"ttq"),ttq.track("Browse"))}catch(e){console.error(e)}},e.getTikTokOrderItemIds=function(){let e=[];for(const[o,r]of Object.entries(wpmDataLayer.order.items)){var t,a;let o;o={content_type:"product",quantity:r.quantity,price:r.price},null!==(t=wpmDataLayer)&&void 0!==t&&null!==(a=t.general)&&void 0!==a&&a.variationsOutput&&0!==r.variation_id?(o.content_id=String(wpmDataLayer.products[r.variation_id].dyn_r_ids[wpmDataLayer.pixels.bing.dynamic_remarketing.id_type]),o.content_name=wpmDataLayer.products[r.variation_id].name,e.push(o)):(o.content_id=String(wpmDataLayer.products[r.id].dyn_r_ids[wpmDataLayer.pixels.bing.dynamic_remarketing.id_type]),o.content_name=wpmDataLayer.products[r.id].name,e.push(o))}return e}}(window.wpm=window.wpm||{},jQuery),jQuery(document).on("wpmLoadPixels",(function(){var e,t,a;!wpm.canIFire("ads","tiktok-ads")||null!==(e=wpmDataLayer)&&void 0!==e&&null!==(t=e.pixels)&&void 0!==t&&null!==(a=t.tiktok)&&void 0!==a&&a.loaded||wpm.loadTikTokPixel()})),jQuery(document).on("wpmAddToCart",(function(e,t){try{var a,o,r;if(null===(a=wpmDataLayer)||void 0===a||null===(o=a.pixels)||void 0===o||null===(r=o.tiktok)||void 0===r||!r.loaded)return;ttq.track("AddToCart",{content_id:t.dyn_r_ids[wpmDataLayer.pixels.tiktok.dynamic_remarketing.id_type],content_type:"product",content_name:t.name,quantity:t.quantity,value:t.price,currency:t.currency})}catch(e){console.error(e)}})),jQuery(document).on("wpmBeginCheckout",(function(e){try{var t,a,o;if(null===(t=wpmDataLayer)||void 0===t||null===(a=t.pixels)||void 0===a||null===(o=a.tiktok)||void 0===o||!o.loaded)return;ttq.track("InitiateCheckout")}catch(e){console.error(e)}})),jQuery(document).on("wpmViewItem",(function(e,t){try{var a,o,r;if(null===(a=wpmDataLayer)||void 0===a||null===(o=a.pixels)||void 0===o||null===(r=o.tiktok)||void 0===r||!r.loaded)return;ttq.track("ViewContent",{content_id:t.dyn_r_ids[wpmDataLayer.pixels.tiktok.dynamic_remarketing.id_type],content_type:"product",content_name:t.name,quantity:t.quantity,value:t.price,currency:t.currency})}catch(e){console.error(e)}})),jQuery(document).on("wpmAddToWishlist",(function(e,t){try{var a,o,r;if(null===(a=wpmDataLayer)||void 0===a||null===(o=a.pixels)||void 0===o||null===(r=o.tiktok)||void 0===r||!r.loaded)return;ttq.track("AddToWishlist",{content_id:t.dyn_r_ids[wpmDataLayer.pixels.tiktok.dynamic_remarketing.id_type],content_type:"product",content_name:t.name,quantity:t.quantity,value:t.price,currency:t.currency})}catch(e){console.error(e)}})),jQuery(document).on("wpmSearch",(function(){try{var e,t,a;if(null===(e=wpmDataLayer)||void 0===e||null===(t=e.pixels)||void 0===t||null===(a=t.tiktok)||void 0===a||!a.loaded)return;ttq.track("Search")}catch(e){console.error(e)}})),jQuery(document).on("wpmOrderReceivedPage",(function(){try{var e,t,a;if(null===(e=wpmDataLayer)||void 0===e||null===(t=e.pixels)||void 0===t||null===(a=t.tiktok)||void 0===a||!a.loaded)return;ttq.track(wpmDataLayer.pixels.tiktok.purchase_event_name,{value:wpmDataLayer.order.value_filtered,currency:wpmDataLayer.order.currency,contents:wpm.getTikTokOrderItemIds()})}catch(e){console.error(e)}}))},574:()=>{!function(e,t,a){e.loadTwitterPixel=function(){try{var e,t,a;null!==(e=wpmDataLayer)&&void 0!==e&&null!==(t=e.pixels)&&void 0!==t&&null!==(a=t.twitter)&&void 0!==a&&a.pixel_id&&(wpmDataLayer.pixels.twitter.loaded=!0,o=window,r=document,i="script",o.twq||(n=o.twq=function(){n.exe?n.exe.apply(n,arguments):n.queue.push(arguments)},n.version="1.1",n.queue=[],(l=r.createElement(i)).async=!0,l.src="//static.ads-twitter.com/uwt.js",(d=r.getElementsByTagName(i)[0]).parentNode.insertBefore(l,d)),twq("init",wpmDataLayer.pixels.twitter.pixel_id),twq("track","PageView"))}catch(o){console.error(o)}var o,r,i,n,l,d},e.twitterGetOrderContentIds=function(){let e=[];for(const[o,r]of Object.entries(wpmDataLayer.order.items)){var t,a;null!==(t=wpmDataLayer)&&void 0!==t&&null!==(a=t.general)&&void 0!==a&&a.variationsOutput&&0!==r.variation_id?e.push(String(wpmDataLayer.products[r.variation_id].dyn_r_ids[wpmDataLayer.pixels.twitter.dynamic_remarketing.id_type])):e.push(String(wpmDataLayer.products[r.id].dyn_r_ids[wpmDataLayer.pixels.twitter.dynamic_remarketing.id_type]))}return e}}(window.wpm=window.wpm||{},jQuery),jQuery(document).on("wpmLoadPixels",(function(){var e,t,a;!wpm.canIFire("ads","twitter-ads")||null!==(e=wpmDataLayer)&&void 0!==e&&null!==(t=e.pixels)&&void 0!==t&&null!==(a=t.twitter)&&void 0!==a&&a.loaded||wpm.loadTwitterPixel()})),jQuery(document).on("wpmAddToCart",(function(e,t){try{var a,o,r;if(null===(a=wpmDataLayer)||void 0===a||null===(o=a.pixels)||void 0===o||null===(r=o.twitter)||void 0===r||!r.loaded)return;twq("track","AddToCart")}catch(e){console.error(e)}})),jQuery(document).on("wpmViewItem",(function(e,t){try{var a,o,r;if(null===(a=wpmDataLayer)||void 0===a||null===(o=a.pixels)||void 0===o||null===(r=o.twitter)||void 0===r||!r.loaded)return;twq("track","ViewContent")}catch(e){console.error(e)}})),jQuery(document).on("wpmAddToWishlist",(function(e,t){try{var a,o,r;if(null===(a=wpmDataLayer)||void 0===a||null===(o=a.pixels)||void 0===o||null===(r=o.twitter)||void 0===r||!r.loaded)return;twq("track","AddToWishlist")}catch(e){console.error(e)}})),jQuery(document).on("wpmBeginCheckout",(function(e,t){try{var a,o,r;if(null===(a=wpmDataLayer)||void 0===a||null===(o=a.pixels)||void 0===o||null===(r=o.twitter)||void 0===r||!r.loaded)return;twq("track","InitiateCheckout")}catch(e){console.error(e)}})),jQuery(document).on("wpmSearch",(function(){try{var e,t,a;if(null===(e=wpmDataLayer)||void 0===e||null===(t=e.pixels)||void 0===t||null===(a=t.twitter)||void 0===a||!a.loaded)return;twq("track","Search")}catch(e){console.error(e)}})),jQuery(document).on("wpmOrderReceivedPage",(function(){try{var e,t,a;if(null===(e=wpmDataLayer)||void 0===e||null===(t=e.pixels)||void 0===t||null===(a=t.twitter)||void 0===a||!a.loaded)return;twq("track","Purchase",{order_id:wpmDataLayer.order.id,value:wpmDataLayer.order.value_filtered,currency:wpmDataLayer.order.currency,num_items:wpmDataLayer.order.quantity,content_ids:wpm.twitterGetOrderContentIds()})}catch(e){console.error(e)}}))},560:()=>{wpm.wpmDataLayerExists().then((function(){jQuery(document).trigger("wpmPreLoadPixels",{})})).then((function(){wpm.pageLoaded().then((function(){jQuery(document).trigger("wpmLoad",{})}))}))},230:()=>{!function(e,t,a){const o="_wpm_order_ids",r="_wpm_endpoint_available",i="/wp-json/";function n(){return""!==e.getCookie(o)}e.emailSelected=!1,e.paymentMethodSelected=!1,e.useRestEndpoint=function(){return e.isSessionStorageAvailable()&&e.isRestEndpointAvailable()&&e.isBelowRestErrorThreshold()},e.isBelowRestErrorThreshold=function(){return window.sessionStorage.getItem(0)<=10},e.isRestEndpointAvailable=function(){if(window.sessionStorage.getItem(r))return JSON.parse(window.sessionStorage.getItem(r));e.testEndpoint()},e.isSessionStorageAvailable=function(){return!!window.sessionStorage},e.testEndpoint=function(){let e=arguments.length>0&&arguments[0]!==a?arguments[0]:location.protocol+"//"+location.host+i,t=arguments.length>1&&arguments[1]!==a?arguments[1]:r;jQuery.ajax(e,{type:"HEAD",timeout:1e3,statusCode:{200:function(e){window.sessionStorage.setItem(t,JSON.stringify(!0))},404:function(e){window.sessionStorage.setItem(t,JSON.stringify(!1))},0:function(e){window.sessionStorage.setItem(t,JSON.stringify(!1))}}}).then((e=>{}))},e.isWpmRestEndpointAvailable=function(){let t=arguments.length>0&&arguments[0]!==a?arguments[0]:r;return!!e.getCookie(t)},e.writeOrderIdToStorage=function(t){if(window.Storage)if(null===localStorage.getItem(o)){let e=[];e.push(t),window.localStorage.setItem(o,JSON.stringify(e))}else{let e=JSON.parse(localStorage.getItem(o));e.includes(t)||(e.push(t),window.localStorage.setItem(o,JSON.stringify(e)))}else{let a=new Date;a.setDate(a.getDate()+365);let r=[];n()&&(r=JSON.parse(e.getCookie(o))),r.includes(t)||(r.push(t),document.cookie="_wpm_order_ids="+JSON.stringify(r)+";expires="+a.toUTCString())}"function"==typeof e.storeOrderIdOnServer&&wpmDataLayer.orderDeduplication&&e.storeOrderIdOnServer(t)},e.isOrderIdStored=function(t){return wpmDataLayer.orderDeduplication?window.Storage?null!==localStorage.getItem(o)&&JSON.parse(localStorage.getItem(o)).includes(t):!!n()&&JSON.parse(e.getCookie(o)).includes(t):(console.log("order duplication prevention: off"),!1)},e.isEmail=function(e){return/^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/.test(e)},e.removeProductFromCart=function(t){let o=arguments.length>1&&arguments[1]!==a?arguments[1]:null;try{if(!t)throw Error("Wasn't able to retrieve a productId");if(!(t=getIdBasedOndVariationsOutputSetting(t)))throw Error("Wasn't able to retrieve a productId");let a;if(a=null==o?wpmDataLayer.cart[t].quantity:o,wpmDataLayer.cart[t]){let r=e.getProductDetailsFormattedForEvent(t,a);jQuery(document).trigger("wpmRemoveFromCart",r),null==o||wpmDataLayer.cart[t].quantity===o?(delete wpmDataLayer.cart[t],sessionStorage&&sessionStorage.setItem("wpmDataLayerCart",JSON.stringify(wpmDataLayer.cart))):(wpmDataLayer.cart[t].quantity=wpmDataLayer.cart[t].quantity-a,sessionStorage&&sessionStorage.setItem("wpmDataLayerCart",JSON.stringify(wpmDataLayer.cart)))}}catch(e){console.error(e)}},getIdBasedOndVariationsOutputSetting=function(e){try{var t,a;return null!==(t=wpmDataLayer)&&void 0!==t&&null!==(a=t.general)&&void 0!==a&&a.variationsOutput?e:wpmDataLayer.products[e].isVariation?wpmDataLayer.products[e].parentId:e}catch(e){console.error(e)}},e.addProductToCart=function(t,o){try{if(!t)throw Error("Wasn't able to retrieve a productId");if(!(t=getIdBasedOndVariationsOutputSetting(t)))throw Error("Wasn't able to retrieve a productId");if(wpmDataLayer.products[t]){let r=e.getProductDetailsFormattedForEvent(t,o);jQuery(document).trigger("wpmAddToCart",r),wpmDataLayer.cart!==a&&wpmDataLayer.cart[t]!==a?(wpmDataLayer.cart[t].quantity=wpmDataLayer.cart[t].quantity+o,sessionStorage&&sessionStorage.setItem("wpmDataLayerCart",JSON.stringify(wpmDataLayer.cart))):wpmDataLayer.cart?(wpmDataLayer.cart[t]=e.getProductDetailsFormattedForEvent(t,o),sessionStorage&&sessionStorage.setItem("wpmDataLayerCart",JSON.stringify(wpmDataLayer.cart))):(wpmDataLayer.cart={[t]:e.getProductDetailsFormattedForEvent(t,o)},sessionStorage&&sessionStorage.setItem("wpmDataLayerCart",JSON.stringify(wpmDataLayer.cart)))}}catch(t){console.error(t),e.getCartItemsFromBackend()}},e.getCartItems=function(){sessionStorage?sessionStorage.getItem("wpmDataLayerCart")&&"order_received_page"!==wpmDataLayer.shop.page_type?e.saveCartObjectToDataLayer(JSON.parse(sessionStorage.getItem("wpmDataLayerCart"))):sessionStorage.setItem("wpmDataLayerCart",JSON.stringify({})):e.getCartItemsFromBackend()},e.getCartItemsFromBackend=function(){try{let t={action:"wpm_get_cart_items"};jQuery.ajax({type:"get",dataType:"json",url:e.ajax_url,data:t,success:function(t){t.cart||(t.cart={}),e.saveCartObjectToDataLayer(t.cart),sessionStorage&&sessionStorage.setItem("wpmDataLayerCart",JSON.stringify(t.cart))}})}catch(e){console.error(e)}},e.getProductsFromBackend=function(t){if((t=t.filter((e=>!wpmDataLayer.products.hasOwnProperty(e))))&&0!==t.length)try{let a={action:"wpm_get_product_ids",productIds:t};jQuery.ajax({type:"get",dataType:"json",url:e.ajax_url,data:a,success:function(e){wpmDataLayer.products=Object.assign({},wpmDataLayer.products,e)},error:function(e){console.log(e)}})}catch(e){console.error(e)}},e.saveCartObjectToDataLayer=function(e){wpmDataLayer.cart=e,wpmDataLayer.products=Object.assign({},wpmDataLayer.products,e)},e.fireCheckoutOption=function(e){let t=arguments.length>1&&arguments[1]!==a?arguments[1]:null,o=arguments.length>2&&arguments[2]!==a?arguments[2]:null,r={step:e,checkout_option:t,value:o};jQuery(document).trigger("wpmFireCheckoutOption",r)},e.fireCheckoutProgress=function(e){let t={step:e};jQuery(document).trigger("wpmFireCheckoutProgress",t)},e.getPostIdFromString=function(e){try{return e.match(/(post-)(\d+)/)[2]}catch(e){console.error(e)}},e.triggerViewItemList=function(t){if(!t)throw Error("Wasn't able to retrieve a productId");if(!(t=getIdBasedOndVariationsOutputSetting(t)))throw Error("Wasn't able to retrieve a productId");jQuery(document).trigger("wpmViewItemList",e.getProductDataForViewItemEvent(t))},e.getProductDataForViewItemEvent=function(t){if(!t)throw Error("Wasn't able to retrieve a productId");try{if(wpmDataLayer.products[t])return e.getProductDetailsFormattedForEvent(t)}catch(e){console.error(e)}},e.getMainProductIdFromProductPage=function(){try{return["simple","variable","grouped","composite","bundle"].indexOf(wpmDataLayer.shop.product_type)>=0&&jQuery(".wpmProductId:first").data("id")}catch(e){console.error(e)}},e.viewItemListTriggerTestMode=function(e){jQuery(e).css({position:"relative"}),jQuery(e).append('<div id="viewItemListTriggerOverlay"></div>'),jQuery(e).find("#viewItemListTriggerOverlay").css({"z-index":"10",display:"block",position:"absolute",height:"100%",top:"0",left:"0",right:"0",opacity:wpmDataLayer.viewItemListTrigger.opacity,"background-color":wpmDataLayer.viewItemListTrigger.backgroundColor})},e.getSearchTermFromUrl=function(){try{return new URLSearchParams(window.location.search).get("s")}catch(e){console.error(e)}};let l,d={};e.observerCallback=function(t,a){t.forEach((t=>{try{let o,r=jQuery(t.target).data("ioid");if(o=jQuery(t.target).next(".wpmProductId").length?jQuery(t.target).next(".wpmProductId").data("id"):jQuery(t.target).find(".wpmProductId").data("id"),!o)throw Error("wpmProductId element not found");t.isIntersecting?d[r]=setTimeout((()=>{e.triggerViewItemList(o),wpmDataLayer.viewItemListTrigger.testMode&&e.viewItemListTriggerTestMode(t.target),!1===wpmDataLayer.viewItemListTrigger.repeat&&a.unobserve(t.target)}),wpmDataLayer.viewItemListTrigger.timeout):(clearTimeout(d[r]),wpmDataLayer.viewItemListTrigger.testMode&&jQuery(t.target).find("#viewItemListTriggerOverlay").remove())}catch(e){console.error(e)}}))};let s,c=0;e.startIntersectionObserverToWatch=function(){try{new URLSearchParams(window.location.search).has("vildemomode")&&(wpmDataLayer.viewItemListTrigger.testMode=!0),l=new IntersectionObserver(e.observerCallback,{threshold:wpmDataLayer.viewItemListTrigger.threshold}),s=jQuery(".wpmProductId").map((function(e,t){return jQuery(t).parent().hasClass("type-product")||jQuery(t).parent().hasClass("product")||jQuery(t).parent().hasClass("product-item-inner")?jQuery(t).parent():jQuery(t).prev().hasClass("wc-block-grid__product")||jQuery(t).prev().hasClass("product")||jQuery(t).prev().hasClass("product-small")||jQuery(t).prev().hasClass("woocommerce-LoopProduct-link")?jQuery(this).prev():jQuery(t).closest(".product").length?jQuery(t).closest(".product"):void 0})),s.each((function(e,t){jQuery(t[0]).data("ioid",c++),l.observe(t[0])}))}catch(e){console.error(e)}},e.startProductsMutationObserverToWatch=function(){try{let e=jQuery(".wpmProductId:eq(0)").parents().has(jQuery(".wpmProductId:eq(1)").parents()).first();e.length&&u.observe(e[0],{attributes:!0,childList:!0,characterData:!0})}catch(e){console.error(e)}};let u=new MutationObserver((function(e){e.forEach((function(e){let t=e.addedNodes;null!==t&&jQuery(t).each((function(){(jQuery(this).hasClass("type-product")||jQuery(this).hasClass("product-small")||jQuery(this).hasClass("wc-block-grid__product"))&&p(this)&&(jQuery(this).data("ioid",c++),l.observe(this))}))}))})),p=function(e){return!(!jQuery(e).find(".wpmProductId").length&&!jQuery(e).siblings(".wpmProductId").length)};e.setCookie=function(e){let t=arguments.length>1&&arguments[1]!==a?arguments[1]:"",o=arguments.length>2&&arguments[2]!==a?arguments[2]:null;if(o){let a=new Date;a.setTime(a.getTime()+24*o*60*60*1e3);let r="expires="+a.toUTCString();document.cookie=e+"="+t+";"+r+";path=/"}else document.cookie=e+"="+t+";path=/"},e.getCookie=function(e){let t=e+"=",a=decodeURIComponent(document.cookie).split(";");for(let e=0;e<a.length;e++){let o=a[e];for(;" "==o.charAt(0);)o=o.substring(1);if(0==o.indexOf(t))return o.substring(t.length,o.length)}return""},e.getWpmSessionData=function(){if(window.sessionStorage){let e=window.sessionStorage.getItem("_wpm");return null!==e?JSON.parse(e):{}}return{}},e.setWpmSessionData=function(e){window.sessionStorage&&window.sessionStorage.setItem("_wpm",JSON.stringify(e))},e.storeOrderIdOnServer=function(t){try{let a={action:"wpm_purchase_pixels_fired",order_id:t,nonce:e.nonce};jQuery.ajax({type:"post",dataType:"json",url:e.ajax_url,data:a,success:function(e){!1===e.success&&console.log(e)},error:function(e){console.log(e)}})}catch(e){console.error(e)}},e.getProductIdByCartItemKeyUrl=function(e){let t=new URLSearchParams(e.search).get("remove_item"),a=null;return a=0===wpmDataLayer.cartItemKeys[t].variation_id?wpmDataLayer.cartItemKeys[t].product_id:wpmDataLayer.cartItemKeys[t].variation_id,a},e.getAddToCartLinkProductIds=function(){return jQuery("a").map((function(){let e=jQuery(this).attr("href");if(e&&e.includes("?add-to-cart=")){let t=e.match(/(add-to-cart=)(\d+)/);if(t)return t[2]}})).get()},e.getProductDetailsFormattedForEvent=function(e){let t=arguments.length>1&&arguments[1]!==a?arguments[1]:1,o={id:e.toString(),dyn_r_ids:wpmDataLayer.products[e].dyn_r_ids,name:wpmDataLayer.products[e].name,list_name:wpmDataLayer.shop.list_name,brand:wpmDataLayer.products[e].brand,category:wpmDataLayer.products[e].category,variant:wpmDataLayer.products[e].variant,list_position:wpmDataLayer.products[e].position,quantity:t,price:wpmDataLayer.products[e].price,currency:wpmDataLayer.shop.currency,isVariable:wpmDataLayer.products[e].isVariable,isVariation:wpmDataLayer.products[e].isVariation,parentId:wpmDataLayer.products[e].parentId};return o.isVariation&&(o.parentId_dyn_r_ids=wpmDataLayer.products[e].parentId_dyn_r_ids),o},e.setReferrerToCookie=function(){e.getCookie("wpmReferrer")||e.setCookie("wpmReferrer",document.referrer)},e.getReferrerFromCookie=function(){return e.getCookie("wpmReferrer")?e.getCookie("wpmReferrer"):null},e.getClidFromBrowser=function(){let t,o=arguments.length>0&&arguments[0]!==a?arguments[0]:"gclid";return t={gclid:"_gcl_aw",dclid:"_gcl_dc"},e.getCookie(t[o])?e.getCookie(t[o]).match(/(GCL.[\d]*.)(.*)/)[2]:""},e.getUserAgent=function(){return navigator.userAgent},e.getViewPort=function(){return{width:Math.max(document.documentElement.clientWidth||0,window.innerWidth||0),height:Math.max(document.documentElement.clientHeight||0,window.innerHeight||0)}};let m=function(){let t=e.getCookie("cmplz_statistics"),a=e.getCookie("cmplz_marketing");return!(!e.getCookie("cmplz_consent_status")&&!e.getCookie("cmplz_banner-status"))&&{analytics:"allow"===t,ads:"allow"===a,visitorHasChosen:!0}},y=function(){let t=e.getCookie("cookielawinfo-checkbox-analytics"),a=e.getCookie("cookielawinfo-checkbox-advertisement"),o=e.getCookie("CookieLawInfoConsent");return!(!t&&!a)&&{analytics:"yes"===t,ads:"yes"===a,visitorHasChosen:!!o}},g={categories:{},pixels:[],mode:"category",visitorHasChosen:!1};e.getConsentValues=function(){return g},e.setConsentValueCategories=function(){let e=arguments.length>0&&arguments[0]!==a&&arguments[0],t=arguments.length>1&&arguments[1]!==a&&arguments[1];g.categories.analytics=e,g.categories.ads=t},e.updateConsentCookieValues=function(){let t,o=arguments.length>0&&arguments[0]!==a&&arguments[0];if(t=e.getCookie("CookieConsent"))t=decodeURI(t),g.categories.analytics=t.indexOf("statistics:true")>=0,g.categories.ads=t.indexOf("marketing:true")>=0,g.visitorHasChosen=!0;else if(t=e.getCookie("CookieScriptConsent"))t=JSON.parse(t),"reject"===t.action?(g.categories.analytics=!1,g.categories.ads=!1):2===t.categories.length?(g.categories.analytics=!0,g.categories.ads=!0):(g.categories.analytics=t.categories.indexOf("performance")>=0,g.categories.ads=t.categories.indexOf("targeting")>=0),g.visitorHasChosen=!0;else if(t=e.getCookie("borlabs-cookie")){var r,i,n,l,d,s,c,u;t=decodeURI(t),t=JSON.parse(t),g.categories.analytics=!(null===(r=t)||void 0===r||null===(i=r.consents)||void 0===i||!i.statistics),g.categories.ads=!(null===(n=t)||void 0===n||null===(l=n.consents)||void 0===l||!l.marketing),g.visitorHasChosen=!0,g.pixels=[...(null===(d=t)||void 0===d||null===(s=d.consents)||void 0===s?void 0:s.statistics)||[],...(null===(c=t)||void 0===c||null===(u=c.consents)||void 0===u?void 0:u.marketing)||[]],g.mode="pixel"}else(t=m())?(g.categories.analytics=!0===t.analytics,g.categories.ads=!0===t.ads,g.visitorHasChosen=t.visitorHasChosen):(t=e.getCookie("cookie_notice_accepted"))?(g.categories.analytics=!0,g.categories.ads=!0,g.visitorHasChosen=!0):(t=e.getCookie("hu-consent"))?(t=JSON.parse(t),g.categories.analytics=!!t.categories[3],g.categories.ads=!!t.categories[4],g.visitorHasChosen=!0):(t=y())?(g.categories.analytics=!0===t.analytics,g.categories.ads=!0===t.ads,g.visitorHasChosen=!0===t.visitorHasChosen):(t=e.getCookie("moove_gdpr_popup"))?(t=JSON.parse(t),g.categories.analytics="1"===t.thirdparty,g.categories.ads="1"===t.advanced,g.visitorHasChosen=!0):(g.categories.analytics=!o,g.categories.ads=!o)},e.updateConsentCookieValues(),e.setConsentDefaultValuesToExplicit=function(){g.categories={analytics:!1,ads:!1}},e.canIFire=function(e,t){return"category"===g.mode?!!g.categories[e]:"pixel"===g.mode?g.pixels.includes(t):(console.error("Couldn't find a valid consent mode in wpmConsentValues"),!1)},e.scriptTagObserver=new MutationObserver((a=>{a.forEach((a=>{let{addedNodes:o}=a;[...o].forEach((a=>{t(a).data("wpm-cookie-category")&&(e.shouldScriptBeActive(a)?e.unblockScript(a):e.blockScript(a))}))}))})),e.scriptTagObserver.observe(document.head,{childList:!0,subtree:!0}),window.addEventListener("DOMContentLoaded",(()=>e.scriptTagObserver.disconnect())),e.shouldScriptBeActive=function(e){var a,o,r,i;return!((wpmDataLayer.shop.cookie_consent_mgmt.explicit_consent||g.visitorHasChosen)&&("category"!==g.mode||!t(e).data("wpm-cookie-category").split(",").some((e=>g.categories[e])))&&("pixel"!==g.mode||!g.pixels.includes(t(e).data("wpm-pixel-name")))&&("pixel"!==g.mode||"google"!==t(e).data("wpm-pixel-name")||!["google-analytics","google-ads"].some((e=>g.pixels.includes(e))))&&(null===(a=wpmDataLayer)||void 0===a||null===(o=a.pixels)||void 0===o||null===(r=o.google)||void 0===r||null===(i=r.consent_mode)||void 0===i||!i.active||"google"!==t(e).data("wpm-pixel-name")))},e.unblockScript=function(e){let o=arguments.length>1&&arguments[1]!==a&&arguments[1];o&&t(e).remove();let r=t(e).data("wpm-src");r&&t(e).attr("src",r),e.type="text/javascript",o&&t(e).appendTo("head"),jQuery(document).trigger("wpmPreLoadPixels",{})},e.blockScript=function(e){let o=arguments.length>1&&arguments[1]!==a&&arguments[1];o&&t(e).remove(),t(e).attr("src")&&t(e).removeAttr("src"),e.type="blocked/javascript",o&&t(e).appendTo("head")},e.unblockAllScripts=function(){let o=!(arguments.length>0&&arguments[0]!==a)||arguments[0],r=!(arguments.length>1&&arguments[1]!==a)||arguments[1];t.each(t('script[type="blocked/javascript"]'),(function(a,i){(t(i).data("wpm-cookie-category").includes("analytics")&&o||t(i).data("wpm-cookie-category").includes("ads")&&r)&&e.unblockScript(i,!0)})),jQuery(document).trigger("wpmPreLoadPixels",{})},e.unblockSelectedPixels=function(){t.each(t('script[type="blocked/javascript"]'),(function(a,o){(g.pixels.includes(t(o).data("wpm-pixel-name"))||"google"===t(o).data("wpm-pixel-name")&&["google-analytics","google-ads"].some((e=>g.pixels.includes(e))))&&e.unblockScript(o,!0)})),jQuery(document).trigger("wpmPreLoadPixels",{})},window.addEventListener("borlabs-cookie-consent-saved",(function(t){e.updateConsentCookieValues(),"pixel"===g.mode?(e.unblockSelectedPixels(),e.updateGoogleConsentMode(g.pixels.includes("google-analytics"),g.pixels.includes("google-ads"))):(e.unblockAllScripts(g.categories.analytics,g.categories.ads),e.updateGoogleConsentMode(g.categories.analytics,g.categories.ads))})),window.addEventListener("CookiebotOnAccept",(function(t){Cookiebot.consent.statistics&&(g.categories.analytics=!0),Cookiebot.consent.marketing&&(g.categories.ads=!0),e.unblockAllScripts(g.categories.analytics,g.categories.ads),e.updateGoogleConsentMode(g.categories.analytics,g.categories.ads)}),!1),window.addEventListener("CookieScriptAccept",(function(t){t.detail.categories.includes("performance")&&(g.categories.analytics=!0),t.detail.categories.includes("targeting")&&(g.categories.ads=!0),e.unblockAllScripts(g.categories.analytics,g.categories.ads),e.updateGoogleConsentMode(g.categories.analytics,g.categories.ads)})),window.addEventListener("CookieScriptAcceptAll",(function(t){e.unblockAllScripts(!0,!0),e.updateGoogleConsentMode(!0,!0)})),document.addEventListener("cmplzStatusChange",(function(t){e.updateConsentCookieValues(),e.unblockAllScripts(g.categories.analytics,g.categories.ads),e.updateGoogleConsentMode(g.categories.analytics,g.categories.ads)})),document.addEventListener("setCookieNotice",(function(t){e.updateConsentCookieValues(),e.unblockAllScripts(g.categories.analytics,g.categories.ads),e.updateGoogleConsentMode(g.categories.analytics,g.categories.ads)})),e.huObserver=new MutationObserver((function(t){t.forEach((t=>{let{addedNodes:a}=t;[...a].forEach((t=>{"hu"===t.id&&jQuery(".hu-cookies-save").on("click",(function(t){e.updateConsentCookieValues(),e.unblockAllScripts(g.categories.analytics,g.categories.ads),e.updateGoogleConsentMode(g.categories.analytics,g.categories.ads)}))}))}))})),window.hu&&e.huObserver.observe(document.documentElement||document.body,{childList:!0,subtree:!0}),e.version=function(){console.log(wpmDataLayer.version)},e.loadScriptAndCacheIt=function(e,t){return t=jQuery.extend(t||{},{dataType:"script",cache:!0,url:e}),jQuery.ajax(t)},e.getOrderItemPrice=function(e){return(e.total+e.total_tax)/e.quantity},e.hasLoginEventFired=function(){let t=e.getWpmSessionData();return null==t?void 0:t.loginEventFired},e.setLoginEventFired=function(){let t=e.getWpmSessionData();t.loginEventFired=!0,e.setWpmSessionData(t)},e.wpmDataLayerExists=function(){return new Promise((function(e){!function t(){if("undefined"!=typeof wpmDataLayer)return e();setTimeout(t,50)}()}))},e.pageLoaded=function(){return new Promise((function(e){!function t(){if("complete"===document.readyState)return e();setTimeout(t,50)}()}))},window.wpmLoaded={}}(window.wpm=window.wpm||{},jQuery),jQuery((function(){wpm.wpmDataLayerExists().then((function(){wpm.startIntersectionObserverToWatch(),wpm.startProductsMutationObserverToWatch()}))})),jQuery(document).on("click",".remove_from_cart_button, .remove",(function(e){try{let e=new URL(jQuery(this).attr("href")),t=wpm.getProductIdByCartItemKeyUrl(e);wpm.removeProductFromCart(t)}catch(e){console.error(e)}})),jQuery(document).on("click",".add_to_cart_button:not(.product_type_variable), .ajax_add_to_cart, .single_add_to_cart_button",(function(e){try{if("product"===wpmDataLayer.shop.page_type){if(void 0!==jQuery(this).attr("href")&&jQuery(this).attr("href").includes("add-to-cart")){let e=1,t=jQuery(this).data("product_id");wpm.addProductToCart(t,e)}else if("simple"===wpmDataLayer.shop.product_type){let e=Number(jQuery(".input-text.qty").val());e||0===e||(e=1);let t=jQuery(this).val();wpm.addProductToCart(t,e)}else if("variable"===wpmDataLayer.shop.product_type){let e=Number(jQuery(".input-text.qty").val());e||0===e||(e=1);let t=jQuery("[name='variation_id']").val();wpm.addProductToCart(t,e)}else if("grouped"===wpmDataLayer.shop.product_type)jQuery(".woocommerce-grouped-product-list-item").each((function(){let e=Number(jQuery(this).find(".input-text.qty").val());e||0===e||(e=1);let t=jQuery(this).attr("class"),a=wpm.getPostIdFromString(t);wpm.addProductToCart(a,e)}));else if("bundle"===wpmDataLayer.shop.product_type){let e=Number(jQuery(".input-text.qty").val());e||0===e||(e=1);let t=jQuery("input[name=add-to-cart]").val();wpm.addProductToCart(t,e)}}else{let e=1,t=jQuery(this).data("product_id");wpm.addProductToCart(t,e)}}catch(e){console.error(e)}})),jQuery(document).one("click","a:not(.add_to_cart_button, .ajax_add_to_cart, .single_add_to_cart_button)",(function(e){try{if(jQuery(e.target).closest("a").attr("href")){let t=jQuery(e.target).closest("a").attr("href");if(t.includes("add-to-cart=")){let e=t.match(/(add-to-cart=)(\d+)/);e&&wpm.addProductToCart(e[2],1)}}}catch(e){console.error(e)}})),jQuery(document).on("click",".woocommerce-LoopProduct-link, .wc-block-grid__product, .product, .product-small, .type-product",(function(e){try{let e=jQuery(this).nextAll(".wpmProductId:first").data("id");if(e){if(e=getIdBasedOndVariationsOutputSetting(e),!e)throw Error("Wasn't able to retrieve a productId");if(wpmDataLayer.products&&wpmDataLayer.products[e]){let t=wpm.getProductDetailsFormattedForEvent(e);jQuery(document).trigger("wpmSelectContentGaUa",t),jQuery(document).trigger("wpmSelectItem",t)}}}catch(e){console.error(e)}})),jQuery(document).one("click",".checkout-button, .cart-checkout-button, .button.checkout",(function(e){jQuery(document).trigger("wpmBeginCheckout")})),jQuery(document).on("input","#billing_email",(function(){wpm.isEmail(jQuery(this).val())&&(wpm.fireCheckoutProgress(2),wpm.emailSelected=!0)})),jQuery(document).on("click",".wc_payment_methods",(function(){!1===wpm.paymentMethodSelected&&wpm.fireCheckoutProgress(3),wpm.fireCheckoutOption(3,jQuery("input[name='payment_method']:checked").val()),wpm.paymentMethodSelected=!0})),jQuery(document).one("click","#place_order",(function(){!1===wpm.emailSelected&&wpm.fireCheckoutProgress(2),!1===wpm.paymentMethodSelected&&(wpm.fireCheckoutProgress(3),wpm.fireCheckoutOption(3,jQuery("input[name='payment_method']:checked").val())),wpm.fireCheckoutProgress(4)})),jQuery(document).on("click","[name='update_cart']",(function(e){try{jQuery(".cart_item").each((function(){let e=new URL(jQuery(this).find(".product-remove").find("a").attr("href")),t=wpm.getProductIdByCartItemKeyUrl(e),a=jQuery(this).find(".qty").val();0===a?wpm.removeProductFromCart(t):a<wpmDataLayer.cart[t].quantity?wpm.removeProductFromCart(t,wpmDataLayer.cart[t].quantity-a):a>wpmDataLayer.cart[t].quantity&&wpm.addProductToCart(t,a-wpmDataLayer.cart[t].quantity)}))}catch(e){console.error(e),wpm.getCartItemsFromBackend()}})),jQuery(document).on("click",".add_to_wishlist, .wl-add-to",(function(){try{let e;if(jQuery(this).data("productid")?e=jQuery(this).data("productid"):jQuery(this).data("product-id")&&(e=jQuery(this).data("product-id")),!e)throw Error("Wasn't able to retrieve a productId");let t=wpm.getProductDetailsFormattedForEvent(e);jQuery(document).trigger("wpmAddToWishlist",t)}catch(e){console.error(e)}})),jQuery(document).on("updated_cart_totals",(function(){jQuery(document).trigger("wpmViewCart")})),jQuery(window).on("wpmLoad",(function(){try{JSON.parse(sessionStorage.getItem("wpmMiniCartActive"))&&JSON.parse(sessionStorage.getItem("wpmFirstPageLoad"))&&!0===wpmDataLayer.shop.mini_cart.track?wpm.getCartItems():sessionStorage.setItem("wpmFirstPageLoad",JSON.stringify(!0))}catch(e){console.error(e)}})),jQuery(window).on("wpmLoad",(function(){wpmDataLayer.products=wpmDataLayer.products||{};let e=wpm.getAddToCartLinkProductIds();wpm.getProductsFromBackend(e)})),jQuery(window).on("wpmLoad",(function(){if(!wpm.getCookie("wpmReferrer"))if(document.referrer){let e=new URL(document.referrer).hostname;e!==window.location.host?wpm.setCookie("wpmReferrer",e):wpm.setCookie("wpmReferrer","")}else wpm.setCookie("wpmReferrer","")})),jQuery(window).on("wpmLoad",(function(){try{var e;if("undefined"!=typeof wpmDataLayer&&(null===(e=wpmDataLayer)||void 0===e||!e.wpmLoadFired)){if(jQuery(document).trigger("wpmLoadAlways"),"product"===wpmDataLayer.shop.page_type&&"variable"!==wpmDataLayer.shop.product_type&&wpm.getMainProductIdFromProductPage()){let e=wpm.getProductDataForViewItemEvent(wpm.getMainProductIdFromProductPage());jQuery(document).trigger("wpmViewItem",e)}else"product_category"===wpmDataLayer.shop.page_type?jQuery(document).trigger("wpmCategory"):"search"===wpmDataLayer.shop.page_type?jQuery(document).trigger("wpmSearch"):"cart"===wpmDataLayer.shop.page_type?jQuery(document).trigger("wpmViewCart"):"order_received_page"===wpmDataLayer.shop.page_type&&wpmDataLayer.order?wpm.isOrderIdStored(wpmDataLayer.order.id)||(jQuery(document).trigger("wpmOrderReceivedPage"),wpm.writeOrderIdToStorage(wpmDataLayer.order.id)):jQuery(document).trigger("wpmEverywhereElse");wpmDataLayer.user.id&&!wpm.hasLoginEventFired()&&(jQuery(document).trigger("wpmLogin"),wpm.setLoginEventFired()),jQuery(document).ajaxSend((function(e,t,a){a.url.includes("get_refreshed_fragments")&&sessionStorage&&(sessionStorage.getItem("wpmMiniCartActive")||sessionStorage.setItem("wpmMiniCartActive",JSON.stringify(!0)))})),wpmDataLayer.wpmLoadFired=!0}}catch(e){console.error(e)}})),jQuery(window).on("wpmPreLoadPixels",(function(){var e,t,a;null!==(e=wpmDataLayer)&&void 0!==e&&null!==(t=e.shop)&&void 0!==t&&null!==(a=t.cookie_consent_mgmt)&&void 0!==a&&a.explicit_consent&&wpm.updateConsentCookieValues(!0),jQuery(document).trigger("wpmLoadPixels",{})})),jQuery((function(){jQuery(".single_variation_wrap").on("show_variation",(function(e,t){try{let e=getIdBasedOndVariationsOutputSetting(t.variation_id);if(!e)throw Error("Wasn't able to retrieve a productId");if(wpmDataLayer.products&&wpmDataLayer.products[e]){let t=wpm.getProductDetailsFormattedForEvent(e);jQuery(document).trigger("wpmViewItem",t)}}catch(e){console.error(e)}}))}))},514:()=>{window.wpm=window.wpm||{},jQuery}},t={};function a(o){var r=t[o];if(void 0!==r)return r.exports;var i=t[o]={exports:{}};return e[o](i,i.exports,a),i.exports}a(230),a(514),a(385),a(577),a(354),a(464),a(234),a(785),a(570),a(497),a(271),a(172),a(657),a(986),a(699),a(317),a(623),a(574),a(403),a(560)})();
|
2 |
+
//# sourceMappingURL=wpm-public__premium_only.p1.min.js.map
|
js/public/wpm-public__premium_only.p1.min.js.map
ADDED
@@ -0,0 +1 @@
|
|
|
1 |
+
{"version":3,"file":"wpm-public__premium_only.p1.min.js","mappings":"uBAIC,SAAUA,EAAKC,EAAGC,GAElB,IAAIC,EAEJH,EAAII,kBAAoB,WAEvB,IAAI,UACH,UAAIC,oBAAJ,iBAAI,EAAcC,cAAlB,iBAAI,EAAsBC,gBAA1B,OAAI,EAAgCC,WAEnCH,aAAaC,OAAOC,SAASE,QAAS,EAGzBC,EAMuBC,OANrBC,EAM6BC,SAN3BC,EAMoC,SAL9CJ,EAAEK,MAAWC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tE,IACC,IAAIna,EAAY8P,qCAAqCqK,EAAUle,cAE/D,IAAK+D,EAAW,MAAM6P,MAAM,uCAE5B,GAAI1Y,aAAagF,UAAYhF,aAAagF,SAAS6D,GAAY,CAI9D,IAAIjG,EAAUjD,IAAIiZ,mCAAmC/P,GAErDnF,OAAOlD,UAAUmD,QAAQ,cAAef,IAExC,MAAOnC,GACRkB,QAAQC,MAAMnB,W,SCv2DfH,OAAOX,IAAMW,OAAOX,KAAO,GAAI+D,SCH7Buf,EAA2B,GAG/B,SAASC,EAAoBC,GAE5B,IAAIC,EAAeH,EAAyBE,GAC5C,QAAqBtjB,IAAjBujB,EACH,OAAOA,EAAaC,QAGrB,IAAIC,EAASL,EAAyBE,GAAY,CAGjDE,QAAS,IAOV,OAHAE,EAAoBJ,GAAUG,EAAQA,EAAOD,QAASH,GAG/CI,EAAOD,QCLfG,EAAQ,KACRA,EAAQ,KACRA,EAAQ,KAMRA,EAAQ,KACRA,EAAQ,KACRA,EAAQ,KACRA,EAAQ,KACRA,EAAQ,KACRA,EAAQ,KACRA,EAAQ,KAMRA,EAAQ,KACRA,EAAQ,KACRA,EAAQ,KACRA,EAAQ,KACRA,EAAQ,KACRA,EAAQ,KACRA,EAAQ,KACRA,EAAQ,KACRA,EAAQ,KAORA,EAAQ,M","sources":["webpack://WooCommerce Pixel Manager/./src/js/public/facebook.js","webpack://WooCommerce Pixel Manager/./src/js/public/facebook__premium_only.js","webpack://WooCommerce Pixel Manager/./src/js/public/google-ads.js","webpack://WooCommerce Pixel Manager/./src/js/public/google-ads__premium_only.js","webpack://WooCommerce Pixel Manager/./src/js/public/google-ga-4-eec__premium_only.js","webpack://WooCommerce Pixel Manager/./src/js/public/google-ga-4.js","webpack://WooCommerce Pixel Manager/./src/js/public/google-ga-ua-eec__premium_only.js","webpack://WooCommerce Pixel Manager/./src/js/public/google-ga-ua.js","webpack://WooCommerce Pixel Manager/./src/js/public/google-optimize.js","webpack://WooCommerce Pixel Manager/./src/js/public/google.js","webpack://WooCommerce Pixel Manager/./src/js/public/google__premium_only.js","webpack://WooCommerce Pixel Manager/./src/js/public/hotjar.js","webpack://WooCommerce Pixel Manager/./src/js/public/microsoft-ads__premium_only.js","webpack://WooCommerce Pixel Manager/./src/js/public/pinterest__premium_only.js","webpack://WooCommerce Pixel Manager/./src/js/public/snapchat__premium_only.js","webpack://WooCommerce Pixel Manager/./src/js/public/tiktok__premium_only.js","webpack://WooCommerce Pixel Manager/./src/js/public/twitter__premium_only.js","webpack://WooCommerce Pixel Manager/./src/js/public/wpm-loader.js","webpack://WooCommerce Pixel Manager/./src/js/public/wpm.js","webpack://WooCommerce Pixel Manager/./src/js/public/wpm__premium_only.js","webpack://WooCommerce Pixel Manager/webpack/bootstrap","webpack://WooCommerce Pixel Manager/./src/js/public/main-premium.js"],"sourcesContent":["/**\n * Add functions for Facebook\n * */\n\n(function (wpm, $, undefined) {\n\n\tlet fBUserData\n\n\twpm.loadFacebookPixel = function () {\n\n\t\ttry {\n\t\t\tif (wpmDataLayer?.pixels?.facebook?.pixel_id) {\n\n\t\t\t\twpmDataLayer.pixels.facebook.loaded = true\n\n\t\t\t\t// @formatter:off\n \t\t\t!function(f,b,e,v,n,t,s)\n \t\t\t{if(f.fbq)return;n=f.fbq=function(){n.callMethod?\n \t\t\t\tn.callMethod.apply(n,arguments):n.queue.push(arguments)};\n \t\t\t\tif(!f._fbq)f._fbq=n;n.push=n;n.loaded=!0;n.version='2.0';\n \t\t\t\tn.queue=[];t=b.createElement(e);t.async=!0;\n \t\t\t\tt.src=v;s=b.getElementsByTagName(e)[0];\n \t\t\t\ts.parentNode.insertBefore(t,s)}(window, document,'script',\n \t\t\t\t'https://connect.facebook.net/en_US/fbevents.js');\n \t\t\t// @formatter:on\n\n\t\t\t\tfbq(\"init\", wpmDataLayer.pixels.facebook.pixel_id)\n\t\t\t\tfbq(\"track\", \"PageView\")\n\t\t\t}\n\t\t} catch (e) {\n\t\t\tconsole.error(e)\n\t\t}\n\t}\n\n\twpm.getRandomEventId = function () {\n\t\treturn (Math.random() + 1).toString(36).substring(2)\n\t}\n\n\twpm.getFbUserData = function () {\n\t\t// We need the first one for InitiateCheckout\n\t\t// where getting the user_data from the browser is too slow\n\t\t// using wpm.getCookie(), so we cache the user_data earlier.\n\t\t// And we need the second one because the ViewContent hit happens too fast\n\t\t// after adding a variation to the cart because the function to cache\n\t\t// the user_data is too slow. But we can get the user_data using wpm.getCookie()\n\t\t// because we don't move away from the page and can wait for the browser\n\t\t// to get it.\n\t\tif (fBUserData) {\n\t\t\treturn fBUserData\n\t\t} else {\n\t\t\treturn wpm.getFbUserDataFromBrowser()\n\t\t}\n\t}\n\n\twpm.setFbUserData = function () {\n\t\tfBUserData = wpm.getFbUserDataFromBrowser()\n\t}\n\n\twpm.getFbUserDataFromBrowser = function () {\n\t\treturn {\n\t\t\tfbp : wpm.getCookie(\"_fbp\"),\n\t\t\tfbc : wpm.getCookie(\"_fbc\"),\n\t\t\tclient_user_agent: navigator.userAgent,\n\t\t}\n\t}\n\n\twpm.fbViewContent = function (product) {\n\n\t\ttry {\n\t\t\tif (!wpmDataLayer?.pixels?.facebook?.loaded) return\n\n\t\t\tlet eventId = wpm.getRandomEventId()\n\n\t\t\tfbq(\"track\", \"ViewContent\", {\n\t\t\t\tcontent_type: \"product\",\n\t\t\t\tcontent_name: product.name,\n\t\t\t\t// content_category: product.category,\n\t\t\t\tcontent_ids: product.dyn_r_ids[wpmDataLayer.pixels.facebook.dynamic_remarketing.id_type],\n\t\t\t\tcurrency : wpmDataLayer.shop.currency,\n\t\t\t\tvalue : product.price,\n\t\t\t}, {\n\t\t\t\teventID: eventId,\n\t\t\t})\n\n\t\t\tproduct[\"currency\"] = wpmDataLayer.shop.currency\n\n\t\t\tjQuery(document).trigger(\"wpmFbCapiEvent\", {\n\t\t\t\tevent_name : \"ViewContent\",\n\t\t\t\tevent_id : eventId,\n\t\t\t\tuser_data : wpm.getFbUserData(),\n\t\t\t\tproduct_data : product,\n\t\t\t\tproduct_id : product.dyn_r_ids[wpmDataLayer.pixels.facebook.dynamic_remarketing.id_type],\n\t\t\t\tevent_source_url: window.location.href,\n\t\t\t})\n\t\t} catch (e) {\n\t\t\tconsole.error(e)\n\t\t}\n\t}\n\n\twpm.facebookContentIds = function () {\n\t\tlet prodIds = []\n\n\t\tfor (const [key, item] of Object.entries(wpmDataLayer.order.items)) {\n\n\t\t\tif (wpmDataLayer?.general?.variationsOutput && 0 !== item.variation_id) {\n\t\t\t\tprodIds.push(String(wpmDataLayer.products[item.variation_id].dyn_r_ids[wpmDataLayer.pixels.facebook.dynamic_remarketing.id_type]))\n\t\t\t} else {\n\t\t\t\tprodIds.push(String(wpmDataLayer.products[item.id].dyn_r_ids[wpmDataLayer.pixels.facebook.dynamic_remarketing.id_type]))\n\t\t\t}\n\t\t}\n\n\t\treturn prodIds\n\t}\n\n}(window.wpm = window.wpm || {}, jQuery));\n\n\n/**\n * Execute as soon as possible\n * */\n\n(function () {\n\n\tjQuery(document).on(\"wpmLoadPixels\", function () {\n\n\t\tif (wpm.canIFire(\"ads\", \"facebook-ads\") && !wpmDataLayer?.pixels?.facebook?.loaded) wpm.loadFacebookPixel()\n\n\t})\n\n})()\n\n\n/**\n * All event listeners\n * */\n\n// AddToCart event\njQuery(document).on(\"wpmAddToCart\", function (event, product) {\n\n\ttry {\n\t\tif (!wpmDataLayer?.pixels?.facebook?.loaded) return\n\n\t\tlet eventId = wpm.getRandomEventId()\n\n\t\t// console.log('eventId: ' + eventId);\n\n\t\tfbq(\"track\", \"AddToCart\", {\n\t\t\tcontent_type: \"product\",\n\t\t\tcontent_name: product.name,\n\t\t\tcontent_ids : product.dyn_r_ids[wpmDataLayer.pixels.facebook.dynamic_remarketing.id_type],\n\t\t\tvalue : parseFloat(product.quantity * product.price),\n\t\t\tcurrency : product.currency,\n\t\t}, {\n\t\t\teventID: eventId,\n\t\t})\n\n\n\t\tproduct[\"currency\"] = wpmDataLayer.shop.currency\n\n\t\tjQuery(document).trigger(\"wpmFbCapiEvent\", {\n\t\t\tevent_name : \"AddToCart\",\n\t\t\tevent_id : eventId,\n\t\t\tuser_data : wpm.getFbUserData(),\n\t\t\tproduct_data : product,\n\t\t\tproduct_id : product.dyn_r_ids[wpmDataLayer.pixels.facebook.dynamic_remarketing.id_type],\n\t\t\tevent_source_url: window.location.href,\n\t\t})\n\t} catch (e) {\n\t\tconsole.error(e)\n\t}\n})\n\n// InitiateCheckout event\njQuery(document).on(\"wpmBeginCheckout\", function (event) {\n\n\ttry {\n\t\t// console.log('firing facebook ads InitiateCheckout event');\n\n\t\tif (!wpmDataLayer?.pixels?.facebook?.loaded) return\n\n\t\tlet eventId = wpm.getRandomEventId()\n\n\t\tfbq(\"track\", \"InitiateCheckout\", {}, {\n\t\t\teventID: eventId,\n\t\t})\n\n\t\tjQuery(document).trigger(\"wpmFbCapiEvent\", {\n\t\t\tevent_name : \"InitiateCheckout\",\n\t\t\tevent_id : eventId,\n\t\t\tuser_data : wpm.getFbUserData(),\n\t\t\tevent_source_url: window.location.href,\n\t\t})\n\t} catch (e) {\n\t\tconsole.error(e)\n\t}\n})\n\n// AddToWishlist event\njQuery(document).on(\"wpmAddToWishlist\", function (event, product) {\n\n\ttry {\n\t\t// console.log('firing facebook ads AddToWishlist event');\n\t\t// console.log(product);\n\n\t\tif (!wpmDataLayer?.pixels?.facebook?.loaded) return\n\n\t\tlet eventId = wpm.getRandomEventId()\n\n\t\tfbq(\"track\", \"AddToWishlist\", {\n\t\t\tcontent_type: \"product\",\n\t\t\tcontent_name: product.name,\n\t\t\tcontent_ids : product.dyn_r_ids[wpmDataLayer.pixels.facebook.dynamic_remarketing.id_type],\n\t\t\tvalue : parseFloat(product.quantity * product.price),\n\t\t\tcurrency : product.currency,\n\t\t}, {\n\t\t\teventID: eventId,\n\t\t})\n\n\n\t\tproduct[\"currency\"] = wpmDataLayer.shop.currency\n\n\t\tjQuery(document).trigger(\"wpmFbCapiEvent\", {\n\t\t\tevent_name : \"AddToWishlist\",\n\t\t\tevent_id : eventId,\n\t\t\tuser_data : wpm.getFbUserData(),\n\t\t\tproduct_data : product,\n\t\t\tproduct_id : product.dyn_r_ids[wpmDataLayer.pixels.facebook.dynamic_remarketing.id_type],\n\t\t\tevent_source_url: window.location.href,\n\t\t})\n\t} catch (e) {\n\t\tconsole.error(e)\n\t}\n})\n\n// ViewContent event\njQuery(document).on(\"wpmViewItem\", function (event, product) {\n\n\ttry {\n\t\t// console.log('firing facebook ads ViewContent event');\n\t\t// console.log(product);\n\n\t\tif (!wpmDataLayer?.pixels?.facebook?.loaded) return\n\n\t\twpm.fbViewContent(product)\n\t} catch (e) {\n\t\tconsole.error(e)\n\t}\n})\n\n// view search event\njQuery(document).on(\"wpmSearch\", function () {\n\n\ttry {\n\t\tif (!wpmDataLayer?.pixels?.facebook?.loaded) return\n\n\t\tlet eventId = wpm.getRandomEventId()\n\n\t\tfbq(\"track\", \"Search\", {}, {\n\t\t\teventID: eventId,\n\t\t})\n\n\t\tjQuery(document).trigger(\"wpmFbCapiEvent\", {\n\t\t\tevent_name : \"Search\",\n\t\t\tevent_id : eventId,\n\t\t\tuser_data : wpm.getFbUserData(),\n\t\t\tevent_source_url: window.location.href,\n\t\t})\n\t} catch (e) {\n\t\tconsole.error(e)\n\t}\n})\n\n// load always event\njQuery(document).on(\"wpmLoadAlways\", function () {\n\n\ttry {\n\t\tif (!wpmDataLayer?.pixels?.facebook?.loaded) return\n\n\t\twpm.setFbUserData()\n\t} catch (e) {\n\t\tconsole.error(e)\n\t}\n})\n\n// view order received page event\n// https://developers.pinterest.com/docs/tag/conversion/\njQuery(document).on(\"wpmOrderReceivedPage\", function () {\n\n\ttry {\n\t\tif (!wpmDataLayer?.pixels?.facebook?.loaded) return\n\n\t\tfbq(\"track\", \"Purchase\",\n\t\t\t{\n\t\t\t\tcontent_type: \"product\",\n\t\t\t\tvalue : wpmDataLayer.order.value_filtered,\n\t\t\t\tcurrency : wpmDataLayer.order.currency,\n\t\t\t\tcontent_ids : wpm.facebookContentIds(),\n\t\t\t},\n\t\t\t{eventID: wpmDataLayer.order.id},\n\t\t)\n\n\n\t\t// console.log(wpm.facebookContentIds())\n\t} catch (e) {\n\t\tconsole.error(e)\n\t}\n})\n","/**\n * Add functions for Facebook (pro)\n * */\n\n(function (wpm, $, undefined) {\n\n\twpm.setFacebookIdentifiersOnServer = function () {\n\n\t\ttry {\n\n\t\t\t// get first party cookies fbp and fbc\n\n\t\t\t// send the cookies to the server in order to save them on the session\n\n\t\t\tlet data = {\n\t\t\t\taction: \"wpm_facebook_set_session_identifiers\",\n\t\t\t\t// nonce : wpm_facebook_premium_only_ajax_object.nonce,\n\t\t\t\tnonce: wpm.nonce,\n\t\t\t\tfbp : wpm.getCookie(\"_fbp\"),\n\t\t\t\tfbc : wpm.getCookie(\"_fbc\"),\n\t\t\t}\n\n\t\t\tif (data.fbp && window.sessionStorage && window.sessionStorage.getItem(\"wpm_fb_session_id_\" + data.fbp + \"_set\")) {\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\tjQuery.ajax(\n\t\t\t\t{\n\t\t\t\t\ttype : \"post\",\n\t\t\t\t\tdataType: \"json\",\n\t\t\t\t\t// url : wpm_facebook_premium_only_ajax_object.ajax_url,\n\t\t\t\t\turl : wpm.ajax_url,\n\t\t\t\t\tdata : data,\n\t\t\t\t\tsuccess: function (response) {\n\t\t\t\t\t\t// console.log(response);\n\n\t\t\t\t\t\tif (window.sessionStorage && response[\"success\"] === true) {\n\t\t\t\t\t\t\t// console.log('setting session storage');\n\t\t\t\t\t\t\twindow.sessionStorage.setItem(\"wpm_fb_session_id_\" + data.fbp + \"_set\", JSON.stringify(true))\n\t\t\t\t\t\t}\n\t\t\t\t\t},\n\t\t\t\t\terror : function (response) {\n\t\t\t\t\t\t// console.log(response);\n\t\t\t\t\t},\n\t\t\t\t})\n\n\t\t} catch (e) {\n\t\t\tconsole.error(e)\n\t\t}\n\t}\n\n}(window.wpm = window.wpm || {}, jQuery))\n\n\n/**\n * All event listeners\n * */\n\n\n// add_to_cart event\njQuery(document).on(\"wpmAddToWishlist\", function (event, product) {\n\n\ttry {\n\t\tif (!wpmDataLayer?.pixels?.facebook?.loaded) return\n\n\t\tfbq(\"track\", \"AddToWishlist\", {\n\t\t\tcontent_name : product.name,\n\t\t\tcontent_category: product.category,\n\t\t\tcontent_ids : product.dyn_r_ids[wpmDataLayer.pixels.facebook.dynamic_remarketing.id_type],\n\t\t\t// contents : \"\",\n\t\t\tcurrency: product.currency,\n\t\t\tvalue : product.price,\n\t\t})\n\t} catch (e) {\n\t\tconsole.error(e)\n\t}\n})\n\njQuery(document).on(\"wpmFbCapiEvent\", function (event, eventData) {\n\n\ttry {\n\t\tif (!wpmDataLayer.pixels.facebook.capi) return\n\n\t\t// save the state in the database\n\t\tlet data = {\n\t\t\taction: \"wpm_facebook_capi_event\",\n\t\t\tdata : eventData,\n\t\t\t// nonce : wpm_facebook_premium_only_ajax_object.nonce,\n\t\t\tnonce: wpm.nonce,\n\t\t}\n\n\t\tjQuery.ajax(\n\t\t\t{\n\t\t\t\ttype : \"post\",\n\t\t\t\tdataType: \"json\",\n\t\t\t\t// url : wpm_facebook_premium_only_ajax_object.ajax_url,\n\t\t\t\turl : wpm.ajax_url,\n\t\t\t\tdata : data,\n\t\t\t\tsuccess: function (msg) {\n\t\t\t\t\t// console.log(msg);\n\t\t\t\t},\n\t\t\t\terror : function (msg) {\n\t\t\t\t\t// console.log(msg);\n\t\t\t\t},\n\t\t\t})\n\t} catch (e) {\n\t\tconsole.error(e)\n\t}\n})\n\n\njQuery(window).on(\"wpmLoadAlways\", function () {\n\n\ttry {\n\t\tif (wpmDataLayer?.pixels?.facebook?.pixel_id && wpmDataLayer.pixels.facebook.capi) {\n\n\t\t\t// We need to be sure that we capture the cid early enough, because the\n\t\t\t// shop might be using a one click checkout button as early as on the product page.\n\t\t\tif ([\"cart\", \"checkout\"].indexOf(wpmDataLayer.shop.page_type) >= 0) {\n\n\t\t\t\twpm.setFacebookIdentifiersOnServer()\n\t\t\t}\n\t\t}\n\t} catch (e) {\n\t\tconsole.error(e)\n\t}\n})\n","/**\n * Add functions for Google Ads\n * */\n\n(function (wpm, $, undefined) {\n\n\tlet conversionIdentifiers = []\n\n\twpm.getGoogleAdsConversionIdentifiersWithLabel = function () {\n\t\tfor (const [key, item] of Object.entries(wpmDataLayer.pixels.google.ads.conversionIds)) {\n\t\t\tconversionIdentifiers.push(key + \"/\" + item)\n\t\t}\n\t\treturn conversionIdentifiers\n\t}\n\n\twpm.getGoogleAdsConversionIdentifiers = function () {\n\n\t\tlet conversionIdentifiers = []\n\t\tfor (const [key, item] of Object.entries(wpmDataLayer.pixels.google.ads.conversionIds)) {\n\t\t\tconversionIdentifiers.push(key)\n\t\t}\n\n\t\treturn conversionIdentifiers\n\t}\n\n\twpm.getGoogleAdsRegularOrderItems = function () {\n\t\t// \"id\" : \"gla_34\",\n\t\t// \"quantity\": 1,\n\t\t// \"price\" : 45\n\n\t\tlet orderItems = []\n\n\t\tfor (const [key, item] of Object.entries(wpmDataLayer.order.items)) {\n\n\t\t\tlet orderItem\n\n\t\t\torderItem = {\n\t\t\t\tquantity: item.quantity,\n\t\t\t\tprice : item.price,\n\t\t\t}\n\n\t\t\tif (wpmDataLayer?.general?.variationsOutput && 0 !== item.variation_id) {\n\n\t\t\t\torderItem.id = String(wpmDataLayer.products[item.variation_id].dyn_r_ids[wpmDataLayer.pixels.google.ads.dynamic_remarketing.id_type])\n\t\t\t\torderItems.push(orderItem)\n\t\t\t} else {\n\n\t\t\t\torderItem.id = String(wpmDataLayer.products[item.id].dyn_r_ids[wpmDataLayer.pixels.google.ads.dynamic_remarketing.id_type])\n\t\t\t\torderItems.push(orderItem)\n\t\t\t}\n\t\t}\n\n\t\treturn orderItems\n\t}\n\n\twpm.getGoogleAdsDynamicRemarketingOrderItems = function () {\n\t\t// \"id\" : \"gla_34\",\n\t\t// \"quantity\" : 1,\n\t\t// \"price\" : 45,\n\t\t// \"google_business_vertical\": \"retail\"\n\n\t\tlet orderItems = []\n\n\t\tfor (const [key, item] of Object.entries(wpmDataLayer.order.items)) {\n\n\t\t\tlet orderItem\n\n\t\t\torderItem = {\n\t\t\t\tquantity : item.quantity,\n\t\t\t\tprice : item.price,\n\t\t\t\tgoogle_business_vertical: wpmDataLayer.pixels.google.ads.google_business_vertical,\n\t\t\t}\n\n\t\t\tif (wpmDataLayer?.general?.variationsOutput && 0 !== item.variation_id) {\n\n\t\t\t\torderItem.id = String(wpmDataLayer.products[item.variation_id].dyn_r_ids[wpmDataLayer.pixels.google.ads.dynamic_remarketing.id_type])\n\t\t\t\torderItems.push(orderItem)\n\t\t\t} else {\n\n\t\t\t\torderItem.id = String(wpmDataLayer.products[item.id].dyn_r_ids[wpmDataLayer.pixels.google.ads.dynamic_remarketing.id_type])\n\t\t\t\torderItems.push(orderItem)\n\t\t\t}\n\t\t}\n\n\t\treturn orderItems\n\t}\n\n}(window.wpm = window.wpm || {}, jQuery))\n\n\n/**\n * All event listeners\n * */\n\n// view_item_list event\njQuery(document).on(\"wpmViewItemList\", function (event, product) {\n\n\ttry {\n\t\tif(jQuery.isEmptyObject(wpmDataLayer?.pixels?.google?.ads?.conversionIds)) return\n\t\tif (!wpmDataLayer?.pixels?.google?.ads?.dynamic_remarketing?.status) return\n\t\tif (!wpm.googleConfigConditionsMet(\"ads\")) return\n\n\n\t\tif (\n\t\t\twpmDataLayer?.general?.variationsOutput &&\n\t\t\tproduct.isVariable &&\n\t\t\twpmDataLayer.pixels.google.ads.dynamic_remarketing.send_events_with_parent_ids === false\n\t\t) return\n\n\t\t// try to prevent that WC sends cached hits to Google\n\t\tif (!product) return\n\n\t\twpm.gtagLoaded().then(function () {\n\t\t gtag(\"event\", \"view_item_list\", {\n \t\t\tsend_to: wpm.getGoogleAdsConversionIdentifiers(),\n \t\t\titems : [{\n \t\t\t\tid : product.dyn_r_ids[wpmDataLayer.pixels.google.ads.dynamic_remarketing.id_type],\n \t\t\t\tgoogle_business_vertical: wpmDataLayer.pixels.google.ads.google_business_vertical,\n \t\t\t}],\n \t\t})\n\t\t})\n\t} catch (e) {\n\t\tconsole.error(e)\n\t}\n})\n\n// add_to_cart event\njQuery(document).on(\"wpmAddToCart\", function (event, product) {\n\n\ttry {\n\t\tif(jQuery.isEmptyObject(wpmDataLayer?.pixels?.google?.ads?.conversionIds)) return\n\t\tif (!wpmDataLayer?.pixels?.google?.ads?.dynamic_remarketing?.status) return\n\t\tif (!wpm.googleConfigConditionsMet(\"ads\")) return\n\n\t\twpm.gtagLoaded().then(function () {\n\t\t gtag(\"event\", \"add_to_cart\", {\n \t\t\tsend_to: wpm.getGoogleAdsConversionIdentifiers(),\n \t\t\tvalue : product.quantity * product.price,\n \t\t\titems : [{\n \t\t\t\tid : product.dyn_r_ids[wpmDataLayer.pixels.google.ads.dynamic_remarketing.id_type],\n \t\t\t\tquantity : product.quantity,\n \t\t\t\tprice : product.price,\n \t\t\t\tgoogle_business_vertical: wpmDataLayer.pixels.google.ads.google_business_vertical,\n \t\t\t}],\n \t\t})\n\t\t})\n\t} catch (e) {\n\t\tconsole.error(e)\n\t}\n})\n\n// view_item event\njQuery(document).on(\"wpmViewItem\", function (event, product) {\n\n\ttry {\n\t\tif(jQuery.isEmptyObject(wpmDataLayer?.pixels?.google?.ads?.conversionIds)) return\n\t\tif (!wpmDataLayer?.pixels?.google?.ads?.dynamic_remarketing?.status) return\n\t\tif (!wpm.googleConfigConditionsMet(\"ads\")) return\n\n\n\t\twpm.gtagLoaded().then(function () {\n\t\t gtag(\"event\", \"view_item\", {\n \t\t\tsend_to: wpm.getGoogleAdsConversionIdentifiers(),\n \t\t\tvalue : (product.quantity ? product.quantity : 1) * product.price,\n \t\t\titems : [{\n \t\t\t\tid : product.dyn_r_ids[wpmDataLayer.pixels.google.ads.dynamic_remarketing.id_type],\n \t\t\t\tquantity : (product.quantity ? product.quantity : 1),\n \t\t\t\tprice : product.price,\n \t\t\t\tgoogle_business_vertical: wpmDataLayer.pixels.google.ads.google_business_vertical,\n \t\t\t}],\n \t\t})\n\t\t})\n\t} catch (e) {\n\t\tconsole.error(e)\n\t}\n})\n\n\n// view search event\njQuery(document).on(\"wpmSearch\", function () {\n\n\ttry {\n\t\tif(jQuery.isEmptyObject(wpmDataLayer?.pixels?.google?.ads?.conversionIds)) return\n\t\tif (!wpmDataLayer?.pixels?.google?.ads?.dynamic_remarketing?.status) return\n\t\tif (!wpm.googleConfigConditionsMet(\"ads\")) return\n\n\n\t\tlet products = []\n\n\t\tfor (const [key, product] of Object.entries(wpmDataLayer.products)) {\n\n\t\t\tif (\n\t\t\t\twpmDataLayer?.general?.variationsOutput &&\n\t\t\t\tproduct.isVariable &&\n\t\t\t\twpmDataLayer.pixels.google.ads.dynamic_remarketing.send_events_with_parent_ids === false\n\t\t\t) return\n\n\t\t\tproducts.push({\n\t\t\t\tid : product.dyn_r_ids[wpmDataLayer.pixels.google.ads.dynamic_remarketing.id_type],\n\t\t\t\tgoogle_business_vertical: wpmDataLayer.pixels.google.ads.google_business_vertical,\n\t\t\t})\n\t\t}\n\n\t\t// console.log(products);\n\n\t\twpm.gtagLoaded().then(function () {\n\t\t\tgtag(\"event\", \"view_search_results\", {\n \t\t\tsend_to: wpm.getGoogleAdsConversionIdentifiers(),\n \t\t\t// value : 1 * product.price,\n \t\t\titems: products,\n \t\t})\n\t\t})\n\t} catch (e) {\n\t\tconsole.error(e)\n\t}\n})\n\n\n// view order received page event\n// TODO distinguish with or without cart data active\njQuery(document).on(\"wpmOrderReceivedPage\", function () {\n\n\ttry {\n\t\tif(jQuery.isEmptyObject(wpmDataLayer?.pixels?.google?.ads?.conversionIds)) return\n\t\tif (!wpmDataLayer?.pixels?.google?.ads?.dynamic_remarketing?.status) return\n\t\tif (!wpm.googleConfigConditionsMet(\"ads\")) return\n\n\t\twpm.gtagLoaded().then(function () {\n\t\t gtag(\"event\", \"purchase\", {\n \t\t\tsend_to: wpm.getGoogleAdsConversionIdentifiers(),\n \t\t\tvalue : wpmDataLayer.order.value_filtered,\n \t\t\titems : wpm.getGoogleAdsDynamicRemarketingOrderItems(),\n \t\t})\n\t\t})\n\n\t\t// console.log(wpm.getGoogleAdsDynamicRemarketingOrderItems())\n\t} catch (e) {\n\t\tconsole.error(e)\n\t}\n})\n\n// user log in event\njQuery(document).on(\"wpmLogin\", function () {\n\n\ttry {\n\t\tif(jQuery.isEmptyObject(wpmDataLayer?.pixels?.google?.ads?.conversionIds)) return\n\t\tif (!wpmDataLayer?.pixels?.google?.ads?.dynamic_remarketing?.status) return\n\t\tif (!wpm.googleConfigConditionsMet(\"ads\")) return\n\n\n\t\twpm.gtagLoaded().then(function () {\n\t\t gtag(\"event\", \"login\", {\n \t\t\tsend_to: wpm.getGoogleAdsConversionIdentifiers(),\n \t\t})\n\t\t})\n\t} catch (e) {\n\t\tconsole.error(e)\n\t}\n})\n\n// view order received page event\n// new_customer parameter: https://support.google.com/google-ads/answer/9917012\njQuery(document).on(\"wpmOrderReceivedPage\", function () {\n\n\ttry {\n\t\tif(jQuery.isEmptyObject(wpmDataLayer?.pixels?.google?.ads?.conversionIds)) return\n\t\tif (!wpm.googleConfigConditionsMet(\"ads\")) return\n\n\t\tlet data_basic = {}\n\t\tlet data_with_cart = {}\n\n\t\tdata_basic = {\n\t\t\tsend_to : wpm.getGoogleAdsConversionIdentifiersWithLabel(),\n\t\t\ttransaction_id: wpmDataLayer.order.number,\n\t\t\tvalue : wpmDataLayer.order.value_filtered,\n\t\t\tcurrency : wpmDataLayer.order.currency,\n\t\t\tnew_customer : wpmDataLayer.order.new_customer,\n\t\t}\n\n\t\tif (wpmDataLayer?.order?.aw_merchant_id) {\n\t\t\tdata_with_cart = {\n\t\t\t\tdiscount : wpmDataLayer.order.discount,\n\t\t\t\taw_merchant_id : wpmDataLayer.order.aw_merchant_id,\n\t\t\t\taw_feed_country : wpmDataLayer.order.aw_feed_country,\n\t\t\t\taw_feed_language: wpmDataLayer.order.aw_feed_language,\n\t\t\t\titems : wpm.getGoogleAdsRegularOrderItems(),\n\t\t\t}\n\t\t}\n\n\t\twpm.gtagLoaded().then(function () {\n\t\t\tgtag(\"event\", \"conversion\", {...data_basic, ...data_with_cart})\n\t\t})\n\n\t\t// console.log({...data_basic,...data_with_cart})\n\n\t\t// console.log(wpm.getGoogleAdsOrderItems())\n\t} catch (e) {\n\t\tconsole.error(e)\n\t}\n})\n\n\n\n\n\n","// TODO check all events and add more if there are any\n\n/**\n * Add functions for Snapchat Ads\n * */\n\n(function (wpm, $, undefined) {\n\n\n}(window.wpm = window.wpm || {}, jQuery));\n\n/**\n * Execute as soon as possible\n * */\n\n(function () {\n\t//\n\t//\n\t// if ('order_received_page' === wpmDataLayer.shop.page_type && wpmDataLayer?.order?.google?.ads?.enhanced_conversion_data) {\n\t// \tvar enhanced_conversion_data_2 = wpmDataLayer.order.google.ads.enhanced_conversion_data;\n\t// }\n\n})()\n\n","/**\n * Add functions for Google\n * */\n\n\n(function (wpm, $, undefined) {\n\n\twpm.getCartItemsGa4 = function () {\n\n\t\tlet data = []\n\n\t\tfor (const [productId, product] of Object.entries(wpmDataLayer.cart)) {\n\n\t\t\tlet productItems = {\n\t\t\t\titem_id : product.dyn_r_ids[wpmDataLayer.pixels.google.analytics.id_type],\n\t\t\t\titem_name: product.name,\n\t\t\t\tquantity : product.quantity,\n\t\t\t\t// affiliation : '',\n\t\t\t\t// coupon : '',\n\t\t\t\t// discount : 0,\n\t\t\t\titem_brand : product.brand,\n\t\t\t\titem_variant: product.variant,\n\t\t\t\tprice : product.price,\n\t\t\t\tcurrency : wpmDataLayer.shop.currency,\n\t\t\t}\n\n\t\t\tproductItems = wpm.getFormattedGA4Categories(productItems, product.category)\n\n\t\t\tdata.push(productItems)\n\t\t}\n\n\t\treturn data\n\t}\n\n}(window.wpm = window.wpm || {}, jQuery))\n\n\n/**\n * All event listeners\n * */\n\n// view_item_list event\n// https://developers.google.com/analytics/devguides/collection/ga4/ecommerce?client_type=gtag#view_item_list\njQuery(document).on(\"wpmViewItemList\", function (event, product) {\n\n\ttry {\n\t\tif (!wpmDataLayer?.pixels?.google?.analytics?.eec) return\n\t\tif (!wpmDataLayer?.pixels?.google?.analytics?.ga4?.measurement_id) return\n\t\tif (!wpm.googleConfigConditionsMet(\"analytics\")) return\n\n\t\tlet productItems = {\n\t\t\titem_id : product.dyn_r_ids[wpmDataLayer.pixels.google.analytics.id_type],\n\t\t\titem_name: product.name,\n\t\t\t// coupon : \"\",\n\t\t\t// discount: 0,\n\t\t\tindex : product.list_position, // doesn't make sense on mini_cart\n\t\t\titem_list_name: wpmDataLayer.shop.list_name,\n\t\t\titem_list_id : wpmDataLayer.shop.list_id,\n\t\t\t// affiliation: \"\",\n\t\t\titem_brand : product.brand,\n\t\t\titem_variant: product.variant,\n\t\t\tprice : product.price,\n\t\t\tcurrency : wpmDataLayer.shop.currency,\n\t\t\tquantity : product.quantity,\n\t\t}\n\n\t\tproductItems = wpm.getFormattedGA4Categories(productItems, product.category)\n\n\t\twpm.gtagLoaded().then(function () {\n\t\t gtag(\"event\", \"view_item_list\", {\n \t\t\tsend_to : wpmDataLayer.pixels.google.analytics.ga4.measurement_id,\n \t\t\titems : [productItems],\n \t\t\titem_list_name: wpmDataLayer.shop.list_name, // doesn't make sense on mini_cart\n \t\t\titem_list_id : wpmDataLayer.shop.list_id, // doesn't make sense on mini_cart\n \t\t})\n\t\t})\n\t} catch (e) {\n\t\tconsole.error(e)\n\t}\n})\n\n// select_item event\n// https://developers.google.com/analytics/devguides/collection/ga4/ecommerce?client_type=gtag#select_item\njQuery(document).on(\"wpmSelectItem\", function (event, product) {\n\n\ttry {\n\t\tif (!wpmDataLayer?.pixels?.google?.analytics?.eec) return\n\t\tif (!wpmDataLayer?.pixels?.google?.analytics?.ga4?.measurement_id) return\n\t\tif (!wpm.googleConfigConditionsMet(\"analytics\")) return\n\n\t\tlet productItems = {\n\t\t\titem_id : product.dyn_r_ids[wpmDataLayer.pixels.google.analytics.id_type],\n\t\t\titem_name: product.name,\n\t\t\t// coupon : \"\",\n\t\t\t// discount: 0,\n\t\t\tindex : product.list_position, // doesn't make sense on mini_cart\n\t\t\titem_list_name: wpmDataLayer.shop.list_name,\n\t\t\titem_list_id : wpmDataLayer.shop.list_id,\n\t\t\t// affiliation: \"\",\n\t\t\titem_brand : product.brand,\n\t\t\titem_variant: product.variant,\n\t\t\tprice : product.price,\n\t\t\tcurrency : wpmDataLayer.shop.currency,\n\t\t\tquantity : product.quantity,\n\t\t}\n\n\t\tproductItems = wpm.getFormattedGA4Categories(productItems, product.category)\n\n\t\twpm.gtagLoaded().then(function () {\n\t\t gtag(\"event\", \"select_item\", {\n \t\t\tsend_to: wpmDataLayer.pixels.google.analytics.ga4.measurement_id,\n \t\t\titems : [productItems],\n \t\t})\n\t\t})\n\t} catch (e) {\n\t\tconsole.error(e)\n\t}\n})\n\n// add_to_cart event\n// https://developers.google.com/analytics/devguides/collection/ga4/ecommerce?client_type=gtag#add_to_cart\njQuery(document).on(\"wpmAddToCart\", function (event, product) {\n\n\ttry {\n\t\tif (!wpmDataLayer?.pixels?.google?.analytics?.eec) return\n\t\tif (!wpmDataLayer?.pixels?.google?.analytics?.ga4?.measurement_id) return\n\t\tif (!wpm.googleConfigConditionsMet(\"analytics\")) return\n\n\t\tlet productItems = {\n\t\t\titem_name : product.name,\n\t\t\titem_id : product.dyn_r_ids[wpmDataLayer.pixels.google.analytics.id_type],\n\t\t\titem_list_name: wpmDataLayer.shop.list_name,\n\t\t\titem_list_id : wpmDataLayer.shop.list_id,\n\t\t\t// coupon: \"\",\n\t\t\t// discount: 0,\n\t\t\t// affiliation: \"\",\n\t\t\titem_brand : product.brand,\n\t\t\titem_variant: product.variant,\n\t\t\tprice : product.price,\n\t\t\tcurrency : wpmDataLayer.shop.currency,\n\t\t\tquantity : product.quantity,\n\t\t}\n\n\t\tproductItems = wpm.getFormattedGA4Categories(productItems, product.category)\n\n\t\twpm.gtagLoaded().then(function () {\n\t\t gtag(\"event\", \"add_to_cart\", {\n \t\t\tsend_to : wpmDataLayer.pixels.google.analytics.ga4.measurement_id,\n \t\t\tcurrency: wpmDataLayer.shop.currency,\n \t\t\t// value: 0,\n \t\t\titems: [productItems],\n \t\t})\n\t\t})\n\t} catch (e) {\n\t\tconsole.error(e)\n\t}\n})\n\n// view_item event\n// https://developers.google.com/analytics/devguides/collection/ga4/ecommerce?client_type=gtag#view_item\njQuery(document).on(\"wpmViewItem\", function (event, product) {\n\n\ttry {\n\t\tif (!wpmDataLayer?.pixels?.google?.analytics?.eec) return\n\t\tif (!wpmDataLayer?.pixels?.google?.analytics?.ga4?.measurement_id) return\n\t\tif (!wpm.googleConfigConditionsMet(\"analytics\")) return\n\n\t\tlet productItems = {\n\t\t\titem_id : product.dyn_r_ids[wpmDataLayer.pixels.google.analytics.id_type],\n\t\t\titem_name: product.name,\n\t\t\t// coupon: \"\",\n\t\t\t// discount: 0,\n\t\t\t// affiliation: \"\",\n\t\t\titem_brand : product.brand,\n\t\t\titem_variant : product.variant,\n\t\t\tprice : product.price,\n\t\t\tcurrency : wpmDataLayer.shop.currency,\n\t\t\tquantity : 1,\n\t\t\titem_list_name: wpmDataLayer.shop.list_name,\n\t\t\titem_list_id : wpmDataLayer.shop.list_id,\n\t\t}\n\n\t\tproductItems = wpm.getFormattedGA4Categories(productItems, product.category)\n\n\t\twpm.gtagLoaded().then(function () {\n\t\t gtag(\"event\", \"view_item\", {\n \t\t\tsend_to : wpmDataLayer.pixels.google.analytics.ga4.measurement_id,\n \t\t\tcurrency: wpmDataLayer.shop.currency,\n \t\t\t// value: 0,\n \t\t\titems: [productItems],\n \t\t})\n\t\t})\n\t} catch (e) {\n\t\tconsole.error(e)\n\t}\n})\n\n// add_to_wishlist event\n// https://developers.google.com/analytics/devguides/collection/ga4/ecommerce?client_type=gtag#add_to_wishlist\njQuery(document).on(\"wpmAddToWishlist\", function (event, product) {\n\n\ttry {\n\t\tif (!wpmDataLayer?.pixels?.google?.analytics?.eec) return\n\t\tif (!wpmDataLayer?.pixels?.google?.analytics?.ga4?.measurement_id) return\n\t\tif (!wpm.googleConfigConditionsMet(\"analytics\")) return\n\n\t\tlet productItems = {\n\t\t\titem_id : product.dyn_r_ids[wpmDataLayer.pixels.google.analytics.id_type],\n\t\t\titem_name: product.name,\n\t\t\tquantity : 1,\n\t\t\t// affiliation: \"\",\n\t\t\t// coupon: \"\",\n\t\t\t// discount: 0,\n\t\t\titem_brand : product.brand,\n\t\t\titem_variant: product.variant,\n\t\t\tprice : product.price,\n\t\t\tcurrency : wpmDataLayer.shop.currency,\n\t\t}\n\n\t\tproductItems = wpm.getFormattedGA4Categories(productItems, product.category)\n\n\t\twpm.gtagLoaded().then(function () {\n\t\t gtag(\"event\", \"add_to_wishlist\", {\n \t\t\tsend_to : wpmDataLayer.pixels.google.analytics.ga4.measurement_id,\n \t\t\tcurrency: wpmDataLayer.shop.currency,\n \t\t\t// value: 0,\n \t\t\titems: [productItems],\n \t\t})\n\t\t})\n\t} catch (e) {\n\t\tconsole.error(e)\n\t}\n})\n\n// remove_from_cart event\n// https://developers.google.com/analytics/devguides/collection/ga4/ecommerce?client_type=gtag#remove_from_cart\njQuery(document).on(\"wpmRemoveFromCart\", function (event, product) {\n\n\ttry {\n\t\tif (!wpmDataLayer?.pixels?.google?.analytics?.eec) return\n\t\tif (!wpmDataLayer?.pixels?.google?.analytics?.ga4?.measurement_id) return\n\t\tif (!wpm.googleConfigConditionsMet(\"analytics\")) return\n\n\t\tlet productItems = {\n\t\t\titem_id : product.dyn_r_ids[wpmDataLayer.pixels.google.analytics.id_type],\n\t\t\titem_name: product.name,\n\t\t\t// coupon: \"\",\n\t\t\t// discount: 0,\n\t\t\t// affiliation: \"\",\n\t\t\titem_brand : product.brand,\n\t\t\titem_variant: product.variant,\n\t\t\tprice : product.price,\n\t\t\tcurrency : wpmDataLayer.shop.currency,\n\t\t\tquantity : product.quantity,\n\t\t}\n\n\t\tproductItems = wpm.getFormattedGA4Categories(productItems, product.category)\n\n\t\twpm.gtagLoaded().then(function () {\n\t\t gtag(\"event\", \"remove_from_cart\", {\n \t\t\tsend_to : wpmDataLayer.pixels.google.analytics.ga4.measurement_id,\n \t\t\tcurrency: wpmDataLayer.shop.currency,\n \t\t\t// value: 0,\n \t\t\titems: [productItems],\n \t\t})\n\t\t})\n\t} catch (e) {\n\t\tconsole.error(e)\n\t}\n})\n\n// begin_checkout event\n// https://developers.google.com/analytics/devguides/collection/ga4/ecommerce?client_type=gtag#begin_checkout\njQuery(document).on(\"wpmBeginCheckout\", function (event) {\n\n\ttry {\n\t\tif (!wpmDataLayer?.pixels?.google?.analytics?.eec) return\n\t\tif (!wpmDataLayer?.pixels?.google?.analytics?.ga4?.measurement_id) return\n\t\tif (!wpm.googleConfigConditionsMet(\"analytics\")) return\n\n\t\twpm.gtagLoaded().then(function () {\n\t\t gtag(\"event\", \"begin_checkout\", {\n \t\t\tsend_to: wpmDataLayer.pixels.google.analytics.ga4.measurement_id,\n \t\t\t// coupon: \"\",\n \t\t\tcurrency: wpmDataLayer.shop.currency,\n \t\t\t// value: 0,\n \t\t\titems: wpm.getCartItemsGa4(),\n \t\t})\n\t\t})\n\t} catch (e) {\n\t\tconsole.error(e)\n\t}\n})\n\n// view_cart event\n// https://developers.google.com/analytics/devguides/collection/ga4/ecommerce?client_type=gtag#view_cart\njQuery(document).on(\"wpmViewCart\", function (event) {\n\n\ttry {\n\t\tif (!wpmDataLayer?.pixels?.google?.analytics?.eec) return\n\t\tif (!wpmDataLayer?.pixels?.google?.analytics?.ga4?.measurement_id) return\n\t\tif (!wpm.googleConfigConditionsMet(\"analytics\")) return\n\n\t\tif (jQuery.isEmptyObject(wpmDataLayer.cart)) return\n\n\t\tlet products = []\n\t\tlet cartValue = null\n\n\t\tfor (const [key, product] of Object.entries(wpmDataLayer.cart)) {\n\t\t\t// console.log(`${key}: ${value}`);\n\n\t\t\tlet productItems = {\n\t\t\t\titem_id : product.dyn_r_ids[wpmDataLayer.pixels.google.analytics.id_type],\n\t\t\t\titem_name: product.name,\n\t\t\t\tquantity : product.quantity,\n\t\t\t\t// affiliation: \"\",\n\t\t\t\t// coupon: \"\",\n\t\t\t\t// discount: 0,\n\t\t\t\t// index : product.position,\n\t\t\t\titem_brand : product.brand,\n\t\t\t\titem_list_name: wpmDataLayer.shop.list_name,\n\t\t\t\titem_list_id : wpmDataLayer.shop.list_id,\n\t\t\t\titem_variant : product.variant,\n\t\t\t\tprice : product.price,\n\t\t\t\tcurrency : wpmDataLayer.shop.currency,\n\t\t\t}\n\n\t\t\tproductItems = wpm.getFormattedGA4Categories(productItems, product.category)\n\n\t\t\tproducts.push(productItems)\n\n\t\t\tcartValue = cartValue + product.quantity * product.price\n\t\t}\n\n\t\t// console.log(products)\n\t\t// console.log('cart value: ' + cartValue.toFixed(2))\n\n\t\twpm.gtagLoaded().then(function () {\n\t\t\tgtag(\"event\", \"view_cart\", {\n\t\t\t\tsend_to : wpmDataLayer.pixels.google.analytics.ga4.measurement_id,\n\t\t\t\tcurrency: wpmDataLayer.shop.currency,\n\t\t\t\tvalue : cartValue.toFixed(2),\n\t\t\t\titems : products,\n\t\t\t})\n\t\t})\n\t} catch (e) {\n\t\tconsole.error(e)\n\t}\n})\n\n\n// view search event\njQuery(document).on(\"wpmSearch\", function () {\n\n\ttry {\n\t\tif (!wpmDataLayer?.pixels?.google?.analytics?.eec) return\n\t\tif (!wpmDataLayer?.pixels?.google?.analytics?.ga4?.measurement_id) return\n\t\tif (!wpm.googleConfigConditionsMet(\"analytics\")) return\n\n\t\tlet products = []\n\n\t\tfor (const [key, product] of Object.entries(wpmDataLayer.products)) {\n\t\t\t// console.log(`${key}: ${value}`);\n\n\t\t\tlet productItems = {\n\t\t\t\titem_id : product.dyn_r_ids[wpmDataLayer.pixels.google.analytics.id_type],\n\t\t\t\titem_name: product.name,\n\t\t\t\tquantity : 1,\n\t\t\t\t// \"affiliation\": \"\",\n\t\t\t\t// \"coupon\": \"\",\n\t\t\t\t// \"discount\": 0,\n\t\t\t\tindex : product.position,\n\t\t\t\titem_brand : product.brand,\n\t\t\t\titem_list_name: wpmDataLayer.shop.list_name,\n\t\t\t\titem_list_id : wpmDataLayer.shop.list_id,\n\t\t\t\titem_variant : product.variant,\n\t\t\t\tprice : product.price,\n\t\t\t\tcurrency : wpmDataLayer.shop.currency,\n\t\t\t}\n\n\t\t\tproductItems = wpm.getFormattedGA4Categories(productItems, product.category)\n\n\t\t\tproducts.push(productItems)\n\t\t}\n\n\t\twpm.gtagLoaded().then(function () {\n\t\t\tgtag(\"event\", \"view_search_results\", {\n\t\t\t\tsend_to : wpmDataLayer.pixels.google.analytics.ga4.measurement_id,\n\t\t\t\tsearch_term: wpm.getSearchTermFromUrl(),\n\t\t\t\titems : products,\n\t\t\t})\n\n\t\t})\n\n\n\t} catch (e) {\n\t\tconsole.error(e)\n\t}\n})\n\n// user log in event\njQuery(document).on(\"wpmLogin\", function () {\n\n\ttry {\n\t\tif (!wpmDataLayer?.pixels?.google?.analytics?.eec) return\n\t\tif (!wpmDataLayer?.pixels?.google?.analytics?.ga4?.measurement_id) return\n\t\tif (!wpm.googleConfigConditionsMet(\"analytics\")) return\n\n\n\t\twpm.gtagLoaded().then(function () {\n\t\t\tgtag(\"event\", \"login\", {\n\t\t\t\tsend_to: wpmDataLayer.pixels.google.analytics.ga4.measurement_id,\n\t\t\t})\n\t\t})\n\t} catch (e) {\n\t\tconsole.error(e)\n\t}\n})\n\n\n","/**\n * Add functions for Google Analytics 4\n * */\n\n(function (wpm, $, undefined) {\n\n\twpm.getGA4OrderItems = function () {\n\n\t\t// \"item_id\" : \"34\",\n\t\t// \"item_name\" : \"Hoodie\",\n\t\t// \"quantity\" : 1,\n\t\t// \"item_brand\" : \"\",\n\t\t// \"item_variant\" : \"Color: blue | Logo: yes\",\n\t\t// \"price\" : 45,\n\t\t// \"currency\" : \"CHF\",\n\t\t// \"item_category\": \"Hoodies\"\n\n\n\t\tlet orderItems = []\n\n\t\tfor (const [key, item] of Object.entries(wpmDataLayer.order.items)) {\n\n\t\t\tlet orderItem\n\n\t\t\torderItem = {\n\t\t\t\tquantity : item.quantity,\n\t\t\t\tprice : item.price,\n\t\t\t\titem_name : item.name,\n\t\t\t\tcurrency : wpmDataLayer.order.currency,\n\t\t\t\titem_category: wpmDataLayer.products[item.id].category.join(\"/\"),\n\t\t\t}\n\n\t\t\tif (wpmDataLayer?.general?.variationsOutput && 0 !== item.variation_id) {\n\n\t\t\t\torderItem.item_id = String(wpmDataLayer.products[item.variation_id].dyn_r_ids[wpmDataLayer.pixels.google.analytics.id_type])\n\t\t\t\torderItem.item_variant = wpmDataLayer.products[item.variation_id].variant_name\n\t\t\t\torderItem.item_brand = wpmDataLayer.products[item.variation_id].brand\n\t\t\t\torderItems.push(orderItem)\n\t\t\t} else {\n\n\t\t\t\torderItem.item_id = String(wpmDataLayer.products[item.id].dyn_r_ids[wpmDataLayer.pixels.google.analytics.id_type])\n\t\t\t\torderItem.item_brand = wpmDataLayer.products[item.id].brand\n\t\t\t\torderItems.push(orderItem)\n\t\t\t}\n\t\t}\n\n\t\treturn orderItems\n\t}\n\n}(window.wpm = window.wpm || {}, jQuery))\n\n\n/**\n * All event listeners\n * */\n\n\n// view order received page event\njQuery(document).on(\"wpmOrderReceivedPage\", function () {\n\n\ttry {\n\t\tif (!wpmDataLayer?.pixels?.google?.analytics?.ga4?.measurement_id) return\n\t\tif (wpmDataLayer?.pixels?.google?.analytics?.ga4?.mp_active) return\n\t\tif (!wpm.googleConfigConditionsMet(\"analytics\")) return\n\n\t\twpm.gtagLoaded().then(function () {\n\t\t gtag(\"event\", \"purchase\", {\n \t\t\tsend_to : [wpmDataLayer.pixels.google.analytics.ga4.measurement_id],\n \t\t\ttransaction_id: wpmDataLayer.order.number,\n \t\t\taffiliation : wpmDataLayer.order.affiliation,\n \t\t\tcurrency : wpmDataLayer.order.currency,\n \t\t\tvalue : wpmDataLayer.order.value_regular,\n \t\t\tdiscount : wpmDataLayer.order.discount,\n \t\t\ttax : wpmDataLayer.order.tax,\n \t\t\tshipping : wpmDataLayer.order.shipping,\n \t\t\tcoupon : wpmDataLayer.order.coupon,\n \t\t\titems : wpm.getGA4OrderItems(),\n \t\t})\n\t\t})\n\t} catch (e) {\n\t\tconsole.error(e)\n\t}\n})\n","/**\n * Add functions for Google\n * */\n\n(function (wpm, $, undefined) {\n\n\twpm.getCartItemsGaUa = function () {\n\n\t\t// console.log('test')\n\n\t\tlet data = []\n\n\t\tfor (const [productId, product] of Object.entries(wpmDataLayer.cart)) {\n\n\t\t\tdata.push({\n\t\t\t\tid : product.dyn_r_ids[wpmDataLayer.pixels.google.analytics.id_type],\n\t\t\t\tname : product.name,\n\t\t\t\tbrand : product.brand,\n\t\t\t\tcategory: product.category.join(\",\"),\n\t\t\t\t// coupon: '',\n\t\t\t\t// list_name: '',\n\t\t\t\t// list_position: 1,\n\t\t\t\tprice : product.price,\n\t\t\t\tquantity: product.quantity,\n\t\t\t\tvariant : product.variant,\n\t\t\t})\n\t\t}\n\n\t\treturn data\n\t}\n\n}(window.wpm = window.wpm || {}, jQuery))\n\n\n/**\n * All event listeners\n * */\n\n// view_item_list event\njQuery(document).on(\"wpmViewItemList\", function (event, product) {\n\n\ttry {\n\t\tif (!wpmDataLayer?.pixels?.google?.analytics?.eec) return\n\t\tif (!wpmDataLayer?.pixels?.google?.analytics?.universal?.property_id) return\n\t\tif (!wpm.googleConfigConditionsMet(\"analytics\")) return\n\n\t\twpm.gtagLoaded().then(function () {\n\t\t gtag(\"event\", \"view_item_list\", {\n \t\t\tsend_to: wpmDataLayer.pixels.google.analytics.universal.property_id,\n \t\t\titems : [{\n \t\t\t\tid : product.dyn_r_ids[wpmDataLayer.pixels.google.analytics.id_type],\n \t\t\t\tname : product.name,\n \t\t\t\tbrand : product.brand,\n \t\t\t\tcategory: product.category.join(\",\"),\n \t\t\t\t// coupon : \"\",\n \t\t\t\tlist_name : wpmDataLayer.shop.list_name,\n \t\t\t\tlist_position: product.list_position, // doesn't make sense on mini_cart\n \t\t\t\tprice : product.price,\n \t\t\t\tquantity : product.quantity,\n \t\t\t\tvariant : product.variant,\n \t\t\t}],\n \t\t})\n\t\t})\n\t} catch (e) {\n\t\tconsole.error(e)\n\t}\n})\n\n// select_content event\njQuery(document).on(\"wpmSelectContentGaUa\", function (event, product) {\n\n\ttry {\n\t\tif (!wpmDataLayer?.pixels?.google?.analytics?.eec) return\n\t\tif (!wpmDataLayer?.pixels?.google?.analytics?.universal?.property_id) return\n\t\tif (!wpm.googleConfigConditionsMet(\"analytics\")) return\n\n\t\twpm.gtagLoaded().then(function () {\n\t\t gtag(\"event\", \"select_content\", {\n \t\t\tsend_to : wpmDataLayer.pixels.google.analytics.universal.property_id,\n \t\t\tcontent_type: \"product\",\n \t\t\titems : [\n \t\t\t\t{\n \t\t\t\t\tid : product.dyn_r_ids[wpmDataLayer.pixels.google.analytics.id_type],\n \t\t\t\t\tname : product.name,\n \t\t\t\t\tlist_name : wpmDataLayer.shop.list_name,\n \t\t\t\t\tbrand : product.brand,\n \t\t\t\t\tcategory : product.category.join(\",\"),\n \t\t\t\t\tvariant : product.variant,\n \t\t\t\t\tlist_position: product.list_position, // doesn't make sense on mini_cart\n \t\t\t\t\tquantity : product.quantity,\n \t\t\t\t\tprice : product.price,\n \t\t\t\t},\n \t\t\t],\n \t\t})\n\t\t})\n\t} catch (e) {\n\t\tconsole.error(e)\n\t}\n})\n\n// add_to_cart event\njQuery(document).on(\"wpmAddToCart\", function (event, product) {\n\n\ttry {\n\t\tif (!wpmDataLayer?.pixels?.google?.analytics?.eec) return\n\t\tif (!wpmDataLayer?.pixels?.google?.analytics?.universal?.property_id) return\n\t\tif (!wpm.googleConfigConditionsMet(\"analytics\")) return\n\n\t\twpm.gtagLoaded().then(function () {\n\t\t gtag(\"event\", \"add_to_cart\", {\n \t\t\tsend_to : wpmDataLayer.pixels.google.analytics.universal.property_id,\n \t\t\tcurrency: wpmDataLayer.shop.currency,\n \t\t\titems : [\n \t\t\t\t{\n \t\t\t\t\tid : product.dyn_r_ids[wpmDataLayer.pixels.google.analytics.id_type],\n \t\t\t\t\tname : product.name,\n \t\t\t\t\tlist_name : wpmDataLayer.shop.list_name,\n \t\t\t\t\tbrand : product.brand,\n \t\t\t\t\tcategory : product.category.join(\",\"),\n \t\t\t\t\tvariant : product.variant,\n \t\t\t\t\tlist_position: product.list_position, // doesn't make sense on mini_cart\n \t\t\t\t\tquantity : product.quantity,\n \t\t\t\t\tprice : product.price,\n \t\t\t\t},\n \t\t\t],\n \t\t})\n\t\t})\n\t} catch (e) {\n\t\tconsole.error(e)\n\t}\n})\n\n// view_item event\njQuery(document).on(\"wpmViewItem\", function (event, product) {\n\n\ttry {\n\t\tif (!wpmDataLayer?.pixels?.google?.analytics?.eec) return\n\t\tif (!wpmDataLayer?.pixels?.google?.analytics?.universal?.property_id) return\n\t\tif (!wpm.googleConfigConditionsMet(\"analytics\")) return\n\n\t\twpm.gtagLoaded().then(function () {\n\t\t gtag(\"event\", \"view_item\", {\n \t\t\tsend_to: wpmDataLayer.pixels.google.analytics.universal.property_id,\n \t\t\titems : [{\n \t\t\t\tid : product.dyn_r_ids[wpmDataLayer.pixels.google.analytics.id_type],\n \t\t\t\tname : product.name,\n \t\t\t\tlist_name : wpmDataLayer.shop.list_name, // doesn't make sense on mini_cart\n \t\t\t\tbrand : product.brand,\n \t\t\t\tcategory : product.category.join(\",\"),\n \t\t\t\tvariant : product.variant,\n \t\t\t\tlist_position: 1,\n \t\t\t\tquantity : 1,\n \t\t\t\tprice : product.price,\n \t\t\t}],\n \t\t})\n\t\t})\n\t} catch (e) {\n\t\tconsole.error(e)\n\t}\n})\n\n// add_to_wishlist event\njQuery(document).on(\"wpmAddToWishlist\", function (event, product) {\n\n\ttry {\n\t\tif (!wpmDataLayer?.pixels?.google?.analytics?.eec) return\n\t\tif (!wpmDataLayer?.pixels?.google?.analytics?.universal?.property_id) return\n\t\tif (!wpm.googleConfigConditionsMet(\"analytics\")) return\n\n\t\twpm.gtagLoaded().then(function () {\n\t\t gtag(\"event\", \"add_to_wishlist\", {\n \t\t\tsend_to: wpmDataLayer.pixels.google.analytics.universal.property_id,\n \t\t\titems : [\n \t\t\t\t{\n \t\t\t\t\tid : product.dyn_r_ids[wpmDataLayer.pixels.google.analytics.id_type],\n \t\t\t\t\tname : product.name,\n \t\t\t\t\tbrand : product.brand,\n \t\t\t\t\tcategory: product.category.join(\",\"),\n \t\t\t\t\t// coupon : \"\",\n \t\t\t\t\tlist_name : wpmDataLayer.shop.list_name, // doesn't make sense on mini_cart\n \t\t\t\t\tlist_position: product.position,\n \t\t\t\t\tprice : product.price,\n \t\t\t\t\tquantity : 1,\n \t\t\t\t\tvariant : product.variant,\n \t\t\t\t},\n \t\t\t],\n \t\t})\n\t\t})\n\t} catch (e) {\n\t\tconsole.error(e)\n\t}\n})\n\n// remove_from_cart event\njQuery(document).on(\"wpmRemoveFromCart\", function (event, product) {\n\n\ttry {\n\t\tif (!wpmDataLayer?.pixels?.google?.analytics?.eec) return\n\t\tif (!wpmDataLayer?.pixels?.google?.analytics?.universal?.property_id) return\n\t\tif (!wpm.googleConfigConditionsMet(\"analytics\")) return\n\n\t\twpm.gtagLoaded().then(function () {\n\t\t gtag(\"event\", \"remove_from_cart\", {\n \t\t\tsend_to : wpmDataLayer.pixels.google.analytics.universal.property_id,\n \t\t\tcurrency: wpmDataLayer.shop.currency,\n \t\t\titems : [\n \t\t\t\t{\n \t\t\t\t\tid : product.dyn_r_ids[wpmDataLayer.pixels.google.analytics.id_type],\n \t\t\t\t\tname : product.name,\n \t\t\t\t\tlist_name: wpmDataLayer.shop.list_name,\n \t\t\t\t\tbrand : product.brand,\n \t\t\t\t\tcategory : product.category.join(\",\"),\n \t\t\t\t\tvariant : product.variant,\n \t\t\t\t\t// list_position: product.list_position, // doesn't make sense on mini_cart\n \t\t\t\t\tquantity: product.quantity,\n \t\t\t\t\tprice : product.price,\n \t\t\t\t},\n \t\t\t],\n \t\t})\n\t\t})\n\t} catch (e) {\n\t\tconsole.error(e)\n\t}\n})\n\n// begin_checkout event\njQuery(document).on(\"wpmBeginCheckout\", function (event) {\n\n\ttry {\n\t\tif (!wpmDataLayer?.pixels?.google?.analytics?.eec) return\n\t\tif (!wpmDataLayer?.pixels?.google?.analytics?.universal?.property_id) return\n\t\tif (!wpm.googleConfigConditionsMet(\"analytics\")) return\n\n\t\twpm.gtagLoaded().then(function () {\n\t\t gtag(\"event\", \"begin_checkout\", {\n \t\t\tsend_to : wpmDataLayer.pixels.google.analytics.universal.property_id,\n \t\t\tcurrency: wpmDataLayer.shop.currency,\n \t\t\titems : wpm.getCartItemsGaUa(),\n \t\t})\n\t\t})\n\t} catch (e) {\n\t\tconsole.error(e)\n\t}\n})\n\n// set_checkout_option event\njQuery(document).on(\"wpmFireCheckoutOption\", function (event, data) {\n\n\ttry {\n\t\tif (!wpmDataLayer?.pixels?.google?.analytics?.eec) return\n\t\tif (!wpmDataLayer?.pixels?.google?.analytics?.universal?.property_id) return\n\t\tif (!wpm.googleConfigConditionsMet(\"analytics\")) return\n\n\t\twpm.gtagLoaded().then(function () {\n\t\t gtag(\"event\", \"set_checkout_option\", {\n \t\t\tsend_to : wpmDataLayer.pixels.google.analytics.universal.property_id,\n \t\t\tcheckout_step : data.step,\n \t\t\tcheckout_option: data.checkout_option,\n \t\t\tvalue : data.value,\n \t\t})\n\t\t})\n\t} catch (e) {\n\t\tconsole.error(e)\n\t}\n})\n\n// checkout_progress event\njQuery(document).on(\"wpmFireCheckoutProgress\", function (event, data) {\n\n\ttry {\n\t\tif (!wpmDataLayer?.pixels?.google?.analytics?.eec) return\n\t\tif (!wpmDataLayer?.pixels?.google?.analytics?.universal?.property_id) return\n\t\tif (!wpm.googleConfigConditionsMet(\"analytics\")) return\n\n\t\twpm.gtagLoaded().then(function () {\n\t\t gtag(\"event\", \"checkout_progress\", {\n \t\t\tsend_to : wpmDataLayer.pixels.google.analytics.universal.property_id,\n \t\t\tcheckout_step: data.step,\n \t\t})\n\t\t})\n\t} catch (e) {\n\t\tconsole.error(e)\n\t}\n})\n\n// view search event\njQuery(document).on(\"wpmSearch\", function () {\n\n\ttry {\n\t\tif (!wpmDataLayer?.pixels?.google?.analytics?.eec) return\n\t\tif (!wpmDataLayer?.pixels?.google?.analytics?.universal?.property_id) return\n\t\tif (!wpm.googleConfigConditionsMet(\"analytics\")) return\n\n\t\tlet products = []\n\n\t\tfor (const [key, product] of Object.entries(wpmDataLayer.products)) {\n\t\t\t// console.log(`${key}: ${value}`);\n\n\t\t\tproducts.push({\n\t\t\t\tid : product.dyn_r_ids[wpmDataLayer.pixels.google.analytics.id_type],\n\t\t\t\tname : product.name,\n\t\t\t\tquantity: 1,\n\t\t\t\t// affiliation: \"\",\n\t\t\t\t// coupon: \"\",\n\t\t\t\t// discount: 0,\n\t\t\t\tlist_position: product.position,\n\t\t\t\tbrand : product.brand,\n\t\t\t\tcategory : product.category.join(\",\"),\n\t\t\t\tlist_name : wpmDataLayer.shop.list_name,\n\t\t\t\tvariant : product.variant,\n\t\t\t\tprice : product.price,\n\t\t\t})\n\t\t}\n\n\t\twpm.gtagLoaded().then(function () {\n\t\t\tgtag(\"event\", \"view_search_results\", {\n\t\t\t\tsend_to : wpmDataLayer.pixels.google.analytics.universal.property_id,\n\t\t\t\tsearch_term: wpm.getSearchTermFromUrl(),\n\t\t\t\titems : products,\n\t\t\t})\n\t\t})\n\t} catch (e) {\n\t\tconsole.error(e)\n\t}\n})\n\n// user log in event\njQuery(document).on(\"wpmLogin\", function () {\n\n\ttry {\n\t\tif (!wpmDataLayer?.pixels?.google?.analytics?.eec) return\n\t\tif (!wpmDataLayer?.pixels?.google?.analytics?.universal?.property_id) return\n\t\tif (!wpm.googleConfigConditionsMet(\"analytics\")) return\n\n\n\t\twpm.gtagLoaded().then(function () {\n\t\t gtag(\"event\", \"login\", {\n \t\t\tsend_to: wpmDataLayer.pixels.google.analytics.universal.property_id,\n \t\t})\n\t\t})\n\t} catch (e) {\n\t\tconsole.error(e)\n\t}\n})\n\n","/**\n * Add functions for Google Analytics Universal\n * */\n\n(function (wpm, $, undefined) {\n\n\twpm.getGAUAOrderItems = function () {\n\n\t\t// \"id\" : \"34\",\n\t\t// \"name\" : \"Hoodie\",\n\t\t// \"brand\" : \"\",\n\t\t// \"category\" : \"Hoodies\",\n\t\t// \"list_position\": 1,\n\t\t// \"price\" : 45,\n\t\t// \"quantity\" : 1,\n\t\t// \"variant\" : \"Color: blue | Logo: yes\"\n\n\n\t\tlet orderItems = [],\n\t\t\tlist_position = 1\n\n\t\tfor (const [key, item] of Object.entries(wpmDataLayer.order.items)) {\n\n\t\t\tlet orderItem\n\n\t\t\torderItem = {\n\t\t\t\tquantity : item.quantity,\n\t\t\t\tprice : item.price,\n\t\t\t\titem_name : item.name,\n\t\t\t\tcurrency : wpmDataLayer.order.currency,\n\t\t\t\titem_category: wpmDataLayer.products[item.id].category.join(\"/\"),\n\t\t\t\tlist_position: list_position,\n\t\t\t}\n\n\t\t\tif (wpmDataLayer?.general?.variationsOutput && 0 !== item.variation_id) {\n\n\t\t\t\torderItem.id = String(wpmDataLayer.products[item.variation_id].dyn_r_ids[wpmDataLayer.pixels.google.analytics.id_type])\n\t\t\t\torderItem.variant = wpmDataLayer.products[item.variation_id].variant_name\n\t\t\t\torderItem.item_brand = wpmDataLayer.products[item.variation_id].brand\n\t\t\t\torderItems.push(orderItem)\n\t\t\t} else {\n\n\t\t\t\torderItem.id = String(wpmDataLayer.products[item.id].dyn_r_ids[wpmDataLayer.pixels.google.analytics.id_type])\n\t\t\t\torderItem.item_brand = wpmDataLayer.products[item.id].brand\n\t\t\t\torderItems.push(orderItem)\n\t\t\t}\n\n\t\t\tlist_position++\n\t\t}\n\n\t\treturn orderItems\n\t}\n\n}(window.wpm = window.wpm || {}, jQuery))\n\n\n/**\n * All event listeners\n * */\n\n\n// view order received page event\njQuery(document).on(\"wpmOrderReceivedPage\", function () {\n\n\ttry {\n\t\tif (!wpmDataLayer?.pixels?.google?.analytics?.universal?.property_id) return\n\t\tif (wpmDataLayer?.pixels?.google?.analytics?.universal?.mp_active) return\n\t\tif (!wpm.googleConfigConditionsMet(\"analytics\")) return\n\n\t\twpm.gtagLoaded().then(function () {\n\t\t gtag(\"event\", \"purchase\", {\n \t\t\tsend_to : [wpmDataLayer.pixels.google.analytics.universal.property_id],\n \t\t\ttransaction_id: wpmDataLayer.order.number,\n \t\t\taffiliation : wpmDataLayer.order.affiliation,\n \t\t\tcurrency : wpmDataLayer.order.currency,\n \t\t\tvalue : wpmDataLayer.order.value_regular,\n \t\t\tdiscount : wpmDataLayer.order.discount,\n \t\t\ttax : wpmDataLayer.order.tax,\n \t\t\tshipping : wpmDataLayer.order.shipping,\n \t\t\tcoupon : wpmDataLayer.order.coupon,\n \t\t\titems : wpm.getGAUAOrderItems(),\n \t\t})\n\t\t})\n\n\t\t// console.log(wpm.getGAUAOrderItems())\n\t} catch (e) {\n\t\tconsole.error(e)\n\t}\n})\n","(function (wpm, $, undefined) {\n\n\twpm.load_google_optimize_pixel = function () {\n\n\t\ttry {\n\t\t\tif (wpmDataLayer?.pixels?.google?.optimize?.container_id) {\n\n\t\t\t\twpmDataLayer.pixels.google.optimize.loaded = true\n\n\t\t\t\twpm.loadScriptAndCacheIt(\"https://www.googleoptimize.com/optimize.js?id=\" + wpmDataLayer.pixels.google.optimize.container_id)\n\t\t\t\t// .done(function (script, textStatus) {\n\t\t\t\t// \t\tconsole.log('Google Optimize loaded')\n\t\t\t\t// });\n\t\t\t}\n\t\t} catch (e) {\n\t\t\tconsole.error(e)\n\t\t}\n\t}\n\n}(window.wpm = window.wpm || {}, jQuery));\n\n\n(function () {\n\n\tjQuery(document).on(\"wpmLoadPixels\", function () {\n\n\t\tif (wpm.canIFire(\"analytics\", \"google-optimize\") && !wpmDataLayer?.pixels?.google?.optimize?.loaded) wpm.load_google_optimize_pixel()\n\n\t})\n\n})()\n\n\n\n","/**\n * Add functions for Google\n * */\n\n(function (wpm, $, undefined) {\n\n\twpm.googleConfigConditionsMet = function (type) {\n\t\t// always returns true if Google Consent Mode is active\n\t\tif (wpmDataLayer?.pixels?.google?.consent_mode?.active) {\n\t\t\treturn true\n\t\t} else if (wpm.getConsentValues().mode === \"category\") {\n\t\t\treturn wpm.getConsentValues().categories[type] === true\n\t\t} else if (wpm.getConsentValues().mode === \"pixel\") {\n\t\t\treturn wpm.getConsentValues().pixels.includes(\"google-\" + type)\n\t\t} else {\n\t\t\treturn false\n\t\t}\n\t}\n\n\twpm.getVisitorConsentStatusAndUpdateGoogleConsentSettings = function (google_consent_settings) {\n\n\t\tif (wpm.getConsentValues().mode === \"category\") {\n\t\t\tif (wpm.getConsentValues().categories.analytics) google_consent_settings.analytics_storage = \"granted\"\n\t\t\tif (wpm.getConsentValues().categories.ads) google_consent_settings.ad_storage = \"granted\"\n\t\t} else if ((wpm.getConsentValues().mode === \"pixel\")) {\n\t\t\tgoogle_consent_settings.analytics_storage = wpm.getConsentValues().pixels.includes(\"google-analytics\") ? \"granted\" : \"denied\"\n\t\t\tgoogle_consent_settings.ad_storage = wpm.getConsentValues().pixels.includes(\"google-ads\") ? \"granted\" : \"denied\"\n\t\t}\n\n\t\treturn google_consent_settings\n\t}\n\n\twpm.updateGoogleConsentMode = function (analytics = true, ads = true) {\n\n\t\ttry {\n\t\t\tif (\n\t\t\t\t!window.gtag ||\n\t\t\t\t!wpmDataLayer.shop.cookie_consent_mgmt.explicit_consent\n\t\t\t) return\n\n\t\t\tgtag(\"consent\", \"update\", {\n\t\t\t\tanalytics_storage: analytics ? \"granted\" : \"denied\",\n\t\t\t\tad_storage : ads ? \"granted\" : \"denied\",\n\t\t\t})\n\t\t} catch (e) {\n\t\t\tconsole.error(e)\n\t\t}\n\t}\n\n\twpm.fireGtagGoogleAds = function () {\n\t\ttry {\n\t\t\twpmDataLayer.pixels.google.ads.state = \"loading\"\n\n\t\t\tif (wpmDataLayer?.pixels?.google?.ads?.enhanced_conversions?.active) {\n\t\t\t\tfor (const [key, item] of Object.entries(wpmDataLayer.pixels.google.ads.conversionIds)) {\n\t\t\t\t\tgtag(\"config\", key, {\"allow_enhanced_conversions\": true})\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tfor (const [key, item] of Object.entries(wpmDataLayer.pixels.google.ads.conversionIds)) {\n\t\t\t\t\tgtag(\"config\", key)\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (wpmDataLayer?.pixels?.google?.ads?.conversionIds && wpmDataLayer?.pixels?.google?.ads?.phone_conversion_label && wpmDataLayer?.pixels?.google?.ads?.phone_conversion_number) {\n\t\t\t\tgtag(\"config\", Object.keys(wpmDataLayer.pixels.google.ads.conversionIds)[0] + \"/\" + wpmDataLayer.pixels.google.ads.phone_conversion_label, {\n\t\t\t\t\tphone_conversion_number: wpmDataLayer.pixels.google.ads.phone_conversion_number,\n\t\t\t\t})\n\t\t\t}\n\n\t\t\t// ! enhanced_conversion_data needs to be var\n\t\t\t// https://support.google.com/google-ads/answer/9888145#zippy=%2Cvalidate-your-implementation-using-chrome-developer-tools\n\t\t\tif (\"order_received_page\" === wpmDataLayer.shop.page_type && wpmDataLayer?.order?.google?.ads?.enhanced_conversion_data) {\n\t\t\t\twindow.enhanced_conversion_data = wpmDataLayer.order.google.ads.enhanced_conversion_data\n\t\t\t}\n\n\t\t\twpmDataLayer.pixels.google.ads.state = \"ready\"\n\t\t} catch (e) {\n\t\t\tconsole.error(e)\n\t\t}\n\t}\n\n\twpm.fireGtagGoogleAnalyticsUA = function () {\n\t\ttry {\n\t\t\twpmDataLayer.pixels.google.analytics.universal.state = \"loading\"\n\n\t\t\tgtag(\"config\", wpmDataLayer.pixels.google.analytics.universal.property_id, wpmDataLayer.pixels.google.analytics.universal.parameters)\n\t\t\twpmDataLayer.pixels.google.analytics.universal.state = \"ready\"\n\t\t} catch (e) {\n\t\t\tconsole.error(e)\n\t\t}\n\t}\n\n\twpm.fireGtagGoogleAnalyticsGA4 = function () {\n\t\ttry {\n\t\t\twpmDataLayer.pixels.google.analytics.ga4.state = \"loading\"\n\n\t\t\tgtag(\"config\", wpmDataLayer.pixels.google.analytics.ga4.measurement_id, wpmDataLayer.pixels.google.analytics.ga4.parameters)\n\t\t\twpmDataLayer.pixels.google.analytics.ga4.state = \"ready\"\n\t\t} catch (e) {\n\t\t\tconsole.error(e)\n\t\t}\n\t}\n\n\twpm.isGoogleActive = function () {\n\t\tif (\n\t\t\twpmDataLayer?.pixels?.google?.analytics?.universal?.property_id ||\n\t\t\twpmDataLayer?.pixels?.google?.analytics?.ga4?.measurement_id ||\n\t\t\t!jQuery.isEmptyObject(wpmDataLayer?.pixels?.google?.ads?.conversionIds)\n\t\t) {\n\t\t\treturn true\n\t\t} else {\n\t\t\treturn false\n\t\t}\n\t}\n\n\twpm.getGoogleGtagId = function () {\n\t\tif (wpmDataLayer?.pixels?.google?.analytics?.universal?.property_id) {\n\t\t\treturn wpmDataLayer.pixels.google.analytics.universal.property_id\n\t\t} else if (wpmDataLayer?.pixels?.google?.analytics?.ga4?.measurement_id) {\n\t\t\treturn wpmDataLayer.pixels.google.analytics.ga4.measurement_id\n\t\t} else {\n\t\t\treturn Object.keys(wpmDataLayer.pixels.google.ads.conversionIds)[0]\n\t\t}\n\t}\n\n\twpm.loadGoogle = function () {\n\n\t\tif (wpm.isGoogleActive()) {\n\n\t\t\twpmDataLayer.pixels.google.state = \"loading\"\n\n\t\t\twpm.loadScriptAndCacheIt(\"https://www.googletagmanager.com/gtag/js?id=\" + wpm.getGoogleGtagId())\n\t\t\t\t.done(function (script, textStatus) {\n\t\t\t\t\ttry {\n\t\t\t\t\t\t// console.log('Google Optimize loaded')\n\t\t\t\t\t\t// alert('Google Optimize loaded')\n\n\t\t\t\t\t\t// Initiate Google dataLayer and gtag\n\t\t\t\t\t\twindow.dataLayer = window.dataLayer || []\n\t\t\t\t\t\twindow.gtag = function gtag() {\n\t\t\t\t\t\t\tdataLayer.push(arguments)\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t// Google Consent Mode\n\t\t\t\t\t\tif (wpmDataLayer?.pixels?.google?.consent_mode?.active) {\n\n\t\t\t\t\t\t\tlet google_consent_settings = {\n\t\t\t\t\t\t\t\t\"ad_storage\" : wpmDataLayer.pixels.google.consent_mode.ad_storage,\n\t\t\t\t\t\t\t\t\"analytics_storage\": wpmDataLayer.pixels.google.consent_mode.analytics_storage,\n\t\t\t\t\t\t\t\t\"wait_for_update\" : wpmDataLayer.pixels.google.consent_mode.wait_for_update,\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\tif (wpmDataLayer?.pixels?.google?.consent_mode?.region) {\n\t\t\t\t\t\t\t\tgoogle_consent_settings.region = wpmDataLayer.pixels.google.consent_mode.region\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tgoogle_consent_settings = wpm.getVisitorConsentStatusAndUpdateGoogleConsentSettings(google_consent_settings)\n\n\t\t\t\t\t\t\tgtag(\"consent\", \"default\", google_consent_settings)\n\t\t\t\t\t\t\tgtag(\"set\", \"ads_data_redaction\", wpmDataLayer.pixels.google.consent_mode.ads_data_redaction)\n\t\t\t\t\t\t\tgtag(\"set\", \"url_passthrough\", wpmDataLayer.pixels.google.consent_mode.url_passthrough)\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t// Google Linker\n\t\t\t\t\t\t// https://developers.google.com/gtagjs/devguide/linker\n\t\t\t\t\t\tif (wpmDataLayer?.pixels?.google?.linker?.settings) {\n\t\t\t\t\t\t\tgtag(\"set\", \"linker\", wpmDataLayer.pixels.google.linker.settings)\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tgtag(\"js\", new Date())\n\n\t\t\t\t\t\tif (wpm.googleConfigConditionsMet(\"ads\") && !jQuery.isEmptyObject(wpmDataLayer?.pixels?.google?.ads?.conversionIds)) wpm.fireGtagGoogleAds()\n\t\t\t\t\t\tif (wpm.googleConfigConditionsMet(\"analytics\") && wpmDataLayer?.pixels?.google?.analytics?.universal?.property_id) wpm.fireGtagGoogleAnalyticsUA()\n\t\t\t\t\t\tif (wpm.googleConfigConditionsMet(\"analytics\") && wpmDataLayer?.pixels?.google?.analytics?.ga4?.measurement_id) wpm.fireGtagGoogleAnalyticsGA4()\n\n\t\t\t\t\t\twpmDataLayer.pixels.google.state = \"ready\"\n\t\t\t\t\t} catch (e) {\n\t\t\t\t\t\tconsole.error(e)\n\t\t\t\t\t}\n\t\t\t\t})\n\t\t}\n\t}\n\n\twpm.canGoogleLoad = function () {\n\n\t\tif (wpmDataLayer?.pixels?.google?.consent_mode?.active) {\n\t\t\treturn true\n\t\t} else if (\"category\" === wpm.getConsentValues().mode) {\n\t\t\treturn !!(wpm.getConsentValues().categories[\"ads\"] || wpm.getConsentValues().categories[\"analytics\"])\n\t\t} else if (\"pixel\" === wpm.getConsentValues().mode) {\n\t\t\treturn wpm.getConsentValues().pixels.includes(\"google-ads\") || wpm.getConsentValues().pixels.includes(\"google-analytics\")\n\t\t} else {\n\t\t\tconsole.error(\"Couldn't find a valid load condition for Google mode in wpmConsentValues\")\n\t\t\treturn false\n\t\t}\n\t}\n\n\twpm.gtagLoaded = function () {\n\t\treturn new Promise(function (resolve, reject) {\n\n\t\t\tif (typeof wpmDataLayer?.pixels?.google?.state === \"undefined\") reject()\n\n\t\t\tlet startTime = 0\n\t\t\tlet timeout = 5000\n\t\t\tlet frequency = 200;\n\n\t\t\t(function wait() {\n\t\t\t\tif (wpmDataLayer?.pixels?.google?.state === \"ready\") return resolve()\n\t\t\t\tif (startTime >= timeout) return reject()\n\t\t\t\tstartTime += frequency\n\t\t\t\tsetTimeout(wait, frequency)\n\t\t\t})()\n\t\t})\n\t}\n\n\t// wpm.gtagLoadednew = function () {\n\t// \treturn Promise.race([\n\t// \t\t\tnew Promise(function (resolve, reject) {\n\t//\n\t// \t\t\t\tif (typeof wpmDataLayer?.pixels?.google?.state === \"undefined\") reject();\n\t//\n\t//\n\t// \t\t\t\t(function wait() {\n\t// \t\t\t\t\tif (wpmDataLayer?.pixels?.google?.state === \"ready\") return resolve()\n\t// \t\t\t\t\tif (to >= 1000) return reject()\n\t// \t\t\t\t\tsetTimeout(wait, 100)\n\t// \t\t\t\t})()\n\t// \t\t\t}),\n\t// \t\t\tnew Promise(function (resolve, reject) {\n\t// \t\t\t\tsetTimeout(() => reject(), 1000)\n\t// \t\t\t}),\n\t// \t\t],\n\t// \t)\n\t// \t\t// .then((value) => {console.log(\"race then value: \" + value)})\n\t// \t\t.catch(\n\t// \t\t\t(value) => {\n\t// \t\t\t\tconsole.log(\"race catch value: \" + value)\n\t// \t\t\t\treturn Promise.reject()\n\t// \t\t\t})\n\t// }\n\n\n\t// const promise1 = new Promise((resolve, reject) => {\n\t// \tsetTimeout(resolve, 500, \"one\")\n\t// })\n\t//\n\t// const promise2 = new Promise((resolve, reject) => {\n\t// \tsetTimeout(reject, 100, \"two\")\n\t// })\n\t//\n\t// let onlyRunIfResolves = function () {\n\t// \treturn Promise.race([promise1, promise2])\n\t// \t\t.catch(() => {\n\t// \t\t})\n\t// }\n\t//\n\t// onlyRunIfResolves()\n\t// \t.then(() => {\n\t// \t\tconsole.log(\"running function\")\n\t// \t})\n\n\n}(window.wpm = window.wpm || {}, jQuery));\n\n\n(function () {\n\n\tjQuery(document).on(\"wpmLoadPixels\", function () {\n\n\t\tif (\n\t\t\twpm.canGoogleLoad() &&\n\t\t\t(typeof wpmDataLayer?.pixels?.google?.state === \"undefined\")\n\t\t) {\n\t\t\twpm.loadGoogle()\n\t\t}\n\t})\n\n\t// return wpmDataLayer?.pixels?.google?.state === \"undefined\";\n\n})()\n","(function (wpm, $, undefined) {\n\n\twpm.getFormattedGA4Categories = function (productItems, categories) {\n\n\t\tlet maxCategories = 5\n\n\t\t// remove categories with equal names from array\n\t\tcategories = Array.from(new Set(categories))\n\n\t\tif (Array.isArray(categories) && categories.length) {\n\n\t\t\tproductItems[\"item_category\"] = categories[0]\n\n\t\t\tlet max = categories.length > maxCategories ? maxCategories : categories.length\n\n\t\t\tfor (let i = 1; i < max; i++) {\n\t\t\t\tproductItems[\"item_category\" + (i + 1)] = categories[i]\n\t\t\t}\n\t\t}\n\n\t\treturn productItems\n\t}\n\n\twpm.setGoogleCidOnServer = function () {\n\n\t\ttry {\n\n\t\t\tlet targetIDs = []\n\n\t\t\tif (wpmDataLayer?.pixels?.google?.analytics?.ga4?.measurement_id) targetIDs.push(wpmDataLayer.pixels.google.analytics.ga4.measurement_id)\n\t\t\tif (wpmDataLayer?.pixels?.google?.analytics?.universal?.property_id) targetIDs.push(wpmDataLayer.pixels.google.analytics.universal.property_id)\n\n\n\t\t\twpm.gtagLoaded().then(function () {\n\t\t\t gtag(\"get\", targetIDs[0], \"client_id\", (clientID) => {\n\n \t\t\t\t// save the state in the database\n \t\t\t\tlet data = {\n \t\t\t\t\taction: \"wpm_google_analytics_set_session_data\",\n \t\t\t\t\t// 'nonce' : wpm_google_premium_only_ajax_object.nonce,\n \t\t\t\t\t// 'nonce' : wpm.nonce,\n \t\t\t\t\ttarget_ids: targetIDs,\n \t\t\t\t\tclient_id : clientID,\n \t\t\t\t\treferrer : wpm.getReferrerFromCookie(),\n \t\t\t\t\tgclid : wpm.getClidFromBrowser(\"gclid\"),\n \t\t\t\t\t// dclid : wpm.getClidFromBrowser('dclid'),\n \t\t\t\t\tuserAgent : wpm.getUserAgent(),\n \t\t\t\t\tviewPortWidth : wpm.getViewPort().width,\n \t\t\t\t\tviewPortHeight: wpm.getViewPort().height,\n \t\t\t\t}\n\n \t\t\t\tjQuery.ajax(\n \t\t\t\t\t{\n \t\t\t\t\t\ttype : \"post\",\n \t\t\t\t\t\tdataType: \"json\",\n \t\t\t\t\t\t// url : wpm_google_premium_only_ajax_object.ajax_url,\n \t\t\t\t\t\turl : wpm.ajax_url,\n \t\t\t\t\t\tdata : data,\n \t\t\t\t\t\tsuccess: function (response) {\n\n \t\t\t\t\t\t\tif (response[\"success\"] === true) {\n \t\t\t\t\t\t\t\tif (window.sessionStorage) {\n \t\t\t\t\t\t\t\t\ttargetIDs.forEach((targetId) => {\n \t\t\t\t\t\t\t\t\t\twindow.sessionStorage.setItem('_wpm_ga_cid_set', JSON.stringify(true))\n \t\t\t\t\t\t\t\t\t\twindow.sessionStorage.setItem(\"wpm_cid_\" + targetId + \"_\" + clientID + \"_set\", JSON.stringify(true))\n \t\t\t\t\t\t\t\t\t})\n \t\t\t\t\t\t\t\t} else {\n \t\t\t\t\t\t\t\t\ttargetIDs.forEach((targetId) => {\n \t\t\t\t\t\t\t\t\t\twpm.setCookie(\"wpm_cid_\" + targetId + \"_\" + clientID + \"_set\", true)\n \t\t\t\t\t\t\t\t\t})\n \t\t\t\t\t\t\t\t}\n \t\t\t\t\t\t\t}\n \t\t\t\t\t\t},\n \t\t\t\t\t\terror : function (response) {\n \t\t\t\t\t\t\tconsole.error(response)\n \t\t\t\t\t\t},\n \t\t\t\t\t})\n\n \t\t\t\t// wp.ajax.post('wpm_google_analytics_set_session_data', data)\n \t\t\t\t// .done(function (response) {\n \t\t\t\t//\n \t\t\t\t// // console.log(response);\n \t\t\t\t//\n \t\t\t\t// if (response === 'success') {\n \t\t\t\t// if (window.sessionStorage) {\n \t\t\t\t// // console.log('setting session storage');\n \t\t\t\t// window.sessionStorage.setItem(cidSetOnServerCookie, JSON.stringify(true));\n \t\t\t\t// } else {\n \t\t\t\t// // console.log('not setting session storage');\n \t\t\t\t//\n \t\t\t\t// wpm.setCookie(cidSetOnServerCookie, true);\n \t\t\t\t// }\n \t\t\t\t// }\n \t\t\t\t// })\n \t\t\t\t// .fail(function (response) {\n \t\t\t\t// console.log(response);\n \t\t\t\t// });\n \t\t\t})\n\t\t\t})\n\n\t\t} catch (e) {\n\t\t\tconsole.error(e)\n\t\t}\n\t}\n\n}(window.wpm = window.wpm || {}, jQuery))\n\n\njQuery(window).on(\"wpmLoadAlways\", function () {\n\n\ttry {\n\t\tif (\n\t\t\twpmDataLayer?.pixels?.google?.analytics?.eec &&\n\t\t\t!window?.sessionStorage?.getItem('_wpm_ga_cid_set', JSON.parse(true)) &&\n\t\t\t(\n\t\t\t\twpmDataLayer?.pixels?.google?.analytics?.universal?.property_id ||\n\t\t\t\twpmDataLayer?.pixels?.google?.analytics?.ga4?.measurement_id\n\t\t\t)\n\t\t) {\n\t\t\t// We need to be sure that we capture the cid early enough, because the\n\t\t\t// shop might be using a one click checkout button as early as on the product page.\n\t\t\tif ([\"product\", \"cart\", \"checkout\"].indexOf(wpmDataLayer.shop.page_type) >= 0) {\n\t\t\t\twpm.setGoogleCidOnServer()\n\t\t\t}\n\t\t}\n\t} catch (e) {\n\t\tconsole.error(e)\n\t}\n})\n\n","(function (wpm, $, undefined) {\n\n\twpm.load_hotjar_pixel = function () {\n\n\t\tif (wpmDataLayer?.pixels?.hotjar?.site_id) {\n\n\t\t\t// console.log('hotjar loaded');\n\n\t\t\twpmDataLayer.pixels.hotjar.loaded = true;\n\n\t\t\t// @formatter:off\n\t\t\t(function(h,o,t,j,a,r){\n\t\t\t\th.hj=h.hj||function(){(h.hj.q=h.hj.q||[]).push(arguments)};\n\t\t\t\th._hjSettings={hjid:wpmDataLayer.pixels.hotjar.site_id,hjsv:6};\n\t\t\t\ta=o.getElementsByTagName('head')[0];\n\t\t\t\tr=o.createElement('script');r.async=1;\n\t\t\t\tr.src=t+h._hjSettings.hjid+j+h._hjSettings.hjsv;\n\t\t\t\ta.appendChild(r);\n\t\t\t})(window,document,'https://static.hotjar.com/c/hotjar-','.js?sv=');\n\t\t\t// @formatter:on\n\n\t\t}\n\t}\n\n}(window.wpm = window.wpm || {}, jQuery));\n\n\n(function () {\n\n\tjQuery(document).on(\"wpmLoadPixels\", function () {\n\n\t\tif (wpm.canIFire(\"analytics\", \"hotjar\") && !wpmDataLayer?.pixels?.hotjar?.loaded) wpm.load_hotjar_pixel()\n\n\t})\n\n})()\n\n\n\n","/**\n * Add functions for Microsoft Ads\n * */\n\n(function (wpm, $, undefined) {\n\n\twpm.load_bing_pixel = function () {\n\n\t\ttry {\n\t\t\tif (wpmDataLayer?.pixels?.bing?.uet_tag_id) {\n\n\t\t\t\twpmDataLayer.pixels.bing.loaded = true\n\n\t\t\t\t// @formatter:off\n \t\t\twindow.uetq = window.uetq || [];\n\n \t\t\t(function(w,d,t,r,u){var f,n,i;w[u]=w[u]||[],f=function(){var o={ti:wpmDataLayer.pixels.bing.uet_tag_id};o.q=w[u],w[u]=new UET(o),w[u].push(\"pageLoad\")},n=d.createElement(t),n.src=r,n.async=1,n.onload=n.onreadystatechange=function(){var s=this.readyState;s&&s!==\"loaded\"&&s!==\"complete\"||(f(),n.onload=n.onreadystatechange=null)},i=d.getElementsByTagName(t)[0],i.parentNode.insertBefore(n,i)})(window,document,\"script\",\"//bat.bing.com/bat.js\",\"uetq\");\n \t\t\t// @formatter:on\n\t\t\t}\n\t\t} catch (e) {\n\t\t\tconsole.error(e)\n\t\t}\n\t}\n\n\twpm.bing_purchase_ecomm_prodids = function () {\n\n\t\tlet prodIds = []\n\n\t\tfor (const [key, orderItem] of Object.entries(wpmDataLayer.order.items)) {\n\n\t\t\tif (wpmDataLayer?.general?.variationsOutput && 0 !== orderItem.variation_id) {\n\t\t\t\tprodIds.push(String(wpmDataLayer.products[orderItem.variation_id].dyn_r_ids[wpmDataLayer.pixels.bing.dynamic_remarketing.id_type]))\n\t\t\t} else {\n\t\t\t\tprodIds.push(String(wpmDataLayer.products[orderItem.id].dyn_r_ids[wpmDataLayer.pixels.bing.dynamic_remarketing.id_type]))\n\t\t\t}\n\t\t}\n\n\t\treturn prodIds\n\t}\n\n\twpm.bing_purchase_items = function () {\n\n\t\tlet orderItems = []\n\n\t\tfor (const [key, item] of Object.entries(wpmDataLayer.order.items)) {\n\n\t\t\tlet orderItem\n\n\t\t\torderItem = {\n\t\t\t\tquantity: item.quantity,\n\t\t\t\tprice : item.price,\n\t\t\t}\n\n\t\t\tif (wpmDataLayer?.general?.variationsOutput && 0 !== item.variation_id) {\n\n\t\t\t\torderItem.id = String(wpmDataLayer.products[item.variation_id].dyn_r_ids[wpmDataLayer.pixels.bing.dynamic_remarketing.id_type])\n\t\t\t\torderItems.push(orderItem)\n\t\t\t} else {\n\n\t\t\t\torderItem.id = String(wpmDataLayer.products[item.id].dyn_r_ids[wpmDataLayer.pixels.bing.dynamic_remarketing.id_type])\n\t\t\t\torderItems.push(orderItem)\n\t\t\t}\n\t\t}\n\n\t\treturn orderItems\n\t}\n\n}(window.wpm = window.wpm || {}, jQuery));\n\n\n/**\n * Execute as soon as possible\n * */\n\n(function () {\n\n\tjQuery(document).on(\"wpmLoadPixels\", function () {\n\n\t\tif (wpm.canIFire(\"ads\", \"bing-ads\") && !wpmDataLayer?.pixels?.bing?.loaded) wpm.load_bing_pixel()\n\n\t})\n\n})()\n\n\n/**\n * All event listeners\n * */\n\n// add-to-cart event\njQuery(document).on(\"wpmAddToCart\", function (event, product) {\n\n\ttry {\n\t\tif (!wpmDataLayer?.pixels?.bing?.loaded) return\n\n\t\twindow.uetq.push(\"event\", \"\", {\n\t\t\tecomm_pagetype: \"cart\",\n\t\t\tecomm_prodid : product.dyn_r_ids[wpmDataLayer.pixels.bing.dynamic_remarketing.id_type],\n\t\t})\n\t} catch (e) {\n\t\tconsole.error(e)\n\t}\n})\n\n// view product event\njQuery(document).on(\"wpmViewItem\", function (event, product) {\n\n\ttry {\n\t\tif (!wpmDataLayer?.pixels?.bing?.loaded) return\n\n\t\twindow.uetq.push(\"event\", \"\", {\n\t\t\tecomm_pagetype: \"product\",\n\t\t\tecomm_prodid : product.dyn_r_ids[wpmDataLayer.pixels.bing.dynamic_remarketing.id_type],\n\t\t})\n\t} catch (e) {\n\t\tconsole.error(e)\n\t}\n})\n\n// view category event\njQuery(document).on(\"wpmCategory\", function () {\n\n\ttry {\n\t\tif (!wpmDataLayer?.pixels?.bing?.loaded) return\n\n\t\twindow.uetq.push(\"event\", \"\", {\n\t\t\tecomm_pagetype: \"category\",\n\t\t})\n\t} catch (e) {\n\t\tconsole.error(e)\n\t}\n})\n\n// view search event\njQuery(document).on(\"wpmSearch\", function () {\n\n\ttry {\n\t\tif (!wpmDataLayer?.pixels?.bing?.loaded) return\n\n\t\twindow.uetq.push(\"event\", \"\", {\n\t\t\tecomm_pagetype: \"searchresults\",\n\t\t})\n\t} catch (e) {\n\t\tconsole.error(e)\n\t}\n})\n\n// view order received page event\n// https://help.ads.microsoft.com/#apex/ads/en/60118/-1\njQuery(document).on(\"wpmOrderReceivedPage\", function () {\n\n\ttry {\n\t\tif (!wpmDataLayer?.pixels?.bing?.loaded) return\n\n\t\twindow.uetq.push(\"event\", \"purchase\", {\n\t\t\tecomm_pagetype: \"purchase\",\n\t\t\tecomm_prodid : wpm.bing_purchase_ecomm_prodids(),\n\t\t\trevenue_value : wpmDataLayer.order.value_filtered,\n\t\t\tcurrency : wpmDataLayer.order.currency,\n\t\t\titems : wpm.bing_purchase_items(),\n\t\t})\n\n\t\t// console.log('test')\n\t\t// console.log(wpm.bing_purchase_ecomm_prodids())\n\t\t// console.log(wpm.bing_purchase_items())\n\t} catch (e) {\n\t\tconsole.error(e)\n\t}\n})\n\n","// TODO add enhanced match email hash to uncached pages like cart and purchase confirmation page\n// TODO check if more values can be passed to product and category pages\n// TODO look into how Pinterest handles variants separately https://developers.pinterest.com/docs/tag/conversion/\n\n/**\n * Add functions for Pinterest\n * */\n\n(function (wpm, $, undefined) {\n\n\twpm.getPinterestProductData = function (product) {\n\n\t\t// console.log(product)\n\n\t\tif (product.isVariation) {\n\t\t\treturn {\n\t\t\t\tproduct_name : product.name,\n\t\t\t\tproduct_variant_id: product.dyn_r_ids[wpmDataLayer.pixels.pinterest.dynamic_remarketing.id_type],\n\t\t\t\t// product_id : wpmDataLayer.products[product.parentId].dyn_r_ids[wpmDataLayer.pixels.pinterest.dynamic_remarketing.id_type],\n\t\t\t\tproduct_id : product.parentId_dyn_r_ids[wpmDataLayer.pixels.pinterest.dynamic_remarketing.id_type],\n\t\t\t\tproduct_category: product.category,\n\t\t\t\tproduct_variant : product.variant,\n\t\t\t\tproduct_price : product.price,\n\t\t\t\tproduct_quantity: product.quantity,\n\t\t\t\tproduct_brand : product.brand,\n\t\t\t}\n\t\t} else {\n\t\t\treturn {\n\t\t\t\tproduct_name : product.name,\n\t\t\t\tproduct_id : product.dyn_r_ids[wpmDataLayer.pixels.pinterest.dynamic_remarketing.id_type],\n\t\t\t\tproduct_category: product.category,\n\t\t\t\tproduct_price : product.price,\n\t\t\t\tproduct_quantity: product.quantity,\n\t\t\t\tproduct_brand : product.brand,\n\t\t\t}\n\t\t}\n\t}\n\n\twpm.pinterestFormattedOrderItems = function () {\n\n\t\tlet orderItems = []\n\n\t\tfor (const [key, item] of Object.entries(wpmDataLayer.order.items)) {\n\n\t\t\tlet orderItem\n\n\t\t\torderItem = {\n\t\t\t\tproduct_category: wpmDataLayer.products[key].category.join(\",\"),\n\t\t\t\t// product_brand : wpmDataLayer.products[key].brand,\n\t\t\t\tproduct_quantity: item.quantity,\n\t\t\t\tproduct_price : item.price,\n\t\t\t}\n\n\t\t\tif (wpmDataLayer?.general?.variationsOutput && 0 !== item.variation_id) {\n\n\t\t\t\torderItem.product_id = String(wpmDataLayer.products[item.variation_id].dyn_r_ids[wpmDataLayer.pixels.pinterest.dynamic_remarketing.id_type])\n\t\t\t\torderItem.product_name = wpmDataLayer.products[item.variation_id].name\n\t\t\t\torderItems.push(orderItem)\n\t\t\t} else {\n\n\t\t\t\torderItem.product_id = String(wpmDataLayer.products[item.id].dyn_r_ids[wpmDataLayer.pixels.pinterest.dynamic_remarketing.id_type])\n\t\t\t\torderItem.product_name = wpmDataLayer.products[item.id].name\n\t\t\t\torderItems.push(orderItem)\n\t\t\t}\n\t\t}\n\n\t\treturn orderItems\n\t}\n\n\t// https://developers.pinterest.com/docs/tag/conversion/\n\twpm.loadPinterestPixel = function () {\n\n\t\ttry {\n\t\t\tif (wpmDataLayer?.pixels?.pinterest?.pixel_id) {\n\n\t\t\t\twpmDataLayer.pixels.pinterest.loaded = true;\n\n\t\t\t\t// @formatter:off\n \t\t\t!function(e){if(!window.pintrk){window.pintrk=function(){window.pintrk.queue.push(\n \t\t\t\tArray.prototype.slice.call(arguments))};var\n \t\t\t\tn=window.pintrk;n.queue=[],n.version=\"3.0\";var\n \t\t\t\tt=document.createElement(\"script\");t.async=!0,t.src=e;var\n \t\t\t\tr=document.getElementsByTagName(\"script\")[0];r.parentNode.insertBefore(t,r)}}(\"https://s.pinimg.com/ct/core.js\");\n\n \t\t\twpm.pinterestLoadEvent();\n \t\t\tpintrk('page');\n \t\t\t// @formatter:on\n\t\t\t}\n\t\t} catch (e) {\n\t\t\tconsole.error(e)\n\t\t}\n\t}\n\n\twpm.pinterestLoadEvent = function () {\n\t\ttry {\n\t\t\tif (\n\t\t\t\t(\n\t\t\t\t\twpmDataLayer.general.userLoggedIn ||\n\t\t\t\t\t\"order_received_page\" === wpmDataLayer.shop.page_type\n\t\t\t\t)\n\t\t\t\t&& wpmDataLayer?.pixels?.pinterest?.enhanced_match\n\t\t\t) {\n\t\t\t\tpintrk(\"load\", wpmDataLayer.pixels.pinterest.pixel_id, {em: wpmDataLayer.pixels.pinterest.enhanced_match_email})\n\t\t\t} else {\n\t\t\t\tpintrk(\"load\", wpmDataLayer.pixels.pinterest.pixel_id)\n\t\t\t}\n\t\t} catch (e) {\n\t\t\tconsole.error(e)\n\t\t}\n\t}\n\n}(window.wpm = window.wpm || {}, jQuery));\n\n/**\n * Execute as soon as possible\n * */\n\n(function () {\n\n\tjQuery(document).on(\"wpmLoadPixels\", function () {\n\n\t\tif (wpm.canIFire(\"ads\", \"pinterest-ads\") && !wpmDataLayer?.pixels?.pinterest?.loaded) wpm.loadPinterestPixel()\n\n\t})\n\n})()\n\n\n/**\n * All event listeners\n * */\n\n// https://help.pinterest.com/en/business/article/add-event-codes\n\n// AddToCart event\njQuery(document).on(\"wpmAddToCart\", function (event, product) {\n\n\ttry {\n\t\tif (!wpmDataLayer?.pixels?.pinterest?.loaded) return\n\n\t\t// console.log('firing Pinterest ads AddToCart event');\n\t\t// console.log(product);\n\n\t\tpintrk(\"track\", \"addtocart\", {\n\t\t\tvalue : parseFloat(product.quantity * product.price),\n\t\t\tcurrency : product.currency,\n\t\t\tline_items: [wpm.getPinterestProductData(product)],\n\t\t})\n\t} catch (e) {\n\t\tconsole.error(e)\n\t}\n})\n\n// pageview event\njQuery(document).on(\"wpmViewItem\", function (event, product) {\n\n\ttry {\n\t\tif (!wpmDataLayer?.pixels?.pinterest?.loaded) return\n\n\t\t// console.log('firing Pinterest pageview event');\n\t\t// console.log(product);\n\n\t\tpintrk(\"track\", \"pagevisit\", {\n\t\t\tcurrency : product.currency,\n\t\t\tline_items: [wpm.getPinterestProductData(product)],\n\t\t})\n\t} catch (e) {\n\t\tconsole.error(e)\n\t}\n})\n\n// view product event\njQuery(document).on(\"wpmViewItem\", function (event, product) {\n\n\ttry {\n\t\tif (!wpmDataLayer?.pixels?.pinterest?.loaded) return\n\n\t\tlet productData = wpm.getPinterestProductData(product)\n\n\t\tpintrk(\"track\", \"pagevisit\", {\n\t\t\tcurrency : product.currency,\n\t\t\tline_items: [productData],\n\t\t})\n\t} catch (e) {\n\t\tconsole.error(e)\n\t}\n})\n\n// view search event\njQuery(document).on(\"wpmSearch\", function () {\n\n\ttry {\n\t\tif (!wpmDataLayer?.pixels?.pinterest?.loaded) return\n\n\t\tlet urlParams = new URLSearchParams(window.location.search)\n\n\t\tpintrk(\"track\", \"search\", {\n\t\t\tsearch_query: urlParams.get(\"s\"),\n\t\t})\n\t} catch (e) {\n\t\tconsole.error(e)\n\t}\n})\n\n// view category event\njQuery(document).on(\"wpmCategory\", function () {\n\n\ttry {\n\t\tif (!wpmDataLayer?.pixels?.pinterest?.loaded) return\n\n\t\tpintrk(\"track\", \"viewcategory\")\n\t} catch (e) {\n\t\tconsole.error(e)\n\t}\n})\n\n\n// view order received page event\n// https://developers.pinterest.com/docs/tag/conversion/\njQuery(document).on(\"wpmOrderReceivedPage\", function () {\n\n\ttry {\n\t\tif (!wpmDataLayer?.pixels?.pinterest?.loaded) return\n\n\t\tpintrk(\"track\", \"checkout\", {\n\t\t\tvalue : wpmDataLayer.order.value_filtered,\n\t\t\torder_quantity: wpmDataLayer.order.quantity,\n\t\t\tcurrency : wpmDataLayer.order.currency,\n\t\t\torder_id : wpmDataLayer.order.id,\n\t\t\tline_items : wpm.pinterestFormattedOrderItems(),\n\t\t})\n\n\t\t// console.log(wpm.pinterestFormattedOrderItems())\n\t} catch (e) {\n\t\tconsole.error(e)\n\t}\n})\n","// TODO check all events and add more if there are any\n\n/**\n * Add functions for Snapchat Ads\n * */\n\n(function (wpm, $, undefined) {\n\n\twpm.snapchatGetEmail = function () {\n\t\tlet userInfo = {}\n\n\t\tif (wpmDataLayer?.user?.email_sha256) {\n\t\t\tuserInfo.user_hashed_email = wpmDataLayer.user?.email_sha256\n\t\t}\n\t\t// console.log(userInfo)\n\t\treturn userInfo\n\t}\n\n\twpm.loadSnapchatPixel = function () {\n\n\t\ttry {\n\t\t\tif (wpmDataLayer?.pixels?.snapchat?.pixel_id) {\n\n\t\t\t\twpmDataLayer.pixels.snapchat.loaded = true;\n\n\t\t\t\t// @formatter:off\n \t\t\t(function(e,t,n){if(e.snaptr)return;var a=e.snaptr=function()\n \t\t\t{a.handleRequest?a.handleRequest.apply(a,arguments):a.queue.push(arguments)};\n \t\t\t\ta.queue=[];var s='script';r=t.createElement(s);r.async=!0;\n \t\t\t\tr.src=n;var u=t.getElementsByTagName(s)[0];\n \t\t\t\tu.parentNode.insertBefore(r,u);})(window,document,\n \t\t\t\t'https://sc-static.net/scevent.min.js');\n \t\t\t// @formatter:on\n\n\t\t\t\tsnaptr(\"init\", wpmDataLayer.pixels.snapchat.pixel_id, wpm.snapchatGetEmail())\n\t\t\t\tsnaptr(\"track\", \"PAGE_VIEW\")\n\t\t\t}\n\t\t} catch (e) {\n\t\t\tconsole.error(e)\n\t\t}\n\t}\n\n\twpm.getSnapchatOrderItemIds = function () {\n\t\tlet contentIds = []\n\n\t\tfor (const [key, item] of Object.entries(wpmDataLayer.order.items)) {\n\n\t\t\tif (wpmDataLayer?.general?.variationsOutput && 0 !== item.variation_id) {\n\t\t\t\tcontentIds.push(String(wpmDataLayer.products[item.variation_id].dyn_r_ids[wpmDataLayer.pixels.snapchat.dynamic_remarketing.id_type]))\n\t\t\t} else {\n\t\t\t\tcontentIds.push(String(wpmDataLayer.products[item.id].dyn_r_ids[wpmDataLayer.pixels.snapchat.dynamic_remarketing.id_type]))\n\t\t\t}\n\t\t}\n\n\t\treturn contentIds\n\t}\n\n}(window.wpm = window.wpm || {}, jQuery));\n\n/**\n * Execute as soon as possible\n * */\n\n(function () {\n\n\tjQuery(document).on(\"wpmLoadPixels\", function () {\n\n\t\tif (wpm.canIFire(\"ads\", \"snapchat-ads\") && !wpmDataLayer?.pixels?.snapchat?.loaded) wpm.loadSnapchatPixel()\n\n\t})\n\n})()\n\n\n/**\n * All event listeners\n * */\n\n// AddToCart event\njQuery(document).on(\"wpmAddToCart\", function (event, product) {\n\n\ttry {\n\t\tif (!wpmDataLayer?.pixels?.snapchat?.loaded) return\n\n\t\tsnaptr(\"track\", \"ADD_CART\", {\n\t\t\titem_ids: [product.dyn_r_ids[wpmDataLayer.pixels.snapchat.dynamic_remarketing.id_type]],\n\t\t})\n\t} catch (e) {\n\t\tconsole.error(e)\n\t}\n})\n\n// VIEW_CONTENT event\njQuery(document).on(\"wpmViewItem\", function (event, product) {\n\n\ttry {\n\t\tif (!wpmDataLayer?.pixels?.snapchat?.loaded) return\n\n\t\tsnaptr(\"track\", \"VIEW_CONTENT\", {\n\t\t\titem_ids: [product.dyn_r_ids[wpmDataLayer.pixels.snapchat.dynamic_remarketing.id_type]],\n\t\t})\n\t} catch (e) {\n\t\tconsole.error(e)\n\t}\n})\n\n\n// view order received page event\njQuery(document).on(\"wpmOrderReceivedPage\", function () {\n\n\ttry {\n\t\tif (!wpmDataLayer?.pixels?.snapchat?.loaded) return\n\n\t\tsnaptr(\"track\", \"PURCHASE\", {\n\t\t\tcurrency : wpmDataLayer.order.currency,\n\t\t\tprice : wpmDataLayer.order.value_filtered,\n\t\t\ttransaction_id: wpmDataLayer.order.id,\n\t\t\titem_ids : wpm.getSnapchatOrderItemIds(),\n\t\t})\n\n\t\t// console.log(wpm.getSnapchatOrderItemIds())\n\t\t// console.log({price: wpmDataLayer.order.value_filtered})\n\t\t// console.log({transaction_id: wpmDataLayer.order.id})\n\t} catch (e) {\n\t\tconsole.error(e)\n\t}\n})\n","// https://ads.tiktok.com/help/article?aid=10028\n\n// TODO check all events and add more if there are any\n\n\n/**\n * Add functions for TikTok Ads\n * */\n\n(function (wpm, $, undefined) {\n\n\twpm.loadTikTokPixel = function () {\n\n\t\ttry {\n\t\t\tif (wpmDataLayer?.pixels?.tiktok?.pixel_id) {\n\n\t\t\t\twpmDataLayer.pixels.tiktok.loaded = true;\n\n\t\t\t\t// @formatter:off\n \t\t\t!function (w, d, t) {\n \t\t\t\tw.TiktokAnalyticsObject=t;var ttq=w[t]=w[t]||[];ttq.methods=[\"page\",\"track\",\"identify\",\"instances\",\"debug\",\"on\",\"off\",\"once\",\"ready\",\"alias\",\"group\",\"enableCookie\",\"disableCookie\"],ttq.setAndDefer=function(t,e){t[e]=function(){t.push([e].concat(Array.prototype.slice.call(arguments,0)))}};for(var i=0;i<ttq.methods.length;i++)ttq.setAndDefer(ttq,ttq.methods[i]);ttq.instance=function(t){for(var e=ttq._i[t]||[],n=0;n<ttq.methods.length;n++)ttq.setAndDefer(e,ttq.methods[n]);return e},ttq.load=function(e,n){var i=\"https://analytics.tiktok.com/i18n/pixel/events.js\";ttq._i=ttq._i||{},ttq._i[e]=[],ttq._i[e]._u=i,ttq._t=ttq._t||{},ttq._t[e]=+new Date,ttq._o=ttq._o||{},ttq._o[e]=n||{};var o=document.createElement(\"script\");o.type=\"text/javascript\",o.async=!0,o.src=i+\"?sdkid=\"+e+\"&lib=\"+t;var a=document.getElementsByTagName(\"script\")[0];a.parentNode.insertBefore(o,a)};\n \t\t\t\tttq.load(wpmDataLayer.pixels.tiktok.pixel_id);\n \t\t\t\tttq.page();\n \t\t\t}(window, document, 'ttq');\n \t\t\t// @formatter:on\n\n\t\t\t\tttq.track(\"Browse\")\n\t\t\t}\n\t\t} catch (e) {\n\t\t\tconsole.error(e)\n\t\t}\n\t}\n\n\twpm.getTikTokOrderItemIds = function () {\n\n\t\tlet orderItems = []\n\n\t\tfor (const [key, item] of Object.entries(wpmDataLayer.order.items)) {\n\n\t\t\tlet orderItem\n\n\t\t\torderItem = {\n\t\t\t\tcontent_type: \"product\",\n\t\t\t\tquantity : item.quantity,\n\t\t\t\tprice : item.price,\n\t\t\t}\n\n\t\t\tif (wpmDataLayer?.general?.variationsOutput && 0 !== item.variation_id) {\n\n\t\t\t\torderItem.content_id = String(wpmDataLayer.products[item.variation_id].dyn_r_ids[wpmDataLayer.pixels.bing.dynamic_remarketing.id_type])\n\t\t\t\torderItem.content_name = wpmDataLayer.products[item.variation_id].name\n\t\t\t\torderItems.push(orderItem)\n\t\t\t} else {\n\n\t\t\t\torderItem.content_id = String(wpmDataLayer.products[item.id].dyn_r_ids[wpmDataLayer.pixels.bing.dynamic_remarketing.id_type])\n\t\t\t\torderItem.content_name = wpmDataLayer.products[item.id].name\n\t\t\t\torderItems.push(orderItem)\n\t\t\t}\n\t\t}\n\n\t\treturn orderItems\n\t}\n\n}(window.wpm = window.wpm || {}, jQuery));\n\n/**\n * Execute as soon as possible\n * */\n\n(function () {\n\n\tjQuery(document).on(\"wpmLoadPixels\", function () {\n\n\t\tif (wpm.canIFire(\"ads\", \"tiktok-ads\") && !wpmDataLayer?.pixels?.tiktok?.loaded) wpm.loadTikTokPixel()\n\n\t})\n\n})()\n\n/**\n * All event listeners\n * */\n\n// AddToCart event\njQuery(document).on(\"wpmAddToCart\", function (event, product) {\n\n\ttry {\n\t\tif (!wpmDataLayer?.pixels?.tiktok?.loaded) return\n\n\t\tttq.track(\"AddToCart\", {\n\t\t\tcontent_id : product.dyn_r_ids[wpmDataLayer.pixels.tiktok.dynamic_remarketing.id_type],\n\t\t\tcontent_type: \"product\",\n\t\t\tcontent_name: product.name,\n\t\t\tquantity : product.quantity,\n\t\t\tvalue : product.price,\n\t\t\tcurrency : product.currency,\n\t\t})\n\t} catch (e) {\n\t\tconsole.error(e)\n\t}\n})\n\n// InitiateCheckout event\njQuery(document).on(\"wpmBeginCheckout\", function (event) {\n\n\ttry {\n\t\tif (!wpmDataLayer?.pixels?.tiktok?.loaded) return\n\n\t\tttq.track(\"InitiateCheckout\")\n\t} catch (e) {\n\t\tconsole.error(e)\n\t}\n})\n\n// ViewContent event\njQuery(document).on(\"wpmViewItem\", function (event, product) {\n\n\ttry {\n\t\tif (!wpmDataLayer?.pixels?.tiktok?.loaded) return\n\n\t\tttq.track(\"ViewContent\", {\n\t\t\tcontent_id : product.dyn_r_ids[wpmDataLayer.pixels.tiktok.dynamic_remarketing.id_type],\n\t\t\tcontent_type: \"product\",\n\t\t\tcontent_name: product.name,\n\t\t\tquantity : product.quantity,\n\t\t\tvalue : product.price,\n\t\t\tcurrency : product.currency,\n\t\t})\n\t} catch (e) {\n\t\tconsole.error(e)\n\t}\n})\n\n// AddToWishlist event\njQuery(document).on(\"wpmAddToWishlist\", function (event, product) {\n\n\ttry {\n\t\tif (!wpmDataLayer?.pixels?.tiktok?.loaded) return\n\n\t\tttq.track(\"AddToWishlist\", {\n\t\t\tcontent_id : product.dyn_r_ids[wpmDataLayer.pixels.tiktok.dynamic_remarketing.id_type],\n\t\t\tcontent_type: \"product\",\n\t\t\tcontent_name: product.name,\n\t\t\tquantity : product.quantity,\n\t\t\tvalue : product.price,\n\t\t\tcurrency : product.currency,\n\t\t})\n\t} catch (e) {\n\t\tconsole.error(e)\n\t}\n})\n\n// search event\njQuery(document).on(\"wpmSearch\", function () {\n\n\ttry {\n\t\tif (!wpmDataLayer?.pixels?.tiktok?.loaded) return\n\n\t\tttq.track(\"Search\")\n\t} catch (e) {\n\t\tconsole.error(e)\n\t}\n\n})\n\n\n// view order received page event\njQuery(document).on(\"wpmOrderReceivedPage\", function () {\n\n\ttry {\n\t\tif (!wpmDataLayer?.pixels?.tiktok?.loaded) return\n\n\t\tttq.track(wpmDataLayer.pixels.tiktok.purchase_event_name, {\n\t\t\tvalue : wpmDataLayer.order.value_filtered,\n\t\t\tcurrency: wpmDataLayer.order.currency,\n\t\t\tcontents: wpm.getTikTokOrderItemIds(),\n\t\t})\n\n\t\t// console.log(wpm.getTikTokOrderItemIds())\n\t} catch (e) {\n\t\tconsole.error(e)\n\t}\n})\n","// TODO implement AddPaymentInfo event\n// TODO check if more values can be passed to product and cart pages\n\n// https://business.twitter.com/en/help/campaign-measurement-and-analytics/conversion-tracking-for-websites.html\n\n/**\n * Add functions for Twitter Ads\n * */\n\n(function (wpm, $, undefined) {\n\n\twpm.loadTwitterPixel = function () {\n\n\t\ttry {\n\t\t\tif (wpmDataLayer?.pixels?.twitter?.pixel_id) {\n\n\t\t\t\twpmDataLayer.pixels.twitter.loaded = true;\n\n\t\t\t\t// @formatter:off\n \t\t\t!function(e,t,n,s,u,a){e.twq||(s=e.twq=function(){s.exe?s.exe.apply(s,arguments):s.queue.push(arguments);\n \t\t\t},s.version='1.1',s.queue=[],u=t.createElement(n),u.async=!0,u.src='//static.ads-twitter.com/uwt.js',\n \t\t\t\ta=t.getElementsByTagName(n)[0],a.parentNode.insertBefore(u,a))}(window,document,'script');\n\n \t\t\ttwq('init', wpmDataLayer.pixels.twitter.pixel_id);\n \t\t\t// @formatter:on\n\n\t\t\t\ttwq(\"track\", \"PageView\")\n\t\t\t}\n\t\t} catch (e) {\n\t\t\tconsole.error(e)\n\t\t}\n\t}\n\n\twpm.twitterGetOrderContentIds = function () {\n\t\tlet contentIds = []\n\n\t\tfor (const [key, item] of Object.entries(wpmDataLayer.order.items)) {\n\n\t\t\tif (wpmDataLayer?.general?.variationsOutput && 0 !== item.variation_id) {\n\t\t\t\tcontentIds.push(String(wpmDataLayer.products[item.variation_id].dyn_r_ids[wpmDataLayer.pixels.twitter.dynamic_remarketing.id_type]))\n\t\t\t} else {\n\t\t\t\tcontentIds.push(String(wpmDataLayer.products[item.id].dyn_r_ids[wpmDataLayer.pixels.twitter.dynamic_remarketing.id_type]))\n\t\t\t}\n\t\t}\n\n\t\treturn contentIds\n\t}\n\n}(window.wpm = window.wpm || {}, jQuery));\n\n\n/**\n * Execute as soon as possible\n * */\n\n(function () {\n\n\tjQuery(document).on(\"wpmLoadPixels\", function () {\n\n\t\tif (wpm.canIFire(\"ads\", \"twitter-ads\") && !wpmDataLayer?.pixels?.twitter?.loaded) wpm.loadTwitterPixel()\n\n\t})\n\n})()\n\n\n/**\n * All event listeners\n * */\n\n// add-to-cart event\njQuery(document).on(\"wpmAddToCart\", function (event, product) {\n\n\ttry {\n\t\tif (!wpmDataLayer?.pixels?.twitter?.loaded) return\n\n\t\ttwq(\"track\", \"AddToCart\")\n\t} catch (e) {\n\t\tconsole.error(e)\n\t}\n})\n\n// view product event\njQuery(document).on(\"wpmViewItem\", function (event, product) {\n\n\ttry {\n\t\tif (!wpmDataLayer?.pixels?.twitter?.loaded) return\n\n\t\ttwq(\"track\", \"ViewContent\")\n\t} catch (e) {\n\t\tconsole.error(e)\n\t}\n})\n\n// // view category event\n// jQuery(document).on('wpmCategory', function () {\n//\n// \tif (!wpmDataLayer?.pixels?.twitter?.loaded) return;\n//\n// \t// twq('track', 'AddToWishlist');\n// });\n\n// add-to-wishlist event\njQuery(document).on(\"wpmAddToWishlist\", function (event, product) {\n\n\ttry {\n\t\tif (!wpmDataLayer?.pixels?.twitter?.loaded) return\n\n\t\ttwq(\"track\", \"AddToWishlist\")\n\t} catch (e) {\n\t\tconsole.error(e)\n\t}\n})\n\n// start checkout event\njQuery(document).on(\"wpmBeginCheckout\", function (event, product) {\n\n\ttry {\n\t\tif (!wpmDataLayer?.pixels?.twitter?.loaded) return\n\n\t\ttwq(\"track\", \"InitiateCheckout\")\n\t} catch (e) {\n\t\tconsole.error(e)\n\t}\n})\n\n// view search event\njQuery(document).on(\"wpmSearch\", function () {\n\n\ttry {\n\t\tif (!wpmDataLayer?.pixels?.twitter?.loaded) return\n\n\t\ttwq(\"track\", \"Search\")\n\t} catch (e) {\n\t\tconsole.error(e)\n\t}\n})\n\n\n// view order received page event\n// TODO find out under which circumstances to use different values in content_type\njQuery(document).on(\"wpmOrderReceivedPage\", function () {\n\n\ttry {\n\t\tif (!wpmDataLayer?.pixels?.twitter?.loaded) return\n\n\t\ttwq(\"track\", \"Purchase\", {\n\t\t\torder_id: wpmDataLayer.order.id,\n\t\t\t// content_type: 'product',\n\t\t\tvalue : wpmDataLayer.order.value_filtered,\n\t\t\tcurrency : wpmDataLayer.order.currency,\n\t\t\tnum_items : wpmDataLayer.order.quantity,\n\t\t\tcontent_ids: wpm.twitterGetOrderContentIds(),\n\t\t})\n\n\t\t// console.log(wpm.twitterGetOrderContentIds())\n\t} catch (e) {\n\t\tconsole.error(e)\n\t}\n})\n\n","/**\n * After wpm is loaded\n * we first check if wpmDataLayer is loaded,\n * and as soon as it is, we load the pixels,\n * and as soon as the page load is complete,\n * we fire the wpmLoad event.\n */\nwpm.wpmDataLayerExists()\n\t.then(function () {\n\t\tjQuery(document).trigger(\"wpmPreLoadPixels\", {})\n\t})\n\t.then(function () {\n\t\twpm.pageLoaded().then(function () {\n\t\t\tjQuery(document).trigger(\"wpmLoad\", {})\n\t\t})\n\t})\n\n","/**\n * Create a wpm namespace under which all functions are declared\n */\n\n// https://stackoverflow.com/a/5947280/4688612\n(function (wpm, $, undefined) {\n\n\tconst wpmDeduper = {\n\t\tkeyName : \"_wpm_order_ids\",\n\t\tcookieExpiresDays: 365,\n\t}\n\n\tconst wpmRestSettings = {\n\t\t// cookiesAvailable : '_wpm_cookies_are_available',\n\t\tcookieWpmRestEndpointAvailable: \"_wpm_endpoint_available\",\n\t\trestEndpoint : \"/wp-json/\",\n\t\trestFails : 0,\n\t\trestFailsThreshold : 10,\n\t}\n\n\twpm.emailSelected = false\n\twpm.paymentMethodSelected = false\n\n\t// wpm.checkIfCookiesAvailable = function () {\n\t//\n\t// // read the cookie if previously set, if it is return true, otherwise continue\n\t// if (wpm.getCookie(wpmRestSettings.cookiesAvailable)) {\n\t// return true;\n\t// }\n\t//\n\t// // set the cookie for the session\n\t// Cookies.set(wpmRestSettings.cookiesAvailable, true);\n\t//\n\t// // read cookie, true if ok, false if not ok\n\t// return !!wpm.getCookie(wpmRestSettings.cookiesAvailable);\n\t// }\n\n\twpm.useRestEndpoint = function () {\n\n\t\t// only if sessionStorage is available\n\n\t\t// only if REST API endpoint is generally accessible\n\t\t// check in sessionStorage if we checked before and return answer\n\t\t// otherwise check if the endpoint is available, save answer in sessionStorage and return answer\n\n\t\t// only if not too many REST API errors happened\n\n\t\treturn wpm.isSessionStorageAvailable() &&\n\t\t\twpm.isRestEndpointAvailable() &&\n\t\t\twpm.isBelowRestErrorThreshold()\n\t}\n\n\twpm.isBelowRestErrorThreshold = function () {\n\t\treturn window.sessionStorage.getItem(wpmRestSettings.restFails) <= wpmRestSettings.restFailsThreshold\n\t}\n\n\twpm.isRestEndpointAvailable = function () {\n\n\t\tif (window.sessionStorage.getItem(wpmRestSettings.cookieWpmRestEndpointAvailable)) {\n\t\t\treturn JSON.parse(window.sessionStorage.getItem(wpmRestSettings.cookieWpmRestEndpointAvailable))\n\t\t} else {\n\t\t\t// return wpm.testEndpoint();\n\t\t\t// just set the value whenever possible in order not to wait or block the main thread\n\t\t\twpm.testEndpoint()\n\t\t}\n\t}\n\n\twpm.isSessionStorageAvailable = function () {\n\n\t\treturn !!window.sessionStorage\n\t}\n\n\twpm.testEndpoint = function (\n\t\turl = location.protocol + \"//\" + location.host + wpmRestSettings.restEndpoint,\n\t\tcookieName = wpmRestSettings.cookieWpmRestEndpointAvailable,\n\t) {\n\t\t// console.log('testing endpoint');\n\n\t\tjQuery.ajax(url, {\n\t\t\ttype : \"HEAD\",\n\t\t\ttimeout: 1000,\n\t\t\t// async: false,\n\t\t\tstatusCode: {\n\t\t\t\t200: function (response) {\n\t\t\t\t\t// Cookies.set(cookieName, true);\n\t\t\t\t\t// console.log('endpoint works');\n\t\t\t\t\twindow.sessionStorage.setItem(cookieName, JSON.stringify(true))\n\t\t\t\t},\n\t\t\t\t404: function (response) {\n\t\t\t\t\t// Cookies.set(cookieName, false);\n\t\t\t\t\t// console.log('endpoint doesn\\'t work');\n\t\t\t\t\twindow.sessionStorage.setItem(cookieName, JSON.stringify(false))\n\t\t\t\t},\n\t\t\t\t0 : function (response) {\n\t\t\t\t\t// Cookies.set(cookieName, false);\n\t\t\t\t\t// console.log('endpoint doesn\\'t work');\n\t\t\t\t\twindow.sessionStorage.setItem(cookieName, JSON.stringify(false))\n\t\t\t\t},\n\t\t\t},\n\t\t}).then(r => {\n\t\t\t// console.log('test done')\n\t\t\t// console.log('result: ' + JSON.parse(window.sessionStorage.getItem(cookieName)));\n\t\t\t// return JSON.parse(window.sessionStorage.getItem(cookieName));\n\t\t})\n\t}\n\n\twpm.isWpmRestEndpointAvailable = function (cookieName = wpmRestSettings.cookieWpmRestEndpointAvailable) {\n\n\t\treturn !!wpm.getCookie(cookieName)\n\t}\n\n\twpm.writeOrderIdToStorage = function (orderId, expireDays = 365) {\n\n\t\t// save the order ID in the browser storage\n\n\t\tif (!window.Storage) {\n\t\t\tlet expiresDate = new Date()\n\t\t\texpiresDate.setDate(expiresDate.getDate() + wpmDeduper.cookieExpiresDays)\n\n\t\t\tlet ids = []\n\t\t\tif (checkCookie()) {\n\t\t\t\tids = JSON.parse(wpm.getCookie(wpmDeduper.keyName))\n\t\t\t}\n\n\t\t\tif (!ids.includes(orderId)) {\n\t\t\t\tids.push(orderId)\n\t\t\t\tdocument.cookie = wpmDeduper.keyName + \"=\" + JSON.stringify(ids) + \";expires=\" + expiresDate.toUTCString()\n\t\t\t}\n\n\t\t} else {\n\t\t\tif (localStorage.getItem(wpmDeduper.keyName) === null) {\n\t\t\t\tlet ids = []\n\t\t\t\tids.push(orderId)\n\t\t\t\twindow.localStorage.setItem(wpmDeduper.keyName, JSON.stringify(ids))\n\n\t\t\t} else {\n\t\t\t\tlet ids = JSON.parse(localStorage.getItem(wpmDeduper.keyName))\n\t\t\t\tif (!ids.includes(orderId)) {\n\t\t\t\t\tids.push(orderId)\n\t\t\t\t\twindow.localStorage.setItem(wpmDeduper.keyName, JSON.stringify(ids))\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tif (typeof wpm.storeOrderIdOnServer === \"function\" && wpmDataLayer.orderDeduplication) {\n\t\t\twpm.storeOrderIdOnServer(orderId)\n\t\t}\n\t}\n\n\tfunction checkCookie() {\n\t\tlet key = wpm.getCookie(wpmDeduper.keyName)\n\t\treturn key !== \"\"\n\t}\n\n\twpm.isOrderIdStored = function (orderId) {\n\n\t\t// console.log('deduper: ' + wpmDataLayer.orderDeduplication);\n\t\tif (wpmDataLayer.orderDeduplication) {\n\t\t\t// console.log('order deduplication: on');\n\t\t\tif (!window.Storage) {\n\n\t\t\t\tif (checkCookie()) {\n\t\t\t\t\tlet ids = JSON.parse(wpm.getCookie(wpmDeduper.keyName))\n\t\t\t\t\treturn ids.includes(orderId)\n\t\t\t\t} else {\n\t\t\t\t\treturn false\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tif (localStorage.getItem(wpmDeduper.keyName) !== null) {\n\t\t\t\t\tlet ids = JSON.parse(localStorage.getItem(wpmDeduper.keyName))\n\t\t\t\t\treturn ids.includes(orderId)\n\t\t\t\t} else {\n\t\t\t\t\treturn false\n\t\t\t\t}\n\t\t\t}\n\t\t} else {\n\t\t\tconsole.log(\"order duplication prevention: off\")\n\t\t\treturn false\n\t\t}\n\t}\n\n\twpm.isEmail = function (email) {\n\t\t// https://emailregex.com/\n\t\tlet regex = /^(([^<>()\\[\\]\\\\.,;:\\s@\"]+(\\.[^<>()\\[\\]\\\\.,;:\\s@\"]+)*)|(\".+\"))@((\\[[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}])|(([a-zA-Z\\-0-9]+\\.)+[a-zA-Z]{2,}))$/\n\t\treturn regex.test(email)\n\t}\n\n\twpm.removeProductFromCart = function (productId, quantityToRemove = null) {\n\t\t// console.log('product_id: ' + productId + ' | quantityToRemove: ' + quantityToRemove);\n\n\t\ttry {\n\n\t\t\tif (!productId) throw Error(\"Wasn't able to retrieve a productId\")\n\n\t\t\tproductId = getIdBasedOndVariationsOutputSetting(productId)\n\n\t\t\tif (!productId) throw Error(\"Wasn't able to retrieve a productId\")\n\n\t\t\tlet quantity\n\n\t\t\tif (quantityToRemove == null) {\n\t\t\t\tquantity = wpmDataLayer.cart[productId].quantity\n\t\t\t} else {\n\t\t\t\tquantity = quantityToRemove\n\t\t\t}\n\n\t\t\t// console.log('product_id: ' + productId + ' | qty: ' + quantity);\n\t\t\t// console.log(productId);\n\t\t\t// console.log(wpmDataLayer.cart);\n\t\t\t// console.log(wpmDataLayer.cart[productId]);\n\n\t\t\tif (wpmDataLayer.cart[productId]) {\n\n\t\t\t\t// let product = {\n\t\t\t\t// id : productId.toString(),\n\t\t\t\t// dyn_r_ids: wpmDataLayer.cart[productId].dyn_r_ids,\n\t\t\t\t// name : wpmDataLayer.cart[productId].name,\n\t\t\t\t// // list_name: wpmDataLayer.shop.list_name, // doesn't make sense on mini_cart\n\t\t\t\t// brand : wpmDataLayer.cart[productId].brand,\n\t\t\t\t// category: wpmDataLayer.cart[productId].category,\n\t\t\t\t// variant : wpmDataLayer.cart[productId].variant,\n\t\t\t\t// // list_position: wpmDataLayer.cart[productId].position, // doesn't make sense on mini_cart\n\t\t\t\t// quantity : quantity,\n\t\t\t\t// price : wpmDataLayer.cart[productId].price,\n\t\t\t\t// isVariation: wpmDataLayer.products[productId].isVariation,\n\t\t\t\t// };\n\t\t\t\t//\n\t\t\t\t// if (product.isVariation) product['parentId_dyn_r_ids'] = wpmDataLayer.products[productId].parentId_dyn_r_ids;\n\n\t\t\t\tlet product = wpm.getProductDetailsFormattedForEvent(productId, quantity)\n\n\t\t\t\t// console.log('removing');\n\t\t\t\t// console.log(data);\n\n\t\t\t\tjQuery(document).trigger(\"wpmRemoveFromCart\", product)\n\n\t\t\t\tif (quantityToRemove == null || wpmDataLayer.cart[productId].quantity === quantityToRemove) {\n\t\t\t\t\tdelete wpmDataLayer.cart[productId]\n\t\t\t\t\tif (sessionStorage) sessionStorage.setItem(\"wpmDataLayerCart\", JSON.stringify(wpmDataLayer.cart))\n\t\t\t\t} else {\n\t\t\t\t\twpmDataLayer.cart[productId].quantity = wpmDataLayer.cart[productId].quantity - quantity\n\t\t\t\t\tif (sessionStorage) sessionStorage.setItem(\"wpmDataLayerCart\", JSON.stringify(wpmDataLayer.cart))\n\t\t\t\t}\n\t\t\t}\n\t\t} catch (e) {\n\t\t\tconsole.error(e)\n\t\t\t// console.log('getting cart from back end');\n\t\t\t// wpm.getCartItemsFromBackend();\n\t\t\t// console.log('getting cart from back end done');\n\n\t\t}\n\t}\n\n\tgetIdBasedOndVariationsOutputSetting = function (productId) {\n\n\t\ttry {\n\t\t\tif (wpmDataLayer?.general?.variationsOutput) {\n\t\t\t\t// console.log('test');\n\t\t\t\treturn productId\n\t\t\t} else {\n\t\t\t\tif (wpmDataLayer.products[productId].isVariation) {\n\t\t\t\t\treturn wpmDataLayer.products[productId].parentId\n\t\t\t\t} else {\n\t\t\t\t\treturn productId\n\t\t\t\t}\n\t\t\t}\n\t\t} catch (e) {\n\t\t\tconsole.error(e)\n\t\t}\n\t}\n\n\t// add_to_cart\n\twpm.addProductToCart = function (productId, quantity) {\n\n\t\ttry {\n\t\t\t// console.log('productId: ' + productId + ' | qty: ' + quantity);\n\t\t\t// console.log('productId: ' + productId + ' | variationId: ' + variationId + ' | qty: ' + quantity);\n\n\t\t\tif (!productId) throw Error(\"Wasn't able to retrieve a productId\")\n\n\t\t\tproductId = getIdBasedOndVariationsOutputSetting(productId)\n\n\t\t\tif (!productId) throw Error(\"Wasn't able to retrieve a productId\")\n\n\t\t\tif (wpmDataLayer.products[productId]) {\n\n\t\t\t\tlet product = wpm.getProductDetailsFormattedForEvent(productId, quantity)\n\n\t\t\t\t// console.log(productId);\n\n\t\t\t\tjQuery(document).trigger(\"wpmAddToCart\", product)\n\n\t\t\t\t// add product to cart wpmDataLayer['cart']\n\n\t\t\t\t// if the product already exists in the object, only add the additional quantity\n\t\t\t\t// otherwise create that product object in the wpmDataLayer['cart']\n\t\t\t\tif (wpmDataLayer.cart !== undefined && wpmDataLayer.cart[productId] !== undefined) {\n\t\t\t\t\twpmDataLayer.cart[productId].quantity = wpmDataLayer.cart[productId].quantity + quantity\n\t\t\t\t\tif (sessionStorage) sessionStorage.setItem(\"wpmDataLayerCart\", JSON.stringify(wpmDataLayer.cart))\n\t\t\t\t} else {\n\n\t\t\t\t\tif (!wpmDataLayer.cart) {\n\n\t\t\t\t\t\t// wpmDataLayer['cart'] = {\n\t\t\t\t\t\t// [productId]: {\n\t\t\t\t\t\t// id : productId,\n\t\t\t\t\t\t// dyn_r_ids : wpmDataLayer.products[productId].dyn_r_ids,\n\t\t\t\t\t\t// name : wpmDataLayer.products[productId].name,\n\t\t\t\t\t\t// brand : wpmDataLayer.products[productId].brand,\n\t\t\t\t\t\t// category : wpmDataLayer.products[productId].category,\n\t\t\t\t\t\t// variant : wpmDataLayer.products[productId].variant,\n\t\t\t\t\t\t// quantity : quantity,\n\t\t\t\t\t\t// price : wpmDataLayer.products[productId].price,\n\t\t\t\t\t\t// isVariation: wpmDataLayer.products[productId].isVariation,\n\t\t\t\t\t\t// parentId : wpmDataLayer.products[productId].parentId,\n\t\t\t\t\t\t// }\n\t\t\t\t\t\t// };\n\t\t\t\t\t\t//\n\t\t\t\t\t\t// if (wpmDataLayer['cart'][productId].isVariation) wpmDataLayer['cart'][productId]['parentId_dyn_r_ids'] = wpmDataLayer.products[productId].parentId_dyn_r_ids;\n\n\t\t\t\t\t\twpmDataLayer[\"cart\"] = {\n\t\t\t\t\t\t\t[productId]: wpm.getProductDetailsFormattedForEvent(productId, quantity),\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tif (sessionStorage) sessionStorage.setItem(\"wpmDataLayerCart\", JSON.stringify(wpmDataLayer.cart))\n\t\t\t\t\t} else {\n\n\t\t\t\t\t\t// wpmDataLayer.cart[productId] = {\n\t\t\t\t\t\t// id : productId,\n\t\t\t\t\t\t// dyn_r_ids : wpmDataLayer.products[productId].dyn_r_ids,\n\t\t\t\t\t\t// name : wpmDataLayer.products[productId].name,\n\t\t\t\t\t\t// brand : wpmDataLayer.products[productId].brand,\n\t\t\t\t\t\t// category : wpmDataLayer.products[productId].category,\n\t\t\t\t\t\t// variant : wpmDataLayer.products[productId].variant,\n\t\t\t\t\t\t// quantity : quantity,\n\t\t\t\t\t\t// price : wpmDataLayer.products[productId].price,\n\t\t\t\t\t\t// isVariation: wpmDataLayer.products[productId].isVariation,\n\t\t\t\t\t\t// parentId : wpmDataLayer.products[productId].parentId,\n\t\t\t\t\t\t// };\n\t\t\t\t\t\t//\n\t\t\t\t\t\t// if (wpmDataLayer.cart[productId].isVariation) wpmDataLayer.cart[productId]['parentId_dyn_r_ids'] = wpmDataLayer.products[productId].parentId_dyn_r_ids;\n\n\t\t\t\t\t\twpmDataLayer.cart[productId] = wpm.getProductDetailsFormattedForEvent(productId, quantity)\n\n\t\t\t\t\t\tif (sessionStorage) sessionStorage.setItem(\"wpmDataLayerCart\", JSON.stringify(wpmDataLayer.cart))\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t} catch (e) {\n\t\t\tconsole.error(e)\n\n\t\t\t// fallback if wpmDataLayer.cart and wpmDataLayer.products got out of sync in case cart caching has an issue\n\t\t\twpm.getCartItemsFromBackend()\n\t\t}\n\t}\n\n\twpm.getCartItems = function () {\n\n\t\t// console.log('get cart items');\n\n\t\tif (sessionStorage) {\n\t\t\tif (!sessionStorage.getItem(\"wpmDataLayerCart\") || wpmDataLayer.shop.page_type === \"order_received_page\") {\n\t\t\t\tsessionStorage.setItem(\"wpmDataLayerCart\", JSON.stringify({}))\n\t\t\t} else {\n\t\t\t\twpm.saveCartObjectToDataLayer(JSON.parse(sessionStorage.getItem(\"wpmDataLayerCart\")))\n\t\t\t}\n\t\t} else {\n\t\t\twpm.getCartItemsFromBackend()\n\t\t}\n\t}\n\n\twpm.getCartItemsFromBackend = function () {\n\t\t// get all cart items from the backend\n\t\ttry {\n\t\t\tlet data = {\n\t\t\t\taction: \"wpm_get_cart_items\",\n\t\t\t}\n\n\t\t\tjQuery.ajax(\n\t\t\t\t{\n\t\t\t\t\ttype : \"get\",\n\t\t\t\t\tdataType: \"json\",\n\t\t\t\t\t// url : ajax_object.ajax_url,\n\t\t\t\t\turl : wpm.ajax_url,\n\t\t\t\t\tdata : data,\n\t\t\t\t\tsuccess: function (cartItems) {\n\n\t\t\t\t\t\t// save all cart items into wpmDataLayer\n\n\t\t\t\t\t\tif (!cartItems[\"cart\"]) cartItems[\"cart\"] = {}\n\n\t\t\t\t\t\twpm.saveCartObjectToDataLayer(cartItems[\"cart\"])\n\t\t\t\t\t\tif (sessionStorage) sessionStorage.setItem(\"wpmDataLayerCart\", JSON.stringify(cartItems[\"cart\"]))\n\t\t\t\t\t},\n\t\t\t\t})\n\t\t} catch (e) {\n\t\t\tconsole.error(e)\n\t\t}\n\t}\n\n\twpm.getProductsFromBackend = function (productIds) {\n\t\t// console.log('getting pids from back-end: ' + productIds)\n\t\t// get productIds from the backend\n\n\t\t// reduce productIds by products already in the dataLayer\n\t\tproductIds = productIds.filter(item => !wpmDataLayer.products.hasOwnProperty(item))\n\n\t\t// if no products IDs are in the object, don't try to get anything from the server\n\t\tif (!productIds || productIds.length === 0) return\n\n\t\ttry {\n\t\t\tlet data = {\n\t\t\t\taction : \"wpm_get_product_ids\",\n\t\t\t\tproductIds: productIds,\n\t\t\t}\n\n\t\t\tjQuery.ajax(\n\t\t\t\t{\n\t\t\t\t\ttype : \"get\",\n\t\t\t\t\tdataType: \"json\",\n\t\t\t\t\t// url : ajax_object.ajax_url,\n\t\t\t\t\turl : wpm.ajax_url,\n\t\t\t\t\tdata : data,\n\t\t\t\t\tsuccess: function (products) {\n\n\t\t\t\t\t\t// merge products into wpmDataLayer.products\n\t\t\t\t\t\twpmDataLayer.products = Object.assign({}, wpmDataLayer.products, products)\n\t\t\t\t\t},\n\t\t\t\t\terror : function (response) {\n\t\t\t\t\t\tconsole.log(response)\n\t\t\t\t\t},\n\t\t\t\t})\n\t\t} catch (e) {\n\t\t\tconsole.error(e)\n\t\t}\n\t}\n\n\twpm.saveCartObjectToDataLayer = function (cartObject) {\n\t\twpmDataLayer.cart = cartObject\n\t\twpmDataLayer.products = Object.assign({}, wpmDataLayer.products, cartObject)\n\t}\n\n\twpm.fireCheckoutOption = function (step, checkout_option = null, value = null) {\n\n\t\tlet data = {\n\t\t\tstep : step,\n\t\t\tcheckout_option: checkout_option,\n\t\t\tvalue : value,\n\t\t}\n\n\t\tjQuery(document).trigger(\"wpmFireCheckoutOption\", data)\n\t}\n\n\twpm.fireCheckoutProgress = function (step) {\n\n\t\tlet data = {\n\t\t\tstep: step,\n\t\t}\n\n\t\tjQuery(document).trigger(\"wpmFireCheckoutProgress\", data)\n\t}\n\n\twpm.getPostIdFromString = function (string) {\n\t\t// console.log(string);\n\t\ttry {\n\t\t\treturn string.match(/(post-)(\\d+)/)[2]\n\t\t} catch (e) {\n\t\t\tconsole.error(e)\n\t\t}\n\t}\n\n\twpm.triggerViewItemList = function (productId) {\n\n\t\t// productId = null;\n\n\t\tif (!productId) throw Error(\"Wasn't able to retrieve a productId\")\n\n\t\tproductId = getIdBasedOndVariationsOutputSetting(productId)\n\n\t\tif (!productId) throw Error(\"Wasn't able to retrieve a productId\")\n\n\t\tjQuery(document).trigger(\"wpmViewItemList\", wpm.getProductDataForViewItemEvent(productId))\n\t}\n\n\twpm.getProductDataForViewItemEvent = function (productId) {\n\n\t\tif (!productId) throw Error(\"Wasn't able to retrieve a productId\")\n\n\t\ttry {\n\t\t\tif (wpmDataLayer.products[productId]) {\n\n\t\t\t\treturn wpm.getProductDetailsFormattedForEvent(productId)\n\t\t\t}\n\t\t} catch (e) {\n\t\t\tconsole.error(e)\n\t\t}\n\t}\n\twpm.getMainProductIdFromProductPage = function () {\n\t\ttry {\n\t\t\tif ([\"simple\", \"variable\", \"grouped\", \"composite\", \"bundle\"].indexOf(wpmDataLayer.shop.product_type) >= 0) {\n\t\t\t\treturn jQuery(\".wpmProductId:first\").data(\"id\")\n\t\t\t} else {\n\t\t\t\treturn false\n\t\t\t}\n\t\t} catch (e) {\n\t\t\tconsole.error(e)\n\t\t}\n\t}\n\n\twpm.viewItemListTriggerTestMode = function (target) {\n\n\t\tjQuery(target).css({\"position\": \"relative\"})\n\t\tjQuery(target).append(\"<div id=\\\"viewItemListTriggerOverlay\\\"></div>\")\n\t\tjQuery(target).find(\"#viewItemListTriggerOverlay\").css({\n\t\t\t\"z-index\" : \"10\",\n\t\t\t\"display\" : \"block\",\n\t\t\t\"position\" : \"absolute\",\n\t\t\t\"height\" : \"100%\",\n\t\t\t\"top\" : \"0\",\n\t\t\t\"left\" : \"0\",\n\t\t\t\"right\" : \"0\",\n\t\t\t\"opacity\" : wpmDataLayer.viewItemListTrigger.opacity,\n\t\t\t\"background-color\": wpmDataLayer.viewItemListTrigger.backgroundColor,\n\t\t})\n\t}\n\n\twpm.getSearchTermFromUrl = function () {\n\t\ttry {\n\t\t\tlet urlParameters = new URLSearchParams(window.location.search)\n\t\t\treturn urlParameters.get(\"s\")\n\t\t} catch (e) {\n\t\t\tconsole.error(e)\n\t\t}\n\t}\n\n\t// we need this to track timeouts for intersection observers\n\tlet ioTimeouts = {}\n\n\twpm.observerCallback = function (entries, observer) {\n\n\t\tentries.forEach((entry) => {\n\n\t\t\ttry {\n\t\t\t\tlet productId\n\n\t\t\t\tlet elementId = jQuery(entry.target).data(\"ioid\")\n\n\t\t\t\t// Get the productId from next element, if wpmProductId is a sibling, like in Gutenberg blocks\n\t\t\t\t// otherwise go search in children, like in regular WC loop items\n\t\t\t\tif (jQuery(entry.target).next(\".wpmProductId\").length) {\n\t\t\t\t\t// console.log('test 1');\n\t\t\t\t\tproductId = jQuery(entry.target).next(\".wpmProductId\").data(\"id\")\n\t\t\t\t} else {\n\t\t\t\t\tproductId = jQuery(entry.target).find(\".wpmProductId\").data(\"id\")\n\t\t\t\t}\n\n\t\t\t\t// productId = null;\n\n\t\t\t\tif (!productId) throw Error(\"wpmProductId element not found\")\n\n\t\t\t\tif (entry.isIntersecting) {\n\n\t\t\t\t\t// console.log('prodid: ' + productId);\n\t\t\t\t\tioTimeouts[elementId] = setTimeout(() => {\n\t\t\t\t\t\t// console.log('prodid: ' + productId);\n\t\t\t\t\t\twpm.triggerViewItemList(productId)\n\t\t\t\t\t\tif (wpmDataLayer.viewItemListTrigger.testMode) wpm.viewItemListTriggerTestMode(entry.target)\n\t\t\t\t\t\tif (wpmDataLayer.viewItemListTrigger.repeat === false) observer.unobserve(entry.target)\n\t\t\t\t\t}, wpmDataLayer.viewItemListTrigger.timeout)\n\n\t\t\t\t} else {\n\n\t\t\t\t\tclearTimeout(ioTimeouts[elementId])\n\t\t\t\t\tif (wpmDataLayer.viewItemListTrigger.testMode) jQuery(entry.target).find(\"#viewItemListTriggerOverlay\").remove()\n\t\t\t\t}\n\t\t\t} catch (e) {\n\t\t\t\tconsole.error(e)\n\t\t\t}\n\t\t})\n\t}\n\n\t// fire view_item_list only on products that have become visible\n\tlet io\n\tlet ioid = 0\n\tlet allIoElementsToWatch\n\n\tlet getAllElementsToWatch = function () {\n\n\t\tallIoElementsToWatch = jQuery(\".wpmProductId\")\n\t\t\t.map(function (i, elem) {\n\t\t\t\t// console.log(elem);\n\t\t\t\tif (\n\t\t\t\t\tjQuery(elem).parent().hasClass(\"type-product\") ||\n\t\t\t\t\tjQuery(elem).parent().hasClass(\"product\") ||\n\t\t\t\t\tjQuery(elem).parent().hasClass(\"product-item-inner\")\n\t\t\t\t) {\n\t\t\t\t\t// console.log(elem);\n\t\t\t\t\treturn jQuery(elem).parent()\n\t\t\t\t} else if (\n\t\t\t\t\tjQuery(elem).prev().hasClass(\"wc-block-grid__product\") ||\n\t\t\t\t\tjQuery(elem).prev().hasClass(\"product\") ||\n\t\t\t\t\tjQuery(elem).prev().hasClass(\"product-small\") ||\n\t\t\t\t\tjQuery(elem).prev().hasClass(\"woocommerce-LoopProduct-link\")\n\t\t\t\t) {\n\t\t\t\t\treturn jQuery(this).prev()\n\t\t\t\t} else if (jQuery(elem).closest(\".product\").length) {\n\t\t\t\t\treturn jQuery(elem).closest(\".product\")\n\t\t\t\t}\n\t\t\t})\n\t}\n\n\twpm.startIntersectionObserverToWatch = function () {\n\n\t\ttry {\n\t\t\t// enable view_item_list test mode from browser\n\t\t\tlet urlParams = new URLSearchParams(window.location.search)\n\t\t\tif (urlParams.has(\"vildemomode\")) wpmDataLayer.viewItemListTrigger.testMode = true\n\n\t\t\t// set up intersection observer\n\t\t\tio = new IntersectionObserver(wpm.observerCallback, {\n\t\t\t\tthreshold: wpmDataLayer.viewItemListTrigger.threshold,\n\t\t\t})\n\n\t\t\tgetAllElementsToWatch()\n\n\t\t\t// console.log(allElementsToWatch);\n\n\t\t\tallIoElementsToWatch.each(function (i, elem) {\n\t\t\t\t// console.log(elem[0]);\n\t\t\t\t// jQuery(elem[0]).attr('data-ioid', ioid++);\n\t\t\t\tjQuery(elem[0]).data(\"ioid\", ioid++)\n\n\t\t\t\tio.observe(elem[0])\n\t\t\t})\n\t\t} catch (e) {\n\t\t\tconsole.error(e)\n\t\t}\n\t}\n\n\t// watch DOM for new lazy loaded products and add them to the intersection observer\n\twpm.startProductsMutationObserverToWatch = function () {\n\n\t\ttry {\n\t\t\t// Pass in the target node, as well as the observer options\n\n\t\t\t// selects the most common parent node\n\t\t\t// https://stackoverflow.com/a/7648323/4688612\n\t\t\tlet productsNode = jQuery(\".wpmProductId:eq(0)\").parents().has(jQuery(\".wpmProductId:eq(1)\").parents()).first()\n\n\t\t\tif (productsNode.length) {\n\t\t\t\tproductsMutationObserver.observe(productsNode[0], {\n\t\t\t\t\tattributes : true,\n\t\t\t\t\tchildList : true,\n\t\t\t\t\tcharacterData: true,\n\t\t\t\t})\n\t\t\t}\n\t\t} catch (e) {\n\t\t\tconsole.error(e)\n\t\t}\n\t}\n\n\t// Create an observer instance\n\tlet productsMutationObserver = new MutationObserver(function (mutations) {\n\n\t\tmutations.forEach(function (mutation) {\n\t\t\tlet newNodes = mutation.addedNodes // DOM NodeList\n\t\t\tif (newNodes !== null) { // If there are new nodes added\n\t\t\t\tlet nodes = jQuery(newNodes) // jQuery set\n\t\t\t\tnodes.each(function () {\n\t\t\t\t\tif (\n\t\t\t\t\t\tjQuery(this).hasClass(\"type-product\") ||\n\t\t\t\t\t\tjQuery(this).hasClass(\"product-small\") ||\n\t\t\t\t\t\tjQuery(this).hasClass(\"wc-block-grid__product\")\n\t\t\t\t\t) {\n\t\t\t\t\t\t// check if the node has a child or sibling wpmProductId\n\t\t\t\t\t\t// if yes add it to the intersectionObserver\n\t\t\t\t\t\tif (hasWpmProductIdElement(this)) {\n\t\t\t\t\t\t\tjQuery(this).data(\"ioid\", ioid++)\n\t\t\t\t\t\t\tio.observe(this)\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t})\n\t\t\t}\n\t\t})\n\t})\n\n\tlet hasWpmProductIdElement = function (elem) {\n\t\treturn !!(jQuery(elem).find(\".wpmProductId\").length ||\n\t\t\tjQuery(elem).siblings(\".wpmProductId\").length)\n\t}\n\n\twpm.setCookie = function (cookieName, cookieValue = \"\", expiryDays = null) {\n\t\tif (expiryDays) {\n\t\t\tlet d = new Date()\n\t\t\td.setTime(d.getTime() + (expiryDays * 24 * 60 * 60 * 1000))\n\t\t\tlet expires = \"expires=\" + d.toUTCString()\n\t\t\tdocument.cookie = cookieName + \"=\" + cookieValue + \";\" + expires + \";path=/\"\n\t\t} else {\n\t\t\tdocument.cookie = cookieName + \"=\" + cookieValue + \";path=/\"\n\t\t}\n\t}\n\n\twpm.getCookie = function (cookieName) {\n\t\tlet name = cookieName + \"=\"\n\t\tlet decodedCookie = decodeURIComponent(document.cookie)\n\t\tlet ca = decodedCookie.split(\";\")\n\t\tfor (let i = 0; i < ca.length; i++) {\n\t\t\tlet c = ca[i]\n\t\t\twhile (c.charAt(0) == \" \") {\n\t\t\t\tc = c.substring(1)\n\t\t\t}\n\t\t\tif (c.indexOf(name) == 0) {\n\t\t\t\treturn c.substring(name.length, c.length)\n\t\t\t}\n\t\t}\n\t\treturn \"\"\n\t}\n\n\twpm.getWpmSessionData = function () {\n\t\tif (window.sessionStorage) {\n\n\t\t\tlet data = window.sessionStorage.getItem(\"_wpm\")\n\t\t\tif (data !== null) {\n\t\t\t\treturn JSON.parse(data)\n\t\t\t} else {\n\t\t\t\treturn {}\n\t\t\t}\n\t\t} else {\n\t\t\treturn {}\n\t\t}\n\t}\n\n\twpm.setWpmSessionData = function (data) {\n\t\tif (window.sessionStorage) {\n\t\t\twindow.sessionStorage.setItem(\"_wpm\", JSON.stringify(data))\n\t\t}\n\t}\n\n\twpm.storeOrderIdOnServer = function (orderId) {\n\n\t\t// console.log('saving wpm_purchase_pixels_fired');\n\n\t\t// console.log('url: ' + wpm_premium_only_ajax_object.ajax_url);\n\t\t// console.log('nonce: ' + wpm_premium_only_ajax_object.nonce);\n\t\t// console.log('url: ' + wpm.ajax_url);\n\t\t// console.log('nonce: ' + wpm.nonce);\n\n\t\ttry {\n\t\t\t// save the state in the database\n\t\t\tlet data = {\n\t\t\t\taction : \"wpm_purchase_pixels_fired\",\n\t\t\t\torder_id: orderId,\n\t\t\t\t// nonce : ajax_object.nonce,\n\t\t\t\tnonce: wpm.nonce,\n\t\t\t}\n\n\t\t\tjQuery.ajax(\n\t\t\t\t{\n\t\t\t\t\ttype : \"post\",\n\t\t\t\t\tdataType: \"json\",\n\t\t\t\t\t// url : ajax_object.ajax_url,\n\t\t\t\t\turl : wpm.ajax_url,\n\t\t\t\t\tdata : data,\n\t\t\t\t\tsuccess: function (response) {\n\t\t\t\t\t\tif (response.success === false) {\n\t\t\t\t\t\t\tconsole.log(response)\n\t\t\t\t\t\t}\n\t\t\t\t\t},\n\t\t\t\t\terror : function (response) {\n\t\t\t\t\t\tconsole.log(response)\n\t\t\t\t\t},\n\t\t\t\t})\n\t\t} catch (e) {\n\t\t\tconsole.error(e)\n\t\t}\n\t}\n\n\twpm.getProductIdByCartItemKeyUrl = function (url) {\n\t\tlet searchParams = new URLSearchParams(url.search)\n\t\tlet cartItemKey = searchParams.get(\"remove_item\")\n\n\t\tlet productId = null\n\n\t\tif (wpmDataLayer.cartItemKeys[cartItemKey][\"variation_id\"] === 0) {\n\t\t\tproductId = wpmDataLayer.cartItemKeys[cartItemKey][\"product_id\"]\n\t\t} else {\n\t\t\tproductId = wpmDataLayer.cartItemKeys[cartItemKey][\"variation_id\"]\n\t\t}\n\n\t\treturn productId\n\t}\n\n\twpm.getAddToCartLinkProductIds = function () {\n\t\treturn jQuery(\"a\").map(function () {\n\t\t\tlet href = jQuery(this).attr(\"href\")\n\n\t\t\tif (href && href.includes(\"?add-to-cart=\")) {\n\t\t\t\tlet matches = href.match(/(add-to-cart=)(\\d+)/)\n\t\t\t\tif (matches) return matches[2]\n\t\t\t}\n\t\t}).get()\n\t}\n\n\twpm.getProductDetailsFormattedForEvent = function (productId, quantity = 1) {\n\n\t\t// console.log(wpmDataLayer.products[productId].dyn_r_ids)\n\n\t\tlet product = {\n\t\t\tid : productId.toString(),\n\t\t\tdyn_r_ids : wpmDataLayer.products[productId].dyn_r_ids,\n\t\t\tname : wpmDataLayer.products[productId].name,\n\t\t\tlist_name : wpmDataLayer.shop.list_name,\n\t\t\tbrand : wpmDataLayer.products[productId].brand,\n\t\t\tcategory : wpmDataLayer.products[productId].category,\n\t\t\tvariant : wpmDataLayer.products[productId].variant,\n\t\t\tlist_position: wpmDataLayer.products[productId].position,\n\t\t\tquantity : quantity,\n\t\t\tprice : wpmDataLayer.products[productId].price,\n\t\t\tcurrency : wpmDataLayer.shop.currency,\n\t\t\tisVariable : wpmDataLayer.products[productId].isVariable,\n\t\t\tisVariation : wpmDataLayer.products[productId].isVariation,\n\t\t\tparentId : wpmDataLayer.products[productId].parentId,\n\t\t}\n\n\t\tif (product.isVariation) product[\"parentId_dyn_r_ids\"] = wpmDataLayer.products[productId].parentId_dyn_r_ids\n\n\t\treturn product\n\t}\n\n\twpm.setReferrerToCookie = function () {\n\t\t// can't use session storage as we can't read it from the server\n\t\tif (!wpm.getCookie(\"wpmReferrer\")) {\n\t\t\twpm.setCookie(\"wpmReferrer\", document.referrer)\n\t\t}\n\t}\n\n\twpm.getReferrerFromCookie = function () {\n\t\tif (wpm.getCookie(\"wpmReferrer\")) {\n\t\t\treturn wpm.getCookie(\"wpmReferrer\")\n\t\t} else {\n\t\t\treturn null\n\t\t}\n\t}\n\n\twpm.getClidFromBrowser = function (clidId = \"gclid\") {\n\n\t\tlet clidCookieId\n\n\t\tclidCookieId = {\n\t\t\tgclid: \"_gcl_aw\",\n\t\t\tdclid: \"_gcl_dc\",\n\t\t}\n\n\t\tif (wpm.getCookie(clidCookieId[clidId])) {\n\t\t\tlet clidCookie = wpm.getCookie(clidCookieId[clidId])\n\t\t\tlet matches = clidCookie.match(/(GCL.[\\d]*.)(.*)/)\n\t\t\treturn matches[2]\n\t\t} else {\n\t\t\treturn \"\"\n\t\t}\n\t}\n\n\twpm.getUserAgent = function () {\n\t\treturn navigator.userAgent\n\t}\n\n\twpm.getViewPort = function () {\n\t\treturn {\n\t\t\twidth : Math.max(document.documentElement.clientWidth || 0, window.innerWidth || 0),\n\t\t\theight: Math.max(document.documentElement.clientHeight || 0, window.innerHeight || 0),\n\t\t}\n\t}\n\n\t/*\n\t* Handle Cookie Management Platforms\n\t* */\n\n\tlet getComplianzCookies = function () {\n\n\t\tlet cmplz_statistics = wpm.getCookie(\"cmplz_statistics\")\n\t\tlet cmplz_marketing = wpm.getCookie(\"cmplz_marketing\")\n\t\tlet cmplz_consent_status = wpm.getCookie(\"cmplz_consent_status\") || wpm.getCookie(\"cmplz_banner-status\")\n\n\n\t\tif (cmplz_consent_status) {\n\t\t\treturn {\n\t\t\t\tanalytics : cmplz_statistics === \"allow\",\n\t\t\t\tads : cmplz_marketing === \"allow\",\n\t\t\t\tvisitorHasChosen: true,\n\t\t\t}\n\t\t} else {\n\t\t\treturn false\n\t\t}\n\t}\n\n\tlet getCookieLawInfoCookies = function () {\n\n\t\tlet analyticsCookie = wpm.getCookie(\"cookielawinfo-checkbox-analytics\")\n\t\tlet adsCookie = wpm.getCookie(\"cookielawinfo-checkbox-advertisement\")\n\t\tlet visitorHasChosen = wpm.getCookie(\"CookieLawInfoConsent\")\n\n\t\tif (analyticsCookie || adsCookie) {\n\n\t\t\treturn {\n\t\t\t\tanalytics : analyticsCookie === \"yes\",\n\t\t\t\tads : adsCookie === \"yes\",\n\t\t\t\tvisitorHasChosen: !!visitorHasChosen,\n\t\t\t}\n\t\t} else {\n\t\t\treturn false\n\t\t}\n\t}\n\n\n\tlet\n\t\twpmConsentValues = {}\n\twpmConsentValues.categories = {}\n\twpmConsentValues.pixels = []\n\twpmConsentValues.mode = \"category\"\n\twpmConsentValues.visitorHasChosen = false\n\n\twpm.getConsentValues = function () {\n\t\treturn wpmConsentValues\n\t}\n\n\twpm.setConsentValueCategories = function (analytics = false, ads = false) {\n\t\twpmConsentValues.categories.analytics = analytics\n\t\twpmConsentValues.categories.ads = ads\n\t}\n\n\twpm.updateConsentCookieValues = function (explicitConsent = false) {\n\n\t\t// ad_storage\n\t\t// analytics_storage\n\t\t// functionality_storage\n\t\t// personalization_storage\n\t\t// security_storage\n\n\t\t// console.log('exp cons: ' + explicitConsent)\n\n\t\tlet cookie\n\n\t\tif (cookie = wpm.getCookie(\"CookieConsent\")) {\n\t\t\t// Cookiebot\n\t\t\t// https://wordpress.org/plugins/cookiebot/\n\t\t\tcookie = decodeURI(cookie)\n\n\t\t\t// console.log(cookie.indexOf('statistics:true'))\n\t\t\t// console.log(cookie.indexOf('marketing:true'))\n\n\t\t\twpmConsentValues.categories.analytics = cookie.indexOf(\"statistics:true\") >= 0\n\t\t\twpmConsentValues.categories.ads = cookie.indexOf(\"marketing:true\") >= 0\n\t\t\twpmConsentValues.visitorHasChosen = true\n\n\t\t} else if (cookie = wpm.getCookie(\"CookieScriptConsent\")) {\n\t\t\t// Cookie Script\n\t\t\t// https://wordpress.org/plugins/cookie-script-com/\n\n\t\t\tcookie = JSON.parse(cookie)\n\n\t\t\t// console.log(cookie)\n\t\t\t// console.log(cookie.action)\n\t\t\t// console.log('cat length: ' + cookie.categories.length)\n\t\t\t// console.log(cookie.categories.indexOf('performance'))\n\n\t\t\tif (cookie.action === \"reject\") {\n\t\t\t\twpmConsentValues.categories.analytics = false\n\t\t\t\twpmConsentValues.categories.ads = false\n\t\t\t} else if (cookie.categories.length === 2) {\n\t\t\t\twpmConsentValues.categories.analytics = true\n\t\t\t\twpmConsentValues.categories.ads = true\n\t\t\t} else {\n\t\t\t\twpmConsentValues.categories.analytics = cookie.categories.indexOf(\"performance\") >= 0\n\t\t\t\twpmConsentValues.categories.ads = cookie.categories.indexOf(\"targeting\") >= 0\n\t\t\t}\n\n\t\t\twpmConsentValues.visitorHasChosen = true\n\n\t\t\t// console.log(wpmConsentValues)\n\n\t\t} else if (cookie = wpm.getCookie(\"borlabs-cookie\")) {\n\t\t\t// Borlabs Cookie\n\t\t\t// https://borlabs.io/borlabs-cookie/\n\n\t\t\tcookie = decodeURI(cookie)\n\t\t\tcookie = JSON.parse(cookie)\n\n\t\t\twpmConsentValues.categories.analytics = !!cookie?.consents?.statistics\n\t\t\twpmConsentValues.categories.ads = !!cookie?.consents?.marketing\n\t\t\twpmConsentValues.visitorHasChosen = true\n\t\t\twpmConsentValues.pixels = [...cookie?.consents?.statistics || [], ...cookie?.consents?.marketing || []]\n\t\t\twpmConsentValues.mode = \"pixel\"\n\n\t\t} else if (cookie = getComplianzCookies()) {\n\t\t\t// Complianz Cookie\n\t\t\t// https://wordpress.org/plugins/complianz-gdpr/\n\n\t\t\t// console.log(cookie)\n\n\t\t\twpmConsentValues.categories.analytics = cookie.analytics === true\n\t\t\twpmConsentValues.categories.ads = cookie.ads === true\n\t\t\twpmConsentValues.visitorHasChosen = cookie.visitorHasChosen\n\n\t\t\t// console.log(wpmConsentValues)\n\n\t\t} else if (cookie = wpm.getCookie(\"cookie_notice_accepted\")) {\n\t\t\t// Cookie Compliance (free version)\n\t\t\t// https://wordpress.org/plugins/cookie-notice/\n\n\t\t\twpmConsentValues.categories.analytics = true\n\t\t\twpmConsentValues.categories.ads = true\n\t\t\twpmConsentValues.visitorHasChosen = true\n\n\t\t} else if (cookie = wpm.getCookie(\"hu-consent\")) {\n\t\t\t// Cookie Compliance (pro version)\n\t\t\t// https://wordpress.org/plugins/cookie-notice/\n\n\t\t\tcookie = JSON.parse(cookie)\n\n\t\t\twpmConsentValues.categories.analytics = !!cookie.categories[\"3\"]\n\t\t\twpmConsentValues.categories.ads = !!cookie.categories[\"4\"]\n\t\t\twpmConsentValues.visitorHasChosen = true\n\n\t\t} else if (cookie = getCookieLawInfoCookies()) {\n\t\t\t// CookieYes, GDPR Cookie Consent (Cookie Law Info)\n\t\t\t// https://wordpress.org/plugins/cookie-law-info/\n\n\t\t\twpmConsentValues.categories.analytics = cookie.analytics === true\n\t\t\twpmConsentValues.categories.ads = cookie.ads === true\n\t\t\twpmConsentValues.visitorHasChosen = cookie.visitorHasChosen === true\n\n\t\t} else if (cookie = wpm.getCookie(\"moove_gdpr_popup\")) {\n\t\t\t// GDPR Cookie Compliance Plugin by Moove Agency\n\t\t\t// https://wordpress.org/plugins/gdpr-cookie-compliance/\n\t\t\t// TODO write documentation on how to set up the plugin in order for this to work properly\n\n\t\t\tcookie = JSON.parse(cookie)\n\t\t\t// console.log('moove cookie thirdparty: ' + cookie.thirdparty)\n\t\t\t// console.log('moove cookie advanced: ' + cookie.advanced)\n\n\t\t\twpmConsentValues.categories.analytics = cookie.thirdparty === \"1\"\n\t\t\twpmConsentValues.categories.ads = cookie.advanced === \"1\"\n\t\t\twpmConsentValues.visitorHasChosen = true\n\n\t\t\t// console.log(wpmConsentValues)\n\n\t\t} else {\n\t\t\t// consentValues.categories.analytics = true\n\t\t\t// consentValues.categories.ads = true\n\n\t\t\twpmConsentValues.categories.analytics = !explicitConsent\n\t\t\twpmConsentValues.categories.ads = !explicitConsent\n\t\t}\n\t}\n\n\twpm.updateConsentCookieValues()\n\n\twpm.setConsentDefaultValuesToExplicit = function () {\n\t\twpmConsentValues.categories = {\n\t\t\tanalytics: false,\n\t\t\tads : false,\n\t\t}\n\t}\n\n\twpm.canIFire = function (category, pixelName) {\n\n\t\tif (\"category\" === wpmConsentValues.mode) {\n\t\t\treturn !!wpmConsentValues.categories[category]\n\t\t} else if (\"pixel\" === wpmConsentValues.mode) {\n\t\t\treturn wpmConsentValues.pixels.includes(pixelName)\n\t\t} else {\n\t\t\tconsole.error(\"Couldn't find a valid consent mode in wpmConsentValues\")\n\t\t\treturn false\n\t\t}\n\t}\n\n\t/**\n\t * Runs through each script in <head> and blocks / unblocks it according to the plugin settings\n\t * and user consent.\n\t */\n\n\t// https://stackoverflow.com/q/65453565/4688612\n\twpm.scriptTagObserver = new MutationObserver((mutations) => {\n\t\tmutations.forEach(({addedNodes}) => {\n\t\t\t[...addedNodes]\n\t\t\t\t.forEach(node => {\n\n\t\t\t\t\tif ($(node).data(\"wpm-cookie-category\")) {\n\n\t\t\t\t\t\t// console.log(node)\n\n\t\t\t\t\t\t// If the pixel category has been approved > unblock\n\t\t\t\t\t\t// If the pixel belongs to more than one category, then unblock if one of the categories has been approved\n\t\t\t\t\t\t// If no category has been approved, but the Google Consent Mode is active, then only unblock the Google scripts\n\n\t\t\t\t\t\tif (wpm.shouldScriptBeActive(node)) {\n\t\t\t\t\t\t\twpm.unblockScript(node)\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\twpm.blockScript(node)\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t})\n\t\t})\n\t})\n\n\twpm.scriptTagObserver.observe(document.head, {childList: true, subtree: true})\n\twindow.addEventListener(\"DOMContentLoaded\", () => wpm.scriptTagObserver.disconnect())\n\n\twpm.shouldScriptBeActive = function (node) {\n\n\t\tif (\n\t\t\twpmDataLayer.shop.cookie_consent_mgmt.explicit_consent ||\n\t\t\twpmConsentValues.visitorHasChosen\n\t\t) {\n\n\t\t\tif (wpmConsentValues.mode === \"category\" && $(node).data(\"wpm-cookie-category\").split(\",\").some(element => wpmConsentValues.categories[element])) {\n\t\t\t\treturn true\n\t\t\t} else if (wpmConsentValues.mode === \"pixel\" && wpmConsentValues.pixels.includes($(node).data(\"wpm-pixel-name\"))) {\n\t\t\t\treturn true\n\t\t\t} else if (wpmConsentValues.mode === \"pixel\" && $(node).data(\"wpm-pixel-name\") === \"google\" && [\"google-analytics\", \"google-ads\"].some(element => wpmConsentValues.pixels.includes(element))) {\n\t\t\t\treturn true\n\t\t\t} else if (wpmDataLayer?.pixels?.google?.consent_mode?.active && $(node).data(\"wpm-pixel-name\") === \"google\") {\n\t\t\t\treturn true\n\t\t\t} else {\n\t\t\t\treturn false\n\t\t\t}\n\t\t} else {\n\t\t\treturn true\n\t\t}\n\t}\n\n\n\twpm.unblockScript = function (scriptNode, removeAttach = false) {\n\n\t\tif (removeAttach) $(scriptNode).remove()\n\n\t\tlet wpmSrc = $(scriptNode).data(\"wpm-src\")\n\t\tif (wpmSrc) $(scriptNode).attr(\"src\", wpmSrc)\n\n\t\tscriptNode.type = \"text/javascript\"\n\n\t\tif (removeAttach) $(scriptNode).appendTo(\"head\")\n\n\t\tjQuery(document).trigger(\"wpmPreLoadPixels\", {})\n\t}\n\n\twpm.blockScript = function (scriptNode, removeAttach = false) {\n\n\t\tif (removeAttach) $(scriptNode).remove()\n\n\t\tif ($(scriptNode).attr(\"src\")) $(scriptNode).removeAttr(\"src\")\n\t\tscriptNode.type = \"blocked/javascript\"\n\n\t\tif (removeAttach) $(scriptNode).appendTo(\"head\")\n\t}\n\n\twpm.unblockAllScripts = function (analytics = true, ads = true) {\n\t\t// console.log('unblocking all scripts')\n\n\t\t$.each(\n\t\t\t$(\"script[type=\\\"blocked/javascript\\\"]\"), function (index, scriptNode) {\n\n\t\t\t\tif ($(scriptNode).data(\"wpm-cookie-category\").includes(\"analytics\") && analytics) {\n\t\t\t\t\twpm.unblockScript(scriptNode, true)\n\t\t\t\t} else if ($(scriptNode).data(\"wpm-cookie-category\").includes(\"ads\") && ads) {\n\t\t\t\t\twpm.unblockScript(scriptNode, true)\n\t\t\t\t}\n\t\t\t})\n\n\t\tjQuery(document).trigger(\"wpmPreLoadPixels\", {})\n\t}\n\n\twpm.unblockSelectedPixels = function () {\n\t\t$.each(\n\t\t\t$(\"script[type=\\\"blocked/javascript\\\"]\"), function (index, node) {\n\n\t\t\t\tif (wpmConsentValues.pixels.includes($(node).data(\"wpm-pixel-name\"))) {\n\t\t\t\t\twpm.unblockScript(node, true)\n\t\t\t\t} else if ($(node).data(\"wpm-pixel-name\") === \"google\" && [\"google-analytics\", \"google-ads\"].some(element => wpmConsentValues.pixels.includes(element))) {\n\t\t\t\t\twpm.unblockScript(node, true)\n\t\t\t\t}\n\t\t\t})\n\n\t\tjQuery(document).trigger(\"wpmPreLoadPixels\", {})\n\t}\n\n\n\t/**\n\t * Block or unblock scripts for each CMP immediately after cookie consent has been updated\n\t * by the visitor.\n\t */\n\n\t// Borlabs Cookie\n\t// If visitor accepts cookies in Borlabs Cookie unblock the scripts\n\twindow.addEventListener(\"borlabs-cookie-consent-saved\", function (e) {\n\n\t\twpm.updateConsentCookieValues()\n\n\t\tif (wpmConsentValues.mode === \"pixel\") {\n\n\t\t\twpm.unblockSelectedPixels()\n\t\t\twpm.updateGoogleConsentMode(wpmConsentValues.pixels.includes(\"google-analytics\"), wpmConsentValues.pixels.includes(\"google-ads\"))\n\t\t} else {\n\n\t\t\twpm.unblockAllScripts(wpmConsentValues.categories.analytics, wpmConsentValues.categories.ads)\n\t\t\twpm.updateGoogleConsentMode(wpmConsentValues.categories.analytics, wpmConsentValues.categories.ads)\n\t\t}\n\t})\n\n\t// Cookiebot\n\t// If visitor accepts cookies in Cookiebot unblock the scripts\n\t// https://www.cookiebot.com/en/developer/\n\twindow.addEventListener(\"CookiebotOnAccept\", function (e) {\n\t\tif (Cookiebot.consent.statistics) wpmConsentValues.categories.analytics = true\n\t\tif (Cookiebot.consent.marketing) wpmConsentValues.categories.ads = true\n\n\t\twpm.unblockAllScripts(wpmConsentValues.categories.analytics, wpmConsentValues.categories.ads)\n\t\twpm.updateGoogleConsentMode(wpmConsentValues.categories.analytics, wpmConsentValues.categories.ads)\n\n\t}, false)\n\n\t/**\n\t * Cookie Script\n\t * If visitor accepts cookies in Cookie Script unblock the scripts\n\t * https://support.cookie-script.com/article/20-custom-events\n\t */\n\twindow.addEventListener(\"CookieScriptAccept\", function (e) {\n\t\tif (e.detail.categories.includes(\"performance\")) wpmConsentValues.categories.analytics = true\n\t\tif (e.detail.categories.includes(\"targeting\")) wpmConsentValues.categories.ads = true\n\n\t\twpm.unblockAllScripts(wpmConsentValues.categories.analytics, wpmConsentValues.categories.ads)\n\t\twpm.updateGoogleConsentMode(wpmConsentValues.categories.analytics, wpmConsentValues.categories.ads)\n\t})\n\n\t/**\n\t * Cookie Script\n\t * If visitor accepts cookies in Cookie Script unblock the scripts\n\t * https://support.cookie-script.com/\n\t */\n\twindow.addEventListener(\"CookieScriptAcceptAll\", function (e) {\n\t\twpm.unblockAllScripts(true, true)\n\t\twpm.updateGoogleConsentMode(true, true)\n\t})\n\n\t// Complianz Cookie\n\t// If visitor accepts cookies in Complianz unblock the scripts\n\tdocument.addEventListener(\"cmplzStatusChange\", function (e) {\n\n\t\twpm.updateConsentCookieValues()\n\n\t\t// console.log(wpmConsentValues)\n\n\t\twpm.unblockAllScripts(wpmConsentValues.categories.analytics, wpmConsentValues.categories.ads)\n\t\twpm.updateGoogleConsentMode(wpmConsentValues.categories.analytics, wpmConsentValues.categories.ads)\n\t})\n\n\t// Cookie Compliance by hu-manity.co (free and pro)\n\t// If visitor accepts cookies in Cookie Notice by hu-manity.co unblock the scripts (free version)\n\t// https://wordpress.org/support/topic/events-on-consent-change/#post-15202792\n\tdocument.addEventListener(\"setCookieNotice\", function (e) {\n\n\t\twpm.updateConsentCookieValues()\n\n\t\t// console.log(wpmConsentValues)\n\n\t\twpm.unblockAllScripts(wpmConsentValues.categories.analytics, wpmConsentValues.categories.ads)\n\t\twpm.updateGoogleConsentMode(wpmConsentValues.categories.analytics, wpmConsentValues.categories.ads)\n\t})\n\n\t/**\n\t * Cookie Compliance by hu-manity.co (free and pro)\n\t * If visitor accepts cookies in Cookie Notice by hu-manity.co unblock the scripts (pro version)\n\t * https://wordpress.org/support/topic/events-on-consent-change/#post-15202792\n\t * Because Cookie Notice has no documented API or event that is being triggered on consent save or update\n\t * we have to solve this by using a mutation observer.\n\t *\n\t * @type {MutationObserver}\n\t */\n\n\twpm.huObserver = new MutationObserver(function (mutations) {\n\t\tmutations.forEach(({addedNodes}) => {\n\t\t\t[...addedNodes]\n\t\t\t\t.forEach(node => {\n\n\t\t\t\t\tif (node.id === \"hu\") {\n\n\t\t\t\t\t\tjQuery(\".hu-cookies-save\").on(\"click\", function (e) {\n\t\t\t\t\t\t\twpm.updateConsentCookieValues()\n\t\t\t\t\t\t\twpm.unblockAllScripts(wpmConsentValues.categories.analytics, wpmConsentValues.categories.ads)\n\t\t\t\t\t\t\twpm.updateGoogleConsentMode(wpmConsentValues.categories.analytics, wpmConsentValues.categories.ads)\n\t\t\t\t\t\t})\n\t\t\t\t\t}\n\t\t\t\t})\n\t\t})\n\t})\n\n\tif (window.hu) {\n\t\twpm.huObserver.observe(document.documentElement || document.body, {childList: true, subtree: true})\n\t}\n\n\twpm.version = function () {\n\t\tconsole.log(wpmDataLayer.version)\n\t}\n\n\t// https://api.jquery.com/jquery.getscript/\n\twpm.loadScriptAndCacheIt = function (url, options) {\n\n\t\t// Allow user to set any option except for dataType, cache, and url\n\t\toptions = jQuery.extend(options || {}, {\n\t\t\tdataType: \"script\",\n\t\t\tcache : true,\n\t\t\turl : url,\n\t\t})\n\n\t\t// Use $.ajax() since it is more flexible than $.getScript\n\t\t// Return the jqXHR object so we can chain callbacks\n\t\treturn jQuery.ajax(options)\n\t}\n\n\twpm.getOrderItemPrice = function (orderItem) {\n\t\treturn (orderItem.total + orderItem.total_tax) / orderItem.quantity\n\t}\n\n\twpm.hasLoginEventFired = function () {\n\t\tlet data = wpm.getWpmSessionData()\n\t\treturn data?.loginEventFired\n\t}\n\n\twpm.setLoginEventFired = function () {\n\t\tlet data = wpm.getWpmSessionData()\n\t\tdata[\"loginEventFired\"] = true\n\t\twpm.setWpmSessionData(data)\n\t}\n\n\twpm.wpmDataLayerExists = function () {\n\t\treturn new Promise(function (resolve) {\n\t\t\t(function waitForVar() {\n\t\t\t\tif (typeof wpmDataLayer !== \"undefined\") return resolve()\n\t\t\t\tsetTimeout(waitForVar, 50)\n\t\t\t})()\n\t\t})\n\t}\n\n\twpm.pageLoaded = function () {\n\t\treturn new Promise(function (resolve) {\n\t\t\t(function waitForVar() {\n\t\t\t\tif (\"complete\" === document.readyState) return resolve()\n\t\t\t\tsetTimeout(waitForVar, 50)\n\t\t\t})()\n\t\t})\n\t}\n\n\t// wpm['load'] = {\n\t// base: true\n\t// };\n\n\twindow[\"wpmLoaded\"] = {}\n\n\t// return {\n\t// writeOrderIdToStorage : writeOrderIdToStorage,\n\t// isOrderIdStored : isOrderIdStored,\n\t// isEmail : isEmail,\n\t// removeProductFromCart : removeProductFromCart,\n\t// getViewItemProducts : getViewItemProducts,\n\t// addProductToCart : addProductToCart,\n\t// getCartItemsFromBackEnd: getCartItemsFromBackEnd,\n\t// fireCheckoutOption : fireCheckoutOption,\n\t// getCartItems : getCartItems\n\t// }\n\n}(window.wpm = window.wpm || {}, jQuery))\n\n/**\n * Run as soon as wpm namespace is loaded\n */\n\n// run when window ready\njQuery(function () {\n// jQuery(window).on('load', function () {\n\n\twpm.wpmDataLayerExists()\n\t\t.then(function () {\n\t\t\t// watch for products visible in viewport\n\t\t\twpm.startIntersectionObserverToWatch()\n\n\t\t\t// watch for lazy loaded products\n\t\t\twpm.startProductsMutationObserverToWatch()\n\t\t})\n\n\t// let products = jQuery(\".products, .product\")\n})\n\n\n/**\n * All event listeners\n * */\n\n// remove_from_cart event\n// body.on('click', '.remove_from_cart_button, .remove', function (e) {\njQuery(document).on(\"click\", \".remove_from_cart_button, .remove\", function (e) {\n\t// jQuery('.remove_from_cart_button, .remove').on('click', function (e) {\n\n\ttry {\n\t\t// console.log('remove_from_cart: ' + jQuery(this).data('product_id'));\n\n\t\tlet url = new URL(jQuery(this).attr(\"href\"))\n\t\tlet productId = wpm.getProductIdByCartItemKeyUrl(url)\n\n\t\twpm.removeProductFromCart(productId)\n\n\t} catch (e) {\n\t\tconsole.error(e)\n\t}\n})\n\n\n// add_to_cart event\n// body.on('click', '.add_to_cart_button:not(.product_type_variable), .ajax_add_to_cart, .single_add_to_cart_button', function (e) {\njQuery(document).on(\"click\", \".add_to_cart_button:not(.product_type_variable), .ajax_add_to_cart, .single_add_to_cart_button\", function (e) {\n\t// jQuery('.add_to_cart_button:not(.product_type_variable), .ajax_add_to_cart, .js-ajax-add-to-cart, .single_add_to_cart_button, .btn_color-2').on('click', function (e) {\n\n\ttry {\n\t\t// console.log('add_to_cart');\n\n\t\tif (wpmDataLayer.shop.page_type === \"product\") {\n\n\t\t\t// first process related and upsell products\n\t\t\tif (typeof jQuery(this).attr(\"href\") !== \"undefined\" && jQuery(this).attr(\"href\").includes(\"add-to-cart\")) {\n\t\t\t\t// console.log('add-to-cart on upsell and related products');\n\t\t\t\tlet quantity = 1\n\t\t\t\tlet productId = jQuery(this).data(\"product_id\")\n\t\t\t\t// console.log('productId: ' + productId);\n\t\t\t\twpm.addProductToCart(productId, quantity)\n\t\t\t} else {\n\n\t\t\t\tif (wpmDataLayer.shop.product_type === \"simple\") {\n\n\t\t\t\t\t// console.log('test');\n\t\t\t\t\tlet quantity = Number(jQuery(\".input-text.qty\").val())\n\n\t\t\t\t\tif (!quantity && quantity !== 0) quantity = 1\n\n\t\t\t\t\tlet productId = jQuery(this).val()\n\n\t\t\t\t\t// console.log('productId: ' + productId);\n\t\t\t\t\t// console.log('quantity: ' + quantity);\n\n\t\t\t\t\twpm.addProductToCart(productId, quantity)\n\n\t\t\t\t} else if (wpmDataLayer.shop.product_type === \"variable\") {\n\n\t\t\t\t\t// console.log('variable');\n\n\t\t\t\t\tlet quantity = Number(jQuery(\".input-text.qty\").val())\n\n\t\t\t\t\tif (!quantity && quantity !== 0) quantity = 1\n\n\t\t\t\t\tlet productId = jQuery(\"[name='variation_id']\").val()\n\n\t\t\t\t\t// console.log('productId: ' + productId);\n\t\t\t\t\t// console.log('quantity: ' + quantity);\n\n\t\t\t\t\twpm.addProductToCart(productId, quantity)\n\n\t\t\t\t} else if (wpmDataLayer.shop.product_type === \"grouped\") {\n\n\t\t\t\t\t// console.log('grouped');\n\n\t\t\t\t\tjQuery(\".woocommerce-grouped-product-list-item\").each(function () {\n\n\t\t\t\t\t\tlet quantity = Number(jQuery(this).find(\".input-text.qty\").val())\n\n\t\t\t\t\t\tif (!quantity && quantity !== 0) quantity = 1\n\n\t\t\t\t\t\tlet classes = jQuery(this).attr(\"class\")\n\t\t\t\t\t\tlet productId = wpm.getPostIdFromString(classes)\n\n\t\t\t\t\t\t// console.log('productId: ' + productId);\n\t\t\t\t\t\t// console.log('quantity: ' + quantity);\n\n\t\t\t\t\t\twpm.addProductToCart(productId, quantity)\n\t\t\t\t\t})\n\t\t\t\t} else if (wpmDataLayer.shop.product_type === \"bundle\") {\n\n\t\t\t\t\t// console.log('bundle');\n\n\t\t\t\t\tlet quantity = Number(jQuery(\".input-text.qty\").val())\n\n\t\t\t\t\tif (!quantity && quantity !== 0) quantity = 1\n\n\t\t\t\t\tlet productId = jQuery(\"input[name=add-to-cart]\").val()\n\n\t\t\t\t\t// console.log('productId: ' + productId);\n\t\t\t\t\t// console.log('quantity: ' + quantity);\n\n\t\t\t\t\twpm.addProductToCart(productId, quantity)\n\t\t\t\t}\n\t\t\t}\n\t\t} else {\n\n\t\t\t// console.log('non product page');\n\n\t\t\tlet quantity = 1\n\t\t\tlet productId = jQuery(this).data(\"product_id\")\n\t\t\t// console.log('productId: ' + productId);\n\t\t\twpm.addProductToCart(productId, quantity)\n\t\t}\n\t} catch (e) {\n\t\tconsole.error(e)\n\t}\n})\n\n// if someone clicks anywhere on a custom /?add-to-cart=123 link\n// trigger the add to cart event\n// body.one('click', function (e) {\n//\n// try {\n// if (jQuery(this)[0].URL) {\n//\n// let href = new URL(jQuery(this)[0].URL);\n// let searchParams = new URLSearchParams(href.search);\n//\n// if (searchParams.has('add-to-cart')) {\n// // console.log('non product page, /?add-to-cart=123 link');\n//\n// let productId = searchParams.get('add-to-cart');\n// wpm.addProductToCart(productId, 1);\n// }\n// }\n// } catch (e) {\n// console.error(e);\n// }\n// });\n\n\n/**\n * If someone clicks anywhere on a custom /?add-to-cart=123 link\n * trigger the add to cart event\n */\n// body.one('click', 'a:not(.add_to_cart_button, .ajax_add_to_cart, .single_add_to_cart_button)', function (event) {\njQuery(document).one(\"click\", \"a:not(.add_to_cart_button, .ajax_add_to_cart, .single_add_to_cart_button)\", function (event) {\n\t// jQuery('a:not(.add_to_cart_button, .ajax_add_to_cart, .single_add_to_cart_button)').one('click', function (event) {\n\n\ttry {\n\t\tif (jQuery(event.target).closest(\"a\").attr(\"href\")) {\n\n\t\t\tlet href = jQuery(event.target).closest(\"a\").attr(\"href\")\n\n\t\t\tif (href.includes(\"add-to-cart=\")) {\n\t\t\t\tlet matches = href.match(/(add-to-cart=)(\\d+)/)\n\t\t\t\t// console.log('pid: ' + matches[2])\n\t\t\t\tif (matches) wpm.addProductToCart(matches[2], 1)\n\t\t\t}\n\t\t}\n\t} catch (e) {\n\t\tconsole.error(e)\n\t}\n})\n\n// select_content GA UA event\n// select_item GA 4 event\n// jQuery(document).on('click', '.woocommerce-LoopProduct-link, .wc-block-grid__product, .product-small.box', function (e) {\n// body.on('click', '.woocommerce-LoopProduct-link, .wc-block-grid__product, .product, .product-small, .type-product', function (e) {\njQuery(document).on(\"click\", \".woocommerce-LoopProduct-link, .wc-block-grid__product, .product, .product-small, .type-product\", function (e) {\n\t// jQuery('.woocommerce-LoopProduct-link, .wc-block-grid__product, .product, .product-small, .type-product').on('click', function (e) {\n\n\ttry {\n\n\t\t// On some pages the event fires multiple times, and on product pages\n\t\t// even on page load. Using e.stopPropagation helps to prevent this,\n\t\t// but I dont know why. We don't even have to use this, since only a real\n\t\t// product click yields a valid productId. So we filter the invalid click\n\t\t// events out later down the code. I'll keep it that way because this is\n\t\t// the most compatible way across shops.\n\t\t// e.stopPropagation();\n\n\t\t// console.log('select_content and select_item');\n\n\t\tlet productId = jQuery(this).nextAll(\".wpmProductId:first\").data(\"id\")\n\t\t// console.log('select_content and select_item: ' + productId);\n\n\n\t\t// On product pages, for some reason, the click event is triggered on the main product on page load.\n\t\t// In that case no ID is found. But we can discard it, since we only want to trigger the event on\n\t\t// related products, which are found below.\n\t\tif (productId) {\n\n\t\t\t// console.log('select_content and select_item: ' + productId);\n\n\t\t\tproductId = getIdBasedOndVariationsOutputSetting(productId)\n\n\t\t\tif (!productId) throw Error(\"Wasn't able to retrieve a productId\")\n\n\t\t\t// console.log('prodid: ' + productId);\n\n\t\t\tif (wpmDataLayer.products && wpmDataLayer.products[productId]) {\n\n\t\t\t\tlet product = wpm.getProductDetailsFormattedForEvent(productId)\n\n\t\t\t\tjQuery(document).trigger(\"wpmSelectContentGaUa\", product)\n\t\t\t\tjQuery(document).trigger(\"wpmSelectItem\", product)\n\t\t\t}\n\t\t}\n\t} catch (e) {\n\t\tconsole.error(e)\n\t}\n})\n\n// begin_checkout event\n// body.one('click', '.checkout-button, .cart-checkout-button, .button.checkout', function (e) {\njQuery(document).one(\"click\", \".checkout-button, .cart-checkout-button, .button.checkout\", function (e) {\n\t// jQuery('.checkout-button, .cart-checkout-button, .button.checkout').one('click', function (e) {\n\t// console.log('begin_checkout');\n\n\tjQuery(document).trigger(\"wpmBeginCheckout\")\n})\n\n\n// checkout_progress event\n// track checkout option event: entered valid billing email\n// body.on('input', '#billing_email', function () {\njQuery(document).on(\"input\", \"#billing_email\", function () {\n\t// jQuery('#billing_email').on('input', function () {\n\n\tif (wpm.isEmail(jQuery(this).val())) {\n\t\t// wpm.fireCheckoutOption(2);\n\t\twpm.fireCheckoutProgress(2)\n\t\twpm.emailSelected = true\n\t}\n})\n\n// track checkout option event: purchase click\n\n// body.on('click', '.wc_payment_methods', function () {\njQuery(document).on(\"click\", \".wc_payment_methods\", function () {\n\t// jQuery('.wc_payment_methods').on('click', function () {\n\n\tif (false === wpm.paymentMethodSelected) {\n\t\twpm.fireCheckoutProgress(3)\n\t}\n\n\twpm.fireCheckoutOption(3, jQuery(\"input[name='payment_method']:checked\").val())\n\twpm.paymentMethodSelected = true\n})\n\n// track checkout option event: purchase click\n// body.one('click', '#place_order', function () {\njQuery(document).one(\"click\", \"#place_order\", function () {\n\t// jQuery('#place_order').one('click', function () {\n\n\tif (false === wpm.emailSelected) {\n\t\twpm.fireCheckoutProgress(2)\n\t}\n\n\tif (false === wpm.paymentMethodSelected) {\n\t\twpm.fireCheckoutProgress(3)\n\t\twpm.fireCheckoutOption(3, jQuery(\"input[name='payment_method']:checked\").val())\n\t}\n\n\twpm.fireCheckoutProgress(4)\n})\n\n// update cart event\n// body.on('click', \"[name='update_cart']\", function (e) {\njQuery(document).on(\"click\", \"[name='update_cart']\", function (e) {\n\t// jQuery(\"[name='update_cart']\").on('click', function (e) {\n\n\ttry {\n\t\tjQuery(\".cart_item\").each(function () {\n\n\t\t\t// let productId = jQuery(this).find('[data-product_id]').data('product_id');\n\n\t\t\tlet url = new URL(jQuery(this).find(\".product-remove\").find(\"a\").attr(\"href\"))\n\t\t\tlet productId = wpm.getProductIdByCartItemKeyUrl(url)\n\n\t\t\t// console.log(productId)\n\n\t\t\tlet quantity = jQuery(this).find(\".qty\").val()\n\n\t\t\tif (quantity === 0) {\n\t\t\t\twpm.removeProductFromCart(productId)\n\t\t\t} else if (quantity < wpmDataLayer.cart[productId].quantity) {\n\t\t\t\twpm.removeProductFromCart(productId, wpmDataLayer.cart[productId].quantity - quantity)\n\t\t\t} else if (quantity > wpmDataLayer.cart[productId].quantity) {\n\t\t\t\twpm.addProductToCart(productId, quantity - wpmDataLayer.cart[productId].quantity)\n\t\t\t}\n\t\t})\n\t} catch (e) {\n\t\tconsole.error(e)\n\t\twpm.getCartItemsFromBackend()\n\t}\n})\n\n\n// add_to_wishlist\n// body.on('click', '.add_to_wishlist, .wl-add-to', function () {\njQuery(document).on(\"click\", \".add_to_wishlist, .wl-add-to\", function () {\n\t// jQuery('.add_to_wishlist, .wl-add-to').on('click', function () {\n\n\ttry {\n\t\t// console.log('add_to_wishlist');\n\t\t// console.log('this:' + jQuery(this).data('product-id'));\n\n\t\tlet productId\n\n\t\tif (jQuery(this).data(\"productid\")) { // for the WooCommerce wishlist plugin\n\t\t\tproductId = jQuery(this).data(\"productid\")\n\t\t} else if (jQuery(this).data(\"product-id\")) { // for the YITH wishlist plugin\n\t\t\tproductId = jQuery(this).data(\"product-id\")\n\t\t}\n\n\t\tif (!productId) throw Error(\"Wasn't able to retrieve a productId\")\n\n\t\tlet product = wpm.getProductDetailsFormattedForEvent(productId)\n\n\t\t// console.log('add_to_wishlist');\n\t\t// console.log(product);\n\n\t\tjQuery(document).trigger(\"wpmAddToWishlist\", product)\n\t} catch (e) {\n\t\tconsole.error(e)\n\t}\n})\n\n// body.on('updated_cart_totals', function () {\njQuery(document).on(\"updated_cart_totals\", function () {\n\tjQuery(document).trigger(\"wpmViewCart\")\n})\n\n\n// populate the wpmDataLayer with the cart items\njQuery(window).on(\"wpmLoad\", function () {\n\t// console.log('getting cart');\n\n\ttry {\n\t\t// console.log('wpmMiniCartActive: ' + JSON.parse(sessionStorage.getItem('wpmMiniCartActive')));\n\t\t// if ( wpmDataLayer.shop.page_type === 'cart' || wpmDataLayer.shop.mini_cart.track === true) {\n\n\t\tif (\n\t\t\tJSON.parse(sessionStorage.getItem(\"wpmMiniCartActive\")) && // if we detected calls to get_refreshed_fragments\n\t\t\tJSON.parse(sessionStorage.getItem(\"wpmFirstPageLoad\")) && // when a new session is initiated there are no items in the cart, so we can save that call\n\t\t\twpmDataLayer.shop.mini_cart.track === true // if shop owner generally allows the plugin to track the mini cart\n\t\t) {\n\t\t\t// console.log('getting cart');\n\t\t\twpm.getCartItems()\n\n\t\t} else {\n\t\t\tsessionStorage.setItem(\"wpmFirstPageLoad\", JSON.stringify(true))\n\t\t}\n\t} catch (e) {\n\t\tconsole.error(e)\n\t}\n})\n\n// get all add-to-cart= products from backend\njQuery(window).on(\"wpmLoad\", function () {\n\n\twpmDataLayer.products = wpmDataLayer.products || {}\n\t// wpmDataLayer.products = {14: 'x', 31: 'x', 16: 'x', 22: 'x', 40: 'x'};\n\n\t// scan page for add-to-cart= links\n\tlet productIds = wpm.getAddToCartLinkProductIds()\n\n\twpm.getProductsFromBackend(productIds)\n})\n\n/**\n * Save the referrer into a cookie\n */\n\njQuery(window).on(\"wpmLoad\", function () {\n\n\t// can't use session storage as we can't read it from the server\n\tif (!wpm.getCookie(\"wpmReferrer\")) {\n\n\t\tif (document.referrer) {\n\t\t\tlet referrerUrl = new URL(document.referrer)\n\t\t\tlet referrerHostname = referrerUrl.hostname\n\n\t\t\tif (referrerHostname !== window.location.host) {\n\t\t\t\twpm.setCookie(\"wpmReferrer\", referrerHostname)\n\t\t\t} else {\n\t\t\t\twpm.setCookie(\"wpmReferrer\", \"\")\n\t\t\t}\n\n\t\t} else {\n\t\t\twpm.setCookie(\"wpmReferrer\", \"\")\n\t\t}\n\t}\n})\n\n\n/**\n * Create our own load event in order to better handle script flow execution when JS \"optimizers\" shuffle the code.\n */\n\njQuery(window).on(\"wpmLoad\", function () {\n\ttry {\n\t\tif (typeof wpmDataLayer != \"undefined\" && !wpmDataLayer?.wpmLoadFired) {\n\n\t\t\tjQuery(document).trigger(\"wpmLoadAlways\")\n\n\t\t\tif (\"product\" === wpmDataLayer.shop.page_type && wpmDataLayer.shop.product_type !== \"variable\" && wpm.getMainProductIdFromProductPage()) {\n\n\t\t\t\tlet product = wpm.getProductDataForViewItemEvent(wpm.getMainProductIdFromProductPage())\n\t\t\t\tjQuery(document).trigger(\"wpmViewItem\", product)\n\n\t\t\t} else if (\"product_category\" === wpmDataLayer.shop.page_type) {\n\n\t\t\t\tjQuery(document).trigger(\"wpmCategory\")\n\n\t\t\t} else if (\"search\" === wpmDataLayer.shop.page_type) {\n\n\t\t\t\tjQuery(document).trigger(\"wpmSearch\")\n\n\t\t\t} else if (\"cart\" === wpmDataLayer.shop.page_type) {\n\n\t\t\t\tjQuery(document).trigger(\"wpmViewCart\")\n\n\t\t\t} else if (\"order_received_page\" === wpmDataLayer.shop.page_type && wpmDataLayer.order) {\n\n\t\t\t\tif (!wpm.isOrderIdStored(wpmDataLayer.order.id)) {\n\n\t\t\t\t\tjQuery(document).trigger(\"wpmOrderReceivedPage\")\n\t\t\t\t\twpm.writeOrderIdToStorage(wpmDataLayer.order.id)\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tjQuery(document).trigger(\"wpmEverywhereElse\")\n\t\t\t}\n\n\t\t\tif (wpmDataLayer.user.id && !wpm.hasLoginEventFired()) {\n\t\t\t\tjQuery(document).trigger(\"wpmLogin\")\n\t\t\t\twpm.setLoginEventFired()\n\t\t\t}\n\n\t\t\t/**\n\t\t\t * Load mini cart fragments into a wpm session storage key,\n\t\t\t * after the document load event.\n\t\t\t */\n\t\t\tjQuery(document).ajaxSend(function (event, jqxhr, settings) {\n\t\t\t\t// console.log('settings.url: ' + settings.url);\n\n\t\t\t\tif (settings.url.includes(\"get_refreshed_fragments\") && sessionStorage) {\n\t\t\t\t\tif (!sessionStorage.getItem(\"wpmMiniCartActive\")) {\n\t\t\t\t\t\tsessionStorage.setItem(\"wpmMiniCartActive\", JSON.stringify(true))\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t})\n\n\t\t\twpmDataLayer.wpmLoadFired = true\n\t\t}\n\n\t} catch (e) {\n\t\tconsole.error(e)\n\t}\n})\n\n// jQuery(window).on(\"load\", function () {\n// \tjQuery(document).trigger(\"wpmLoad\", {})\n// })\n\njQuery(window).on(\"wpmPreLoadPixels\", function () {\n\n\tif (wpmDataLayer?.shop?.cookie_consent_mgmt?.explicit_consent) {\n\t\twpm.updateConsentCookieValues(true)\n\t}\n\tjQuery(document).trigger(\"wpmLoadPixels\", {})\n})\n\n\n/**\n * Events that only work after document ready state,\n * such as jQuery(\".single_variation_wrap\").on(\"show_variation\", function(){})\n */\n\njQuery(function () {\n\n\t/**\n\t * Fired when the user selects all the required dropdowns / attributes\n\t * Can only be hooked into after document ready\n\t * https://stackoverflow.com/a/27849208/4688612\n\t * https://stackoverflow.com/a/65065335/4688612\n\t */\n\tjQuery(\".single_variation_wrap\").on(\"show_variation\", function (event, variation) {\n\n\t\ttry {\n\t\t\tlet productId = getIdBasedOndVariationsOutputSetting(variation.variation_id)\n\n\t\t\tif (!productId) throw Error(\"Wasn't able to retrieve a productId\")\n\n\t\t\tif (wpmDataLayer.products && wpmDataLayer.products[productId]) {\n\n\t\t\t\t// console.log('productId: ' + productId);\n\n\t\t\t\tlet product = wpm.getProductDetailsFormattedForEvent(productId)\n\n\t\t\t\tjQuery(document).trigger(\"wpmViewItem\", product)\n\t\t\t}\n\t\t} catch (e) {\n\t\t\tconsole.error(e)\n\t\t}\n\t})\n\n\n})\n","(function (wpm, $, undefined) {\n\n\t// do something\n\n}(window.wpm = window.wpm || {}, jQuery))\n","// The module cache\nvar __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tvar cachedModule = __webpack_module_cache__[moduleId];\n\tif (cachedModule !== undefined) {\n\t\treturn cachedModule.exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\t// no module.id needed\n\t\t// no module.loaded needed\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId](module, module.exports, __webpack_require__);\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n","// TODO Try using the webpack ignore plugin to remove premium imports during compilation\n// https://webpack.js.org/plugins/ignore-plugin/\n// https://stackoverflow.com/questions/65004054/webpack-ignoreplugin-on-multiple-modules\n// https://stackoverflow.com/questions/61822069/conditional-import-import-if-exists\n// https://stackoverflow.com/questions/36367532/how-can-i-conditionally-import-an-es6-module\n\n\n// console.log(ENV)\n// if (ENV.tier === 'pro') {\n// console.log('tier')\n// }\n\n/**\n * Load all essential scripts first\n */\n\nrequire(\"./wpm\")\nrequire(\"./wpm__premium_only\")\nrequire(\"./google__premium_only\")\n\n/**\n * Load all free scripts\n */\n\nrequire(\"./google\")\nrequire(\"./google-ga-ua\")\nrequire(\"./google-ga-4\")\nrequire(\"./google-ads\")\nrequire(\"./facebook\")\nrequire(\"./hotjar\")\nrequire(\"./google-optimize\")\n\n/**\n * Load all premium scripts\n */\n\nrequire(\"./google-ga-ua-eec__premium_only\")\nrequire(\"./google-ga-4-eec__premium_only\")\nrequire(\"./tiktok__premium_only\")\nrequire(\"./snapchat__premium_only\")\nrequire(\"./pinterest__premium_only\")\nrequire(\"./facebook__premium_only\")\nrequire(\"./microsoft-ads__premium_only.js\")\nrequire(\"./twitter__premium_only.js\")\nrequire(\"./google-ads__premium_only.js\")\n\n\n/**\n * Execute the wpm loader. It makes sure that the script flow gets exectuded correctly, no matter how JS \"optimizers\" shuffle the code.\n */\n\nrequire(\"./wpm-loader\")\n\n\n// console.log('WooCommerce Pixel Manager premium version')\n\n\n"],"names":["wpm","$","undefined","fBUserData","loadFacebookPixel","wpmDataLayer","pixels","facebook","pixel_id","loaded","f","window","b","document","e","fbq","n","callMethod","apply","arguments","queue","push","_fbq","version","t","createElement","async","src","s","getElementsByTagName","parentNode","insertBefore","console","error","getRandomEventId","Math","random","toString","substring","getFbUserData","getFbUserDataFromBrowser","setFbUserData","fbp","getCookie","fbc","client_user_agent","navigator","userAgent","fbViewContent","product","eventId","content_type","content_name","name","content_ids","dyn_r_ids","dynamic_remarketing","id_type","currency","shop","value","price","eventID","jQuery","trigger","event_name","event_id","user_data","product_data","product_id","event_source_url","location","href","facebookContentIds","prodIds","key","item","Object","entries","order","items","general","variationsOutput","variation_id","String","products","id","on","canIFire","event","parseFloat","quantity","value_filtered","setFacebookIdentifiersOnServer","data","action","nonce","sessionStorage","getItem","ajax","type","dataType","url","ajax_url","success","response","setItem","JSON","stringify","content_category","category","eventData","capi","msg","indexOf","page_type","conversionIdentifiers","getGoogleAdsConversionIdentifiersWithLabel","google","ads","conversionIds","getGoogleAdsConversionIdentifiers","getGoogleAdsRegularOrderItems","orderItems","orderItem","getGoogleAdsDynamicRemarketingOrderItems","google_business_vertical","isEmptyObject","status","googleConfigConditionsMet","isVariable","send_events_with_parent_ids","gtagLoaded","then","gtag","send_to","data_basic","data_with_cart","transaction_id","number","new_customer","aw_merchant_id","discount","aw_feed_country","aw_feed_language","getCartItemsGa4","productId","cart","productItems","item_id","analytics","item_name","item_brand","brand","item_variant","variant","getFormattedGA4Categories","eec","ga4","measurement_id","index","list_position","item_list_name","list_name","item_list_id","list_id","cartValue","toFixed","position","search_term","getSearchTermFromUrl","getGA4OrderItems","item_category","join","variant_name","mp_active","affiliation","value_regular","tax","shipping","coupon","getCartItemsGaUa","universal","property_id","checkout_step","step","checkout_option","getGAUAOrderItems","load_google_optimize_pixel","optimize","container_id","loadScriptAndCacheIt","consent_mode","active","getConsentValues","mode","categories","includes","getVisitorConsentStatusAndUpdateGoogleConsentSettings","google_consent_settings","analytics_storage","ad_storage","updateGoogleConsentMode","cookie_consent_mgmt","explicit_consent","fireGtagGoogleAds","state","enhanced_conversions","phone_conversion_label","phone_conversion_number","keys","enhanced_conversion_data","fireGtagGoogleAnalyticsUA","parameters","fireGtagGoogleAnalyticsGA4","isGoogleActive","getGoogleGtagId","loadGoogle","done","script","textStatus","dataLayer","wait_for_update","region","ads_data_redaction","url_passthrough","linker","settings","Date","canGoogleLoad","Promise","resolve","reject","startTime","wait","setTimeout","Array","from","Set","isArray","length","max","i","setGoogleCidOnServer","targetIDs","clientID","target_ids","client_id","referrer","getReferrerFromCookie","gclid","getClidFromBrowser","getUserAgent","viewPortWidth","getViewPort","width","viewPortHeight","height","forEach","targetId","setCookie","parse","load_hotjar_pixel","hotjar","site_id","h","o","j","a","r","hj","q","_hjSettings","hjid","hjsv","appendChild","load_bing_pixel","bing","uet_tag_id","uetq","w","d","u","ti","UET","onload","onreadystatechange","this","readyState","bing_purchase_ecomm_prodids","bing_purchase_items","ecomm_pagetype","ecomm_prodid","revenue_value","getPinterestProductData","isVariation","product_name","product_variant_id","pinterest","parentId_dyn_r_ids","product_category","product_variant","product_price","product_quantity","product_brand","pinterestFormattedOrderItems","loadPinterestPixel","pintrk","prototype","slice","call","pinterestLoadEvent","userLoggedIn","enhanced_match","em","enhanced_match_email","line_items","productData","urlParams","URLSearchParams","search","search_query","get","order_quantity","order_id","snapchatGetEmail","userInfo","user","email_sha256","user_hashed_email","loadSnapchatPixel","snapchat","snaptr","handleRequest","getSnapchatOrderItemIds","contentIds","item_ids","loadTikTokPixel","tiktok","TiktokAnalyticsObject","ttq","methods","setAndDefer","concat","instance","_i","load","_u","_t","_o","page","track","getTikTokOrderItemIds","content_id","purchase_event_name","contents","loadTwitterPixel","twitter","twq","exe","twitterGetOrderContentIds","num_items","wpmDataLayerExists","pageLoaded","wpmDeduper","wpmRestSettings","checkCookie","emailSelected","paymentMethodSelected","useRestEndpoint","isSessionStorageAvailable","isRestEndpointAvailable","isBelowRestErrorThreshold","testEndpoint","protocol","host","cookieName","timeout","statusCode","isWpmRestEndpointAvailable","writeOrderIdToStorage","orderId","Storage","localStorage","ids","expiresDate","setDate","getDate","cookie","toUTCString","storeOrderIdOnServer","orderDeduplication","isOrderIdStored","log","isEmail","email","test","removeProductFromCart","quantityToRemove","Error","getIdBasedOndVariationsOutputSetting","getProductDetailsFormattedForEvent","parentId","addProductToCart","getCartItemsFromBackend","getCartItems","saveCartObjectToDataLayer","cartItems","getProductsFromBackend","productIds","filter","hasOwnProperty","assign","cartObject","fireCheckoutOption","fireCheckoutProgress","getPostIdFromString","string","match","triggerViewItemList","getProductDataForViewItemEvent","getMainProductIdFromProductPage","product_type","viewItemListTriggerTestMode","target","css","append","find","viewItemListTrigger","opacity","backgroundColor","io","ioTimeouts","observerCallback","observer","entry","elementId","next","isIntersecting","testMode","repeat","unobserve","clearTimeout","remove","allIoElementsToWatch","ioid","startIntersectionObserverToWatch","has","IntersectionObserver","threshold","map","elem","parent","hasClass","prev","closest","each","observe","startProductsMutationObserverToWatch","productsNode","parents","first","productsMutationObserver","attributes","childList","characterData","MutationObserver","mutations","mutation","newNodes","addedNodes","hasWpmProductIdElement","siblings","cookieValue","expiryDays","setTime","getTime","expires","ca","decodeURIComponent","split","c","charAt","getWpmSessionData","setWpmSessionData","getProductIdByCartItemKeyUrl","cartItemKey","cartItemKeys","getAddToCartLinkProductIds","attr","matches","setReferrerToCookie","clidCookieId","clidId","dclid","documentElement","clientWidth","innerWidth","clientHeight","innerHeight","getComplianzCookies","cmplz_statistics","cmplz_marketing","visitorHasChosen","getCookieLawInfoCookies","analyticsCookie","adsCookie","wpmConsentValues","setConsentValueCategories","updateConsentCookieValues","explicitConsent","decodeURI","consents","statistics","marketing","thirdparty","advanced","setConsentDefaultValuesToExplicit","pixelName","scriptTagObserver","node","shouldScriptBeActive","unblockScript","blockScript","head","subtree","addEventListener","disconnect","some","element","scriptNode","removeAttach","wpmSrc","appendTo","removeAttr","unblockAllScripts","unblockSelectedPixels","Cookiebot","consent","detail","huObserver","hu","body","options","extend","cache","getOrderItemPrice","total","total_tax","hasLoginEventFired","loginEventFired","setLoginEventFired","waitForVar","URL","Number","val","classes","one","nextAll","mini_cart","referrerHostname","hostname","wpmLoadFired","ajaxSend","jqxhr","variation","__webpack_module_cache__","__webpack_require__","moduleId","cachedModule","exports","module","__webpack_modules__","require"],"sourceRoot":""}
|
js/public/wpm.js
ADDED
@@ -0,0 +1,1905 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/**
|
2 |
+
* Create a wpm namespace under which all functions are declared
|
3 |
+
*/
|
4 |
+
|
5 |
+
// https://stackoverflow.com/a/5947280/4688612
|
6 |
+
(function (wpm, $, undefined) {
|
7 |
+
|
8 |
+
const wpmDeduper = {
|
9 |
+
keyName : "_wpm_order_ids",
|
10 |
+
cookieExpiresDays: 365,
|
11 |
+
}
|
12 |
+
|
13 |
+
const wpmRestSettings = {
|
14 |
+
// cookiesAvailable : '_wpm_cookies_are_available',
|
15 |
+
cookieWpmRestEndpointAvailable: "_wpm_endpoint_available",
|
16 |
+
restEndpoint : "/wp-json/",
|
17 |
+
restFails : 0,
|
18 |
+
restFailsThreshold : 10,
|
19 |
+
}
|
20 |
+
|
21 |
+
wpm.emailSelected = false
|
22 |
+
wpm.paymentMethodSelected = false
|
23 |
+
|
24 |
+
// wpm.checkIfCookiesAvailable = function () {
|
25 |
+
//
|
26 |
+
// // read the cookie if previously set, if it is return true, otherwise continue
|
27 |
+
// if (wpm.getCookie(wpmRestSettings.cookiesAvailable)) {
|
28 |
+
// return true;
|
29 |
+
// }
|
30 |
+
//
|
31 |
+
// // set the cookie for the session
|
32 |
+
// Cookies.set(wpmRestSettings.cookiesAvailable, true);
|
33 |
+
//
|
34 |
+
// // read cookie, true if ok, false if not ok
|
35 |
+
// return !!wpm.getCookie(wpmRestSettings.cookiesAvailable);
|
36 |
+
// }
|
37 |
+
|
38 |
+
wpm.useRestEndpoint = function () {
|
39 |
+
|
40 |
+
// only if sessionStorage is available
|
41 |
+
|
42 |
+
// only if REST API endpoint is generally accessible
|
43 |
+
// check in sessionStorage if we checked before and return answer
|
44 |
+
// otherwise check if the endpoint is available, save answer in sessionStorage and return answer
|
45 |
+
|
46 |
+
// only if not too many REST API errors happened
|
47 |
+
|
48 |
+
return wpm.isSessionStorageAvailable() &&
|
49 |
+
wpm.isRestEndpointAvailable() &&
|
50 |
+
wpm.isBelowRestErrorThreshold()
|
51 |
+
}
|
52 |
+
|
53 |
+
wpm.isBelowRestErrorThreshold = function () {
|
54 |
+
return window.sessionStorage.getItem(wpmRestSettings.restFails) <= wpmRestSettings.restFailsThreshold
|
55 |
+
}
|
56 |
+
|
57 |
+
wpm.isRestEndpointAvailable = function () {
|
58 |
+
|
59 |
+
if (window.sessionStorage.getItem(wpmRestSettings.cookieWpmRestEndpointAvailable)) {
|
60 |
+
return JSON.parse(window.sessionStorage.getItem(wpmRestSettings.cookieWpmRestEndpointAvailable))
|
61 |
+
} else {
|
62 |
+
// return wpm.testEndpoint();
|
63 |
+
// just set the value whenever possible in order not to wait or block the main thread
|
64 |
+
wpm.testEndpoint()
|
65 |
+
}
|
66 |
+
}
|
67 |
+
|
68 |
+
wpm.isSessionStorageAvailable = function () {
|
69 |
+
|
70 |
+
return !!window.sessionStorage
|
71 |
+
}
|
72 |
+
|
73 |
+
wpm.testEndpoint = function (
|
74 |
+
url = location.protocol + "//" + location.host + wpmRestSettings.restEndpoint,
|
75 |
+
cookieName = wpmRestSettings.cookieWpmRestEndpointAvailable,
|
76 |
+
) {
|
77 |
+
// console.log('testing endpoint');
|
78 |
+
|
79 |
+
jQuery.ajax(url, {
|
80 |
+
type : "HEAD",
|
81 |
+
timeout: 1000,
|
82 |
+
// async: false,
|
83 |
+
statusCode: {
|
84 |
+
200: function (response) {
|
85 |
+
// Cookies.set(cookieName, true);
|
86 |
+
// console.log('endpoint works');
|
87 |
+
window.sessionStorage.setItem(cookieName, JSON.stringify(true))
|
88 |
+
},
|
89 |
+
404: function (response) {
|
90 |
+
// Cookies.set(cookieName, false);
|
91 |
+
// console.log('endpoint doesn\'t work');
|
92 |
+
window.sessionStorage.setItem(cookieName, JSON.stringify(false))
|
93 |
+
},
|
94 |
+
0 : function (response) {
|
95 |
+
// Cookies.set(cookieName, false);
|
96 |
+
// console.log('endpoint doesn\'t work');
|
97 |
+
window.sessionStorage.setItem(cookieName, JSON.stringify(false))
|
98 |
+
},
|
99 |
+
},
|
100 |
+
}).then(r => {
|
101 |
+
// console.log('test done')
|
102 |
+
// console.log('result: ' + JSON.parse(window.sessionStorage.getItem(cookieName)));
|
103 |
+
// return JSON.parse(window.sessionStorage.getItem(cookieName));
|
104 |
+
})
|
105 |
+
}
|
106 |
+
|
107 |
+
wpm.isWpmRestEndpointAvailable = function (cookieName = wpmRestSettings.cookieWpmRestEndpointAvailable) {
|
108 |
+
|
109 |
+
return !!wpm.getCookie(cookieName)
|
110 |
+
}
|
111 |
+
|
112 |
+
wpm.writeOrderIdToStorage = function (orderId, expireDays = 365) {
|
113 |
+
|
114 |
+
// save the order ID in the browser storage
|
115 |
+
|
116 |
+
if (!window.Storage) {
|
117 |
+
let expiresDate = new Date()
|
118 |
+
expiresDate.setDate(expiresDate.getDate() + wpmDeduper.cookieExpiresDays)
|
119 |
+
|
120 |
+
let ids = []
|
121 |
+
if (checkCookie()) {
|
122 |
+
ids = JSON.parse(wpm.getCookie(wpmDeduper.keyName))
|
123 |
+
}
|
124 |
+
|
125 |
+
if (!ids.includes(orderId)) {
|
126 |
+
ids.push(orderId)
|
127 |
+
document.cookie = wpmDeduper.keyName + "=" + JSON.stringify(ids) + ";expires=" + expiresDate.toUTCString()
|
128 |
+
}
|
129 |
+
|
130 |
+
} else {
|
131 |
+
if (localStorage.getItem(wpmDeduper.keyName) === null) {
|
132 |
+
let ids = []
|
133 |
+
ids.push(orderId)
|
134 |
+
window.localStorage.setItem(wpmDeduper.keyName, JSON.stringify(ids))
|
135 |
+
|
136 |
+
} else {
|
137 |
+
let ids = JSON.parse(localStorage.getItem(wpmDeduper.keyName))
|
138 |
+
if (!ids.includes(orderId)) {
|
139 |
+
ids.push(orderId)
|
140 |
+
window.localStorage.setItem(wpmDeduper.keyName, JSON.stringify(ids))
|
141 |
+
}
|
142 |
+
}
|
143 |
+
}
|
144 |
+
|
145 |
+
if (typeof wpm.storeOrderIdOnServer === "function" && wpmDataLayer.orderDeduplication) {
|
146 |
+
wpm.storeOrderIdOnServer(orderId)
|
147 |
+
}
|
148 |
+
}
|
149 |
+
|
150 |
+
function checkCookie() {
|
151 |
+
let key = wpm.getCookie(wpmDeduper.keyName)
|
152 |
+
return key !== ""
|
153 |
+
}
|
154 |
+
|
155 |
+
wpm.isOrderIdStored = function (orderId) {
|
156 |
+
|
157 |
+
// console.log('deduper: ' + wpmDataLayer.orderDeduplication);
|
158 |
+
if (wpmDataLayer.orderDeduplication) {
|
159 |
+
// console.log('order deduplication: on');
|
160 |
+
if (!window.Storage) {
|
161 |
+
|
162 |
+
if (checkCookie()) {
|
163 |
+
let ids = JSON.parse(wpm.getCookie(wpmDeduper.keyName))
|
164 |
+
return ids.includes(orderId)
|
165 |
+
} else {
|
166 |
+
return false
|
167 |
+
}
|
168 |
+
} else {
|
169 |
+
if (localStorage.getItem(wpmDeduper.keyName) !== null) {
|
170 |
+
let ids = JSON.parse(localStorage.getItem(wpmDeduper.keyName))
|
171 |
+
return ids.includes(orderId)
|
172 |
+
} else {
|
173 |
+
return false
|
174 |
+
}
|
175 |
+
}
|
176 |
+
} else {
|
177 |
+
console.log("order duplication prevention: off")
|
178 |
+
return false
|
179 |
+
}
|
180 |
+
}
|
181 |
+
|
182 |
+
wpm.isEmail = function (email) {
|
183 |
+
// https://emailregex.com/
|
184 |
+
let regex = /^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/
|
185 |
+
return regex.test(email)
|
186 |
+
}
|
187 |
+
|
188 |
+
wpm.removeProductFromCart = function (productId, quantityToRemove = null) {
|
189 |
+
// console.log('product_id: ' + productId + ' | quantityToRemove: ' + quantityToRemove);
|
190 |
+
|
191 |
+
try {
|
192 |
+
|
193 |
+
if (!productId) throw Error("Wasn't able to retrieve a productId")
|
194 |
+
|
195 |
+
productId = getIdBasedOndVariationsOutputSetting(productId)
|
196 |
+
|
197 |
+
if (!productId) throw Error("Wasn't able to retrieve a productId")
|
198 |
+
|
199 |
+
let quantity
|
200 |
+
|
201 |
+
if (quantityToRemove == null) {
|
202 |
+
quantity = wpmDataLayer.cart[productId].quantity
|
203 |
+
} else {
|
204 |
+
quantity = quantityToRemove
|
205 |
+
}
|
206 |
+
|
207 |
+
// console.log('product_id: ' + productId + ' | qty: ' + quantity);
|
208 |
+
// console.log(productId);
|
209 |
+
// console.log(wpmDataLayer.cart);
|
210 |
+
// console.log(wpmDataLayer.cart[productId]);
|
211 |
+
|
212 |
+
if (wpmDataLayer.cart[productId]) {
|
213 |
+
|
214 |
+
// let product = {
|
215 |
+
// id : productId.toString(),
|
216 |
+
// dyn_r_ids: wpmDataLayer.cart[productId].dyn_r_ids,
|
217 |
+
// name : wpmDataLayer.cart[productId].name,
|
218 |
+
// // list_name: wpmDataLayer.shop.list_name, // doesn't make sense on mini_cart
|
219 |
+
// brand : wpmDataLayer.cart[productId].brand,
|
220 |
+
// category: wpmDataLayer.cart[productId].category,
|
221 |
+
// variant : wpmDataLayer.cart[productId].variant,
|
222 |
+
// // list_position: wpmDataLayer.cart[productId].position, // doesn't make sense on mini_cart
|
223 |
+
// quantity : quantity,
|
224 |
+
// price : wpmDataLayer.cart[productId].price,
|
225 |
+
// isVariation: wpmDataLayer.products[productId].isVariation,
|
226 |
+
// };
|
227 |
+
//
|
228 |
+
// if (product.isVariation) product['parentId_dyn_r_ids'] = wpmDataLayer.products[productId].parentId_dyn_r_ids;
|
229 |
+
|
230 |
+
let product = wpm.getProductDetailsFormattedForEvent(productId, quantity)
|
231 |
+
|
232 |
+
// console.log('removing');
|
233 |
+
// console.log(data);
|
234 |
+
|
235 |
+
jQuery(document).trigger("wpmRemoveFromCart", product)
|
236 |
+
|
237 |
+
if (quantityToRemove == null || wpmDataLayer.cart[productId].quantity === quantityToRemove) {
|
238 |
+
delete wpmDataLayer.cart[productId]
|
239 |
+
if (sessionStorage) sessionStorage.setItem("wpmDataLayerCart", JSON.stringify(wpmDataLayer.cart))
|
240 |
+
} else {
|
241 |
+
wpmDataLayer.cart[productId].quantity = wpmDataLayer.cart[productId].quantity - quantity
|
242 |
+
if (sessionStorage) sessionStorage.setItem("wpmDataLayerCart", JSON.stringify(wpmDataLayer.cart))
|
243 |
+
}
|
244 |
+
}
|
245 |
+
} catch (e) {
|
246 |
+
console.error(e)
|
247 |
+
// console.log('getting cart from back end');
|
248 |
+
// wpm.getCartItemsFromBackend();
|
249 |
+
// console.log('getting cart from back end done');
|
250 |
+
|
251 |
+
}
|
252 |
+
}
|
253 |
+
|
254 |
+
getIdBasedOndVariationsOutputSetting = function (productId) {
|
255 |
+
|
256 |
+
try {
|
257 |
+
if (wpmDataLayer?.general?.variationsOutput) {
|
258 |
+
// console.log('test');
|
259 |
+
return productId
|
260 |
+
} else {
|
261 |
+
if (wpmDataLayer.products[productId].isVariation) {
|
262 |
+
return wpmDataLayer.products[productId].parentId
|
263 |
+
} else {
|
264 |
+
return productId
|
265 |
+
}
|
266 |
+
}
|
267 |
+
} catch (e) {
|
268 |
+
console.error(e)
|
269 |
+
}
|
270 |
+
}
|
271 |
+
|
272 |
+
// add_to_cart
|
273 |
+
wpm.addProductToCart = function (productId, quantity) {
|
274 |
+
|
275 |
+
try {
|
276 |
+
// console.log('productId: ' + productId + ' | qty: ' + quantity);
|
277 |
+
// console.log('productId: ' + productId + ' | variationId: ' + variationId + ' | qty: ' + quantity);
|
278 |
+
|
279 |
+
if (!productId) throw Error("Wasn't able to retrieve a productId")
|
280 |
+
|
281 |
+
productId = getIdBasedOndVariationsOutputSetting(productId)
|
282 |
+
|
283 |
+
if (!productId) throw Error("Wasn't able to retrieve a productId")
|
284 |
+
|
285 |
+
if (wpmDataLayer.products[productId]) {
|
286 |
+
|
287 |
+
let product = wpm.getProductDetailsFormattedForEvent(productId, quantity)
|
288 |
+
|
289 |
+
// console.log(productId);
|
290 |
+
|
291 |
+
jQuery(document).trigger("wpmAddToCart", product)
|
292 |
+
|
293 |
+
// add product to cart wpmDataLayer['cart']
|
294 |
+
|
295 |
+
// if the product already exists in the object, only add the additional quantity
|
296 |
+
// otherwise create that product object in the wpmDataLayer['cart']
|
297 |
+
if (wpmDataLayer.cart !== undefined && wpmDataLayer.cart[productId] !== undefined) {
|
298 |
+
wpmDataLayer.cart[productId].quantity = wpmDataLayer.cart[productId].quantity + quantity
|
299 |
+
if (sessionStorage) sessionStorage.setItem("wpmDataLayerCart", JSON.stringify(wpmDataLayer.cart))
|
300 |
+
} else {
|
301 |
+
|
302 |
+
if (!wpmDataLayer.cart) {
|
303 |
+
|
304 |
+
// wpmDataLayer['cart'] = {
|
305 |
+
// [productId]: {
|
306 |
+
// id : productId,
|
307 |
+
// dyn_r_ids : wpmDataLayer.products[productId].dyn_r_ids,
|
308 |
+
// name : wpmDataLayer.products[productId].name,
|
309 |
+
// brand : wpmDataLayer.products[productId].brand,
|
310 |
+
// category : wpmDataLayer.products[productId].category,
|
311 |
+
// variant : wpmDataLayer.products[productId].variant,
|
312 |
+
// quantity : quantity,
|
313 |
+
// price : wpmDataLayer.products[productId].price,
|
314 |
+
// isVariation: wpmDataLayer.products[productId].isVariation,
|
315 |
+
// parentId : wpmDataLayer.products[productId].parentId,
|
316 |
+
// }
|
317 |
+
// };
|
318 |
+
//
|
319 |
+
// if (wpmDataLayer['cart'][productId].isVariation) wpmDataLayer['cart'][productId]['parentId_dyn_r_ids'] = wpmDataLayer.products[productId].parentId_dyn_r_ids;
|
320 |
+
|
321 |
+
wpmDataLayer["cart"] = {
|
322 |
+
[productId]: wpm.getProductDetailsFormattedForEvent(productId, quantity),
|
323 |
+
}
|
324 |
+
|
325 |
+
if (sessionStorage) sessionStorage.setItem("wpmDataLayerCart", JSON.stringify(wpmDataLayer.cart))
|
326 |
+
} else {
|
327 |
+
|
328 |
+
// wpmDataLayer.cart[productId] = {
|
329 |
+
// id : productId,
|
330 |
+
// dyn_r_ids : wpmDataLayer.products[productId].dyn_r_ids,
|
331 |
+
// name : wpmDataLayer.products[productId].name,
|
332 |
+
// brand : wpmDataLayer.products[productId].brand,
|
333 |
+
// category : wpmDataLayer.products[productId].category,
|
334 |
+
// variant : wpmDataLayer.products[productId].variant,
|
335 |
+
// quantity : quantity,
|
336 |
+
// price : wpmDataLayer.products[productId].price,
|
337 |
+
// isVariation: wpmDataLayer.products[productId].isVariation,
|
338 |
+
// parentId : wpmDataLayer.products[productId].parentId,
|
339 |
+
// };
|
340 |
+
//
|
341 |
+
// if (wpmDataLayer.cart[productId].isVariation) wpmDataLayer.cart[productId]['parentId_dyn_r_ids'] = wpmDataLayer.products[productId].parentId_dyn_r_ids;
|
342 |
+
|
343 |
+
wpmDataLayer.cart[productId] = wpm.getProductDetailsFormattedForEvent(productId, quantity)
|
344 |
+
|
345 |
+
if (sessionStorage) sessionStorage.setItem("wpmDataLayerCart", JSON.stringify(wpmDataLayer.cart))
|
346 |
+
}
|
347 |
+
}
|
348 |
+
}
|
349 |
+
} catch (e) {
|
350 |
+
console.error(e)
|
351 |
+
|
352 |
+
// fallback if wpmDataLayer.cart and wpmDataLayer.products got out of sync in case cart caching has an issue
|
353 |
+
wpm.getCartItemsFromBackend()
|
354 |
+
}
|
355 |
+
}
|
356 |
+
|
357 |
+
wpm.getCartItems = function () {
|
358 |
+
|
359 |
+
// console.log('get cart items');
|
360 |
+
|
361 |
+
if (sessionStorage) {
|
362 |
+
if (!sessionStorage.getItem("wpmDataLayerCart") || wpmDataLayer.shop.page_type === "order_received_page") {
|
363 |
+
sessionStorage.setItem("wpmDataLayerCart", JSON.stringify({}))
|
364 |
+
} else {
|
365 |
+
wpm.saveCartObjectToDataLayer(JSON.parse(sessionStorage.getItem("wpmDataLayerCart")))
|
366 |
+
}
|
367 |
+
} else {
|
368 |
+
wpm.getCartItemsFromBackend()
|
369 |
+
}
|
370 |
+
}
|
371 |
+
|
372 |
+
wpm.getCartItemsFromBackend = function () {
|
373 |
+
// get all cart items from the backend
|
374 |
+
try {
|
375 |
+
let data = {
|
376 |
+
action: "wpm_get_cart_items",
|
377 |
+
}
|
378 |
+
|
379 |
+
jQuery.ajax(
|
380 |
+
{
|
381 |
+
type : "get",
|
382 |
+
dataType: "json",
|
383 |
+
// url : ajax_object.ajax_url,
|
384 |
+
url : wpm.ajax_url,
|
385 |
+
data : data,
|
386 |
+
success: function (cartItems) {
|
387 |
+
|
388 |
+
// save all cart items into wpmDataLayer
|
389 |
+
|
390 |
+
if (!cartItems["cart"]) cartItems["cart"] = {}
|
391 |
+
|
392 |
+
wpm.saveCartObjectToDataLayer(cartItems["cart"])
|
393 |
+
if (sessionStorage) sessionStorage.setItem("wpmDataLayerCart", JSON.stringify(cartItems["cart"]))
|
394 |
+
},
|
395 |
+
})
|
396 |
+
} catch (e) {
|
397 |
+
console.error(e)
|
398 |
+
}
|
399 |
+
}
|
400 |
+
|
401 |
+
wpm.getProductsFromBackend = function (productIds) {
|
402 |
+
// console.log('getting pids from back-end: ' + productIds)
|
403 |
+
// get productIds from the backend
|
404 |
+
|
405 |
+
// reduce productIds by products already in the dataLayer
|
406 |
+
productIds = productIds.filter(item => !wpmDataLayer.products.hasOwnProperty(item))
|
407 |
+
|
408 |
+
// if no products IDs are in the object, don't try to get anything from the server
|
409 |
+
if (!productIds || productIds.length === 0) return
|
410 |
+
|
411 |
+
try {
|
412 |
+
let data = {
|
413 |
+
action : "wpm_get_product_ids",
|
414 |
+
productIds: productIds,
|
415 |
+
}
|
416 |
+
|
417 |
+
jQuery.ajax(
|
418 |
+
{
|
419 |
+
type : "get",
|
420 |
+
dataType: "json",
|
421 |
+
// url : ajax_object.ajax_url,
|
422 |
+
url : wpm.ajax_url,
|
423 |
+
data : data,
|
424 |
+
success: function (products) {
|
425 |
+
|
426 |
+
// merge products into wpmDataLayer.products
|
427 |
+
wpmDataLayer.products = Object.assign({}, wpmDataLayer.products, products)
|
428 |
+
},
|
429 |
+
error : function (response) {
|
430 |
+
console.log(response)
|
431 |
+
},
|
432 |
+
})
|
433 |
+
} catch (e) {
|
434 |
+
console.error(e)
|
435 |
+
}
|
436 |
+
}
|
437 |
+
|
438 |
+
wpm.saveCartObjectToDataLayer = function (cartObject) {
|
439 |
+
wpmDataLayer.cart = cartObject
|
440 |
+
wpmDataLayer.products = Object.assign({}, wpmDataLayer.products, cartObject)
|
441 |
+
}
|
442 |
+
|
443 |
+
wpm.fireCheckoutOption = function (step, checkout_option = null, value = null) {
|
444 |
+
|
445 |
+
let data = {
|
446 |
+
step : step,
|
447 |
+
checkout_option: checkout_option,
|
448 |
+
value : value,
|
449 |
+
}
|
450 |
+
|
451 |
+
jQuery(document).trigger("wpmFireCheckoutOption", data)
|
452 |
+
}
|
453 |
+
|
454 |
+
wpm.fireCheckoutProgress = function (step) {
|
455 |
+
|
456 |
+
let data = {
|
457 |
+
step: step,
|
458 |
+
}
|
459 |
+
|
460 |
+
jQuery(document).trigger("wpmFireCheckoutProgress", data)
|
461 |
+
}
|
462 |
+
|
463 |
+
wpm.getPostIdFromString = function (string) {
|
464 |
+
// console.log(string);
|
465 |
+
try {
|
466 |
+
return string.match(/(post-)(\d+)/)[2]
|
467 |
+
} catch (e) {
|
468 |
+
console.error(e)
|
469 |
+
}
|
470 |
+
}
|
471 |
+
|
472 |
+
wpm.triggerViewItemList = function (productId) {
|
473 |
+
|
474 |
+
// productId = null;
|
475 |
+
|
476 |
+
if (!productId) throw Error("Wasn't able to retrieve a productId")
|
477 |
+
|
478 |
+
productId = getIdBasedOndVariationsOutputSetting(productId)
|
479 |
+
|
480 |
+
if (!productId) throw Error("Wasn't able to retrieve a productId")
|
481 |
+
|
482 |
+
jQuery(document).trigger("wpmViewItemList", wpm.getProductDataForViewItemEvent(productId))
|
483 |
+
}
|
484 |
+
|
485 |
+
wpm.getProductDataForViewItemEvent = function (productId) {
|
486 |
+
|
487 |
+
if (!productId) throw Error("Wasn't able to retrieve a productId")
|
488 |
+
|
489 |
+
try {
|
490 |
+
if (wpmDataLayer.products[productId]) {
|
491 |
+
|
492 |
+
return wpm.getProductDetailsFormattedForEvent(productId)
|
493 |
+
}
|
494 |
+
} catch (e) {
|
495 |
+
console.error(e)
|
496 |
+
}
|
497 |
+
}
|
498 |
+
wpm.getMainProductIdFromProductPage = function () {
|
499 |
+
try {
|
500 |
+
if (["simple", "variable", "grouped", "composite", "bundle"].indexOf(wpmDataLayer.shop.product_type) >= 0) {
|
501 |
+
return jQuery(".wpmProductId:first").data("id")
|
502 |
+
} else {
|
503 |
+
return false
|
504 |
+
}
|
505 |
+
} catch (e) {
|
506 |
+
console.error(e)
|
507 |
+
}
|
508 |
+
}
|
509 |
+
|
510 |
+
wpm.viewItemListTriggerTestMode = function (target) {
|
511 |
+
|
512 |
+
jQuery(target).css({"position": "relative"})
|
513 |
+
jQuery(target).append("<div id=\"viewItemListTriggerOverlay\"></div>")
|
514 |
+
jQuery(target).find("#viewItemListTriggerOverlay").css({
|
515 |
+
"z-index" : "10",
|
516 |
+
"display" : "block",
|
517 |
+
"position" : "absolute",
|
518 |
+
"height" : "100%",
|
519 |
+
"top" : "0",
|
520 |
+
"left" : "0",
|
521 |
+
"right" : "0",
|
522 |
+
"opacity" : wpmDataLayer.viewItemListTrigger.opacity,
|
523 |
+
"background-color": wpmDataLayer.viewItemListTrigger.backgroundColor,
|
524 |
+
})
|
525 |
+
}
|
526 |
+
|
527 |
+
wpm.getSearchTermFromUrl = function () {
|
528 |
+
try {
|
529 |
+
let urlParameters = new URLSearchParams(window.location.search)
|
530 |
+
return urlParameters.get("s")
|
531 |
+
} catch (e) {
|
532 |
+
console.error(e)
|
533 |
+
}
|
534 |
+
}
|
535 |
+
|
536 |
+
// we need this to track timeouts for intersection observers
|
537 |
+
let ioTimeouts = {}
|
538 |
+
|
539 |
+
wpm.observerCallback = function (entries, observer) {
|
540 |
+
|
541 |
+
entries.forEach((entry) => {
|
542 |
+
|
543 |
+
try {
|
544 |
+
let productId
|
545 |
+
|
546 |
+
let elementId = jQuery(entry.target).data("ioid")
|
547 |
+
|
548 |
+
// Get the productId from next element, if wpmProductId is a sibling, like in Gutenberg blocks
|
549 |
+
// otherwise go search in children, like in regular WC loop items
|
550 |
+
if (jQuery(entry.target).next(".wpmProductId").length) {
|
551 |
+
// console.log('test 1');
|
552 |
+
productId = jQuery(entry.target).next(".wpmProductId").data("id")
|
553 |
+
} else {
|
554 |
+
productId = jQuery(entry.target).find(".wpmProductId").data("id")
|
555 |
+
}
|
556 |
+
|
557 |
+
// productId = null;
|
558 |
+
|
559 |
+
if (!productId) throw Error("wpmProductId element not found")
|
560 |
+
|
561 |
+
if (entry.isIntersecting) {
|
562 |
+
|
563 |
+
// console.log('prodid: ' + productId);
|
564 |
+
ioTimeouts[elementId] = setTimeout(() => {
|
565 |
+
// console.log('prodid: ' + productId);
|
566 |
+
wpm.triggerViewItemList(productId)
|
567 |
+
if (wpmDataLayer.viewItemListTrigger.testMode) wpm.viewItemListTriggerTestMode(entry.target)
|
568 |
+
if (wpmDataLayer.viewItemListTrigger.repeat === false) observer.unobserve(entry.target)
|
569 |
+
}, wpmDataLayer.viewItemListTrigger.timeout)
|
570 |
+
|
571 |
+
} else {
|
572 |
+
|
573 |
+
clearTimeout(ioTimeouts[elementId])
|
574 |
+
if (wpmDataLayer.viewItemListTrigger.testMode) jQuery(entry.target).find("#viewItemListTriggerOverlay").remove()
|
575 |
+
}
|
576 |
+
} catch (e) {
|
577 |
+
console.error(e)
|
578 |
+
}
|
579 |
+
})
|
580 |
+
}
|
581 |
+
|
582 |
+
// fire view_item_list only on products that have become visible
|
583 |
+
let io
|
584 |
+
let ioid = 0
|
585 |
+
let allIoElementsToWatch
|
586 |
+
|
587 |
+
let getAllElementsToWatch = function () {
|
588 |
+
|
589 |
+
allIoElementsToWatch = jQuery(".wpmProductId")
|
590 |
+
.map(function (i, elem) {
|
591 |
+
// console.log(elem);
|
592 |
+
if (
|
593 |
+
jQuery(elem).parent().hasClass("type-product") ||
|
594 |
+
jQuery(elem).parent().hasClass("product") ||
|
595 |
+
jQuery(elem).parent().hasClass("product-item-inner")
|
596 |
+
) {
|
597 |
+
// console.log(elem);
|
598 |
+
return jQuery(elem).parent()
|
599 |
+
} else if (
|
600 |
+
jQuery(elem).prev().hasClass("wc-block-grid__product") ||
|
601 |
+
jQuery(elem).prev().hasClass("product") ||
|
602 |
+
jQuery(elem).prev().hasClass("product-small") ||
|
603 |
+
jQuery(elem).prev().hasClass("woocommerce-LoopProduct-link")
|
604 |
+
) {
|
605 |
+
return jQuery(this).prev()
|
606 |
+
} else if (jQuery(elem).closest(".product").length) {
|
607 |
+
return jQuery(elem).closest(".product")
|
608 |
+
}
|
609 |
+
})
|
610 |
+
}
|
611 |
+
|
612 |
+
wpm.startIntersectionObserverToWatch = function () {
|
613 |
+
|
614 |
+
try {
|
615 |
+
// enable view_item_list test mode from browser
|
616 |
+
let urlParams = new URLSearchParams(window.location.search)
|
617 |
+
if (urlParams.has("vildemomode")) wpmDataLayer.viewItemListTrigger.testMode = true
|
618 |
+
|
619 |
+
// set up intersection observer
|
620 |
+
io = new IntersectionObserver(wpm.observerCallback, {
|
621 |
+
threshold: wpmDataLayer.viewItemListTrigger.threshold,
|
622 |
+
})
|
623 |
+
|
624 |
+
getAllElementsToWatch()
|
625 |
+
|
626 |
+
// console.log(allElementsToWatch);
|
627 |
+
|
628 |
+
allIoElementsToWatch.each(function (i, elem) {
|
629 |
+
// console.log(elem[0]);
|
630 |
+
// jQuery(elem[0]).attr('data-ioid', ioid++);
|
631 |
+
jQuery(elem[0]).data("ioid", ioid++)
|
632 |
+
|
633 |
+
io.observe(elem[0])
|
634 |
+
})
|
635 |
+
} catch (e) {
|
636 |
+
console.error(e)
|
637 |
+
}
|
638 |
+
}
|
639 |
+
|
640 |
+
// watch DOM for new lazy loaded products and add them to the intersection observer
|
641 |
+
wpm.startProductsMutationObserverToWatch = function () {
|
642 |
+
|
643 |
+
try {
|
644 |
+
// Pass in the target node, as well as the observer options
|
645 |
+
|
646 |
+
// selects the most common parent node
|
647 |
+
// https://stackoverflow.com/a/7648323/4688612
|
648 |
+
let productsNode = jQuery(".wpmProductId:eq(0)").parents().has(jQuery(".wpmProductId:eq(1)").parents()).first()
|
649 |
+
|
650 |
+
if (productsNode.length) {
|
651 |
+
productsMutationObserver.observe(productsNode[0], {
|
652 |
+
attributes : true,
|
653 |
+
childList : true,
|
654 |
+
characterData: true,
|
655 |
+
})
|
656 |
+
}
|
657 |
+
} catch (e) {
|
658 |
+
console.error(e)
|
659 |
+
}
|
660 |
+
}
|
661 |
+
|
662 |
+
// Create an observer instance
|
663 |
+
let productsMutationObserver = new MutationObserver(function (mutations) {
|
664 |
+
|
665 |
+
mutations.forEach(function (mutation) {
|
666 |
+
let newNodes = mutation.addedNodes // DOM NodeList
|
667 |
+
if (newNodes !== null) { // If there are new nodes added
|
668 |
+
let nodes = jQuery(newNodes) // jQuery set
|
669 |
+
nodes.each(function () {
|
670 |
+
if (
|
671 |
+
jQuery(this).hasClass("type-product") ||
|
672 |
+
jQuery(this).hasClass("product-small") ||
|
673 |
+
jQuery(this).hasClass("wc-block-grid__product")
|
674 |
+
) {
|
675 |
+
// check if the node has a child or sibling wpmProductId
|
676 |
+
// if yes add it to the intersectionObserver
|
677 |
+
if (hasWpmProductIdElement(this)) {
|
678 |
+
jQuery(this).data("ioid", ioid++)
|
679 |
+
io.observe(this)
|
680 |
+
}
|
681 |
+
}
|
682 |
+
})
|
683 |
+
}
|
684 |
+
})
|
685 |
+
})
|
686 |
+
|
687 |
+
let hasWpmProductIdElement = function (elem) {
|
688 |
+
return !!(jQuery(elem).find(".wpmProductId").length ||
|
689 |
+
jQuery(elem).siblings(".wpmProductId").length)
|
690 |
+
}
|
691 |
+
|
692 |
+
wpm.setCookie = function (cookieName, cookieValue = "", expiryDays = null) {
|
693 |
+
if (expiryDays) {
|
694 |
+
let d = new Date()
|
695 |
+
d.setTime(d.getTime() + (expiryDays * 24 * 60 * 60 * 1000))
|
696 |
+
let expires = "expires=" + d.toUTCString()
|
697 |
+
document.cookie = cookieName + "=" + cookieValue + ";" + expires + ";path=/"
|
698 |
+
} else {
|
699 |
+
document.cookie = cookieName + "=" + cookieValue + ";path=/"
|
700 |
+
}
|
701 |
+
}
|
702 |
+
|
703 |
+
wpm.getCookie = function (cookieName) {
|
704 |
+
let name = cookieName + "="
|
705 |
+
let decodedCookie = decodeURIComponent(document.cookie)
|
706 |
+
let ca = decodedCookie.split(";")
|
707 |
+
for (let i = 0; i < ca.length; i++) {
|
708 |
+
let c = ca[i]
|
709 |
+
while (c.charAt(0) == " ") {
|
710 |
+
c = c.substring(1)
|
711 |
+
}
|
712 |
+
if (c.indexOf(name) == 0) {
|
713 |
+
return c.substring(name.length, c.length)
|
714 |
+
}
|
715 |
+
}
|
716 |
+
return ""
|
717 |
+
}
|
718 |
+
|
719 |
+
wpm.getWpmSessionData = function () {
|
720 |
+
if (window.sessionStorage) {
|
721 |
+
|
722 |
+
let data = window.sessionStorage.getItem("_wpm")
|
723 |
+
if (data !== null) {
|
724 |
+
return JSON.parse(data)
|
725 |
+
} else {
|
726 |
+
return {}
|
727 |
+
}
|
728 |
+
} else {
|
729 |
+
return {}
|
730 |
+
}
|
731 |
+
}
|
732 |
+
|
733 |
+
wpm.setWpmSessionData = function (data) {
|
734 |
+
if (window.sessionStorage) {
|
735 |
+
window.sessionStorage.setItem("_wpm", JSON.stringify(data))
|
736 |
+
}
|
737 |
+
}
|
738 |
+
|
739 |
+
wpm.storeOrderIdOnServer = function (orderId) {
|
740 |
+
|
741 |
+
// console.log('saving wpm_purchase_pixels_fired');
|
742 |
+
|
743 |
+
// console.log('url: ' + wpm_premium_only_ajax_object.ajax_url);
|
744 |
+
// console.log('nonce: ' + wpm_premium_only_ajax_object.nonce);
|
745 |
+
// console.log('url: ' + wpm.ajax_url);
|
746 |
+
// console.log('nonce: ' + wpm.nonce);
|
747 |
+
|
748 |
+
try {
|
749 |
+
// save the state in the database
|
750 |
+
let data = {
|
751 |
+
action : "wpm_purchase_pixels_fired",
|
752 |
+
order_id: orderId,
|
753 |
+
// nonce : ajax_object.nonce,
|
754 |
+
nonce: wpm.nonce,
|
755 |
+
}
|
756 |
+
|
757 |
+
jQuery.ajax(
|
758 |
+
{
|
759 |
+
type : "post",
|
760 |
+
dataType: "json",
|
761 |
+
// url : ajax_object.ajax_url,
|
762 |
+
url : wpm.ajax_url,
|
763 |
+
data : data,
|
764 |
+
success: function (response) {
|
765 |
+
if (response.success === false) {
|
766 |
+
console.log(response)
|
767 |
+
}
|
768 |
+
},
|
769 |
+
error : function (response) {
|
770 |
+
console.log(response)
|
771 |
+
},
|
772 |
+
})
|
773 |
+
} catch (e) {
|
774 |
+
console.error(e)
|
775 |
+
}
|
776 |
+
}
|
777 |
+
|
778 |
+
wpm.getProductIdByCartItemKeyUrl = function (url) {
|
779 |
+
let searchParams = new URLSearchParams(url.search)
|
780 |
+
let cartItemKey = searchParams.get("remove_item")
|
781 |
+
|
782 |
+
let productId = null
|
783 |
+
|
784 |
+
if (wpmDataLayer.cartItemKeys[cartItemKey]["variation_id"] === 0) {
|
785 |
+
productId = wpmDataLayer.cartItemKeys[cartItemKey]["product_id"]
|
786 |
+
} else {
|
787 |
+
productId = wpmDataLayer.cartItemKeys[cartItemKey]["variation_id"]
|
788 |
+
}
|
789 |
+
|
790 |
+
return productId
|
791 |
+
}
|
792 |
+
|
793 |
+
wpm.getAddToCartLinkProductIds = function () {
|
794 |
+
return jQuery("a").map(function () {
|
795 |
+
let href = jQuery(this).attr("href")
|
796 |
+
|
797 |
+
if (href && href.includes("?add-to-cart=")) {
|
798 |
+
let matches = href.match(/(add-to-cart=)(\d+)/)
|
799 |
+
if (matches) return matches[2]
|
800 |
+
}
|
801 |
+
}).get()
|
802 |
+
}
|
803 |
+
|
804 |
+
wpm.getProductDetailsFormattedForEvent = function (productId, quantity = 1) {
|
805 |
+
|
806 |
+
// console.log(wpmDataLayer.products[productId].dyn_r_ids)
|
807 |
+
|
808 |
+
let product = {
|
809 |
+
id : productId.toString(),
|
810 |
+
dyn_r_ids : wpmDataLayer.products[productId].dyn_r_ids,
|
811 |
+
name : wpmDataLayer.products[productId].name,
|
812 |
+
list_name : wpmDataLayer.shop.list_name,
|
813 |
+
brand : wpmDataLayer.products[productId].brand,
|
814 |
+
category : wpmDataLayer.products[productId].category,
|
815 |
+
variant : wpmDataLayer.products[productId].variant,
|
816 |
+
list_position: wpmDataLayer.products[productId].position,
|
817 |
+
quantity : quantity,
|
818 |
+
price : wpmDataLayer.products[productId].price,
|
819 |
+
currency : wpmDataLayer.shop.currency,
|
820 |
+
isVariable : wpmDataLayer.products[productId].isVariable,
|
821 |
+
isVariation : wpmDataLayer.products[productId].isVariation,
|
822 |
+
parentId : wpmDataLayer.products[productId].parentId,
|
823 |
+
}
|
824 |
+
|
825 |
+
if (product.isVariation) product["parentId_dyn_r_ids"] = wpmDataLayer.products[productId].parentId_dyn_r_ids
|
826 |
+
|
827 |
+
return product
|
828 |
+
}
|
829 |
+
|
830 |
+
wpm.setReferrerToCookie = function () {
|
831 |
+
// can't use session storage as we can't read it from the server
|
832 |
+
if (!wpm.getCookie("wpmReferrer")) {
|
833 |
+
wpm.setCookie("wpmReferrer", document.referrer)
|
834 |
+
}
|
835 |
+
}
|
836 |
+
|
837 |
+
wpm.getReferrerFromCookie = function () {
|
838 |
+
if (wpm.getCookie("wpmReferrer")) {
|
839 |
+
return wpm.getCookie("wpmReferrer")
|
840 |
+
} else {
|
841 |
+
return null
|
842 |
+
}
|
843 |
+
}
|
844 |
+
|
845 |
+
wpm.getClidFromBrowser = function (clidId = "gclid") {
|
846 |
+
|
847 |
+
let clidCookieId
|
848 |
+
|
849 |
+
clidCookieId = {
|
850 |
+
gclid: "_gcl_aw",
|
851 |
+
dclid: "_gcl_dc",
|
852 |
+
}
|
853 |
+
|
854 |
+
if (wpm.getCookie(clidCookieId[clidId])) {
|
855 |
+
let clidCookie = wpm.getCookie(clidCookieId[clidId])
|
856 |
+
let matches = clidCookie.match(/(GCL.[\d]*.)(.*)/)
|
857 |
+
return matches[2]
|
858 |
+
} else {
|
859 |
+
return ""
|
860 |
+
}
|
861 |
+
}
|
862 |
+
|
863 |
+
wpm.getUserAgent = function () {
|
864 |
+
return navigator.userAgent
|
865 |
+
}
|
866 |
+
|
867 |
+
wpm.getViewPort = function () {
|
868 |
+
return {
|
869 |
+
width : Math.max(document.documentElement.clientWidth || 0, window.innerWidth || 0),
|
870 |
+
height: Math.max(document.documentElement.clientHeight || 0, window.innerHeight || 0),
|
871 |
+
}
|
872 |
+
}
|
873 |
+
|
874 |
+
/*
|
875 |
+
* Handle Cookie Management Platforms
|
876 |
+
* */
|
877 |
+
|
878 |
+
let getComplianzCookies = function () {
|
879 |
+
|
880 |
+
let cmplz_statistics = wpm.getCookie("cmplz_statistics")
|
881 |
+
let cmplz_marketing = wpm.getCookie("cmplz_marketing")
|
882 |
+
let cmplz_consent_status = wpm.getCookie("cmplz_consent_status") || wpm.getCookie("cmplz_banner-status")
|
883 |
+
|
884 |
+
|
885 |
+
if (cmplz_consent_status) {
|
886 |
+
return {
|
887 |
+
analytics : cmplz_statistics === "allow",
|
888 |
+
ads : cmplz_marketing === "allow",
|
889 |
+
visitorHasChosen: true,
|
890 |
+
}
|
891 |
+
} else {
|
892 |
+
return false
|
893 |
+
}
|
894 |
+
}
|
895 |
+
|
896 |
+
let getCookieLawInfoCookies = function () {
|
897 |
+
|
898 |
+
let analyticsCookie = wpm.getCookie("cookielawinfo-checkbox-analytics")
|
899 |
+
let adsCookie = wpm.getCookie("cookielawinfo-checkbox-advertisement")
|
900 |
+
let visitorHasChosen = wpm.getCookie("CookieLawInfoConsent")
|
901 |
+
|
902 |
+
if (analyticsCookie || adsCookie) {
|
903 |
+
|
904 |
+
return {
|
905 |
+
analytics : analyticsCookie === "yes",
|
906 |
+
ads : adsCookie === "yes",
|
907 |
+
visitorHasChosen: !!visitorHasChosen,
|
908 |
+
}
|
909 |
+
} else {
|
910 |
+
return false
|
911 |
+
}
|
912 |
+
}
|
913 |
+
|
914 |
+
|
915 |
+
let
|
916 |
+
wpmConsentValues = {}
|
917 |
+
wpmConsentValues.categories = {}
|
918 |
+
wpmConsentValues.pixels = []
|
919 |
+
wpmConsentValues.mode = "category"
|
920 |
+
wpmConsentValues.visitorHasChosen = false
|
921 |
+
|
922 |
+
wpm.getConsentValues = function () {
|
923 |
+
return wpmConsentValues
|
924 |
+
}
|
925 |
+
|
926 |
+
wpm.setConsentValueCategories = function (analytics = false, ads = false) {
|
927 |
+
wpmConsentValues.categories.analytics = analytics
|
928 |
+
wpmConsentValues.categories.ads = ads
|
929 |
+
}
|
930 |
+
|
931 |
+
wpm.updateConsentCookieValues = function (explicitConsent = false) {
|
932 |
+
|
933 |
+
// ad_storage
|
934 |
+
// analytics_storage
|
935 |
+
// functionality_storage
|
936 |
+
// personalization_storage
|
937 |
+
// security_storage
|
938 |
+
|
939 |
+
// console.log('exp cons: ' + explicitConsent)
|
940 |
+
|
941 |
+
let cookie
|
942 |
+
|
943 |
+
if (cookie = wpm.getCookie("CookieConsent")) {
|
944 |
+
// Cookiebot
|
945 |
+
// https://wordpress.org/plugins/cookiebot/
|
946 |
+
cookie = decodeURI(cookie)
|
947 |
+
|
948 |
+
// console.log(cookie.indexOf('statistics:true'))
|
949 |
+
// console.log(cookie.indexOf('marketing:true'))
|
950 |
+
|
951 |
+
wpmConsentValues.categories.analytics = cookie.indexOf("statistics:true") >= 0
|
952 |
+
wpmConsentValues.categories.ads = cookie.indexOf("marketing:true") >= 0
|
953 |
+
wpmConsentValues.visitorHasChosen = true
|
954 |
+
|
955 |
+
} else if (cookie = wpm.getCookie("CookieScriptConsent")) {
|
956 |
+
// Cookie Script
|
957 |
+
// https://wordpress.org/plugins/cookie-script-com/
|
958 |
+
|
959 |
+
cookie = JSON.parse(cookie)
|
960 |
+
|
961 |
+
// console.log(cookie)
|
962 |
+
// console.log(cookie.action)
|
963 |
+
// console.log('cat length: ' + cookie.categories.length)
|
964 |
+
// console.log(cookie.categories.indexOf('performance'))
|
965 |
+
|
966 |
+
if (cookie.action === "reject") {
|
967 |
+
wpmConsentValues.categories.analytics = false
|
968 |
+
wpmConsentValues.categories.ads = false
|
969 |
+
} else if (cookie.categories.length === 2) {
|
970 |
+
wpmConsentValues.categories.analytics = true
|
971 |
+
wpmConsentValues.categories.ads = true
|
972 |
+
} else {
|
973 |
+
wpmConsentValues.categories.analytics = cookie.categories.indexOf("performance") >= 0
|
974 |
+
wpmConsentValues.categories.ads = cookie.categories.indexOf("targeting") >= 0
|
975 |
+
}
|
976 |
+
|
977 |
+
wpmConsentValues.visitorHasChosen = true
|
978 |
+
|
979 |
+
// console.log(wpmConsentValues)
|
980 |
+
|
981 |
+
} else if (cookie = wpm.getCookie("borlabs-cookie")) {
|
982 |
+
// Borlabs Cookie
|
983 |
+
// https://borlabs.io/borlabs-cookie/
|
984 |
+
|
985 |
+
cookie = decodeURI(cookie)
|
986 |
+
cookie = JSON.parse(cookie)
|
987 |
+
|
988 |
+
wpmConsentValues.categories.analytics = !!cookie?.consents?.statistics
|
989 |
+
wpmConsentValues.categories.ads = !!cookie?.consents?.marketing
|
990 |
+
wpmConsentValues.visitorHasChosen = true
|
991 |
+
wpmConsentValues.pixels = [...cookie?.consents?.statistics || [], ...cookie?.consents?.marketing || []]
|
992 |
+
wpmConsentValues.mode = "pixel"
|
993 |
+
|
994 |
+
} else if (cookie = getComplianzCookies()) {
|
995 |
+
// Complianz Cookie
|
996 |
+
// https://wordpress.org/plugins/complianz-gdpr/
|
997 |
+
|
998 |
+
// console.log(cookie)
|
999 |
+
|
1000 |
+
wpmConsentValues.categories.analytics = cookie.analytics === true
|
1001 |
+
wpmConsentValues.categories.ads = cookie.ads === true
|
1002 |
+
wpmConsentValues.visitorHasChosen = cookie.visitorHasChosen
|
1003 |
+
|
1004 |
+
// console.log(wpmConsentValues)
|
1005 |
+
|
1006 |
+
} else if (cookie = wpm.getCookie("cookie_notice_accepted")) {
|
1007 |
+
// Cookie Compliance (free version)
|
1008 |
+
// https://wordpress.org/plugins/cookie-notice/
|
1009 |
+
|
1010 |
+
wpmConsentValues.categories.analytics = true
|
1011 |
+
wpmConsentValues.categories.ads = true
|
1012 |
+
wpmConsentValues.visitorHasChosen = true
|
1013 |
+
|
1014 |
+
} else if (cookie = wpm.getCookie("hu-consent")) {
|
1015 |
+
// Cookie Compliance (pro version)
|
1016 |
+
// https://wordpress.org/plugins/cookie-notice/
|
1017 |
+
|
1018 |
+
cookie = JSON.parse(cookie)
|
1019 |
+
|
1020 |
+
wpmConsentValues.categories.analytics = !!cookie.categories["3"]
|
1021 |
+
wpmConsentValues.categories.ads = !!cookie.categories["4"]
|
1022 |
+
wpmConsentValues.visitorHasChosen = true
|
1023 |
+
|
1024 |
+
} else if (cookie = getCookieLawInfoCookies()) {
|
1025 |
+
// CookieYes, GDPR Cookie Consent (Cookie Law Info)
|
1026 |
+
// https://wordpress.org/plugins/cookie-law-info/
|
1027 |
+
|
1028 |
+
wpmConsentValues.categories.analytics = cookie.analytics === true
|
1029 |
+
wpmConsentValues.categories.ads = cookie.ads === true
|
1030 |
+
wpmConsentValues.visitorHasChosen = cookie.visitorHasChosen === true
|
1031 |
+
|
1032 |
+
} else if (cookie = wpm.getCookie("moove_gdpr_popup")) {
|
1033 |
+
// GDPR Cookie Compliance Plugin by Moove Agency
|
1034 |
+
// https://wordpress.org/plugins/gdpr-cookie-compliance/
|
1035 |
+
// TODO write documentation on how to set up the plugin in order for this to work properly
|
1036 |
+
|
1037 |
+
cookie = JSON.parse(cookie)
|
1038 |
+
// console.log('moove cookie thirdparty: ' + cookie.thirdparty)
|
1039 |
+
// console.log('moove cookie advanced: ' + cookie.advanced)
|
1040 |
+
|
1041 |
+
wpmConsentValues.categories.analytics = cookie.thirdparty === "1"
|
1042 |
+
wpmConsentValues.categories.ads = cookie.advanced === "1"
|
1043 |
+
wpmConsentValues.visitorHasChosen = true
|
1044 |
+
|
1045 |
+
// console.log(wpmConsentValues)
|
1046 |
+
|
1047 |
+
} else {
|
1048 |
+
// consentValues.categories.analytics = true
|
1049 |
+
// consentValues.categories.ads = true
|
1050 |
+
|
1051 |
+
wpmConsentValues.categories.analytics = !explicitConsent
|
1052 |
+
wpmConsentValues.categories.ads = !explicitConsent
|
1053 |
+
}
|
1054 |
+
}
|
1055 |
+
|
1056 |
+
wpm.updateConsentCookieValues()
|
1057 |
+
|
1058 |
+
wpm.setConsentDefaultValuesToExplicit = function () {
|
1059 |
+
wpmConsentValues.categories = {
|
1060 |
+
analytics: false,
|
1061 |
+
ads : false,
|
1062 |
+
}
|
1063 |
+
}
|
1064 |
+
|
1065 |
+
wpm.canIFire = function (category, pixelName) {
|
1066 |
+
|
1067 |
+
if ("category" === wpmConsentValues.mode) {
|
1068 |
+
return !!wpmConsentValues.categories[category]
|
1069 |
+
} else if ("pixel" === wpmConsentValues.mode) {
|
1070 |
+
return wpmConsentValues.pixels.includes(pixelName)
|
1071 |
+
} else {
|
1072 |
+
console.error("Couldn't find a valid consent mode in wpmConsentValues")
|
1073 |
+
return false
|
1074 |
+
}
|
1075 |
+
}
|
1076 |
+
|
1077 |
+
/**
|
1078 |
+
* Runs through each script in <head> and blocks / unblocks it according to the plugin settings
|
1079 |
+
* and user consent.
|
1080 |
+
*/
|
1081 |
+
|
1082 |
+
// https://stackoverflow.com/q/65453565/4688612
|
1083 |
+
wpm.scriptTagObserver = new MutationObserver((mutations) => {
|
1084 |
+
mutations.forEach(({addedNodes}) => {
|
1085 |
+
[...addedNodes]
|
1086 |
+
.forEach(node => {
|
1087 |
+
|
1088 |
+
if ($(node).data("wpm-cookie-category")) {
|
1089 |
+
|
1090 |
+
// console.log(node)
|
1091 |
+
|
1092 |
+
// If the pixel category has been approved > unblock
|
1093 |
+
// If the pixel belongs to more than one category, then unblock if one of the categories has been approved
|
1094 |
+
// If no category has been approved, but the Google Consent Mode is active, then only unblock the Google scripts
|
1095 |
+
|
1096 |
+
if (wpm.shouldScriptBeActive(node)) {
|
1097 |
+
wpm.unblockScript(node)
|
1098 |
+
} else {
|
1099 |
+
wpm.blockScript(node)
|
1100 |
+
}
|
1101 |
+
}
|
1102 |
+
})
|
1103 |
+
})
|
1104 |
+
})
|
1105 |
+
|
1106 |
+
wpm.scriptTagObserver.observe(document.head, {childList: true, subtree: true})
|
1107 |
+
window.addEventListener("DOMContentLoaded", () => wpm.scriptTagObserver.disconnect())
|
1108 |
+
|
1109 |
+
wpm.shouldScriptBeActive = function (node) {
|
1110 |
+
|
1111 |
+
if (
|
1112 |
+
wpmDataLayer.shop.cookie_consent_mgmt.explicit_consent ||
|
1113 |
+
wpmConsentValues.visitorHasChosen
|
1114 |
+
) {
|
1115 |
+
|
1116 |
+
if (wpmConsentValues.mode === "category" && $(node).data("wpm-cookie-category").split(",").some(element => wpmConsentValues.categories[element])) {
|
1117 |
+
return true
|
1118 |
+
} else if (wpmConsentValues.mode === "pixel" && wpmConsentValues.pixels.includes($(node).data("wpm-pixel-name"))) {
|
1119 |
+
return true
|
1120 |
+
} else if (wpmConsentValues.mode === "pixel" && $(node).data("wpm-pixel-name") === "google" && ["google-analytics", "google-ads"].some(element => wpmConsentValues.pixels.includes(element))) {
|
1121 |
+
return true
|
1122 |
+
} else if (wpmDataLayer?.pixels?.google?.consent_mode?.active && $(node).data("wpm-pixel-name") === "google") {
|
1123 |
+
return true
|
1124 |
+
} else {
|
1125 |
+
return false
|
1126 |
+
}
|
1127 |
+
} else {
|
1128 |
+
return true
|
1129 |
+
}
|
1130 |
+
}
|
1131 |
+
|
1132 |
+
|
1133 |
+
wpm.unblockScript = function (scriptNode, removeAttach = false) {
|
1134 |
+
|
1135 |
+
if (removeAttach) $(scriptNode).remove()
|
1136 |
+
|
1137 |
+
let wpmSrc = $(scriptNode).data("wpm-src")
|
1138 |
+
if (wpmSrc) $(scriptNode).attr("src", wpmSrc)
|
1139 |
+
|
1140 |
+
scriptNode.type = "text/javascript"
|
1141 |
+
|
1142 |
+
if (removeAttach) $(scriptNode).appendTo("head")
|
1143 |
+
|
1144 |
+
jQuery(document).trigger("wpmPreLoadPixels", {})
|
1145 |
+
}
|
1146 |
+
|
1147 |
+
wpm.blockScript = function (scriptNode, removeAttach = false) {
|
1148 |
+
|
1149 |
+
if (removeAttach) $(scriptNode).remove()
|
1150 |
+
|
1151 |
+
if ($(scriptNode).attr("src")) $(scriptNode).removeAttr("src")
|
1152 |
+
scriptNode.type = "blocked/javascript"
|
1153 |
+
|
1154 |
+
if (removeAttach) $(scriptNode).appendTo("head")
|
1155 |
+
}
|
1156 |
+
|
1157 |
+
wpm.unblockAllScripts = function (analytics = true, ads = true) {
|
1158 |
+
// console.log('unblocking all scripts')
|
1159 |
+
|
1160 |
+
$.each(
|
1161 |
+
$("script[type=\"blocked/javascript\"]"), function (index, scriptNode) {
|
1162 |
+
|
1163 |
+
if ($(scriptNode).data("wpm-cookie-category").includes("analytics") && analytics) {
|
1164 |
+
wpm.unblockScript(scriptNode, true)
|
1165 |
+
} else if ($(scriptNode).data("wpm-cookie-category").includes("ads") && ads) {
|
1166 |
+
wpm.unblockScript(scriptNode, true)
|
1167 |
+
}
|
1168 |
+
})
|
1169 |
+
|
1170 |
+
jQuery(document).trigger("wpmPreLoadPixels", {})
|
1171 |
+
}
|
1172 |
+
|
1173 |
+
wpm.unblockSelectedPixels = function () {
|
1174 |
+
$.each(
|
1175 |
+
$("script[type=\"blocked/javascript\"]"), function (index, node) {
|
1176 |
+
|
1177 |
+
if (wpmConsentValues.pixels.includes($(node).data("wpm-pixel-name"))) {
|
1178 |
+
wpm.unblockScript(node, true)
|
1179 |
+
} else if ($(node).data("wpm-pixel-name") === "google" && ["google-analytics", "google-ads"].some(element => wpmConsentValues.pixels.includes(element))) {
|
1180 |
+
wpm.unblockScript(node, true)
|
1181 |
+
}
|
1182 |
+
})
|
1183 |
+
|
1184 |
+
jQuery(document).trigger("wpmPreLoadPixels", {})
|
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 |
+
wpm.updateConsentCookieValues()
|
1198 |
+
|
1199 |
+
if (wpmConsentValues.mode === "pixel") {
|
1200 |
+
|
1201 |
+
wpm.unblockSelectedPixels()
|
1202 |
+
wpm.updateGoogleConsentMode(wpmConsentValues.pixels.includes("google-analytics"), wpmConsentValues.pixels.includes("google-ads"))
|
1203 |
+
} else {
|
1204 |
+
|
1205 |
+
wpm.unblockAllScripts(wpmConsentValues.categories.analytics, wpmConsentValues.categories.ads)
|
1206 |
+
wpm.updateGoogleConsentMode(wpmConsentValues.categories.analytics, wpmConsentValues.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) wpmConsentValues.categories.analytics = true
|
1215 |
+
if (Cookiebot.consent.marketing) wpmConsentValues.categories.ads = true
|
1216 |
+
|
1217 |
+
wpm.unblockAllScripts(wpmConsentValues.categories.analytics, wpmConsentValues.categories.ads)
|
1218 |
+
wpm.updateGoogleConsentMode(wpmConsentValues.categories.analytics, wpmConsentValues.categories.ads)
|
1219 |
+
|
1220 |
+
}, false)
|
1221 |
+
|
1222 |
+
/**
|
1223 |
+
* Cookie Script
|
1224 |
+
* If visitor accepts cookies in Cookie Script unblock the scripts
|
1225 |
+
* https://support.cookie-script.com/article/20-custom-events
|
1226 |
+
*/
|
1227 |
+
window.addEventListener("CookieScriptAccept", function (e) {
|
1228 |
+
if (e.detail.categories.includes("performance")) wpmConsentValues.categories.analytics = true
|
1229 |
+
if (e.detail.categories.includes("targeting")) wpmConsentValues.categories.ads = true
|
1230 |
+
|
1231 |
+
wpm.unblockAllScripts(wpmConsentValues.categories.analytics, wpmConsentValues.categories.ads)
|
1232 |
+
wpm.updateGoogleConsentMode(wpmConsentValues.categories.analytics, wpmConsentValues.categories.ads)
|
1233 |
+
})
|
1234 |
+
|
1235 |
+
/**
|
1236 |
+
* Cookie Script
|
1237 |
+
* If visitor accepts cookies in Cookie Script unblock the scripts
|
1238 |
+
* https://support.cookie-script.com/
|
1239 |
+
*/
|
1240 |
+
window.addEventListener("CookieScriptAcceptAll", function (e) {
|
1241 |
+
wpm.unblockAllScripts(true, true)
|
1242 |
+
wpm.updateGoogleConsentMode(true, true)
|
1243 |
+
})
|
1244 |
+
|
1245 |
+
// Complianz Cookie
|
1246 |
+
// If visitor accepts cookies in Complianz unblock the scripts
|
1247 |
+
document.addEventListener("cmplzStatusChange", function (e) {
|
1248 |
+
|
1249 |
+
wpm.updateConsentCookieValues()
|
1250 |
+
|
1251 |
+
// console.log(wpmConsentValues)
|
1252 |
+
|
1253 |
+
wpm.unblockAllScripts(wpmConsentValues.categories.analytics, wpmConsentValues.categories.ads)
|
1254 |
+
wpm.updateGoogleConsentMode(wpmConsentValues.categories.analytics, wpmConsentValues.categories.ads)
|
1255 |
+
})
|
1256 |
+
|
1257 |
+
// Cookie Compliance by hu-manity.co (free and pro)
|
1258 |
+
// If visitor accepts cookies in Cookie Notice by hu-manity.co unblock the scripts (free version)
|
1259 |
+
// https://wordpress.org/support/topic/events-on-consent-change/#post-15202792
|
1260 |
+
document.addEventListener("setCookieNotice", function (e) {
|
1261 |
+
|
1262 |
+
wpm.updateConsentCookieValues()
|
1263 |
+
|
1264 |
+
// console.log(wpmConsentValues)
|
1265 |
+
|
1266 |
+
wpm.unblockAllScripts(wpmConsentValues.categories.analytics, wpmConsentValues.categories.ads)
|
1267 |
+
wpm.updateGoogleConsentMode(wpmConsentValues.categories.analytics, wpmConsentValues.categories.ads)
|
1268 |
+
})
|
1269 |
+
|
1270 |
+
/**
|
1271 |
+
* Cookie Compliance by hu-manity.co (free and pro)
|
1272 |
+
* If visitor accepts cookies in Cookie Notice by hu-manity.co unblock the scripts (pro version)
|
1273 |
+
* https://wordpress.org/support/topic/events-on-consent-change/#post-15202792
|
1274 |
+
* Because Cookie Notice has no documented API or event that is being triggered on consent save or update
|
1275 |
+
* we have to solve this by using a mutation observer.
|
1276 |
+
*
|
1277 |
+
* @type {MutationObserver}
|
1278 |
+
*/
|
1279 |
+
|
1280 |
+
wpm.huObserver = new MutationObserver(function (mutations) {
|
1281 |
+
mutations.forEach(({addedNodes}) => {
|
1282 |
+
[...addedNodes]
|
1283 |
+
.forEach(node => {
|
1284 |
+
|
1285 |
+
if (node.id === "hu") {
|
1286 |
+
|
1287 |
+
jQuery(".hu-cookies-save").on("click", function (e) {
|
1288 |
+
wpm.updateConsentCookieValues()
|
1289 |
+
wpm.unblockAllScripts(wpmConsentValues.categories.analytics, wpmConsentValues.categories.ads)
|
1290 |
+
wpm.updateGoogleConsentMode(wpmConsentValues.categories.analytics, wpmConsentValues.categories.ads)
|
1291 |
+
})
|
1292 |
+
}
|
1293 |
+
})
|
1294 |
+
})
|
1295 |
+
})
|
1296 |
+
|
1297 |
+
if (window.hu) {
|
1298 |
+
wpm.huObserver.observe(document.documentElement || document.body, {childList: true, subtree: true})
|
1299 |
+
}
|
1300 |
+
|
1301 |
+
wpm.version = function () {
|
1302 |
+
console.log(wpmDataLayer.version)
|
1303 |
+
}
|
1304 |
+
|
1305 |
+
// https://api.jquery.com/jquery.getscript/
|
1306 |
+
wpm.loadScriptAndCacheIt = function (url, options) {
|
1307 |
+
|
1308 |
+
// Allow user to set any option except for dataType, cache, and url
|
1309 |
+
options = jQuery.extend(options || {}, {
|
1310 |
+
dataType: "script",
|
1311 |
+
cache : true,
|
1312 |
+
url : url,
|
1313 |
+
})
|
1314 |
+
|
1315 |
+
// Use $.ajax() since it is more flexible than $.getScript
|
1316 |
+
// Return the jqXHR object so we can chain callbacks
|
1317 |
+
return jQuery.ajax(options)
|
1318 |
+
}
|
1319 |
+
|
1320 |
+
wpm.getOrderItemPrice = function (orderItem) {
|
1321 |
+
return (orderItem.total + orderItem.total_tax) / orderItem.quantity
|
1322 |
+
}
|
1323 |
+
|
1324 |
+
wpm.hasLoginEventFired = function () {
|
1325 |
+
let data = wpm.getWpmSessionData()
|
1326 |
+
return data?.loginEventFired
|
1327 |
+
}
|
1328 |
+
|
1329 |
+
wpm.setLoginEventFired = function () {
|
1330 |
+
let data = wpm.getWpmSessionData()
|
1331 |
+
data["loginEventFired"] = true
|
1332 |
+
wpm.setWpmSessionData(data)
|
1333 |
+
}
|
1334 |
+
|
1335 |
+
wpm.wpmDataLayerExists = function () {
|
1336 |
+
return new Promise(function (resolve) {
|
1337 |
+
(function waitForVar() {
|
1338 |
+
if (typeof wpmDataLayer !== "undefined") return resolve()
|
1339 |
+
setTimeout(waitForVar, 50)
|
1340 |
+
})()
|
1341 |
+
})
|
1342 |
+
}
|
1343 |
+
|
1344 |
+
wpm.pageLoaded = function () {
|
1345 |
+
return new Promise(function (resolve) {
|
1346 |
+
(function waitForVar() {
|
1347 |
+
if ("complete" === document.readyState) return resolve()
|
1348 |
+
setTimeout(waitForVar, 50)
|
1349 |
+
})()
|
1350 |
+
})
|
1351 |
+
}
|
1352 |
+
|
1353 |
+
// wpm['load'] = {
|
1354 |
+
// base: true
|
1355 |
+
// };
|
1356 |
+
|
1357 |
+
window["wpmLoaded"] = {}
|
1358 |
+
|
1359 |
+
// return {
|
1360 |
+
// writeOrderIdToStorage : writeOrderIdToStorage,
|
1361 |
+
// isOrderIdStored : isOrderIdStored,
|
1362 |
+
// isEmail : isEmail,
|
1363 |
+
// removeProductFromCart : removeProductFromCart,
|
1364 |
+
// getViewItemProducts : getViewItemProducts,
|
1365 |
+
// addProductToCart : addProductToCart,
|
1366 |
+
// getCartItemsFromBackEnd: getCartItemsFromBackEnd,
|
1367 |
+
// fireCheckoutOption : fireCheckoutOption,
|
1368 |
+
// getCartItems : getCartItems
|
1369 |
+
// }
|
1370 |
+
|
1371 |
+
}(window.wpm = window.wpm || {}, jQuery))
|
1372 |
+
|
1373 |
+
/**
|
1374 |
+
* Run as soon as wpm namespace is loaded
|
1375 |
+
*/
|
1376 |
+
|
1377 |
+
// run when window ready
|
1378 |
+
jQuery(function () {
|
1379 |
+
// jQuery(window).on('load', function () {
|
1380 |
+
|
1381 |
+
wpm.wpmDataLayerExists()
|
1382 |
+
.then(function () {
|
1383 |
+
// watch for products visible in viewport
|
1384 |
+
wpm.startIntersectionObserverToWatch()
|
1385 |
+
|
1386 |
+
// watch for lazy loaded products
|
1387 |
+
wpm.startProductsMutationObserverToWatch()
|
1388 |
+
})
|
1389 |
+
|
1390 |
+
// let products = jQuery(".products, .product")
|
1391 |
+
})
|
1392 |
+
|
1393 |
+
|
1394 |
+
/**
|
1395 |
+
* All event listeners
|
1396 |
+
* */
|
1397 |
+
|
1398 |
+
// remove_from_cart event
|
1399 |
+
// body.on('click', '.remove_from_cart_button, .remove', function (e) {
|
1400 |
+
jQuery(document).on("click", ".remove_from_cart_button, .remove", function (e) {
|
1401 |
+
// jQuery('.remove_from_cart_button, .remove').on('click', function (e) {
|
1402 |
+
|
1403 |
+
try {
|
1404 |
+
// console.log('remove_from_cart: ' + jQuery(this).data('product_id'));
|
1405 |
+
|
1406 |
+
let url = new URL(jQuery(this).attr("href"))
|
1407 |
+
let productId = wpm.getProductIdByCartItemKeyUrl(url)
|
1408 |
+
|
1409 |
+
wpm.removeProductFromCart(productId)
|
1410 |
+
|
1411 |
+
} catch (e) {
|
1412 |
+
console.error(e)
|
1413 |
+
}
|
1414 |
+
})
|
1415 |
+
|
1416 |
+
|
1417 |
+
// add_to_cart event
|
1418 |
+
// body.on('click', '.add_to_cart_button:not(.product_type_variable), .ajax_add_to_cart, .single_add_to_cart_button', function (e) {
|
1419 |
+
jQuery(document).on("click", ".add_to_cart_button:not(.product_type_variable), .ajax_add_to_cart, .single_add_to_cart_button", function (e) {
|
1420 |
+
// 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) {
|
1421 |
+
|
1422 |
+
try {
|
1423 |
+
// console.log('add_to_cart');
|
1424 |
+
|
1425 |
+
if (wpmDataLayer.shop.page_type === "product") {
|
1426 |
+
|
1427 |
+
// first process related and upsell products
|
1428 |
+
if (typeof jQuery(this).attr("href") !== "undefined" && jQuery(this).attr("href").includes("add-to-cart")) {
|
1429 |
+
// console.log('add-to-cart on upsell and related products');
|
1430 |
+
let quantity = 1
|
1431 |
+
let productId = jQuery(this).data("product_id")
|
1432 |
+
// console.log('productId: ' + productId);
|
1433 |
+
wpm.addProductToCart(productId, quantity)
|
1434 |
+
} else {
|
1435 |
+
|
1436 |
+
if (wpmDataLayer.shop.product_type === "simple") {
|
1437 |
+
|
1438 |
+
// console.log('test');
|
1439 |
+
let quantity = Number(jQuery(".input-text.qty").val())
|
1440 |
+
|
1441 |
+
if (!quantity && quantity !== 0) quantity = 1
|
1442 |
+
|
1443 |
+
let productId = jQuery(this).val()
|
1444 |
+
|
1445 |
+
// console.log('productId: ' + productId);
|
1446 |
+
// console.log('quantity: ' + quantity);
|
1447 |
+
|
1448 |
+
wpm.addProductToCart(productId, quantity)
|
1449 |
+
|
1450 |
+
} else if (wpmDataLayer.shop.product_type === "variable") {
|
1451 |
+
|
1452 |
+
// console.log('variable');
|
1453 |
+
|
1454 |
+
let quantity = Number(jQuery(".input-text.qty").val())
|
1455 |
+
|
1456 |
+
if (!quantity && quantity !== 0) quantity = 1
|
1457 |
+
|
1458 |
+
let productId = jQuery("[name='variation_id']").val()
|
1459 |
+
|
1460 |
+
// console.log('productId: ' + productId);
|
1461 |
+
// console.log('quantity: ' + quantity);
|
1462 |
+
|
1463 |
+
wpm.addProductToCart(productId, quantity)
|
1464 |
+
|
1465 |
+
} else if (wpmDataLayer.shop.product_type === "grouped") {
|
1466 |
+
|
1467 |
+
// console.log('grouped');
|
1468 |
+
|
1469 |
+
jQuery(".woocommerce-grouped-product-list-item").each(function () {
|
1470 |
+
|
1471 |
+
let quantity = Number(jQuery(this).find(".input-text.qty").val())
|
1472 |
+
|
1473 |
+
if (!quantity && quantity !== 0) quantity = 1
|
1474 |
+
|
1475 |
+
let classes = jQuery(this).attr("class")
|
1476 |
+
let productId = wpm.getPostIdFromString(classes)
|
1477 |
+
|
1478 |
+
// console.log('productId: ' + productId);
|
1479 |
+
// console.log('quantity: ' + quantity);
|
1480 |
+
|
1481 |
+
wpm.addProductToCart(productId, quantity)
|
1482 |
+
})
|
1483 |
+
} else if (wpmDataLayer.shop.product_type === "bundle") {
|
1484 |
+
|
1485 |
+
// console.log('bundle');
|
1486 |
+
|
1487 |
+
let quantity = Number(jQuery(".input-text.qty").val())
|
1488 |
+
|
1489 |
+
if (!quantity && quantity !== 0) quantity = 1
|
1490 |
+
|
1491 |
+
let productId = jQuery("input[name=add-to-cart]").val()
|
1492 |
+
|
1493 |
+
// console.log('productId: ' + productId);
|
1494 |
+
// console.log('quantity: ' + quantity);
|
1495 |
+
|
1496 |
+
wpm.addProductToCart(productId, quantity)
|
1497 |
+
}
|
1498 |
+
}
|
1499 |
+
} else {
|
1500 |
+
|
1501 |
+
// console.log('non product page');
|
1502 |
+
|
1503 |
+
let quantity = 1
|
1504 |
+
let productId = jQuery(this).data("product_id")
|
1505 |
+
// console.log('productId: ' + productId);
|
1506 |
+
wpm.addProductToCart(productId, quantity)
|
1507 |
+
}
|
1508 |
+
} catch (e) {
|
1509 |
+
console.error(e)
|
1510 |
+
}
|
1511 |
+
})
|
1512 |
+
|
1513 |
+
// if someone clicks anywhere on a custom /?add-to-cart=123 link
|
1514 |
+
// trigger the add to cart event
|
1515 |
+
// body.one('click', function (e) {
|
1516 |
+
//
|
1517 |
+
// try {
|
1518 |
+
// if (jQuery(this)[0].URL) {
|
1519 |
+
//
|
1520 |
+
// let href = new URL(jQuery(this)[0].URL);
|
1521 |
+
// let searchParams = new URLSearchParams(href.search);
|
1522 |
+
//
|
1523 |
+
// if (searchParams.has('add-to-cart')) {
|
1524 |
+
// // console.log('non product page, /?add-to-cart=123 link');
|
1525 |
+
//
|
1526 |
+
// let productId = searchParams.get('add-to-cart');
|
1527 |
+
// wpm.addProductToCart(productId, 1);
|
1528 |
+
// }
|
1529 |
+
// }
|
1530 |
+
// } catch (e) {
|
1531 |
+
// console.error(e);
|
1532 |
+
// }
|
1533 |
+
// });
|
1534 |
+
|
1535 |
+
|
1536 |
+
/**
|
1537 |
+
* If someone clicks anywhere on a custom /?add-to-cart=123 link
|
1538 |
+
* trigger the add to cart event
|
1539 |
+
*/
|
1540 |
+
// body.one('click', 'a:not(.add_to_cart_button, .ajax_add_to_cart, .single_add_to_cart_button)', function (event) {
|
1541 |
+
jQuery(document).one("click", "a:not(.add_to_cart_button, .ajax_add_to_cart, .single_add_to_cart_button)", function (event) {
|
1542 |
+
// jQuery('a:not(.add_to_cart_button, .ajax_add_to_cart, .single_add_to_cart_button)').one('click', function (event) {
|
1543 |
+
|
1544 |
+
try {
|
1545 |
+
if (jQuery(event.target).closest("a").attr("href")) {
|
1546 |
+
|
1547 |
+
let href = jQuery(event.target).closest("a").attr("href")
|
1548 |
+
|
1549 |
+
if (href.includes("add-to-cart=")) {
|
1550 |
+
let matches = href.match(/(add-to-cart=)(\d+)/)
|
1551 |
+
// console.log('pid: ' + matches[2])
|
1552 |
+
if (matches) wpm.addProductToCart(matches[2], 1)
|
1553 |
+
}
|
1554 |
+
}
|
1555 |
+
} catch (e) {
|
1556 |
+
console.error(e)
|
1557 |
+
}
|
1558 |
+
})
|
1559 |
+
|
1560 |
+
// select_content GA UA event
|
1561 |
+
// select_item GA 4 event
|
1562 |
+
// jQuery(document).on('click', '.woocommerce-LoopProduct-link, .wc-block-grid__product, .product-small.box', function (e) {
|
1563 |
+
// body.on('click', '.woocommerce-LoopProduct-link, .wc-block-grid__product, .product, .product-small, .type-product', function (e) {
|
1564 |
+
jQuery(document).on("click", ".woocommerce-LoopProduct-link, .wc-block-grid__product, .product, .product-small, .type-product", function (e) {
|
1565 |
+
// jQuery('.woocommerce-LoopProduct-link, .wc-block-grid__product, .product, .product-small, .type-product').on('click', function (e) {
|
1566 |
+
|
1567 |
+
try {
|
1568 |
+
|
1569 |
+
// On some pages the event fires multiple times, and on product pages
|
1570 |
+
// even on page load. Using e.stopPropagation helps to prevent this,
|
1571 |
+
// but I dont know why. We don't even have to use this, since only a real
|
1572 |
+
// product click yields a valid productId. So we filter the invalid click
|
1573 |
+
// events out later down the code. I'll keep it that way because this is
|
1574 |
+
// the most compatible way across shops.
|
1575 |
+
// e.stopPropagation();
|
1576 |
+
|
1577 |
+
// console.log('select_content and select_item');
|
1578 |
+
|
1579 |
+
let productId = jQuery(this).nextAll(".wpmProductId:first").data("id")
|
1580 |
+
// console.log('select_content and select_item: ' + productId);
|
1581 |
+
|
1582 |
+
|
1583 |
+
// On product pages, for some reason, the click event is triggered on the main product on page load.
|
1584 |
+
// In that case no ID is found. But we can discard it, since we only want to trigger the event on
|
1585 |
+
// related products, which are found below.
|
1586 |
+
if (productId) {
|
1587 |
+
|
1588 |
+
// console.log('select_content and select_item: ' + productId);
|
1589 |
+
|
1590 |
+
productId = getIdBasedOndVariationsOutputSetting(productId)
|
1591 |
+
|
1592 |
+
if (!productId) throw Error("Wasn't able to retrieve a productId")
|
1593 |
+
|
1594 |
+
// console.log('prodid: ' + productId);
|
1595 |
+
|
1596 |
+
if (wpmDataLayer.products && wpmDataLayer.products[productId]) {
|
1597 |
+
|
1598 |
+
let product = wpm.getProductDetailsFormattedForEvent(productId)
|
1599 |
+
|
1600 |
+
jQuery(document).trigger("wpmSelectContentGaUa", product)
|
1601 |
+
jQuery(document).trigger("wpmSelectItem", product)
|
1602 |
+
}
|
1603 |
+
}
|
1604 |
+
} catch (e) {
|
1605 |
+
console.error(e)
|
1606 |
+
}
|
1607 |
+
})
|
1608 |
+
|
1609 |
+
// begin_checkout event
|
1610 |
+
// body.one('click', '.checkout-button, .cart-checkout-button, .button.checkout', function (e) {
|
1611 |
+
jQuery(document).one("click", ".checkout-button, .cart-checkout-button, .button.checkout", function (e) {
|
1612 |
+
// jQuery('.checkout-button, .cart-checkout-button, .button.checkout').one('click', function (e) {
|
1613 |
+
// console.log('begin_checkout');
|
1614 |
+
|
1615 |
+
jQuery(document).trigger("wpmBeginCheckout")
|
1616 |
+
})
|
1617 |
+
|
1618 |
+
|
1619 |
+
// checkout_progress event
|
1620 |
+
// track checkout option event: entered valid billing email
|
1621 |
+
// body.on('input', '#billing_email', function () {
|
1622 |
+
jQuery(document).on("input", "#billing_email", function () {
|
1623 |
+
// jQuery('#billing_email').on('input', function () {
|
1624 |
+
|
1625 |
+
if (wpm.isEmail(jQuery(this).val())) {
|
1626 |
+
// wpm.fireCheckoutOption(2);
|
1627 |
+
wpm.fireCheckoutProgress(2)
|
1628 |
+
wpm.emailSelected = true
|
1629 |
+
}
|
1630 |
+
})
|
1631 |
+
|
1632 |
+
// track checkout option event: purchase click
|
1633 |
+
|
1634 |
+
// body.on('click', '.wc_payment_methods', function () {
|
1635 |
+
jQuery(document).on("click", ".wc_payment_methods", function () {
|
1636 |
+
// jQuery('.wc_payment_methods').on('click', function () {
|
1637 |
+
|
1638 |
+
if (false === wpm.paymentMethodSelected) {
|
1639 |
+
wpm.fireCheckoutProgress(3)
|
1640 |
+
}
|
1641 |
+
|
1642 |
+
wpm.fireCheckoutOption(3, jQuery("input[name='payment_method']:checked").val())
|
1643 |
+
wpm.paymentMethodSelected = true
|
1644 |
+
})
|
1645 |
+
|
1646 |
+
// track checkout option event: purchase click
|
1647 |
+
// body.one('click', '#place_order', function () {
|
1648 |
+
jQuery(document).one("click", "#place_order", function () {
|
1649 |
+
// jQuery('#place_order').one('click', function () {
|
1650 |
+
|
1651 |
+
if (false === wpm.emailSelected) {
|
1652 |
+
wpm.fireCheckoutProgress(2)
|
1653 |
+
}
|
1654 |
+
|
1655 |
+
if (false === wpm.paymentMethodSelected) {
|
1656 |
+
wpm.fireCheckoutProgress(3)
|
1657 |
+
wpm.fireCheckoutOption(3, jQuery("input[name='payment_method']:checked").val())
|
1658 |
+
}
|
1659 |
+
|
1660 |
+
wpm.fireCheckoutProgress(4)
|
1661 |
+
})
|
1662 |
+
|
1663 |
+
// update cart event
|
1664 |
+
// body.on('click', "[name='update_cart']", function (e) {
|
1665 |
+
jQuery(document).on("click", "[name='update_cart']", function (e) {
|
1666 |
+
// jQuery("[name='update_cart']").on('click', function (e) {
|
1667 |
+
|
1668 |
+
try {
|
1669 |
+
jQuery(".cart_item").each(function () {
|
1670 |
+
|
1671 |
+
// let productId = jQuery(this).find('[data-product_id]').data('product_id');
|
1672 |
+
|
1673 |
+
let url = new URL(jQuery(this).find(".product-remove").find("a").attr("href"))
|
1674 |
+
let productId = wpm.getProductIdByCartItemKeyUrl(url)
|
1675 |
+
|
1676 |
+
// console.log(productId)
|
1677 |
+
|
1678 |
+
let quantity = jQuery(this).find(".qty").val()
|
1679 |
+
|
1680 |
+
if (quantity === 0) {
|
1681 |
+
wpm.removeProductFromCart(productId)
|
1682 |
+
} else if (quantity < wpmDataLayer.cart[productId].quantity) {
|
1683 |
+
wpm.removeProductFromCart(productId, wpmDataLayer.cart[productId].quantity - quantity)
|
1684 |
+
} else if (quantity > wpmDataLayer.cart[productId].quantity) {
|
1685 |
+
wpm.addProductToCart(productId, quantity - wpmDataLayer.cart[productId].quantity)
|
1686 |
+
}
|
1687 |
+
})
|
1688 |
+
} catch (e) {
|
1689 |
+
console.error(e)
|
1690 |
+
wpm.getCartItemsFromBackend()
|
1691 |
+
}
|
1692 |
+
})
|
1693 |
+
|
1694 |
+
|
1695 |
+
// add_to_wishlist
|
1696 |
+
// body.on('click', '.add_to_wishlist, .wl-add-to', function () {
|
1697 |
+
jQuery(document).on("click", ".add_to_wishlist, .wl-add-to", function () {
|
1698 |
+
// jQuery('.add_to_wishlist, .wl-add-to').on('click', function () {
|
1699 |
+
|
1700 |
+
try {
|
1701 |
+
// console.log('add_to_wishlist');
|
1702 |
+
// console.log('this:' + jQuery(this).data('product-id'));
|
1703 |
+
|
1704 |
+
let productId
|
1705 |
+
|
1706 |
+
if (jQuery(this).data("productid")) { // for the WooCommerce wishlist plugin
|
1707 |
+
productId = jQuery(this).data("productid")
|
1708 |
+
} else if (jQuery(this).data("product-id")) { // for the YITH wishlist plugin
|
1709 |
+
productId = jQuery(this).data("product-id")
|
1710 |
+
}
|
1711 |
+
|
1712 |
+
if (!productId) throw Error("Wasn't able to retrieve a productId")
|
1713 |
+
|
1714 |
+
let product = wpm.getProductDetailsFormattedForEvent(productId)
|
1715 |
+
|
1716 |
+
// console.log('add_to_wishlist');
|
1717 |
+
// console.log(product);
|
1718 |
+
|
1719 |
+
jQuery(document).trigger("wpmAddToWishlist", product)
|
1720 |
+
} catch (e) {
|
1721 |
+
console.error(e)
|
1722 |
+
}
|
1723 |
+
})
|
1724 |
+
|
1725 |
+
// body.on('updated_cart_totals', function () {
|
1726 |
+
jQuery(document).on("updated_cart_totals", function () {
|
1727 |
+
jQuery(document).trigger("wpmViewCart")
|
1728 |
+
})
|
1729 |
+
|
1730 |
+
|
1731 |
+
// populate the wpmDataLayer with the cart items
|
1732 |
+
jQuery(window).on("wpmLoad", function () {
|
1733 |
+
// console.log('getting cart');
|
1734 |
+
|
1735 |
+
try {
|
1736 |
+
// console.log('wpmMiniCartActive: ' + JSON.parse(sessionStorage.getItem('wpmMiniCartActive')));
|
1737 |
+
// if ( wpmDataLayer.shop.page_type === 'cart' || wpmDataLayer.shop.mini_cart.track === true) {
|
1738 |
+
|
1739 |
+
if (
|
1740 |
+
JSON.parse(sessionStorage.getItem("wpmMiniCartActive")) && // if we detected calls to get_refreshed_fragments
|
1741 |
+
JSON.parse(sessionStorage.getItem("wpmFirstPageLoad")) && // when a new session is initiated there are no items in the cart, so we can save that call
|
1742 |
+
wpmDataLayer.shop.mini_cart.track === true // if shop owner generally allows the plugin to track the mini cart
|
1743 |
+
) {
|
1744 |
+
// console.log('getting cart');
|
1745 |
+
wpm.getCartItems()
|
1746 |
+
|
1747 |
+
} else {
|
1748 |
+
sessionStorage.setItem("wpmFirstPageLoad", JSON.stringify(true))
|
1749 |
+
}
|
1750 |
+
} catch (e) {
|
1751 |
+
console.error(e)
|
1752 |
+
}
|
1753 |
+
})
|
1754 |
+
|
1755 |
+
// get all add-to-cart= products from backend
|
1756 |
+
jQuery(window).on("wpmLoad", function () {
|
1757 |
+
|
1758 |
+
wpmDataLayer.products = wpmDataLayer.products || {}
|
1759 |
+
// wpmDataLayer.products = {14: 'x', 31: 'x', 16: 'x', 22: 'x', 40: 'x'};
|
1760 |
+
|
1761 |
+
// scan page for add-to-cart= links
|
1762 |
+
let productIds = wpm.getAddToCartLinkProductIds()
|
1763 |
+
|
1764 |
+
wpm.getProductsFromBackend(productIds)
|
1765 |
+
})
|
1766 |
+
|
1767 |
+
/**
|
1768 |
+
* Save the referrer into a cookie
|
1769 |
+
*/
|
1770 |
+
|
1771 |
+
jQuery(window).on("wpmLoad", function () {
|
1772 |
+
|
1773 |
+
// can't use session storage as we can't read it from the server
|
1774 |
+
if (!wpm.getCookie("wpmReferrer")) {
|
1775 |
+
|
1776 |
+
if (document.referrer) {
|
1777 |
+
let referrerUrl = new URL(document.referrer)
|
1778 |
+
let referrerHostname = referrerUrl.hostname
|
1779 |
+
|
1780 |
+
if (referrerHostname !== window.location.host) {
|
1781 |
+
wpm.setCookie("wpmReferrer", referrerHostname)
|
1782 |
+
} else {
|
1783 |
+
wpm.setCookie("wpmReferrer", "")
|
1784 |
+
}
|
1785 |
+
|
1786 |
+
} else {
|
1787 |
+
wpm.setCookie("wpmReferrer", "")
|
1788 |
+
}
|
1789 |
+
}
|
1790 |
+
})
|
1791 |
+
|
1792 |
+
|
1793 |
+
/**
|
1794 |
+
* Create our own load event in order to better handle script flow execution when JS "optimizers" shuffle the code.
|
1795 |
+
*/
|
1796 |
+
|
1797 |
+
jQuery(window).on("wpmLoad", function () {
|
1798 |
+
try {
|
1799 |
+
if (typeof wpmDataLayer != "undefined" && !wpmDataLayer?.wpmLoadFired) {
|
1800 |
+
|
1801 |
+
jQuery(document).trigger("wpmLoadAlways")
|
1802 |
+
|
1803 |
+
if ("product" === wpmDataLayer.shop.page_type && wpmDataLayer.shop.product_type !== "variable" && wpm.getMainProductIdFromProductPage()) {
|
1804 |
+
|
1805 |
+
let product = wpm.getProductDataForViewItemEvent(wpm.getMainProductIdFromProductPage())
|
1806 |
+
jQuery(document).trigger("wpmViewItem", product)
|
1807 |
+
|
1808 |
+
} else if ("product_category" === wpmDataLayer.shop.page_type) {
|
1809 |
+
|
1810 |
+
jQuery(document).trigger("wpmCategory")
|
1811 |
+
|
1812 |
+
} else if ("search" === wpmDataLayer.shop.page_type) {
|
1813 |
+
|
1814 |
+
jQuery(document).trigger("wpmSearch")
|
1815 |
+
|
1816 |
+
} else if ("cart" === wpmDataLayer.shop.page_type) {
|
1817 |
+
|
1818 |
+
jQuery(document).trigger("wpmViewCart")
|
1819 |
+
|
1820 |
+
} else if ("order_received_page" === wpmDataLayer.shop.page_type && wpmDataLayer.order) {
|
1821 |
+
|
1822 |
+
if (!wpm.isOrderIdStored(wpmDataLayer.order.id)) {
|
1823 |
+
|
1824 |
+
jQuery(document).trigger("wpmOrderReceivedPage")
|
1825 |
+
wpm.writeOrderIdToStorage(wpmDataLayer.order.id)
|
1826 |
+
}
|
1827 |
+
} else {
|
1828 |
+
jQuery(document).trigger("wpmEverywhereElse")
|
1829 |
+
}
|
1830 |
+
|
1831 |
+
if (wpmDataLayer.user.id && !wpm.hasLoginEventFired()) {
|
1832 |
+
jQuery(document).trigger("wpmLogin")
|
1833 |
+
wpm.setLoginEventFired()
|
1834 |
+
}
|
1835 |
+
|
1836 |
+
/**
|
1837 |
+
* Load mini cart fragments into a wpm session storage key,
|
1838 |
+
* after the document load event.
|
1839 |
+
*/
|
1840 |
+
jQuery(document).ajaxSend(function (event, jqxhr, settings) {
|
1841 |
+
// console.log('settings.url: ' + settings.url);
|
1842 |
+
|
1843 |
+
if (settings.url.includes("get_refreshed_fragments") && sessionStorage) {
|
1844 |
+
if (!sessionStorage.getItem("wpmMiniCartActive")) {
|
1845 |
+
sessionStorage.setItem("wpmMiniCartActive", JSON.stringify(true))
|
1846 |
+
}
|
1847 |
+
}
|
1848 |
+
})
|
1849 |
+
|
1850 |
+
wpmDataLayer.wpmLoadFired = true
|
1851 |
+
}
|
1852 |
+
|
1853 |
+
} catch (e) {
|
1854 |
+
console.error(e)
|
1855 |
+
}
|
1856 |
+
})
|
1857 |
+
|
1858 |
+
// jQuery(window).on("load", function () {
|
1859 |
+
// jQuery(document).trigger("wpmLoad", {})
|
1860 |
+
// })
|
1861 |
+
|
1862 |
+
jQuery(window).on("wpmPreLoadPixels", function () {
|
1863 |
+
|
1864 |
+
if (wpmDataLayer?.shop?.cookie_consent_mgmt?.explicit_consent) {
|
1865 |
+
wpm.updateConsentCookieValues(true)
|
1866 |
+
}
|
1867 |
+
jQuery(document).trigger("wpmLoadPixels", {})
|
1868 |
+
})
|
1869 |
+
|
1870 |
+
|
1871 |
+
/**
|
1872 |
+
* Events that only work after document ready state,
|
1873 |
+
* such as jQuery(".single_variation_wrap").on("show_variation", function(){})
|
1874 |
+
*/
|
1875 |
+
|
1876 |
+
jQuery(function () {
|
1877 |
+
|
1878 |
+
/**
|
1879 |
+
* Fired when the user selects all the required dropdowns / attributes
|
1880 |
+
* Can only be hooked into after document ready
|
1881 |
+
* https://stackoverflow.com/a/27849208/4688612
|
1882 |
+
* https://stackoverflow.com/a/65065335/4688612
|
1883 |
+
*/
|
1884 |
+
jQuery(".single_variation_wrap").on("show_variation", function (event, variation) {
|
1885 |
+
|
1886 |
+
try {
|
1887 |
+
let productId = getIdBasedOndVariationsOutputSetting(variation.variation_id)
|
1888 |
+
|
1889 |
+
if (!productId) throw Error("Wasn't able to retrieve a productId")
|
1890 |
+
|
1891 |
+
if (wpmDataLayer.products && wpmDataLayer.products[productId]) {
|
1892 |
+
|
1893 |
+
// console.log('productId: ' + productId);
|
1894 |
+
|
1895 |
+
let product = wpm.getProductDetailsFormattedForEvent(productId)
|
1896 |
+
|
1897 |
+
jQuery(document).trigger("wpmViewItem", product)
|
1898 |
+
}
|
1899 |
+
} catch (e) {
|
1900 |
+
console.error(e)
|
1901 |
+
}
|
1902 |
+
})
|
1903 |
+
|
1904 |
+
|
1905 |
+
})
|
languages/woocommerce-google-adwords-conversion-tracking-tag.pot
CHANGED
@@ -2,21 +2,21 @@
|
|
2 |
# This file is distributed under the GNU General Public License v3.0.
|
3 |
msgid ""
|
4 |
msgstr ""
|
5 |
-
"Project-Id-Version: WooCommerce Pixel Manager 1.
|
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-
|
13 |
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
|
14 |
"X-Generator: WP-CLI 2.6.0\n"
|
15 |
"X-Domain: woocommerce-google-adwords-conversion-tracking-tag\n"
|
16 |
|
17 |
#. Plugin Name of the plugin
|
18 |
-
#: wgact.php:
|
19 |
-
#: wgact.php:
|
20 |
msgid "WooCommerce Pixel Manager"
|
21 |
msgstr ""
|
22 |
|
@@ -36,222 +36,222 @@ msgstr ""
|
|
36 |
msgid "https://sweetcode.com"
|
37 |
msgstr ""
|
38 |
|
39 |
-
#: classes/admin/class-admin.php:
|
40 |
-
#: classes/admin/class-admin.php:
|
41 |
msgid "Pixel Manager"
|
42 |
msgstr ""
|
43 |
|
44 |
-
#: classes/admin/class-admin.php:
|
45 |
msgid "Main"
|
46 |
msgstr ""
|
47 |
|
48 |
-
#: classes/admin/class-admin.php:
|
49 |
msgid "Google"
|
50 |
msgstr ""
|
51 |
|
52 |
-
#: classes/admin/class-admin.php:
|
53 |
msgid "Google Ads Conversion ID"
|
54 |
msgstr ""
|
55 |
|
56 |
-
#: classes/admin/class-admin.php:
|
57 |
msgid "Google Ads Purchase Conversion Label"
|
58 |
msgstr ""
|
59 |
|
60 |
-
#: classes/admin/class-admin.php:
|
61 |
msgid "Google Analytics UA"
|
62 |
msgstr ""
|
63 |
|
64 |
-
#: classes/admin/class-admin.php:
|
65 |
msgid "Google Analytics 4"
|
66 |
msgstr ""
|
67 |
|
68 |
-
#: classes/admin/class-admin.php:
|
69 |
msgid "Google Optimize"
|
70 |
msgstr ""
|
71 |
|
72 |
-
#: classes/admin/class-admin.php:
|
73 |
-
msgid "
|
74 |
msgstr ""
|
75 |
|
76 |
-
#: classes/admin/class-admin.php:
|
77 |
-
msgid "
|
78 |
msgstr ""
|
79 |
|
80 |
-
#: classes/admin/class-admin.php:
|
81 |
msgid "more pixels"
|
82 |
msgstr ""
|
83 |
|
84 |
-
#: classes/admin/class-admin.php:
|
85 |
msgid "Microsoft Advertising UET tag ID"
|
86 |
msgstr ""
|
87 |
|
88 |
-
#: classes/admin/class-admin.php:
|
89 |
msgid "Twitter pixel ID"
|
90 |
msgstr ""
|
91 |
|
92 |
-
#: classes/admin/class-admin.php:
|
93 |
msgid "Pinterest pixel ID"
|
94 |
msgstr ""
|
95 |
|
96 |
-
#: classes/admin/class-admin.php:
|
97 |
msgid "Snapchat pixel ID"
|
98 |
msgstr ""
|
99 |
|
100 |
-
#: classes/admin/class-admin.php:
|
101 |
msgid "TikTok pixel ID"
|
102 |
msgstr ""
|
103 |
|
104 |
-
#: classes/admin/class-admin.php:
|
105 |
msgid "Hotjar site ID"
|
106 |
msgstr ""
|
107 |
|
108 |
-
#: classes/admin/class-admin.php:
|
109 |
msgid "Advanced"
|
110 |
msgstr ""
|
111 |
|
112 |
-
#: classes/admin/class-admin.php:
|
113 |
msgid "Order Total Logic"
|
114 |
msgstr ""
|
115 |
|
116 |
-
#: classes/admin/class-admin.php:
|
117 |
msgid "Order Duplication Prevention"
|
118 |
msgstr ""
|
119 |
|
120 |
-
#: classes/admin/class-admin.php:
|
121 |
msgid "Maximum Compatibility Mode"
|
122 |
msgstr ""
|
123 |
|
124 |
-
#: classes/admin/class-admin.php:
|
125 |
-
msgid "
|
126 |
msgstr ""
|
127 |
|
128 |
-
#: classes/admin/class-admin.php:
|
129 |
msgid "Conversion Cart Data"
|
130 |
msgstr ""
|
131 |
|
132 |
-
#: classes/admin/class-admin.php:
|
133 |
msgid "Enhanced E-Commerce"
|
134 |
msgstr ""
|
135 |
|
136 |
-
#: classes/admin/class-admin.php:
|
137 |
msgid "GA 4 API secret"
|
138 |
msgstr ""
|
139 |
|
140 |
-
#: classes/admin/class-admin.php:
|
141 |
msgid "Enhanced Link Attribution"
|
142 |
msgstr ""
|
143 |
|
144 |
-
#: classes/admin/class-admin.php:
|
145 |
msgid "Google User ID"
|
146 |
msgstr ""
|
147 |
|
148 |
-
#: classes/admin/class-admin.php:
|
149 |
msgid "Google Ads Enhanced Conversions"
|
150 |
msgstr ""
|
151 |
|
152 |
-
#: classes/admin/class-admin.php:
|
153 |
msgid "Google Ads Phone Conversion Number"
|
154 |
msgstr ""
|
155 |
|
156 |
-
#: classes/admin/class-admin.php:
|
157 |
msgid "Google Ads Phone Conversion Label"
|
158 |
msgstr ""
|
159 |
|
160 |
-
#: classes/admin/class-admin.php:
|
161 |
msgid "Cookie Consent Management"
|
162 |
msgstr ""
|
163 |
|
164 |
-
#: classes/admin/class-admin.php:
|
165 |
msgid "Google Consent Mode"
|
166 |
msgstr ""
|
167 |
|
168 |
-
#: classes/admin/class-admin.php:
|
169 |
msgid "Google Consent Regions"
|
170 |
msgstr ""
|
171 |
|
172 |
-
#: classes/admin/class-admin.php:
|
173 |
msgid "Explicit Consent Mode"
|
174 |
msgstr ""
|
175 |
|
176 |
-
#: classes/admin/class-admin.php:
|
177 |
msgid "Borlabs Cookie support"
|
178 |
msgstr ""
|
179 |
|
180 |
-
#: classes/admin/class-admin.php:
|
181 |
msgid "Cookiebot support"
|
182 |
msgstr ""
|
183 |
|
184 |
-
#: classes/admin/class-admin.php:
|
185 |
msgid "Complianz GDPR support"
|
186 |
msgstr ""
|
187 |
|
188 |
-
#: classes/admin/class-admin.php:
|
189 |
msgid "Cookie Notice support"
|
190 |
msgstr ""
|
191 |
|
192 |
-
#: classes/admin/class-admin.php:
|
193 |
msgid "Cookie Script support"
|
194 |
msgstr ""
|
195 |
|
196 |
-
#: classes/admin/class-admin.php:
|
197 |
msgid "GDPR Cookie Compliance support"
|
198 |
msgstr ""
|
199 |
|
200 |
-
#: classes/admin/class-admin.php:
|
201 |
msgid "GDPR Cookie Consent support"
|
202 |
msgstr ""
|
203 |
|
204 |
-
#: classes/admin/class-admin.php:
|
205 |
-
msgid "
|
206 |
msgstr ""
|
207 |
|
208 |
-
#: classes/admin/class-admin.php:
|
209 |
-
msgid "
|
210 |
msgstr ""
|
211 |
|
212 |
-
#: classes/admin/class-admin.php:
|
213 |
-
msgid "
|
214 |
msgstr ""
|
215 |
|
216 |
-
#: classes/admin/class-admin.php:
|
217 |
-
msgid "
|
218 |
msgstr ""
|
219 |
|
220 |
-
#: classes/admin/class-admin.php:
|
221 |
-
#: classes/admin/class-admin.php:
|
222 |
-
#: classes/admin/class-admin.php:
|
223 |
msgid "Dynamic Remarketing"
|
224 |
msgstr ""
|
225 |
|
226 |
-
#: classes/admin/class-admin.php:
|
227 |
msgid "Product Identifier"
|
228 |
msgstr ""
|
229 |
|
230 |
-
#: classes/admin/class-admin.php:
|
231 |
msgid "Variations output"
|
232 |
msgstr ""
|
233 |
|
234 |
-
#: classes/admin/class-admin.php:
|
235 |
msgid "Google Business Vertical"
|
236 |
msgstr ""
|
237 |
|
238 |
-
#: classes/admin/class-admin.php:1015
|
239 |
#: classes/admin/class-admin.php:1024
|
|
|
240 |
msgid "Support"
|
241 |
msgstr ""
|
242 |
|
243 |
-
#: classes/admin/class-admin.php:
|
244 |
-
#: classes/admin/class-admin.php:
|
245 |
msgid "Author"
|
246 |
msgstr ""
|
247 |
|
248 |
-
#: classes/admin/class-admin.php:
|
249 |
msgid ""
|
250 |
"It looks like you are using some sort of ad or script blocker which is blocking the script and CSS files of this plugin.\n"
|
251 |
" In order for the plugin to work properly you need to disable the script blocker."
|
252 |
msgstr ""
|
253 |
|
254 |
-
#: classes/admin/class-admin.php:
|
255 |
#: classes/admin/class-notifications.php:31
|
256 |
#: classes/admin/class-notifications.php:73
|
257 |
#: classes/admin/class-notifications.php:114
|
@@ -259,413 +259,441 @@ msgstr ""
|
|
259 |
msgid "Learn more"
|
260 |
msgstr ""
|
261 |
|
262 |
-
#: classes/admin/class-admin.php:
|
263 |
msgid "Profit Driven Marketing by SweetCode"
|
264 |
msgstr ""
|
265 |
|
266 |
-
#: classes/admin/class-admin.php:
|
267 |
msgid "Visit us here:"
|
268 |
msgstr ""
|
269 |
|
270 |
-
#: classes/admin/class-admin.php:
|
271 |
msgid "Contacting Support"
|
272 |
msgstr ""
|
273 |
|
274 |
-
#: classes/admin/class-admin.php:
|
275 |
msgid "Debug Information"
|
276 |
msgstr ""
|
277 |
|
278 |
-
#: classes/admin/class-admin.php:
|
279 |
msgid "copy to clipboard"
|
280 |
msgstr ""
|
281 |
|
282 |
-
#: classes/admin/class-admin.php:
|
283 |
msgid "Translations"
|
284 |
msgstr ""
|
285 |
|
286 |
-
#: classes/admin/class-admin.php:
|
287 |
msgid "If you want to participate improving the translations of this plugin into your language, please follow this link:"
|
288 |
msgstr ""
|
289 |
|
290 |
-
#: classes/admin/class-admin.php:
|
291 |
msgid "Post a support request in the WordPress support forum here: "
|
292 |
msgstr ""
|
293 |
|
294 |
-
#: classes/admin/class-admin.php:
|
295 |
msgid "Support forum"
|
296 |
msgstr ""
|
297 |
|
298 |
-
#: classes/admin/class-admin.php:
|
299 |
msgid "(Never post the debug or other sensitive information to the support forum. Instead send us the information by email.)"
|
300 |
msgstr ""
|
301 |
|
302 |
-
#: classes/admin/class-admin.php:
|
303 |
msgid "Or send us an email to the following address: "
|
304 |
msgstr ""
|
305 |
|
306 |
-
#: classes/admin/class-admin.php:
|
307 |
msgid "Send us your support request through the WooCommerce.com dashboard: "
|
308 |
msgstr ""
|
309 |
|
310 |
-
#: classes/admin/class-admin.php:
|
311 |
msgid "More details about the developer of this plugin: "
|
312 |
msgstr ""
|
313 |
|
314 |
-
#: classes/admin/class-admin.php:
|
315 |
msgid "Developer: SweetCode"
|
316 |
msgstr ""
|
317 |
|
318 |
-
#: classes/admin/class-admin.php:
|
319 |
msgid "Website: "
|
320 |
msgstr ""
|
321 |
|
322 |
-
#: classes/admin/class-admin.php:
|
323 |
msgid "The Google Analytics Universal property ID looks like this:"
|
324 |
msgstr ""
|
325 |
|
326 |
-
#: classes/admin/class-admin.php:
|
327 |
msgid "The Google Analytics 4 measurement ID looks like this:"
|
328 |
msgstr ""
|
329 |
|
330 |
-
#: classes/admin/class-admin.php:
|
331 |
msgid "The conversion ID looks similar to this:"
|
332 |
msgstr ""
|
333 |
|
334 |
-
#: classes/admin/class-admin.php:
|
335 |
msgid "The purchase conversion label looks similar to this:"
|
336 |
msgstr ""
|
337 |
|
338 |
-
#: classes/admin/class-admin.php:
|
339 |
-
#: classes/admin/class-admin.php:
|
340 |
msgid "Requires an active Google Ads Conversion ID"
|
341 |
msgstr ""
|
342 |
|
343 |
-
#: classes/admin/class-admin.php:
|
344 |
msgid "The Google Optimize container ID looks like this:"
|
345 |
msgstr ""
|
346 |
|
347 |
-
#: classes/admin/class-admin.php:
|
348 |
-
msgid "The
|
349 |
msgstr ""
|
350 |
|
351 |
-
#: classes/admin/class-admin.php:
|
352 |
msgid "The Microsoft Advertising UET tag ID looks similar to this:"
|
353 |
msgstr ""
|
354 |
|
355 |
-
#: classes/admin/class-admin.php:
|
356 |
msgid "The Twitter pixel ID looks similar to this:"
|
357 |
msgstr ""
|
358 |
|
359 |
-
#: classes/admin/class-admin.php:
|
360 |
msgid "The Pinterest pixel ID looks similar to this:"
|
361 |
msgstr ""
|
362 |
|
363 |
-
#: classes/admin/class-admin.php:
|
364 |
msgid "The Snapchat pixel ID looks similar to this:"
|
365 |
msgstr ""
|
366 |
|
367 |
-
#: classes/admin/class-admin.php:
|
368 |
msgid "The TikTok pixel ID looks similar to this:"
|
369 |
msgstr ""
|
370 |
|
371 |
-
#: classes/admin/class-admin.php:
|
372 |
msgid "The Hotjar site ID looks similar to this:"
|
373 |
msgstr ""
|
374 |
|
375 |
-
#: classes/admin/class-admin.php:
|
376 |
msgid "Use order_subtotal: Doesn't include tax and shipping (default)"
|
377 |
msgstr ""
|
378 |
|
379 |
-
#: classes/admin/class-admin.php:
|
380 |
msgid "Use order_total: Includes tax and shipping"
|
381 |
msgstr ""
|
382 |
|
383 |
-
#: classes/admin/class-admin.php:
|
384 |
msgid "This is the order total amount reported back to Google Ads"
|
385 |
msgstr ""
|
386 |
|
387 |
-
#: classes/admin/class-admin.php:
|
388 |
msgid "open the documentation"
|
389 |
msgstr ""
|
390 |
|
391 |
-
#: classes/admin/class-admin.php:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
392 |
msgid "Enable Google consent mode with standard settings"
|
393 |
msgstr ""
|
394 |
|
395 |
-
#: classes/admin/class-admin.php:
|
396 |
msgid "If no region is set, then the restrictions are enabled for all regions. If you specify one or more regions, then the restrictions only apply for the specified regions."
|
397 |
msgstr ""
|
398 |
|
399 |
-
#: classes/admin/class-admin.php:
|
400 |
msgid "Enable Google Analytics enhanced e-commerce"
|
401 |
msgstr ""
|
402 |
|
403 |
-
#: classes/admin/class-admin.php:
|
404 |
-
#: classes/admin/class-admin.php:
|
405 |
-
#: classes/admin/class-admin.php:
|
406 |
msgid "You need to activate at least Google Analytics UA or Google Analytics 4"
|
407 |
msgstr ""
|
408 |
|
409 |
-
#: classes/admin/class-admin.php:
|
410 |
msgid "Google Analytics 4 activation required"
|
411 |
msgstr ""
|
412 |
|
413 |
-
#: classes/admin/class-admin.php:
|
414 |
msgid "Enhanced E-Commerce activation required"
|
415 |
msgstr ""
|
416 |
|
417 |
-
#: classes/admin/class-admin.php:
|
418 |
msgid "If enabled, purchase and refund events will be sent to Google through the measurement protocol for increased accuracy."
|
419 |
msgstr ""
|
420 |
|
421 |
-
#: classes/admin/class-admin.php:
|
422 |
msgid "Enable Google Analytics enhanced link attribution"
|
423 |
msgstr ""
|
424 |
|
425 |
-
#: classes/admin/class-admin.php:
|
426 |
msgid "Enable Google user ID"
|
427 |
msgstr ""
|
428 |
|
429 |
-
#: classes/admin/class-admin.php:
|
430 |
msgid "Enable Google Ads Enhanced Conversions"
|
431 |
msgstr ""
|
432 |
|
433 |
-
#: classes/admin/class-admin.php:
|
434 |
msgid "You need to activate Google Ads"
|
435 |
msgstr ""
|
436 |
|
437 |
-
#: classes/admin/class-admin.php:
|
438 |
msgid "The Google Ads phone conversion number must be in the same format as on the website."
|
439 |
msgstr ""
|
440 |
|
441 |
-
#: classes/admin/class-admin.php:
|
442 |
msgid "Borlabs Cookie detected. Automatic support is:"
|
443 |
msgstr ""
|
444 |
|
445 |
-
#: classes/admin/class-admin.php:
|
446 |
msgid "Cookiebot detected. Automatic support is:"
|
447 |
msgstr ""
|
448 |
|
449 |
-
#: classes/admin/class-admin.php:
|
450 |
msgid "Complianz GDPR detected. Automatic support is:"
|
451 |
msgstr ""
|
452 |
|
453 |
-
#: classes/admin/class-admin.php:
|
454 |
msgid "Cookie Notice (by hu-manity.co) detected. Automatic support is:"
|
455 |
msgstr ""
|
456 |
|
457 |
-
#: classes/admin/class-admin.php:
|
458 |
msgid "Cookie Script (by cookie-script.com) detected. Automatic support is:"
|
459 |
msgstr ""
|
460 |
|
461 |
-
#: classes/admin/class-admin.php:
|
462 |
msgid "GDPR Cookie Compliance (by Moove Agency) detected. Automatic support is:"
|
463 |
msgstr ""
|
464 |
|
465 |
-
#: classes/admin/class-admin.php:
|
466 |
msgid "GDPR Cookie Consent (by WebToffee) detected. Automatic support is:"
|
467 |
msgstr ""
|
468 |
|
469 |
-
#: classes/admin/class-admin.php:
|
470 |
msgid "Enable Explicit Consent Mode"
|
471 |
msgstr ""
|
472 |
|
473 |
-
#: classes/admin/class-admin.php:
|
474 |
msgid "Only activate the Explicit Consent Mode if you are also using a Cookie Management Platform (a cookie banner) that is compatible with this plugin. Find a list of compatible plugins in the documentation."
|
475 |
msgstr ""
|
476 |
|
477 |
-
#: classes/admin/class-admin.php:1892
|
478 |
#: classes/admin/class-admin.php:1925
|
479 |
-
#: classes/admin/class-admin.php:
|
480 |
-
#: classes/admin/class-admin.php:
|
481 |
-
|
|
|
482 |
msgstr ""
|
483 |
|
484 |
-
#: classes/admin/class-admin.php:
|
485 |
-
msgid "Send CAPI hits for anonymous visitors who likely have blocked the
|
486 |
msgstr ""
|
487 |
|
488 |
-
#: classes/admin/class-admin.php:
|
489 |
msgid "Include additional visitor's identifiers, such as IP address, email and shop ID in the CAPI hit."
|
490 |
msgstr ""
|
491 |
|
492 |
-
#: classes/admin/class-admin.php:
|
493 |
-
msgid "Enable
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
494 |
msgstr ""
|
495 |
|
496 |
-
#: classes/admin/class-admin.php:
|
497 |
msgid "Only disable order duplication prevention for testing. Remember to re-enable the setting once done."
|
498 |
msgstr ""
|
499 |
|
500 |
-
#: classes/admin/class-admin.php:
|
501 |
msgid "Enable the maximum compatibility mode"
|
502 |
msgstr ""
|
503 |
|
504 |
-
#: classes/admin/class-admin.php:
|
505 |
msgid "Advanced order duplication prevention is "
|
506 |
msgstr ""
|
507 |
|
508 |
-
#: classes/admin/class-admin.php:
|
509 |
msgid "Basic order duplication prevention is "
|
510 |
msgstr ""
|
511 |
|
512 |
-
#: classes/admin/class-admin.php:
|
513 |
msgid "Enable dynamic remarketing audience collection"
|
514 |
msgstr ""
|
515 |
|
516 |
-
#: classes/admin/class-admin.php:
|
517 |
msgid "You need to choose the correct product identifier setting in order to match the product identifiers in the product feeds."
|
518 |
msgstr ""
|
519 |
|
520 |
-
#: classes/admin/class-admin.php:
|
521 |
msgid "Enable variations output"
|
522 |
msgstr ""
|
523 |
|
524 |
-
#: classes/admin/class-admin.php:
|
525 |
msgid "In order for this to work you need to upload your product feed including product variations and the item_group_id. Disable it, if you choose only to upload the parent product for variable products."
|
526 |
msgstr ""
|
527 |
|
528 |
-
#: classes/admin/class-admin.php:
|
529 |
msgid "Retail"
|
530 |
msgstr ""
|
531 |
|
532 |
-
#: classes/admin/class-admin.php:
|
533 |
msgid "Education"
|
534 |
msgstr ""
|
535 |
|
536 |
-
#: classes/admin/class-admin.php:
|
537 |
msgid "Hotels and rentals"
|
538 |
msgstr ""
|
539 |
|
540 |
-
#: classes/admin/class-admin.php:
|
541 |
msgid "Jobs"
|
542 |
msgstr ""
|
543 |
|
544 |
-
#: classes/admin/class-admin.php:
|
545 |
msgid "Local deals"
|
546 |
msgstr ""
|
547 |
|
548 |
-
#: classes/admin/class-admin.php:
|
549 |
msgid "Real estate"
|
550 |
msgstr ""
|
551 |
|
552 |
-
#: classes/admin/class-admin.php:
|
553 |
msgid "Custom"
|
554 |
msgstr ""
|
555 |
|
556 |
-
#: classes/admin/class-admin.php:
|
557 |
msgid "ID of your Google Merchant Center account. It looks like this: 12345678"
|
558 |
msgstr ""
|
559 |
|
560 |
-
#: classes/admin/class-admin.php:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
561 |
msgid "post ID (default)"
|
562 |
msgstr ""
|
563 |
|
564 |
-
#: classes/admin/class-admin.php:
|
565 |
msgid "SKU"
|
566 |
msgstr ""
|
567 |
|
568 |
-
#: classes/admin/class-admin.php:
|
569 |
msgid "ID for the WooCommerce Google Product Feed. Outputs the post ID with woocommerce_gpf_ prefix *"
|
570 |
msgstr ""
|
571 |
|
572 |
-
#: classes/admin/class-admin.php:
|
573 |
msgid "ID for the WooCommerce Google Listings & Ads Plugin. Outputs the post ID with gla_ prefix **"
|
574 |
msgstr ""
|
575 |
|
576 |
-
#: classes/admin/class-admin.php:
|
577 |
msgid "Choose a product identifier."
|
578 |
msgstr ""
|
579 |
|
580 |
-
#: classes/admin/class-admin.php:
|
581 |
msgid "* This is for users of the WooCommerce Google Product Feed Plugin"
|
582 |
msgstr ""
|
583 |
|
584 |
-
#: classes/admin/class-admin.php:
|
585 |
msgid "** This is for users of the WooCommerce Google Listings & Ads Plugin"
|
586 |
msgstr ""
|
587 |
|
588 |
-
#: classes/admin/class-admin.php:
|
589 |
msgid "beta"
|
590 |
msgstr ""
|
591 |
|
592 |
-
#: classes/admin/class-admin.php:
|
593 |
-
#: classes/admin/class-admin.php:
|
594 |
msgid "active"
|
595 |
msgstr ""
|
596 |
|
597 |
-
#: classe
|
2 |
# This file is distributed under the GNU General Public License v3.0.
|
3 |
msgid ""
|
4 |
msgstr ""
|
5 |
+
"Project-Id-Version: WooCommerce Pixel Manager 1.15.0\n"
|
6 |
"Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/src\n"
|
7 |
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
8 |
"Language-Team: LANGUAGE <LL@li.org>\n"
|
9 |
"MIME-Version: 1.0\n"
|
10 |
"Content-Type: text/plain; charset=UTF-8\n"
|
11 |
"Content-Transfer-Encoding: 8bit\n"
|
12 |
+
"POT-Creation-Date: 2022-03-15T05:14:58+00:00\n"
|
13 |
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
|
14 |
"X-Generator: WP-CLI 2.6.0\n"
|
15 |
"X-Domain: woocommerce-google-adwords-conversion-tracking-tag\n"
|
16 |
|
17 |
#. Plugin Name of the plugin
|
18 |
+
#: wgact.php:201
|
19 |
+
#: wgact.php:202
|
20 |
msgid "WooCommerce Pixel Manager"
|
21 |
msgstr ""
|
22 |
|
36 |
msgid "https://sweetcode.com"
|
37 |
msgstr ""
|
38 |
|
39 |
+
#: classes/admin/class-admin.php:201
|
40 |
+
#: classes/admin/class-admin.php:202
|
41 |
msgid "Pixel Manager"
|
42 |
msgstr ""
|
43 |
|
44 |
+
#: classes/admin/class-admin.php:232
|
45 |
msgid "Main"
|
46 |
msgstr ""
|
47 |
|
48 |
+
#: classes/admin/class-admin.php:253
|
49 |
msgid "Google"
|
50 |
msgstr ""
|
51 |
|
52 |
+
#: classes/admin/class-admin.php:276
|
53 |
msgid "Google Ads Conversion ID"
|
54 |
msgstr ""
|
55 |
|
56 |
+
#: classes/admin/class-admin.php:288
|
57 |
msgid "Google Ads Purchase Conversion Label"
|
58 |
msgstr ""
|
59 |
|
60 |
+
#: classes/admin/class-admin.php:299
|
61 |
msgid "Google Analytics UA"
|
62 |
msgstr ""
|
63 |
|
64 |
+
#: classes/admin/class-admin.php:310
|
65 |
msgid "Google Analytics 4"
|
66 |
msgstr ""
|
67 |
|
68 |
+
#: classes/admin/class-admin.php:321
|
69 |
msgid "Google Optimize"
|
70 |
msgstr ""
|
71 |
|
72 |
+
#: classes/admin/class-admin.php:333
|
73 |
+
msgid "Facebook"
|
74 |
msgstr ""
|
75 |
|
76 |
+
#: classes/admin/class-admin.php:356
|
77 |
+
msgid "Facebook pixel ID"
|
78 |
msgstr ""
|
79 |
|
80 |
+
#: classes/admin/class-admin.php:368
|
81 |
msgid "more pixels"
|
82 |
msgstr ""
|
83 |
|
84 |
+
#: classes/admin/class-admin.php:393
|
85 |
msgid "Microsoft Advertising UET tag ID"
|
86 |
msgstr ""
|
87 |
|
88 |
+
#: classes/admin/class-admin.php:405
|
89 |
msgid "Twitter pixel ID"
|
90 |
msgstr ""
|
91 |
|
92 |
+
#: classes/admin/class-admin.php:417
|
93 |
msgid "Pinterest pixel ID"
|
94 |
msgstr ""
|
95 |
|
96 |
+
#: classes/admin/class-admin.php:429
|
97 |
msgid "Snapchat pixel ID"
|
98 |
msgstr ""
|
99 |
|
100 |
+
#: classes/admin/class-admin.php:441
|
101 |
msgid "TikTok pixel ID"
|
102 |
msgstr ""
|
103 |
|
104 |
+
#: classes/admin/class-admin.php:454
|
105 |
msgid "Hotjar site ID"
|
106 |
msgstr ""
|
107 |
|
108 |
+
#: classes/admin/class-admin.php:466
|
109 |
msgid "Advanced"
|
110 |
msgstr ""
|
111 |
|
112 |
+
#: classes/admin/class-admin.php:517
|
113 |
msgid "Order Total Logic"
|
114 |
msgstr ""
|
115 |
|
116 |
+
#: classes/admin/class-admin.php:529
|
117 |
msgid "Order Duplication Prevention"
|
118 |
msgstr ""
|
119 |
|
120 |
+
#: classes/admin/class-admin.php:541
|
121 |
msgid "Maximum Compatibility Mode"
|
122 |
msgstr ""
|
123 |
|
124 |
+
#: classes/admin/class-admin.php:574
|
125 |
+
msgid "gtag Deactivation"
|
126 |
msgstr ""
|
127 |
|
128 |
+
#: classes/admin/class-admin.php:587
|
129 |
msgid "Conversion Cart Data"
|
130 |
msgstr ""
|
131 |
|
132 |
+
#: classes/admin/class-admin.php:600
|
133 |
msgid "Enhanced E-Commerce"
|
134 |
msgstr ""
|
135 |
|
136 |
+
#: classes/admin/class-admin.php:612
|
137 |
msgid "GA 4 API secret"
|
138 |
msgstr ""
|
139 |
|
140 |
+
#: classes/admin/class-admin.php:625
|
141 |
msgid "Enhanced Link Attribution"
|
142 |
msgstr ""
|
143 |
|
144 |
+
#: classes/admin/class-admin.php:638
|
145 |
msgid "Google User ID"
|
146 |
msgstr ""
|
147 |
|
148 |
+
#: classes/admin/class-admin.php:650
|
149 |
msgid "Google Ads Enhanced Conversions"
|
150 |
msgstr ""
|
151 |
|
152 |
+
#: classes/admin/class-admin.php:664
|
153 |
msgid "Google Ads Phone Conversion Number"
|
154 |
msgstr ""
|
155 |
|
156 |
+
#: classes/admin/class-admin.php:676
|
157 |
msgid "Google Ads Phone Conversion Label"
|
158 |
msgstr ""
|
159 |
|
160 |
+
#: classes/admin/class-admin.php:689
|
161 |
msgid "Cookie Consent Management"
|
162 |
msgstr ""
|
163 |
|
164 |
+
#: classes/admin/class-admin.php:712
|
165 |
msgid "Google Consent Mode"
|
166 |
msgstr ""
|
167 |
|
168 |
+
#: classes/admin/class-admin.php:724
|
169 |
msgid "Google Consent Regions"
|
170 |
msgstr ""
|
171 |
|
172 |
+
#: classes/admin/class-admin.php:736
|
173 |
msgid "Explicit Consent Mode"
|
174 |
msgstr ""
|
175 |
|
176 |
+
#: classes/admin/class-admin.php:749
|
177 |
msgid "Borlabs Cookie support"
|
178 |
msgstr ""
|
179 |
|
180 |
+
#: classes/admin/class-admin.php:763
|
181 |
msgid "Cookiebot support"
|
182 |
msgstr ""
|
183 |
|
184 |
+
#: classes/admin/class-admin.php:777
|
185 |
msgid "Complianz GDPR support"
|
186 |
msgstr ""
|
187 |
|
188 |
+
#: classes/admin/class-admin.php:791
|
189 |
msgid "Cookie Notice support"
|
190 |
msgstr ""
|
191 |
|
192 |
+
#: classes/admin/class-admin.php:805
|
193 |
msgid "Cookie Script support"
|
194 |
msgstr ""
|
195 |
|
196 |
+
#: classes/admin/class-admin.php:819
|
197 |
msgid "GDPR Cookie Compliance support"
|
198 |
msgstr ""
|
199 |
|
200 |
+
#: classes/admin/class-admin.php:833
|
201 |
msgid "GDPR Cookie Consent support"
|
202 |
msgstr ""
|
203 |
|
204 |
+
#: classes/admin/class-admin.php:866
|
205 |
+
msgid "Facebook CAPI: token"
|
206 |
msgstr ""
|
207 |
|
208 |
+
#: classes/admin/class-admin.php:878
|
209 |
+
msgid "Facebook CAPI: process anonymous hits"
|
210 |
msgstr ""
|
211 |
|
212 |
+
#: classes/admin/class-admin.php:890
|
213 |
+
msgid "Facebook CAPI: send additional visitor identifiers"
|
214 |
msgstr ""
|
215 |
|
216 |
+
#: classes/admin/class-admin.php:902
|
217 |
+
msgid "Facebook Microdata Tags for Catalogues"
|
218 |
msgstr ""
|
219 |
|
220 |
+
#: classes/admin/class-admin.php:914
|
221 |
+
#: classes/admin/class-admin.php:927
|
222 |
+
#: classes/admin/class-admin.php:974
|
223 |
msgid "Dynamic Remarketing"
|
224 |
msgstr ""
|
225 |
|
226 |
+
#: classes/admin/class-admin.php:986
|
227 |
msgid "Product Identifier"
|
228 |
msgstr ""
|
229 |
|
230 |
+
#: classes/admin/class-admin.php:998
|
231 |
msgid "Variations output"
|
232 |
msgstr ""
|
233 |
|
234 |
+
#: classes/admin/class-admin.php:1011
|
235 |
msgid "Google Business Vertical"
|
236 |
msgstr ""
|
237 |
|
|
|
238 |
#: classes/admin/class-admin.php:1024
|
239 |
+
#: classes/admin/class-admin.php:1033
|
240 |
msgid "Support"
|
241 |
msgstr ""
|
242 |
|
243 |
+
#: classes/admin/class-admin.php:1041
|
244 |
+
#: classes/admin/class-admin.php:1051
|
245 |
msgid "Author"
|
246 |
msgstr ""
|
247 |
|
248 |
+
#: classes/admin/class-admin.php:1087
|
249 |
msgid ""
|
250 |
"It looks like you are using some sort of ad or script blocker which is blocking the script and CSS files of this plugin.\n"
|
251 |
" In order for the plugin to work properly you need to disable the script blocker."
|
252 |
msgstr ""
|
253 |
|
254 |
+
#: classes/admin/class-admin.php:1094
|
255 |
#: classes/admin/class-notifications.php:31
|
256 |
#: classes/admin/class-notifications.php:73
|
257 |
#: classes/admin/class-notifications.php:114
|
259 |
msgid "Learn more"
|
260 |
msgstr ""
|
261 |
|
262 |
+
#: classes/admin/class-admin.php:1139
|
263 |
msgid "Profit Driven Marketing by SweetCode"
|
264 |
msgstr ""
|
265 |
|
266 |
+
#: classes/admin/class-admin.php:1164
|
267 |
msgid "Visit us here:"
|
268 |
msgstr ""
|
269 |
|
270 |
+
#: classes/admin/class-admin.php:1209
|
271 |
msgid "Contacting Support"
|
272 |
msgstr ""
|
273 |
|
274 |
+
#: classes/admin/class-admin.php:1223
|
275 |
msgid "Debug Information"
|
276 |
msgstr ""
|
277 |
|
278 |
+
#: classes/admin/class-admin.php:1232
|
279 |
msgid "copy to clipboard"
|
280 |
msgstr ""
|
281 |
|
282 |
+
#: classes/admin/class-admin.php:1246
|
283 |
msgid "Translations"
|
284 |
msgstr ""
|
285 |
|
286 |
+
#: classes/admin/class-admin.php:1247
|
287 |
msgid "If you want to participate improving the translations of this plugin into your language, please follow this link:"
|
288 |
msgstr ""
|
289 |
|
290 |
+
#: classes/admin/class-admin.php:1265
|
291 |
msgid "Post a support request in the WordPress support forum here: "
|
292 |
msgstr ""
|
293 |
|
294 |
+
#: classes/admin/class-admin.php:1268
|
295 |
msgid "Support forum"
|
296 |
msgstr ""
|
297 |
|
298 |
+
#: classes/admin/class-admin.php:1272
|
299 |
msgid "(Never post the debug or other sensitive information to the support forum. Instead send us the information by email.)"
|
300 |
msgstr ""
|
301 |
|
302 |
+
#: classes/admin/class-admin.php:1275
|
303 |
msgid "Or send us an email to the following address: "
|
304 |
msgstr ""
|
305 |
|
306 |
+
#: classes/admin/class-admin.php:1291
|
307 |
msgid "Send us your support request through the WooCommerce.com dashboard: "
|
308 |
msgstr ""
|
309 |
|
310 |
+
#: classes/admin/class-admin.php:1305
|
311 |
msgid "More details about the developer of this plugin: "
|
312 |
msgstr ""
|
313 |
|
314 |
+
#: classes/admin/class-admin.php:1308
|
315 |
msgid "Developer: SweetCode"
|
316 |
msgstr ""
|
317 |
|
318 |
+
#: classes/admin/class-admin.php:1310
|
319 |
msgid "Website: "
|
320 |
msgstr ""
|
321 |
|
322 |
+
#: classes/admin/class-admin.php:1333
|
323 |
msgid "The Google Analytics Universal property ID looks like this:"
|
324 |
msgstr ""
|
325 |
|
326 |
+
#: classes/admin/class-admin.php:1349
|
327 |
msgid "The Google Analytics 4 measurement ID looks like this:"
|
328 |
msgstr ""
|
329 |
|
330 |
+
#: classes/admin/class-admin.php:1365
|
331 |
msgid "The conversion ID looks similar to this:"
|
332 |
msgstr ""
|
333 |
|
334 |
+
#: classes/admin/class-admin.php:1381
|
335 |
msgid "The purchase conversion label looks similar to this:"
|
336 |
msgstr ""
|
337 |
|
338 |
+
#: classes/admin/class-admin.php:1385
|
339 |
+
#: classes/admin/class-admin.php:2138
|
340 |
msgid "Requires an active Google Ads Conversion ID"
|
341 |
msgstr ""
|
342 |
|
343 |
+
#: classes/admin/class-admin.php:1403
|
344 |
msgid "The Google Optimize container ID looks like this:"
|
345 |
msgstr ""
|
346 |
|
347 |
+
#: classes/admin/class-admin.php:1419
|
348 |
+
msgid "The Facebook pixel ID looks similar to this:"
|
349 |
msgstr ""
|
350 |
|
351 |
+
#: classes/admin/class-admin.php:1437
|
352 |
msgid "The Microsoft Advertising UET tag ID looks similar to this:"
|
353 |
msgstr ""
|
354 |
|
355 |
+
#: classes/admin/class-admin.php:1456
|
356 |
msgid "The Twitter pixel ID looks similar to this:"
|
357 |
msgstr ""
|
358 |
|
359 |
+
#: classes/admin/class-admin.php:1475
|
360 |
msgid "The Pinterest pixel ID looks similar to this:"
|
361 |
msgstr ""
|
362 |
|
363 |
+
#: classes/admin/class-admin.php:1494
|
364 |
msgid "The Snapchat pixel ID looks similar to this:"
|
365 |
msgstr ""
|
366 |
|
367 |
+
#: classes/admin/class-admin.php:1513
|
368 |
msgid "The TikTok pixel ID looks similar to this:"
|
369 |
msgstr ""
|
370 |
|
371 |
+
#: classes/admin/class-admin.php:1525
|
372 |
msgid "The Hotjar site ID looks similar to this:"
|
373 |
msgstr ""
|
374 |
|
375 |
+
#: classes/admin/class-admin.php:1535
|
376 |
msgid "Use order_subtotal: Doesn't include tax and shipping (default)"
|
377 |
msgstr ""
|
378 |
|
379 |
+
#: classes/admin/class-admin.php:1542
|
380 |
msgid "Use order_total: Includes tax and shipping"
|
381 |
msgstr ""
|
382 |
|
383 |
+
#: classes/admin/class-admin.php:1545
|
384 |
msgid "This is the order total amount reported back to Google Ads"
|
385 |
msgstr ""
|
386 |
|
387 |
+
#: classes/admin/class-admin.php:1565
|
388 |
msgid "open the documentation"
|
389 |
msgstr ""
|
390 |
|
391 |
+
#: classes/admin/class-admin.php:1581
|
392 |
+
msgid "Disable gtag.js insertion, if another plugin is inserting it already"
|
393 |
+
msgstr ""
|
394 |
+
|
395 |
+
#: classes/admin/class-admin.php:1587
|
396 |
+
msgid "Only do this, if the other plugin does insert the gtag above this pixel. If not, keep the gtag active."
|
397 |
+
msgstr ""
|
398 |
+
|
399 |
+
#: classes/admin/class-admin.php:1591
|
400 |
+
msgid "This setting is deprecated. It will be removed in future versions of the plugin. Read more about it in the documentation."
|
401 |
+
msgstr ""
|
402 |
+
|
403 |
+
#: classes/admin/class-admin.php:1609
|
404 |
msgid "Enable Google consent mode with standard settings"
|
405 |
msgstr ""
|
406 |
|
407 |
+
#: classes/admin/class-admin.php:1647
|
408 |
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."
|
409 |
msgstr ""
|
410 |
|
411 |
+
#: classes/admin/class-admin.php:1668
|
412 |
msgid "Enable Google Analytics enhanced e-commerce"
|
413 |
msgstr ""
|
414 |
|
415 |
+
#: classes/admin/class-admin.php:1679
|
416 |
+
#: classes/admin/class-admin.php:1740
|
417 |
+
#: classes/admin/class-admin.php:1770
|
418 |
msgid "You need to activate at least Google Analytics UA or Google Analytics 4"
|
419 |
msgstr ""
|
420 |
|
421 |
+
#: classes/admin/class-admin.php:1701
|
422 |
msgid "Google Analytics 4 activation required"
|
423 |
msgstr ""
|
424 |
|
425 |
+
#: classes/admin/class-admin.php:1706
|
426 |
msgid "Enhanced E-Commerce activation required"
|
427 |
msgstr ""
|
428 |
|
429 |
+
#: classes/admin/class-admin.php:1709
|
430 |
msgid "If enabled, purchase and refund events will be sent to Google through the measurement protocol for increased accuracy."
|
431 |
msgstr ""
|
432 |
|
433 |
+
#: classes/admin/class-admin.php:1724
|
434 |
msgid "Enable Google Analytics enhanced link attribution"
|
435 |
msgstr ""
|
436 |
|
437 |
+
#: classes/admin/class-admin.php:1759
|
438 |
msgid "Enable Google user ID"
|
439 |
msgstr ""
|
440 |
|
441 |
+
#: classes/admin/class-admin.php:1789
|
442 |
msgid "Enable Google Ads Enhanced Conversions"
|
443 |
msgstr ""
|
444 |
|
445 |
+
#: classes/admin/class-admin.php:1800
|
446 |
msgid "You need to activate Google Ads"
|
447 |
msgstr ""
|
448 |
|
449 |
+
#: classes/admin/class-admin.php:1820
|
450 |
msgid "The Google Ads phone conversion number must be in the same format as on the website."
|
451 |
msgstr ""
|
452 |
|
453 |
+
#: classes/admin/class-admin.php:1842
|
454 |
msgid "Borlabs Cookie detected. Automatic support is:"
|
455 |
msgstr ""
|
456 |
|
457 |
+
#: classes/admin/class-admin.php:1848
|
458 |
msgid "Cookiebot detected. Automatic support is:"
|
459 |
msgstr ""
|
460 |
|
461 |
+
#: classes/admin/class-admin.php:1854
|
462 |
msgid "Complianz GDPR detected. Automatic support is:"
|
463 |
msgstr ""
|
464 |
|
465 |
+
#: classes/admin/class-admin.php:1860
|
466 |
msgid "Cookie Notice (by hu-manity.co) detected. Automatic support is:"
|
467 |
msgstr ""
|
468 |
|
469 |
+
#: classes/admin/class-admin.php:1866
|
470 |
msgid "Cookie Script (by cookie-script.com) detected. Automatic support is:"
|
471 |
msgstr ""
|
472 |
|
473 |
+
#: classes/admin/class-admin.php:1872
|
474 |
msgid "GDPR Cookie Compliance (by Moove Agency) detected. Automatic support is:"
|
475 |
msgstr ""
|
476 |
|
477 |
+
#: classes/admin/class-admin.php:1878
|
478 |
msgid "GDPR Cookie Consent (by WebToffee) detected. Automatic support is:"
|
479 |
msgstr ""
|
480 |
|
481 |
+
#: classes/admin/class-admin.php:1897
|
482 |
msgid "Enable Explicit Consent Mode"
|
483 |
msgstr ""
|
484 |
|
485 |
+
#: classes/admin/class-admin.php:1906
|
486 |
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."
|
487 |
msgstr ""
|
488 |
|
|
|
489 |
#: classes/admin/class-admin.php:1925
|
490 |
+
#: classes/admin/class-admin.php:1958
|
491 |
+
#: classes/admin/class-admin.php:1987
|
492 |
+
#: classes/admin/class-admin.php:2015
|
493 |
+
msgid "You need to activate the Facebook pixel"
|
494 |
msgstr ""
|
495 |
|
496 |
+
#: classes/admin/class-admin.php:1949
|
497 |
+
msgid "Send CAPI hits for anonymous visitors who likely have blocked the Facebook pixel."
|
498 |
msgstr ""
|
499 |
|
500 |
+
#: classes/admin/class-admin.php:1978
|
501 |
msgid "Include additional visitor's identifiers, such as IP address, email and shop ID in the CAPI hit."
|
502 |
msgstr ""
|
503 |
|
504 |
+
#: classes/admin/class-admin.php:2006
|
505 |
+
msgid "Enable Facebook product microdata output"
|
506 |
+
msgstr ""
|
507 |
+
|
508 |
+
#: classes/admin/class-admin.php:2031
|
509 |
+
msgid "Add the cart data to the conversion event"
|
510 |
+
msgstr ""
|
511 |
+
|
512 |
+
#: classes/admin/class-admin.php:2040
|
513 |
+
msgid "Requires an active Google Ads Conversion ID, an active Conversion Label and an active Google Merchant Center ID (aw_merchant_id)"
|
514 |
msgstr ""
|
515 |
|
516 |
+
#: classes/admin/class-admin.php:2069
|
517 |
msgid "Only disable order duplication prevention for testing. Remember to re-enable the setting once done."
|
518 |
msgstr ""
|
519 |
|
520 |
+
#: classes/admin/class-admin.php:2086
|
521 |
msgid "Enable the maximum compatibility mode"
|
522 |
msgstr ""
|
523 |
|
524 |
+
#: classes/admin/class-admin.php:2097
|
525 |
msgid "Advanced order duplication prevention is "
|
526 |
msgstr ""
|
527 |
|
528 |
+
#: classes/admin/class-admin.php:2099
|
529 |
msgid "Basic order duplication prevention is "
|
530 |
msgstr ""
|
531 |
|
532 |
+
#: classes/admin/class-admin.php:2123
|
533 |
msgid "Enable dynamic remarketing audience collection"
|
534 |
msgstr ""
|
535 |
|
536 |
+
#: classes/admin/class-admin.php:2144
|
537 |
msgid "You need to choose the correct product identifier setting in order to match the product identifiers in the product feeds."
|
538 |
msgstr ""
|
539 |
|
540 |
+
#: classes/admin/class-admin.php:2162
|
541 |
msgid "Enable variations output"
|
542 |
msgstr ""
|
543 |
|
544 |
+
#: classes/admin/class-admin.php:2173
|
545 |
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."
|
546 |
msgstr ""
|
547 |
|
548 |
+
#: classes/admin/class-admin.php:2188
|
549 |
msgid "Retail"
|
550 |
msgstr ""
|
551 |
|
552 |
+
#: classes/admin/class-admin.php:2198
|
553 |
msgid "Education"
|
554 |
msgstr ""
|
555 |
|
556 |
+
#: classes/admin/class-admin.php:2208
|
557 |
msgid "Hotels and rentals"
|
558 |
msgstr ""
|
559 |
|
560 |
+
#: classes/admin/class-admin.php:2218
|
561 |
msgid "Jobs"
|
562 |
msgstr ""
|
563 |
|
564 |
+
#: classes/admin/class-admin.php:2228
|
565 |
msgid "Local deals"
|
566 |
msgstr ""
|
567 |
|
568 |
+
#: classes/admin/class-admin.php:2238
|
569 |
msgid "Real estate"
|
570 |
msgstr ""
|
571 |
|
572 |
+
#: classes/admin/class-admin.php:2248
|
573 |
msgid "Custom"
|
574 |
msgstr ""
|
575 |
|
576 |
+
#: classes/admin/class-admin.php:2267
|
577 |
msgid "ID of your Google Merchant Center account. It looks like this: 12345678"
|
578 |
msgstr ""
|
579 |
|
580 |
+
#: classes/admin/class-admin.php:2275
|
581 |
+
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:"
|
582 |
+
msgstr ""
|
583 |
+
|
584 |
+
#: classes/admin/class-admin.php:2313
|
585 |
+
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:"
|
586 |
+
msgstr ""
|
587 |
+
|
588 |
+
#: classes/admin/class-admin.php:2331
|
589 |
msgid "post ID (default)"
|
590 |
msgstr ""
|
591 |
|
592 |
+
#: classes/admin/class-admin.php:2337
|
593 |
msgid "SKU"
|
594 |
msgstr ""
|
595 |
|
596 |
+
#: classes/admin/class-admin.php:2344
|
597 |
msgid "ID for the WooCommerce Google Product Feed. Outputs the post ID with woocommerce_gpf_ prefix *"
|
598 |
msgstr ""
|
599 |
|
600 |
+
#: classes/admin/class-admin.php:2351
|
601 |
msgid "ID for the WooCommerce Google Listings & Ads Plugin. Outputs the post ID with gla_ prefix **"
|
602 |
msgstr ""
|
603 |
|
604 |
+
#: classes/admin/class-admin.php:2355
|
605 |
msgid "Choose a product identifier."
|
606 |
msgstr ""
|
607 |
|
608 |
+
#: classes/admin/class-admin.php:2358
|
609 |
msgid "* This is for users of the WooCommerce Google Product Feed Plugin"
|
610 |
msgstr ""
|
611 |
|
612 |
+
#: classes/admin/class-admin.php:2362
|
613 |
msgid "** This is for users of the WooCommerce Google Listings & Ads Plugin"
|
614 |
msgstr ""
|
615 |
|
616 |
+
#: classes/admin/class-admin.php:2371
|
617 |
msgid "beta"
|
618 |
msgstr ""
|
619 |
|
620 |
+
#: classes/admin/class-admin.php:2375
|
621 |
+
#: classes/admin/class-admin.php:2380
|
622 |
msgid "active"
|
623 |
msgstr ""
|
624 |
|
|