WooCommerce Google Analytics Integration - Version 1.5.6

Version Description

  • 2021-12-29 =
  • Fix - Confirm order key before displaying transaction tracking code.
Download this release

Release Info

Developer automattic
Plugin Icon 128x128 WooCommerce Google Analytics Integration
Version 1.5.6
Comparing to
See all releases

Code changes from version 1.5.5 to 1.5.6

changelog.txt CHANGED
@@ -1,5 +1,8 @@
1
  *** Changelog ***
2
 
 
 
 
3
  = 1.5.5 - 2021-12-09 =
4
  * Tweak - WC 6.0 compatibility.
5
  * Tweak - WP 5.9 compatibility.
1
  *** Changelog ***
2
 
3
+ = 1.5.6 - 2021-12-29 =
4
+ * Fix - Confirm order key before displaying transaction tracking code.
5
+
6
  = 1.5.5 - 2021-12-09 =
7
  * Tweak - WC 6.0 compatibility.
8
  * Tweak - WP 5.9 compatibility.
includes/class-wc-google-analytics.php CHANGED
@@ -401,16 +401,23 @@ class WC_Google_Analytics extends WC_Integration {
401
  return '';
402
  }
403
 
 
 
 
 
 
 
 
404
  $load = $this->get_tracking_instance()->load_analytics( $order );
405
  $code = $this->get_tracking_instance()->add_transaction( $order );
406
 
407
  // Mark the order as tracked.
408
  update_post_meta( $order_id, '_ga_tracked', 1 );
409
 
410
- return "
411
  <!-- WooCommerce Google Analytics Integration -->
412
- " . $this->get_tracking_instance()->header() . "
413
- " . $load . "
414
  <script type='text/javascript'>$code</script>
415
  <!-- /WooCommerce Google Analytics Integration -->
416
  ";
401
  return '';
402
  }
403
 
404
+ // Check order key.
405
+ // phpcs:ignore WordPress.Security.NonceVerification.Recommended,WordPress.Security.ValidatedSanitizedInput.InputNotSanitized
406
+ $order_key = empty( $_GET['key'] ) ? '' : wc_clean( wp_unslash( $_GET['key'] ) );
407
+ if ( ! $order->key_is_valid( $order_key ) ) {
408
+ return '';
409
+ }
410
+
411
  $load = $this->get_tracking_instance()->load_analytics( $order );
412
  $code = $this->get_tracking_instance()->add_transaction( $order );
413
 
414
  // Mark the order as tracked.
415
  update_post_meta( $order_id, '_ga_tracked', 1 );
416
 
417
+ return '
418
  <!-- WooCommerce Google Analytics Integration -->
419
+ ' . $this->get_tracking_instance()->header() . '
420
+ ' . $load . "
421
  <script type='text/javascript'>$code</script>
422
  <!-- /WooCommerce Google Analytics Integration -->
423
  ";
readme.txt CHANGED
@@ -3,7 +3,7 @@ Contributors: woocommerce, automattic, claudiosanches, bor0, royho, laurendaviss
3
  Tags: woocommerce, google analytics
4
  Requires at least: 3.9
5
  Tested up to: 5.8
6
- Stable tag: 1.5.5
7
  License: GPLv3
8
  License URI: https://www.gnu.org/licenses/gpl-3.0.html
9
 
@@ -60,6 +60,9 @@ Exact wording depends on the national data privacy laws and should be adjusted.
60
 
61
  == Changelog ==
62
 
 
 
 
63
  = 1.5.5 - 2021-12-09 =
64
  * Tweak - WC 6.0 compatibility.
65
  * Tweak - WP 5.9 compatibility.
3
  Tags: woocommerce, google analytics
4
  Requires at least: 3.9
5
  Tested up to: 5.8
6
+ Stable tag: 1.5.6
7
  License: GPLv3
8
  License URI: https://www.gnu.org/licenses/gpl-3.0.html
9
 
60
 
61
  == Changelog ==
62
 
63
+ = 1.5.6 - 2021-12-29 =
64
+ * Fix - Confirm order key before displaying transaction tracking code.
65
+
66
  = 1.5.5 - 2021-12-09 =
67
  * Tweak - WC 6.0 compatibility.
68
  * Tweak - WP 5.9 compatibility.
woocommerce-google-analytics-integration.php CHANGED
@@ -5,7 +5,7 @@
5
  * Description: Allows Google Analytics tracking code to be inserted into WooCommerce store pages.
6
  * Author: WooCommerce
7
  * Author URI: https://woocommerce.com
8
- * Version: 1.5.5
9
  * WC requires at least: 3.2
10
  * WC tested up to: 6.0
11
  * Tested up to: 5.9
@@ -20,7 +20,7 @@ if ( ! defined( 'ABSPATH' ) ) {
20
 
21
  if ( ! class_exists( 'WC_Google_Analytics_Integration' ) ) {
22
 
23
- define( 'WC_GOOGLE_ANALYTICS_INTEGRATION_VERSION', '1.5.5' ); // WRCS: DEFINED_VERSION.
24
 
25
  // Maybe show the GA Pro notice on plugin activation.
26
  register_activation_hook(
5
  * Description: Allows Google Analytics tracking code to be inserted into WooCommerce store pages.
6
  * Author: WooCommerce
7
  * Author URI: https://woocommerce.com
8
+ * Version: 1.5.6
9
  * WC requires at least: 3.2
10
  * WC tested up to: 6.0
11
  * Tested up to: 5.9
20
 
21
  if ( ! class_exists( 'WC_Google_Analytics_Integration' ) ) {
22
 
23
+ define( 'WC_GOOGLE_ANALYTICS_INTEGRATION_VERSION', '1.5.6' ); // WRCS: DEFINED_VERSION.
24
 
25
  // Maybe show the GA Pro notice on plugin activation.
26
  register_activation_hook(