DuracellTomi's Google Tag Manager for WordPress - Version 0.8.2

Version Description

  • Fixed: broken links when listing subcategories instead of products (thanks Jon)
  • Fixed: wheather/weather typo (thanks John Hockaday)
  • Fixed: wrong usage of get_the_permalink() instead of get_permalink() (thanks Szepe Viktor)
Download this release

Release Info

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

Code changes from version 0.8.1 to 0.8.2

duracelltomi-google-tag-manager-for-wordpress.php CHANGED
@@ -1,14 +1,14 @@
1
  <?php
2
  /*
3
  Plugin Name: Google Tag Manager for Wordpress
4
- Version: 0.8.1
5
  Plugin URI: http://www.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
8
  Author URI: http://www.duracelltomi.com/
9
  */
10
 
11
- define( 'GTM4WP_VERSION', '0.8.1' );
12
  define( 'GTM4WP_PATH', plugin_dir_path( __FILE__ ) );
13
  define( 'GTM4WP_TEXTDOMAIN', 'gtm4wp-lang' );
14
 
1
  <?php
2
  /*
3
  Plugin Name: Google Tag Manager for Wordpress
4
+ Version: 0.8.2
5
  Plugin URI: http://www.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
8
  Author URI: http://www.duracelltomi.com/
9
  */
10
 
11
+ define( 'GTM4WP_VERSION', '0.8.2' );
12
  define( 'GTM4WP_PATH', plugin_dir_path( __FILE__ ) );
13
  define( 'GTM4WP_TEXTDOMAIN', 'gtm4wp-lang' );
14
 
