Enhanced Ecommerce Google Analytics Plugin for WooCommerce - Version 2.0.2

Version Description

  • 23/05/2018 =
    • IP Anonymization Feature
    • Google Analytics Opt Out
    • Update the Privacy Policy under GDPR Compliance
Download this release

Release Info

Developer Tatvic
Plugin Icon 128x128 Enhanced Ecommerce Google Analytics Plugin for WooCommerce
Version 2.0.2
Comparing to
See all releases

Code changes from version 2.0.1 to 2.0.2

includes/class-wc-enhanced-ecommerce-google-analytics-integration.php CHANGED
@@ -18,7 +18,7 @@ class WC_Enhanced_Ecommerce_Google_Analytics extends WC_Integration {
18
  * @return void
19
  */
20
  //set plugin version
21
- public $tvc_eeVer = '2.0.1';
22
  public function __construct() {
23
 
24
  //Set Global Variables
@@ -55,8 +55,9 @@ class WC_Enhanced_Ecommerce_Google_Analytics extends WC_Integration {
55
  $this->ga_eeT = $this->get_option("ga_eeT");
56
  $this->ga_DF = $this->get_option("ga_DF") == "yes" ? true : false;
57
  $this->ga_imTh = $this->get_option("ga_imTh") == "" ? 6 : $this->get_option("ga_imTh");
58
-
59
-
 
60
  //Save Changes action for admin settings
61
  add_action("woocommerce_update_options_integration_" . $this->id, array($this, "process_admin_options"));
62
 
@@ -207,7 +208,7 @@ class WC_Enhanced_Ecommerce_Google_Analytics extends WC_Integration {
207
  }
208
  $tracking_id = $this->ga_id;
209
 
210
- if (!$tracking_id) {
211
  return;
212
  }
213
  //common validation----end
@@ -217,16 +218,42 @@ class WC_Enhanced_Ecommerce_Google_Analytics extends WC_Integration {
217
  } else {
218
  $set_domain_name = "auto";
219
  }
220
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
221
  $code = '<script async src="https://www.googletagmanager.com/gtag/js?id='.esc_js($tracking_id).'"></script>
222
  <script>
223
  window.dataLayer = window.dataLayer || [];
224
  function gtag(){dataLayer.push(arguments);}
225
  gtag("js", new Date());
 
226
  gtag("config", "'.esc_js($tracking_id).'",{"cookie_domain":"'.$set_domain_name.'"});
227
  </script>
228
  ';
229
- echo $code;
230
  }
231
 
232
  /**
@@ -288,7 +315,34 @@ class WC_Enhanced_Ecommerce_Google_Analytics extends WC_Integration {
288
  'min' => "1",
289
  ),
290
  "default" => get_option("ga_imTh") ? get_option("ga_imTh") : "6" // Backwards compat
291
- ),
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
292
  );
293
  }
294
 
18
  * @return void
19
  */
20
  //set plugin version
21
+ public $tvc_eeVer = '2.0.2';
22
  public function __construct() {
23
 
24
  //Set Global Variables
55
  $this->ga_eeT = $this->get_option("ga_eeT");
56
  $this->ga_DF = $this->get_option("ga_DF") == "yes" ? true : false;
57
  $this->ga_imTh = $this->get_option("ga_imTh") == "" ? 6 : $this->get_option("ga_imTh");
58
+ $this->ga_OPTOUT = $this->get_option("ga_OPTOUT") == "yes" ? true : false; //Google Analytics Opt Out
59
+ $this->ga_PrivacyPolicy = $this->get_option("ga_PrivacyPolicy") == "yes" ? true : false;
60
+ $this->ga_IPA = $this->get_option("ga_IPA") == "yes" ? true : false; //IP Anony.
61
  //Save Changes action for admin settings
62
  add_action("woocommerce_update_options_integration_" . $this->id, array($this, "process_admin_options"));
63
 
208
  }
209
  $tracking_id = $this->ga_id;
210
 
211
+ if (!$tracking_id || !$this->ga_PrivacyPolicy) {
212
  return;
213
  }
214
  //common validation----end
218
  } else {
219
  $set_domain_name = "auto";
220
  }
221
+ // IP Anonymization
222
+ if ($this->ga_IPA) {
223
+ $ga_ip_anonymization = 'gtag("config", "'.$tracking_id.'", { "anonymize_ip": true });';
224
+ } else {
225
+ $ga_ip_anonymization = '';
226
+ }
227
+ if($this->ga_OPTOUT) {
228
+ echo '<script>
229
+ // Set to the same value as the web property used on the site
230
+ var gaProperty = "'.$tracking_id.'";
231
+
232
+ // Disable tracking if the opt-out cookie exists.
233
+ var disableStr = "ga-disable-" + gaProperty;
234
+ if (document.cookie.indexOf(disableStr + "=true") > -1) {
235
+ window[disableStr] = true;
236
+ }
237
+
238
+ // Opt-out function
239
+ function gaOptout() {
240
+ var expDate = new Date;
241
+ expDate.setMonth(expDate.getMonth() + 26);
242
+ document.cookie = disableStr + "=true; expires="+expDate.toGMTString();+"path=/";
243
+ window[disableStr] = true;
244
+ }
245
+ </script>';
246
+ }
247
  $code = '<script async src="https://www.googletagmanager.com/gtag/js?id='.esc_js($tracking_id).'"></script>
248
  <script>
249
  window.dataLayer = window.dataLayer || [];
250
  function gtag(){dataLayer.push(arguments);}
251
  gtag("js", new Date());
252
+ '.$ga_ip_anonymization.'
253
  gtag("config", "'.esc_js($tracking_id).'",{"cookie_domain":"'.$set_domain_name.'"});
254
  </script>
255
  ';
256
+ echo $code;
257
  }
