DuracellTomi's Google Tag Manager for WordPress - Version 1.11.3

Version Description

  • Fixed: use var_export instead of var_dump in some debug code,
  • Fixed: apply WooCommerce option for tax inclusion on the order received page as well
  • Fixed: JavaScript errors in Vimeo player
  • Updated: do not add type attribute to script elements if theme suppors HTML5
  • Updated: tested version numbers for WordPress and WooCommerce
Download this release

Release Info

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

Code changes from version 1.11.2 to 1.11.3

admin/admin.php CHANGED
@@ -1246,7 +1246,7 @@ function gtm4wp_admin_init() {
1246
  'description' => '<strong>Thomas Geiger</strong><br />
1247
  Website: <a href="https://gtm4wp.com/" target="_blank">gtm4wp.com</a><br />
1248
  <a href="https://www.linkedin.com/in/duracelltomi" target="_blank">Me on LinkedIn</a><br />
1249
- <a href="http://www.linkedin.com/company/jabjab-online-marketing-ltd-" target="_blank">JabJab Online Marketing on LinkedIn</a>',
1250
  )
1251
  );
1252
 
@@ -1310,7 +1310,7 @@ function gtm4wp_add_admin_js( $hook ) {
1310
  );
1311
  wp_localize_script( 'admin-subtabs', 'gtm4wp', $subtabtexts );
1312
 
1313
- wp_enqueue_script( 'admin-subtabs', array(), GTM4WP_VERSION );
1314
  wp_enqueue_script( 'admin-tabcreator', $gtp4wp_plugin_url . 'js/admin-tabcreator.js', array( 'jquery-core' ), GTM4WP_VERSION );
1315
 
1316
  wp_enqueue_style( 'gtm4wp-validate', $gtp4wp_plugin_url . 'css/admin-gtm4wp.css', array(), GTM4WP_VERSION );
1246
  'description' => '<strong>Thomas Geiger</strong><br />
1247
  Website: <a href="https://gtm4wp.com/" target="_blank">gtm4wp.com</a><br />
1248
  <a href="https://www.linkedin.com/in/duracelltomi" target="_blank">Me on LinkedIn</a><br />
1249
+ <a href="http://www.linkedin.com/company/jabjab-online-marketing-ltd" target="_blank">JabJab Online Marketing on LinkedIn</a>',
1250
  )
1251
  );
1252
 
1310
  );
1311
  wp_localize_script( 'admin-subtabs', 'gtm4wp', $subtabtexts );
1312
 
1313
+ wp_enqueue_script( 'admin-subtabs' );
1314
  wp_enqueue_script( 'admin-tabcreator', $gtp4wp_plugin_url . 'js/admin-tabcreator.js', array( 'jquery-core' ), GTM4WP_VERSION );
1315
 
1316
  wp_enqueue_style( 'gtm4wp-validate', $gtp4wp_plugin_url . 'css/admin-gtm4wp.css', array(), GTM4WP_VERSION );
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.11.2
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
@@ -10,10 +10,10 @@ Text Domain: duracelltomi-google-tag-manager
10
  Domain Path: /languages
11
 
12
  WC requires at least: 2.6
13
- WC tested up to: 3.8
14
  */
15
 
16
- define( 'GTM4WP_VERSION', '1.11.2' );
17
  define( 'GTM4WP_PATH', plugin_dir_path( __FILE__ ) );
18
 
19
  global $gtp4wp_plugin_url, $gtp4wp_plugin_basename;
1
  <?php
2
  /*
3
  Plugin Name: Google Tag Manager for Wordpress
4
+ Version: 1.11.3
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
10
  Domain Path: /languages
11
 
12
  WC requires at least: 2.6
13
+ WC tested up to: 3.9.3
14
  */
15
 
16
+ define( 'GTM4WP_VERSION', '1.11.3' );
17
  define( 'GTM4WP_PATH', plugin_dir_path( __FILE__ ) );
18
 
19
  global $gtp4wp_plugin_url, $gtp4wp_plugin_basename;
integration/woocommerce.php CHANGED
@@ -190,7 +190,8 @@ function gtm4wp_process_order_items( $order ) {
190
  }
191
 
192
  $product = ( $gtm4wp_is_woocommerce3 ? $item->get_product() : $order->get_product_from_item( $item ) );
193
- $product_price = (float) $order->get_item_total( $item );
 
