WooCommerce Google Analytics Integration - Version 1.5.3

Version Description

  • 2021-09-15 =
  • Tweak - Avoid unnecessary completed orders queries.
  • Tweak - WC 5.7 compatibility.
  • Tweak - WP 5.8 compatibility.
Download this release

Release Info

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

Code changes from version 1.5.2 to 1.5.3

changelog.txt CHANGED
@@ -1,5 +1,10 @@
1
  *** Changelog ***
2
 
 
 
 
 
 
3
  = 1.5.2 - 2021-07-30 =
4
  * Fix - Change utm_source and utm_medium in upsell notice link.
5
  * Fix - add product links to readme.
1
  *** Changelog ***
2
 
3
+ = 1.5.3 - 2021-09-15 =
4
+ * Tweak - Avoid unnecessary completed orders queries.
5
+ * Tweak - WC 5.7 compatibility.
6
+ * Tweak - WP 5.8 compatibility.
7
+
8
  = 1.5.2 - 2021-07-30 =
9
  * Fix - Change utm_source and utm_medium in upsell notice link.
10
  * Fix - add product links to readme.
languages/woocommerce-google-analytics-integration.pot CHANGED
@@ -2,11 +2,11 @@
2
  # This file is distributed under the GPLv2 or later.
3
  msgid ""
4
  msgstr ""
5
- "Project-Id-Version: WooCommerce Google Analytics Integration 1.5.2\n"
6
  "Report-Msgid-Bugs-To: "
7
  "https://wordpress.org/support/plugin/woocommerce-google-analytics-"
8
  "integration\n"
9
- "POT-Creation-Date: 2021-07-30 14:54:54+00:00\n"
10
  "MIME-Version: 1.0\n"
11
  "Content-Type: text/plain; charset=utf-8\n"
12
  "Content-Transfer-Encoding: 8bit\n"
@@ -242,11 +242,11 @@ msgstr ""
242
  msgid "WooCommerce"
243
  msgstr ""
244
 
245
- #: woocommerce-google-analytics-integration.php:141
246
  msgid "Get detailed insights into your sales with Google Analytics Pro"
247
  msgstr ""
248
 
249
- #: woocommerce-google-analytics-integration.php:144
250
  #. translators: 1: href link to GA pro
251
  msgid ""
252
  "Add advanced tracking for your sales funnel, coupons and more. [<a "
2
  # This file is distributed under the GPLv2 or later.
3
  msgid ""
4
  msgstr ""
5
+ "Project-Id-Version: WooCommerce Google Analytics Integration 1.5.3\n"
6
  "Report-Msgid-Bugs-To: "
7
  "https://wordpress.org/support/plugin/woocommerce-google-analytics-"
8
  "integration\n"
9
+ "POT-Creation-Date: 2021-09-15 08:00:44+00:00\n"
10
  "MIME-Version: 1.0\n"
11
  "Content-Type: text/plain; charset=utf-8\n"
12
  "Content-Transfer-Encoding: 8bit\n"
242
  msgid "WooCommerce"
243
  msgstr ""
244
 
245
+ #: woocommerce-google-analytics-integration.php:146
246
  msgid "Get detailed insights into your sales with Google Analytics Pro"
247
  msgstr ""
248
 
249
+ #: woocommerce-google-analytics-integration.php:149
250
  #. translators: 1: href link to GA pro
251
  msgid ""
252
  "Add advanced tracking for your sales funnel, coupons and more. [<a "
readme.txt CHANGED
@@ -2,8 +2,8 @@
2
  Contributors: woocommerce, automattic, claudiosanches, bor0, royho, laurendavissmith001, c-shultz
3
  Tags: woocommerce, google analytics
4
  Requires at least: 3.9
5
- Tested up to: 5.6
6
- Stable tag: 1.5.2
7
  License: GPLv3
8
  License URI: https://www.gnu.org/licenses/gpl-3.0.html
9
 
@@ -60,6 +60,11 @@ Exact wording depends on the national data privacy laws and should be adjusted.
60
 
61
  == Changelog ==
62
 
 
 
 
 
 
63
  = 1.5.2 - 2021-07-30 =
64
  * Fix - Change utm_source and utm_medium in upsell notice link.