integration/woocommerce.php CHANGED
@@ -24,6 +24,9 @@ function gtm4wp_woocommerce_datalayer_filter_items( $dataLayer ) {
24
  $i = ($first-1);
25
  foreach( $_temp_product_id_list as $itemid => $oneproductid ) {
26
  $product = get_product( $oneproductid );
 
 
 
27
 
28
  $product_price = $product->get_price();
29
  $_product_cats = get_the_terms($product->id, 'product_cat');
@@ -330,6 +333,10 @@ function gtm4wp_woocommerce_enhanced_ecom_product_click() {
330
  $woocommerce->add_inline_js("
331
  $('.products li a:not(.add_to_cart_button)').click(function() {
332
  var productdata = $( this ).find( '.gtm4wp_productdata' );
 
 
 
 
333
 
334
  ". $gtm4wp_datalayer_name .".push({
335
  'event': 'gtm4wp.productClick',
@@ -365,7 +372,7 @@ function gtm4wp_woocommerce_enhanced_ecom_add_prod_data() {
365
  $product_cat = "";
366
  }
367
 
368
- echo '<span class="gtm4wp_productdata" data-product_id="' . $product->id . '" data-product_name="' . str_replace( '"', '&quot;', $product->get_title() ) . '" data-product_price="' .$product_price . '" data-product_cat="' . str_replace( '"', '&quot;', $product_cat ) . '" data-product_url="' . get_the_permalink() . '" data-product_listposition="' . $gtm4wp_product_counter . '"></span>';
369
  $gtm4wp_product_counter++;
370
  }
371
 
@@ -380,7 +387,7 @@ function gtm4wp_woocommerce_cart_item_product_filter($product) {
380
  $product_cat = "";
381
  }
382
 
383
- $GLOBALS["gtm4wp_cart_item_proddata"] = '<span class="gtm4wp_productdata" data-product_id="' . $product->id . '" data-product_name="' . str_replace( '"', '&quot;', $product->get_title() ) . '" data-product_price="' .$product_price . '" data-product_cat="' . str_replace( '"', '&quot;', $product_cat ) . '" data-product_url="' . get_the_permalink() . '"></span>';
384
  return $product;
385
  }
386
 
24
  $i = ($first-1);
25
  foreach( $_temp_product_id_list as $itemid => $oneproductid ) {
26
  $product = get_product( $oneproductid );
27
+ if ( false === $product ) {
28
+ continue;
29
+ }
30
 
31
  $product_price = $product->get_price();
32
  $_product_cats = get_the_terms($product->id, 'product_cat');
333
  $woocommerce->add_inline_js("
334
  $('.products li a:not(.add_to_cart_button)').click(function() {
335
  var productdata = $( this ).find( '.gtm4wp_productdata' );
336
+
337
+ if ( 0 == productdata.length ) {
338
+ return true;
339
+ }
340
 
341
  ". $gtm4wp_datalayer_name .".push({
342
  'event': 'gtm4wp.productClick',
372
  $product_cat = "";
373
  }
374
 
375
+ echo '<span class="gtm4wp_productdata" data-product_id="' . $product->id . '" data-product_name="' . str_replace( '"', '&quot;', $product->get_title() ) . '" data-product_price="' .$product_price . '" data-product_cat="' . str_replace( '"', '&quot;', $product_cat ) . '" data-product_url="' . get_permalink() . '" data-product_listposition="' . $gtm4wp_product_counter . '"></span>';
376
  $gtm4wp_product_counter++;
377
  }
378
 
387
  $product_cat = "";
388
  }
389
 
390
+ $GLOBALS["gtm4wp_cart_item_proddata"] = '<span class="gtm4wp_productdata" data-product_id="' . $product->id . '" data-product_name="' . str_replace( '"', '&quot;', $product->get_title() ) . '" data-product_price="' .$product_price . '" data-product_cat="' . str_replace( '"', '&quot;', $product_cat ) . '" data-product_url="' . get_permalink() . '"></span>';
391
  return $product;
392
  }
393
 
public/frontend.php CHANGED
@@ -312,8 +312,8 @@ function gtm4wp_add_basic_datalayer_data( $dataLayer ) {
312
  }
313
 
314
  if ( $gtm4wp_options[ GTM4WP_OPTION_INCLUDE_WEATHER ] ) {
315
- $dataLayer[ "weatherCategory" ] = __( "(no wheather data available)", GTM4WP_TEXTDOMAIN );
316
- $dataLayer[ "weatherDescription" ] = __( "(no wheather data available)", GTM4WP_TEXTDOMAIN );
317
  $dataLayer[ "weatherTemp" ] = 0;
318
  $dataLayer[ "weatherPressure" ] = 0;
319
  $dataLayer[ "weatherWindSpeed" ] = 0;
312
  }
313
 
314
  if ( $gtm4wp_options[ GTM4WP_OPTION_INCLUDE_WEATHER ] ) {
315
+ $dataLayer[ "weatherCategory" ] = __( "(no weather data available)", GTM4WP_TEXTDOMAIN );
316
+ $dataLayer[ "weatherDescription" ] = __( "(no weather data available)", GTM4WP_TEXTDOMAIN );
317
  $dataLayer[ "weatherTemp" ] = 0;
318
  $dataLayer[ "weatherPressure" ] = 0;
319
  $dataLayer[ "weatherWindSpeed" ] = 0;
readme.txt CHANGED
@@ -3,8 +3,8 @@ Contributors: duracelltomi
3
  Donate link: http://duracelltomi.com/
4
  Tags: google tag manager, tag manager, gtm, google, adwords, google adwords, adwords remarketing, remarketing, google analytics, analytics
5
  Requires at least: 3.0.1
6
- Tested up to: 4.0
7
- Stable tag: 0.8.1
8
  License: GPLv3
9
  License URI: http://www.gnu.org/licenses/gpl.html
10
 
@@ -244,6 +244,12 @@ If you or your social plugin inserts the Facebook buttons using IFRAME-s (like S
244
 
245
  == Changelog ==
246
 
 
 
 
 
 
 
247
  = 0.8.1 =
248
 
249
  * Fixed: PHP error in enhanced ecommerce implementation when using layered nav widget
@@ -314,6 +320,10 @@ If you or your social plugin inserts the Facebook buttons using IFRAME-s (like S
314
 
315
  == Upgrade Notice ==
316
 
 
 
 
 
317
  = 0.8.1 =
318
 
319
  Bugfix release for WooCommerce users with Enhanced Ecommerce enabled
3
  Donate link: http://duracelltomi.com/
4
  Tags: google tag manager, tag manager, gtm, google, adwords, google adwords, adwords remarketing, remarketing, google analytics, analytics
5
  Requires at least: 3.0.1
6
+ Tested up to: 4.1
7
+ Stable tag: 0.8.2
8
  License: GPLv3
9
  License URI: http://www.gnu.org/licenses/gpl.html
10
 
244
 
245
  == Changelog ==
246
 
247
+ = 0.8.2 =
248
+
249
+ * Fixed: broken links when listing subcategories instead of products (thanks Jon)
250
+ * Fixed: wheather/weather typo (thanks John Hockaday)
251
+ * Fixed: wrong usage of get_the_permalink() instead of get_permalink() (thanks Szepe Viktor)
252
+
253
  = 0.8.1 =
254
 
255
  * Fixed: PHP error in enhanced ecommerce implementation when using layered nav widget
320
 
321
  == Upgrade Notice ==
322
 
323
+ = 0.8.2 =
324
+
325
+ Another bugfix release for WooCommerce users with Enhanced Ecommerce enabled
326
+
327
  = 0.8.1 =
328
 
329
  Bugfix release for WooCommerce users with Enhanced Ecommerce enabled