194
  $eec_product_array = gtm4wp_process_product( $product, array(
195
  'quantity' => $item->get_quantity(),
196
  'price' => $product_price
@@ -424,7 +425,7 @@ function gtm4wp_woocommerce_datalayer_filter_items( $dataLayer ) {
424
  }
425
  }
426
 
427
- if ( $gtm4wp_options[ GTM4WP_OPTION_INTEGRATE_WCORDERDATA ] && $gtm4wp_is_woocommerce3 ) {
428
  $order_items = gtm4wp_process_order_items( $order );
429
 
430
  $dataLayer['orderData'] = array(
190
  }
191
 
192
  $product = ( $gtm4wp_is_woocommerce3 ? $item->get_product() : $order->get_product_from_item( $item ) );
193
+ $inc_tax = ( 'incl' === get_option( 'woocommerce_tax_display_shop' ) );
194
+ $product_price = (float) $order->get_item_total( $item, $inc_tax );
195
  $eec_product_array = gtm4wp_process_product( $product, array(
196
  'quantity' => $item->get_quantity(),
197
  'price' => $product_price
425
  }
426
  }
427
 
428
+ if ( isset($order) && $gtm4wp_options[ GTM4WP_OPTION_INTEGRATE_WCORDERDATA ] && $gtm4wp_is_woocommerce3 ) {
429
  $order_items = gtm4wp_process_order_items( $order );
430
 
431
  $dataLayer['orderData'] = array(
js/gtm4wp-vimeo.js CHANGED
@@ -105,27 +105,26 @@ jQuery(function() {
105
  'mediaPlayerEvent': 'texttrackchange',
106
  'mediaPlayerEventParam': data,
107
  'mediaCurrentTime': seconds
 
108
 
109
- }).catch( function( error ) {
110
-
111
- window[ gtm4wp_datalayer_name ].push({
112
- 'event': 'gtm4wp.mediaPlayerEvent',
113
- 'mediaType': 'vimeo',
114
- 'mediaData': {
115
- 'id': videoid,
116
- 'author': '',
117
- 'title': "Unknown title",
118
- 'url': videourl,
119
- 'duration': jqframe.attr( "data-player_duration" )
120
- },
121
- 'mediaCurrentTime': 0,
122
- 'mediaPlayerEvent': 'error',
123
- 'mediaPlayerEventParam': error
124
- });
125
 
126
- }); // end call api getCurrentTime()
 
 
 
 
 
 
 
 
 
 
 
 
 
127
 
128
- });
129
 
130
  });
131
 
@@ -147,26 +146,26 @@ jQuery(function() {
147
  'mediaPlayerEventParam': data.volume,
148
  'mediaCurrentTime': seconds
149
 
150
- }).catch( function( error ) {
151
 
152
- window[ gtm4wp_datalayer_name ].push({
153
- 'event': 'gtm4wp.mediaPlayerEvent',
154
- 'mediaType': 'vimeo',
155
- 'mediaData': {
156
- 'id': videoid,
157
- 'author': '',
158
- 'title': "Unknown title",
159
- 'url': videourl,
160
- 'duration': jqframe.attr( "data-player_duration" )
161
- },
162
- 'mediaCurrentTime': 0,
163
- 'mediaPlayerEvent': 'error',
164
- 'mediaPlayerEventParam': error
165
- });
166
 
167
- }); // end call api getCurrentTime()
 
 
 
 
 
 
 
 
 
 
 
 
 
168
 
169
- });
170
 
171
  });
172
 
@@ -188,26 +187,27 @@ jQuery(function() {
188
  'mediaPlayerEventParam': data,
189
  'mediaCurrentTime': seconds
190
 
191
- }).catch( function( error ) {
192
 
193
- window[ gtm4wp_datalayer_name ].push({
194
- 'event': 'gtm4wp.mediaPlayerEvent',
195
- 'mediaType': 'vimeo',
196
- 'mediaData': {
197
- 'id': videoid,
198
- 'author': '',
199
- 'title': "Unknown title",
200
- 'url': videourl,
201
- 'duration': jqframe.attr( "data-player_duration" )
202
- },
203
- 'mediaCurrentTime': 0,
204
- 'mediaPlayerEvent': 'error',
205
- 'mediaPlayerEventParam': error
206
- });
207
 
208
- }); // end call api getCurrentTime()
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
209
 
210
- });
211
  });
212
 
213
  vimeoapi.on( 'timeupdate', function( data ) {
@@ -265,4 +265,4 @@ jQuery(function() {
265
  };
266
 
267
  });
268
- });
105
  'mediaPlayerEvent': 'texttrackchange',
106
  'mediaPlayerEventParam': data,
107
  'mediaCurrentTime': seconds
108
+ });
109
 
