Enhanced Ecommerce Google Analytics Plugin for WooCommerce - Version 4.9.0

Version Description

  • 08/09/2022 =
  • The implemented feature will give Conversios users, the capability to customize "Google Analytics Event tracking" for their custom implementations on the WooCommerce store pages, which will help them not lose tracking on page events.
Download this release

Release Info

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

Code changes from version 4.8.9 to 4.9.0

admin/class-tvc-admin-auto-product-sync-helper.php CHANGED
@@ -501,8 +501,8 @@ if ( ! class_exists( 'TVC_Admin_Auto_Product_sync_Helper' ) ) {
501
  }*/
502
 
503
  public function generateAccessToken($access_token, $refresh_token) {
504
- $url = "https://www.googleapis.com/oauth2/v1/tokeninfo?=" . $access_token;
505
- $request = wp_remote_get(esc_url_raw($url), array("access_token"=>$access_token));
506
  $response_code = wp_remote_retrieve_response_code($request);
507
 
508
  $response_message = wp_remote_retrieve_response_message($request);
@@ -516,10 +516,10 @@ if ( ! class_exists( 'TVC_Admin_Auto_Product_sync_Helper' ) ) {
516
  $clientSecret = $credentials['web']['client_secret'];
517
 
518
  $data = [
519
- "grant_type" => 'refresh_token',
520
- "client_id" => sanitize_text_field($clientId),
521
- 'client_secret' => sanitize_text_field($clientSecret),
522
- 'refresh_token' => sanitize_text_field($refresh_token),
523
  ];
524
  $args = array(
525
  'headers' =>$header,
@@ -532,7 +532,11 @@ if ( ! class_exists( 'TVC_Admin_Auto_Product_sync_Helper' ) ) {
532
  $response_message = wp_remote_retrieve_response_message($request);
533
  $response = json_decode(wp_remote_retrieve_body($request));
534
  if(isset($response->access_token)){
535
- return $response->access_token;
 
 
 
 
536
  }else{
537
  //return $access_token;
538
  }
501
  }*/
502
 
503
  public function generateAccessToken($access_token, $refresh_token) {
504
+ $url = "https://www.googleapis.com/oauth2/v1/tokeninfo?access_token=".$access_token;
505
+ $request = wp_remote_get(esc_url_raw($url), array('timeout' => 10000));
506
  $response_code = wp_remote_retrieve_response_code($request);
507
 
508
  $response_message = wp_remote_retrieve_response_message($request);
516
  $clientSecret = $credentials['web']['client_secret'];
517
 
518
  $data = [
519
+ "grant_type" => 'refresh_token',
520
+ "client_id" => sanitize_text_field($clientId),
521
+ 'client_secret' => sanitize_text_field($clientSecret),
522
+ 'refresh_token' => sanitize_text_field($refresh_token),
523
  ];
524
  $args = array(
525
  'headers' =>$header,
532
  $response_message = wp_remote_retrieve_response_message($request);
533
  $response = json_decode(wp_remote_retrieve_body($request));
534
  if(isset($response->access_token)){
535
+ $TVC_Admin_Helper = new TVC_Admin_Helper();
536
+ $google_detail = $TVC_Admin_Helper->get_ee_options_data();
537
+ $google_detail["setting"]->access_token = base64_encode(sanitize_text_field($response->access_token));
538
+ $TVC_Admin_Helper->set_ee_options_data($google_detail);
539
+ return $response->access_token;
540
  }else{
541
  //return $access_token;
542
  }
admin/css/style.css CHANGED
@@ -30,7 +30,7 @@
30
  .rate_us span{margin-right: 3px; /*vertical-align: bottom;*/}
31
  .rate_us img{max-width: 120px;}
32
  /*dasboard*/
33
- select#tvc_conversion_tracking_type{
34
  border: 1px solid #C6C6C6;
35
  border-radius: 6px;
36
  box-sizing: border-box;
@@ -53,25 +53,6 @@ select#tvc_conversion_tracking_type{
53
  background-color: #fff;
54
  }
55
 
56
- /*@-webkit-keyframes shiny-btn1 {
57
- 0% { -webkit-transform: scale(0) rotate(45deg); opacity: 0; }
58
- 40% { -webkit-transform: scale(0) rotate(45deg); opacity: 0.5; }
59
- 70% { -webkit-transform: scale(4) rotate(45deg); opacity: 1; }
60
- 100% { -webkit-transform: scale(50) rotate(45deg); opacity: 0; }
61
- }
62
- @-webkit-keyframes shiny-btn2 {
63
- 0% { top:74%; }
64
- 25% { top:73%; }
65
- 50% { top:72%; }
66
- 75% { top:73%; }
67
- 100% { top:74%; }
68
- 0% { right:0%; }
69
- 25% { right:-1%; }
70
- 50% { right:-3%; }
71
- 75% { right:-1%; }
72
- 100% { right:0%; }
73
-
74
- }*/
75
  .product_batch_size{position: relative; margin-top: 10px; float: right;}
76
  .product_batch_size label{ margin-right: 23px;}
77
  .update-nag, .updated, .error, .is-dismissible, .notice { display: none !important; }
@@ -1155,7 +1136,7 @@ button:disabled,button[disabled], button:disabled:hover,button[disabled]:hover{b
1155
  right: 14px;
1156
  }
1157
  /* feedback-form */
1158
- #feedback-form-wrapper #feedback_record_btn > button { position: fixed;right: 0;bottom: 7%;transform: rotate(-90deg) translate(50%, -50%);transform-origin: right;z-index: 999;width: 110px;font-size: 19px; }
1159
  #feedback-form-wrapper .rating-input-wrapper input[type="radio"] { display: none; }
1160
  .rating-input-wrapper input[type="radio"] ~ span { cursor: pointer; }
1161
  .rating-input-wrapper{ display: flex;flex-direction: row;justify-content: flex-start; }
@@ -1173,10 +1154,12 @@ button:disabled,button[disabled], button:disabled:hover,button[disabled]:hover{b
1173
  /* end feedback-form */
1174
 
1175
  #ee_plugin_form select{
1176
- min-width: 330px;
1177
  }
 
1178
  table .tracking-trigger td{ padding: 0 0 0.5rem 1rem;}
1179
- #ee_plugin_form input[type="text"], #ee_plugin_form input[type="number"]{ min-width: 285px; height: 32px; margin-bottom: 5px;}
 
1180
  /**********PMax CSS ************/
1181
  .search-box { background: url('../images/search-icon.png');
1182
  background-repeat: no-repeat;
@@ -1368,6 +1351,21 @@ img.img-upload {
1368
  .pmax-campaign .cmp_urls .fromfiled{max-width: 500px;}
1369
  .pmax-campaign .cmp_urls .form-col-8 {width: 45%;}
1370
  /*.pmax-campaign .fromfiled.smtext{max-width: 200px;}*/
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1371
 
1372
  .tvc-auto-product-sync-form .ga-title{position: relative;}
1373
  .tvc-product-sync-toolip{ position: absolute; display: inline-block; width: auto; top: -5px; margin-left: 2px;}
30
  .rate_us span{margin-right: 3px; /*vertical-align: bottom;*/}
31
  .rate_us img{max-width: 120px;}
32
  /*dasboard*/
33
+ select.data_collection_method{
34
  border: 1px solid #C6C6C6;
35
  border-radius: 6px;
36
  box-sizing: border-box;
53
  background-color: #fff;
54
  }
55
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
56
  .product_batch_size{position: relative; margin-top: 10px; float: right;}
57
  .product_batch_size label{ margin-right: 23px;}
58
  .update-nag, .updated, .error, .is-dismissible, .notice { display: none !important; }
1136
  right: 14px;
1137
  }
1138
  /* feedback-form */
1139
+ #feedback-form-wrapper #feedback_record_btn > button { position: fixed;right: 0;bottom: 9%;transform: rotate(-90deg) translate(50%, -50%);transform-origin: right;z-index: 999;width: 120px;font-size: 19px; }
1140
  #feedback-form-wrapper .rating-input-wrapper input[type="radio"] { display: none; }
1141
  .rating-input-wrapper input[type="radio"] ~ span { cursor: pointer; }
1142
  .rating-input-wrapper{ display: flex;flex-direction: row;justify-content: flex-start; }
1154
  /* end feedback-form */
1155
 
1156
  #ee_plugin_form select{
1157
+ min-width: 480px;
1158
  }
1159
+ #ee_plugin_form select.select-sm { min-width: 80px; border-radius: 6px; padding: 1px 5px; margin: 0; display: inline-block;}
1160
  table .tracking-trigger td{ padding: 0 0 0.5rem 1rem;}
1161
+ #ee_plugin_form input[type="text"], #ee_plugin_form input[type="number"], .tracking-trigger .fromfiled{ min-width: 285px; height: 32px; margin-bottom: 5px;}
1162
+ #ee_plugin_form .tracking-trigger input[type="text"].select-sm{min-width: 10px; max-width: 80px;}
1163
  /**********PMax CSS ************/
1164
  .search-box { background: url('../images/search-icon.png');
1165
  background-repeat: no-repeat;
1351
  .pmax-campaign .cmp_urls .fromfiled{max-width: 500px;}
1352
  .pmax-campaign .cmp_urls .form-col-8 {width: 45%;}
1353
  /*.pmax-campaign .fromfiled.smtext{max-width: 200px;}*/
1354
+ .google-account-analytics .ga-title.con_faq_title{cursor: pointer; position: relative; background-color: #F1F1F1; padding: 10px 5px;}
1355
+ .google-account-analytics .ga-title.con_faq_title.active{ margin-bottom: 8px;}
1356
+ .con_faq_title img.faq_icon{position: absolute; right: 10px; transition:all 0.5s ease-in-out 0s;-moz-transition:all 0.5s ease-in-out 0s;-webkit-transition:all 0.5s ease-in-out 0s;-o-transition:all 0.5s ease-in-out 0s;}
1357
+ .con_faq_title.active img.faq_icon{transform: rotate(180deg); transition:all 0.5s ease-in-out 0s;-moz-transition:all 0.5s ease-in-out 0s;-webkit-transition:all 0.5s ease-in-out 0s;-o-transition:all 0.5s ease-in-out 0s;}
1358
+ .sec_con_integration {opacity: 0; position: fixed; visibility: hidden; transition:all 0.5s ease-in-out 0s;-moz-transition:all 0.5s ease-in-out 0s;-webkit-transition:all 0.5s ease-in-out 0s;-o-transition:all 0.5s ease-in-out 0s;}
1359
+ .sec_con_integration.active{ opacity: 1; position: relative; visibility: visible; transition:all 0.5s ease-in-out 0s;-moz-transition:all 0.5s ease-in-out 0s;-webkit-transition:all 0.5s ease-in-out 0s;-o-transition:all 0.5s ease-in-out 0s;}
1360
+ .sec_con_integration .tvc-hide{transition:all 0.5s ease-in-out 0s;-moz-transition:all 0.5s ease-in-out 0s;-webkit-transition:all 0.5s ease-in-out 0s;-o-transition:all 0.5s ease-in-out 0s;}
1361
+ .sec_con_integration .tvc-tooltip{position: relative; display: inline-block; width: auto; top: -33px; float: right; right: -15px;}
1362
+ .sec_con_integration .tvc-tooltip .tvc-tooltiptext{line-height: 1.2; bottom: 6px; left: 125%; top: auto; min-width: 380px;}
1363
+ .tvc-css-selector-sec .tvc-tooltip{top: -6px; right: 13px;}
1364
+ .tracking-trigger th span{display: inline-block;}
1365
+ .sec_con_integration th .tvc-tooltip{top: -7px; right: -3px;}
1366
+ .tvc_ee_plugin_form .tvc-tooltip{position: relative; display: inline-block; width: auto;}
1367
+ .tvc_ee_plugin_form .tvc-tooltip .tvc-tooltiptext{line-height: 1.2; bottom: 0px; left: 125%; top: auto; min-width: 380px; padding: 5px 8px;}
1368
+
1369
 
1370
  .tvc-auto-product-sync-form .ga-title{position: relative;}
1371
  .tvc-product-sync-toolip{ position: absolute; display: inline-block; width: auto; top: -5px; margin-left: 2px;}
admin/helper/class-onboarding-helper.php CHANGED
@@ -348,9 +348,14 @@ if(!class_exists('Conversios_Onboarding_Helper')):
348
  $settings['ga_CG'] = isset($old_setting['ga_CG'])?$old_setting['ga_CG']:"";
349
  $settings['ga_optimize_id'] = isset($old_setting['ga_optimize_id'])?$old_setting['ga_optimize_id']:"";
350
 
351
- $settings['tvc_conversion_tracking_type'] = isset($old_setting['tvc_conversion_tracking_type'])?$old_setting['tvc_conversion_tracking_type']:"";
352
  $settings['tvc_product_detail_conversion_tracking_type'] = isset($old_setting['tvc_product_detail_conversion_tracking_type'])?$old_setting['tvc_product_detail_conversion_tracking_type']:"";
353
- $settings['tvc_checkout_conversion_tracking_type'] = isset($old_setting['tvc_checkout_conversion_tracking_type'])?$old_setting['tvc_checkout_conversion_tracking_type']:"";
 
 
 
 
 
354
  //update option in wordpress local database
355
  update_option('google_ads_conversion_tracking', $googleDetail->google_ads_conversion_tracking);
356
  update_option('ads_tracking_id', $googleDetail->google_ads_id);
@@ -1093,8 +1098,8 @@ if(!class_exists('Conversios_Onboarding_ApiCall') ){
1093
  }
1094
  }
1095
  public function generateAccessToken($access_token, $refresh_token) {
1096
- $url = "https://www.googleapis.com/oauth2/v1/tokeninfo?=" . $access_token;
1097
- $request = wp_remote_get(esc_url_raw($url), array( "access_token" => $access_token, 'timeout' => 10000 ));
1098
  $response_code = wp_remote_retrieve_response_code($request);
1099
 
1100
  $response_message = wp_remote_retrieve_response_message($request);
@@ -1125,7 +1130,11 @@ if(!class_exists('Conversios_Onboarding_ApiCall') ){
1125
  $response_message = wp_remote_retrieve_response_message($request);
1126
  $response = json_decode(wp_remote_retrieve_body($request));
1127
  if(isset($response->access_token)){
1128
- return $response->access_token;
 
 
 
 
1129
  }else{
1130
  //return $access_token;
1131
  }
348
  $settings['ga_CG'] = isset($old_setting['ga_CG'])?$old_setting['ga_CG']:"";
349
  $settings['ga_optimize_id'] = isset($old_setting['ga_optimize_id'])?$old_setting['ga_optimize_id']:"";
350
 
351
+ /*$settings['tvc_conversion_tracking_type'] = isset($old_setting['tvc_conversion_tracking_type'])?$old_setting['tvc_conversion_tracking_type']:"";
352
  $settings['tvc_product_detail_conversion_tracking_type'] = isset($old_setting['tvc_product_detail_conversion_tracking_type'])?$old_setting['tvc_product_detail_conversion_tracking_type']:"";
353
+ $settings['tvc_checkout_conversion_tracking_type'] = isset($old_setting['tvc_checkout_conversion_tracking_type'])?$old_setting['tvc_checkout_conversion_tracking_type']:"";*/
354
+
355
+ $tracking_integration = array("tvc_product_list_data_collection_method", "tvc_product_detail_data_collection_method", "tvc_checkout_data_collection_method", "tvc_thankyou_data_collection_method", "tvc_product_detail_addtocart_selector", "tvc_product_detail_addtocart_selector_type", "tvc_product_detail_addtocart_selector_val", "tvc_checkout_step_2_selector", "tvc_checkout_step_2_selector_type", "tvc_checkout_step_2_selector_val", "tvc_checkout_step_3_selector", "tvc_checkout_step_3_selector_type", "tvc_checkout_step_3_selector_val");
356
+ foreach($tracking_integration as $val){
357
+ $settings[$val] = isset($old_setting[$val])?sanitize_text_field($old_setting[$val]):"";
358
+ }
359
  //update option in wordpress local database
360
  update_option('google_ads_conversion_tracking', $googleDetail->google_ads_conversion_tracking);
361
  update_option('ads_tracking_id', $googleDetail->google_ads_id);
1098
  }
1099
  }
1100
  public function generateAccessToken($access_token, $refresh_token) {
1101
+ $url = "https://www.googleapis.com/oauth2/v1/tokeninfo?access_token=" . $access_token;
1102
+ $request = wp_remote_get(esc_url_raw($url), array('timeout' => 10000));
1103
  $response_code = wp_remote_retrieve_response_code($request);
1104
 
1105
  $response_message = wp_remote_retrieve_response_message($request);
1130
  $response_message = wp_remote_retrieve_response_message($request);
1131
  $response = json_decode(wp_remote_retrieve_body($request));
1132
  if(isset($response->access_token)){
1133
+ $TVC_Admin_Helper = new TVC_Admin_Helper();
1134
+ $google_detail = $TVC_Admin_Helper->get_ee_options_data();
1135
+ $google_detail["setting"]->access_token = base64_encode(sanitize_text_field($response->access_token));
1136
+ $TVC_Admin_Helper->set_ee_options_data($google_detail);
1137
+ return $response->access_token;
1138
  }else{
1139
  //return $access_token;
1140
  }
admin/images/arrow-down-sign.png ADDED
Binary file
admin/partials/general-fields.php CHANGED
@@ -1,7 +1,7 @@
1
  <?php
2
  echo "<script>var return_url ='".esc_url_raw($this->url)."';</script>";
3
  $TVC_Admin_Helper = new TVC_Admin_Helper();
4
- $class = "";
5
  $message_p = "";
6
  if (isset($_POST['ee_submit_plugin'])) {
7
  $settings = $TVC_Admin_Helper->get_ee_options_settings();
@@ -33,20 +33,22 @@ if (isset($_POST['ee_submit_plugin'])) {
33
  //$settings['ga_OPTOUT'] = isset($_POST["ga_OPTOUT"])?sanitize_text_field($_POST["ga_OPTOUT"]):"";
34
  $settings['ga_PrivacyPolicy'] = isset($_POST["ga_PrivacyPolicy"])?sanitize_text_field($_POST["ga_PrivacyPolicy"]):"";
35
  $settings['google-analytic'] = '';
36
- $settings['tvc_conversion_tracking_type'] = isset($_POST["tvc_conversion_tracking_type"])?sanitize_text_field($_POST["tvc_conversion_tracking_type"]):"";
37
- $settings['tvc_product_detail_conversion_tracking_type'] = isset($_POST["tvc_product_detail_conversion_tracking_type"])?sanitize_text_field($_POST["tvc_product_detail_conversion_tracking_type"]):"";
38
- $settings['tvc_checkout_conversion_tracking_type'] = isset($_POST["tvc_checkout_conversion_tracking_type"])?sanitize_text_field($_POST["tvc_checkout_conversion_tracking_type"]):"";
 
 
 
39
  $settings['fb_pixel_id'] = isset($_POST["fb_pixel_id"])?sanitize_text_field($_POST["fb_pixel_id"]):"";
40
  $settings['ga4_api_secret'] = isset($_POST["ga4_api_secret"])?sanitize_text_field($_POST["ga4_api_secret"]):"";
41
 
42
  $TVC_Admin_Helper->save_ee_options_settings($settings);
43
  $TVC_Admin_Helper->update_app_status();
44
 
45
- $class = 'alert-message tvc-alert-success';
46
  $message_p = esc_html__( 'Your settings have been saved.', 'conversios' );
47
  }
48
  $data = unserialize(get_option('ee_options'));
49
-
50
  $subscription_id = $TVC_Admin_Helper->get_subscriptionId();
51
  $TVC_Admin_Helper->add_spinner_html();
52
  $google_detail = $TVC_Admin_Helper->get_ee_options_data();
@@ -66,7 +68,7 @@ if(isset($google_detail['setting'])){
66
  <div class="tab-pane show active" id="googleShoppingFeed">
67
  <div class="tab-card">
68
  <div class="row">
69
- <div class="col-md-6 col-lg-8 border-right">
70
  <?php if($plan_id == 1){?>
71
  <div class="licence tvc-licence" >
72
  <div class="tvc_licence_key_wapper <?php if($plan_id != 1){?>tvc-hide<?php }?>">
@@ -84,7 +86,7 @@ if(isset($google_detail['setting'])){
84
  </div>
85
  </div>
86
  <?php }?>
87
- <div class="google-account-analytics">
88
  <div class="row mb-3">
89
  <div class="col-6 col-md-6 col-lg-6">
90
  <h2 class="ga-title"><?php esc_html_e("Connected Google Analytics Account:","conversios"); ?></h2>
@@ -164,62 +166,74 @@ if(isset($google_detail['setting'])){
164
  <tbody>
165
  <tr>
166
  <th width="155px">
167
- <label class="align-middle" for="tracking_code"><?php esc_html_e("Tracking Code","conversios"); ?></label>
168
  </th>
169
  <td>
170
- <label class = "align-middle">
171
  <?php $ga_ST = !empty($data['ga_ST']) ? 'checked' : ''; ?>
172
  <input type="checkbox" name="ga_ST" id="ga_ST" <?php echo esc_attr($ga_ST); ?> >
173
  <label class="custom-control-label" for="ga_ST"><?php esc_html_e("Add Global Site Tracking Code 'gtag.js'","conversios"); ?></label>
174
-
175
- <i style="cursor: help;" class="fas fa-question-circle" title="<?php esc_html_e("This feature adds new gtag.js tracking code to your store. You don't need to enable this if gtag.js is implemented via any third party analytics plugin.","conversios"); ?>"></i>
 
 
176
  </label><br/>
177
- <label class = "align-middle">
178
  <?php $ga_eeT = !empty($data['ga_eeT']) ? 'checked' : ''; ?>
179
  <input type="checkbox" name="ga_eeT" id="ga_eeT" <?php echo esc_attr($ga_eeT); ?> >
180
  <label class="custom-control-label" for="ga_eeT"><?php esc_html_e("Add Enhanced Ecommerce Tracking Code","conversios"); ?></label>
181
-
182
- <i style="cursor: help;" class="fas fa-question-circle" title="<?php esc_html_e("This feature adds Enhanced Ecommerce Tracking Code to your Store","conversios"); ?>"></i>
 
 
183
  </label><br/>
184
- <label class = "align-middle">
185
  <?php $ga_gUser = !empty($data['ga_gUser']) ? 'checked' : ''; ?>
186
  <input type="checkbox" name="ga_gUser" id="ga_gUser" <?php echo esc_attr($ga_gUser); ?> >
187
  <label class="custom-control-label" for="ga_gUser"><?php esc_html_e("Add Code to Track the Login Step of Guest Users (Optional)","conversios"); ?></label>
188
-
189
- <i style="cursor: help;" class="fas fa-question-circle" title="<?php esc_html_e("If you have Guest Check out enable, we recommend you to add this code","conversios"); ?>"></i>
 
 
190
  </label>
191
  </td>
192
  </tr>
193
  <?php if(isset($data['gm_id']) && $data['gm_id'] != '' && $plan_id != 1){ ?>
194
  <tr>
195
  <th>
196
- <?php esc_html_e("GA4 - API secrets ","conversios"); ?><span class="tvc-pro"> (PRO)</span>
197
  </th>
198
  <td>
199
  <?php $ga4_api_secret = isset($data['ga4_api_secret'])?$data['ga4_api_secret']:""; ?>
200
- <input type="text" class="fromfiled" name="ga4_api_secret" id="ga4_api_secret" value="<?php echo esc_attr($ga4_api_secret); ?>">
 
 
 
 
201
  <br>To track refund order
202
- <p class="description" style="text-align: justify;"><?php esc_html_e("How to get 'Measurement Protocol API Secret' in GA4: Click Admin > Click Data streams (Under Property) > Select the stream > Additional Settings - Measurement Protocol API secrets > Create a new API secret.","conversios"); ?></p>
203
  </td>
204
  </tr>
205
  <?php } ?>
206
  <tr>
207
  <th>
208
- <label class="align-middle" for= "ga_CG" ><?php esc_html_e("Content Grouping","conversios"); ?> <span class="tvc-pro"> (PRO)</span></label>
209
  </th>
210
  <td>
211
- <label class = "align-middle">
212
  <?php $ga_CG = (!empty($data['ga_CG'])) ? 'checked' : '';
213
  if($plan_id==1){ $ga_CG ="";}?>
214
  <input type="checkbox" name="ga_CG" id="ga_CG" <?php if($plan_id==1){?> onclick="return false;"<?php } ?> <?php echo esc_attr($ga_CG);?> >
215
- <label class="custom-control-label" for="ga_CG"><?php esc_html_e("Add Code to enable content grouping","conversios"); ?> <i>(Optional)</i></label>
216
- <p class="description" style="text-align: justify;"><?php esc_html_e("Content grouping helps you group your web pages (content).","conversios"); ?></p>
 
 
 
217
  </label>
218
  </td>
219
  </tr>
220
  <tr>
221
  <th>
222
- <label class="align-middle" for= "ga_optimize" ><?php esc_html_e("Google Optimize","conversios"); ?> <span class="tvc-pro"> (PRO)</span></label>
223
  </th>
224
  <td>
225
  <?php
@@ -228,118 +242,377 @@ if(isset($google_detail['setting'])){
228
  <?php }else{ ?>
229
  <input type="text" name="ga_optimize_id" id="ga_optimize_id" value = "<?php echo !empty($data['ga_optimize_id']) ? esc_attr($data['ga_optimize_id']) : '';?>" placeholder="<?php esc_html_e("Google Optimize ID","conversios"); ?>">
230
  <?php } ?>
231
- <i style="cursor: help;" class="fas fa-question-circle" id="ga_optimize_id" title="Enter a valid google optimize container ID."></i>
232
- </td>
 
 
 
 
233
  </tr>
234
  <tr>
235
  <th>
236
- <label for="ga_Impr"><?php esc_html_e("Impression Thresold","conversios"); ?></label>
237
  </th>
238
  <td>
239
  <?php $ga_Impr = !empty($data['ga_Impr']) ? $data['ga_Impr'] : 6; ?>
240
  <input type="number" min="1" id="ga_Impr" name = "ga_Impr" value = "<?php echo esc_attr($ga_Impr); ?>">
241
  <label for="ga_Impr"></label>
242
- <i style="cursor: help;" class="fas fa-question-circle" title="<?php esc_html_e("This feature sets Impression threshold for category page. It sends hit after these many numbers of products impressions.","conversios"); ?>"></i>
 
 
 
243
  <p class="description"><b><?php esc_html_e("Note : To avoid processing load on server we recommend upto 6 Impression Thresold.","conversios"); ?></b></p>
244
  </td>
245
  </tr>
246
  <tr>
247
  <th>
248
- <label class = "align-middle" for="ga_IPA"><?php esc_html_e("I.P. Anoymization","conversios"); ?></label>
249
  </th>
250
  <td>
251
- <label class = "align-middle">
252
  <?php $ga_IPA = !empty($data['ga_IPA']) ? 'checked' : ''; ?>
253
  <input class="" type="checkbox" name="ga_IPA" id="ga_IPA" <?php echo esc_attr($ga_IPA); ?>>
254
  <label class="custom-control-label" for="ga_IPA"><?php esc_html_e("Enable I.P. Anonymization","conversios"); ?></label>
255
-
256
- <i style="cursor: help;" class="fas fa-question-circle" title="<?php esc_html_e("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","conversios"); ?>"></i>
 
 
257
  </label>
258
  </td>
259
  </tr>
260
- <tr>
261
- <td colspan="2" style="padding: 0.5rem 0;">
262
- <strong>Tracking Trigger Point Settings</strong>
263
- <table class="tracking-trigger">
264
- <tr>
265
- <th style="padding: 0 1rem;">
266
- <label class = "align-middle" for="tvc_product_detail_conversion_tracking_type"><?php esc_html_e("AddtoCart PDP","conversios"); ?></label>
267
- </th>
268
- <td>
269
- <?php $tvc_prod_dtl_con_tracking_type = isset($data['tvc_product_detail_conversion_tracking_type'])?$data['tvc_product_detail_conversion_tracking_type']:""; ?>
270
- <select name="tvc_product_detail_conversion_tracking_type" id="tvc_conversion_tracking_type">
271
- <option value="woo-product-detail-hook" <?php echo ($tvc_prod_dtl_con_tracking_type != "on-productdetail-page")?"selected":""; ?>><?php esc_html_e("hook - woocommerce_after_single_product","conversios"); ?></option>
272
- <option value="on-productdetail-page" <?php echo ($tvc_prod_dtl_con_tracking_type == "on-productdetail-page")?"selected":""; ?>><?php esc_html_e("On Page Condition","conversios"); ?></option>
273
- </select>
274
- <i style="cursor: help;" class="fas fa-question-circle" title="<?php esc_html_e("If your AddtoCart event (product detail page) tracking does not work with the current tracking method then switch to another method.","conversios"); ?>"></i>
275
- </td>
276
- </tr>
277
- <tr>
278
- <th style="padding: 0 1rem;">
279
- <label class = "align-middle" for="tvc_checkout_conversion_tracking_type"><?php esc_html_e("Checkout Steps","conversios"); ?></label>
280
- </th>
281
- <td>
282
- <?php $tvc_checkout_con_tracking_type = isset($data['tvc_checkout_conversion_tracking_type'])?$data['tvc_checkout_conversion_tracking_type']:""; ?>
283
- <select name="tvc_checkout_conversion_tracking_type" id="tvc_conversion_tracking_type">
284
- <option value="woo-checkout-hook" <?php echo ($tvc_checkout_con_tracking_type != "on-checkout-page")?"selected":""; ?>><?php esc_html_e("hook - woocommerce_before_checkout_form","conversios"); ?></option>
285
- <option value="on-checkout-page" <?php echo ($tvc_checkout_con_tracking_type == "on-checkout-page")?"selected":""; ?>><?php esc_html_e("On Page Condition","conversios"); ?></option>
286
- </select>
287
- <i style="cursor: help;" class="fas fa-question-circle" title="<?php esc_html_e("If your checkout page tracking does not work with the current tracking method then switch to another method.","conversios"); ?>"></i>
288
- </td>
289
- </tr>
290
-
291
- <tr>
292
- <th style="padding: 0 1rem;">
293
- <label class = "align-middle" for="tvc_conversion_tracking_type"><?php esc_html_e("Order Conversion","conversios"); ?></label>
294
- </th>
295
- <td>
296
- <?php $tvc_con_tracking_type = isset($data['tvc_conversion_tracking_type'])?$data['tvc_conversion_tracking_type']:""; ?>
297
- <select name="tvc_conversion_tracking_type" id="tvc_conversion_tracking_type">
298
- <option value="woo-thankyou-hook" <?php echo ($tvc_con_tracking_type != "on-thankyou-page")?"selected":""; ?>><?php esc_html_e("hook - woocommerce_thankyou","conversios"); ?></option>
299
- <option value="on-thankyou-page" <?php echo ($tvc_con_tracking_type == "on-thankyou-page")?"selected":""; ?>><?php esc_html_e("On Page Condition","conversios"); ?></option>
300
- </select>
301
- <i style="cursor: help;" class="fas fa-question-circle" title="<?php esc_html_e("If your thank you page conversion tracking does not work with the current tracking method then switch to another method.","conversios"); ?>"></i>
302
- </td>
303
- </tr>
304
- </table>
305
- </td>
306
- </tr>
307
- <?php /*
308
- <tr>
309
- <th>
310
- <label class = "align-middle" for="ga_OPTOUT"><?php esc_html_e("Google Analytics Opt Out","conversios"); ?></label>
311
- </th>
312
- <td>
313
- <label class = "align-middle">
314
- <?php $ga_OPTOUT = !empty($data['ga_OPTOUT']) ? 'checked' : ''; ?>
315
- <input class="" type="checkbox" name="ga_OPTOUT" id="ga_OPTOUT" <?php echo esc_attr($ga_OPTOUT); ?>>
316
- <label class="custom-control-label" for="ga_OPTOUT"><?php esc_html_e("Enable Google Analytics Opt Out (Optional)","conversios"); ?></label>
317
-
318
- <i style="cursor: help;" class="fas fa-question-circle" title="<?php esc_html_e("Use this feature to provide website visitors the ability to prevent their data from being used by Google Analytics As per the GDPR compliance.Go through the documentation to check the setup","conversios"); ?>"></i>
319
- </label>
320
- </td>
321
- </tr> */ ?>
322
  <tr>
323
  <th>
324
- <img style="height: 20px;" src="<?php echo esc_url_raw(ENHANCAD_PLUGIN_URL . "/admin/images/fb-icon.png"); ?>" > <?php esc_html_e("Facebook pixel ID","conversios"); ?>
325
  </th>
326
  <td>
327
  <?php $fb_pixel_id = isset($data['fb_pixel_id'])?$data['fb_pixel_id']:""; ?>
328
  <input type="text" class="fromfiled" name="fb_pixel_id" id="fb_pixel_id" value="<?php echo esc_attr($fb_pixel_id); ?>">
329
- <small><?php esc_html_e("The Facebook pixel ID looks like. 518896233175751","conversios"); ?></small>
 
 
 
330
  </td>
331
  </tr>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
332
  <tr>
333
  <th>
334
- <label class = "align-middle" for="ga_PrivacyPolicy"><?php esc_html_e("Privacy Policy","conversios"); ?></label>
335
  </th>
336
  <td>
337
- <label class = "align-middle">
338
  <?php $ga_PrivacyPolicy = !empty($data['ga_PrivacyPolicy']) ? 'checked' : ''; ?>
339
  <input type="checkbox" name="ga_PrivacyPolicy" id="ga_PrivacyPolicy" required="required" <?php echo esc_attr($ga_PrivacyPolicy); ?>>
340
  <label class="custom-control-label" for="ga_PrivacyPolicy"><?php esc_html_e("Accept Privacy Policy of Plugin","conversios"); ?></label>
341
 
342
- <p class="description"><?php esc_html_e("By using Tatvic Plugin, you agree to Tatvic plugin's","conversios"); ?> <a href= "<?php echo esc_url_raw("https://www.tatvic.com/privacy-policy/?ref=plugin_policy&utm_source=plugin_backend&utm_medium=woo_premium_plugin&utm_campaign=GDPR_complaince_ecomm_plugins"); ?>" target="_blank"><?php esc_html_e("Privacy Policy","conversios"); ?></a></p>
343
  </label>
344
  </td>
345
  </tr>
@@ -373,6 +646,47 @@ if(isset($google_detail['setting'])){
373
  ?>
374
  <script>
375
  jQuery(document).ready(function () {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
376
  /*facebook*/
377
  jQuery("#fb_pixel_id").keypress(function (evt){
378
  var theEvent = evt || window.event;
1
  <?php
2
  echo "<script>var return_url ='".esc_url_raw($this->url)."';</script>";
3
  $TVC_Admin_Helper = new TVC_Admin_Helper();
4
+ $class="";
5
  $message_p = "";
6
  if (isset($_POST['ee_submit_plugin'])) {
7
  $settings = $TVC_Admin_Helper->get_ee_options_settings();
33
  //$settings['ga_OPTOUT'] = isset($_POST["ga_OPTOUT"])?sanitize_text_field($_POST["ga_OPTOUT"]):"";
34
  $settings['ga_PrivacyPolicy'] = isset($_POST["ga_PrivacyPolicy"])?sanitize_text_field($_POST["ga_PrivacyPolicy"]):"";
35
  $settings['google-analytic'] = '';
36
+ $tracking_integration = array("tvc_product_list_data_collection_method", "tvc_product_detail_data_collection_method", "tvc_checkout_data_collection_method", "tvc_thankyou_data_collection_method", "tvc_product_detail_addtocart_selector", "tvc_product_detail_addtocart_selector_type", "tvc_product_detail_addtocart_selector_val", "tvc_checkout_step_2_selector", "tvc_checkout_step_2_selector_type", "tvc_checkout_step_2_selector_val", "tvc_checkout_step_3_selector", "tvc_checkout_step_3_selector_type", "tvc_checkout_step_3_selector_val");
37
+ foreach($tracking_integration as $val){
38
+ $settings[$val] = isset($_POST[$val])?sanitize_text_field($_POST[$val]):"";
39
+ }
40
+
41
+
42
  $settings['fb_pixel_id'] = isset($_POST["fb_pixel_id"])?sanitize_text_field($_POST["fb_pixel_id"]):"";
43
  $settings['ga4_api_secret'] = isset($_POST["ga4_api_secret"])?sanitize_text_field($_POST["ga4_api_secret"]):"";
44
 
45
  $TVC_Admin_Helper->save_ee_options_settings($settings);
46
  $TVC_Admin_Helper->update_app_status();
47
 
48
+ $class='alert-message tvc-alert-success';
49
  $message_p = esc_html__( 'Your settings have been saved.', 'conversios' );
50
  }
51
  $data = unserialize(get_option('ee_options'));
 
52
  $subscription_id = $TVC_Admin_Helper->get_subscriptionId();
53
  $TVC_Admin_Helper->add_spinner_html();
54
  $google_detail = $TVC_Admin_Helper->get_ee_options_data();
68
  <div class="tab-pane show active" id="googleShoppingFeed">
69
  <div class="tab-card">
70
  <div class="row">
71
+ <div class="col-md-6 col-lg-8 border-right google-account-analytics">
72
  <?php if($plan_id == 1){?>
73
  <div class="licence tvc-licence" >
74
  <div class="tvc_licence_key_wapper <?php if($plan_id != 1){?>tvc-hide<?php }?>">
86
  </div>
87
  </div>
88
  <?php }?>
89
+ <div class="">
90
  <div class="row mb-3">
91
  <div class="col-6 col-md-6 col-lg-6">
92
  <h2 class="ga-title"><?php esc_html_e("Connected Google Analytics Account:","conversios"); ?></h2>
166
  <tbody>
167
  <tr>
168
  <th width="155px">
169
+ <label class="ga-title align-middle" for="tracking_code"><?php esc_html_e("Tracking Code","conversios"); ?></label>
170
  </th>
171
  <td>
172
+ <label class="align-middle">
173
  <?php $ga_ST = !empty($data['ga_ST']) ? 'checked' : ''; ?>
174
  <input type="checkbox" name="ga_ST" id="ga_ST" <?php echo esc_attr($ga_ST); ?> >
175
  <label class="custom-control-label" for="ga_ST"><?php esc_html_e("Add Global Site Tracking Code 'gtag.js'","conversios"); ?></label>
176
+ <div class="tvc-tooltip">
177
+ <span class="tvc-tooltiptext tvc-tooltip-right"><?php esc_html_e("This feature adds new gtag.js tracking code to your store. You don't need to enable this if gtag.js is implemented via any third party analytics plugin.","conversios"); ?></span>
178
+ <img src="<?php echo esc_url_raw(ENHANCAD_PLUGIN_URL."/admin/images/icon/informationI.svg"); ?>" alt=""/>
179
+ </div>
180
  </label><br/>
181
+ <label class="align-middle">
182
  <?php $ga_eeT = !empty($data['ga_eeT']) ? 'checked' : ''; ?>
183
  <input type="checkbox" name="ga_eeT" id="ga_eeT" <?php echo esc_attr($ga_eeT); ?> >
184
  <label class="custom-control-label" for="ga_eeT"><?php esc_html_e("Add Enhanced Ecommerce Tracking Code","conversios"); ?></label>
185
+ <div class="tvc-tooltip">
186
+ <span class="tvc-tooltiptext tvc-tooltip-right"><?php esc_html_e("This feature adds Enhanced Ecommerce Tracking Code to your Store.","conversios"); ?></span>
187
+ <img src="<?php echo esc_url_raw(ENHANCAD_PLUGIN_URL."/admin/images/icon/informationI.svg"); ?>" alt=""/>
188
+ </div>
189
  </label><br/>
190
+ <label class="align-middle">
191
  <?php $ga_gUser = !empty($data['ga_gUser']) ? 'checked' : ''; ?>
192
  <input type="checkbox" name="ga_gUser" id="ga_gUser" <?php echo esc_attr($ga_gUser); ?> >
193
  <label class="custom-control-label" for="ga_gUser"><?php esc_html_e("Add Code to Track the Login Step of Guest Users (Optional)","conversios"); ?></label>
194
+ <div class="tvc-tooltip">
195
+ <span class="tvc-tooltiptext tvc-tooltip-right"><?php esc_html_e("If you have Guest Check out enable, we recommend you to add this code.","conversios"); ?></span>
196
+ <img src="<?php echo esc_url_raw(ENHANCAD_PLUGIN_URL."/admin/images/icon/informationI.svg"); ?>" alt=""/>
197
+ </div>
198
  </label>
199
  </td>
200
  </tr>
201
  <?php if(isset($data['gm_id']) && $data['gm_id'] != '' && $plan_id != 1){ ?>
202
  <tr>
203
  <th>
204
+ <label class="ga-title align-middle"><?php esc_html_e("GA4 - API secrets ","conversios"); ?><span class="tvc-pro"> (PRO)</span></label>
205
  </th>
206
  <td>
207
  <?php $ga4_api_secret = isset($data['ga4_api_secret'])?$data['ga4_api_secret']:""; ?>
208
+ <input type="text" class="fromfiled" name="ga4_api_secret" id="ga4_api_secret" value="<?php echo esc_attr($ga4_api_secret); ?>">
209
+ <div class="tvc-tooltip">
210
+ <span class="tvc-tooltiptext tvc-tooltip-right"><?php esc_html_e("How to get 'Measurement Protocol API Secret' in GA4: Click Admin > Click Data streams (Under Property) > Select the stream > Additional Settings - Measurement Protocol API secrets > Create a new API secret.","conversios"); ?></span>
211
+ <img src="<?php echo esc_url_raw(ENHANCAD_PLUGIN_URL."/admin/images/icon/informationI.svg"); ?>" alt=""/>
212
+ </div>
213
  <br>To track refund order
 
214
  </td>
215
  </tr>
216
  <?php } ?>
217
  <tr>
218
  <th>
219
+ <label class="ga-title align-middle" for= "ga_CG" ><?php esc_html_e("Content Grouping","conversios"); ?> <span class="tvc-pro"> (PRO)</span></label>
220
  </th>
221
  <td>
222
+ <label class="align-middle">
223
  <?php $ga_CG = (!empty($data['ga_CG'])) ? 'checked' : '';
224
  if($plan_id==1){ $ga_CG ="";}?>
225
  <input type="checkbox" name="ga_CG" id="ga_CG" <?php if($plan_id==1){?> onclick="return false;"<?php } ?> <?php echo esc_attr($ga_CG);?> >
226
+ <label class="custom-control-label" for="ga_CG"><?php esc_html_e("Add Code to enable content grouping","conversios"); ?></label>
227
+ <div class="tvc-tooltip">
228
+ <span class="tvc-tooltiptext tvc-tooltip-right"><?php esc_html_e("Content grouping helps you group your web pages (content).","conversios"); ?></span>
229
+ <img src="<?php echo esc_url_raw(ENHANCAD_PLUGIN_URL."/admin/images/icon/informationI.svg"); ?>" alt=""/>
230
+ </div>
231
  </label>
232
  </td>
233
  </tr>
234
  <tr>
235
  <th>
236
+ <label class="ga-title align-middle" for= "ga_optimize" ><?php esc_html_e("Google Optimize","conversios"); ?> <span class="tvc-pro"> (PRO)</span></label>
237
  </th>
238
  <td>
239
  <?php
242
  <?php }else{ ?>
243
  <input type="text" name="ga_optimize_id" id="ga_optimize_id" value = "<?php echo !empty($data['ga_optimize_id']) ? esc_attr($data['ga_optimize_id']) : '';?>" placeholder="<?php esc_html_e("Google Optimize ID","conversios"); ?>">
244
  <?php } ?>
245
+ <div class="tvc-tooltip">
246
+ <span class="tvc-tooltiptext tvc-tooltip-right"><?php esc_html_e("Enter a valid google optimize container ID.","conversios"); ?></span>
247
+ <img src="<?php echo esc_url_raw(ENHANCAD_PLUGIN_URL."/admin/images/icon/informationI.svg"); ?>" alt=""/>
248
+ </div>
249
+
250
+ </td>
251
  </tr>
252
  <tr>
253
  <th>
254
+ <label class="ga-title align-middle" for="ga_Impr"><?php esc_html_e("Impression Thresold","conversios"); ?></label>
255
  </th>
256
  <td>
257
  <?php $ga_Impr = !empty($data['ga_Impr']) ? $data['ga_Impr'] : 6; ?>
258
  <input type="number" min="1" id="ga_Impr" name = "ga_Impr" value = "<?php echo esc_attr($ga_Impr); ?>">
259
  <label for="ga_Impr"></label>
260
+ <div class="tvc-tooltip">
261
+ <span class="tvc-tooltiptext tvc-tooltip-right"><?php esc_html_e("This feature sets Impression threshold for category page. It sends hit after these many numbers of products impressions.","conversios"); ?></span>
262
+ <img src="<?php echo esc_url_raw(ENHANCAD_PLUGIN_URL."/admin/images/icon/informationI.svg"); ?>" alt=""/>
263
+ </div>
264
  <p class="description"><b><?php esc_html_e("Note : To avoid processing load on server we recommend upto 6 Impression Thresold.","conversios"); ?></b></p>
265
  </td>
266
  </tr>
267
  <tr>
268
  <th>
269
+ <label class="ga-title align-middle" for="ga_IPA"><?php esc_html_e("I.P. Anoymization","conversios"); ?></label>
270
  </th>
271
  <td>
272
+ <label class="align-middle">
273
  <?php $ga_IPA = !empty($data['ga_IPA']) ? 'checked' : ''; ?>
274
  <input class="" type="checkbox" name="ga_IPA" id="ga_IPA" <?php echo esc_attr($ga_IPA); ?>>
275
  <label class="custom-control-label" for="ga_IPA"><?php esc_html_e("Enable I.P. Anonymization","conversios"); ?></label>
276
+ <div class="tvc-tooltip">
277
+ <span class="tvc-tooltiptext tvc-tooltip-right"><?php esc_html_e("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.","conversios"); ?></span>
278
+ <img src="<?php echo esc_url_raw(ENHANCAD_PLUGIN_URL."/admin/images/icon/informationI.svg"); ?>" alt=""/>
279
+ </div>
280
  </label>
281
  </td>
282
  </tr>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
283
  <tr>
284
  <th>
285
+ <label class="ga-title align-middle"><img style="height: 20px;" src="<?php echo esc_url_raw(ENHANCAD_PLUGIN_URL . "/admin/images/fb-icon.png"); ?>" > <?php esc_html_e("Facebook pixel ID","conversios"); ?></label>
286
  </th>
287
  <td>
288
  <?php $fb_pixel_id = isset($data['fb_pixel_id'])?$data['fb_pixel_id']:""; ?>
289
  <input type="text" class="fromfiled" name="fb_pixel_id" id="fb_pixel_id" value="<?php echo esc_attr($fb_pixel_id); ?>">
290
+ <div class="tvc-tooltip">
291
+ <span class="tvc-tooltiptext tvc-tooltip-right"><?php esc_html_e("The Facebook pixel ID looks like. 518896233175751","conversios"); ?></span>
292
+ <img src="<?php echo esc_url_raw(ENHANCAD_PLUGIN_URL."/admin/images/icon/informationI.svg"); ?>" alt=""/>
293
+ </div>
294
  </td>
295
  </tr>
296
+ <tr>
297
+ <td colspan="2" style="padding: 0.5rem 0;">
298
+ <div class="ga-title con_tracking_integration con_faq_title" data-id="sec_con_integration">
299
+ <?php esc_html_e("Google Analytics Event Tracking - Custom Integration","conversios"); ?>
300
+ <div class="tvc-tooltip">
301
+ <span class="tvc-tooltiptext tvc-tooltip-right"><?php esc_html_e("This feature is for the woocommerce store which has changed standard woocommerce hooks or implemented custom woocommerce hooks.","conversios"); ?></span>
302
+ <img src="<?php echo esc_url_raw(ENHANCAD_PLUGIN_URL."/admin/images/icon/informationI.svg"); ?>" alt=""/>
303
+ </div>
304
+ <img class="faq_icon" style="height: 20px;" src="<?php echo esc_url_raw(ENHANCAD_PLUGIN_URL . "/admin/images/arrow-down-sign.png"); ?>" ></div>
305
+ <div class="sec_con_integration" id="sec_con_integration">
306
+ <table class="tracking-trigger">
307
+ <tr><th colspan="2">
308
+ <span>
309
+ <?php esc_html_e("Product data collection method ","conversios"); ?>
310
+ <div class="tvc-tooltip">
311
+ <span class="tvc-tooltiptext tvc-tooltip-right"><?php esc_html_e("When you have custom woocommerce implementation and you have modified standard woocommerce hooks, you can configure/select your custom hooks from below to enable google analytics tracking for specific events.","conversios"); ?></span>
312
+ <img src="<?php echo esc_url_raw(ENHANCAD_PLUGIN_URL."/admin/images/icon/informationI.svg"); ?>" alt=""/>
313
+ </div>
314
+ </span>
315
+ </th></tr>
316
+ <tr>
317
+ <th style="padding: 0 1rem; width: 35%;">
318
+ <label class="ga-title align-middle"><?php esc_html_e("Product list","conversios"); ?></label>
319
+ </th>
320
+ <td>
321
+ <?php $tvc_product_list_data_collection_method = isset($data['tvc_product_list_data_collection_method'])?$data['tvc_product_list_data_collection_method']:"woocommerce_after_shop_loop_item";
322
+ $list = array(
323
+ "woocommerce_before_shop_loop_item" => "woocommerce_before_shop_loop_item (default hook)",
324
+ "woocommerce_after_shop_loop_item" => "woocommerce_after_shop_loop_item (default hook)",
325
+ "woocommerce_before_shop_loop_item_title" => "woocommerce_before_shop_loop_item_title (default hook)",
326
+ "woocommerce_shop_loop_item_title" => "woocommerce_shop_loop_item_title (default hook)",
327
+ "woocommerce_after_shop_loop_item_title" => "woocommerce_after_shop_loop_item_title (default hook)",
328
+ "conversios_shop_loop_item" => "conversios_shop_loop_item (conversios hook)"
329
+ ); ?>
330
+ <select name="tvc_product_list_data_collection_method" class="data_collection_method">
331
+ <?php if(!empty($list)){
332
+ foreach($list as $key => $val){
333
+ $selected = ($tvc_product_list_data_collection_method == $key)?"selected":"";
334
+ ?>
335
+ <option value="<?php echo esc_attr($key);?>" <?php echo $selected; ?>><?php echo esc_attr($val);?></option>
336
+ <?php
337
+ }
338
+ }?>
339
+ </select>
340
+ <div class="tvc-tooltip">
341
+ <span class="tvc-tooltiptext tvc-tooltip-right"><?php esc_html_e("When product impressions, clicks or add to cart google analytics ecommerce events are not working on your store, select the implemented hook from the dropdown.","conversios"); ?></span>
342
+ <img src="<?php echo esc_url_raw(ENHANCAD_PLUGIN_URL."/admin/images/icon/informationI.svg"); ?>" alt=""/>
343
+ </div>
344
+ <small>(At home, collection, shop, product details and cart page)</small>
345
+ </td>
346
+ </tr>
347
+ <tr>
348
+ <th style="padding: 0 1rem;">
349
+ <label class="ga-title align-middle"><?php esc_html_e("Product detail page","conversios"); ?></label>
350
+ </th>
351
+ <td>
352
+ <?php $tvc_product_detail_data_collection_method = isset($data['tvc_product_detail_data_collection_method'])?$data['tvc_product_detail_data_collection_method']:"woocommerce_after_single_product";
353
+ $list = array(
354
+ "woocommerce_before_single_product" => "woocommerce_before_single_product (default hook)",
355
+ "woocommerce_after_single_product" => "woocommerce_after_single_product (default hook)",
356
+ "woocommerce_single_product_summary" => "woocommerce_single_product_summary (default hook)",
357
+ "conversios_single_product" => "conversios_single_product (conversios hook)",
358
+ "on_page" => "On page load"
359
+ ); ?>
360
+ <select name="tvc_product_detail_data_collection_method" class="data_collection_method">
361
+ <?php if(!empty($list)){
362
+ foreach($list as $key => $val){
363
+ $selected = ($tvc_product_detail_data_collection_method == $key)?"selected":"";
364
+ ?>
365
+ <option value="<?php echo esc_attr($key);?>" <?php echo $selected; ?>><?php echo esc_attr($val);?></option>
366
+ <?php
367
+ }
368
+ }?>
369
+ </select>
370
+ <div class="tvc-tooltip">
371
+ <span class="tvc-tooltiptext tvc-tooltip-right"><?php esc_html_e("When your product detail page is not being tracked in google analytics (view_item), try changing the relevant hook from the dropdown.","conversios"); ?></span>
372
+ <img src="<?php echo esc_url_raw(ENHANCAD_PLUGIN_URL."/admin/images/icon/informationI.svg"); ?>" alt=""/>
373
+ </div>
374
+ </td>
375
+ </tr>
376
+ <tr>
377
+ <th style="padding: 0 1rem;">
378
+ <label class="ga-title align-middle"><?php esc_html_e("Checkout page","conversios"); ?></label>
379
+ </th>
380
+ <td>
381
+ <?php
382
+ $tvc_checkout_data_collection_method = isset($data['tvc_checkout_data_collection_method'])?$data['tvc_checkout_data_collection_method']:"woocommerce_before_checkout_form";
383
+ $list = array(
384
+ "woocommerce_before_checkout_form" => "woocommerce_before_checkout_form (default hook)",
385
+ "woocommerce_after_checkout_form" => "woocommerce_after_checkout_form (default hook)",
386
+ "woocommerce_checkout_billing" => "woocommerce_checkout_billing (default hook)",
387
+ "woocommerce_checkout_shipping" => "woocommerce_checkout_shipping (default hook)",
388
+ "woocommerce_checkout_order_review" => "woocommerce_checkout_order_review (default hook)",
389
+ "conversios_checkout_form" => "conversios_checkout_form (conversios hook)",
390
+ "on_page" =>"On page load"
391
+ ); ?>
392
+ <select name="tvc_checkout_data_collection_method" class="data_collection_method">
393
+ <?php if(!empty($list)){
394
+ foreach($list as $key => $val){
395
+ $selected = ($tvc_checkout_data_collection_method == $key)?"selected":"";
396
+ ?>
397
+ <option value="<?php echo esc_attr($key);?>" <?php echo $selected; ?>><?php echo esc_attr($val);?></option>
398
+ <?php
399
+ }
400
+ }?>
401
+ </select>
402
+ <div class="tvc-tooltip">
403
+ <span class="tvc-tooltiptext tvc-tooltip-right"><?php esc_html_e("When your checkout is not being tracked in google analytics (checkout events), try changing the relevant hook from the dropdown.","conversios"); ?></span>
404
+ <img src="<?php echo esc_url_raw(ENHANCAD_PLUGIN_URL."/admin/images/icon/informationI.svg"); ?>" alt=""/>
405
+ </div>
406
+ </td>
407
+ </tr>
408
+
409
+ <tr>
410
+ <th style="padding: 0 1rem;">
411
+ <label class="ga-title align-middle"><?php esc_html_e("Order confirmation page","conversios"); ?></label>
412
+ </th>
413
+ <td>
414
+ <?php
415
+ $tvc_thankyou_data_collection_method = isset($data['tvc_thankyou_data_collection_method'])?$data['tvc_thankyou_data_collection_method']:"woocommerce_thankyou";
416
+ $list = array(
417
+ "woocommerce_thankyou" => "woocommerce_thankyou (default hook)",
418
+ "woocommerce_before_thankyou" => "woocommerce_before_thankyou (default hook)",
419
+ "conversios_thankyou" => "conversios_thankyou (conversios hook)",
420
+ "on_page" =>"On page load"
421
+ ); ?>
422
+ <select name="tvc_thankyou_data_collection_method" class="data_collection_method">
423
+ <?php if(!empty($list)){
424
+ foreach($list as $key => $val){
425
+ $selected = ($tvc_thankyou_data_collection_method == $key)?"selected":"";
426
+ ?>
427
+ <option value="<?php echo esc_attr($key);?>" <?php echo $selected; ?>><?php echo esc_attr($val);?></option>
428
+ <?php
429
+ }
430
+ }?>
431
+ </select>
432
+ <div class="tvc-tooltip">
433
+ <span class="tvc-tooltiptext tvc-tooltip-right"><?php esc_html_e("When your transactions are not being tracked in google analytics (purchase event), try changing the relevant hook from the dropdown.","conversios"); ?></span>
434
+ <img src="<?php echo esc_url_raw(ENHANCAD_PLUGIN_URL."/admin/images/icon/informationI.svg"); ?>" alt=""/>
435
+ </div>
436
+ </td>
437
+ </tr>
438
+
439
+ <tr><th colspan="2">
440
+ <span>
441
+ <?php esc_html_e("Event selector","conversios"); ?>
442
+ <div class="tvc-tooltip">
443
+ <span class="tvc-tooltiptext tvc-tooltip-right"><?php esc_html_e("If you change your front end class or id for below events, select/input the changed class or id.","conversios"); ?></span>
444
+ <img src="<?php echo esc_url_raw(ENHANCAD_PLUGIN_URL."/admin/images/icon/informationI.svg"); ?>" alt=""/>
445
+ </div>
446
+ </span>
447
+ </th></tr>
448
+ <tr>
449
+ <th style="padding: 0 1rem;">
450
+ <label class="ga-title align-middle"><?php esc_html_e("Product page AddToCart button","conversios"); ?></label>
451
+ </th>
452
+ <td>
453
+ <?php $tvc_product_detail_addtocart_selector = isset($data['tvc_product_detail_addtocart_selector'])?$data['tvc_product_detail_addtocart_selector']:"default";
454
+ $list = array(
455
+ "default" => "default",
456
+ "custom" => "custom"
457
+ ); ?>
458
+ <select name="tvc_product_detail_addtocart_selector" class="select-sm css-selector">
459
+ <?php if(!empty($list)){
460
+ foreach($list as $key => $val){
461
+ $selected = ($tvc_product_detail_addtocart_selector == $key)?"selected":"";
462
+ ?>
463
+ <option value="<?php echo esc_attr($key);?>" <?php echo $selected; ?>><?php echo esc_attr($val);?></option>
464
+ <?php
465
+ }
466
+ }?>
467
+ </select>
468
+
469
+ <span class="tvc-css-selector-sec default-selector-sec <?php echo ($tvc_product_detail_addtocart_selector != "default")?"tvc-hide":""; ?>">
470
+ <input type="text" class="select-sm" value="class" disabled>
471
+
472
+ <input type="text" class="fromfiled default_selector_val" value="single_add_to_cart_button" disabled>
473
+ </span>
474
+
475
+ <span class="tvc-css-selector-sec <?php echo ($tvc_product_detail_addtocart_selector == "default")?"tvc-hide":""; ?>">
476
+ <?php $tvc_product_detail_addtocart_selector_type = isset($data['tvc_product_detail_addtocart_selector_type'])?$data['tvc_product_detail_addtocart_selector_type']:"class";
477
+ $list = array(
478
+ "id" => "id",
479
+ "class" => "class"
480
+ ); ?>
481
+ <select name="tvc_product_detail_addtocart_selector_type" class="select-sm">
482
+ <?php if(!empty($list)){
483
+ foreach($list as $key => $val){
484
+ $selected = ($tvc_product_detail_addtocart_selector_type == $key)?"selected":"";
485
+ ?>
486
+ <option value="<?php echo esc_attr($key);?>" <?php echo $selected; ?>><?php echo esc_attr($val);?></option>
487
+ <?php
488
+ }
489
+ }?>
490
+ </select>
491
+ <?php $tvc_product_detail_addtocart_selector_val = isset($data['tvc_product_detail_addtocart_selector_val'])?$data['tvc_product_detail_addtocart_selector_val']:""; ?>
492
+ <input type="text" class="fromfiled" name="tvc_product_detail_addtocart_selector_val" id="tvc_product_detail_addtocart_selector_val" value="<?php echo esc_attr($tvc_product_detail_addtocart_selector_val); ?>">
493
+ <div class="tvc-tooltip">
494
+ <span class="tvc-tooltiptext tvc-tooltip-right"><?php esc_html_e("Enter your button selector (id or calss) value. You can add multiple classes using comma separated string.","conversios"); ?></span>
495
+ <img src="<?php echo esc_url_raw(ENHANCAD_PLUGIN_URL."/admin/images/icon/informationI.svg"); ?>" alt=""/>
496
+ </div>
497
+ </span>
498
+
499
+ </td>
500
+ </tr>
501
+ <tr>
502
+ <th style="padding: 0 1rem;">
503
+ <label class="ga-title align-middle"><?php esc_html_e("Checkout Step 2","conversios"); ?></label>
504
+ </th>
505
+ <td>
506
+ <?php $tvc_checkout_step_2_selector = isset($data['tvc_checkout_step_2_selector'])?$data['tvc_checkout_step_2_selector']:"default";
507
+ $list = array(
508
+ "default" => "default",
509
+ "custom" => "custom"
510
+ ); ?>
511
+ <select name="tvc_checkout_step_2_selector" class="select-sm css-selector">
512
+ <?php if(!empty($list)){
513
+ foreach($list as $key => $val){
514
+ $selected = ($tvc_checkout_step_2_selector == $key)?"selected":"";
515
+ ?>
516
+ <option value="<?php echo esc_attr($key);?>" <?php echo $selected; ?>><?php echo esc_attr($val);?></option>
517
+ <?php
518
+ }
519
+ }?>
520
+ </select>
521
+ <span class="tvc-css-selector-sec default-selector-sec <?php echo ($tvc_checkout_step_2_selector != "default")?"tvc-hide":""; ?>">
522
+ <input type="text" class="select-sm" value="name" disabled>
523
+
524
+ <input type="text" class="fromfiled default_selector_val" value="input[name=billing_first_name]" disabled>
525
+ </span>
526
+ <span class="tvc-css-selector-sec <?php echo ($tvc_checkout_step_2_selector == "default")?"tvc-hide":""; ?>">
527
+ <?php $tvc_checkout_step_2_selector_type = isset($data['tvc_checkout_step_2_selector_type'])?$data['tvc_checkout_step_2_selector_type']:"";
528
+ $list = array(
529
+ "id" => "id",
530
+ "class" => "class"
531
+ ); ?>
532
+ <select name="tvc_checkout_step_2_selector_type" class="select-sm">
533
+ <?php if(!empty($list)){
534
+ foreach($list as $key => $val){
535
+ $selected = ($tvc_checkout_step_2_selector_type == $key)?"selected":"";
536
+ ?>
537
+ <option value="<?php echo esc_attr($key);?>" <?php echo $selected; ?>><?php echo esc_attr($val);?></option>
538
+ <?php
539
+ }
540
+ }?>
541
+ </select>
542
+ <?php $tvc_checkout_step_2_selector_val = isset($data['tvc_checkout_step_2_selector_val'])?$data['tvc_checkout_step_2_selector_val']:""; ?>
543
+ <input type="text" class="fromfiled" name="tvc_checkout_step_2_selector_val" id="tvc_checkout_step_2_selector_val" value="<?php echo esc_attr($tvc_checkout_step_2_selector_val); ?>">
544
+ <div class="tvc-tooltip">
545
+ <span class="tvc-tooltiptext tvc-tooltip-right"><?php esc_html_e("Enter your selector (id or calss) value. You can add multiple classes using comma separated string.","conversios"); ?></span>
546
+ <img src="<?php echo esc_url_raw(ENHANCAD_PLUGIN_URL."/admin/images/icon/informationI.svg"); ?>" alt=""/>
547
+ </div>
548
+ </span>
549
+ </td>
550
+ </tr>
551
+ <tr>
552
+ <th style="padding: 0 1rem;">
553
+ <label class="ga-title align-middle"><?php esc_html_e("Checkout Step 3","conversios"); ?></label>
554
+ </th>
555
+ <td>
556
+ <?php $tvc_checkout_step_3_selector = isset($data['tvc_checkout_step_3_selector'])?$data['tvc_checkout_step_3_selector']:"default";
557
+ $list = array(
558
+ "default" => "default",
559
+ "custom" => "custom"
560
+ ); ?>
561
+ <select name="tvc_checkout_step_3_selector" class="select-sm css-selector">
562
+ <?php if(!empty($list)){
563
+ foreach($list as $key => $val){
564
+ $selected = ($tvc_checkout_step_3_selector == $key)?"selected":"";
565
+ ?>
566
+ <option value="<?php echo esc_attr($key);?>" <?php echo $selected; ?>><?php echo esc_attr($val);?></option>
567
+ <?php
568
+ }
569
+ }?>
570
+ </select>
571
+ <span class="tvc-css-selector-sec default-selector-sec <?php echo ($tvc_checkout_step_3_selector != "default")?"tvc-hide":""; ?>">
572
+ <input type="text" class="select-sm" value="id" disabled>
573
+
574
+ <input type="text" class="fromfiled default_selector_val" value="place_order" disabled>
575
+ </span>
576
+ <span class="tvc-css-selector-sec <?php echo ($tvc_checkout_step_3_selector == "default")?"tvc-hide":""; ?>">
577
+ <?php $tvc_checkout_step_3_selector_type = isset($data['tvc_checkout_step_3_selector_type'])?$data['tvc_checkout_step_3_selector_type']:"";
578
+ $list = array(
579
+ "id" => "id",
580
+ "class" => "class"
581
+ ); ?>
582
+ <select name="tvc_checkout_step_3_selector_type" class="select-sm">
583
+ <?php if(!empty($list)){
584
+ foreach($list as $key => $val){
585
+ $selected = ($tvc_checkout_step_3_selector_type == $key)?"selected":"";
586
+ ?>
587
+ <option value="<?php echo esc_attr($key);?>" <?php echo $selected; ?>><?php echo esc_attr($val);?></option>
588
+ <?php
589
+ }
590
+ }?>
591
+ </select>
592
+ <?php $tvc_checkout_step_3_selector_val = isset($data['tvc_checkout_step_3_selector_val'])?$data['tvc_checkout_step_3_selector_val']:""; ?>
593
+ <input type="text" class="fromfiled" name="tvc_checkout_step_3_selector_val" id="tvc_checkout_step_3_selector_val" value="<?php echo esc_attr($tvc_checkout_step_3_selector_val); ?>">
594
+ <div class="tvc-tooltip">
595
+ <span class="tvc-tooltiptext tvc-tooltip-right"><?php esc_html_e("Enter your button selector (id or calss) value. You can add multiple classes using comma separated string.","conversios"); ?></span>
596
+ <img src="<?php echo esc_url_raw(ENHANCAD_PLUGIN_URL."/admin/images/icon/informationI.svg"); ?>" alt=""/>
597
+ </div>
598
+ </span>
599
+ </td>
600
+ </tr>
601
+ </table>
602
+ </div>
603
+ </td>
604
+ </tr>
605
  <tr>
606
  <th>
607
+ <label class="ga-title align-middle" for="ga_PrivacyPolicy"><?php esc_html_e("Privacy Policy","conversios"); ?></label>
608
  </th>
609
  <td>
610
+ <label class="align-middle">
611
  <?php $ga_PrivacyPolicy = !empty($data['ga_PrivacyPolicy']) ? 'checked' : ''; ?>
612
  <input type="checkbox" name="ga_PrivacyPolicy" id="ga_PrivacyPolicy" required="required" <?php echo esc_attr($ga_PrivacyPolicy); ?>>
613
  <label class="custom-control-label" for="ga_PrivacyPolicy"><?php esc_html_e("Accept Privacy Policy of Plugin","conversios"); ?></label>
614
 
615
+ <p class="description"><?php esc_html_e("By using Conversios plugin, you agree to Conversios plugin's","conversios"); ?> <a href= "<?php echo esc_url_raw("https://www.tatvic.com/privacy-policy/?ref=plugin_policy&utm_source=plugin_backend&utm_medium=woo_premium_plugin&utm_campaign=GDPR_complaince_ecomm_plugins"); ?>" target="_blank"><?php esc_html_e("Privacy Policy","conversios"); ?></a></p>
616
  </label>
617
  </td>
618
  </tr>
646
  ?>
647
  <script>
648
  jQuery(document).ready(function () {
649
+ jQuery(document).on('click','.con_faq_title',function(event){
650
+ let faq_id = jQuery(this).attr("data-id");
651
+ jQuery(this).toggleClass('active');
652
+ jQuery('#'+faq_id).toggleClass('active');
653
+ });
654
+ jQuery(document).on('change','.css-selector',function(event){
655
+ //console.log(jQuery(this).val());
656
+ if(jQuery(this).val() == "custom"){
657
+ console.log(jQuery(this).next());
658
+ jQuery(this).next().addClass("tvc-hide");
659
+ jQuery(this).next().next().removeClass("tvc-hide");
660
+ }else{
661
+ jQuery(this).next().next().addClass("tvc-hide");
662
+ jQuery(this).next().removeClass("tvc-hide");
663
+ }
664
+ });
665
+
666
+ jQuery(document).on('submit','form#ee_plugin_form',function(event){
667
+ if(jQuery('select[name="tvc_product_detail_addtocart_selector"]').val() == "custom" ){
668
+ if(jQuery('input[name="tvc_product_detail_addtocart_selector_val"]').val() == "" ){
669
+ jQuery('input[name="tvc_product_detail_addtocart_selector_val"]').focus();
670
+ jQuery('input[name="tvc_product_detail_addtocart_selector_val"]').css("border","1px #f10909 solid")
671
+ return false;
672
+ }
673
+ }
674
+ if(jQuery('select[name="tvc_checkout_step_2_selector"]').val() == "custom" ){
675
+ if(jQuery('input[name="tvc_checkout_step_2_selector_val"]').val() == "" ){
676
+ jQuery('input[name="tvc_checkout_step_2_selector_val"]').focus();
677
+ jQuery('input[name="tvc_checkout_step_2_selector_val"]').css("border","1px #f10909 solid")
678
+ return false;
679
+ }
680
+ }
681
+ if(jQuery('select[name="tvc_checkout_step_3_selector"]').val() == "custom" ){
682
+ if(jQuery('input[name="tvc_checkout_step_3_selector_val"]').val() == "" ){
683
+ jQuery('input[name="tvc_checkout_step_3_selector_val"]').focus();
684
+ jQuery('input[name="tvc_checkout_step_3_selector_val"]').css("border","1px #f10909 solid")
685
+ return false;
686
+ }
687
+ }
688
+ });
689
+
690
  /*facebook*/
691
  jQuery("#fb_pixel_id").keypress(function (evt){
692
  var theEvent = evt || window.event;
enhanced-ecommerce-google-analytics.php CHANGED
@@ -15,7 +15,7 @@
15
  * Plugin Name: Conversios.io - Google Analytics and Google Shopping plugin for WooCommerce
16
  * Plugin URI: https://www.tatvic.com/tatvic-labs/woocommerce-extension/
17
  * Description: Automates eCommerce tracking in Google Analytics, dynamic remarkting in Google Ads, and provides complete Google Shopping features.
18
- * Version: 4.8.9
19
  * Author: Conversios
20
  * Author URI: conversios.io
21
  * License: GPL-2.0+
@@ -37,7 +37,7 @@ if ( ! defined( 'WPINC' ) ) {
37
  * Start at version 1.0.0 and use SemVer - https://semver.org
38
  * Rename this for your plugin and update it as you release new versions.
39
  */
40
- define( 'PLUGIN_TVC_VERSION', '4.8.9' );
41
  $fullName = plugin_basename( __FILE__ );
42
  $dir = str_replace('/enhanced-ecommerce-google-analytics.php','',$fullName);
43
  if ( ! defined( 'ENHANCAD_PLUGIN_NAME' ) ) {
15
  * Plugin Name: Conversios.io - Google Analytics and Google Shopping plugin for WooCommerce
16
  * Plugin URI: https://www.tatvic.com/tatvic-labs/woocommerce-extension/
17
  * Description: Automates eCommerce tracking in Google Analytics, dynamic remarkting in Google Ads, and provides complete Google Shopping features.
18
+ * Version: 4.9.0
19
  * Author: Conversios
20
  * Author URI: conversios.io
21
  * License: GPL-2.0+
37
  * Start at version 1.0.0 and use SemVer - https://semver.org
38
  * Rename this for your plugin and update it as you release new versions.
39
  */
40
+ define( 'PLUGIN_TVC_VERSION', '4.9.0' );
41
  $fullName = plugin_basename( __FILE__ );
42
  $dir = str_replace('/enhanced-ecommerce-google-analytics.php','',$fullName);
43
  if ( ! defined( 'ENHANCAD_PLUGIN_NAME' ) ) {
includes/setup/CustomApi.php CHANGED
@@ -83,7 +83,8 @@ class CustomApi{
83
  if(isset($options['fb_pixel_id']) && $options['fb_pixel_id'] != ""){
84
  $fb_pixel_enable = "1";
85
  }
86
- $store_country = get_option('woocommerce_default_country');
 
87
  $postData = array(
88
  "subscription_id" => $subscription_id,
89
  "domain" => esc_url_raw(get_site_url()),
@@ -93,10 +94,12 @@ class CustomApi{
93
  "fb_pixel_enable" => $fb_pixel_enable,
94
  "app_verstion" => PLUGIN_TVC_VERSION,
95
  "domain" => esc_url_raw(get_site_url()),
 
96
  "update_date" => date("Y-m-d")
97
  ),
98
- "store"=>array(
99
- "country" =>$store_country
 
100
  )
101
  )
102
  );
@@ -782,8 +785,8 @@ class CustomApi{
782
  }
783
 
784
  public function generateAccessToken($access_token, $refresh_token) {
785
- $url = "https://www.googleapis.com/oauth2/v1/tokeninfo?=" . $access_token;
786
- $request = wp_remote_get(esc_url_raw($url), array("access_token" => $access_token, 'timeout' => 10000));
787
  $response_code = wp_remote_retrieve_response_code($request);
788
 
789
  $response_message = wp_remote_retrieve_response_message($request);
@@ -814,7 +817,11 @@ class CustomApi{
814
  $response_message = wp_remote_retrieve_response_message($request);
815
  $response = json_decode(wp_remote_retrieve_body($request));
816
  if(isset($response->access_token)){
817
- return $response->access_token;
 
 
 
 
818
  }else{
819
  //return $access_token;
820
  }
83
  if(isset($options['fb_pixel_id']) && $options['fb_pixel_id'] != ""){
84
  $fb_pixel_enable = "1";
85
  }
86
+ $store_country = get_option('woocommerce_default_country');
87
+ $store_country = explode(":",$store_country);
88
  $postData = array(
89
  "subscription_id" => $subscription_id,
90
  "domain" => esc_url_raw(get_site_url()),
94
  "fb_pixel_enable" => $fb_pixel_enable,
95
  "app_verstion" => PLUGIN_TVC_VERSION,
96
  "domain" => esc_url_raw(get_site_url()),
97
+ "product_settings" => unserialize(get_option('ee_options')),
98
  "update_date" => date("Y-m-d")
99
  ),
100
+ "store" => array(
101
+ "country" =>isset($store_country[0])?$store_country[0]:"",
102
+ "state" =>isset($store_country[1])?$store_country[1]:""
103
  )
104
  )
105
  );
785
  }
786
 
787
  public function generateAccessToken($access_token, $refresh_token) {
788
+ $url = "https://www.googleapis.com/oauth2/v1/tokeninfo?access_token=".$access_token;
789
+ $request = wp_remote_get(esc_url_raw($url), array('timeout' => 10000));
790
  $response_code = wp_remote_retrieve_response_code($request);
791
 
792
  $response_message = wp_remote_retrieve_response_message($request);
817
  $response_message = wp_remote_retrieve_response_message($request);
818
  $response = json_decode(wp_remote_retrieve_body($request));
819
  if(isset($response->access_token)){
820
+ $TVC_Admin_Helper = new TVC_Admin_Helper();
821
+ $google_detail = $TVC_Admin_Helper->get_ee_options_data();
822
+ $google_detail["setting"]->access_token = base64_encode(sanitize_text_field($response->access_token));
823
+ $TVC_Admin_Helper->set_ee_options_data($google_detail);
824
+ return $response->access_token;
825
  }else{
826
  //return $access_token;
827
  }
index.php CHANGED
@@ -1,4 +1,4 @@
1
- <?php
2
- /**
3
- * Silence Is Golden
4
  */
1
+ <?php
2
+ /**
3
+ * Silence Is Golden
4
  */
public/class-enhanced-ecommerce-google-analytics-public-pro.php CHANGED
@@ -68,11 +68,9 @@ class Enhanced_Ecommerce_Google_Analytics_Public {
68
  protected $remarketing_snippet_id;
69
  protected $remarketing_snippets;
70
  protected $conversio_send_to;
71
- protected $tvc_conversion_tracking_type;
72
- protected $tvc_product_detail_tracking_type;
73
- protected $tvc_checkout_tracking_type;
74
  protected $ee_options;
75
  protected $fb_pixel_id;
 
76
 
77
  /**
78
  * Enhanced_Ecommerce_Google_Analytics_Public constructor.
@@ -87,9 +85,20 @@ class Enhanced_Ecommerce_Google_Analytics_Public {
87
  $this->ga_CG = $this->get_option('ga_CG') == "on" ? true : false; // Content Grouping
88
  $this->ga_optimize_id = sanitize_text_field($this->get_option("ga_optimize_id"));
89
  $this->ee_options = $this->TVC_Admin_Helper->get_ee_options_settings();
90
- $this->tvc_conversion_tracking_type = sanitize_text_field($this->get_option("tvc_conversion_tracking_type"));
91
- $this->tvc_product_detail_tracking_type = sanitize_text_field($this->get_option("tvc_product_detail_conversion_tracking_type"));
92
- $this->tvc_checkout_tracking_type = sanitize_text_field($this->get_option("tvc_checkout_conversion_tracking_type"));
 
 
 
 
 
 
 
 
 
 
 
93
  $this->tvc_call_hooks();
94
 
95
  $this->ga_Dname = "auto";
@@ -173,8 +182,23 @@ class Enhanced_Ecommerce_Google_Analytics_Public {
173
  );
174
  /*
175
  * end tvc_options
176
- */
177
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
178
  }
179
 
180
  public function tvc_call_hooks(){
@@ -183,40 +207,62 @@ class Enhanced_Ecommerce_Google_Analytics_Public {
183
  add_action("wp_head", array($this, "add_google_site_verification_tag"),1);
184
 
185
  add_action("wp_footer", array($this, "t_products_impre_clicks"));
186
- add_action("woocommerce_after_shop_loop_item", array($this, "bind_product_metadata"));
187
- if($this->tvc_conversion_tracking_type == "on-thankyou-page"){
188
- add_action("wp_head", array($this, "ecommerce_tracking_code"));
 
 
 
189
  }else{
 
 
 
 
 
 
 
 
 
190
  add_action("woocommerce_thankyou", array($this, "ecommerce_tracking_code"));
191
- }
192
- if($this->tvc_product_detail_tracking_type == "on-product-detail-page"){
193
- add_action("wp_head", array($this, "product_detail_view"));
194
- add_action("wp_footer", array($this, "single_add_to_cart"));
 
 
 
 
 
 
 
 
195
  }else{
196
- // var int
197
- add_action("woocommerce_after_single_product", array($this, "product_detail_view"));
198
- // event tigger
199
- add_action("woocommerce_after_add_to_cart_button", array($this, "single_add_to_cart"));
200
  }
201
  add_action("woocommerce_after_cart", array($this, "remove_cart_tracking"));
202
 
203
- //check out step 1,2,3
204
- if($this->tvc_checkout_tracking_type == "on-checkout-page"){
205
- add_action("wp_head", array($this, "checkout_step_1_tracking"));
206
- add_action("wp_head", array($this, "checkout_step_2_tracking"));
207
- add_action("wp_head", array($this, "checkout_step_3_tracking"));
 
 
 
 
 
208
  }else{
209
- add_action("woocommerce_before_checkout_form", array($this, "checkout_step_1_tracking"));
210
- add_action("woocommerce_before_checkout_form", array($this, "checkout_step_2_tracking"));
211
- add_action("woocommerce_before_checkout_form", array($this, "checkout_step_3_tracking"));
212
  }
213
 
214
  //Add Dev ID
215
  add_action("wp_head", array($this, "add_dev_id"));
216
  add_action("wp_footer", array($this, "tvc_store_meta_data"));
217
-
218
- //add_action('wp_ajax_get_variation_data', array($this,'get_variation_data') );
219
- //add_action("wp_ajax_nopriv_get_variation_data" , "get_variation_data");
220
  }
221
  public function getAttributesVariation($product) {
222
  $prod_var_array = array();
@@ -453,7 +499,7 @@ class Enhanced_Ecommerce_Google_Analytics_Public {
453
  <?php if ($this->ga_optimize_id ){?>
454
  <!--Conversios.io – Google optimize start-->
455
  <style>.async-hide { opacity: 0 !important} </style>
456
- <script>
457
  (function(a,s,y,n,c,h,i,d,e){s.className+=' '+y;h.start=1*new Date;
458
  h.end=i=function(){s.className=s.className.replace(RegExp(' ?'+y),'')};
459
  (a[n]=a[n]||[]).hide=h;setTimeout(function(){i();h.end=null},c);h.timeout=c;
@@ -463,7 +509,7 @@ class Enhanced_Ecommerce_Google_Analytics_Public {
463
  <script src="https://www.googleoptimize.com/optimize.js?id=<?php echo esc_js($this->ga_optimize_id); ?>"></script>
464
  <!--Conversios.io – Google optimize end-->
465
  <?php } ?>
466
- <script type="text/javascript">
467
  var adsTringId = '<?php echo esc_js($this->ads_tracking_id); ?>';
468
  var ads_ert = '<?php echo esc_js($this->ads_ert); ?>';
469
  var ads_edrt = '<?php echo esc_js($this->ads_edrt)?>';
@@ -492,7 +538,7 @@ class Enhanced_Ecommerce_Google_Analytics_Public {
492
  if( $this->tracking_option == "BOTH" && $this->gm_id && $this->ga_id){ ?>
493
  <!--Conversios.io – Google Analytics and Google Shopping plugin for WooCommerce-->
494
  <script async src="https://www.googletagmanager.com/gtag/js?id=<?php echo esc_js($this->gm_id); ?>"></script>
495
- <script>
496
  window.dataLayer = window.dataLayer || [];
497
  function gtag(){dataLayer.push(arguments);}
498
  gtag("js", new Date());
@@ -525,7 +571,7 @@ class Enhanced_Ecommerce_Google_Analytics_Public {
525
  }else if($this->tracking_option == "GA4" && $this->gm_id){ ?>
526
  <!--Conversios.io – Google Analytics and Google Shopping plugin for WooCommerce-->
527
  <script async src="https://www.googletagmanager.com/gtag/js?id=<?php echo esc_js($this->gm_id); ?>"></script>
528
- <script>
529
  window.dataLayer = window.dataLayer || [];
530
  function gtag(){dataLayer.push(arguments);}
531
  gtag("js", new Date());
@@ -557,7 +603,7 @@ class Enhanced_Ecommerce_Google_Analytics_Public {
557
  }else if($this->ga_id){ ?>
558
  <!--Conversios.io – Google Analytics and Google Shopping plugin for WooCommerce-->
559
  <script async src="https://www.googletagmanager.com/gtag/js?id=<?php echo esc_js($this->ga_id); ?>"></script>
560
- <script>
561
  window.dataLayer = window.dataLayer || [];
562
  function gtag(){dataLayer.push(arguments);}
563
  gtag("js", new Date());
@@ -593,7 +639,7 @@ class Enhanced_Ecommerce_Google_Analytics_Public {
593
  ?>
594
  <script async src="https://www.googletagmanager.com/gtag/js?id=<?php echo esc_js($this->remarketing_snippet_id); ?>">
595
  </script>
596
- <script>
597
  window.dataLayer = window.dataLayer || [];
598
  function gtag(){dataLayer.push(arguments);}
599
  gtag('js', new Date());
@@ -647,11 +693,9 @@ class Enhanced_Ecommerce_Google_Analytics_Public {
647
  $enhanced_conversion["address"]["country"] = esc_js($billing_country);
648
  }
649
  if(!empty($enhanced_conversion)){
650
- ?>
651
- <script>
652
- var enhanced_conversion_data = <?php echo json_encode($enhanced_conversion); ?>
653
- </script>
654
- <script>
655
  gtag('set', 'user_data', {
656
  "email": enhanced_conversion_data.email,
657
  "phone_number":enhanced_conversion_data.phone_number,
@@ -722,7 +766,7 @@ class Enhanced_Ecommerce_Google_Analytics_Public {
722
  <script>
723
  var enhanced_conversion_data = <?php echo json_encode($enhanced_conversion); ?>
724
  </script>
725
- <script>
726
  gtag('set', 'user_data', {
727
  "email": enhanced_conversion_data.email,
728
  "phone_number":enhanced_conversion_data.phone_number,
@@ -756,7 +800,7 @@ class Enhanced_Ecommerce_Google_Analytics_Public {
756
  if($this->fb_pixel_id != ""){
757
  ?>
758
  <!-- Conversios.io - Meta Pixel Code -->
759
- <script>
760
  !function(f,b,e,v,n,t,s)
761
  {if(f.fbq)return;n=f.fbq=function(){n.callMethod?
762
  n.callMethod.apply(n,arguments):n.queue.push(arguments)};
@@ -822,6 +866,7 @@ src="https://www.facebook.com/tr?id=<?php echo esc_js($this->fb_pixel_id); ?>&ev
822
  * @return void
823
  */
824
  function ecommerce_tracking_code($order_id = null) {
 
825
  global $woocommerce;
826
  $order = "";
827
  if($order_id == null && is_order_received_page()){
@@ -942,7 +987,7 @@ src="https://www.facebook.com/tr?id=<?php echo esc_js($this->fb_pixel_id); ?>&ev
942
  $this->wc_version_compare("tvc_td=" . json_encode($orderpage_trans_Array) . ";");
943
 
944
  ?>
945
- <script>
946
  window.addEventListener('load', call_thnkyou_page,true);
947
  function call_thnkyou_page(){
948
  tvc_js = new TVC_Enhanced(<?php echo json_encode($this->tvc_options); ?>);
@@ -974,12 +1019,14 @@ src="https://www.facebook.com/tr?id=<?php echo esc_js($this->fb_pixel_id); ?>&ev
974
  $variations_data['available_variations'] = $product->get_available_variations(); //get all child variations
975
  $variations_data['available_attributes'] = $product->get_variation_attributes();
976
  }
 
 
977
  ?>
978
- <script>
979
  window.addEventListener('load', call_tvc_enhanced,true);
980
  function call_tvc_enhanced(){
981
  tvc_js = new TVC_Enhanced(<?php echo json_encode($this->tvc_options); ?>);
982
- tvc_js.singleProductaddToCartEventBindings(<?php echo json_encode($variations_data); ?>);
983
  }
984
  </script>
985
  <?php
@@ -1025,7 +1072,7 @@ src="https://www.facebook.com/tr?id=<?php echo esc_js($this->fb_pixel_id); ?>&ev
1025
  //prod page detail view json
1026
  $this->wc_version_compare("tvc_po=" . json_encode($prodpage_detail_json) . ";");
1027
  ?>
1028
- <script>
1029
  window.addEventListener('load', call_view_item_pdp,true);
1030
  function call_view_item_pdp(){
1031
  tvc_js = new TVC_Enhanced(<?php echo json_encode($this->tvc_options); ?>);
@@ -1502,7 +1549,7 @@ src="https://www.facebook.com/tr?id=<?php echo esc_js($this->fb_pixel_id); ?>&ev
1502
  ';
1503
  $keyword = get_search_query();
1504
  ?>
1505
- <script>
1506
  window.addEventListener('load', call_search_page,true);
1507
  function call_search_page(){
1508
  tvc_js = new TVC_Enhanced(<?php echo json_encode($this->tvc_options); ?>);
@@ -1688,7 +1735,7 @@ src="https://www.facebook.com/tr?id=<?php echo esc_js($this->fb_pixel_id); ?>&ev
1688
  $cart_total = WC()->cart->total;
1689
  //$amount2 = floatval($cart_total );
1690
  ?>
1691
- <script>
1692
  window.addEventListener('load', call_checkout_step_1_tracking,true);
1693
  function call_checkout_step_1_tracking(){
1694
  tvc_js = new TVC_Enhanced(<?php echo json_encode($this->tvc_options); ?>);
@@ -1731,8 +1778,10 @@ src="https://www.facebook.com/tr?id=<?php echo esc_js($this->fb_pixel_id); ?>&ev
1731
  if (is_user_logged_in()) {
1732
  $step2_onFocus = 't_tracked_focus=0; if(t_tracked_focus===0){' . $code_step_2 . ' t_tracked_focus++;}';
1733
  } else {
 
 
1734
  //first name on focus call fire
1735
- $step2_onFocus = 't_tracked_focus=0; jQuery("input[name=billing_first_name]").on("focus",function(){ if(t_tracked_focus===0){' . $code_step_2 . ' t_tracked_focus++;}});';
1736
  }
1737
  //check woocommerce version and add code
1738
  $this->wc_version_compare($step2_onFocus);
@@ -1769,7 +1818,9 @@ src="https://www.facebook.com/tr?id=<?php echo esc_js($this->fb_pixel_id); ?>&ev
1769
  $code_step_3 = $code . 'gtag("event", "checkout_progress", {"checkout_step": 3,"event_category":"Enhanced-Ecommerce",
1770
  "event_label":"checkout_step_3","items":items,"non_interaction": true });';
1771
 
1772
- $inline_js = 't_track_clk=0; jQuery(document).on("click","#place_order",function(e){ if(t_track_clk===0){';
 
 
1773
  if ($step_2_on_proceed_to_pay) {
1774
  if (isset($code_step_2))
1775
  $inline_js .= $code_step_2;
68
  protected $remarketing_snippet_id;
69
  protected $remarketing_snippets;
70
  protected $conversio_send_to;
 
 
 
71
  protected $ee_options;
72
  protected $fb_pixel_id;
73
+ protected $c_t_o; //custom_tracking_options
74
 
75
  /**
76
  * Enhanced_Ecommerce_Google_Analytics_Public constructor.
85
  $this->ga_CG = $this->get_option('ga_CG') == "on" ? true : false; // Content Grouping
86
  $this->ga_optimize_id = sanitize_text_field($this->get_option("ga_optimize_id"));
87
  $this->ee_options = $this->TVC_Admin_Helper->get_ee_options_settings();
88
+
89
+ /**
90
+ * tvc_product_list_data_collection_method => product data collection method, like product list of shop page, category page, home page.
91
+ * tvc_product_detail_data_collection_method => product page collection method
92
+ * tvc_checkout_data_collection_method => Checkout page data collection method
93
+ * tvc_thankyou_data_collection_method => Thank you page data collection method
94
+ * tvc_product_detail_addtocart_selector => product single page add to cart CSS selector (_type, _val)
95
+ * tvc_checkout_step_2_selector => Checkout step 2 CSS selector (_type, _val)
96
+ * tvc_checkout_step_3_selector => Checkout step 3 CSS selector (_type, _val)
97
+ *
98
+ * */
99
+
100
+ $this->c_t_o = $this->TVC_Admin_Helper->get_ee_options_settings();
101
+
102
  $this->tvc_call_hooks();
103
 
104
  $this->ga_Dname = "auto";
182
  );
183
  /*
184
  * end tvc_options
185
+ */
186
+ }
187
+
188
+ public function get_selector_val_fron_array($obj, $key){
189
+ if( isset($obj[$key.'_val']) && $obj[$key.'_val'] && isset($obj[$key.'_type']) && $obj[$key.'_type'] == "id" ){
190
+ return ",#".$obj[$key.'_val'];
191
+ }else if( isset($obj[$key.'_val']) && $obj[$key.'_val'] && isset($obj[$key.'_type']) && $obj[$key.'_type'] == "class" ){
192
+ $class_list = explode(",",$obj[$key.'_val']);
193
+ if(!empty($class_list)){
194
+ $class_selector = "";
195
+ foreach($class_list as $class){
196
+ $class_selector .= ",.".trim($class);
197
+ }
198
+ return $class_selector;
199
+ }
200
+
201
+ }
202
  }
203
 
204
  public function tvc_call_hooks(){
207
  add_action("wp_head", array($this, "add_google_site_verification_tag"),1);
208
 
209
  add_action("wp_footer", array($this, "t_products_impre_clicks"));
210
+
211
+ /**Bind Product data **/
212
+ //echo "<pre>";print_r($this->c_t_o);echo "</pre>";
213
+ // product list collection method
214
+ if(isset($this->c_t_o['tvc_product_list_data_collection_method']) && $this->c_t_o['tvc_product_list_data_collection_method']){
215
+ add_action($this->c_t_o['tvc_product_list_data_collection_method'], array($this, "bind_product_metadata"));
216
  }else{
217
+ add_action("woocommerce_after_shop_loop_item", array($this, "bind_product_metadata"));
218
+ }
219
+ //Thnak you page collection method
220
+ $tvc_thankyou_data_collection_method = isset($this->c_t_o['tvc_thankyou_data_collection_method'])?$this->c_t_o['tvc_thankyou_data_collection_method']:"woocommerce_thankyou";
221
+ if($tvc_thankyou_data_collection_method == "on_page"){
222
+ add_action("wp_head", array($this, "ecommerce_tracking_code"));
223
+ }else if($tvc_thankyou_data_collection_method){
224
+ add_action($tvc_thankyou_data_collection_method, array($this, "ecommerce_tracking_code"));
225
+ } else{
226
  add_action("woocommerce_thankyou", array($this, "ecommerce_tracking_code"));
227
+ }
228
+
229
+ //product detail page collection method
230
+ $tvc_product_detail_data_collection_method = isset($this->c_t_o['tvc_product_detail_data_collection_method'])?$this->c_t_o['tvc_product_detail_data_collection_method']:"woocommerce_after_single_product";
231
+ if($tvc_product_detail_data_collection_method == "on_page"){
232
+ add_action("wp_head", array($this, "product_detail_view"));
233
+ add_action("wp_footer", array($this, "single_add_to_cart"));
234
+ }else if($tvc_product_detail_data_collection_method){
235
+ //product var init
236
+ add_action($tvc_product_detail_data_collection_method, array($this, "product_detail_view"));
237
+ //event trigger
238
+ add_action("woocommerce_after_add_to_cart_button", array($this, "single_add_to_cart"));
239
  }else{
240
+ //product var init
241
+ add_action("woocommerce_after_single_product", array($this, "product_detail_view"));
242
+ //event trigger
243
+ add_action("woocommerce_after_add_to_cart_button", array($this, "single_add_to_cart"));
244
  }
245
  add_action("woocommerce_after_cart", array($this, "remove_cart_tracking"));
246
 
247
+ //checkout step 1,2,3
248
+ $tvc_checkout_data_collection_method = isset($this->c_t_o['tvc_checkout_data_collection_method'])?$this->c_t_o['tvc_checkout_data_collection_method']:"woocommerce_before_checkout_form";
249
+ if($tvc_checkout_data_collection_method == "on_page"){
250
+ add_action("wp_head", array($this, "checkout_step_1_tracking"));
251
+ add_action("wp_head", array($this, "checkout_step_2_tracking"));
252
+ add_action("wp_head", array($this, "checkout_step_3_tracking"));
253
+ }else if($tvc_checkout_data_collection_method){
254
+ add_action($tvc_checkout_data_collection_method, array($this, "checkout_step_1_tracking"));
255
+ add_action($tvc_checkout_data_collection_method, array($this, "checkout_step_2_tracking"));
256
+ add_action($tvc_checkout_data_collection_method, array($this, "checkout_step_3_tracking"));
257
  }else{
258
+ add_action("woocommerce_before_checkout_form", array($this, "checkout_step_1_tracking"));
259
+ add_action("woocommerce_before_checkout_form", array($this, "checkout_step_2_tracking"));
260
+ add_action("woocommerce_before_checkout_form", array($this, "checkout_step_3_tracking"));
261
  }
262
 
263
  //Add Dev ID
264
  add_action("wp_head", array($this, "add_dev_id"));
265
  add_action("wp_footer", array($this, "tvc_store_meta_data"));
 
 
 
266
  }
267
  public function getAttributesVariation($product) {
268
  $prod_var_array = array();
499
  <?php if ($this->ga_optimize_id ){?>
500
  <!--Conversios.io – Google optimize start-->
501
  <style>.async-hide { opacity: 0 !important} </style>
502
+ <script data-cfasync="false" data-no-optimize="1" data-pagespeed-no-defer >
503
  (function(a,s,y,n,c,h,i,d,e){s.className+=' '+y;h.start=1*new Date;
504
  h.end=i=function(){s.className=s.className.replace(RegExp(' ?'+y),'')};
505
  (a[n]=a[n]||[]).hide=h;setTimeout(function(){i();h.end=null},c);h.timeout=c;
509
  <script src="https://www.googleoptimize.com/optimize.js?id=<?php echo esc_js($this->ga_optimize_id); ?>"></script>
510
  <!--Conversios.io – Google optimize end-->
511
  <?php } ?>
512
+ <script data-cfasync="false" data-no-optimize="1" data-pagespeed-no-defer >
513
  var adsTringId = '<?php echo esc_js($this->ads_tracking_id); ?>';
514
  var ads_ert = '<?php echo esc_js($this->ads_ert); ?>';
515
  var ads_edrt = '<?php echo esc_js($this->ads_edrt)?>';
538
  if( $this->tracking_option == "BOTH" && $this->gm_id && $this->ga_id){ ?>
539
  <!--Conversios.io – Google Analytics and Google Shopping plugin for WooCommerce-->
540
  <script async src="https://www.googletagmanager.com/gtag/js?id=<?php echo esc_js($this->gm_id); ?>"></script>
541
+ <script data-cfasync="false" data-no-optimize="1" data-pagespeed-no-defer >
542
  window.dataLayer = window.dataLayer || [];
543
  function gtag(){dataLayer.push(arguments);}
544
  gtag("js", new Date());
571
  }else if($this->tracking_option == "GA4" && $this->gm_id){ ?>
572
  <!--Conversios.io – Google Analytics and Google Shopping plugin for WooCommerce-->
573
  <script async src="https://www.googletagmanager.com/gtag/js?id=<?php echo esc_js($this->gm_id); ?>"></script>
574
+ <script data-cfasync="false" data-no-optimize="1" data-pagespeed-no-defer >
575
  window.dataLayer = window.dataLayer || [];
576
  function gtag(){dataLayer.push(arguments);}
577
  gtag("js", new Date());
603
  }else if($this->ga_id){ ?>
604
  <!--Conversios.io – Google Analytics and Google Shopping plugin for WooCommerce-->
605
  <script async src="https://www.googletagmanager.com/gtag/js?id=<?php echo esc_js($this->ga_id); ?>"></script>
606
+ <script data-cfasync="false" data-no-optimize="1" data-pagespeed-no-defer >
607
  window.dataLayer = window.dataLayer || [];
608
  function gtag(){dataLayer.push(arguments);}
609
  gtag("js", new Date());
639
  ?>
640
  <script async src="https://www.googletagmanager.com/gtag/js?id=<?php echo esc_js($this->remarketing_snippet_id); ?>">
641
  </script>
642
+ <script data-cfasync="false" data-no-optimize="1" data-pagespeed-no-defer >
643
  window.dataLayer = window.dataLayer || [];
644
  function gtag(){dataLayer.push(arguments);}
645
  gtag('js', new Date());
693
  $enhanced_conversion["address"]["country"] = esc_js($billing_country);
694
  }
695
  if(!empty($enhanced_conversion)){
696
+ ?>
697
+ <script data-cfasync="false" data-no-optimize="1" data-pagespeed-no-defer >
698
+ var enhanced_conversion_data = <?php echo json_encode($enhanced_conversion); ?>;
 
 
699
  gtag('set', 'user_data', {
700
  "email": enhanced_conversion_data.email,
701
  "phone_number":enhanced_conversion_data.phone_number,
766
  <script>
767
  var enhanced_conversion_data = <?php echo json_encode($enhanced_conversion); ?>
768
  </script>
769
+ <script data-cfasync="false" data-no-optimize="1" data-pagespeed-no-defer >
770
  gtag('set', 'user_data', {
771
  "email": enhanced_conversion_data.email,
772
  "phone_number":enhanced_conversion_data.phone_number,
800
  if($this->fb_pixel_id != ""){
801
  ?>
802
  <!-- Conversios.io - Meta Pixel Code -->
803
+ <script data-cfasync="false" data-no-optimize="1" data-pagespeed-no-defer >
804
  !function(f,b,e,v,n,t,s)
805
  {if(f.fbq)return;n=f.fbq=function(){n.callMethod?
806
  n.callMethod.apply(n,arguments):n.queue.push(arguments)};
866
  * @return void
867
  */
868
  function ecommerce_tracking_code($order_id = null) {
869
+ ///exit;
870
  global $woocommerce;
871
  $order = "";
872
  if($order_id == null && is_order_received_page()){
987
  $this->wc_version_compare("tvc_td=" . json_encode($orderpage_trans_Array) . ";");
988
 
989
  ?>
990
+ <script data-cfasync="false" data-no-optimize="1" data-pagespeed-no-defer >
991
  window.addEventListener('load', call_thnkyou_page,true);
992
  function call_thnkyou_page(){
993
  tvc_js = new TVC_Enhanced(<?php echo json_encode($this->tvc_options); ?>);
1019
  $variations_data['available_variations'] = $product->get_available_variations(); //get all child variations
1020
  $variations_data['available_attributes'] = $product->get_variation_attributes();
1021
  }
1022
+
1023
+ $product_detail_addtocart_selector = ( isset( $this->c_t_o['tvc_product_detail_addtocart_selector']) && $this->c_t_o['tvc_product_detail_addtocart_selector'] == "custom" )?$this->c_t_o:array();
1024
  ?>
1025
+ <script data-cfasync="false" data-no-optimize="1" data-pagespeed-no-defer>
1026
  window.addEventListener('load', call_tvc_enhanced,true);
1027
  function call_tvc_enhanced(){
1028
  tvc_js = new TVC_Enhanced(<?php echo json_encode($this->tvc_options); ?>);
1029
+ tvc_js.singleProductaddToCartEventBindings(<?php echo json_encode($variations_data); ?>,"<?php echo esc_js($this->get_selector_val_fron_array($product_detail_addtocart_selector, 'tvc_product_detail_addtocart_selector')); ?>");
1030
  }
1031
  </script>
1032
  <?php
1072
  //prod page detail view json
1073
  $this->wc_version_compare("tvc_po=" . json_encode($prodpage_detail_json) . ";");
1074
  ?>
1075
+ <script data-cfasync="false" data-no-optimize="1" data-pagespeed-no-defer >
1076
  window.addEventListener('load', call_view_item_pdp,true);
1077
  function call_view_item_pdp(){
1078
  tvc_js = new TVC_Enhanced(<?php echo json_encode($this->tvc_options); ?>);
1549
  ';
1550
  $keyword = get_search_query();
1551
  ?>
1552
+ <script data-cfasync="false" data-no-optimize="1" data-pagespeed-no-defer >
1553
  window.addEventListener('load', call_search_page,true);
1554
  function call_search_page(){
1555
  tvc_js = new TVC_Enhanced(<?php echo json_encode($this->tvc_options); ?>);
1735
  $cart_total = WC()->cart->total;
1736
  //$amount2 = floatval($cart_total );
1737
  ?>
1738
+ <script data-cfasync="false" data-no-optimize="1" data-pagespeed-no-defer >
1739
  window.addEventListener('load', call_checkout_step_1_tracking,true);
1740
  function call_checkout_step_1_tracking(){
1741
  tvc_js = new TVC_Enhanced(<?php echo json_encode($this->tvc_options); ?>);
1778
  if (is_user_logged_in()) {
1779
  $step2_onFocus = 't_tracked_focus=0; if(t_tracked_focus===0){' . $code_step_2 . ' t_tracked_focus++;}';
1780
  } else {
1781
+ $checkout_step_2_selector = ( isset( $this->c_t_o['tvc_checkout_step_2_selector']) && $this->c_t_o['tvc_checkout_step_2_selector'] == "custom" )?$this->c_t_o:array();
1782
+
1783
  //first name on focus call fire
1784
+ $step2_onFocus = 't_tracked_focus=0; jQuery("input[name=billing_first_name] '. esc_js($this->get_selector_val_fron_array($checkout_step_2_selector, 'tvc_checkout_step_2_selector')).' ").on("focus",function(){ if(t_tracked_focus===0){' . $code_step_2 . ' t_tracked_focus++;}});';
1785
  }
1786
  //check woocommerce version and add code
1787
  $this->wc_version_compare($step2_onFocus);
1818
  $code_step_3 = $code . 'gtag("event", "checkout_progress", {"checkout_step": 3,"event_category":"Enhanced-Ecommerce",
1819
  "event_label":"checkout_step_3","items":items,"non_interaction": true });';
1820
 
1821
+ $checkout_step_3_selector = ( isset( $this->c_t_o['tvc_checkout_step_3_selector']) && $this->c_t_o['tvc_checkout_step_3_selector'] == "custom" )?$this->c_t_o:array();
1822
+
1823
+ $inline_js = 't_track_clk=0; jQuery(document).on("click","#place_order '. esc_js($this->get_selector_val_fron_array($checkout_step_3_selector, 'tvc_checkout_step_3_selector')).'",function(e){ if(t_track_clk===0){';
1824
  if ($step_2_on_proceed_to_pay) {
1825
  if (isset($code_step_2))
1826
  $inline_js .= $code_step_2;
public/class-enhanced-ecommerce-google-analytics-public.php CHANGED
@@ -96,13 +96,9 @@ class Enhanced_Ecommerce_Google_Analytics_Public {
96
  protected $TVC_Admin_Helper;
97
  protected $remarketing_snippet_id;
98
  protected $remarketing_snippets;
99
- protected $tvc_conversion_tracking_type;
100
- protected $tvc_product_detail_tracking_type;
101
- protected $tvc_checkout_tracking_type;
102
-
103
  protected $ee_options;
104
-
105
  protected $fb_pixel_id;
 
106
  /**
107
  * Enhanced_Ecommerce_Google_Analytics_Public constructor.
108
  * @param $plugin_name
@@ -115,9 +111,18 @@ class Enhanced_Ecommerce_Google_Analytics_Public {
115
  $this->version = sanitize_text_field($version);
116
 
117
  $this->ee_options = $this->TVC_Admin_Helper->get_ee_options_settings();
118
- $this->tvc_conversion_tracking_type = sanitize_text_field($this->get_option("tvc_conversion_tracking_type"));
119
- $this->tvc_product_detail_tracking_type = sanitize_text_field($this->get_option("tvc_product_detail_conversion_tracking_type"));
120
- $this->tvc_checkout_tracking_type = sanitize_text_field($this->get_option("tvc_checkout_conversion_tracking_type"));
 
 
 
 
 
 
 
 
 
121
  $this->tvc_call_hooks();
122
  $this->ga_id = sanitize_text_field($this->get_option("ga_id"));
123
  $this->ga_eeT = sanitize_text_field($this->get_option("ga_eeT"));
@@ -152,38 +157,79 @@ class Enhanced_Ecommerce_Google_Analytics_Public {
152
  $this->fb_pixel_id = sanitize_text_field($this->get_option('fb_pixel_id'));
153
 
154
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
155
  public function tvc_call_hooks(){
156
  add_action("wp_head", array($this, "enqueue_scripts"));
157
  add_action("wp_head", array($this, "ee_settings"));
158
  add_action("wp_head", array($this, "add_google_site_verification_tag"),1);
159
 
160
  add_action("wp_footer", array($this, "t_products_impre_clicks"));
161
- add_action("woocommerce_after_shop_loop_item", array($this, "bind_product_metadata"));
162
- if($this->tvc_conversion_tracking_type == "on-thankyou-page"){
163
- add_action("wp_head", array($this, "ecommerce_tracking_code"));
 
164
  }else{
 
 
 
 
 
 
 
 
 
 
165
  add_action("woocommerce_thankyou", array($this, "ecommerce_tracking_code"));
166
  }
167
- if($this->tvc_product_detail_tracking_type == "on-product-detail-page"){
 
 
 
168
  add_action("wp_head", array($this, "product_detail_view"));
169
  add_action("wp_footer", array($this, "single_add_to_cart"));
 
 
 
 
 
170
  }else{
 
171
  add_action("woocommerce_after_single_product", array($this, "product_detail_view"));
 
172
  add_action("woocommerce_after_add_to_cart_button", array($this, "single_add_to_cart"));
173
  }
 
174
  add_action("woocommerce_after_cart",array($this, "remove_cart_tracking"));
175
- //check out step 1,2,3
176
- if($this->tvc_checkout_tracking_type == "on-checkout-page"){
 
177
  add_action("wp_head", array($this, "checkout_step_1_tracking"));
178
  add_action("wp_head", array($this, "checkout_step_2_tracking"));
179
  add_action("wp_head", array($this, "checkout_step_3_tracking"));
 
 
 
 
180
  }else{
181
  add_action("woocommerce_before_checkout_form", array($this, "checkout_step_1_tracking"));
182
  add_action("woocommerce_before_checkout_form", array($this, "checkout_step_2_tracking"));
183
  add_action("woocommerce_before_checkout_form", array($this, "checkout_step_3_tracking"));
184
  }
185
 
186
- add_action("wp_footer", array($this, "single_add_to_cart"));
187
  //Add Dev ID
188
  add_action("wp_head", array($this, "add_dev_id"));
189
  add_action("wp_footer",array($this, "tvc_store_meta_data"));
@@ -333,7 +379,7 @@ class Enhanced_Ecommerce_Google_Analytics_Public {
333
  } else {
334
  $ga_ip_anonymization ="";
335
  } ?>
336
- <script type="text/javascript">
337
  var track_option = '<?php echo esc_js($tracking_opt); ?>';
338
  var ua_track_id = '<?php echo esc_js($tracking_id); ?>';
339
  var ga4_measure_id = '<?php echo esc_js($measurment_id); ?>';
@@ -367,7 +413,7 @@ class Enhanced_Ecommerce_Google_Analytics_Public {
367
  if(($tracking_opt == "UA" || $tracking_id || $tracking_opt == "") && $tracking_opt != "BOTH"){?>
368
  <!--Conversios.io – Google Analytics and Google Shopping plugin for WooCommerce-->
369
  <script async src="https://www.googletagmanager.com/gtag/js?id=<?php echo esc_js($tracking_id); ?>"></script>
370
- <script>
371
  window.dataLayer = window.dataLayer || [];
372
  function gtag(){dataLayer.push(arguments);}
373
  gtag("js", new Date());
@@ -379,7 +425,7 @@ class Enhanced_Ecommerce_Google_Analytics_Public {
379
  if($tracking_opt == "GA4"){ ?>
380
  <!--Conversios.io – Google Analytics and Google Shopping plugin for WooCommerce-->
381
  <script async src="https://www.googletagmanager.com/gtag/js?id=<?php echo esc_js($measurment_id); ?>"></script>
382
- <script>
383
  window.dataLayer = window.dataLayer || [];
384
  function gtag(){dataLayer.push(arguments);}
385
  gtag("js", new Date());
@@ -390,7 +436,7 @@ class Enhanced_Ecommerce_Google_Analytics_Public {
390
  if($tracking_opt == "BOTH"){ ?>
391
  <!--Conversios.io – Google Analytics and Google Shopping plugin for WooCommerce-->
392
  <script async src="https://www.googletagmanager.com/gtag/js?id=<?php echo esc_js($measurment_id); ?>"></script>
393
- <script>
394
  window.dataLayer = window.dataLayer || [];
395
  function gtag(){dataLayer.push(arguments);}
396
  gtag("js", new Date());
@@ -415,7 +461,7 @@ class Enhanced_Ecommerce_Google_Analytics_Public {
415
  if($this->fb_pixel_id != ""){
416
  ?>
417
  <!-- Conversios.io - Meta Pixel Code -->
418
- <script>
419
  !function(f,b,e,v,n,t,s)
420
  {if(f.fbq)return;n=f.fbq=function(){n.callMethod?
421
  n.callMethod.apply(n,arguments):n.queue.push(arguments)};
@@ -698,7 +744,7 @@ src="https://www.facebook.com/tr?id=<?php echo esc_js($this->fb_pixel_id); ?>&ev
698
  /* facebook pixel */
699
  if($this->fb_pixel_id != ""){
700
  ?>
701
- <script>
702
  var products = <?php echo json_encode($orderpage_prod_Array); ?>;
703
  var cart_total = <?php echo json_encode($order->get_total()); ?>;
704
 
@@ -748,12 +794,14 @@ src="https://www.facebook.com/tr?id=<?php echo esc_js($this->fb_pixel_id); ?>&ev
748
  }
749
  //remove last comma(,) if multiple categories are there
750
  $categories = rtrim($categories, ",");
 
 
751
  if($this->ga_id || ($this->tracking_option == "UA" || $this->tracking_option == "BOTH")) {
752
  $code = '
753
  var items = [];
754
  //set local currencies
755
  gtag("set", {"currency": tvc_lc});
756
- jQuery("button[class*=\'btn-buy-shop\'],button[class*=\'single_add_to_cart_button\'], button[class*=\'add_to_cart\']").click(function() {
757
  // Enhanced E-commerce Add to cart clicks
758
  gtag("event", "add_to_cart", {
759
  "event_category":"Enhanced-Ecommerce",
@@ -824,7 +872,7 @@ src="https://www.facebook.com/tr?id=<?php echo esc_js($this->fb_pixel_id); ?>&ev
824
  /* facebook pixel */
825
  if($this->fb_pixel_id != ""){
826
  ?>
827
- <script>
828
  jQuery("button[class*='btn-buy-shop'],button[class*='single_add_to_cart_button'], button[class*='add_to_cart']").click(function() {
829
  var quantity = jQuery(this).parent().find("input[name=quantity]").val();
830
  fbq("track", "AddToCart", {
@@ -1659,7 +1707,7 @@ src="https://www.facebook.com/tr?id=<?php echo esc_js($this->fb_pixel_id); ?>&ev
1659
  /* facebook pixel */
1660
  if($this->fb_pixel_id != ""){
1661
  ?>
1662
- <script>
1663
  var products = <?php echo json_encode($chkout_json); ?>;
1664
  var cart_total = <?php echo json_encode($cart_total); ?>;
1665
 
@@ -1716,8 +1764,9 @@ src="https://www.facebook.com/tr?id=<?php echo esc_js($this->fb_pixel_id); ?>&ev
1716
  if (is_user_logged_in()) {
1717
  $step2_onFocus = 't_tracked_focus=0; if(t_tracked_focus===0){' . $code_step_2 . ' t_tracked_focus++;}';
1718
  } else {
 
1719
  //first name on focus call fire
1720
- $step2_onFocus = 't_tracked_focus=0; jQuery("input[name=billing_first_name]").on("focus",function(){ if(t_tracked_focus===0){' . $code_step_2 . ' t_tracked_focus++;}});';
1721
  }
1722
  //check woocommerce version and add code
1723
  $this->wc_version_compare($step2_onFocus);
@@ -1753,8 +1802,8 @@ src="https://www.facebook.com/tr?id=<?php echo esc_js($this->fb_pixel_id); ?>&ev
1753
 
1754
  $code_step_3 = $code . 'gtag("event", "checkout_progress", {"checkout_step": 3,"event_category":"Enhanced-Ecommerce",
1755
  "event_label":"checkout_step_3","items":items,"non_interaction": true });';
1756
-
1757
- $inline_js = 't_track_clk=0; jQuery(document).on("click","#place_order",function(e){ if(t_track_clk===0){';
1758
  if ($step_2_on_proceed_to_pay) {
1759
  if (isset($code_step_2))
1760
  $inline_js .= $code_step_2;
96
  protected $TVC_Admin_Helper;
97
  protected $remarketing_snippet_id;
98
  protected $remarketing_snippets;
 
 
 
 
99
  protected $ee_options;
 
100
  protected $fb_pixel_id;
101
+ protected $c_t_o; //custom_tracking_options
102
  /**
103
  * Enhanced_Ecommerce_Google_Analytics_Public constructor.
104
  * @param $plugin_name
111
  $this->version = sanitize_text_field($version);
112
 
113
  $this->ee_options = $this->TVC_Admin_Helper->get_ee_options_settings();
114
+ /**
115
+ * tvc_product_list_data_collection_method => product data collection method, like product list of shop page, category page, home page.
116
+ * tvc_product_detail_data_collection_method => product page collection method
117
+ * tvc_checkout_data_collection_method => Checkout page data collection method
118
+ * tvc_thankyou_data_collection_method => Thank you page data collection method
119
+ * tvc_product_detail_addtocart_selector => product single page add to cart CSS selector (_type, _val)
120
+ * tvc_checkout_step_2_selector => Checkout step 2 CSS selector (_type, _val)
121
+ * tvc_checkout_step_3_selector => Checkout step 3 CSS selector (_type, _val)
122
+ *
123
+ * */
124
+ $this->c_t_o = $this->TVC_Admin_Helper->get_ee_options_settings();
125
+
126
  $this->tvc_call_hooks();
127
  $this->ga_id = sanitize_text_field($this->get_option("ga_id"));
128
  $this->ga_eeT = sanitize_text_field($this->get_option("ga_eeT"));
157
  $this->fb_pixel_id = sanitize_text_field($this->get_option('fb_pixel_id'));
158
 
159
  }
160
+ public function get_selector_val_fron_array($obj, $key){
161
+ if( isset($obj[$key.'_val']) && $obj[$key.'_val'] && isset($obj[$key.'_type']) && $obj[$key.'_type'] == "id" ){
162
+ return ",#".$obj[$key.'_val'];
163
+ }else if( isset($obj[$key.'_val']) && $obj[$key.'_val'] && isset($obj[$key.'_type']) && $obj[$key.'_type'] == "class" ){
164
+ $class_list = explode(",",$obj[$key.'_val']);
165
+ if(!empty($class_list)){
166
+ $class_selector = "";
167
+ foreach($class_list as $class){
168
+ $class_selector .= ",.".trim($class);
169
+ }
170
+ return $class_selector;
171
+ }
172
+
173
+ }
174
+ }
175
  public function tvc_call_hooks(){
176
  add_action("wp_head", array($this, "enqueue_scripts"));
177
  add_action("wp_head", array($this, "ee_settings"));
178
  add_action("wp_head", array($this, "add_google_site_verification_tag"),1);
179
 
180
  add_action("wp_footer", array($this, "t_products_impre_clicks"));
181
+ /**Bind Product data **/
182
+ // product list collection method
183
+ if(isset($this->c_t_o['tvc_product_list_data_collection_method']) && $this->c_t_o['tvc_product_list_data_collection_method']){
184
+ add_action($this->c_t_o['tvc_product_list_data_collection_method'], array($this, "bind_product_metadata"));
185
  }else{
186
+ add_action("woocommerce_after_shop_loop_item", array($this, "bind_product_metadata"));
187
+ }
188
+
189
+ //Thnak you page collection method
190
+ $tvc_thankyou_data_collection_method = isset($this->c_t_o['tvc_thankyou_data_collection_method'])?$this->c_t_o['tvc_thankyou_data_collection_method']:"woocommerce_thankyou";
191
+ if($tvc_thankyou_data_collection_method == "on_page"){
192
+ add_action("wp_head", array($this, "ecommerce_tracking_code"));
193
+ }else if($tvc_thankyou_data_collection_method){
194
+ add_action($tvc_thankyou_data_collection_method, array($this, "ecommerce_tracking_code"));
195
+ } else{
196
  add_action("woocommerce_thankyou", array($this, "ecommerce_tracking_code"));
197
  }
198
+
199
+ //product detail page collection method
200
+ $tvc_product_detail_data_collection_method = isset($this->c_t_o['tvc_product_detail_data_collection_method'])?$this->c_t_o['tvc_product_detail_data_collection_method']:"woocommerce_after_single_product";
201
+ if($tvc_product_detail_data_collection_method == "on_page"){
202
  add_action("wp_head", array($this, "product_detail_view"));
203
  add_action("wp_footer", array($this, "single_add_to_cart"));
204
+ }else if($tvc_product_detail_data_collection_method){
205
+ //product var init
206
+ add_action($tvc_product_detail_data_collection_method, array($this, "product_detail_view"));
207
+ //event trigger
208
+ add_action("woocommerce_after_add_to_cart_button", array($this, "single_add_to_cart"));
209
  }else{
210
+ //product var init
211
  add_action("woocommerce_after_single_product", array($this, "product_detail_view"));
212
+ //event trigger
213
  add_action("woocommerce_after_add_to_cart_button", array($this, "single_add_to_cart"));
214
  }
215
+
216
  add_action("woocommerce_after_cart",array($this, "remove_cart_tracking"));
217
+ //checkout step 1,2,3
218
+ $tvc_checkout_data_collection_method = isset($this->c_t_o['tvc_checkout_data_collection_method'])?$this->c_t_o['tvc_checkout_data_collection_method']:"woocommerce_before_checkout_form";
219
+ if($tvc_checkout_data_collection_method == "on_page"){
220
  add_action("wp_head", array($this, "checkout_step_1_tracking"));
221
  add_action("wp_head", array($this, "checkout_step_2_tracking"));
222
  add_action("wp_head", array($this, "checkout_step_3_tracking"));
223
+ }else if($tvc_checkout_data_collection_method){
224
+ add_action($tvc_checkout_data_collection_method, array($this, "checkout_step_1_tracking"));
225
+ add_action($tvc_checkout_data_collection_method, array($this, "checkout_step_2_tracking"));
226
+ add_action($tvc_checkout_data_collection_method, array($this, "checkout_step_3_tracking"));
227
  }else{
228
  add_action("woocommerce_before_checkout_form", array($this, "checkout_step_1_tracking"));
229
  add_action("woocommerce_before_checkout_form", array($this, "checkout_step_2_tracking"));
230
  add_action("woocommerce_before_checkout_form", array($this, "checkout_step_3_tracking"));
231
  }
232
 
 
233
  //Add Dev ID
234
  add_action("wp_head", array($this, "add_dev_id"));
235
  add_action("wp_footer",array($this, "tvc_store_meta_data"));
379
  } else {
380
  $ga_ip_anonymization ="";
381
  } ?>
382
+ <script data-cfasync="false" data-no-optimize="1" data-pagespeed-no-defer>
383
  var track_option = '<?php echo esc_js($tracking_opt); ?>';
384
  var ua_track_id = '<?php echo esc_js($tracking_id); ?>';
385
  var ga4_measure_id = '<?php echo esc_js($measurment_id); ?>';
413
  if(($tracking_opt == "UA" || $tracking_id || $tracking_opt == "") && $tracking_opt != "BOTH"){?>
414
  <!--Conversios.io – Google Analytics and Google Shopping plugin for WooCommerce-->
415
  <script async src="https://www.googletagmanager.com/gtag/js?id=<?php echo esc_js($tracking_id); ?>"></script>
416
+ <script data-cfasync="false" data-no-optimize="1" data-pagespeed-no-defer>
417
  window.dataLayer = window.dataLayer || [];
418
  function gtag(){dataLayer.push(arguments);}
419
  gtag("js", new Date());
425
  if($tracking_opt == "GA4"){ ?>
426
  <!--Conversios.io – Google Analytics and Google Shopping plugin for WooCommerce-->
427
  <script async src="https://www.googletagmanager.com/gtag/js?id=<?php echo esc_js($measurment_id); ?>"></script>
428
+ <script data-cfasync="false" data-no-optimize="1" data-pagespeed-no-defer>
429
  window.dataLayer = window.dataLayer || [];
430
  function gtag(){dataLayer.push(arguments);}
431
  gtag("js", new Date());
436
  if($tracking_opt == "BOTH"){ ?>
437
  <!--Conversios.io – Google Analytics and Google Shopping plugin for WooCommerce-->
438
  <script async src="https://www.googletagmanager.com/gtag/js?id=<?php echo esc_js($measurment_id); ?>"></script>
439
+ <script data-cfasync="false" data-no-optimize="1" data-pagespeed-no-defer>
440
  window.dataLayer = window.dataLayer || [];
441
  function gtag(){dataLayer.push(arguments);}
442
  gtag("js", new Date());
461
  if($this->fb_pixel_id != ""){
462
  ?>
463
  <!-- Conversios.io - Meta Pixel Code -->
464
+ <script data-cfasync="false" data-no-optimize="1" data-pagespeed-no-defer>
465
  !function(f,b,e,v,n,t,s)
466
  {if(f.fbq)return;n=f.fbq=function(){n.callMethod?
467
  n.callMethod.apply(n,arguments):n.queue.push(arguments)};
744
  /* facebook pixel */
745
  if($this->fb_pixel_id != ""){
746
  ?>
747
+ <script data-cfasync="false" data-no-optimize="1" data-pagespeed-no-defer>
748
  var products = <?php echo json_encode($orderpage_prod_Array); ?>;
749
  var cart_total = <?php echo json_encode($order->get_total()); ?>;
750
 
794
  }
795
  //remove last comma(,) if multiple categories are there
796
  $categories = rtrim($categories, ",");
797
+ $product_detail_addtocart_selector = ( isset( $this->c_t_o['tvc_product_detail_addtocart_selector']) && $this->c_t_o['tvc_product_detail_addtocart_selector'] == "custom" )?$this->c_t_o:array();
798
+ $product_detail_addtocart_selector_css = esc_js($this->get_selector_val_fron_array($product_detail_addtocart_selector, 'tvc_product_detail_addtocart_selector'));
799
  if($this->ga_id || ($this->tracking_option == "UA" || $this->tracking_option == "BOTH")) {
800
  $code = '
801
  var items = [];
802
  //set local currencies
803
  gtag("set", {"currency": tvc_lc});
804
+ jQuery("button[class*=\'btn-buy-shop\'],button[class*=\'single_add_to_cart_button\'], button[class*=\'add_to_cart\']'.$product_detail_addtocart_selector_css.'").click(function() {
805
  // Enhanced E-commerce Add to cart clicks
806
  gtag("event", "add_to_cart", {
807
  "event_category":"Enhanced-Ecommerce",
872
  /* facebook pixel */
873
  if($this->fb_pixel_id != ""){
874
  ?>
875
+ <script data-cfasync="false" data-no-optimize="1" data-pagespeed-no-defer>
876
  jQuery("button[class*='btn-buy-shop'],button[class*='single_add_to_cart_button'], button[class*='add_to_cart']").click(function() {
877
  var quantity = jQuery(this).parent().find("input[name=quantity]").val();
878
  fbq("track", "AddToCart", {
1707
  /* facebook pixel */
1708
  if($this->fb_pixel_id != ""){
1709
  ?>
1710
+ <script data-cfasync="false" data-no-optimize="1" data-pagespeed-no-defer>
1711
  var products = <?php echo json_encode($chkout_json); ?>;
1712
  var cart_total = <?php echo json_encode($cart_total); ?>;
1713
 
1764
  if (is_user_logged_in()) {
1765
  $step2_onFocus = 't_tracked_focus=0; if(t_tracked_focus===0){' . $code_step_2 . ' t_tracked_focus++;}';
1766
  } else {
1767
+ $checkout_step_2_selector = ( isset( $this->c_t_o['tvc_checkout_step_2_selector']) && $this->c_t_o['tvc_checkout_step_2_selector'] == "custom" )?$this->c_t_o:array();
1768
  //first name on focus call fire
1769
+ $step2_onFocus = 't_tracked_focus=0; jQuery("input[name=billing_first_name] '. esc_js($this->get_selector_val_fron_array($checkout_step_2_selector, 'tvc_checkout_step_2_selector')).'").on("focus",function(){ if(t_tracked_focus===0){' . $code_step_2 . ' t_tracked_focus++;}});';
1770
  }
1771
  //check woocommerce version and add code
1772
  $this->wc_version_compare($step2_onFocus);
1802
 
1803
  $code_step_3 = $code . 'gtag("event", "checkout_progress", {"checkout_step": 3,"event_category":"Enhanced-Ecommerce",
1804
  "event_label":"checkout_step_3","items":items,"non_interaction": true });';
1805
+ $checkout_step_3_selector = ( isset( $this->c_t_o['tvc_checkout_step_3_selector']) && $this->c_t_o['tvc_checkout_step_3_selector'] == "custom" )?$this->c_t_o:array();
1806
+ $inline_js = 't_track_clk=0; jQuery(document).on("click","#place_order '. esc_js($this->get_selector_val_fron_array($checkout_step_3_selector, 'tvc_checkout_step_3_selector')).'",function(e){ if(t_track_clk===0){';
1807
  if ($step_2_on_proceed_to_pay) {
1808
  if (isset($code_step_2))
1809
  $inline_js .= $code_step_2;
public/js/tvc-ee-google-analytics.js CHANGED
@@ -18,9 +18,15 @@ class TVC_Enhanced {
18
  //console.log(this.options);
19
  //this.addEventBindings();
20
  }
21
- singleProductaddToCartEventBindings(variations_data){
 
22
  //var single_btn = document.getElementsByClassName("single_add_to_cart_button");
23
- var single_btn = document.querySelectorAll("button[class*='btn-buy-shop'],button[class*='single_add_to_cart_button'], button[class*='add_to_cart']");
 
 
 
 
 
24
  if(single_btn.length > 0){
25
  single_btn[0].addEventListener("click", () => this.add_to_cart_click(variations_data, "Product Pages"));
26
  }
18
  //console.log(this.options);
19
  //this.addEventBindings();
20
  }
21
+ singleProductaddToCartEventBindings(variations_data, product_detail_addtocart_selector){
22
+
23
  //var single_btn = document.getElementsByClassName("single_add_to_cart_button");
24
+ var single_btn = "";
25
+ if(product_detail_addtocart_selector != ""){
26
+ single_btn = document.querySelectorAll("button[class*='btn-buy-shop'],button[class*='single_add_to_cart_button'], button[class*='add_to_cart']"+product_detail_addtocart_selector);
27
+ }else{
28
+ single_btn = document.querySelectorAll("button[class*='btn-buy-shop'],button[class*='single_add_to_cart_button'], button[class*='add_to_cart']");
29
+ }
30
  if(single_btn.length > 0){
31
  single_btn[0].addEventListener("click", () => this.add_to_cart_click(variations_data, "Product Pages"));
32
  }
readme.txt CHANGED
@@ -8,12 +8,12 @@ Author: Tatvic
8
  Requires at least: 3.5.0
9
  Tested up to: 6.0.1
10
  Requires PHP: 5.6 or Higher
11
- Stable tag: 4.8.9
12
- Version: 4.8.9
13
  License: GPLv3
14
  License URI: http://www.gnu.org/licenses/gpl-3.0.html
15
 
16
- A WooCommerce plugin that integrates Google Analytics - eCommerce tracking and automates end-to-end Google Shopping with quality product feed and dynamic remarketing tags under 5 minutes.
17
 
18
  == Product Description ==
19
 
@@ -23,16 +23,16 @@ https://www.youtube.com/watch?v=OWTXa6_nQgI&rel=0
23
 
24
  The new and enhanced Ecommerce Google Analytics Plugin for WooCommerce is there to help you - Know, Measure and Track What Matters To Your Business.
25
 
26
- As a Premium Google Ads Partner, we are delighted to bring a new and enhanced Google Analytics Integration Plugin that does all your eCommerce tracking in Google Analytics. We have 40000+ active eCommerce businesses across 150 countries using, benefitting, growing from this plugin. The plugin is ready and compatible with Google Analytics 4 (GA4)
27
 
28
  Opening an e-commerce store is only the starting, to run it efficiently, to drive traffic to your website, and increase conversions, you have to do one more thing and that is to know your shoppers and what is thier shopping behavoir!
29
 
30
  And how will you do that? Well, Start with Understanding, Measuring, tracking their journey and thier shopping preferences with the help of Google Analytics Tracking for WooCommerce.
31
 
32
- * Know your users likes & preferences
33
- * Track them and understand thier shopping behavior and products
34
- * Offer them better experiences
35
- * Simplify their shopping process
36
  * Remove all the obstacles that slow down user conversion
37
 
38
  The enhanced eCommerce Google Analytics plugin for WooCommerce will show you all the statistics