Enhanced Ecommerce Google Analytics Plugin for WooCommerce - Version 1.0.14

Version Description

  • 10/02/2015 =
    • Fixed - session_start() function warning
    • Fixed - Notice: Undefined variable: coupons_list
    • Fixed - woocommerce deprecated function warning
Download this release

Release Info

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

Code changes from version 1.0.13 to 1.0.14

includes/class-wc-enhanced-ecommerce-google-analytics-integration.php CHANGED
@@ -7,8 +7,7 @@
7
  *
8
  * @class WC_Enhanced_Ecommerce_Google_Analytics
9
  * @extends WC_Integration
10
- * @author Sudhir Mishra <sudhir@tatvic.com>
11
- * @contributor Jigar Navadiya <jigar@tatvic.com>
12
  */
13
  class WC_Enhanced_Ecommerce_Google_Analytics extends WC_Integration {
14
 
@@ -19,7 +18,7 @@ class WC_Enhanced_Ecommerce_Google_Analytics extends WC_Integration {
19
  * @return void
20
  */
21
  //set plugin version
22
- public $tvc_eeVer = '1.0.13';
23
  public function __construct() {
24
 
25
  //Set Global Variables
@@ -29,10 +28,10 @@ class WC_Enhanced_Ecommerce_Google_Analytics extends WC_Integration {
29
  //define plugin ID
30
  $this->id = "enhanced_ecommerce_google_analytics";
31
  $this->method_title = __("Enhanced Ecommerce Google Analytics", "woocommerce");
32
- $this->method_description = __("Enhanced Ecommerce is a new feature of Universal Analytics that generates detailed statistics about the users journey from product page to thank you page on your e-store. <br/><a href='http://www.tatvic.com/blog/enhanced-ecommerce/' target='_blank'>Know more about Enhanced Ecommerce.</a>", "woocommerce");
33
 
34
- //start session for product position count
35
- session_start();
36
  $_SESSION['t_npcnt']=0;
37
  $_SESSION['t_fpcnt']=0;
38
  // Load the integration form
@@ -304,10 +303,10 @@ class WC_Enhanced_Ecommerce_Google_Analytics extends WC_Integration {
304
  // Get the order and output tracking code
305
  $order = new WC_Order($order_id);
306
  //Get Applied Coupon Codes
 
307
  if ($order->get_used_coupons()) {
308
  $coupons_count = count($order->get_used_coupons());
309
  $i = 1;
310
- $coupons_list = '';
311
  foreach ($order->get_used_coupons() as $coupon) {
312
  $coupons_list .= $coupon;
313
  if ($i < $coupons_count)
@@ -378,13 +377,21 @@ class WC_Enhanced_Ecommerce_Google_Analytics extends WC_Integration {
378
  //make json for prod meta data on order page
379
  $this->wc_version_compare("tvc_oc=" . json_encode($orderpage_prod_Array) . ";");
380
  }
 
 
 
 
 
 
 
 
381
  //orderpage transcation data json
382
  $orderpage_trans_Array=array(
383
  "id"=> esc_js($order->get_order_number()), // Transaction ID. Required
384
  "affiliation"=> esc_js(get_bloginfo('name')), // Affiliation or store name
385
  "revenue"=>esc_js($order->get_total()), // Grand Total
386
  "tax"=> esc_js($order->get_total_tax()), // Tax
387
- "shipping"=> esc_js($order->get_shipping()), // Shipping
388
  "coupon"=>$coupons_list
389
  );
390
  //make json for trans data on order page
@@ -1111,6 +1118,9 @@ class WC_Enhanced_Ecommerce_Google_Analytics extends WC_Integration {
1111
  * @access public
1112
  */
1113
  function admin_check_UA_enabled() {
 
 
 
1114
  echo '<script>
1115
  jQuery("#woocommerce_enhanced_ecommerce_google_analytics_ga_ST").change(function(){
1116
  t_ga_chk=jQuery(this).is(":checked");
@@ -1124,8 +1134,11 @@ class WC_Enhanced_Ecommerce_Google_Analytics extends WC_Integration {
1124
  jQuery("#woocommerce_enhanced_ecommerce_google_analytics_ga_DF").removeAttr("checked");
1125
  } }
1126
  });
 
 
1127
  </script>';
1128
  }
 
1129
 
1130
  /**
1131
  * Sending email to remote server
7
  *
8
  * @class WC_Enhanced_Ecommerce_Google_Analytics
9
  * @extends WC_Integration
10
+ * @author Jigar Navadiya <jigar@tatvic.com>
 
11
  */
12
  class WC_Enhanced_Ecommerce_Google_Analytics extends WC_Integration {
13
 
18
  * @return void
19
  */
20
  //set plugin version
21
+ public $tvc_eeVer = '1.0.14';
22
  public function __construct() {
23
 
24
  //Set Global Variables
28
  //define plugin ID
29
  $this->id = "enhanced_ecommerce_google_analytics";
30
  $this->method_title = __("Enhanced Ecommerce Google Analytics", "woocommerce");
31
+ $this->method_description = __("Enhanced Ecommerce is a new feature of Universal Analytics that generates detailed statistics about the users journey from product page to thank you page on your e-store. <br/><a href='http://www.tatvic.com/blog/enhanced-ecommerce/' target='_blank'>Know more about Enhanced Ecommerce.</a><br/><br/><b>Quick Tip:</b> We recently launched an Advanced Google Analytics Plugin for WooCommerce! The plugin offers tracking of 9 Reports of Enhanced Ecommerce, User ID Tracking, 15+ Custom Dimenensions & Metrics, Content Grouping & much more. <a href='http://bit.ly/1yFqA04' target='_blank'>Learn More</a>", "woocommerce");
32
 
33
+
34
+ //session for product position count //session_start removed bcoz it gives warning
35
  $_SESSION['t_npcnt']=0;
36
  $_SESSION['t_fpcnt']=0;
37
  // Load the integration form
303
  // Get the order and output tracking code
304
  $order = new WC_Order($order_id);
305
  //Get Applied Coupon Codes
306
+ $coupons_list = '';
307
  if ($order->get_used_coupons()) {
308
  $coupons_count = count($order->get_used_coupons());
309
  $i = 1;
 
310
  foreach ($order->get_used_coupons() as $coupon) {
311
  $coupons_list .= $coupon;
312
  if ($i < $coupons_count)
377
  //make json for prod meta data on order page
378
  $this->wc_version_compare("tvc_oc=" . json_encode($orderpage_prod_Array) . ";");
379
  }
380
+
381
+
382
+ //get shipping cost based on version >2.1 get_total_shipping() < get_shipping
383
+ if (version_compare($woocommerce->version, "2.1", ">=")) {
384
+ $tvc_sc = $order->get_total_shipping();
385
+ } else {
386
+ $tvc_sc = $order->get_shipping();
387
+ }
388
  //orderpage transcation data json
389
  $orderpage_trans_Array=array(
390
  "id"=> esc_js($order->get_order_number()), // Transaction ID. Required
391
  "affiliation"=> esc_js(get_bloginfo('name')), // Affiliation or store name
392
  "revenue"=>esc_js($order->get_total()), // Grand Total
393
  "tax"=> esc_js($order->get_total_tax()), // Tax
394
+ "shipping"=> esc_js($tvc_sc), // Shipping
395
  "coupon"=>$coupons_list
396
  );
397
  //make json for trans data on order page
1118
  * @access public
1119
  */
1120
  function admin_check_UA_enabled() {
1121
+ $t_tab_name = $_GET['tab'];
1122
+ if($t_tab_name=='integration'){
1123
+
1124
  echo '<script>
1125
  jQuery("#woocommerce_enhanced_ecommerce_google_analytics_ga_ST").change(function(){
1126
  t_ga_chk=jQuery(this).is(":checked");
1134
  jQuery("#woocommerce_enhanced_ecommerce_google_analytics_ga_DF").removeAttr("checked");
1135
  } }
1136
  });
1137
+ //Pugin Promotion
1138
+ jQuery("form#mainform").after("<a href=http://bit.ly/1yFqA04 target=_blank><img src=http://www.tatvic.com/blog/wp-content/uploads/2015/02/woo_plugin_promotion.png title=Actionable Google Analytics Plugin by Tatvic alt=Actionable Google Analytics Plugin by Tatvic></a>");
1139
  </script>';
1140
  }
1141
+ }
1142
 
1143
  /**
1144
  * Sending email to remote server
readme.txt CHANGED
@@ -6,9 +6,9 @@ Tags: Google Analytics, Universal Analytics, Enhanced E-commerce, E-commerce, e-
6
  Author URI: http://www.tatvic.com/
7
  Author: Tatvic
8
  Requires at least: 3.6
9
- Tested up to: 3.9.2
10
- Stable tag: 1.0.13
11
- Version: 1.0.13
12
  License: GPLv3
13
  License URI: http://www.gnu.org/licenses/gpl-3.0.html
14
 
@@ -33,10 +33,11 @@ Provides integration between Google Analytics Enhanced Ecommerce and WooCommerce
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
  = Installation Instructions =
37
  * 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
38
 
39
- * 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
40
 
41
  * Remove standard E-commerce code from thank you along with the ecommerce.js which is included by <code>ga('require', 'ecommerce', 'ecommerce.js');</code>. If you are using a third party plugin for e-commerce tracking, you would have to disable the plugin.
42
 
@@ -46,9 +47,12 @@ Provides integration between Google Analytics Enhanced Ecommerce and WooCommerce
46
 
47
  * If you have a guest checkout on your WooCommerce store, then Check the box “Add Code to Track the Login Step of Guest Users”. If you have a guest login but you do not check the box, then it might cause an uneven funnel reporting in Google Analytics.
48
 
49
- *All the product sections on homepage other than feature product will be fired as Recent Product and will be available in product list performance report.
 
 
50
 
51
- *All the product sections on product page will be fired as Related Product and will be available in product list performance report.
 
52
 
53
  == Installation ==
54
  1. Download the plugin file to your computer and unzip it
@@ -97,7 +101,19 @@ Hence, this may result into missing transaction data in your GA. You can resolve
97
 
98
  = Does your Plugin support Product Refund? =
99
 
100
- Our existing plugin does not track product refund data, however we are currently building a pro plugin that gives you access to product Refund data. It's a paid plugin that will give you access to all the important features of Universal Analytics including Access to all the reports of Enhanced Ecommerce, User ID Tracking, Product Refund, I.P Anonymization, etc. If you are interested in our paid Plugin, please reach out to us at <a href="mailto:marketing@tatvic.com">marketing@tatvic.com</a>
 
 
 
 
 
 
 
 
 
 
 
 
101
 
102
  == Changelog ==
103
 
@@ -134,4 +150,9 @@ Important Note: When you update the plugin, please save your settings again.
134
 
135
  = 1.0.13 - 19/12/2014 =
136
  * Currency as field removed from the plugin. Reason: we now automatically passed the currency which you may have set in WooCommerce store
137
- * Fixed - Minor bugs
 
 
 
 
 
6
  Author URI: http://www.tatvic.com/
7
  Author: Tatvic
8
  Requires at least: 3.6
9
+ Tested up to: 4.1
10
+ Stable tag: 1.0.14
11
+ Version: 1.0.14
12
  License: GPLv3
13
  License URI: http://www.gnu.org/licenses/gpl-3.0.html
14
 
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 =
38
  * 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
39
 
40
+ * Add meaningful labels for your checkout steps. We recommend you to label as, Step 1 : Checkout View; Step 2 : Billing Info; Step 3 : Proceed to payment
41
 
42
  * Remove standard E-commerce code from thank you along with the ecommerce.js which is included by <code>ga('require', 'ecommerce', 'ecommerce.js');</code>. If you are using a third party plugin for e-commerce tracking, you would have to disable the plugin.
43
 
47
 
48
  * If you have a guest checkout on your WooCommerce store, then Check the box “Add Code to Track the Login Step of Guest Users”. If you have a guest login but you do not check the box, then it might cause an uneven funnel reporting in Google Analytics.
49
 
50
+ * All the product sections on homepage other than feature product will be fired as Recent Product and will be available in product list performance report.
51
+
52
+ * All the product sections on product page will be fired as Related Product and will be available in product list performance report.
53
 
54
+ = Need an Advanced Google Analytics Plugin? =
55
+ We have recently launched an Advanced Google Analytics Plugin for WooCommerce which includes tracking of 9 Reports of Enhanced Ecommerce, User ID Tracking, Product Refund, I.P. Anonymization, 15+ Custom Dimenensions & Metrics, Form Field Tracking, Content Grouping & much more. <a href="http://bit.ly/1yFqA04" target="_blank">Learn More</a>
56
 
57
  == Installation ==
58
  1. Download the plugin file to your computer and unzip it
101
 
102
  = Does your Plugin support Product Refund? =
103
 
104
+ Our existing plugin does not track product refund data, however you can buy our <a href="http://bit.ly/1yFqA04" target="_blank">paid plugin</a> to get access to product Refund data
105
+
106
+ = How to verify if you have implemented the Plugin well? =
107
+
108
+ To verify if you have implemented the plugin well, just log in to your Google Analytics account & check if the data is coming well in your Enhanced Ecommerce Reports.
109
+
110
+ = How much time will it take to see the data in Google Analytics? =
111
+
112
+ It generally depends upon the traffic of the store. But in general it may take max up to 24 hours & min 4 hours to see the data in Google Analytics.
113
+
114
+ = Why the plugin does not sent data when I am logged in as Admin? =
115
+
116
+ To avoid sending your own transaction data or sessions data in Google Analytics, our plugin doesn't sent the data to GA when you are logged in. Having said, if you are logged in as Shop Manager, plugin will send the data to GA.
117
 
118
  == Changelog ==
119
 
150
 
151
  = 1.0.13 - 19/12/2014 =
152
  * Currency as field removed from the plugin. Reason: we now automatically passed the currency which you may have set in WooCommerce store
153
+ * Fixed - Minor bugs
154
+
155
+ = 1.0.14 - 10/02/2015 =
156
+ * Fixed - session_start() function warning
157
+ * Fixed - Notice: Undefined variable: coupons_list
158
+ * Fixed - woocommerce deprecated function warning
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: 1.0.13
25
  */
26
  if (!defined('ABSPATH')) {
27
  exit; // Exit if accessed directly
@@ -75,37 +75,6 @@ function tvc_plugin_action_links($links) {
75
  return $links;
76
  }
77
 
78
- //Custom Admin Header Notifications
79
- add_action('admin_notices', 'tvc_admin_notice');
80
-
81
- function tvc_admin_notice() {
82
- global $current_user, $pagenow;
83
- $user_id = $current_user->ID;
84
- global $woocommerce;
85
- if (version_compare($woocommerce->version, "2.1", ">=")) {
86
- $setting_url = 'admin.php?page=wc-settings&tab=integration';
87
- } else {
88
- $setting_url = 'admin.php?page=woocommerce_settings&tab=integration';
89
- }
90
- /* Check that the user hasn't already clicked to ignore the message */
91
- if (!get_user_meta($user_id, 'tvc_hide_msg') && $pagenow == 'plugins.php') {
92
- echo '<div class="updated" style="background: #913428; color: #fff; padding-left: 16px;"><p>';
93
- printf(__('Important Note: Kindly Save Again Your Enhanced Ecommerce WooCommerce Plugin Settings by visiting this <a href="' . get_admin_url(null, $setting_url) . '" style="color: #F9F76B; text-decoration: underline; font-weight: bold;">Tab</a> - Tatvic | <a href="%1$s" style="color: #fff;">Hide Notice</a>'), '?tvc_hide_msg=0');
94
- echo "</p></div>";
95
- }
96
- }
97
-
98
- add_action('admin_init', 'tvc_custom_header_notification');
99
-
100
- function tvc_custom_header_notification() {
101
- global $current_user;
102
- $user_id = $current_user->ID;
103
- /* If user clicks to ignore the notice, add that to their user meta */
104
- if (isset($_GET['tvc_hide_msg']) && '0' == $_GET['tvc_hide_msg']) {
105
- add_user_meta($user_id, 'tvc_hide_msg', 'true', true);
106
- }
107
- }
108
-
109
  //function to catch Plugin activation
110
  function ee_plugin_activate() {
111
  $PID = "enhanced_ecommerce_google_analytics";
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: 1.0.14
25
  */
26
  if (!defined('ABSPATH')) {
27
  exit; // Exit if accessed directly
75
  return $links;
76
  }
77
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
78
  //function to catch Plugin activation
79
  function ee_plugin_activate() {
80
  $PID = "enhanced_ecommerce_google_analytics";