110
+ }).catch( function( error ) {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
111
 
112
+ window[ gtm4wp_datalayer_name ].push({
113
+ 'event': 'gtm4wp.mediaPlayerEvent',
114
+ 'mediaType': 'vimeo',
115
+ 'mediaData': {
116
+ 'id': videoid,
117
+ 'author': '',
118
+ 'title': "Unknown title",
119
+ 'url': videourl,
120
+ 'duration': jqframe.attr( "data-player_duration" )
121
+ },
122
+ 'mediaCurrentTime': 0,
123
+ 'mediaPlayerEvent': 'error',
124
+ 'mediaPlayerEventParam': error
125
+ });
126
 
127
+ }); // end call api getCurrentTime()
128
 
129
  });
130
 
146
  'mediaPlayerEventParam': data.volume,
147
  'mediaCurrentTime': seconds
148
 
149
+ });
150
 
151
+ }).catch( function( error ) {
 
 
 
 
 
 
 
 
 
 
 
 
 
152
 
153
+ window[ gtm4wp_datalayer_name ].push({
154
+ 'event': 'gtm4wp.mediaPlayerEvent',
155
+ 'mediaType': 'vimeo',
156
+ 'mediaData': {
157
+ 'id': videoid,
158
+ 'author': '',
159
+ 'title': "Unknown title",
160
+ 'url': videourl,
161
+ 'duration': jqframe.attr( "data-player_duration" )
162
+ },
163
+ 'mediaCurrentTime': 0,
164
+ 'mediaPlayerEvent': 'error',
165
+ 'mediaPlayerEventParam': error
166
+ });
167
 
168
+ }); // end call api getCurrentTime()
169
 
170
  });
171
 
187
  'mediaPlayerEventParam': data,
188
  'mediaCurrentTime': seconds
189
 
190
+ });
191
 
192
+ }).catch( function( error ) {
 
 
 
 
 
 
 
 
 
 
 
 
 
193
 
194
+ window[ gtm4wp_datalayer_name ].push({
195
+ 'event': 'gtm4wp.mediaPlayerEvent',
196
+ 'mediaType': 'vimeo',
197
+ 'mediaData': {
198
+ 'id': videoid,
199
+ 'author': '',
200
+ 'title': "Unknown title",
201
+ 'url': videourl,
202
+ 'duration': jqframe.attr( "data-player_duration" )
203
+ },
204
+ 'mediaCurrentTime': 0,
205
+ 'mediaPlayerEvent': 'error',
206
+ 'mediaPlayerEventParam': error
207
+ });
208
+
209
+ }); // end call api getCurrentTime()
210
 
 
211
  });
212
 
213
  vimeoapi.on( 'timeupdate', function( data ) {
265
  };
266
 
267
  });
268
+ });
public/frontend.php CHANGED
@@ -613,7 +613,7 @@ function gtm4wp_wp_loaded() {
613
  set_transient( 'gtm4wp-weatherdata-' . esc_attr( $client_ip ), $weatherdata, 60 * 60 );
614
  setcookie( 'gtm4wp_last_weatherstatus', 'Weather data loaded.' );
615
  } else {
616
- setcookie( 'gtm4wp_last_weatherstatus', 'Openweathermap.org did not return processable data: ' . var_dump( $weatherdata, true ) );
617
  }
618
  } else {
619
  if ( is_wp_error( $weatherdata ) ) {
@@ -624,7 +624,7 @@ function gtm4wp_wp_loaded() {
624
  }
625
  }
626
  } else {
627
- setcookie( 'gtm4wp_last_weatherstatus', 'ipstack.com did not return lat-lng data: ' . var_dump( $gtm4wp_geodata, true ) );
628
  }
