WooCommerce Google Analytics Integration - Version 1.5.15

Version Description

  • 2022-10-04 =
  • Add - Support for a Google Tag ID.
  • Tweak - WC 7.0 compatibility.
Download this release

Release Info

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

Code changes from version 1.5.14 to 1.5.15

changelog.txt CHANGED
@@ -1,5 +1,9 @@
1
  *** Changelog ***
2
 
 
 
 
 
3
  = 1.5.14 - 2022-09-02 =
4
  * Dev - Add branch-labels GH workflow.
5
  * Dev - GH release config and the new PR template.
1
  *** Changelog ***
2
 
3
+ = 1.5.15 - 2022-10-04 =
4
+ * Add - Support for a Google Tag ID.
5
+ * Tweak - WC 7.0 compatibility.
6
+
7
  = 1.5.14 - 2022-09-02 =
8
  * Dev - Add branch-labels GH workflow.
9
  * Dev - GH release config and the new PR template.
includes/class-wc-google-analytics.php CHANGED
@@ -138,7 +138,6 @@ class WC_Google_Analytics extends WC_Integration {
138
  * Tells WooCommerce which settings to display under the "integration" tab
139
  */
140
  public function init_form_fields() {
141
-
142
  // backwards_compatibility
143
  if ( get_option( 'woocommerce_ga_use_universal_analytics' ) ) {
144
  $ua_default_value = get_option( 'woocommerce_ga_use_universal_analytics' );
@@ -148,87 +147,94 @@ class WC_Google_Analytics extends WC_Integration {
148
  }
149
 
150
  $this->form_fields = array(
151
- 'ga_id' => array(
152
  'title' => __( 'Google Analytics Tracking ID', 'woocommerce-google-analytics-integration' ),
153
- 'description' => __( 'Log into your Google Analytics account to find your ID. e.g. <code>G-XXXXX</code> or <code>UA-XXXXX-X</code>', 'woocommerce-google-analytics-integration' ),
154
  'type' => 'text',
155
- 'placeholder' => 'UA-XXXXX-X',
156
- 'default' => get_option( 'woocommerce_ga_id' ) // Backwards compat
157
  ),
158
- 'ga_set_domain_name' => array(
159
- 'title' => __( 'Set Domain Name', 'woocommerce-google-analytics-integration' ),
160
- 'description' => sprintf( __( '(Optional) Sets the <code>_setDomainName</code> variable. <a href="%s" target="_blank">See here for more information</a>.', 'woocommerce-google-analytics-integration' ), 'https://developers.google.com/analytics/devguides/collection/gajs/gaTrackingSite#multipleDomains' ),
161
- 'type' => 'text',
162
- 'default' => '',
163
- 'class' => 'legacy-setting',
 
164
  ),
165
 
166
- 'ga_gtag_enabled' => array(
167
  'title' => __( 'Tracking Options', 'woocommerce-google-analytics-integration' ),
168
  'label' => __( 'Use Global Site Tag', 'woocommerce-google-analytics-integration' ),
169
- 'description' => sprintf( __( 'The Global Site Tag provides streamlined tagging across Google’s site measurement, conversion tracking, and remarketing products. This must be enabled to use a Google Analytics 4 Measurement ID (e.g., <code>G-XXXXX</code>). <a href="%s" target="_blank">See here for more information</a>.', 'woocommerce-google-analytics-integration' ), 'https://support.google.com/analytics/answer/7475631?hl=en' ),
 
170
  'type' => 'checkbox',
171
  'checkboxgroup' => '',
172
  'default' => get_option( $this->get_option_key() ) ? 'no' : 'yes', // don't enable on updates, only default on new installs
173
  ),
174
 
175
- 'ga_use_universal_analytics' => array(
176
  'label' => __( 'Enable Universal Analytics', 'woocommerce-google-analytics-integration' ),
177
- 'description' => sprintf( __( 'Uses Universal Analytics instead of Classic Google Analytics. If you have <strong>not</strong> previously used Google Analytics on this site, check this box. Otherwise, %sfollow step 1 of the Universal Analytics upgrade guide.%s Enabling this setting will take care of step 2. %sRead more about Universal Analytics%s. Universal Analytics or Global Site Tag must be enabled to enable enhanced eCommerce.', 'woocommerce-google-analytics-integration' ), '<a href="https://developers.google.com/analytics/devguides/collection/upgrade/guide" target="_blank">', '</a>', '<a href="https://support.google.com/analytics/answer/2790010?hl=en" target="_blank">', '</a>' ),
 
178
  'type' => 'checkbox',
179
  'checkboxgroup' => '',
180
  'default' => $ua_default_value,
181
  'class' => 'legacy-setting',
182
  ),
183
- 'ga_standard_tracking_enabled' => array(
184
  'label' => __( 'Enable Standard Tracking', 'woocommerce-google-analytics-integration' ),
185
- 'description' => __( 'This tracks session data such as demographics, system, etc. You don\'t need to enable this if you are using a 3rd party Google analytics plugin.', 'woocommerce-google-analytics-integration' ),
186
  'type' => 'checkbox',
187
  'checkboxgroup' => 'start',
188
- 'default' => get_option( 'woocommerce_ga_standard_tracking_enabled' ) ? get_option( 'woocommerce_ga_standard_tracking_enabled' ) : 'no' // Backwards compat
189
  ),
190
- 'ga_support_display_advertising' => array(
191
  'label' => __( '"Display Advertising" Support', 'woocommerce-google-analytics-integration' ),
192
- 'description' => sprintf( __( 'Set the Google Analytics code to support Display Advertising. %sRead more about Display Advertising%s.', 'woocommerce-google-analytics-integration' ), '<a href="https://support.google.com/analytics/answer/2700409" target="_blank">', '</a>' ),
 
193
  'type' => 'checkbox',
194
  'checkboxgroup' => '',
195
  'default' => get_option( 'woocommerce_ga_support_display_advertising' ) ? get_option( 'woocommerce_ga_support_display_advertising' ) : 'yes', // Backwards compat
196
  ),
197
- 'ga_support_enhanced_link_attribution' => array(
198
  'label' => __( 'Use Enhanced Link Attribution', 'woocommerce-google-analytics-integration' ),
199
- 'description' => sprintf( __( 'Set the Google Analytics code to support Enhanced Link Attribution. %sRead more about Enhanced Link Attribution%s.', 'woocommerce-google-analytics-integration' ), '<a href="https://support.google.com/analytics/answer/7377126?hl=en" target="_blank">', '</a>' ),
 
200
  'type' => 'checkbox',
201
  'checkboxgroup' => '',
202
- 'default' => get_option( 'woocommerce_ga_support_enhanced_link_attribution' ) ? get_option( 'woocommerce_ga_support_enhanced_link_attribution' ) : 'no' // Backwards compat
203
  ),
204
- 'ga_anonymize_enabled' => array(
205
  'label' => __( 'Anonymize IP addresses', 'woocommerce-google-analytics-integration' ),
206
- 'description' => sprintf( __( 'Enabling this option is mandatory in certain countries due to national privacy laws. %sRead more about IP Anonymization%s.', 'woocommerce-google-analytics-integration' ), '<a href="https://support.google.com/analytics/answer/2763052" target="_blank">', '</a>' ),
 
207
  'type' => 'checkbox',
208
  'checkboxgroup' => '',
209
- 'default' => 'yes'
210
  ),
211
- 'ga_404_tracking_enabled' => array(
212
  'label' => __( 'Track 404 (Not found) Errors', 'woocommerce-google-analytics-integration' ),
213
- 'description' => sprintf( __( 'Enable this to find broken or dead links. An "Event" with category "Error" and action "404 Not Found" will be created in Google Analytics for each incoming pageview to a non-existing page. By setting up a "Custom Goal" for these events within Google Analytics you can find out where broken links originated from (the referrer). %sRead how to set up a goal%s.', 'woocommerce-google-analytics-integration' ), '<a href="https://support.google.com/analytics/answer/1032415" target="_blank">', '</a>' ),
 
214
  'type' => 'checkbox',
215
  'checkboxgroup' => '',
216
- 'default' => 'yes'
217
  ),
218
- 'ga_ecommerce_tracking_enabled' => array(
219
- 'label' => __( 'Purchase Transactions', 'woocommerce-google-analytics-integration' ),
220
- 'description' => __( 'This requires a payment gateway that redirects to the thank you/order received page after payment. Orders paid with gateways which do not do this will not be tracked.', 'woocommerce-google-analytics-integration' ),
221
- 'type' => 'checkbox',
222
- 'checkboxgroup' => 'start',
223
- 'default' => get_option( 'woocommerce_ga_ecommerce_tracking_enabled' ) ? get_option( 'woocommerce_ga_ecommerce_tracking_enabled' ) : 'yes', // Backwards compat
224
  ),
225
- 'ga_event_tracking_enabled' => array(
226
- 'label' => __( 'Add to Cart Events', 'woocommerce-google-analytics-integration' ),
227
- 'type' => 'checkbox',
228
- 'checkboxgroup' => '',
229
- 'default' => 'yes',
230
  ),
231
- 'ga_linker_cross_domains' => array(
232
  'title' => __( 'Cross Domain Tracking', 'woocommerce-google-analytics-integration' ),
233
  /* translators: Read more link */
234
  'description' => sprintf( __( 'Add a comma separated list of domains for automatic linking. %1$sRead more about Cross Domain Measurement%2$s', 'woocommerce-google-analytics-integration' ), '<a href="https://support.google.com/analytics/answer/7476333" target="_blank">', '</a>' ),
@@ -236,64 +242,64 @@ class WC_Google_Analytics extends WC_Integration {
236
  'placeholder' => 'example.com, example.net',
237
  'default' => '',
238
  ),
239
- 'ga_linker_allow_incoming_enabled' => array(
240
  'label' => __( 'Accept Incoming Linker Parameters', 'woocommerce-google-analytics-integration' ),
241
  'description' => __( 'Enabling this option will allow incoming linker parameters from other websites.', 'woocommerce-google-analytics-integration' ),
242
  'type' => 'checkbox',
243
  'checkboxgroup' => '',
244
  'default' => 'no',
245
  ),
246
- 'ga_enhanced_ecommerce_tracking_enabled' => array(
247
  'title' => __( 'Enhanced eCommerce', 'woocommerce-google-analytics-integration' ),
248
  'label' => __( 'Enable Enhanced eCommerce ', 'woocommerce-google-analytics-integration' ),
249
- 'description' => sprintf( __( 'Enhanced eCommerce allows you to measure more user interactions with your store, including: product impressions, product detail views, starting the checkout process, adding cart items, and removing cart items. Universal Analytics or Global Site Tag must be enabled for Enhanced eCommerce to work. If using Universal Analytics, turn on Enhanced eCommerce in your Google Analytics dashboard before enabling this setting. <a href="%s" target="_blank">See here for more information</a>.', 'woocommerce-google-analytics-integration' ), 'https://support.google.com/analytics/answer/6032539?hl=en' ),
 
250
  'type' => 'checkbox',
251
  'checkboxgroup' => '',
252
  'default' => 'no',
253
- 'class' => 'legacy-setting'
254
  ),
255
 
256
-
257
  // Enhanced eCommerce Sub-Settings
258
 
259
- 'ga_enhanced_remove_from_cart_enabled' => array(
260
- 'label' => __( 'Remove from Cart Events', 'woocommerce-google-analytics-integration' ),
261
- 'type' => 'checkbox',
262
- 'checkboxgroup' => '',
263
- 'default' => 'yes',
264
- 'class' => 'enhanced-setting'
265
  ),
266
 
267
- 'ga_enhanced_product_impression_enabled' => array(
268
- 'label' => __( 'Product Impressions from Listing Pages', 'woocommerce-google-analytics-integration' ),
269
- 'type' => 'checkbox',
270
- 'checkboxgroup' => '',
271
- 'default' => 'yes',
272
- 'class' => 'enhanced-setting'
273
  ),
274
 
275
- 'ga_enhanced_product_click_enabled' => array(
276
- 'label' => __( 'Product Clicks from Listing Pages', 'woocommerce-google-analytics-integration' ),
277
- 'type' => 'checkbox',
278
- 'checkboxgroup' => '',
279
- 'default' => 'yes',
280
- 'class' => 'enhanced-setting'
281
  ),
282
 
283
  'ga_enhanced_product_detail_view_enabled' => array(
284
- 'label' => __( 'Product Detail Views', 'woocommerce-google-analytics-integration' ),
285
- 'type' => 'checkbox',
286
- 'checkboxgroup' => '',
287
- 'default' => 'yes',
288
- 'class' => 'enhanced-setting'
289
  ),
290
 
291
- 'ga_enhanced_checkout_process_enabled' => array(
292
- 'label' => __( 'Checkout Process Initiated', 'woocommerce-google-analytics-integration' ),
293
- 'type' => 'checkbox',
294
- 'checkboxgroup' => '',
295
- 'default' => 'yes',
296
- 'class' => 'enhanced-setting'
297
  ),
298
  );
299
  }
@@ -317,16 +323,16 @@ class WC_Google_Analytics extends WC_Integration {
317
  * @param array $data Current WC tracker data.
318
  * @return array Updated WC Tracker data.
319
  */
320
- function track_options( $data ) {
321
  $data['wc-google-analytics'] = array(
322
- 'standard_tracking_enabled' => $this->ga_standard_tracking_enabled,
323
- 'support_display_advertising' => $this->ga_support_display_advertising,
324
  'support_enhanced_link_attribution' => $this->ga_support_enhanced_link_attribution,
325
- 'use_universal_analytics' => $this->ga_use_universal_analytics,
326
- 'anonymize_enabled' => $this->ga_anonymize_enabled,
327
  'ga_404_tracking_enabled' => $this->ga_404_tracking_enabled,
328
- 'ecommerce_tracking_enabled' => $this->ga_ecommerce_tracking_enabled,
329
- 'event_tracking_enabled' => $this->ga_event_tracking_enabled,
330
  'gtag_enabled' => $this->ga_gtag_enabled,
331
  'set_domain_name' => empty( $this->ga_set_domain_name ) ? 'no' : 'yes',
332
  'plugin_version' => WC_GOOGLE_ANALYTICS_INTEGRATION_VERSION,
@@ -336,9 +342,9 @@ class WC_Google_Analytics extends WC_Integration {
336
  );
337
 
338
  // ID prefix, blank, or X for unknown
339
- $prefix = substr( strtoupper( $this->ga_id ), 0, 2 );
340
- if ( 'UA' === $prefix || 'G-' === $prefix || empty( $prefix ) ) {
341
- $data['wc-google-analytics']['ga_id'] = str_replace( '-', '', $prefix );
342
  } else {
343
  $data['wc-google-analytics']['ga_id'] = 'X';
344
  }
138
  * Tells WooCommerce which settings to display under the "integration" tab
139
  */
140
  public function init_form_fields() {
 
141
  // backwards_compatibility
142
  if ( get_option( 'woocommerce_ga_use_universal_analytics' ) ) {
143
  $ua_default_value = get_option( 'woocommerce_ga_use_universal_analytics' );
147
  }
148
 
149
  $this->form_fields = array(
150
+ 'ga_id' => array(
151
  'title' => __( 'Google Analytics Tracking ID', 'woocommerce-google-analytics-integration' ),
152
+ 'description' => __( 'Log into your Google Analytics account to find your ID. e.g. <code>GT-XXXXX</code> or <code>G-XXXXX</code>', 'woocommerce-google-analytics-integration' ),
153
  'type' => 'text',
154
+ 'placeholder' => 'GT-XXXXX',
155
+ 'default' => get_option( 'woocommerce_ga_id' ), // Backwards compat
156
  ),
157
+ 'ga_set_domain_name' => array(
158
+ 'title' => __( 'Set Domain Name', 'woocommerce-google-analytics-integration' ),
159
+ /* translators: Read more link */
160
+ 'description' => sprintf( __( '(Optional) Sets the <code>_setDomainName</code> variable. %1$sSee here for more information%2$s.', 'woocommerce-google-analytics-integration' ), '<a href="https://developers.google.com/analytics/devguides/collection/gajs/gaTrackingSite#multipleDomains" target="_blank">', '</a>' ),
161
+ 'type' => 'text',
162
+ 'default' => '',
163
+ 'class' => 'legacy-setting',
164
  ),
165
 
166
+ 'ga_gtag_enabled' => array(
167
  'title' => __( 'Tracking Options', 'woocommerce-google-analytics-integration' ),
168
  'label' => __( 'Use Global Site Tag', 'woocommerce-google-analytics-integration' ),
169
+ /* translators: Read more link */
170
+ 'description' => sprintf( __( 'The Global Site Tag provides streamlined tagging across Google’s site measurement, conversion tracking, and remarketing products. This must be enabled to use a Google Analytics 4 Measurement ID (e.g., <code>G-XXXXX</code> or <code>GT-XXXXX</code>). %1$sSee here for more information%2$s.', 'woocommerce-google-analytics-integration' ), '<a href="https://support.google.com/analytics/answer/7475631?hl=en" target="_blank">', '</a>' ),
171
  'type' => 'checkbox',
172
  'checkboxgroup' => '',
173
  'default' => get_option( $this->get_option_key() ) ? 'no' : 'yes', // don't enable on updates, only default on new installs
174
  ),
175
 
176
+ 'ga_use_universal_analytics' => array(
177
  'label' => __( 'Enable Universal Analytics', 'woocommerce-google-analytics-integration' ),
178
+ /* translators: Read more start and end links */
179
+ 'description' => sprintf( __( 'Uses Universal Analytics instead of Classic Google Analytics. If you have <strong>not</strong> previously used Google Analytics on this site, check this box. Otherwise, %1$sfollow step 1 of the Universal Analytics upgrade guide.%2$s Enabling this setting will take care of step 2. %3$sRead more about Universal Analytics%4$s. Universal Analytics or Global Site Tag must be enabled to enable enhanced eCommerce.', 'woocommerce-google-analytics-integration' ), '<a href="https://developers.google.com/analytics/devguides/collection/upgrade/guide" target="_blank">', '</a>', '<a href="https://support.google.com/analytics/answer/2790010?hl=en" target="_blank">', '</a>' ),
180
  'type' => 'checkbox',
181
  'checkboxgroup' => '',
182
  'default' => $ua_default_value,
183
  'class' => 'legacy-setting',
184
  ),
185
+ 'ga_standard_tracking_enabled' => array(
186
  'label' => __( 'Enable Standard Tracking', 'woocommerce-google-analytics-integration' ),
187
+ 'description' => __( 'This tracks session data such as demographics, system, etc. You don\'t need to enable this if you are using a 3rd party Google analytics plugin.', 'woocommerce-google-analytics-integration' ),
188
  'type' => 'checkbox',
189
  'checkboxgroup' => 'start',
190
+ 'default' => get_option( 'woocommerce_ga_standard_tracking_enabled' ) ? get_option( 'woocommerce_ga_standard_tracking_enabled' ) : 'no', // Backwards compat
191
  ),
192
+ 'ga_support_display_advertising' => array(
193
  'label' => __( '"Display Advertising" Support', 'woocommerce-google-analytics-integration' ),
194
+ /* translators: Read more link */
195
+ 'description' => sprintf( __( 'Set the Google Analytics code to support Display Advertising. %1$sRead more about Display Advertising%2$s.', 'woocommerce-google-analytics-integration' ), '<a href="https://support.google.com/analytics/answer/2700409" target="_blank">', '</a>' ),
196
  'type' => 'checkbox',
197
  'checkboxgroup' => '',
198
  'default' => get_option( 'woocommerce_ga_support_display_advertising' ) ? get_option( 'woocommerce_ga_support_display_advertising' ) : 'yes', // Backwards compat
199
  ),
200
+ 'ga_support_enhanced_link_attribution' => array(
201
  'label' => __( 'Use Enhanced Link Attribution', 'woocommerce-google-analytics-integration' ),
202
+ /* translators: Read more link */
203
+ 'description' => sprintf( __( 'Set the Google Analytics code to support Enhanced Link Attribution. %1$sRead more about Enhanced Link Attribution%2$s.', 'woocommerce-google-analytics-integration' ), '<a href="https://support.google.com/analytics/answer/7377126?hl=en" target="_blank">', '</a>' ),
204
  'type' => 'checkbox',
205
  'checkboxgroup' => '',
206
+ 'default' => get_option( 'woocommerce_ga_support_enhanced_link_attribution' ) ? get_option( 'woocommerce_ga_support_enhanced_link_attribution' ) : 'no', // Backwards compat
207
  ),
208
+ 'ga_anonymize_enabled' => array(
209
  'label' => __( 'Anonymize IP addresses', 'woocommerce-google-analytics-integration' ),
210
+ /* translators: Read more link */
211
+ 'description' => sprintf( __( 'Enabling this option is mandatory in certain countries due to national privacy laws. %1$sRead more about IP Anonymization%2$s.', 'woocommerce-google-analytics-integration' ), '<a href="https://support.google.com/analytics/answer/2763052" target="_blank">', '</a>' ),
212
  'type' => 'checkbox',
213
  'checkboxgroup' => '',
214
+ 'default' => 'yes',
215
  ),
216
+ 'ga_404_tracking_enabled' => array(
217
  'label' => __( 'Track 404 (Not found) Errors', 'woocommerce-google-analytics-integration' ),
218
+ /* translators: Read more link */
219
+ 'description' => sprintf( __( 'Enable this to find broken or dead links. An "Event" with category "Error" and action "404 Not Found" will be created in Google Analytics for each incoming pageview to a non-existing page. By setting up a "Custom Goal" for these events within Google Analytics you can find out where broken links originated from (the referrer). %1$sRead how to set up a goal%2$s.', 'woocommerce-google-analytics-integration' ), '<a href="https://support.google.com/analytics/answer/1032415" target="_blank">', '</a>' ),
220
  'type' => 'checkbox',
221
  'checkboxgroup' => '',
222
+ 'default' => 'yes',
223
  ),
224
+ 'ga_ecommerce_tracking_enabled' => array(
225
+ 'label' => __( 'Purchase Transactions', 'woocommerce-google-analytics-integration' ),
226
+ 'description' => __( 'This requires a payment gateway that redirects to the thank you/order received page after payment. Orders paid with gateways which do not do this will not be tracked.', 'woocommerce-google-analytics-integration' ),
227
+ 'type' => 'checkbox',
228
+ 'checkboxgroup' => 'start',
229
+ 'default' => get_option( 'woocommerce_ga_ecommerce_tracking_enabled' ) ? get_option( 'woocommerce_ga_ecommerce_tracking_enabled' ) : 'yes', // Backwards compat
230
  ),
231
+ 'ga_event_tracking_enabled' => array(
232
+ 'label' => __( 'Add to Cart Events', 'woocommerce-google-analytics-integration' ),
233
+ 'type' => 'checkbox',
234
+ 'checkboxgroup' => '',
235
+ 'default' => 'yes',
236
  ),
237
+ 'ga_linker_cross_domains' => array(
238
  'title' => __( 'Cross Domain Tracking', 'woocommerce-google-analytics-integration' ),
239
  /* translators: Read more link */
240
  'description' => sprintf( __( 'Add a comma separated list of domains for automatic linking. %1$sRead more about Cross Domain Measurement%2$s', 'woocommerce-google-analytics-integration' ), '<a href="https://support.google.com/analytics/answer/7476333" target="_blank">', '</a>' ),
242
  'placeholder' => 'example.com, example.net',
243
  'default' => '',
244
  ),
245
+ 'ga_linker_allow_incoming_enabled' => array(
246
  'label' => __( 'Accept Incoming Linker Parameters', 'woocommerce-google-analytics-integration' ),
247
  'description' => __( 'Enabling this option will allow incoming linker parameters from other websites.', 'woocommerce-google-analytics-integration' ),
248
  'type' => 'checkbox',
249
  'checkboxgroup' => '',
250
  'default' => 'no',
251
  ),
252
+ 'ga_enhanced_ecommerce_tracking_enabled' => array(
253
  'title' => __( 'Enhanced eCommerce', 'woocommerce-google-analytics-integration' ),
254
  'label' => __( 'Enable Enhanced eCommerce ', 'woocommerce-google-analytics-integration' ),
255
+ /* translators: Read more link */
256
+ 'description' => sprintf( __( 'Enhanced eCommerce allows you to measure more user interactions with your store, including: product impressions, product detail views, starting the checkout process, adding cart items, and removing cart items. Universal Analytics or Global Site Tag must be enabled for Enhanced eCommerce to work. If using Universal Analytics, turn on Enhanced eCommerce in your Google Analytics dashboard before enabling this setting. %1$sSee here for more information%2$s.', 'woocommerce-google-analytics-integration' ), '<a href="https://support.google.com/analytics/answer/6032539?hl=en" target="_blank">', '</a>' ),
257
  'type' => 'checkbox',
258
  'checkboxgroup' => '',
259
  'default' => 'no',
260
+ 'class' => 'legacy-setting',
261
  ),
262
 
 
263
  // Enhanced eCommerce Sub-Settings
264
 
265
+ 'ga_enhanced_remove_from_cart_enabled' => array(
266
+ 'label' => __( 'Remove from Cart Events', 'woocommerce-google-analytics-integration' ),
267
+ 'type' => 'checkbox',
268
+ 'checkboxgroup' => '',
269
+ 'default' => 'yes',
270
+ 'class' => 'enhanced-setting',
271
  ),
272
 
273
+ 'ga_enhanced_product_impression_enabled' => array(
274
+ 'label' => __( 'Product Impressions from Listing Pages', 'woocommerce-google-analytics-integration' ),
275
+ 'type' => 'checkbox',
276
+ 'checkboxgroup' => '',
277
+ 'default' => 'yes',
278
+ 'class' => 'enhanced-setting',
279
  ),
280
 
281
+ 'ga_enhanced_product_click_enabled' => array(
282
+ 'label' => __( 'Product Clicks from Listing Pages', 'woocommerce-google-analytics-integration' ),
283
+ 'type' => 'checkbox',
284
+ 'checkboxgroup' => '',
285
+ 'default' => 'yes',
286
+ 'class' => 'enhanced-setting',
287
  ),
288
 
289
  'ga_enhanced_product_detail_view_enabled' => array(
290
+ 'label' => __( 'Product Detail Views', 'woocommerce-google-analytics-integration' ),
291
+ 'type' => 'checkbox',
292
+ 'checkboxgroup' => '',
293
+ 'default' => 'yes',
294
+ 'class' => 'enhanced-setting',
295
  ),
296
 
297
+ 'ga_enhanced_checkout_process_enabled' => array(
298
+ 'label' => __( 'Checkout Process Initiated', 'woocommerce-google-analytics-integration' ),
299
+ 'type' => 'checkbox',
300
+ 'checkboxgroup' => '',
301
+ 'default' => 'yes',
302
+ 'class' => 'enhanced-setting',
303
  ),
304
  );
305
  }
323
  * @param array $data Current WC tracker data.
324
  * @return array Updated WC Tracker data.
325
  */
326
+ public function track_options( $data ) {
327
  $data['wc-google-analytics'] = array(
328
+ 'standard_tracking_enabled' => $this->ga_standard_tracking_enabled,
329
+ 'support_display_advertising' => $this->ga_support_display_advertising,
330
  'support_enhanced_link_attribution' => $this->ga_support_enhanced_link_attribution,
331
+ 'use_universal_analytics' => $this->ga_use_universal_analytics,
332
+ 'anonymize_enabled' => $this->ga_anonymize_enabled,
333
  'ga_404_tracking_enabled' => $this->ga_404_tracking_enabled,
334
+ 'ecommerce_tracking_enabled' => $this->ga_ecommerce_tracking_enabled,
335
+ 'event_tracking_enabled' => $this->ga_event_tracking_enabled,
336
  'gtag_enabled' => $this->ga_gtag_enabled,
337
  'set_domain_name' => empty( $this->ga_set_domain_name ) ? 'no' : 'yes',
338
  'plugin_version' => WC_GOOGLE_ANALYTICS_INTEGRATION_VERSION,
342
  );
343
 
344
  // ID prefix, blank, or X for unknown
345
+ $prefix = strstr( strtoupper( $this->ga_id ), '-', true );
346
+ if ( in_array( $prefix, array( 'UA', 'G', 'GT' ), true ) || empty( $prefix ) ) {
347
+ $data['wc-google-analytics']['ga_id'] = $prefix;
348
  } else {
349
  $data['wc-google-analytics']['ga_id'] = 'X';
350
  }
phpcs.xml.dist CHANGED
@@ -32,7 +32,6 @@
32
  </rule>
33
 
34
  <!-- Include some other sniffs we want to enforce. -->
35
- <rule ref="Generic.Arrays.DisallowLongArraySyntax"/>
36
  <rule ref="Generic.VersionControl.GitMergeConflict"/>
37
  <rule ref="Generic.WhiteSpace.SpreadOperatorSpacingAfter"/>
38
  <rule ref="PSR12.Classes.AnonClassDeclaration"/>
32
  </rule>
33
 
34
  <!-- Include some other sniffs we want to enforce. -->
 
35
  <rule ref="Generic.VersionControl.GitMergeConflict"/>
36
  <rule ref="Generic.WhiteSpace.SpreadOperatorSpacingAfter"/>
37
  <rule ref="PSR12.Classes.AnonClassDeclaration"/>
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.9
6
- Stable tag: 1.5.14
7
  License: GPLv3
8
  License URI: https://www.gnu.org/licenses/gpl-3.0.html
9
 
@@ -60,6 +60,10 @@ Exact wording depends on the national data privacy laws and should be adjusted.
60
 
61
  == Changelog ==
62
 
 
 
 
 
63
  = 1.5.14 - 2022-09-02 =
64
  * Dev - Add branch-labels GH workflow.
65
  * Dev - GH release config and the new PR template.
3
  Tags: woocommerce, google analytics
4
  Requires at least: 3.9
5
  Tested up to: 5.9
6
+ Stable tag: 1.5.15
7
  License: GPLv3
8
  License URI: https://www.gnu.org/licenses/gpl-3.0.html
9
 
60
 
61
  == Changelog ==
62
 
63
+ = 1.5.15 - 2022-10-04 =
64
+ * Add - Support for a Google Tag ID.
65
+ * Tweak - WC 7.0 compatibility.
66
+
67
  = 1.5.14 - 2022-09-02 =
68
  * Dev - Add branch-labels GH workflow.
69
  * Dev - GH release config and the new PR template.
woocommerce-google-analytics-integration.php CHANGED
@@ -5,9 +5,9 @@
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.14
9
  * WC requires at least: 3.2
10
- * WC tested up to: 6.9
11
  * Tested up to: 6.0
12
  * License: GPLv2 or later
13
  * Text Domain: woocommerce-google-analytics-integration
@@ -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.14' ); // 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.15
9
  * WC requires at least: 3.2
10
+ * WC tested up to: 7.0
11
  * Tested up to: 6.0
12
  * License: GPLv2 or later
13
  * Text Domain: woocommerce-google-analytics-integration
20
 
21
  if ( ! class_exists( 'WC_Google_Analytics_Integration' ) ) {
22
 
23
+ define( 'WC_GOOGLE_ANALYTICS_INTEGRATION_VERSION', '1.5.15' ); // WRCS: DEFINED_VERSION.
24
 
25
  // Maybe show the GA Pro notice on plugin activation.
26
  register_activation_hook(