From 404d0c21b57befc83f247c8f4e0dc843d73b9b11 Mon Sep 17 00:00:00 2001 From: Thomas Geiger Date: Tue, 9 Jan 2024 13:49:22 +0100 Subject: [PATCH 01/14] Update plugin name and description --- ...ltomi-google-tag-manager-for-wordpress.php | 2 +- readme.txt | 63 ++++++++----------- 2 files changed, 28 insertions(+), 37 deletions(-) diff --git a/duracelltomi-google-tag-manager-for-wordpress.php b/duracelltomi-google-tag-manager-for-wordpress.php index 6890149a..65a2c3eb 100644 --- a/duracelltomi-google-tag-manager-for-wordpress.php +++ b/duracelltomi-google-tag-manager-for-wordpress.php @@ -8,7 +8,7 @@ * @license GNU General Public License, version 3 * * @wordpress-plugin - * Plugin Name: GTM4WP + * Plugin Name: GTM4WP - A Google Tag Manager (GTM) plugin for WordPress * Plugin URI: https://gtm4wp.com/ * Description: The first Google Tag Manager plugin for WordPress with business goals in mind * Version: 1.20-beta.1 diff --git a/readme.txt b/readme.txt index abf5f24c..d9f21334 100644 --- a/readme.txt +++ b/readme.txt @@ -1,4 +1,4 @@ -=== GTM4WP === +=== GTM4WP - A Google Tag Manager (GTM) plugin for WordPress === Contributors: duracelltomi Donate link: https://gtm4wp.com/ Tags: google tag manager, tag manager, gtm, google, adwords, google adwords, google ads, adwords remarketing, google ads remarketing, remarketing, google analytics, analytics, facebook ads, facebook remarketing, facebook pixel, google optimize, personalisation @@ -9,20 +9,18 @@ Stable tag: 1.19.1 License: GPLv3 License URI: http://www.gnu.org/licenses/gpl.html -Advanced measurement/advertising tag management and site personalisation for WordPress with Google Tag Manager and Google Optimize +Advanced tag management for WordPress with Google Tag Manager == Description == Google Tag Manager (GTM) is Google's free tool for everyone to manage and deploy analytics and marketing tags as well as other code snippets -using an intuitive web UI. To learn more about this tool, visit the [official website](https://www.google.com/analytics/tag-manager/). +using an intuitive web UI. To learn more about this tool, visit the [official website](https://marketingplatform.google.com/about/tag-manager/). -This plugin places the GTM container code snippets onto your wordpress website so that you do not need to add this manually. +This plugin places the GTM container code snippets onto your WordPress website so that you do not need to add it manually. Multiple containers are also supported! The plugin complements your GTM setup by pushing page meta data and user information into the so called data layer. -Google's official help pages includes [more details about the data layer](https://developers.google.com/tag-manager/devguide#datalayer). - -You can also add your Google Optimize container with the [recommended code setup](https://support.google.com/optimize/answer/7359264?hl=en) +Google's official help pages includes [more details about the data layer](https://developers.google.com/tag-platform/tag-manager/datalayer#datalayer). **PHP 7.4 is required to use this plugin.** @@ -41,12 +39,11 @@ Albeit not ideal, it will work when placed lower in the code. This plugin provid If your WordPress theme is compatible with the additions of WordPress 5.2 then this plugin will place this second code to the right place. Users of the Genisis theme, GeneratePress theme, Elementor, Oxygen Builder and Beaver Builder Theme will also have this placed correctly. -To utilize this, use the "Codeless" placement option. +To utilize this, set the compatibility mode in plugin options to off. -All other users can place this second code snippet using a custom PHP code ("Custom" placement option) or select the so called "Footer" option to +All other users can place this second code snippet using a custom PHP code ("Manually coded" option) or select the so called "Footer" option to add the code lower in the code (it is not the recommended way but will work) - = Basic data included = * post/page titles @@ -56,12 +53,13 @@ add the code lower in the code (it is not the recommended way but will work) * post/page author ID and name * post/page ID * post types +* post format * post count on the current page + in the current category/tag/taxonomy * custom terms associated with any post type * logged in status * logged in user role * logged in user ID (to track cross device behaviour in Google Analytics) -* logged in user email address (to comply with [GTM terms of service](https://www.google.com/analytics/tag-manager/use-policy/) do not pass this on to Google tags) +* logged in user email address (both unhashed and SHA256 hased values to be used with tracking) * logger in user creation date * site search data * site name and id (for WordPress multisite instances) @@ -131,11 +129,6 @@ Scroll tracking is based on the solution originally created by Original script: http://cutroni.com/blog/2012/02/21/advanced-content-tracking-with-google-analytics-part-1/ -= Google Ads remarketing = - -Google Tag Manager for WordPress can add each dataLayer variable as a Google Ads remarketing custom parameter list. -This enables you to build sophisticated remarketing lists. - = Blacklist & Whitelist Tag Manager tags, triggers and variables = To increase website security, you have the option to white- and blacklist tags/triggers/variables. @@ -151,23 +144,22 @@ Google Tag Manager for WordPress integrates with several popular plugins. More i * Contact Form 7: fire an event when a Contact Form 7 form was submitted with any result (mail sent, mail failed, spam detected, invalid input) * WooCommerce: - * Classic e-commerce (deprecated): - * fire an event when visitors add products to their cart - * capture transaction data to be passed to your ad platforms and/or Analytics - * capture necessary remarketing parameters for Google Ads Dynamic Remarketing - * Enhanced e-commerce: - * implementation of [Enhanced E-commerce GA3](https://developers.google.com/tag-manager/enhanced-ecommerce) - * implementation of [Enhanced E-commerce GA4](https://developers.google.com/tag-manager/ecommerce-ga4) - * Does not support promotions since WooCommerce does not have such a feature (yet) - * Does not support refunds + * Implementation of [GA4 E-commerce](https://developers.google.com/tag-manager/ecommerce-ga4) + * Does not support promotions since WooCommerce does not have such a feature (yet) + * Does not support refunds * Compatibility with High Performance Order Storage (HPOS) -* Google Optimize: load your Google Optimize container directly from your website with the ability to use the data layer variables provided during page load * AMP: load your AMP container on the AMP version of your pages +* Cookiebot: use automatic cookie blocking mode if needed +* Google Consent Mode v2: fire the "default" command with specific consent flags to integrat with non-certified Consent Management Platforms (CMPs) and plugins. = Server side containers = If you are using a [server side container](https://developers.google.com/tag-manager/serverside/send-data#update_the_gtmjs_source_domain) -you can enter your custom domain name to load gtm.js from your there. +you can enter your custom domain name and custom path to load gtm.js from your there. + += Exclude specific user roles from being tracked = + +You can set which user roles needs to be excluded from tracking when a user with that role visits the frontend. This will completely disable the container code for that user. == Installation == @@ -179,8 +171,8 @@ you can enter your custom domain name to load gtm.js from your there. = How can I ... = -Tutorials for various Google Tag Manager settings and implementation are available on my website: -https://gtm4wp.com/how-to-articles/ +Tutorials for various Google Tag Manager settings and implementation are available on the plugin's website: +https://gtm4wp.com/setup-gtm4wp-features = PayPal / 3rd party payment gateway transactions in WooCommerce are not being tracked in Google Analytics = @@ -191,6 +183,12 @@ It offers the route back for your customer but it can happen that users close th Enable auto-return in your payment gateway settings. This will instruct them to show a quick info page after payment and redirect the user back to your site. This will improve the accuracy and frequency of tracked transactions. += Purchase event is not tracked with WooCommerce = + +If you are using a 3rd party plugin that alters the default order received page in a way that does not utilize the integration hooks +of WooCommerce then this can happen. Either stop using this 3rd party plugin or ask them to better mimic the behavior of the +default order received page by supporting the woocommerce is_order_received_page and the woocommerce_thankyou actions and filters. + = Why isn't there an option to blacklist tag/variable classes = Although Google recommends to blacklist tags and variables using classes, people struggle to know @@ -215,13 +213,6 @@ There are five dataLayer events you can use in your rule definitions: Example use cases: using these events as triggers, you can fire Google Universal Analytics and/or Google Ads remarketing/conversion tags to report micro conversions and/or to serve ads only to visitors who spend more time reading your content. -= Can I exclude certain user roles from being tracked? = - -This is easily managed through GTM itself. If you want to exclude logged in users or users with certain user roles, -use the corresponding dataLayer variable (visitorType) and an exclude filter in Google Tag Manager. - -https://gtm4wp.com/how-to-articles/how-to-exclude-admin-users-from-being-tracked/ - == Screenshots == 1. Admin panel From dfd8f22f6e7d0f76bb0bd3ad44a2ca916a4b0c3c Mon Sep 17 00:00:00 2001 From: Thomas Geiger Date: Tue, 9 Jan 2024 13:50:19 +0100 Subject: [PATCH 02/14] Fixed code formatting errors in admin.php --- admin/admin.php | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/admin/admin.php b/admin/admin.php index c429377f..d3be00a5 100644 --- a/admin/admin.php +++ b/admin/admin.php @@ -1018,23 +1018,23 @@ function gtm4wp_add_admin_js( $hook ) { wp_register_script( 'admin-subtabs', $gtp4wp_plugin_url . 'js/admin-subtabs.js', array(), GTM4WP_VERSION ); // phpcs:ignore $subtabtexts = array( - 'posttabtitle' => esc_html__( 'Posts', 'duracelltomi-google-tag-manager' ), - 'searchtabtitle' => esc_html__( 'Search', 'duracelltomi-google-tag-manager' ), - 'visitortabtitle' => esc_html__( 'Visitors', 'duracelltomi-google-tag-manager' ), - 'browsertabtitle' => esc_html__( 'Browser/OS/Device', 'duracelltomi-google-tag-manager' ), - 'blocktagstabtitle' => esc_html__( 'Blacklist tags', 'duracelltomi-google-tag-manager' ), - 'blocktriggerstabtitle' => esc_html__( 'Blacklist triggers', 'duracelltomi-google-tag-manager' ), - 'blockmacrostabtitle' => esc_html__( 'Blacklist variables', 'duracelltomi-google-tag-manager' ), - 'wpcf7tabtitle' => esc_html__( 'Contact Form 7', 'duracelltomi-google-tag-manager' ), - 'wctabtitle' => esc_html__( 'WooCommerce', 'duracelltomi-google-tag-manager' ), - 'amptabtitle' => esc_html__( 'Accelerated Mobile Pages', 'duracelltomi-google-tag-manager' ), - 'cookiebottabtitle' => esc_html__( 'Cookiebot', 'duracelltomi-google-tag-manager' ), - 'weathertabtitle' => esc_html__( 'Weather & geo data', 'duracelltomi-google-tag-manager' ), - 'generaleventstabtitle' => esc_html__( 'General events', 'duracelltomi-google-tag-manager' ), - 'mediaeventstabtitle' => esc_html__( 'Media events', 'duracelltomi-google-tag-manager' ), - 'sitetabtitle' => esc_html__( 'Site', 'duracelltomi-google-tag-manager' ), - 'misctabtitle' => esc_html__( 'Misc', 'duracelltomi-google-tag-manager' ), - 'consentmodetabtitle' => esc_html__( 'Google Consent Mode', 'duracelltomi-google-tag-manager' ), + 'posttabtitle' => esc_html__( 'Posts', 'duracelltomi-google-tag-manager' ), + 'searchtabtitle' => esc_html__( 'Search', 'duracelltomi-google-tag-manager' ), + 'visitortabtitle' => esc_html__( 'Visitors', 'duracelltomi-google-tag-manager' ), + 'browsertabtitle' => esc_html__( 'Browser/OS/Device', 'duracelltomi-google-tag-manager' ), + 'blocktagstabtitle' => esc_html__( 'Blacklist tags', 'duracelltomi-google-tag-manager' ), + 'blocktriggerstabtitle' => esc_html__( 'Blacklist triggers', 'duracelltomi-google-tag-manager' ), + 'blockmacrostabtitle' => esc_html__( 'Blacklist variables', 'duracelltomi-google-tag-manager' ), + 'wpcf7tabtitle' => esc_html__( 'Contact Form 7', 'duracelltomi-google-tag-manager' ), + 'wctabtitle' => esc_html__( 'WooCommerce', 'duracelltomi-google-tag-manager' ), + 'amptabtitle' => esc_html__( 'Accelerated Mobile Pages', 'duracelltomi-google-tag-manager' ), + 'cookiebottabtitle' => esc_html__( 'Cookiebot', 'duracelltomi-google-tag-manager' ), + 'weathertabtitle' => esc_html__( 'Weather & geo data', 'duracelltomi-google-tag-manager' ), + 'generaleventstabtitle' => esc_html__( 'General events', 'duracelltomi-google-tag-manager' ), + 'mediaeventstabtitle' => esc_html__( 'Media events', 'duracelltomi-google-tag-manager' ), + 'sitetabtitle' => esc_html__( 'Site', 'duracelltomi-google-tag-manager' ), + 'misctabtitle' => esc_html__( 'Misc', 'duracelltomi-google-tag-manager' ), + 'consentmodetabtitle' => esc_html__( 'Google Consent Mode', 'duracelltomi-google-tag-manager' ), ); wp_localize_script( 'admin-subtabs', 'gtm4wp', $subtabtexts ); From d57e61be50b5405e8a63983564b754e1b6f52d61 Mon Sep 17 00:00:00 2001 From: Thomas Geiger Date: Wed, 10 Jan 2024 12:18:53 +0100 Subject: [PATCH 03/14] WebToffee GDPR Cookie Consent integration --- admin/admin-tab-integrate.php | 8 ++++++++ admin/admin.php | 1 + common/readoptions.php | 4 ++++ dist/js/admin-subtabs.js | 2 +- js/admin-subtabs.js | 4 ++++ public/frontend.php | 29 +++++++++++++++++++++++++++++ readme.txt | 1 + 7 files changed, 48 insertions(+), 1 deletion(-) diff --git a/admin/admin-tab-integrate.php b/admin/admin-tab-integrate.php index 627da26b..34404715 100644 --- a/admin/admin-tab-integrate.php +++ b/admin/admin-tab-integrate.php @@ -255,4 +255,12 @@ ), 'phase' => GTM4WP_PHASE_STABLE, ), + + GTM4WP_OPTION_INTEGRATE_WEBTOFFEE_GDPR => array( + 'label' => esc_html__( 'WebToffee GDPR Cookie Consent', 'duracelltomi-google-tag-manager' ), + 'description' => esc_html__( 'Enabling this feature will fire a GTM event (cookie_consent_update) when the consent banner has been closed with consents being set or during pageload when previously set consents have been found.', 'duracelltomi-google-tag-manager' ), + 'phase' => GTM4WP_PHASE_STABLE, + 'plugintocheck' => 'webtoffee-gdpr-cookie-consent/cookie-law-info.php', + ), + ); diff --git a/admin/admin.php b/admin/admin.php index d3be00a5..76764bcc 100644 --- a/admin/admin.php +++ b/admin/admin.php @@ -1035,6 +1035,7 @@ function gtm4wp_add_admin_js( $hook ) { 'sitetabtitle' => esc_html__( 'Site', 'duracelltomi-google-tag-manager' ), 'misctabtitle' => esc_html__( 'Misc', 'duracelltomi-google-tag-manager' ), 'consentmodetabtitle' => esc_html__( 'Google Consent Mode', 'duracelltomi-google-tag-manager' ), + 'webtoffeetabtitle' => esc_html__( 'WebToffee GDPR Cookie Consent', 'duracelltomi-google-tag-manager' ), ); wp_localize_script( 'admin-subtabs', 'gtm4wp', $subtabtexts ); diff --git a/common/readoptions.php b/common/readoptions.php index 4881a73b..edb8df1b 100644 --- a/common/readoptions.php +++ b/common/readoptions.php @@ -94,6 +94,8 @@ define( 'GTM4WP_OPTION_INTEGRATE_COOKIEBOT', 'integrate-cookiebot' ); +define( 'GTM4WP_OPTION_INTEGRATE_WEBTOFFEE_GDPR', 'integrate-webtoffee-gdpr' ); + define( 'GTM4WP_OPTION_INTEGRATE_CONSENTMODE', 'integrate-consent-mode' ); define( 'GTM4WP_OPTION_INTEGRATE_CONSENTMODE_ADS', 'integrate-consent-mode-ads' ); define( 'GTM4WP_OPTION_INTEGRATE_CONSENTMODE_AD_USER_DATA', 'integrate-consent-mode-ad-user-data' ); @@ -198,6 +200,8 @@ GTM4WP_OPTION_INTEGRATE_COOKIEBOT => false, + GTM4WP_OPTION_INTEGRATE_WEBTOFFEE_GDPR => false, + GTM4WP_OPTION_INTEGRATE_CONSENTMODE => false, GTM4WP_OPTION_INTEGRATE_CONSENTMODE_ADS => false, GTM4WP_OPTION_INTEGRATE_CONSENTMODE_ANALYTICS => false, diff --git a/dist/js/admin-subtabs.js b/dist/js/admin-subtabs.js index f3796bba..72f7df76 100644 --- a/dist/js/admin-subtabs.js +++ b/dist/js/admin-subtabs.js @@ -1 +1 @@ -"use strict";var adminsubtabs={0:{},1:{posts:{tabtext:gtm4wp.posttabtitle,numitems:11},search:{tabtext:gtm4wp.searchtabtitle,numitems:1},visitor:{tabtext:gtm4wp.visitortabtitle,numitems:7},whichbrowser:{tabtext:gtm4wp.browsertabtitle,numitems:3},weather:{tabtext:gtm4wp.weathertabtitle,numitems:6},site:{tabtext:gtm4wp.sitetabtitle,numitems:2}},2:{generalevents:{tabtext:gtm4wp.generaleventstabtitle,numitems:3},mediaevents:{tabtext:gtm4wp.mediaeventstabtitle,numitems:3}},3:{},4:{blocktags:{tabtext:gtm4wp.blocktagstabtitle,numitems:74},blocktriggers:{tabtext:gtm4wp.blocktriggerstabtitle,numitems:9},blockmacros:{tabtext:gtm4wp.blockmacrostabtitle,numitems:15}},5:{"int-wpcf7":{tabtext:gtm4wp.wpcf7tabtitle,numitems:1},"int-wc":{tabtext:gtm4wp.wctabtitle,numitems:15},"int-amp":{tabtext:gtm4wp.amptabtitle,numitems:1},"int-cookiebot":{tabtext:gtm4wp.cookiebottabtitle,numitems:1},"int-consentmode":{tabtext:gtm4wp.consentmodetabtitle,numitems:8}}}; \ No newline at end of file +"use strict";var adminsubtabs={0:{},1:{posts:{tabtext:gtm4wp.posttabtitle,numitems:11},search:{tabtext:gtm4wp.searchtabtitle,numitems:1},visitor:{tabtext:gtm4wp.visitortabtitle,numitems:7},whichbrowser:{tabtext:gtm4wp.browsertabtitle,numitems:3},weather:{tabtext:gtm4wp.weathertabtitle,numitems:6},site:{tabtext:gtm4wp.sitetabtitle,numitems:2}},2:{generalevents:{tabtext:gtm4wp.generaleventstabtitle,numitems:3},mediaevents:{tabtext:gtm4wp.mediaeventstabtitle,numitems:3}},3:{},4:{blocktags:{tabtext:gtm4wp.blocktagstabtitle,numitems:74},blocktriggers:{tabtext:gtm4wp.blocktriggerstabtitle,numitems:9},blockmacros:{tabtext:gtm4wp.blockmacrostabtitle,numitems:15}},5:{"int-wpcf7":{tabtext:gtm4wp.wpcf7tabtitle,numitems:1},"int-wc":{tabtext:gtm4wp.wctabtitle,numitems:15},"int-amp":{tabtext:gtm4wp.amptabtitle,numitems:1},"int-cookiebot":{tabtext:gtm4wp.cookiebottabtitle,numitems:1},"int-consentmode":{tabtext:gtm4wp.consentmodetabtitle,numitems:8},"int-webtoffeegdpr":{tabtext:gtm4wp.webtoffeetabtitle,numitems:1}}}; \ No newline at end of file diff --git a/js/admin-subtabs.js b/js/admin-subtabs.js index 69045c88..0cdf574f 100644 --- a/js/admin-subtabs.js +++ b/js/admin-subtabs.js @@ -72,6 +72,10 @@ var adminsubtabs = { "int-consentmode": { tabtext: gtm4wp.consentmodetabtitle, numitems: 8 + }, + "int-webtoffeegdpr": { + tabtext: gtm4wp.webtoffeetabtitle, + numitems: 1 } } }; diff --git a/public/frontend.php b/public/frontend.php index 5634075a..300d0178 100755 --- a/public/frontend.php +++ b/public/frontend.php @@ -937,6 +937,35 @@ function gtm4wp_wp_header_top( $echo = true ) { const gtm4wp_scrollerscript_scannertime = ' . (int) $gtm4wp_options[ GTM4WP_OPTION_SCROLLER_READERTIME ] . ';'; } + if ( $gtm4wp_options[ GTM4WP_OPTION_INTEGRATE_WEBTOFFEE_GDPR ] ) { + $_gtm_top_content .= ' + var CookieLawInfo_Accept_Callback = (function() { + var gtm4wp_original_cli_callback = CookieLawInfo_Accept_Callback; + + return function() { + if ( !window.CLI.consent ) { + return false; + } + + window.' . esc_js( $gtm4wp_datalayer_name ) . ' = window.' . esc_js( $gtm4wp_datalayer_name ) . ' || []; + window.' . esc_js( $gtm4wp_datalayer_name ) . '.push({ + "event": "cookie_consent_update", + "consent_data": window.CLI.consent + }); + + for(var i in window.CLI.consent) { + window.' . esc_js( $gtm4wp_datalayer_name ) . '.push({ + "event": "cookie_consent_" + i + }); + } + + if ( "function" == typeof gtm4wp_original_cli_callback ) { + gtm4wp_original_cli_callback(); + } + } + })();'; + } + $_gtm_top_content .= ' '; diff --git a/readme.txt b/readme.txt index d9f21334..aed85205 100644 --- a/readme.txt +++ b/readme.txt @@ -242,6 +242,7 @@ please update the plugin on a test version of your website before updating your * Changed: lots of internal function names and variable names changed, although is not recommended to depend on them, if you did, check your code * Changed: renamed WP filter gtm4wp_datalayer_on_pageload to gtm4wp_woocommerce_datalayer_on_pageload to better reflect when it is called. * Added: stockstatus key into the product array of every ecommerce action. Returns the value of WP_Product->get_stock_status(). Thanks [hans2103](https://github.com/hans2103). +* Added: integration with WebToffee GDPR Cookie Consent plugin. GTM4WP can not fire a GTM event when user consent changes or when a previously stored consent has been loaded. = 1.19.1 = From a33ce6214d9f522daa2e35b5695fff311d5cb9b9 Mon Sep 17 00:00:00 2001 From: Thomas Geiger Date: Thu, 11 Jan 2024 14:22:53 +0100 Subject: [PATCH 04/14] Removed unused admin icons --- admin/images/tag_manager-32.png | Bin 1313 -> 0 bytes admin/images/tag_manager-64.png | Bin 916 -> 0 bytes 2 files changed, 0 insertions(+), 0 deletions(-) delete mode 100644 admin/images/tag_manager-32.png delete mode 100644 admin/images/tag_manager-64.png diff --git a/admin/images/tag_manager-32.png b/admin/images/tag_manager-32.png deleted file mode 100644 index f90437ccb0f1fd36ed9987e17eb129cb070886f8..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1313 zcmV++1>X9JP)|Qul8}P51gVO+ za3K{Jg05ODifFshN>QtzxUmQ#f`Xt_x)2NMB2)x7Dzz0MU0Av)XhChIf6}DMO!H^v zy?c*~nMs>AlcfJYxXjGEZ{GRdcfNbhy`rkzNmu|?1rfOo@f6iLp`@XJ%-(Qoaa9}( zP#z!EC|Tx=b$Npl8q-D~DBP4RiJ(56&ZfuH&hDN|mq*W@JziahVUwjjSZk(!7 zEyNgrshW_FmDqBlR#6e+EHHfP`_c%~vP)01=Q`#1Ltkq*>sx-c(aVvv!96wg~X)5A7U2;nW$GTGm1V4S1KM;3w6EnzSUL-bfbHhEH^Q3P2ITDuQ#7 zbhpE3#YFp$*r+Y3N7{cRp%5$G1)W!537)jAlirgDYg>=KPcF>F0n;iS76cXl%Gh(? z?y@^}Zs~e<%YIv#h9?IyUV9P7#{;=U@uB_}#wbB${x|m?+B=v!^mCdW*ey1laarV$ zMcgVjw$+Oj8>-cH09JuGQt~m3)hdimOk<2$@F9eN7TSrA{T}%6T|%0z!B&#)O6};2WgJ%NIF&<_ylc*6U6KAy*(ic1(+VKM^-ma}vi8{KAo&1fXdqGfSXJ zIx>bhj=#jid`CM%+G0-?q7SOON&`bq);&E?4baU?{i{w3rKHxwKi z3N#TypjNA)s;w2MRH*c=H+J|iZsGzYxf>!ehd@V12iDq!O&9{YW{t!vS8Dj+oirO8 zbCO(t8tNWsw8yr#Haa^y7yp;{$c90g+W9sY-+Lp~G<7()Bog)BE3;oO?FWE!=gx8d z{Q1@+I&{YIPWOghGQG`rQQd@Vw8Q;E(%7rmT z$Hpj^%SgT9AR>70S+;Chx_b3JZfI!eqqjcZ{btvF>zs0}%WyszgHBJ=xnc$DH$9{j z+H~4PWN||3Tzyze7RO|{JXI6TNWM^)MD->RXpl&2HSX@|kq6eV7bgNf!)SdwC4i_R z-Xl8OTrQQvo5DeaG)?I)mFVm5C$bhF0s?dVq@a3PifXW4ed|VLpk9Ijj4^7h)hLRtc^G39P!UmUt%eYE`SRsDFfgFb zIaO5^5t^S(SXCvT&sPDuySq(KPtSE9P*jytsYJ0@oc-O~+soRuYZ)FMmMqK2=kpRS zs}r_RC~)-X(S7A|d2^B^8-Pg`-Bz@Qh|I}(2!U0rRxvm@XpSF0{@>}-rw=4a0^p%> zG8!2fp{uLQIp^}X>Z~Xtl4aS<#Kc6kR4QG%eg}?b0?g(>nl6^xb2z=qgmSASUn>3w X8*YeJ#dF`L00000NkvXXu0mjf99?cf diff --git a/admin/images/tag_manager-64.png b/admin/images/tag_manager-64.png deleted file mode 100644 index 10be4afe02f231c17a08a954225a787f6a9b6bbb..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 916 zcmV;F18e+=P)zL#UBY2q?-g*pLhCIYAvpk^X~Iss}X0;m(9CSV;f#sC0| z>&=G%HUP{K)7eMU$M^u|K;Aemr)9aU954W8J{w;5sa0AUY^?QR?F_^V76--1LyYC;w!@A5tNO3fCz4g*e4)gwW3n+BU40ps64&cg@hwO%O0oPVxdhV95CE_zFXGp> zUbm_C1?1C`Idv63mRDqR_C}i`KDhvZyM&MZ4Iu;oJqfLwb6zi(v;7U%X^_V?z>Z-U zP*oMNSgd=lTCJYzJCe!dKs%GkINlZ)rUzI^k_1Ij5RFE;ES7{50GvrkrBV_P2|@}0 zfM77lMS`#bfS!a%B;r{Np#=bE5)?&&R}zF50Q4@5UP$nT0Khv5z7YU;Bf(b!fbmQ4 zod96G5_~BD7@q{+3IN6rQkw_t(PA>r?JT8A(@%=1t qQ6>VY6QE`yfI0zcCIYAvpym(AnjSi3pZr_^0000 Date: Thu, 11 Jan 2024 14:29:56 +0100 Subject: [PATCH 05/14] Updated WC tested version --- duracelltomi-google-tag-manager-for-wordpress.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/duracelltomi-google-tag-manager-for-wordpress.php b/duracelltomi-google-tag-manager-for-wordpress.php index 65a2c3eb..a8f6c615 100644 --- a/duracelltomi-google-tag-manager-for-wordpress.php +++ b/duracelltomi-google-tag-manager-for-wordpress.php @@ -22,7 +22,7 @@ * Domain Path: /languages * WC requires at least: 5.0 - * WC tested up to: 8.3 + * WC tested up to: 8.5 */ define( 'GTM4WP_VERSION', '1.20-beta.1' ); From 5e0ab13b76950c47b494e18bf11fc04b6c309735 Mon Sep 17 00:00:00 2001 From: Thomas Geiger Date: Thu, 11 Jan 2024 14:50:33 +0100 Subject: [PATCH 06/14] Fix: do not track internal product data (internal_id, productlink) --- js/gtm4wp-ecommerce-generic.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/js/gtm4wp-ecommerce-generic.js b/js/gtm4wp-ecommerce-generic.js index 52422b79..53751581 100644 --- a/js/gtm4wp-ecommerce-generic.js +++ b/js/gtm4wp-ecommerce-generic.js @@ -37,7 +37,7 @@ function gtm4wp_push_ecommerce( event_name, items, extra_params, event_callback= window[ gtm4wp_datalayer_name ].push(dl_obj); } -function gtm4wp_read_json_from_node( el, dataset_item_id ) { +function gtm4wp_read_json_from_node( el, dataset_item_id, exclude_keys=['productlink', 'internal_id'] ) { if ( el && el.dataset && el.dataset[ dataset_item_id ] ) { try { const parsed_json = JSON.parse( el.dataset[ dataset_item_id ] ); @@ -46,6 +46,12 @@ function gtm4wp_read_json_from_node( el, dataset_item_id ) { parsed_json.price = gtm4wp_make_sure_is_float( parsed_json.price ); } + if ( exclude_keys && exclude_keys.length > 0 ) { + for ( let i = 0; i < exclude_keys.length; i++ ) { + delete parsed_json[ exclude_keys[i] ]; + } + } + return parsed_json; } } catch(e) { From 87f886a811dd7f672a3eb27ddcc0d8a403e2b7c7 Mon Sep 17 00:00:00 2001 From: Thomas Geiger Date: Thu, 11 Jan 2024 14:53:22 +0100 Subject: [PATCH 07/14] Fix: some code used the 'brand' key instead of 'item_brand' --- integration/woocommerce.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/integration/woocommerce.php b/integration/woocommerce.php index 80d6f558..cc5f1eed 100755 --- a/integration/woocommerce.php +++ b/integration/woocommerce.php @@ -1168,8 +1168,8 @@ function gtm4wp_woocommerce_after_template_part( $template_name ) { 'widgetproduct' ); - if ( ! isset( $eec_product_array['brand'] ) ) { - $eec_product_array['brand'] = ''; + if ( ! isset( $eec_product_array['item_brand'] ) ) { + $eec_product_array['item_brand'] = ''; } $productlink_with_data = sprintf( @@ -1234,8 +1234,8 @@ function gtm4wp_woocommerce_get_product_list_item_extra_tag( $product, $listtype 'productlist' ); - if ( ! isset( $eec_product_array['brand'] ) ) { - $eec_product_array['brand'] = ''; + if ( ! isset( $eec_product_array['item_brand'] ) ) { + $eec_product_array['item_brand'] = ''; } return sprintf( From 8334f24a063079aa4f5370b940bb62e5b14c6e29 Mon Sep 17 00:00:00 2001 From: Thomas Geiger Date: Thu, 11 Jan 2024 16:04:17 +0100 Subject: [PATCH 08/14] Various fixes during testing beta 1 --- integration/woocommerce.php | 8 +++++++ js/gtm4wp-ecommerce-generic.js | 38 ++++++++++++++++++++-------------- js/gtm4wp-woocommerce.js | 23 +++++++++----------- public/frontend.php | 9 +++++--- 4 files changed, 46 insertions(+), 32 deletions(-) diff --git a/integration/woocommerce.php b/integration/woocommerce.php index cc5f1eed..3ed3126a 100755 --- a/integration/woocommerce.php +++ b/integration/woocommerce.php @@ -188,6 +188,8 @@ function gtm4wp_woocommerce_process_order_items( $order ) { 'purchase' ); + unset( $eec_product_array['internal_id'] ); + if ( $eec_product_array ) { $order_data[] = $eec_product_array; } @@ -477,6 +479,7 @@ function gtm4wp_woocommerce_datalayer_filter_items( $data_layer ) { $data_layer['productIsVariable'] = 0; $gtm4wp_currency = get_woocommerce_currency(); + unset( $eec_product_array['internal_id'] ); gtm4wp_datalayer_push( 'view_item', @@ -528,6 +531,8 @@ function gtm4wp_woocommerce_datalayer_filter_items( $data_layer ) { 'cart' ); + unset( $eec_product_array['internal_id'] ); + $gtm4wp_cart_products[] = $eec_product_array; $gtm4wp_cart_total += $eec_product_array['price'] * $eec_product_array['quantity']; } @@ -723,6 +728,8 @@ function gtm4wp_woocommerce_datalayer_filter_items( $data_layer ) { 'checkout' ); + unset( $eec_product_array['internal_id'] ); + $gtm4wp_checkout_products[] = $eec_product_array; $gtm4wp_checkout_total += $eec_product_array['quantity'] * $eec_product_array['price']; } // end foreach cart item @@ -765,6 +772,7 @@ function gtm4wp_woocommerce_datalayer_filter_items( $data_layer ) { ); $gtm4wp_currency = get_woocommerce_currency(); + unset( $eec_product_array['internal_id'] ); gtm4wp_datalayer_push( 'add_to_cart', diff --git a/js/gtm4wp-ecommerce-generic.js b/js/gtm4wp-ecommerce-generic.js index 53751581..8094fd2b 100644 --- a/js/gtm4wp-ecommerce-generic.js +++ b/js/gtm4wp-ecommerce-generic.js @@ -37,26 +37,32 @@ function gtm4wp_push_ecommerce( event_name, items, extra_params, event_callback= window[ gtm4wp_datalayer_name ].push(dl_obj); } -function gtm4wp_read_json_from_node( el, dataset_item_id, exclude_keys=['productlink', 'internal_id'] ) { - if ( el && el.dataset && el.dataset[ dataset_item_id ] ) { - try { - const parsed_json = JSON.parse( el.dataset[ dataset_item_id ] ); - if ( parsed_json ) { - if ( parsed_json.price ) { - parsed_json.price = gtm4wp_make_sure_is_float( parsed_json.price ); - } +function gtm4wp_read_from_json( json_data, exclude_keys=['productlink', 'internal_id'] ) { + try { + const parsed_json = JSON.parse( json_data ); + if ( parsed_json ) { + if ( parsed_json.price ) { + parsed_json.price = gtm4wp_make_sure_is_float( parsed_json.price ); + } - if ( exclude_keys && exclude_keys.length > 0 ) { - for ( let i = 0; i < exclude_keys.length; i++ ) { - delete parsed_json[ exclude_keys[i] ]; - } + if ( exclude_keys && exclude_keys.length > 0 ) { + for ( let i = 0; i < exclude_keys.length; i++ ) { + delete parsed_json[ exclude_keys[i] ]; } - - return parsed_json; } - } catch(e) { - console && console.error && console.error( e.message ); + + return parsed_json; } + } catch(e) { + console && console.error && console.error( e.message ); + } + + return false; +} + +function gtm4wp_read_json_from_node( el, dataset_item_id, exclude_keys=['productlink', 'internal_id'] ) { + if ( el && el.dataset && el.dataset[ dataset_item_id ] ) { + return gtm4wp_read_from_json( el.dataset[ dataset_item_id ], exclude_keys ); } return false; diff --git a/js/gtm4wp-woocommerce.js b/js/gtm4wp-woocommerce.js index 4652711a..07f5183d 100644 --- a/js/gtm4wp-woocommerce.js +++ b/js/gtm4wp-woocommerce.js @@ -263,7 +263,7 @@ function gtm4wp_woocommerce_process_pages() { let sum_value = 0; products_in_group.forEach( function( product_data_el ) { - const productdata = gtm4wp_read_json_from_node(product_data_el, 'gtm4wp_product_data'); + const productdata = gtm4wp_read_json_from_node(product_data_el, 'gtm4wp_product_data', ['productlink']); if ( !productdata ) { return true; } @@ -279,6 +279,8 @@ function gtm4wp_woocommerce_process_pages() { return true; } productdata.quantity = product_qty; + + delete productdata.internal_id; products.push( productdata ); sum_value += productdata.price * productdata.quantity; @@ -298,15 +300,7 @@ function gtm4wp_woocommerce_process_pages() { return true; } - let productdata; - try { - productdata = JSON.parse( product_data_el.value ); - } catch(e) { - console && console.error && console.error( e.message ); - return true; - } - - productdata.price = gtm4wp_make_sure_is_float( productdata.price ); + let productdata = gtm4wp_read_from_json( product_data_el.value ); productdata.quantity = product_form.querySelector( '[name=quantity]' ) && product_form.querySelector( '[name=quantity]' ).value; if ( isNaN( productdata.quantity ) ) { productdata.quantity = 1; @@ -418,7 +412,7 @@ function gtm4wp_woocommerce_process_pages() { } } - const productdata = gtm4wp_read_json_from_node( productdata_el, 'gtm4wp_product_data' ); + const productdata = gtm4wp_read_json_from_node( productdata_el, 'gtm4wp_product_data', ['internal_id'] ); if ( !productdata ) { return true; } @@ -456,6 +450,9 @@ function gtm4wp_woocommerce_process_pages() { // we need to open the new tab/page here so that popup blocker of the browser doesn't block our code window.productpage_window = window.open( 'about:blank', '_blank' ); } + + const productlink_to_redirect = productdata.productlink; + delete productdata.productlink; // fire ga4 version gtm4wp_push_ecommerce( 'select_item', [ productdata ], { @@ -468,9 +465,9 @@ function gtm4wp_woocommerce_process_pages() { if ( !event_already_prevented ) { if ( ( target_new_tab || ctrl_key_pressed ) && productpage_window ) { - productpage_window.location.href = productdata.productlink; + productpage_window.location.href = productlink_to_redirect; } else { - document.location.href = productdata.productlink; + document.location.href = productlink_to_redirect; } } }); diff --git a/public/frontend.php b/public/frontend.php index 300d0178..11d11356 100755 --- a/public/frontend.php +++ b/public/frontend.php @@ -802,6 +802,9 @@ function gtm4wp_enqueue_scripts() { wp_enqueue_script( 'gtm4wp-scroll-tracking', $gtp4wp_script_path . 'analytics-talk-content-tracking.js', array(), GTM4WP_VERSION, $in_footer ); } + wp_register_script( 'gtm4wp-additional-datalayer-pushes', '', array(), GTM4WP_VERSION, true ); + wp_enqueue_script( 'gtm4wp-additional-datalayer-pushes' ); + gtm4wp_fire_additional_datalayer_pushes(); } @@ -1014,7 +1017,7 @@ function gtm4wp_wp_header_begin( $echo = true ) { $gtm4wp_datalayer_data = (array) apply_filters( GTM4WP_WPFILTER_COMPILE_DATALAYER, $gtm4wp_datalayer_data ); echo ' - var dataLayer_content = ' . wp_json_encode( $gtm4wp_datalayer_data, JSON_UNESCAPED_UNICODE ) . ';'; + var dataLayer_content = ' . wp_json_encode( $gtm4wp_datalayer_data, JSON_UNESCAPED_UNICODE | JSON_NUMERIC_CHECK ) . ';'; echo ' ' . esc_js( $gtm4wp_datalayer_name ) . '.push( dataLayer_content );'; @@ -1233,14 +1236,14 @@ function gtm4wp_fire_additional_datalayer_pushes() { if ( array_key_exists( 'datalayer_object', $one_event ) ) { $datalayer_push_code .= ' - ' . esc_js( $gtm4wp_datalayer_name ) . '.push(' . wp_json_encode( $one_event['datalayer_object'], JSON_UNESCAPED_UNICODE ) . ');'; + ' . esc_js( $gtm4wp_datalayer_name ) . '.push(' . wp_json_encode( $one_event['datalayer_object'], JSON_UNESCAPED_UNICODE | JSON_NUMERIC_CHECK ) . ');'; } if ( array_key_exists( 'js_after', $one_event ) ) { $datalayer_push_code .= $one_event['js_after']; } - wp_add_inline_script( 'gtm4wp-woocommerce', $datalayer_push_code, 'after' ); + wp_add_inline_script( 'gtm4wp-additional-datalayer-pushes', $datalayer_push_code, 'after' ); } // Reset array so that additional data can be added and this function can be re-run without double running code. From a4136e64fe5a273c6d996ff962d840e5a42bb10f Mon Sep 17 00:00:00 2001 From: Thomas Geiger Date: Thu, 11 Jan 2024 16:13:25 +0100 Subject: [PATCH 09/14] Fix: fire add_payment_info and add_shipping_info events if required during checkout form submit --- js/gtm4wp-woocommerce.js | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-) diff --git a/js/gtm4wp-woocommerce.js b/js/gtm4wp-woocommerce.js index 07f5183d..70a18801 100644 --- a/js/gtm4wp-woocommerce.js +++ b/js/gtm4wp-woocommerce.js @@ -637,18 +637,9 @@ function gtm4wp_woocommerce_process_pages() { gtm4wp_woocommerce_handle_payment_method_change(); }); - document.addEventListener( 'click', function( e ) { - let event_target_element = e.target; - - if ( !event_target_element ) { - // for some reason event target is not specificed - return true; - } - - if ( !event_target_element.closest( 'form[name=checkout] button[type=submit]' ) ) { - return true; - } - + // We need to use jQuery where since the checkout_place_order event is only triggered using jQuery + const checkout_form = jQuery('form.checkout'); + checkout_form.on('checkout_place_order', function () { if ( gtm4wp_checkout_step_fired.indexOf( 'shipping_method' ) == -1 ) { // shipping methods are not visible if only one is available // and if the user has already a pre-selected method, no click event will fire to report the checkout step From 91524d06dfbba8cb9f2226766764a40b343a7d53 Mon Sep 17 00:00:00 2001 From: Thomas Geiger Date: Thu, 11 Jan 2024 16:17:44 +0100 Subject: [PATCH 10/14] Added changlog --- readme.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/readme.txt b/readme.txt index aed85205..5815dae4 100644 --- a/readme.txt +++ b/readme.txt @@ -243,6 +243,7 @@ please update the plugin on a test version of your website before updating your * Changed: renamed WP filter gtm4wp_datalayer_on_pageload to gtm4wp_woocommerce_datalayer_on_pageload to better reflect when it is called. * Added: stockstatus key into the product array of every ecommerce action. Returns the value of WP_Product->get_stock_status(). Thanks [hans2103](https://github.com/hans2103). * Added: integration with WebToffee GDPR Cookie Consent plugin. GTM4WP can not fire a GTM event when user consent changes or when a previously stored consent has been loaded. +* Fixed: add_payment_info and add_shipping_info events were not fired during checkout submit when not fired before on the page. = 1.19.1 = From 00c827f7b52dc57f444f66f91a0e9d9287fed578 Mon Sep 17 00:00:00 2001 From: Thomas Geiger Date: Thu, 11 Jan 2024 16:45:11 +0100 Subject: [PATCH 11/14] Fix: no internal_id in cartContent and wrong script block output --- integration/woocommerce.php | 2 ++ public/frontend.php | 11 ----------- 2 files changed, 2 insertions(+), 11 deletions(-) diff --git a/integration/woocommerce.php b/integration/woocommerce.php index 3ed3126a..cc51f630 100755 --- a/integration/woocommerce.php +++ b/integration/woocommerce.php @@ -443,6 +443,8 @@ function gtm4wp_woocommerce_datalayer_filter_items( $data_layer ) { 'cart' ); + unset( $eec_product_array['internal_id'] ); + $data_layer['cartContent']['items'][] = $eec_product_array; } } diff --git a/public/frontend.php b/public/frontend.php index 11d11356..d0b50254 100755 --- a/public/frontend.php +++ b/public/frontend.php @@ -1222,11 +1222,6 @@ function gtm4wp_fire_additional_datalayer_pushes() { $has_html5_support = current_theme_supports( 'html5' ); $add_cookiebot_ignore = (bool) $gtm4wp_options[ GTM4WP_OPTION_INTEGRATE_COOKIEBOT ]; - if ( count( $gtm4wp_additional_datalayer_pushes ) > 0 ) { - echo ' -'; - } - foreach ( $gtm4wp_additional_datalayer_pushes as $one_event ) { $datalayer_push_code = ''; @@ -1248,12 +1243,6 @@ function gtm4wp_fire_additional_datalayer_pushes() { // Reset array so that additional data can be added and this function can be re-run without double running code. $gtm4wp_additional_datalayer_pushes = array(); - - if ( count( $gtm4wp_additional_datalayer_pushes ) > 0 ) { - echo ' -'; - } - } /** From c2caec632b7cc480e12d0500a7426b615fa04b64 Mon Sep 17 00:00:00 2001 From: Eric Chuang Date: Fri, 12 Jan 2024 12:21:06 +0800 Subject: [PATCH 12/14] fix the i18n missing strings --- admin/admin-tab-integrate.php | 5 ++--- admin/admin.php | 2 +- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/admin/admin-tab-integrate.php b/admin/admin-tab-integrate.php index 34404715..db2f166e 100644 --- a/admin/admin-tab-integrate.php +++ b/admin/admin-tab-integrate.php @@ -188,12 +188,11 @@ 'label' => esc_html__( 'Google Consent Mode', 'duracelltomi-google-tag-manager' ), 'description' => sprintf( // translators: 1: opening anchor tag linking to Google's documentation about the consent mode command. 2: Closing anchor tag. - gtm4wp_safe_admin_html( - 'Enable this checkbox if you wish to execute the "default" command of %1$sGoogle Consent Mode%2$s before the container loads. + gtm4wp_safe_admin_html( __( 'Enable this checkbox if you wish to execute the "default" command of %1$sGoogle Consent Mode%2$s before the container loads. The "update" command needs to be executed from your consent management tool.