629
  } else {
630
  if ( is_wp_error( $gtm4wp_geodata ) ) {
@@ -773,9 +773,11 @@ function gtm4wp_add_global_vars( $vars, $return = false ) {
773
  function gtm4wp_wp_header_top( $echo = true ) {
774
  global $gtm4wp_options, $gtm4wp_datalayer_name;
775
 
 
 
776
  $_gtm_top_content = '
777
  <!-- Google Tag Manager for WordPress by gtm4wp.com -->
778
- <script data-cfasync="false" data-pagespeed-no-defer type="text/javascript">//<![CDATA[
779
  var gtm4wp_datalayer_name = "' . $gtm4wp_datalayer_name . '";
780
  var ' . $gtm4wp_datalayer_name . ' = ' . $gtm4wp_datalayer_name . ' || [];';
781
 
@@ -809,9 +811,11 @@ function gtm4wp_wp_header_top( $echo = true ) {
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 -->
814
- <script data-cfasync="false" data-pagespeed-no-defer type="text/javascript">//<![CDATA[';
815
 
816
  if ( $gtm4wp_options[ GTM4WP_OPTION_GTM_CODE ] != '' ) {
817
  $gtm4wp_datalayer_data = array();
613
  set_transient( 'gtm4wp-weatherdata-' . esc_attr( $client_ip ), $weatherdata, 60 * 60 );
614
  setcookie( 'gtm4wp_last_weatherstatus', 'Weather data loaded.' );
615
  } else {
616
+ setcookie( 'gtm4wp_last_weatherstatus', 'Openweathermap.org did not return processable data: ' . var_export( $weatherdata, true ) );
617
  }
618
  } else {
619
  if ( is_wp_error( $weatherdata ) ) {
624
  }
625
  }
626
  } else {
627
+ setcookie( 'gtm4wp_last_weatherstatus', 'ipstack.com did not return lat-lng data: ' . var_export( $gtm4wp_geodata, true ) );
628
  }
629
  } else {
630
  if ( is_wp_error( $gtm4wp_geodata ) ) {
773
  function gtm4wp_wp_header_top( $echo = true ) {
774
  global $gtm4wp_options, $gtm4wp_datalayer_name;
775
 
776
+ $has_html5_support = current_theme_supports( 'html5' );
777
+
778
  $_gtm_top_content = '
779
  <!-- Google Tag Manager for WordPress by gtm4wp.com -->
780
+ <script data-cfasync="false" data-pagespeed-no-defer' . ( $has_html5_support ? ' type="text/javascript"' : '' ) . '>//<![CDATA[
781
  var gtm4wp_datalayer_name = "' . $gtm4wp_datalayer_name . '";
782
  var ' . $gtm4wp_datalayer_name . ' = ' . $gtm4wp_datalayer_name . ' || [];';
783
 
811
  function gtm4wp_wp_header_begin( $echo = true ) {
812
  global $gtm4wp_datalayer_name, $gtm4wp_datalayer_json, $gtm4wp_options, $woocommerce;
813
 
814
+ $has_html5_support = current_theme_supports( 'html5' );
815
+
816
  $_gtm_header_content = '
817
  <!-- Google Tag Manager for WordPress by gtm4wp.com -->
818
+ <script data-cfasync="false" data-pagespeed-no-defer' . ( $has_html5_support ? ' type="text/javascript"' : '' ) . '>//<![CDATA[';
819
 
820
  if ( $gtm4wp_options[ GTM4WP_OPTION_GTM_CODE ] != '' ) {
821
  $gtm4wp_datalayer_data = array();
readme.txt CHANGED
@@ -4,8 +4,8 @@ Donate link: https://gtm4wp.com/
4
  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
5
  Requires at least: 3.4.0
6
  Requires PHP: 5.6
7
- Tested up to: 5.2.4
8
- Stable tag: 1.11.2
9
  License: GPLv3
10
  License URI: http://www.gnu.org/licenses/gpl.html
11
 
@@ -258,6 +258,14 @@ If you or your social plugin inserts the Facebook buttons using IFRAMEs (like So
258
 
259
  == Changelog ==
260
 
 
 
 
 
 
 
 
 
261
  = 1.11.2 =
262
 
263
  WARNING!
@@ -652,9 +660,13 @@ Please report all bugs found in my plugin using the [contact form on my website]
652
 
653
  == Upgrade Notice ==
654
 
 
 
 
 
655
  = 1.11.2 =
656
 
657
- No change in plugin code, WP.org deployment of v1.11.1 included wrong directories
658
 
659
  = 1.11.1 =
660
 
4
  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
5
  Requires at least: 3.4.0
6
  Requires PHP: 5.6
7
+ Tested up to: 5.4
8
+ Stable tag: 1.11.3
9
  License: GPLv3
10
  License URI: http://www.gnu.org/licenses/gpl.html
11
 
258
 
259
  == Changelog ==
260
 
261
+ = 1.11.3 =
262
+
263
+ * Fixed: use var_export instead of var_dump in some debug code,
264
+ * Fixed: apply WooCommerce option for tax inclusion on the order received page as well
265
+ * Fixed: JavaScript errors in Vimeo player
266
+ * Updated: do not add type attribute to script elements if theme suppors HTML5
267
+ * Updated: tested version numbers for WordPress and WooCommerce
268
+
269
  = 1.11.2 =
270
 
271
  WARNING!
660
 
661
  == Upgrade Notice ==
662
 
663
+ = 1.11.3 =
664
+
665
+ Some bugfixes and adding support for the latest WordPress and WooCommerce version
666
+
667
  = 1.11.2 =
668
 
669
+ Replaces v1.11.1
670
 
671
  = 1.11.1 =
672