65
  * Fix - add product links to readme.
2
  Contributors: woocommerce, automattic, claudiosanches, bor0, royho, laurendavissmith001, c-shultz
3
  Tags: woocommerce, google analytics
4
  Requires at least: 3.9
5
+ Tested up to: 5.8
6
+ Stable tag: 1.5.3
7
  License: GPLv3
8
  License URI: https://www.gnu.org/licenses/gpl-3.0.html
9
 
60
 
61
  == Changelog ==
62
 
63
+ = 1.5.3 - 2021-09-15 =
64
+ * Tweak - Avoid unnecessary completed orders queries.
65
+ * Tweak - WC 5.7 compatibility.
66
+ * Tweak - WP 5.8 compatibility.
67
+
68
  = 1.5.2 - 2021-07-30 =
69
  * Fix - Change utm_source and utm_medium in upsell notice link.
70
  * Fix - add product links to readme.
woocommerce-google-analytics-integration.php CHANGED
@@ -5,10 +5,10 @@
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.2
9
  * WC requires at least: 3.2
10
- * WC tested up to: 5.0
11
- * Tested up to: 5.6
12
  * License: GPLv2 or later
13
  * Text Domain: woocommerce-google-analytics-integration
14
  * Domain Path: languages/
@@ -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.2' ); // WRCS: DEFINED_VERSION.
24
 
25
  /**
26
  * WooCommerce Google Analytics Integration main class.
@@ -40,7 +40,7 @@ if ( ! class_exists( 'WC_Google_Analytics_Integration' ) ) {
40
 
41
  // Load plugin text domain
42
  add_action( 'init', array( $this, 'load_plugin_textdomain' ) );
43
- add_action( 'init', array( $this, 'show_ga_pro_notices' ) );
44
 
45
  // Checks which WooCommerce is installed.
46
  if ( class_exists( 'WC_Integration' ) && defined( 'WOOCOMMERCE_VERSION' ) && version_compare( WOOCOMMERCE_VERSION, '3.2', '>=' ) ) {
@@ -134,7 +134,12 @@ if ( ! class_exists( 'WC_Google_Analytics_Integration' ) ) {
134
  $completed_orders = wc_orders_count( 'completed' );
135
 
136
  // Only show the notice if there are 10 <= completed orders <= 100.
137
- if ( ! ( 10 <= $completed_orders && $completed_orders <= 100 ) ) {
 
 
 
 
 
138
  return;
139
  }
140
 
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.3
9
  * WC requires at least: 3.2
10
+ * WC tested up to: 5.7
11
+ * Tested up to: 5.8
12
  * License: GPLv2 or later
13
  * Text Domain: woocommerce-google-analytics-integration
14
  * Domain Path: languages/
20
 
21
  if ( ! class_exists( 'WC_Google_Analytics_Integration' ) ) {
22
 
23
+ define( 'WC_GOOGLE_ANALYTICS_INTEGRATION_VERSION', '1.5.3' ); // WRCS: DEFINED_VERSION.
24
 
25
  /**
26
  * WooCommerce Google Analytics Integration main class.
40
 
41
  // Load plugin text domain
42
  add_action( 'init', array( $this, 'load_plugin_textdomain' ) );
43
+ add_action( 'admin_init', array( $this, 'show_ga_pro_notices' ) );
44
 
45
  // Checks which WooCommerce is installed.
46
  if ( class_exists( 'WC_Integration' ) && defined( 'WOOCOMMERCE_VERSION' ) && version_compare( WOOCOMMERCE_VERSION, '3.2', '>=' ) ) {
134
  $completed_orders = wc_orders_count( 'completed' );
135
 
136
  // Only show the notice if there are 10 <= completed orders <= 100.
137
+ $too_few_orders_to_show_the_notice = $completed_orders < 10;
138
+ $too_many_orders_to_show_the_notice = $completed_orders > 100;
139
+ if ( $too_many_orders_to_show_the_notice ) {
140
+ update_option( 'woocommerce_google_analytics_pro_notice_shown', true );
141
+ }
142
+ if ( $too_few_orders_to_show_the_notice || $too_many_orders_to_show_the_notice ) {
143
  return;
144
  }
145