DO NOT enable this feature if your consent manager tool supports firing both the "default" and the "update" command.', 'duracelltomi-google-tag-manager' - ), + ) ), '', '' ), diff --git a/admin/admin.php b/admin/admin.php index 76764bcc..79b26adf 100644 --- a/admin/admin.php +++ b/admin/admin.php @@ -733,7 +733,7 @@ function gtm4wp_admin_init() { GTM4WP_ADMIN_GROUP_GENERAL, array( 'label_for' => GTM4WP_ADMIN_GROUP_CONTAINERON, - 'description' => gtm4wp_safe_admin_html( 'Turning OFF the Google Tag Manager container itself will remove both the head and the body part of the container code but leave data layer codes working.
This should be only used in specific cases where you need to place the container code manually or using another tool.', 'duracelltomi-google-tag-manager' ), + 'description' => gtm4wp_safe_admin_html( __( 'Turning OFF the Google Tag Manager container itself will remove both the head and the body part of the container code but leave data layer codes working.
This should be only used in specific cases where you need to place the container code manually or using another tool.', 'duracelltomi-google-tag-manager' ) ), ) ); From e7e3d9f384671405e5ffa67a388f22105e49b969 Mon Sep 17 00:00:00 2001 From: Thomas Geiger Date: Fri, 12 Jan 2024 13:06:33 +0100 Subject: [PATCH 13/14] Fixing PHPCS warnings of recent PR merge --- admin/admin-tab-integrate.php | 15 +++++++++------ admin/admin.php | 8 +++++++- 2 files changed, 16 insertions(+), 7 deletions(-) diff --git a/admin/admin-tab-integrate.php b/admin/admin-tab-integrate.php index db2f166e..544aa70f 100644 --- a/admin/admin-tab-integrate.php +++ b/admin/admin-tab-integrate.php @@ -187,12 +187,15 @@ GTM4WP_OPTION_INTEGRATE_CONSENTMODE => array( 'label' => esc_html__( 'Google Consent Mode', 'duracelltomi-google-tag-manager' ), 'description' => sprintf( - // translators: 1: opening anchor tag linking to Google's documentation about the consent mode command. 2: Closing anchor tag. - gtm4wp_safe_admin_html( __( 'Enable this checkbox if you wish to execute the "default" command of %1$sGoogle Consent Mode%2$s before the container loads. - The "update" command needs to be executed from your consent management tool.

- DO NOT enable this feature if your consent manager tool supports firing both the "default" and the "update" command.', - 'duracelltomi-google-tag-manager' - ) ), + gtm4wp_safe_admin_html( + // translators: 1: opening anchor tag linking to Google's documentation about the consent mode command. 2: Closing anchor tag. + __( + 'Enable this checkbox if you wish to execute the "default" command of %1$sGoogle Consent Mode%2$s before the container loads. + The "update" command needs to be executed from your consent management tool.

+ DO NOT enable this feature if your consent manager tool supports firing both the "default" and the "update" command.', + 'duracelltomi-google-tag-manager' + ) + ), '', '' ), diff --git a/admin/admin.php b/admin/admin.php index 79b26adf..97dbe133 100644 --- a/admin/admin.php +++ b/admin/admin.php @@ -733,7 +733,13 @@ function gtm4wp_admin_init() { GTM4WP_ADMIN_GROUP_GENERAL, array( 'label_for' => GTM4WP_ADMIN_GROUP_CONTAINERON, - 'description' => gtm4wp_safe_admin_html( __( 'Turning OFF the Google Tag Manager container itself will remove both the head and the body part of the container code but leave data layer codes working.
This should be only used in specific cases where you need to place the container code manually or using another tool.', 'duracelltomi-google-tag-manager' ) ), + 'description' => gtm4wp_safe_admin_html( + __( + 'Turning OFF the Google Tag Manager container itself will remove both the head and the body part of the container code but leave data layer codes working.
+ This should be only used in specific cases where you need to place the container code manually or using another tool.', + 'duracelltomi-google-tag-manager' + ) + ), ) ); From cbdf800a89363c8a658fba639acf63d76e3216a4 Mon Sep 17 00:00:00 2001 From: Thomas Geiger Date: Mon, 15 Jan 2024 16:08:59 +0100 Subject: [PATCH 14/14] Fix: Consent Mode v2 flags without default values --- common/readoptions.php | 188 +++++++++++++++++++++-------------------- 1 file changed, 95 insertions(+), 93 deletions(-) diff --git a/common/readoptions.php b/common/readoptions.php index edb8df1b..41a821f7 100644 --- a/common/readoptions.php +++ b/common/readoptions.php @@ -115,99 +115,101 @@ $gtm4wp_options = array(); $gtm4wp_defaultoptions = array( - GTM4WP_OPTION_GTM_CODE => '', - GTM4WP_OPTION_DATALAYER_NAME => '', - GTM4WP_OPTION_GTM_PLACEMENT => GTM4WP_PLACEMENT_FOOTER, - GTM4WP_OPTION_ENV_GTM_AUTH => '', - GTM4WP_OPTION_ENV_GTM_PREVIEW => '', - GTM4WP_OPTION_LOADEARLY => false, - GTM4WP_OPTION_GTMDOMAIN => '', - GTM4WP_OPTION_GTMCUSTOMPATH => '', - GTM4WP_OPTION_NOGTMFORLOGGEDIN => '', - GTM4WP_OPTION_NOCONSOLELOG => false, - - GTM4WP_OPTION_INCLUDE_LOGGEDIN => false, - GTM4WP_OPTION_INCLUDE_USERROLE => false, - GTM4WP_OPTION_INCLUDE_USERID => false, - GTM4WP_OPTION_INCLUDE_USEREMAIL => false, - GTM4WP_OPTION_INCLUDE_USERREGDATE => false, - GTM4WP_OPTION_INCLUDE_USERNAME => false, - GTM4WP_OPTION_INCLUDE_VISITOR_IP => false, - GTM4WP_OPTION_INCLUDE_POSTTYPE => true, - GTM4WP_OPTION_INCLUDE_CATEGORIES => true, - GTM4WP_OPTION_INCLUDE_TAGS => true, - GTM4WP_OPTION_INCLUDE_AUTHOR => true, - GTM4WP_OPTION_INCLUDE_AUTHORID => false, - GTM4WP_OPTION_INCLUDE_POSTDATE => false, - GTM4WP_OPTION_INCLUDE_POSTTITLE => false, - GTM4WP_OPTION_INCLUDE_POSTCOUNT => false, - GTM4WP_OPTION_INCLUDE_POSTID => false, - GTM4WP_OPTION_INCLUDE_POSTFORMAT => false, - GTM4WP_OPTION_INCLUDE_POSTTERMLIST => false, - GTM4WP_OPTION_INCLUDE_SEARCHDATA => false, - GTM4WP_OPTION_INCLUDE_BROWSERDATA => false, - GTM4WP_OPTION_INCLUDE_OSDATA => false, - GTM4WP_OPTION_INCLUDE_DEVICEDATA => false, - GTM4WP_OPTION_INCLUDE_MISCGEO => false, - GTM4WP_OPTION_INCLUDE_MISCGEOAPI => '', - GTM4WP_OPTION_INCLUDE_MISCGEOCF => false, - GTM4WP_OPTION_INCLUDE_WEATHER => false, - GTM4WP_OPTION_INCLUDE_WEATHERUNITS => 0, - GTM4WP_OPTION_INCLUDE_WEATHEROWMAPI => '', - GTM4WP_OPTION_INCLUDE_SITEID => false, - GTM4WP_OPTION_INCLUDE_SITENAME => false, - - GTM4WP_OPTION_EVENTS_FORMMOVE => false, - GTM4WP_OPTION_EVENTS_NEWUSERREG => false, - GTM4WP_OPTION_EVENTS_USERLOGIN => false, - - GTM4WP_OPTION_EVENTS_YOUTUBE => false, - GTM4WP_OPTION_EVENTS_VIMEO => false, - GTM4WP_OPTION_EVENTS_SOUNDCLOUD => false, - - GTM4WP_OPTION_SCROLLER_ENABLED => false, - GTM4WP_OPTION_SCROLLER_DEBUGMODE => false, - GTM4WP_OPTION_SCROLLER_CALLBACKTIME => 100, - GTM4WP_OPTION_SCROLLER_DISTANCE => 150, - GTM4WP_OPTION_SCROLLER_CONTENTID => 'content', - GTM4WP_OPTION_SCROLLER_READERTIME => 60, - - GTM4WP_OPTION_BLACKLIST_ENABLE => 0, - GTM4WP_OPTION_BLACKLIST_SANDBOXED => false, - GTM4WP_OPTION_BLACKLIST_STATUS => '', - - GTM4WP_OPTION_INTEGRATE_WPCF7 => false, - - GTM4WP_OPTION_INTEGRATE_WCTRACKECOMMERCE => false, - GTM4WP_OPTION_INTEGRATE_WCPRODPERIMPRESSION => 10, - GTM4WP_OPTION_INTEGRATE_WCEINCLUDECARTINDL => false, - GTM4WP_OPTION_INTEGRATE_WCEECBRANDTAXONOMY => '', - GTM4WP_OPTION_INTEGRATE_WCBUSINESSVERTICAL => 'retail', - GTM4WP_OPTION_INTEGRATE_WCUSESKU => false, - GTM4WP_OPTION_INTEGRATE_WCUSEFULLCATEGORYPATH => false, - GTM4WP_OPTION_INTEGRATE_WCREMPRODIDPREFIX => '', - GTM4WP_OPTION_INTEGRATE_WCCUSTOMERDATA => false, - GTM4WP_OPTION_INTEGRATE_WCORDERDATA => false, - GTM4WP_OPTION_INTEGRATE_WCORDERMAXAGE => 30, - GTM4WP_OPTION_INTEGRATE_WCEXCLUDETAX => false, - GTM4WP_OPTION_INTEGRATE_WCEXCLUDESHIPPING => false, - GTM4WP_OPTION_INTEGRATE_WCNOORDERTRACKEDFLAG => false, - GTM4WP_OPTION_INTEGRATE_WCCLEARECOMMERCEDL => false, - - GTM4WP_OPTION_INTEGRATE_WPECOMMERCE => false, - - GTM4WP_OPTION_INTEGRATE_AMPID => '', - - GTM4WP_OPTION_INTEGRATE_COOKIEBOT => false, - - GTM4WP_OPTION_INTEGRATE_WEBTOFFEE_GDPR => false, - - GTM4WP_OPTION_INTEGRATE_CONSENTMODE => false, - GTM4WP_OPTION_INTEGRATE_CONSENTMODE_ADS => false, - GTM4WP_OPTION_INTEGRATE_CONSENTMODE_ANALYTICS => false, - GTM4WP_OPTION_INTEGRATE_CONSENTMODE_PERSO => false, - GTM4WP_OPTION_INTEGRATE_CONSENTMODE_FUNC => false, - GTM4WP_OPTION_INTEGRATE_CONSENTMODE_SECURUTY => false, + GTM4WP_OPTION_GTM_CODE => '', + GTM4WP_OPTION_DATALAYER_NAME => '', + GTM4WP_OPTION_GTM_PLACEMENT => GTM4WP_PLACEMENT_FOOTER, + GTM4WP_OPTION_ENV_GTM_AUTH => '', + GTM4WP_OPTION_ENV_GTM_PREVIEW => '', + GTM4WP_OPTION_LOADEARLY => false, + GTM4WP_OPTION_GTMDOMAIN => '', + GTM4WP_OPTION_GTMCUSTOMPATH => '', + GTM4WP_OPTION_NOGTMFORLOGGEDIN => '', + GTM4WP_OPTION_NOCONSOLELOG => false, + + GTM4WP_OPTION_INCLUDE_LOGGEDIN => false, + GTM4WP_OPTION_INCLUDE_USERROLE => false, + GTM4WP_OPTION_INCLUDE_USERID => false, + GTM4WP_OPTION_INCLUDE_USEREMAIL => false, + GTM4WP_OPTION_INCLUDE_USERREGDATE => false, + GTM4WP_OPTION_INCLUDE_USERNAME => false, + GTM4WP_OPTION_INCLUDE_VISITOR_IP => false, + GTM4WP_OPTION_INCLUDE_POSTTYPE => true, + GTM4WP_OPTION_INCLUDE_CATEGORIES => true, + GTM4WP_OPTION_INCLUDE_TAGS => true, + GTM4WP_OPTION_INCLUDE_AUTHOR => true, + GTM4WP_OPTION_INCLUDE_AUTHORID => false, + GTM4WP_OPTION_INCLUDE_POSTDATE => false, + GTM4WP_OPTION_INCLUDE_POSTTITLE => false, + GTM4WP_OPTION_INCLUDE_POSTCOUNT => false, + GTM4WP_OPTION_INCLUDE_POSTID => false, + GTM4WP_OPTION_INCLUDE_POSTFORMAT => false, + GTM4WP_OPTION_INCLUDE_POSTTERMLIST => false, + GTM4WP_OPTION_INCLUDE_SEARCHDATA => false, + GTM4WP_OPTION_INCLUDE_BROWSERDATA => false, + GTM4WP_OPTION_INCLUDE_OSDATA => false, + GTM4WP_OPTION_INCLUDE_DEVICEDATA => false, + GTM4WP_OPTION_INCLUDE_MISCGEO => false, + GTM4WP_OPTION_INCLUDE_MISCGEOAPI => '', + GTM4WP_OPTION_INCLUDE_MISCGEOCF => false, + GTM4WP_OPTION_INCLUDE_WEATHER => false, + GTM4WP_OPTION_INCLUDE_WEATHERUNITS => 0, + GTM4WP_OPTION_INCLUDE_WEATHEROWMAPI => '', + GTM4WP_OPTION_INCLUDE_SITEID => false, + GTM4WP_OPTION_INCLUDE_SITENAME => false, + + GTM4WP_OPTION_EVENTS_FORMMOVE => false, + GTM4WP_OPTION_EVENTS_NEWUSERREG => false, + GTM4WP_OPTION_EVENTS_USERLOGIN => false, + + GTM4WP_OPTION_EVENTS_YOUTUBE => false, + GTM4WP_OPTION_EVENTS_VIMEO => false, + GTM4WP_OPTION_EVENTS_SOUNDCLOUD => false, + + GTM4WP_OPTION_SCROLLER_ENABLED => false, + GTM4WP_OPTION_SCROLLER_DEBUGMODE => false, + GTM4WP_OPTION_SCROLLER_CALLBACKTIME => 100, + GTM4WP_OPTION_SCROLLER_DISTANCE => 150, + GTM4WP_OPTION_SCROLLER_CONTENTID => 'content', + GTM4WP_OPTION_SCROLLER_READERTIME => 60, + + GTM4WP_OPTION_BLACKLIST_ENABLE => 0, + GTM4WP_OPTION_BLACKLIST_SANDBOXED => false, + GTM4WP_OPTION_BLACKLIST_STATUS => '', + + GTM4WP_OPTION_INTEGRATE_WPCF7 => false, + + GTM4WP_OPTION_INTEGRATE_WCTRACKECOMMERCE => false, + GTM4WP_OPTION_INTEGRATE_WCPRODPERIMPRESSION => 10, + GTM4WP_OPTION_INTEGRATE_WCEINCLUDECARTINDL => false, + GTM4WP_OPTION_INTEGRATE_WCEECBRANDTAXONOMY => '', + GTM4WP_OPTION_INTEGRATE_WCBUSINESSVERTICAL => 'retail', + GTM4WP_OPTION_INTEGRATE_WCUSESKU => false, + GTM4WP_OPTION_INTEGRATE_WCUSEFULLCATEGORYPATH => false, + GTM4WP_OPTION_INTEGRATE_WCREMPRODIDPREFIX => '', + GTM4WP_OPTION_INTEGRATE_WCCUSTOMERDATA => false, + GTM4WP_OPTION_INTEGRATE_WCORDERDATA => false, + GTM4WP_OPTION_INTEGRATE_WCORDERMAXAGE => 30, + GTM4WP_OPTION_INTEGRATE_WCEXCLUDETAX => false, + GTM4WP_OPTION_INTEGRATE_WCEXCLUDESHIPPING => false, + GTM4WP_OPTION_INTEGRATE_WCNOORDERTRACKEDFLAG => false, + GTM4WP_OPTION_INTEGRATE_WCCLEARECOMMERCEDL => false, + + GTM4WP_OPTION_INTEGRATE_WPECOMMERCE => false, + + GTM4WP_OPTION_INTEGRATE_AMPID => '', + + GTM4WP_OPTION_INTEGRATE_COOKIEBOT => false, + + GTM4WP_OPTION_INTEGRATE_WEBTOFFEE_GDPR => false, + + GTM4WP_OPTION_INTEGRATE_CONSENTMODE => false, + GTM4WP_OPTION_INTEGRATE_CONSENTMODE_ADS => false, + GTM4WP_OPTION_INTEGRATE_CONSENTMODE_AD_USER_DATA => false, + GTM4WP_OPTION_INTEGRATE_CONSENTMODE_AD_PERSO => false, + GTM4WP_OPTION_INTEGRATE_CONSENTMODE_ANALYTICS => false, + GTM4WP_OPTION_INTEGRATE_CONSENTMODE_PERSO => false, + GTM4WP_OPTION_INTEGRATE_CONSENTMODE_FUNC => false, + GTM4WP_OPTION_INTEGRATE_CONSENTMODE_SECURUTY => false, ); $gtm4wp_business_verticals = array(