DuracellTomi's Google Tag Manager for WordPress - Version 1.10.1

Version Description

  • Fixed: wrong cookie name was used with the newly introduced double transaction tracking protection while setting the cookie
  • Fixed: double transaction tracking JavaScript code is now only included on the order received page
  • Fixed: replaced all references to AdWords to Google Ads
Download this release

Release Info

Developer duracelltomi
Plugin Icon 128x128 DuracellTomi's Google Tag Manager for WordPress
Version 1.10.1
Comparing to
See all releases

Code changes from version 1.10 to 1.10.1

admin/admin.php CHANGED
@@ -129,7 +129,7 @@ $GLOBALS['gtm4wp_includefieldtexts'] = array(
129
  ),
130
  GTM4WP_OPTION_INCLUDE_REMARKETING => array(
131
  'label' => __( 'Remarketing variable', 'duracelltomi-google-tag-manager' ),
132
- 'description' => __( 'Check this option to include a dataLayer variable where all dataLayer values are stored to be included in your AdWords remarketing tag as a custom variable field', 'duracelltomi-google-tag-manager' ),
133
  'phase' => GTM4WP_PHASE_STABLE,
134
  ),
135
  GTM4WP_OPTION_INCLUDE_BROWSERDATA => array(
@@ -300,12 +300,12 @@ $GLOBALS['gtm4wp_blacklistfieldtexts'] = array(
300
  'phase' => GTM4WP_PHASE_STABLE,
301
  ),
302
  GTM4WP_OPTION_BLACKLIST_AWCONV => array(
303
- 'label' => __( 'AdWords Conversion Tracking Tag', 'duracelltomi-google-tag-manager' ),
304
  'description' => __( '', 'duracelltomi-google-tag-manager' ),
305
  'phase' => GTM4WP_PHASE_STABLE,
306
  ),
307
  GTM4WP_OPTION_BLACKLIST_AWREMARKET => array(
308
- 'label' => __( 'AdWords Remarketing Tag', 'duracelltomi-google-tag-manager' ),
309
  'description' => __( '', 'duracelltomi-google-tag-manager' ),
310
  'phase' => GTM4WP_PHASE_STABLE,
311
  ),
@@ -528,8 +528,8 @@ $GLOBALS['gtm4wp_integratefieldtexts'] = array(
528
  'plugintocheck' => 'woocommerce/woocommerce.php',
529
  ),
530
  GTM4WP_OPTION_INTEGRATE_WCREMARKETING => array(
531
- 'label' => __( 'AdWords Remarketing', 'duracelltomi-google-tag-manager' ),
532
- 'description' => __( 'Enable this to add Google AdWords dynamic remarketing variables to the dataLayer', 'duracelltomi-google-tag-manager' ),
533
  'phase' => GTM4WP_PHASE_BETA,
534
  'plugintocheck' => 'woocommerce/woocommerce.php',
535
  ),
@@ -1254,7 +1254,7 @@ function gtm4wp_add_admin_js( $hook ) {
1254
  'posttabtitle' => __( 'Posts', 'duracelltomi-google-tag-manager' ),
1255
  'searchtabtitle' => __( 'Search', 'duracelltomi-google-tag-manager' ),
1256
  'visitortabtitle' => __( 'Visitors', 'duracelltomi-google-tag-manager' ),
1257
- 'adwordstabtitle' => __( 'AdWords', 'duracelltomi-google-tag-manager' ),
1258
  'browsertabtitle' => __( 'Browser/OS/Device', 'duracelltomi-google-tag-manager' ),
1259
  'blocktagstabtitle' => __( 'Blacklist tags', 'duracelltomi-google-tag-manager' ),
1260
  'blockmacrostabtitle' => __( 'Blacklist macros', 'duracelltomi-google-tag-manager' ),
129
  ),
130
  GTM4WP_OPTION_INCLUDE_REMARKETING => array(
131
  'label' => __( 'Remarketing variable', 'duracelltomi-google-tag-manager' ),
132
+ 'description' => __( 'Check this option to include a dataLayer variable where all dataLayer values are stored to be included in your Google Ads remarketing tag as a custom variable field', 'duracelltomi-google-tag-manager' ),
133
  'phase' => GTM4WP_PHASE_STABLE,
134
  ),
135
  GTM4WP_OPTION_INCLUDE_BROWSERDATA => array(
300
  'phase' => GTM4WP_PHASE_STABLE,
301
  ),
302
  GTM4WP_OPTION_BLACKLIST_AWCONV => array(
303
+ 'label' => __( 'Google Ads Conversion Tracking Tag', 'duracelltomi-google-tag-manager' ),
304
  'description' => __( '', 'duracelltomi-google-tag-manager' ),
305
  'phase' => GTM4WP_PHASE_STABLE,
306
  ),
307
  GTM4WP_OPTION_BLACKLIST_AWREMARKET => array(
308
+ 'label' => __( 'Google Ads Remarketing Tag', 'duracelltomi-google-tag-manager' ),
309
  'description' => __( '', 'duracelltomi-google-tag-manager' ),
310
  'phase' => GTM4WP_PHASE_STABLE,
311
  ),
528
  'plugintocheck' => 'woocommerce/woocommerce.php',
529
  ),