258
 
259
  /**
315
  'min' => "1",
316
  ),
317
  "default" => get_option("ga_imTh") ? get_option("ga_imTh") : "6" // Backwards compat
318
+ ),
319
+ "ga_IPA" => array(
320
+ "title" => __("IP Anonymization", "woocommerce"),
321
+ "label" => __("Enable IP Anonymization (Optional)", "woocommerce"),
322
+ "type" => "checkbox",
323
+ "checkboxgroup" => "",
324
+ "description" => sprintf(__("Use this feature to anonymize (or stop collecting) the I.P Address of your users in Google Analytics. Be in legal compliance by using I.P Anonymization which is important for EU countries As per the GDPR compliance", "woocommerce")),
325
+ "default" => get_option("ga_IPA") ? get_option("ga_IPA") : "no" // Backwards compat
326
+ ),
327
+ "ga_OPTOUT" => array(
328
+ "title" => __("Google Analytics Opt Out", "woocommerce"),
329
+ "label" => __("Enable Google Analytics Opt Out (Optional)", "woocommerce"),
330
+ "type" => "checkbox",
331
+ "checkboxgroup" => "",
332
+ "description" => sprintf(__("Use this feature to provide website visitors the ability to prevent their data from being used by Google Analytics As per the GDPR compliance.Click here to check the setup", "woocommerce")),
333
+ "default" => get_option("ga_OPTOUT") ? get_option("ga_OPTOUT") : "no" // Backwards compat
334
+ ),
335
+ "ga_PrivacyPolicy" => array(
336
+ "title" => __("Privacy Policy", "woocommerce"),
337
+ "label" => __("Accept Privacy Policy of Plugin", "woocommerce"),
338
+ "type" => "checkbox",
339
+ "checkboxgroup" => "",
340
+ 'custom_attributes' => array(
341
+ 'required' => "required",
342
+ ),
343
+ "description" => sprintf(__("By using Tatvic Plugin, you agree to Tatvic plugin's <a href='https://www.tatvic.com/privacy-policy/?ref=plugin_policy&utm_source=plugin_backend&utm_medium=woocommerce_free_plugin&utm_campaign=GDPR_complaince_ecomm_plugins' target='_blank'>Privacy Policy</a>", "woocommerce")),
344
+ "default" => get_option("ga_PrivacyPolicy") ? get_option("ga_PrivacyPolicy") : "no" // Backwards compat
345
+ ),
346
  );
347
  }
348
 
readme.txt CHANGED
@@ -7,8 +7,8 @@ Author URI: http://www.tatvic.com/
7
  Author: Tatvic
8
  Requires at least: 3.6
9
  Tested up to: 4.9
10
- Stable tag: 2.0.1
11
- Version: 2.0.1
12
  License: GPLv3
13
  License URI: http://www.gnu.org/licenses/gpl-3.0.html
14
 
@@ -32,6 +32,8 @@ Provides integration between Enhanced Ecommerce feature of Google Analytics and
32
  8. Captures Product Impressions, Add to Cart & Product Clicks events on Recent Product Section on Homepage
33
  9. Captures Product Impressions, Add to Cart & Product Clicks events on Related Product Section on Productpage
34
  10. Set your local currency
 
 
35
 
36
 
37
  = Installation Instructions =
@@ -65,6 +67,8 @@ We have an Advanced Google Analytics Plugin for WooCommerce which includes track
65
  2. Using an FTP program, or your hosting control panel, upload the unzipped plugin folder to your WordPress installation’s wp-content/plugins/ directory
66
  3. Activate the plugin from the Plugins menu within the WordPress admin
67
  4. Enter your Universal Analytics ID for the plugin to enable the tracking code
 
 
68
 
69
  == Screenshots ==
70
  1. Enable Enhanced E-commerce for your profile/view. This is a profile / view level setting and can be accessed under Admin > View > E-commerce Settings. Also, add meaningful labels for your checkout steps. We recommend you to label as, Step 1 : Checkout View; Step 2 : Login; Step 3 : Proceed to payment;
@@ -84,6 +88,10 @@ Starting the WooCommerce 2.1 release there are no conflicts. However for earlier
84
 
85
  As our plugin automatically tracks all the Enhanced Ecommerce data ( including product name, price, etc dynamically) for your store, you don't need to add any custom/manual code to trackEcommerce events on your store from your end.
86
 
 
 
 
 
87
  = Why are my PayPal transaction data not getting recorded in GA? =
88
 
89
  If you are facing this issue, please check if you have configured auto return in PayPal settings. Configuring auto return will resolve your issue. Here’s a PayPal <a href="https://www.paypal.com/in/cgi-bin/webscr?cmd=p/mer/express_return_summary-outside" target="_blank">documentation</a> & WooCommerce <a href="http://docs.woothemes.com/document/paypal-standard/#section-5" target="_blank">documentation</a> on understanding & setting up Auto Return.
@@ -285,4 +293,9 @@ Important Note: When you update the plugin, please save your settings again.
285
  * Minor Bug Fixes & Optimization.
286
 
287
  = 2.0.1 - 24/04/2018 =
288
- * Minor Bug Fixes & Optimization.
 
 
 
 
 
7
  Author: Tatvic
8
  Requires at least: 3.6
9
  Tested up to: 4.9
10
+ Stable tag: 2.0.2
11
+ Version: 2.0.2
12
  License: GPLv3
13
  License URI: http://www.gnu.org/licenses/gpl-3.0.html
14
 
32
  8. Captures Product Impressions, Add to Cart & Product Clicks events on Recent Product Section on Homepage
33
  9. Captures Product Impressions, Add to Cart & Product Clicks events on Related Product Section on Productpage
34
  10. Set your local currency
35
+ 11. Google Analytics Opt Out
36
+ 12. IP Anonymization
37
 
38
 
39
  = Installation Instructions =
67
  2. Using an FTP program, or your hosting control panel, upload the unzipped plugin folder to your WordPress installation’s wp-content/plugins/ directory
68
  3. Activate the plugin from the Plugins menu within the WordPress admin
69
  4. Enter your Universal Analytics ID for the plugin to enable the tracking code
70
+ 5. Enable the required features
71
+ 5. Accept the Privacy Policy of the Plugin
72
 
73
  == Screenshots ==
74
  1. Enable Enhanced E-commerce for your profile/view. This is a profile / view level setting and can be accessed under Admin > View > E-commerce Settings. Also, add meaningful labels for your checkout steps. We recommend you to label as, Step 1 : Checkout View; Step 2 : Login; Step 3 : Proceed to payment;
88
 
89
  As our plugin automatically tracks all the Enhanced Ecommerce data ( including product name, price, etc dynamically) for your store, you don't need to add any custom/manual code to trackEcommerce events on your store from your end.
90
 
91
+ = Does this plugin match with GDPR compliance? =
92
+
93
+ Yes, our plugin is under GDPR complaince. For more information, read the <a href="https://www.tatvic.com/privacy-policy/?ref=plugin_policy&utm_source=plugin_backend&utm_medium=woocommerce_free_plugin&utm_campaign=GDPR_complaince_ecomm_plugins" target="_blank">privacy policy</a> of our plugin.
94
+
95
  = Why are my PayPal transaction data not getting recorded in GA? =
96
 
97
  If you are facing this issue, please check if you have configured auto return in PayPal settings. Configuring auto return will resolve your issue. Here’s a PayPal <a href="https://www.paypal.com/in/cgi-bin/webscr?cmd=p/mer/express_return_summary-outside" target="_blank">documentation</a> & WooCommerce <a href="http://docs.woothemes.com/document/paypal-standard/#section-5" target="_blank">documentation</a> on understanding & setting up Auto Return.
293
  * Minor Bug Fixes & Optimization.
294
 
295
  = 2.0.1 - 24/04/2018 =
296
+ * Minor Bug Fixes & Optimization.
297
+
298
+ = 2.0.2 - 23/05/2018 =
299
+ * IP Anonymization Feature
300
+ * Google Analytics Opt Out
301
+ * Update the Privacy Policy under GDPR Compliance
woocommerce-enhanced-ecommerce-google-analytics-integration.php CHANGED
@@ -21,7 +21,7 @@
21
  Description: Allows Enhanced E-commerce Google Analytics tracking code to be inserted into WooCommerce store pages.
22
  Author: Tatvic
23
  Author URI: http://www.tatvic.com
24
- Version: 2.0.1
25
  */
26
  if (!defined('ABSPATH')) {
27
  exit; // Exit if accessed directly
21
  Description: Allows Enhanced E-commerce Google Analytics tracking code to be inserted into WooCommerce store pages.
22
  Author: Tatvic
23
  Author URI: http://www.tatvic.com
24
+ Version: 2.0.2
25
  */
26
  if (!defined('ABSPATH')) {
27
  exit; // Exit if accessed directly