Enhanced Ecommerce Google Analytics Plugin for WooCommerce - Version 1.0.19

Version Description

  • 21/12/2016 =
    • Fixed - Compatibility with Wordpress 4.7 & Woocommerce 2.6.x
    • Minor Bug Fixes.
Download this release

Release Info

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

Code changes from version 1.0.16 to 1.0.19

includes/class-wc-enhanced-ecommerce-google-analytics-integration.php CHANGED
@@ -7,7 +7,7 @@
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,7 +18,7 @@ class WC_Enhanced_Ecommerce_Google_Analytics extends WC_Integration {
18
  * @return void
19
  */
20
  //set plugin version
21
- public $tvc_eeVer = '1.0.16';
22
  public function __construct() {
23
 
24
  //Set Global Variables
@@ -40,18 +40,17 @@ class WC_Enhanced_Ecommerce_Google_Analytics extends WC_Integration {
40
  $this->init_settings();
41
 
42
  // Define user set variables -- Always use short names
43
- $this->ga_email = $this->get_option("ga_email");
44
- $this->ga_id = $this->get_option("ga_id");
45
- $this->ga_Dname = $this->get_option("ga_Dname");
46
  $this->ga_LC = get_woocommerce_currency(); //Local Currency yuppi! Got from Back end
47
  //set local currency variable on all page
48
  $this->wc_version_compare("tvc_lc=" . json_encode($this->ga_LC) . ";");
49
- $this->ga_ST = $this->get_option("ga_ST");
50
- $this->ga_gCkout = $this->get_option("ga_gCkout") == "yes" ? true : false; //guest checkout
51
- $this->ga_gUser = $this->get_option("ga_gUser") == "yes" ? true : false; //guest checkout
52
- $this->ga_eeT = $this->get_option("ga_eeT");
53
- $this->ga_DF = $this->get_option("ga_DF") == "yes" ? true : false;
54
- $this->ga_imTh = $this->get_option("ga_imTh");
55
 
56
 
57
  //Save Changes action for admin settings
@@ -59,7 +58,8 @@ class WC_Enhanced_Ecommerce_Google_Analytics extends WC_Integration {
59
 
60
  // API Call to LS with e-mail
61
  // Tracking code
62
- add_action("wp_head", array($this, "google_tracking_code"));
 
63
  add_action("woocommerce_thankyou", array($this, "ecommerce_tracking_code"));
64
 
65
  // Enhanced Ecommerce product impression hook
@@ -86,6 +86,7 @@ class WC_Enhanced_Ecommerce_Google_Analytics extends WC_Integration {
86
 
87
  //Advanced Store data Tracking
88
  add_action("wp_footer", array($this, "tvc_store_meta_data"));
 
89
  }
90
  /**
91
  * Get store meta data for trouble shoot
@@ -131,6 +132,110 @@ class WC_Enhanced_Ecommerce_Google_Analytics extends WC_Integration {
131
  function add_plugin_details() {
132
  echo '<!--Enhanced Ecommerce Google Analytics Plugin for Woocommerce by Tatvic Plugin Version:'.$this->tvc_eeVer.'-->';
133
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
134
 
135
  /**
136
  * Initialise Settings Form Fields
@@ -140,14 +245,6 @@ class WC_Enhanced_Ecommerce_Google_Analytics extends WC_Integration {
140
  */
141
  function init_form_fields() {
142
  $this->form_fields = array(
143
- "ga_email" => array(
144
- "title" => __("Email Address (Optional)", "woocommerce"),
145
- "description" => __("Provide your work email address to receive plugin enhancement updates", "woocommerce"),
146
- "type" => "email",
147
- "placeholder" => "example@test.com",
148
- "desc_tip" => true,
149
- "default" => get_option("ga_email") // Backwards compat
150
- ),
151
  "ga_id" => array(
152
  "title" => __("Google Analytics ID", "woocommerce"),
153
  "description" => __("Enter your Google Analytics ID here. You can login into your Google Analytics account to find your ID. e.g.<code>UA-XXXXX-X</code>", "woocommerce"),
@@ -208,72 +305,6 @@ class WC_Enhanced_Ecommerce_Google_Analytics extends WC_Integration {
208
  "default" => get_option("ga_imTh") ? get_option("ga_imTh") : "6" // Backwards compat
209
  ),
210
  );
211
- /* When user updates the email, post it to the remote server */
212
- if (isset($_GET["tab"]) && isset($_REQUEST["section"]) && isset($_REQUEST["woocommerce_".$this->id."_ga_email"])) {
213
- $current_tab = ( empty($_GET["tab"]) ) ? false : sanitize_text_field(urldecode($_GET["tab"]));
214
- $current_section = ( empty($_REQUEST["section"]) ) ? false : sanitize_text_field(urldecode($_REQUEST["section"]));
215
- $save_for_the_plugin = ($current_tab == "integration" ) && ($current_section == $this->id);
216
-
217
- $update_made_for_email = $_REQUEST["woocommerce_".$this->id."_ga_email"] != $this->get_option("ga_email");
218
- if ($save_for_the_plugin && $update_made_for_email) {
219
- // if ($_REQUEST["woocommerce_".$this->id."_ga_email"] != "")
220
- {
221
- $email = $_REQUEST["woocommerce_".$this->id."_ga_email"];
222
- $this->send_email_to_tatvic($email,'active');
223
- }
224
- }
225
- }
226
- }
227
-
228
- /**
229
- * Google Analytics standard tracking
230
- *
231
- * @access public
232
- * @return void
233
- */
234
- function google_tracking_code() {
235
- global $woocommerce;
236
-
237
- //common validation----start
238
- if (is_admin() || current_user_can("manage_options") || $this->ga_ST == "no") {
239
- return;
240
- }
241
-
242
- $tracking_id = $this->ga_id;
243
-
244
- if (!$tracking_id) {
245
- return;
246
- }
247
-
248
- //common validation----end
249
-
250
- if (!empty($this->ga_Dname)) {
251
- $set_domain_name = esc_js($this->ga_Dname);
252
- } else {
253
- $set_domain_name = "auto";
254
- }
255
-
256
- //add display features
257
- if ($this->ga_DF) {
258
- $ga_display_feature_code = 'ga("require", "displayfeatures");';
259
- } else {
260
- $ga_display_feature_code = "";
261
- }
262
-
263
- $code = '
264
- (function(i,s,o,g,r,a,m){i["GoogleAnalyticsObject"]=r;i[r]=i[r]||function(){
265
- (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
266
- m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
267
- })(window,document,"script","//www.google-analytics.com/analytics.js","ga");
268
- ga("create", "' . esc_js($tracking_id) . '", "' . $set_domain_name . '");
269
- ' . $ga_display_feature_code . '
270
-
271
- ga("send", "pageview");';
272
-
273
- //include this on all pages except order confirmation page.
274
- if (!is_order_received_page()) {
275
- echo "<script>" . $code . "</script>";
276
- }
277
  }
278
 
279
  /**
@@ -285,17 +316,15 @@ class WC_Enhanced_Ecommerce_Google_Analytics extends WC_Integration {
285
  */
286
  function ecommerce_tracking_code($order_id) {
287
  global $woocommerce;
288
-
289
- if ($this->disable_tracking($this->ga_eeT) || current_user_can("manage_options") || get_post_meta($order_id, "_ga_tracked", true) == 1)
290
  return;
291
 
292
  $tracking_id = $this->ga_id;
293
-
294
  if (!$tracking_id)
295
  return;
296
 
297
  // Doing eCommerce tracking so unhook standard tracking from the footer
298
- remove_action("wp_footer", array($this, "google_tracking_code"));
299
 
300
  // Get the order and output tracking code
301
  $order = new WC_Order($order_id);
@@ -420,7 +449,7 @@ class WC_Enhanced_Ecommerce_Google_Analytics extends WC_Integration {
420
 
421
  //check woocommerce version
422
  $this->wc_version_compare($code);
423
- update_post_meta($order_id, "_ga_tracked", 1);
424
  }
425
 
426
  /**
@@ -544,7 +573,7 @@ class WC_Enhanced_Ecommerce_Google_Analytics extends WC_Integration {
544
  //declare all variable as a global which will used for make json
545
  global $homepage_json_fp,$homepage_json_ATC_link, $homepage_json_rp,$prodpage_json_relProd,$catpage_json,$prodpage_json_ATC_link,$catpage_json_ATC_link;
546
  //is home page then make all necessory json
547
- if (is_home()) {
548
  if (!is_array($homepage_json_fp) && !is_array($homepage_json_rp) && !is_array($homepage_json_ATC_link)) {
549
  $homepage_json_fp = array();
550
  $homepage_json_rp = array();
@@ -754,7 +783,7 @@ class WC_Enhanced_Ecommerce_Google_Analytics extends WC_Integration {
754
  }
755
 
756
  ';
757
- if(is_home()){
758
  $hmpg_impressions_jQ .='
759
  if(tvc_fp.length !== 0){
760
  t_products_impre_clicks(tvc_fp,"fp","Featured Products");
@@ -785,6 +814,21 @@ class WC_Enhanced_Ecommerce_Google_Analytics extends WC_Integration {
785
  });
786
 
787
  ';
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
788
  }else if (is_product()) {
789
  //product page releted products
790
  $hmpg_impressions_jQ .='
@@ -836,21 +880,6 @@ class WC_Enhanced_Ecommerce_Google_Analytics extends WC_Integration {
836
  });
837
 
838
 
839
- ';
840
- }else if(is_search()){
841
- $hmpg_impressions_jQ .='
842
- //shop page json
843
- if(tvc_pgc.length !== 0){
844
- t_products_impre_clicks(tvc_pgc,"srch","Search Results");
845
- }
846
- //shop page prod click
847
- jQuery("a:not(.product_type_variable, .product_type_grouped)").on("click",function(){
848
- t_url=jQuery(this).attr("href");
849
- //cat page prod call for click
850
- prod_exists_in_JSON(t_url,catpage_json,"Search Results","srch");
851
- });
852
-
853
-
854
  ';
855
  }
856
  //common ATC link for Category page , Shop Page and Search Page
@@ -870,7 +899,7 @@ class WC_Enhanced_Ecommerce_Google_Analytics extends WC_Integration {
870
  }
871
 
872
  //on home page, product page , category page
873
- if (is_home() || is_product() || is_product_category() || is_search() || is_shop()){
874
  $this->wc_version_compare($hmpg_impressions_jQ);
875
  }
876
  }
@@ -1080,91 +1109,7 @@ class WC_Enhanced_Ecommerce_Google_Analytics extends WC_Integration {
1080
  //make product data json on check out page
1081
  $this->wc_version_compare("tvc_ch=" . json_encode($chkout_json) . ";");
1082
  }
1083
-
1084
- /**
1085
- * Check if tracking is disabled
1086
- *
1087
- * @access private
1088
- * @param mixed $type
1089
- * @return bool
1090
- */
1091
- private function disable_tracking($type) {
1092
- if (is_admin() || current_user_can("manage_options") || (!$this->ga_id ) || "no" == $type) {
1093
- return true;
1094
- }
1095
- }
1096
-
1097
- /**
1098
- * woocommerce version compare
1099
- *
1100
- * @access public
1101
- * @return void
1102
- */
1103
- function wc_version_compare($codeSnippet) {
1104
- global $woocommerce;
1105
- if (version_compare($woocommerce->version, "2.1", ">=")) {
1106
- wc_enqueue_js($codeSnippet);
1107
- } else {
1108
- $woocommerce->add_inline_js($codeSnippet);
1109
- }
1110
- }
1111
-
1112
- /**
1113
- * check UA is enabled or not
1114
- *
1115
- * @access public
1116
- */
1117
- function admin_check_UA_enabled() {
1118
- $t_tab_name = $_GET['tab'];
1119
- if($t_tab_name=='integration'){
1120
-
1121
- echo '<script>
1122
- jQuery("#woocommerce_enhanced_ecommerce_google_analytics_ga_ST").change(function(){
1123
- t_ga_chk=jQuery(this).is(":checked");
1124
-
1125
- if(t_ga_chk){
1126
- jQuery("#woocommerce_enhanced_ecommerce_google_analytics_ga_DF").removeAttr("disabled");
1127
- }else{
1128
- jQuery("#woocommerce_enhanced_ecommerce_google_analytics_ga_DF").attr("disabled",true);
1129
- t_display_chk=jQuery("#woocommerce_enhanced_ecommerce_google_analytics_ga_DF").is(":checked");
1130
- if(t_display_chk){
1131
- jQuery("#woocommerce_enhanced_ecommerce_google_analytics_ga_DF").removeAttr("checked");
1132
- } }
1133
- });
1134
- //Pugin Promotion
1135
- 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>");
1136
- </script>';
1137
- }
1138
- }
1139
-
1140
- /**
1141
- * Sending email to remote server
1142
- *
1143
- * @access public
1144
- * @return void
1145
- */
1146
- public function send_email_to_tatvic($email,$status) {
1147
- $url = "http://dev.tatvic.com/leadgen/woocommerce-plugin/store_email/";
1148
- //set POST variables
1149
- if($email == ""){
1150
-
1151
- $email = "marketing@tatvic.com";
1152
- }
1153
- $fields = array(
1154
- "email" => urlencode($email),
1155
- "domain_name" => urlencode(get_site_url()),
1156
- "status"=>urlencode($status)
1157
- );
1158
- wp_remote_post($url, array(
1159
- "method" => "POST",
1160
- "timeout" => 1,
1161
- "httpversion" => "1.0",
1162
- "blocking" => false,
1163
- "headers" => array(),
1164
- "body" => $fields
1165
- )
1166
- );
1167
- }
1168
 
1169
  }
1170
 
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.19';
22
  public function __construct() {
23
 
24
  //Set Global Variables
40
  $this->init_settings();
41
 
42
  // Define user set variables -- Always use short names
43
+ $this->ga_id = $this->get_option("ga_id");
44
+ $this->ga_Dname = $this->get_option("ga_Dname");
 
45
  $this->ga_LC = get_woocommerce_currency(); //Local Currency yuppi! Got from Back end
46
  //set local currency variable on all page
47
  $this->wc_version_compare("tvc_lc=" . json_encode($this->ga_LC) . ";");
48
+ $this->ga_ST = $this->get_option("ga_ST");
49
+ $this->ga_gCkout = $this->get_option("ga_gCkout") == "yes" ? true : false; //guest checkout
50
+ $this->ga_gUser = $this->get_option("ga_gUser") == "yes" ? true : false; //guest checkout
51
+ $this->ga_eeT = $this->get_option("ga_eeT");
52
+ $this->ga_DF = $this->get_option("ga_DF") == "yes" ? true : false;
53
+ $this->ga_imTh = $this->get_option("ga_imTh");
54
 
55
 
56
  //Save Changes action for admin settings
58
 
59
  // API Call to LS with e-mail
60
  // Tracking code
61
+ add_action("wp_head", array($this, "ee_settings"));
62
+
63
  add_action("woocommerce_thankyou", array($this, "ecommerce_tracking_code"));
64
 
65
  // Enhanced Ecommerce product impression hook
86
 
87
  //Advanced Store data Tracking
88
  add_action("wp_footer", array($this, "tvc_store_meta_data"));
89
+
90
  }
91
  /**
92
  * Get store meta data for trouble shoot
132
  function add_plugin_details() {
133
  echo '<!--Enhanced Ecommerce Google Analytics Plugin for Woocommerce by Tatvic Plugin Version:'.$this->tvc_eeVer.'-->';
134
  }
135
+ /**
136
+ * check UA is enabled or not
137
+ *
138
+ * @access public
139
+ */
140
+ function admin_check_UA_enabled() {
141
+
142
+ if(isset($_GET['tab']) && $_GET['tab'] =='integration' ){
143
+
144
+ echo '<script>
145
+ jQuery("#woocommerce_enhanced_ecommerce_google_analytics_ga_ST").change(function(){
146
+ t_ga_chk=jQuery(this).is(":checked");
147
+
148
+ if(t_ga_chk){
149
+ jQuery("#woocommerce_enhanced_ecommerce_google_analytics_ga_DF").removeAttr("disabled");
150
+ }else{
151
+ jQuery("#woocommerce_enhanced_ecommerce_google_analytics_ga_DF").attr("disabled",true);
152
+ t_display_chk=jQuery("#woocommerce_enhanced_ecommerce_google_analytics_ga_DF").is(":checked");
153
+ if(t_display_chk){
154
+ jQuery("#woocommerce_enhanced_ecommerce_google_analytics_ga_DF").removeAttr("checked");
155
+ } }
156
+ });
157
+
158
+ //Pugin Promotion
159
+ jQuery("form#mainform").after("<a href=http://bit.ly/1yFqA04 target=_blank><img src='.plugins_url( '/woo_plugin_promotion.png' , __FILE__ ).' title=Actionable Google Analytics Plugin by Tatvic alt=Actionable Google Analytics Plugin by Tatvic></a>");
160
+ </script>';
161
+ }
162
+ }
163
+
164
+ /**
165
+ * Check if tracking is disabled
166
+ *
167
+ * @access private
168
+ * @param mixed $type
169
+ * @return bool
170
+ */
171
+ private function disable_tracking($type) {
172
+ if (is_admin() || current_user_can("manage_options") || (!$this->ga_id ) || "no" == $type) {
173
+ return true;
174
+ }
175
+ }
176
+
177
+ /**
178
+ * woocommerce version compare
179
+ *
180
+ * @access public
181
+ * @return void
182
+ */
183
+ function wc_version_compare($codeSnippet) {
184
+ global $woocommerce;
185
+ if (version_compare($woocommerce->version, "2.1", ">=")) {
186
+ wc_enqueue_js($codeSnippet);
187
+ } else {
188
+ $woocommerce->add_inline_js($codeSnippet);
189
+ }
190
+ }
191
+ /**
192
+ * Enhanced Ecommerce GA plugin Settings
193
+ *
194
+ * @access public
195
+ * @return void
196
+ */
197
+ function ee_settings() {
198
+ global $woocommerce;
199
+
200
+ //common validation----start
201
+ if (is_admin() || current_user_can("manage_options") || $this->ga_ST == "no") {
202
+ return;
203
+ }
204
+ $tracking_id = $this->ga_id;
205
+
206
+ if (!$tracking_id) {
207
+ return;
208
+ }
209
+ //common validation----end
210
+
211
+ if (!empty($this->ga_Dname)) {
212
+ $set_domain_name = esc_js($this->ga_Dname);
213
+ } else {
214
+ $set_domain_name = "auto";
215
+ }
216
+
217
+ //add display features
218
+ if ($this->ga_DF) {
219
+ $ga_display_feature_code = 'ga("require", "displayfeatures");';
220
+ } else {
221
+ $ga_display_feature_code = "";
222
+ }
223
+
224
+ $code = '
225
+ (function(i,s,o,g,r,a,m){i["GoogleAnalyticsObject"]=r;i[r]=i[r]||function(){
226
+ (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
227
+ m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
228
+ })(window,document,"script","//www.google-analytics.com/analytics.js","ga");
229
+ ga("create", "' . esc_js($tracking_id) . '", "' . $set_domain_name . '");
230
+ ' . $ga_display_feature_code . '
231
+
232
+ ga("send", "pageview");';
233
+
234
+ //include this on all pages except order confirmation page.
235
+ if (!is_order_received_page()) {
236
+ echo "<script>" . $code . "</script>";
237
+ }
238
+ }
239
 
240
  /**
241
  * Initialise Settings Form Fields
245
  */
246
  function init_form_fields() {
247
  $this->form_fields = array(
 
 
 
 
 
 
 
 
248
  "ga_id" => array(
249
  "title" => __("Google Analytics ID", "woocommerce"),
250
  "description" => __("Enter your Google Analytics ID here. You can login into your Google Analytics account to find your ID. e.g.<code>UA-XXXXX-X</code>", "woocommerce"),
305
  "default" => get_option("ga_imTh") ? get_option("ga_imTh") : "6" // Backwards compat
306
  ),
307
  );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
308
  }
309
 
310
  /**
316
  */
317
  function ecommerce_tracking_code($order_id) {
318
  global $woocommerce;
319
+ if ($this->disable_tracking($this->ga_eeT) || current_user_can("manage_options") || get_post_meta($order_id, "_tracked", true) == 1)
 
320
  return;
321
 
322
  $tracking_id = $this->ga_id;
 
323
  if (!$tracking_id)
324
  return;
325
 
326
  // Doing eCommerce tracking so unhook standard tracking from the footer
327
+ remove_action("wp_footer", array($this, "ee_settings"));
328
 
329
  // Get the order and output tracking code
330
  $order = new WC_Order($order_id);
449
 
450
  //check woocommerce version
451
  $this->wc_version_compare($code);
452
+ update_post_meta($order_id, "_tracked", 1);
453
  }
454
 
455
  /**
573
  //declare all variable as a global which will used for make json
574
  global $homepage_json_fp,$homepage_json_ATC_link, $homepage_json_rp,$prodpage_json_relProd,$catpage_json,$prodpage_json_ATC_link,$catpage_json_ATC_link;
575
  //is home page then make all necessory json
576
+ if (is_home() || is_front_page()) {
577
  if (!is_array($homepage_json_fp) && !is_array($homepage_json_rp) && !is_array($homepage_json_ATC_link)) {
578
  $homepage_json_fp = array();
579
  $homepage_json_rp = array();
783
  }
784
 
785
  ';
786
+ if(is_home() || is_front_page()){
787
  $hmpg_impressions_jQ .='
788
  if(tvc_fp.length !== 0){
789
  t_products_impre_clicks(tvc_fp,"fp","Featured Products");
814
  });
815
 
816
  ';
817
+ }else if(is_search()){
818
+ $hmpg_impressions_jQ .='
819
+ //shop page json
820
+ if(tvc_pgc.length !== 0){
821
+ t_products_impre_clicks(tvc_pgc,"srch","Search Results");
822
+ }
823
+ //shop page prod click
824
+ jQuery("a:not(.product_type_variable, .product_type_grouped)").on("click",function(){
825
+ t_url=jQuery(this).attr("href");
826
+ //cat page prod call for click
827
+ prod_exists_in_JSON(t_url,catpage_json,"Search Results","srch");
828
+ });
829
+
830
+
831
+ ';
832
  }else if (is_product()) {
833
  //product page releted products
834
  $hmpg_impressions_jQ .='
880
  });
881
 
882
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
883
  ';
884
  }
885
  //common ATC link for Category page , Shop Page and Search Page
899
  }
900
 
901
  //on home page, product page , category page
902
+ if (is_home() || is_front_page() || is_product() || is_product_category() || is_search() || is_shop()){
903
  $this->wc_version_compare($hmpg_impressions_jQ);
904
  }
905
  }
1109
  //make product data json on check out page
1110
  $this->wc_version_compare("tvc_ch=" . json_encode($chkout_json) . ";");
1111
  }
1112
+
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1113
 
1114
  }
1115
 
includes/woo_plugin_promotion.png ADDED
Binary file
readme.txt CHANGED
@@ -2,20 +2,20 @@
2
  Contributors: Tatvic
3
  Plugin Name: Enhanced Ecommerce for Woocommerce store
4
  Plugin URI: http://wordpress.org/plugins/enhanced-e-commerce-for-woocommerce-store/
5
- Tags: Google Analytics, Universal Analytics, Enhanced E-commerce, E-commerce, e-commerce, woo-commerce,Ecommerce,woocommerce, commerce, Wordpress Enhanced Ecommerce
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.16
11
- Version: 1.0.16
12
  License: GPLv3
13
  License URI: http://www.gnu.org/licenses/gpl-3.0.html
14
 
15
- Provides integration between Google Analytics Enhanced Ecommerce and WooCommerce.
16
 
17
  == Description ==
18
- <a href="http://www.tatvic.com/enhanced-ecommerce-google-analytics-plugin-woocommerce/">Enhanced Ecommerce Google Analytics</a> is a Free WooCommerce Plugin which allows you to use the newly launched feature of Google Analytics – Enhanced Ecommerce.You can track the user behavior across your e-commerce store starting from product views to thank you page.Enhanced Ecommerce is still in beta and supports only Universal Analytics.
19
 
20
  = Features of Plugin =
21
  1. Quick & Easy installation from the wordpress interface
@@ -39,8 +39,6 @@ Provides integration between Google Analytics Enhanced Ecommerce and WooCommerce
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
-
44
  * Activate our plug-in from the Settings page. You can access the setting page from here WooCommerce -> Settings ->Integration ->Enhanced Ecommerce Google Analytics.
45
 
46
  * Find “Add Enhanced Ecommerce Tracking Code” in the settings page and check the box to add the tracking code
@@ -58,7 +56,7 @@ We have recently launched an Advanced Google Analytics Plugin for WooCommerce wh
58
  1. Download the plugin file to your computer and unzip it
59
  2. Using an FTP program, or your hosting control panel, upload the unzipped plugin folder to your WordPress installation’s wp-content/plugins/ directory
60
  3. Activate the plugin from the Plugins menu within the WordPress admin
61
- 4. Enter your email-address and Google Analytics ID for the plugin to enable the tracking code
62
 
63
  == Screenshots ==
64
  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;
@@ -75,6 +73,10 @@ This plugin will add the settings to the Integration tab, to be found in the Woo
75
 
76
  Starting the WooCommerce 2.1 release there are no conflicts. However for earlier the plugin might conflict with the default Google Analytics integration for WooCommerce.
77
 
 
 
 
 
78
  = Why are my PayPal transaction data not getting recorded in GA? =
79
 
80
  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.
@@ -89,9 +91,36 @@ Following are one or more reasons:
89
 
90
  * If you have just installed our plugin, then please wait for at-least 24 hours before you start seeing any data in your GA. If you still face this issue after 24 hours, please reach out to us via <a href="https://wordpress.org/support/plugin/enhanced-e-commerce-for-woocommerce-store" target="_blank">support thread</a>.
91
 
 
 
 
 
 
 
 
 
 
 
 
 
92
  = Products with Multi variant not getting recorded in GA =
93
 
94
- Currently our plugin does not support products with multiple variant & hence you may not see their transaction data in GA. Additionally, we have planned to add the same feature in our upcoming release
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
95
 
96
  = My Ecommerce transaction data are not getting recorded in GA =
97
 
@@ -101,7 +130,11 @@ Hence, this may result into missing transaction data in your GA. You can resolve
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
 
@@ -161,4 +194,15 @@ Important Note: When you update the plugin, please save your settings again.
161
  * Email Field made optional
162
 
163
  = 1.0.16 - 01/04/2015 =
164
- * Minor Bug Fixes as per Woredpress Guidlines
 
 
 
 
 
 
 
 
 
 
 
2
  Contributors: Tatvic
3
  Plugin Name: Enhanced Ecommerce for Woocommerce store
4
  Plugin URI: http://wordpress.org/plugins/enhanced-e-commerce-for-woocommerce-store/
5
+ Tags: Google Analytics, Universal Analytics, Enhanced E-commerce, E-commerce, e-commerce, woo-commerce,Ecommerce,woocommerce, commerce, Wordpress Enhanced Ecommerce, Woocommerce Enhanced Ecommerce, Woocommerce Google Analytics, Google Analytics Plugin, Enhanced Ecommerce Plugin
6
  Author URI: http://www.tatvic.com/
7
  Author: Tatvic
8
  Requires at least: 3.6
9
+ Tested up to: 4.7
10
+ Stable tag: 1.0.19
11
+ Version: 1.0.19
12
  License: GPLv3
13
  License URI: http://www.gnu.org/licenses/gpl-3.0.html
14
 
15
+ Provides integration between Enhanced Ecommerce feature of Google Analytics and WooCommerce.
16
 
17
  == Description ==
18
+ <a href="http://www.tatvic.com/enhanced-ecommerce-google-analytics-plugin-woocommerce/">Enhanced Ecommerce Google Analytics</a> is a Free WooCommerce Plugin which allows you to use the newly launched feature of Google Analytics – Enhanced Ecommerce.You can track the user behavior across your e-commerce store starting from product views to thank you page. Enhanced Ecommerce supports only Universal Analytics.
19
 
20
  = Features of Plugin =
21
  1. Quick & Easy installation from the wordpress interface
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
  * Activate our plug-in from the Settings page. You can access the setting page from here WooCommerce -> Settings ->Integration ->Enhanced Ecommerce Google Analytics.
43
 
44
  * Find “Add Enhanced Ecommerce Tracking Code” in the settings page and check the box to add the tracking code
56
  1. Download the plugin file to your computer and unzip it
57
  2. Using an FTP program, or your hosting control panel, upload the unzipped plugin folder to your WordPress installation’s wp-content/plugins/ directory
58
  3. Activate the plugin from the Plugins menu within the WordPress admin
59
+ 4. Enter your Universal Analytics ID for the plugin to enable the tracking code
60
 
61
  == Screenshots ==
62
  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;
73
 
74
  Starting the WooCommerce 2.1 release there are no conflicts. However for earlier the plugin might conflict with the default Google Analytics integration for WooCommerce.
75
 
76
+ = Do I Need to add any custom code for it? =
77
+
78
+ 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 code to track Ecommerce events on your store from your end.
79
+
80
  = Why are my PayPal transaction data not getting recorded in GA? =
81
 
82
  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.
91
 
92
  * If you have just installed our plugin, then please wait for at-least 24 hours before you start seeing any data in your GA. If you still face this issue after 24 hours, please reach out to us via <a href="https://wordpress.org/support/plugin/enhanced-e-commerce-for-woocommerce-store" target="_blank">support thread</a>.
93
 
94
+ = Since I have Implemented GA Script (UA tag) Via GTM, I didn't enable Add Universal Analytics Tracking Code option, but seems that it is not working. =
95
+
96
+ When you have the UA script/tag implemented via your GTM, it may happen sometimes that the script might take/make any delay in loading on your store, due to which our plugin may not work well on your store.
97
+
98
+ Reason :
99
+
100
+ * Our Plugin's script works/fetches the data based on the GA's default tracker ('ga' in the case of Universal Analytics script used in our plugin). While you implement the UA tracking script from your GTM, the script in your store may not be able to initialize the tracker, which in turn will hinder the plugin from populating insights in your Analytics account.
101
+
102
+ = Where I can see my all Enhanced Ecommerce Reports (Eg. Sales Report,Product Performance Report)? =
103
+
104
+ You can Find all The Enhanced Ecommerce Reports in your Analytics Account under Conversions --> Ecommerce.
105
+
106
  = Products with Multi variant not getting recorded in GA =
107
 
108
+ Currently our plugin does not support products with multiple variant & hence you may not see their transaction data in GA. Additionally, we have planned to add the same feature in our upcoming release.
109
+
110
+ = I have noticed that some transactions are missing in my GA account, compared to my Woocmmerce backend (Orders) =
111
+
112
+ Possible reasons for not getting the accurate Transactions (in sales performance report) are as below :
113
+
114
+ * If a user completes the transaction via a 3rd party payment gateway and is not redirected back to your store’s thank you page.
115
+
116
+ * If any javascript error is detected on the "thank you" page of your store which may restrict plugin's code to get executed further.
117
+
118
+ * Some browsers and common ad blocking programs block certain JavaScripts
119
+ (including GA's script), which means Google Analytics is unable to record transactions.
120
+
121
+ * The user has left the page before the transaction has had a chance to send to Google Analytics.
122
+
123
+ Additionally, GA is a trend analysis tool, and as such cannot be expected to be 100% accurate. However, if the variance is greater than 10%, we request you to contact us!
124
 
125
  = My Ecommerce transaction data are not getting recorded in GA =
126
 
130
 
131
  = Does your Plugin support Product Refund? =
132
 
133
+ Our existing plugin does not track product refund data, however you can buy our <a href="https://codecanyon.net/item/actionable-google-analytics-for-woocommerce/9899552" target="_blank">paid plugin</a> to get access to product Refund data
134
+
135
+ = Does your plugin supports Multilingual Wordpress site? =
136
+
137
+ Our plugin does not support Multilingual Wordpress site.
138
 
139
  = How to verify if you have implemented the Plugin well? =
140
 
194
  * Email Field made optional
195
 
196
  = 1.0.16 - 01/04/2015 =
197
+ * Minor Bug Fixes as per Wordpress Guidlines
198
+
199
+ = 1.0.17 - 19/02/2016 =
200
+ * Fixed - Notice: Undefined index: tab
201
+ * Minor Bug Fixes as per Wordpress Guidlines
202
+
203
+ = 1.0.18 - 11/04/2016 =
204
+ * Fixed - Compatibility with Google Tag Manager for Wordpress by DuracellTomi
205
+
206
+ = 1.0.19 - 21/12/2016 =
207
+ * Fixed - Compatibility with Wordpress 4.7 & Woocommerce 2.6.x
208
+ * Minor Bug Fixes.
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.16
25
  */
26
  if (!defined('ABSPATH')) {
27
  exit; // Exit if accessed directly
@@ -38,35 +38,13 @@ function wc_enhanced_ecommerce_google_analytics_add_integration($integrations) {
38
  return $integrations;
39
  }
40
 
41
- //function to call controller
42
- function send_email_to_tatvic($email, $status) {
43
- $url = "http://dev.tatvic.com/leadgen/woocommerce-plugin/store_email/";
44
- //set POST variables
45
- if($email == ""){
46
- $email = "marketing@tatvic.com";
47
- }
48
- $fields = array(
49
- "email" => urlencode($email),
50
- "domain_name" => urlencode(get_site_url()),
51
- "status" => urlencode($status)
52
- );
53
- wp_remote_post($url, array(
54
- "method" => "POST",
55
- "timeout" => 1,
56
- "httpversion" => "1.0",
57
- "blocking" => false,
58
- "headers" => array(),
59
- "body" => $fields
60
- )
61
- );
62
- }
63
 
64
  add_filter('woocommerce_integrations', 'wc_enhanced_ecommerce_google_analytics_add_integration', 10);
65
 
66
  //plugin action links on plugin page
67
- add_filter('plugin_action_links_' . plugin_basename(__FILE__), 'tvc_plugin_action_links');
68
 
69
- function tvc_plugin_action_links($links) {
70
  global $woocommerce;
71
  if (version_compare($woocommerce->version, "2.1", ">=")) {
72
  $setting_url = 'admin.php?page=wc-settings&tab=integration';
@@ -75,57 +53,9 @@ function tvc_plugin_action_links($links) {
75
  }
76
  $links[] = '<a href="' . get_admin_url(null, $setting_url) . '">Settings</a>';
77
  $links[] = '<a href="https://wordpress.org/plugins/enhanced-e-commerce-for-woocommerce-store/faq/" target="_blank">FAQ</a>';
 
78
  return $links;
79
  }
80
 
81
- //function to catch Plugin activation
82
- function ee_plugin_activate() {
83
- $PID = "enhanced_ecommerce_google_analytics";
84
- $chk_Settings = get_option('woocommerce_' . $PID . '_settings');
85
- if ($chk_Settings) {
86
- if (array_key_exists("ga_email", $chk_Settings)) {
87
- send_email_to_tatvic($chk_Settings['ga_email'], 'active');
88
- }
89
- }
90
- }
91
-
92
- //function to catch Plugin deactivation
93
- function ee_plugin_dectivate() {
94
- if (!current_user_can('activate_plugins'))
95
- return;
96
- $plugin = isset($_REQUEST['plugin']) ? $_REQUEST['plugin'] : '';
97
- $chk_nonce = check_admin_referer("deactivate-plugin_{$plugin}");
98
-
99
- $PID = "enhanced_ecommerce_google_analytics";
100
- $chk_Settings = get_option('woocommerce_' . $PID . '_settings');
101
-
102
- if ($chk_nonce && $chk_Settings) {
103
- if (array_key_exists("ga_email", $chk_Settings)) {
104
- send_email_to_tatvic($chk_Settings['ga_email'], 'inactive');
105
- }
106
- }
107
- }
108
-
109
- //function to catch Plugin deletion
110
- function ee_plugin_delete() {
111
-
112
- if (!current_user_can('activate_plugins'))
113
- return;
114
-
115
- $chk_nonce = check_admin_referer('bulk-plugins');
116
-
117
- if ($_GET['action'] == 'delete-selected') {
118
- $PID = "enhanced_ecommerce_google_analytics";
119
- $chk_Settings = get_option('woocommerce_' . $PID . '_settings');
120
- if ($chk_nonce && $chk_Settings) {
121
- if (array_key_exists("ga_email", $chk_Settings)) {
122
- send_email_to_tatvic($chk_Settings['ga_email'], 'delete');
123
- }
124
- }
125
- }
126
- }
127
 
128
- register_activation_hook(__FILE__, 'ee_plugin_activate');
129
- register_deactivation_hook(__FILE__, 'ee_plugin_dectivate');
130
- register_uninstall_hook(__FILE__, 'ee_plugin_delete');
131
  ?>
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.19
25
  */
26
  if (!defined('ABSPATH')) {
27
  exit; // Exit if accessed directly
38
  return $integrations;
39
  }
40
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
41
 
42
  add_filter('woocommerce_integrations', 'wc_enhanced_ecommerce_google_analytics_add_integration', 10);
43
 
44
  //plugin action links on plugin page
45
+ add_filter('plugin_action_links_' . plugin_basename(__FILE__), 'tvc_ee_plugin_action_links');
46
 
47
+ function tvc_ee_plugin_action_links($links) {
48
  global $woocommerce;
49
  if (version_compare($woocommerce->version, "2.1", ">=")) {
50
  $setting_url = 'admin.php?page=wc-settings&tab=integration';
53
  }
54
  $links[] = '<a href="' . get_admin_url(null, $setting_url) . '">Settings</a>';
55
  $links[] = '<a href="https://wordpress.org/plugins/enhanced-e-commerce-for-woocommerce-store/faq/" target="_blank">FAQ</a>';
56
+ $links[] = '<a href="http://plugins.tatvic.com/downloads/EE-Woocommerce-Plugin-Documentation.pdf" target="_blank">Documentation</a>';
57
  return $links;
58
  }
59
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
60
 
 
 
 
61
  ?>