DuracellTomi's Google Tag Manager for WordPress - Version 1.7.1

Version Description

  • Fixed: PHP 5.3 compatible syntax in frontend.php
  • Fixed: PHP error using classic ecommerce with WooCommerce 2.6.x
  • Updated: Added data-cfasync='false' to all
Download this release

Release Info

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

Code changes from version 1.7 to 1.7.1

admin/admin.php CHANGED
@@ -28,7 +28,8 @@ $GLOBALS["gtm4wp_def_user_notices_dismisses"] = array(
28
  "enter-gtm-code" => false,
29
  "wc-ga-plugin-warning" => false,
30
  "wc-gayoast-plugin-warning" => false,
31
- "wc-1-3-upgrade-info" => false
 
32
  );
33
 
34
  $GLOBALS["gtm4wp_includefieldtexts"] = array(
@@ -464,7 +465,7 @@ function gtm4wp_admin_output_section( $args ) {
464
  printf( __( '* Browser, OS and Device data is provided using <a href="%s">WhichBrowser</a> library.', 'duracelltomi-google-tag-manager' ), "http://whichbrowser.net/" );
465
  if ( version_compare( PHP_VERSION, '5.4.0' ) < 0 ) {
466
  echo "<br />";
467
- _e( 'You are using an <strong>outdated</strong> version of PHP (5.3 or less). You <strong>should not turn on</strong> browser/device/os tracking as this can hurt your site. Please talk to your hosting and upgrade to PHP 5.4 or newer.', 'duracelltomi-google-tag-manager' );
468
  }
469
 
470
  break;
@@ -1141,6 +1142,10 @@ function gtm4wp_show_warning() {
1141
  echo '<div class="gtm4wp-notice notice notice-warning is-dismissible" data-href="?wc-1-3-upgrade-info"><p><strong>' . sprintf( __( 'Warning: Using WooCommerce and upgrading to v1.3 of the GTM plugin? <a href="%s" target="_blank">Check this important blog post.</a>', 'duracelltomi-google-tag-manager' ), "https://duracelltomi.com/google-tag-manager-for-wordpress/how-to-articles/upgrading-woocommerce-settings-for-v1-3" ) . '</strong></p></div>';
1142
  }
1143
  }
 
 
 
 
1144
  }
1145
 
1146
  function gtm4wp_dismiss_notice() {
28
  "enter-gtm-code" => false,
29
  "wc-ga-plugin-warning" => false,
30
  "wc-gayoast-plugin-warning" => false,
31
+ "wc-1-3-upgrade-info" => false,
32
+ "php53-warning" => false
33
  );
34
 
35
  $GLOBALS["gtm4wp_includefieldtexts"] = array(
465
  printf( __( '* Browser, OS and Device data is provided using <a href="%s">WhichBrowser</a> library.', 'duracelltomi-google-tag-manager' ), "http://whichbrowser.net/" );
466
  if ( version_compare( PHP_VERSION, '5.4.0' ) < 0 ) {
467
  echo "<br />";
468
+ _e( 'You are using an <strong>outdated</strong> version of PHP (v' . PHP_VERSION . '). You <strong>should not turn on</strong> browser/device/os tracking as this can hurt your site. Please talk to your hosting and upgrade to PHP 5.4 or newer.', 'duracelltomi-google-tag-manager' );
469
  }
470
 
471
  break;
1142
  echo '<div class="gtm4wp-notice notice notice-warning is-dismissible" data-href="?wc-1-3-upgrade-info"><p><strong>' . sprintf( __( 'Warning: Using WooCommerce and upgrading to v1.3 of the GTM plugin? <a href="%s" target="_blank">Check this important blog post.</a>', 'duracelltomi-google-tag-manager' ), "https://duracelltomi.com/google-tag-manager-for-wordpress/how-to-articles/upgrading-woocommerce-settings-for-v1-3" ) . '</strong></p></div>';
1143
  }
1144
  }