530
  GTM4WP_OPTION_INTEGRATE_WCREMARKETING => array(
531
+ 'label' => __( 'Google Ads Remarketing', 'duracelltomi-google-tag-manager' ),
532
+ 'description' => __( 'Enable this to add Google Ads dynamic remarketing variables to the dataLayer', 'duracelltomi-google-tag-manager' ),
533
  'phase' => GTM4WP_PHASE_BETA,
534
  'plugintocheck' => 'woocommerce/woocommerce.php',
535
  ),
1254
  'posttabtitle' => __( 'Posts', 'duracelltomi-google-tag-manager' ),
1255
  'searchtabtitle' => __( 'Search', 'duracelltomi-google-tag-manager' ),
1256
  'visitortabtitle' => __( 'Visitors', 'duracelltomi-google-tag-manager' ),
1257
+ 'adwordstabtitle' => __( 'Google Ads', 'duracelltomi-google-tag-manager' ),
1258
  'browsertabtitle' => __( 'Browser/OS/Device', 'duracelltomi-google-tag-manager' ),
1259
  'blocktagstabtitle' => __( 'Blacklist tags', 'duracelltomi-google-tag-manager' ),
1260
  'blockmacrostabtitle' => __( 'Blacklist macros', 'duracelltomi-google-tag-manager' ),
duracelltomi-google-tag-manager-for-wordpress.php CHANGED
@@ -1,7 +1,7 @@
1
  <?php
2
  /*
3
  Plugin Name: Google Tag Manager for Wordpress
4
- Version: 1.10
5
  Plugin URI: https://gtm4wp.com/
6
  Description: The first Google Tag Manager plugin for WordPress with business goals in mind
7
  Author: Thomas Geiger
@@ -13,7 +13,7 @@ WC requires at least: 2.6
13
  WC tested up to: 3.6.5
14
  */
15
 
16
- define( 'GTM4WP_VERSION', '1.10' );
17
  define( 'GTM4WP_PATH', plugin_dir_path( __FILE__ ) );
18
 
19
  $gtp4wp_plugin_url = plugin_dir_url( __FILE__ );
1
  <?php
2
  /*
3
  Plugin Name: Google Tag Manager for Wordpress
4
+ Version: 1.10.1
5
  Plugin URI: https://gtm4wp.com/
6
  Description: The first Google Tag Manager plugin for WordPress with business goals in mind
7
  Author: Thomas Geiger
13
  WC tested up to: 3.6.5
14
  */
15
 
16
+ define( 'GTM4WP_VERSION', '1.10.1' );
17
  define( 'GTM4WP_PATH', plugin_dir_path( __FILE__ ) );
18
 
19
  $gtp4wp_plugin_url = plugin_dir_url( __FILE__ );
js/gtm4wp-woocommerce-enhanced.js CHANGED
@@ -119,7 +119,9 @@ jQuery(function() {
119
  if ( window[ gtm4wp_datalayer_name ][ i ][ 'ecommerce' ] ) {
120
 
121
  if ( ! window[ gtm4wp_datalayer_name ][ i ][ 'ecommerce' ][ 'impressions' ] ) {
122
- window[ gtm4wp_datalayer_name ][ i ][ 'ecommerce' ][ 'impressions' ] = [];
 
 
123
  }
124
 
125
  break;
119
  if ( window[ gtm4wp_datalayer_name ][ i ][ 'ecommerce' ] ) {
120
 
121
  if ( ! window[ gtm4wp_datalayer_name ][ i ][ 'ecommerce' ][ 'impressions' ] ) {
122
+ window[ gtm4wp_datalayer_name ][ i ][ 'ecommerce' ][ 'impressions' ] = products;
123
+ } else {
124
+ window[ gtm4wp_datalayer_name ][ i ][ 'ecommerce' ][ 'impressions' ] = window[ gtm4wp_datalayer_name ][ i ][ 'ecommerce' ][ 'impressions' ].concat( products );
125
  }
126
 
127
  break;
public/frontend.php CHANGED
@@ -807,7 +807,7 @@ function gtm4wp_wp_header_top( $echo = true ) {
807
  }
808
 
809
  function gtm4wp_wp_header_begin( $echo = true ) {
810
- global $gtm4wp_datalayer_name, $gtm4wp_datalayer_json, $gtm4wp_options;
811
 
812
  $_gtm_header_content = '
813
  <!-- Google Tag Manager for WordPress by gtm4wp.com -->
@@ -850,8 +850,12 @@ function gtm4wp_wp_header_begin( $echo = true ) {
850
  );
851
 
852
  $_gtm_header_content .= '
853
- var dataLayer_content = ' . $gtm4wp_datalayer_json . ';
854
 
 
 
 
 
855
  // if dataLayer contains ecommerce purchase data, check whether it has been already tracked
856
  if ( dataLayer_content.transactionId || ( dataLayer_content.ecommerce && dataLayer_content.ecommerce.purchase ) ) {
857
  // read order id already tracked from cookies
@@ -895,11 +899,13 @@ function gtm4wp_wp_header_begin( $echo = true ) {
895
  var gtm4wp_orderid_cookie_expire = new Date();
896
  gtm4wp_orderid_cookie_expire.setTime( gtm4wp_orderid_cookie_expire.getTime() + (365*24*60*60*1000) );
897
  var gtm4wp_orderid_cookie_expires = "expires="+ gtm4wp_orderid_cookie_expire.toUTCString();
898
- document.cookie = "gtm4wp_orderid_cookie_expire=" + gtm4wp_orderid_tracked + ";" + gtm4wp_orderid_cookie_expire + ";path=/";
899
  }
900
 
901
- }
 
902
 
 
903
  ' . $gtm4wp_datalayer_name . '.push( dataLayer_content );';
904
  }
905
 
807
  }
808
 
809
  function gtm4wp_wp_header_begin( $echo = true ) {
810
+ global $gtm4wp_datalayer_name, $gtm4wp_datalayer_json, $gtm4wp_options, $woocommerce;
811
 
812
  $_gtm_header_content = '
813
  <!-- Google Tag Manager for WordPress by gtm4wp.com -->
850
  );
851
 
852
  $_gtm_header_content .= '
853
+ var dataLayer_content = ' . $gtm4wp_datalayer_json . ';';
854
 
855
+ // fire WooCommerce order double tracking protection only if WooCommerce is active and user is on the order received page
856
+ if ( isset( $gtm4wp_options ) && ( $gtm4wp_options[ GTM4WP_OPTION_INTEGRATE_WCTRACKCLASSICEC ] || $gtm4wp_options[ GTM4WP_OPTION_INTEGRATE_WCTRACKENHANCEDEC ] ) && isset( $woocommerce ) && is_order_received_page() ) {
857
+
858
+ $_gtm_header_content .= '
859
  // if dataLayer contains ecommerce purchase data, check whether it has been already tracked
860
  if ( dataLayer_content.transactionId || ( dataLayer_content.ecommerce && dataLayer_content.ecommerce.purchase ) ) {
861
  // read order id already tracked from cookies
899
  var gtm4wp_orderid_cookie_expire = new Date();
900
  gtm4wp_orderid_cookie_expire.setTime( gtm4wp_orderid_cookie_expire.getTime() + (365*24*60*60*1000) );
901
  var gtm4wp_orderid_cookie_expires = "expires="+ gtm4wp_orderid_cookie_expire.toUTCString();
902
+ document.cookie = "gtm4wp_orderid_tracked=" + gtm4wp_orderid_tracked + ";" + gtm4wp_orderid_cookie_expire + ";path=/";
903
  }
904
 
905
+ }';
906
+ }
907
 
908
+ $_gtm_header_content .= '
909
  ' . $gtm4wp_datalayer_name . '.push( dataLayer_content );';
910
  }
911
 
readme.txt CHANGED
@@ -5,7 +5,7 @@ Tags: google tag manager, tag manager, gtm, google, adwords, google adwords, goo
5
  Requires at least: 3.4.0
6
  Requires PHP: 5.6
7
  Tested up to: 5.2.2
8
- Stable tag: 1.10
9
  License: GPLv3
10
  License URI: http://www.gnu.org/licenses/gpl.html
11
 
@@ -258,6 +258,11 @@ If you or your social plugin inserts the Facebook buttons using IFRAMEs (like So
258
 
259
  == Changelog ==
260
 
 
 
 
 
 
261
  = 1.10 =
262
 
263
  * Added: Automatically add the noscript part of the container code after the opening body tag for WordPress 5.2+ sites where themes support the new wp_body_open action
@@ -267,7 +272,7 @@ If you or your social plugin inserts the Facebook buttons using IFRAMEs (like So
267
  * Added: option to remove shipping costs from revenue data on order received page of WooCommerce
268
  * Added: if you enable either enhanced ecommerce or just Google Ads remarketing variables, 3 new data layer variables will be also available about the product on a detail page
269
  * Product rating details (productRatingCounts)
270
- * Averate product rating (productAverageRating)
271
  * Review count (productReviewCount)
272
  * Added: if you are using Cloudflare, you can now add the country code HTTP header value into the data layer and read from it with the geoCloudflareCountryCode variable name
273
  * Fixed: better compatibility with Google's mod_pagespeed
@@ -597,6 +602,10 @@ Please report all bugs found in my plugin using the [contact form on my website]
597
 
598
  == Upgrade Notice ==
599
 
 
 
 
 
600
  = 1.10 =
601
 
602
  Better WordPress 5.2 integration, support for brands in WooCommerce, access cart content in data layer, more stable double transaction tracking prevention on mobiles and more!
5
  Requires at least: 3.4.0
6
  Requires PHP: 5.6
7
  Tested up to: 5.2.2
8
+ Stable tag: 1.10.1
9
  License: GPLv3
10
  License URI: http://www.gnu.org/licenses/gpl.html
11
 
258
 
259
  == Changelog ==
260
 
261
+ = 1.10.1 =
262
+ * Fixed: wrong cookie name was used with the newly introduced double transaction tracking protection while setting the cookie
263
+ * Fixed: double transaction tracking JavaScript code is now only included on the order received page
264
+ * Fixed: replaced all references to AdWords to Google Ads
265
+
266
  = 1.10 =
267
 
268
  * Added: Automatically add the noscript part of the container code after the opening body tag for WordPress 5.2+ sites where themes support the new wp_body_open action
272
  * Added: option to remove shipping costs from revenue data on order received page of WooCommerce
273
  * Added: if you enable either enhanced ecommerce or just Google Ads remarketing variables, 3 new data layer variables will be also available about the product on a detail page
274
  * Product rating details (productRatingCounts)
275
+ * Average product rating (productAverageRating)
276
  * Review count (productReviewCount)
277
  * Added: if you are using Cloudflare, you can now add the country code HTTP header value into the data layer and read from it with the geoCloudflareCountryCode variable name
278
  * Fixed: better compatibility with Google's mod_pagespeed
602
 
603
  == Upgrade Notice ==
604
 
605
+ = 1.10.1 =
606
+
607
+ Bugfix release
608
+
609
  = 1.10 =
610
 
611
  Better WordPress 5.2 integration, support for brands in WooCommerce, access cart content in data layer, more stable double transaction tracking prevention on mobiles and more!