1145
+
1146
+ if ( ( false === $gtm4wp_user_notices_dismisses["php53-warning"] ) && ( version_compare( PHP_VERSION, '5.4.0' ) < 0 ) ) {
1147
+ echo '<div class="gtm4wp-notice notice notice-warning is-dismissible" data-href="?php53-warning"><p><strong>' . __( 'Warning: You are using an outdated version of PHP (v' . PHP_VERSION . ') that can cause issues with the plugin Google Tag Manager for WordPress. Please consider to upgrade your PHP.', 'duracelltomi-google-tag-manager' ) . '</strong></p></div>';
1148
+ }
1149
  }
1150
 
1151
  function gtm4wp_dismiss_notice() {
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.7
5
  Plugin URI: https://duracelltomi.com/google-tag-manager-for-wordpress/
6
  Description: The first Google Tag Manager plugin for WordPress with business goals in mind
7
  Author: Thomas Geiger
@@ -10,7 +10,7 @@ Text Domain: duracelltomi-google-tag-manager
10
  Domain Path: /languages
11
  */
12
 
13
- define( 'GTM4WP_VERSION', '1.7' );
14
  define( 'GTM4WP_PATH', plugin_dir_path( __FILE__ ) );
15
 
16
  $gtp4wp_plugin_url = plugin_dir_url( __FILE__ );
1
  <?php
2
  /*
3
  Plugin Name: Google Tag Manager for Wordpress
4
+ Version: 1.7.1
5
  Plugin URI: https://duracelltomi.com/google-tag-manager-for-wordpress/
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
 
13
+ define( 'GTM4WP_VERSION', '1.7.1' );
14
  define( 'GTM4WP_PATH', plugin_dir_path( __FILE__ ) );
15
 
16
  $gtp4wp_plugin_url = plugin_dir_url( __FILE__ );
integration/woocommerce.php CHANGED
@@ -290,7 +290,7 @@ function gtm4wp_woocommerce_datalayer_filter_items( $dataLayer ) {
290
  $dataLayer["transactionShipping"] = $order->get_total_shipping();
291
  }
292
  $dataLayer["transactionTax"] = $order->get_total_tax();
293
- $dataLayer["transactionPaymentType"] = $order->get_payment_method_title();
294
  $dataLayer["transactionCurrency"] = get_woocommerce_currency();
295
  $dataLayer["transactionShippingMethod"] = $order->get_shipping_method();
296
  $dataLayer["transactionPromoCode"] = implode( ", ", $order->get_used_coupons() );
@@ -694,7 +694,7 @@ function gtm4wp_woocommerce_wp_footer() {
694
 
695
  if ( ( true === $gtm4wp_options[ GTM4WP_OPTION_INTEGRATE_WCREMARKETING ] ) && ( ! is_cart() ) ) {
696
  echo "
697
- <script type='text/javascript'>
698
  (function($) {
699
  if ( $( '.gtm4wp_productdata' ).length > 0 ) {
700
  for( var i=0; i<". $gtm4wp_datalayer_name .".length; i++ ) {
@@ -726,7 +726,7 @@ function gtm4wp_woocommerce_wp_footer() {
726
 
727
  if ( true === $gtm4wp_options[ GTM4WP_OPTION_INTEGRATE_WCTRACKENHANCEDEC ] ) {
728
  echo "
729
- <script type='text/javascript'>
730
  (function($) {
731
  if ( $( '.gtm4wp_productdata,.widget-product-item' ).length > 0 ) {
732
  for( var i=0; i<". $gtm4wp_datalayer_name .".length; i++ ) {
290
  $dataLayer["transactionShipping"] = $order->get_total_shipping();
291
  }
292
  $dataLayer["transactionTax"] = $order->get_total_tax();
293
+ $dataLayer["transactionPaymentType"] = ( $gtm4wp_is_woocommerce3 ? $order->get_payment_method_title() : $order->payment_method_title);
294
  $dataLayer["transactionCurrency"] = get_woocommerce_currency();
295
  $dataLayer["transactionShippingMethod"] = $order->get_shipping_method();
296
  $dataLayer["transactionPromoCode"] = implode( ", ", $order->get_used_coupons() );
694
 
695
  if ( ( true === $gtm4wp_options[ GTM4WP_OPTION_INTEGRATE_WCREMARKETING ] ) && ( ! is_cart() ) ) {
696
  echo "
697
+ <script data-cfasync='false' type='text/javascript'>
698
  (function($) {
699
  if ( $( '.gtm4wp_productdata' ).length > 0 ) {
700
  for( var i=0; i<". $gtm4wp_datalayer_name .".length; i++ ) {
726
 
727
  if ( true === $gtm4wp_options[ GTM4WP_OPTION_INTEGRATE_WCTRACKENHANCEDEC ] ) {
728
  echo "
729
+ <script data-cfasync='false' type='text/javascript'>
730
  (function($) {
731
  if ( $( '.gtm4wp_productdata,.widget-product-item' ).length > 0 ) {
732
  for( var i=0; i<". $gtm4wp_datalayer_name .".length; i++ ) {
public/frontend.php CHANGED
@@ -21,7 +21,7 @@ function gtm4wp_is_assoc($arr) {
21
 
22
  if ( !function_exists( "getallheaders") ) {
23
  function getallheaders() {
24
- $headers = [];
25
  foreach ( $_SERVER as $name => $value ) {
26
  if ( substr($name, 0, 5) == "HTTP_" ) {
27
  $headers[ str_replace(' ', '-', ucwords( strtolower( str_replace( '_', ' ', substr( $name, 5 ) ) ) ) ) ] = $value;
21
 
22
  if ( !function_exists( "getallheaders") ) {
23
  function getallheaders() {
24
+ $headers = array();
25
  foreach ( $_SERVER as $name => $value ) {
26
  if ( substr($name, 0, 5) == "HTTP_" ) {
27
  $headers[ str_replace(' ', '-', ucwords( strtolower( str_replace( '_', ' ', substr( $name, 5 ) ) ) ) ) ] = $value;
readme.txt CHANGED
@@ -4,7 +4,7 @@ Donate link: https://duracelltomi.com/
4
  Tags: google tag manager, tag manager, gtm, google, adwords, google adwords, adwords remarketing, remarketing, google analytics, analytics, facebook ads, facebook remarketing, facebook pixel
5
  Requires at least: 3.4.0
6
  Tested up to: 4.8.1
7
- Stable tag: 1.7
8
  License: GPLv3
9
  License URI: http://www.gnu.org/licenses/gpl.html
10
 
@@ -271,6 +271,13 @@ If you or your social plugin inserts the Facebook buttons using IFRAMEs (like So
271
 
272
  == Changelog ==
273
 
 
 
 
 
 
 
 
274
  = 1.7 =
275
 
276
  * Updated: even better WooCommerce 3.0 compatibility (WooCommerce 2.6 still supported but this support ends with the next plugin version)
@@ -493,6 +500,10 @@ Please report all bugs found in my plugin using the [contact form on my website]
493
 
494
  == Upgrade Notice ==
495
 
 
 
 
 
496
  = 1.7 =
497
 
498
  Better WooCommerce 3.x compatibility and new features
4
  Tags: google tag manager, tag manager, gtm, google, adwords, google adwords, adwords remarketing, remarketing, google analytics, analytics, facebook ads, facebook remarketing, facebook pixel
5
  Requires at least: 3.4.0
6
  Tested up to: 4.8.1
7
+ Stable tag: 1.7.1
8
  License: GPLv3
9
  License URI: http://www.gnu.org/licenses/gpl.html
10
 
271
 
272
  == Changelog ==
273
 
274
+ = 1.7.1 =
275
+
276
+ * Fixed: PHP 5.3 compatible syntax in frontend.php
277
+ * Fixed: PHP error using classic ecommerce with WooCommerce 2.6.x
278
+ * Updated: Added data-cfasync='false' to all <script> elements to prevent ClourFlare to load scripts async
279
+ * Added: Warning for users of PHP 5.4 or older to consier upgrade (FYI: PHP 5.5 and older versions do not get even security fixes)
280
+
281
  = 1.7 =
282
 
283
  * Updated: even better WooCommerce 3.0 compatibility (WooCommerce 2.6 still supported but this support ends with the next plugin version)
500
 
501
  == Upgrade Notice ==
502
 
503
+ = 1.7.1 =
504
+
505
+ Bugfix release: better PHP 5.3 and WooCommerce 2.6.x compatibility
506
+
507
  = 1.7 =
508
 
509
  Better WooCommerce 3.x compatibility and new features