Enhanced Ecommerce Google Analytics Plugin for WooCommerce - Version 4.7.2

Version Description

  • 21/04/2022 =
  • Tweak: Now, Customer can choose the tracking trigger for addTocart (product detail), checkout steps and thenkyou page.
  • New: (PRO) Now compatible with WooCommerce custom attribute mapping for the brands (product) in the product sync.
Download this release

Release Info

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

Code changes from version 4.7.1 to 4.7.2

admin/class-tvc-admin-auto-product-sync-helper.php CHANGED
@@ -160,6 +160,8 @@ if ( ! class_exists( 'TVC_Admin_Auto_Product_sync_Helper' ) ) {
160
 
161
  public function tvc_get_map_product_attribute($products, $tvc_currency, $merchantId){
162
  if(!empty($products)){
 
 
163
  $plan_id = $this->TVC_Admin_Helper->get_plan_id();
164
  $items = [];
165
  $skipProducts = [];
@@ -281,9 +283,21 @@ if ( ! class_exists( 'TVC_Admin_Auto_Product_sync_Helper' ) ) {
281
  }
282
  }else if(in_array($key, array("brand")) && $plan_id != 1){
283
  //list of cutom option added
284
- $yith_product_brand = $this->TVC_Admin_Helper->add_additional_option_val_in_map_product_attribute($key, $postvalue->w_product_id);
285
- if($yith_product_brand != ""){
286
- $product[$key] = sanitize_text_field($yith_product_brand);
 
 
 
 
 
 
 
 
 
 
 
 
287
  }
288
  }else if(isset($postmeta_var->$value) && $postmeta_var->$value != ""){
289
  $product[$key] = sanitize_text_field($postmeta_var->$value);
@@ -345,10 +359,22 @@ if ( ! class_exists( 'TVC_Admin_Auto_Product_sync_Helper' ) ) {
345
  }
346
  }else if(in_array($key, array("brand")) && $plan_id != 1){
347
  //list of cutom option added
348
- $yith_product_brand = $this->TVC_Admin_Helper->add_additional_option_val_in_map_product_attribute($key, $postvalue->w_product_id);
349
- if($yith_product_brand != ""){
350
- $product[$key] = sanitize_text_field($yith_product_brand);
351
- }
 
 
 
 
 
 
 
 
 
 
 
 
352
  }else if(isset($postObj->$value) && $postObj->$value != ""){
353
  $product[$key] = $postObj->$value;
354
  }
160
 
161
  public function tvc_get_map_product_attribute($products, $tvc_currency, $merchantId){
162
  if(!empty($products)){
163
+ global $wpdb;
164
+ $tve_table_prefix = $wpdb->prefix;
165
  $plan_id = $this->TVC_Admin_Helper->get_plan_id();
166
  $items = [];
167
  $skipProducts = [];
283
  }
284
  }else if(in_array($key, array("brand")) && $plan_id != 1){
285
  //list of cutom option added
286
+ $product_brand = ""; $is_custom_attr_brand = false;
287
+ $woo_attr_list = json_decode(json_encode($this->TVC_Admin_Helper->getTableData($tve_table_prefix.'woocommerce_attribute_taxonomies', ['attribute_name'])), true);
288
+ if(!empty($woo_attr_list)){
289
+ foreach ($woo_attr_list as $key_attr => $value_attr) {
290
+ if(isset($value_attr['field']) && $value_attr['field'] == $value){
291
+ $is_custom_attr_brand = true;
292
+ $product_brand = $this->TVC_Admin_Helper->get_custom_taxonomy_name($postvalue->w_product_id, "pa_".$value);
293
+ }
294
+ }
295
+ }
296
+ if($is_custom_attr_brand == false && $product_brand == ""){
297
+ $product_brand = $this->TVC_Admin_Helper->add_additional_option_val_in_map_product_attribute($key, $postvalue->w_product_id);
298
+ }
299
+ if($product_brand != ""){
300
+ $product[$key] = sanitize_text_field($product_brand);
301
  }
302
  }else if(isset($postmeta_var->$value) && $postmeta_var->$value != ""){
303
  $product[$key] = sanitize_text_field($postmeta_var->$value);
359
  }
360
  }else if(in_array($key, array("brand")) && $plan_id != 1){
361
  //list of cutom option added
362
+ $product_brand = ""; $is_custom_attr_brand = false;
363
+ $woo_attr_list = json_decode(json_encode($this->TVC_Admin_Helper->getTableData($tve_table_prefix.'woocommerce_attribute_taxonomies', ['attribute_name'])), true);
364
+ if(!empty($woo_attr_list)){
365
+ foreach ($woo_attr_list as $key_attr => $value_attr) {
366
+ if(isset($value_attr['field']) && $value_attr['field'] == $value){
367
+ $is_custom_attr_brand = true;
368
+ $product_brand = $this->TVC_Admin_Helper->get_custom_taxonomy_name($postvalue->w_product_id, "pa_".$value);
369
+ }
370
+ }
371
+ }
372
+ if($is_custom_attr_brand == false && $product_brand == ""){
373
+ $product_brand = $this->TVC_Admin_Helper->add_additional_option_val_in_map_product_attribute($key, $postvalue->w_product_id);
374
+ }
375
+ if($product_brand != ""){
376
+ $product[$key] = sanitize_text_field($product_brand);
377
+ }
378
  }else if(isset($postObj->$value) && $postObj->$value != ""){
379
  $product[$key] = $postObj->$value;
380
  }
admin/class-tvc-admin-helper.php CHANGED
@@ -24,7 +24,7 @@ Class TVC_Admin_Helper{
24
  $this->customApiObj = new CustomApi();
25
  $this->TVC_Admin_DB_Helper = new TVC_Admin_DB_Helper();
26
  add_action('init',array($this, 'init'));
27
- add_action( 'admin_init', array( $this, 'tvc_upgrade_function' ), 9999 );
28
  }
29
 
30
  public function includes() {
24
  $this->customApiObj = new CustomApi();
25
  $this->TVC_Admin_DB_Helper = new TVC_Admin_DB_Helper();
26
  add_action('init',array($this, 'init'));
27
+ add_action( 'init', array( $this, 'tvc_upgrade_function' ), 9999 );
28
  }
29
 
30
  public function includes() {
admin/css/style.css CHANGED
@@ -1166,4 +1166,10 @@ button:disabled,button[disabled], button:disabled:hover,button[disabled]:hover{b
1166
  #charcount{ text-align: end;padding: 1px 0px;font-size: smaller;}
1167
  .feedback_btn{ margin: 0;text-transform: none;-webkit-appearance: button;transition: color .15s ease-in-out,background-color .15s ease-in-out,border-color .15s ease-in-out,box-shadow .15s ease-in-out;border: 1px solid transparent; text-align: center;text-decoration: none;vertical-align: middle;display: inline-block; font-weight: 400; line-height: 1.5; color: #fff;border-radius: 0!important; padding: 0.375rem 1rem; background-color: #2D62ED;border-color: #2D62ED; }
1168
  .feedback_btn:hover{ color: #fff; }
1169
- /* end feedback-form */
 
 
 
 
 
 
1166
  #charcount{ text-align: end;padding: 1px 0px;font-size: smaller;}
1167
  .feedback_btn{ margin: 0;text-transform: none;-webkit-appearance: button;transition: color .15s ease-in-out,background-color .15s ease-in-out,border-color .15s ease-in-out,box-shadow .15s ease-in-out;border: 1px solid transparent; text-align: center;text-decoration: none;vertical-align: middle;display: inline-block; font-weight: 400; line-height: 1.5; color: #fff;border-radius: 0!important; padding: 0.375rem 1rem; background-color: #2D62ED;border-color: #2D62ED; }
1168
  .feedback_btn:hover{ color: #fff; }
1169
+ /* end feedback-form */
1170
+
1171
+ #ee_plugin_form select{
1172
+ min-width: 330px;
1173
+ }
1174
+ table .tracking-trigger td{ padding: 0 0 0.5rem 1rem;}
1175
+ #ee_plugin_form input[type="text"], #ee_plugin_form input[type="number"]{ min-width: 285px; height: 32px; margin-bottom: 5px;}
admin/helper/class-onboarding-helper.php CHANGED
@@ -296,13 +296,7 @@ if(!class_exists('Conversios_Onboarding_Helper')):
296
  $TVC_Admin_Helper->set_ee_additional_data($ee_additional_data);
297
  }
298
  if(property_exists($google_detail,"error") && $google_detail->error == false){
299
- /**
300
- * for save conversion send to in WP DB
301
- */
302
  $googleDetail = $google_detail->data;
303
- if($googleDetail->plan_id != 1 && sanitize_text_field($googleDetail->google_ads_conversion_tracking) == 1){
304
- $TVC_Admin_Helper->update_conversion_send_to();
305
- }
306
  /**
307
  * for site verifecation
308
  */
@@ -334,6 +328,9 @@ if(!class_exists('Conversios_Onboarding_Helper')):
334
 
335
  $TVC_Admin_Helper->save_ee_options_settings($settings);
336
  $TVC_Admin_Helper->update_app_status();
 
 
 
337
  /*
338
  * function call for save API data in WP DB
339
  */
@@ -343,6 +340,10 @@ if(!class_exists('Conversios_Onboarding_Helper')):
343
  * function call for save remarketing snippets in WP DB
344
  */
345
  $TVC_Admin_Helper->update_remarketing_snippets();
 
 
 
 
346
  /**
347
  * save gmail and view ID in WP DB
348
  */
296
  $TVC_Admin_Helper->set_ee_additional_data($ee_additional_data);
297
  }
298
  if(property_exists($google_detail,"error") && $google_detail->error == false){
 
 
 
299
  $googleDetail = $google_detail->data;
 
 
 
300
  /**
301
  * for site verifecation
302
  */
328
 
329
  $TVC_Admin_Helper->save_ee_options_settings($settings);
330
  $TVC_Admin_Helper->update_app_status();
331
+ /**
332
+ * for save conversion send to in WP DB
333
+ */
334
  /*
335
  * function call for save API data in WP DB
336
  */
340
  * function call for save remarketing snippets in WP DB
341
  */
342
  $TVC_Admin_Helper->update_remarketing_snippets();
343
+
344
+ if($googleDetail->plan_id != 1 && sanitize_text_field($googleDetail->google_ads_conversion_tracking) == 1){
345
+ $TVC_Admin_Helper->update_conversion_send_to();
346
+ }
347
  /**
348
  * save gmail and view ID in WP DB
349
  */
admin/partials/general-fields.php CHANGED
@@ -31,6 +31,8 @@ if (isset($_POST['ee_submit_plugin'])) {
31
  $settings['ga_PrivacyPolicy'] = isset($_POST["ga_PrivacyPolicy"])?sanitize_text_field($_POST["ga_PrivacyPolicy"]):"";
32
  $settings['google-analytic'] = '';
33
  $settings['tvc_conversion_tracking_type'] = isset($_POST["tvc_conversion_tracking_type"])?sanitize_text_field($_POST["tvc_conversion_tracking_type"]):"";
 
 
34
  $settings['fb_pixel_id'] = isset($_POST["fb_pixel_id"])?sanitize_text_field($_POST["fb_pixel_id"]):"";
35
 
36
  $TVC_Admin_Helper->save_ee_options_settings($settings);
@@ -211,16 +213,50 @@ if(isset($google_detail['setting'])){
211
  </td>
212
  </tr>
213
  <tr>
214
- <th>
215
- <label class = "align-middle" for="ga_PrivacyPolicy"><?php esc_html_e("Order Conversion Trigger","conversios"); ?></label>
216
- </th>
217
- <td>
218
- <?php $tvc_con_tracking_type = isset($data['tvc_conversion_tracking_type'])?$data['tvc_conversion_tracking_type']:""; ?>
219
- <select name="tvc_conversion_tracking_type" id="tvc_conversion_tracking_type">
220
- <option value="woo-thankyou-hook" <?php echo ($tvc_con_tracking_type != "on-thankyou-page")?"selected":""; ?>><?php esc_html_e("Woo Thankyou Hook","conversios"); ?></option>
221
- <option value="on-thankyou-page" <?php echo ($tvc_con_tracking_type == "on-thankyou-page")?"selected":""; ?>><?php esc_html_e("On Thankyou Page","conversios"); ?></option>
222
- </select>
223
- <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>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
224
  </td>
225
  </tr>
226
  <?php /*
31
  $settings['ga_PrivacyPolicy'] = isset($_POST["ga_PrivacyPolicy"])?sanitize_text_field($_POST["ga_PrivacyPolicy"]):"";
32
  $settings['google-analytic'] = '';
33
  $settings['tvc_conversion_tracking_type'] = isset($_POST["tvc_conversion_tracking_type"])?sanitize_text_field($_POST["tvc_conversion_tracking_type"]):"";
34
+ $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"]):"";
35
+ $settings['tvc_checkout_conversion_tracking_type'] = isset($_POST["tvc_checkout_conversion_tracking_type"])?sanitize_text_field($_POST["tvc_checkout_conversion_tracking_type"]):"";
36
  $settings['fb_pixel_id'] = isset($_POST["fb_pixel_id"])?sanitize_text_field($_POST["fb_pixel_id"]):"";
37
 
38
  $TVC_Admin_Helper->save_ee_options_settings($settings);
213
  </td>
214
  </tr>
215
  <tr>
216
+ <td colspan="2" style="padding: 0.5rem 0;">
217
+ <strong>Tracking Trigger Point Settings</strong>
218
+ <table class="tracking-trigger">
219
+ <tr>
220
+ <th style="padding: 0 1rem;">
221
+ <label class = "align-middle" for="tvc_product_detail_conversion_tracking_type"><?php esc_html_e("AddtoCart PDP","conversios"); ?></label>
222
+ </th>
223
+ <td>
224
+ <?php $tvc_prod_dtl_con_tracking_type = isset($data['tvc_product_detail_conversion_tracking_type'])?$data['tvc_product_detail_conversion_tracking_type']:""; ?>
225
+ <select name="tvc_product_detail_conversion_tracking_type" id="tvc_conversion_tracking_type">
226
+ <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>
227
+ <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>
228
+ </select>
229
+ <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>
230
+ </td>
231
+ </tr>
232
+ <tr>
233
+ <th style="padding: 0 1rem;">
234
+ <label class = "align-middle" for="tvc_checkout_conversion_tracking_type"><?php esc_html_e("Checkout Steps","conversios"); ?></label>
235
+ </th>
236
+ <td>
237
+ <?php $tvc_checkout_con_tracking_type = isset($data['tvc_checkout_conversion_tracking_type'])?$data['tvc_checkout_conversion_tracking_type']:""; ?>
238
+ <select name="tvc_checkout_conversion_tracking_type" id="tvc_conversion_tracking_type">
239
+ <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>
240
+ <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>
241
+ </select>
242
+ <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>
243
+ </td>
244
+ </tr>
245
+
246
+ <tr>
247
+ <th style="padding: 0 1rem;">
248
+ <label class = "align-middle" for="tvc_conversion_tracking_type"><?php esc_html_e("Order Conversion","conversios"); ?></label>
249
+ </th>
250
+ <td>
251
+ <?php $tvc_con_tracking_type = isset($data['tvc_conversion_tracking_type'])?$data['tvc_conversion_tracking_type']:""; ?>
252
+ <select name="tvc_conversion_tracking_type" id="tvc_conversion_tracking_type">
253
+ <option value="woo-thankyou-hook" <?php echo ($tvc_con_tracking_type != "on-thankyou-page")?"selected":""; ?>><?php esc_html_e("hook - woocommerce_thankyou","conversios"); ?></option>
254
+ <option value="on-thankyou-page" <?php echo ($tvc_con_tracking_type == "on-thankyou-page")?"selected":""; ?>><?php esc_html_e("On Page Condition","conversios"); ?></option>
255
+ </select>
256
+ <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>
257
+ </td>
258
+ </tr>
259
+ </table>
260
  </td>
261
  </tr>
262
  <?php /*
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.7.1
19
  * Author: Tatvic
20
  * Author URI: www.tatvic.com
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.7.1' );
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.7.2
19
  * Author: Tatvic
20
  * Author URI: www.tatvic.com
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.7.2' );
41
  $fullName = plugin_basename( __FILE__ );
42
  $dir = str_replace('/enhanced-ecommerce-google-analytics.php','',$fullName);
43
  if ( ! defined( 'ENHANCAD_PLUGIN_NAME' ) ) {
includes/setup/class-tvc-product-sync-helper.php CHANGED
@@ -78,6 +78,8 @@ if ( ! class_exists( 'TVCProductSyncHelper' ) ) {
78
  */
79
  public function tvc_get_map_product_attribute($products, $tvc_currency, $merchantId, $product_batch_size = 100){
80
  if(!empty($products)){
 
 
81
  $plan_id = $this->TVC_Admin_Helper->get_plan_id();
82
  $items = [];
83
  $skipProducts = [];
@@ -226,9 +228,21 @@ if ( ! class_exists( 'TVCProductSyncHelper' ) ) {
226
  $product[$key] = sanitize_text_field($stock_status);
227
  }
228
  }else if(in_array($key, array("brand")) && $plan_id != 1){ //list of cutom option added (Pro user only)
229
- $yith_product_brand = $this->TVC_Admin_Helper->add_additional_option_val_in_map_product_attribute($key, $postvalue->w_product_id);
230
- if($yith_product_brand != ""){
231
- $product[$key] = sanitize_text_field($yith_product_brand);
 
 
 
 
 
 
 
 
 
 
 
 
232
  }
233
  }else if(isset($postmeta_var->$value) && $postmeta_var->$value != ""){
234
  $product[$key] = sanitize_text_field($postmeta_var->$value);
@@ -292,13 +306,26 @@ if ( ! class_exists( 'TVCProductSyncHelper' ) ) {
292
  }
293
  }else if(in_array($key, array("brand")) && $plan_id != 1){
294
  //list of cutom option added
295
- $yith_product_brand = $this->TVC_Admin_Helper->add_additional_option_val_in_map_product_attribute($key, $postvalue->w_product_id);
296
- if($yith_product_brand != ""){
297
- $product[$key] = sanitize_text_field($yith_product_brand);
298
- }
 
 
 
 
 
 
 
 
 
 
 
 
299
  }else if(isset($postObj->$value) && $postObj->$value != ""){
300
  $product[$key] = $postObj->$value;
301
  }
 
302
  }
303
  $item = [
304
  'merchant_id' => sanitize_text_field($merchantId),
@@ -378,7 +405,9 @@ if ( ! class_exists( 'TVCProductSyncHelper' ) ) {
378
  $tve_table_prefix = $wpdb->prefix;
379
  $column1 = json_decode(json_encode($this->TVC_Admin_Helper->getTableColumns($tve_table_prefix.'posts')), true);
380
  $column2 = json_decode(json_encode($this->TVC_Admin_Helper->getTableData($tve_table_prefix.'postmeta', ['meta_key'])), true);
381
- return array_merge($column1, $column2);
 
 
382
  }
383
 
384
  public function tvc_product_sync_popup_html(){
78
  */
79
  public function tvc_get_map_product_attribute($products, $tvc_currency, $merchantId, $product_batch_size = 100){
80
  if(!empty($products)){
81
+ global $wpdb;
82
+ $tve_table_prefix = $wpdb->prefix;
83
  $plan_id = $this->TVC_Admin_Helper->get_plan_id();
84
  $items = [];
85
  $skipProducts = [];
228
  $product[$key] = sanitize_text_field($stock_status);
229
  }
230
  }else if(in_array($key, array("brand")) && $plan_id != 1){ //list of cutom option added (Pro user only)
231
+ $product_brand = ""; $is_custom_attr_brand = false;
232
+ $woo_attr_list = json_decode(json_encode($this->TVC_Admin_Helper->getTableData($tve_table_prefix.'woocommerce_attribute_taxonomies', ['attribute_name'])), true);
233
+ if(!empty($woo_attr_list)){
234
+ foreach ($woo_attr_list as $key_attr => $value_attr) {
235
+ if(isset($value_attr['field']) && $value_attr['field'] == $value){
236
+ $is_custom_attr_brand = true;
237
+ $product_brand = $this->TVC_Admin_Helper->get_custom_taxonomy_name($postvalue->w_product_id, "pa_".$value);
238
+ }
239
+ }
240
+ }
241
+ if($is_custom_attr_brand == false && $product_brand == ""){
242
+ $product_brand = $this->TVC_Admin_Helper->add_additional_option_val_in_map_product_attribute($key, $postvalue->w_product_id);
243
+ }
244
+ if($product_brand != ""){
245
+ $product[$key] = sanitize_text_field($product_brand);
246
  }
247
  }else if(isset($postmeta_var->$value) && $postmeta_var->$value != ""){
248
  $product[$key] = sanitize_text_field($postmeta_var->$value);
306
  }
307
  }else if(in_array($key, array("brand")) && $plan_id != 1){
308
  //list of cutom option added
309
+ $product_brand = ""; $is_custom_attr_brand = false;
310
+ $woo_attr_list = json_decode(json_encode($this->TVC_Admin_Helper->getTableData($tve_table_prefix.'woocommerce_attribute_taxonomies', ['attribute_name'])), true);
311
+ if(!empty($woo_attr_list)){
312
+ foreach ($woo_attr_list as $key_attr => $value_attr) {
313
+ if(isset($value_attr['field']) && $value_attr['field'] == $value){
314
+ $is_custom_attr_brand = true;
315
+ $product_brand = $this->TVC_Admin_Helper->get_custom_taxonomy_name($postvalue->w_product_id, "pa_".$value);
316
+ }
317
+ }
318
+ }
319
+ if($is_custom_attr_brand == false && $product_brand == ""){
320
+ $product_brand = $this->TVC_Admin_Helper->add_additional_option_val_in_map_product_attribute($key, $postvalue->w_product_id);
321
+ }
322
+ if($product_brand != ""){
323
+ $product[$key] = sanitize_text_field($product_brand);
324
+ }
325
  }else if(isset($postObj->$value) && $postObj->$value != ""){
326
  $product[$key] = $postObj->$value;
327
  }
328
+
329
  }
330
  $item = [
331
  'merchant_id' => sanitize_text_field($merchantId),
405
  $tve_table_prefix = $wpdb->prefix;
406
  $column1 = json_decode(json_encode($this->TVC_Admin_Helper->getTableColumns($tve_table_prefix.'posts')), true);
407
  $column2 = json_decode(json_encode($this->TVC_Admin_Helper->getTableData($tve_table_prefix.'postmeta', ['meta_key'])), true);
408
+ $column3 = json_decode(json_encode($this->TVC_Admin_Helper->getTableData($tve_table_prefix.'woocommerce_attribute_taxonomies', ['attribute_name'])), true);
409
+
410
+ return array_merge($column1, $column2,$column3);
411
  }
412
 
413
  public function tvc_product_sync_popup_html(){
public/class-enhanced-ecommerce-google-analytics-public-pro.php CHANGED
@@ -65,7 +65,8 @@ class Enhanced_Ecommerce_Google_Analytics_Public {
65
  protected $remarketing_snippets;
66
  protected $conversio_send_to;
67
  protected $tvc_conversion_tracking_type;
68
-
 
69
  protected $ee_options;
70
  protected $fb_pixel_id;
71
 
@@ -81,6 +82,8 @@ class Enhanced_Ecommerce_Google_Analytics_Public {
81
  $this->version = sanitize_text_field($version);
82
  $this->ee_options = $this->TVC_Admin_Helper->get_ee_options_settings();
83
  $this->tvc_conversion_tracking_type = sanitize_text_field($this->get_option("tvc_conversion_tracking_type"));
 
 
84
  $this->tvc_call_hooks();
85
 
86
  $this->ga_Dname = "auto";
@@ -177,19 +180,28 @@ class Enhanced_Ecommerce_Google_Analytics_Public {
177
  add_action("wp_head", array($this, "ecommerce_tracking_code"));
178
  }else{
179
  add_action("woocommerce_thankyou", array($this, "ecommerce_tracking_code"));
180
- }
181
- //add_action("woocommerce_after_single_product", array($this, "product_detail_view"));
182
- add_action("wp_head", array($this, "product_detail_view"));
183
- add_action("woocommerce_after_cart", array($this, "remove_cart_tracking"));
 
 
 
 
 
 
 
 
184
  //check out step 1,2,3
185
- //add_action("woocommerce_before_checkout_form", array($this, "checkout_step_1_tracking"));
186
- //add_action("woocommerce_before_checkout_form", array($this, "checkout_step_2_tracking"));
187
- //add_action("woocommerce_before_checkout_form", array($this, "checkout_step_3_tracking"));
188
- add_action("wp_head", array($this, "checkout_step_1_tracking"));
189
- add_action("wp_head", array($this, "checkout_step_2_tracking"));
190
- add_action("wp_head", array($this, "checkout_step_3_tracking"));
191
- //add_action("woocommerce_after_add_to_cart_button", array($this, "add_to_cart"));
192
- add_action("wp_footer", array($this, "single_add_to_cart"));
 
193
  //add version details in footer
194
  add_action("wp_footer", array($this, "add_plugin_details"));
195
  //Add Dev ID
@@ -649,7 +661,7 @@ src="https://www.facebook.com/tr?id=<?php echo esc_js($this->fb_pixel_id); ?>&ev
649
  $order = new WC_Order($order_id);
650
  }
651
  if ($this->disable_tracking($this->ga_eeT) || current_user_can("manage_options") || get_post_meta($order_id, "_tracked", true) == 1 || !is_order_received_page() ){
652
- //return;
653
  }
654
  get_post_meta($order_id, "_tracked", true);
655
  // Doing eCommerce tracking so unhook standard tracking from the footer
65
  protected $remarketing_snippets;
66
  protected $conversio_send_to;
67
  protected $tvc_conversion_tracking_type;
68
+ protected $tvc_product_detail_tracking_type;
69
+ protected $tvc_checkout_tracking_type;
70
  protected $ee_options;
71
  protected $fb_pixel_id;
72
 
82
  $this->version = sanitize_text_field($version);
83
  $this->ee_options = $this->TVC_Admin_Helper->get_ee_options_settings();
84
  $this->tvc_conversion_tracking_type = sanitize_text_field($this->get_option("tvc_conversion_tracking_type"));
85
+ $this->tvc_product_detail_tracking_type = sanitize_text_field($this->get_option("tvc_product_detail_tracking_type"));
86
+ $this->tvc_checkout_tracking_type = sanitize_text_field($this->get_option("tvc_checkout_tracking_type"));
87
  $this->tvc_call_hooks();
88
 
89
  $this->ga_Dname = "auto";
180
  add_action("wp_head", array($this, "ecommerce_tracking_code"));
181
  }else{
182
  add_action("woocommerce_thankyou", array($this, "ecommerce_tracking_code"));
183
+ }
184
+ if($this->tvc_product_detail_tracking_type == "on-product-detail-page"){
185
+ add_action("wp_head", array($this, "product_detail_view"));
186
+ add_action("wp_footer", array($this, "single_add_to_cart"));
187
+ }else{
188
+ // var int
189
+ add_action("woocommerce_after_single_product", array($this, "product_detail_view"));
190
+ // event tigger
191
+ add_action("woocommerce_after_add_to_cart_button", array($this, "single_add_to_cart"));
192
+ }
193
+ add_action("woocommerce_after_cart", array($this, "remove_cart_tracking"));
194
+
195
  //check out step 1,2,3
196
+ if($this->tvc_checkout_tracking_type == "on-checkout-page"){
197
+ add_action("wp_head", array($this, "checkout_step_1_tracking"));
198
+ add_action("wp_head", array($this, "checkout_step_2_tracking"));
199
+ add_action("wp_head", array($this, "checkout_step_3_tracking"));
200
+ }else{
201
+ add_action("woocommerce_before_checkout_form", array($this, "checkout_step_1_tracking"));
202
+ add_action("woocommerce_before_checkout_form", array($this, "checkout_step_2_tracking"));
203
+ add_action("woocommerce_before_checkout_form", array($this, "checkout_step_3_tracking"));
204
+ }
205
  //add version details in footer
206
  add_action("wp_footer", array($this, "add_plugin_details"));
207
  //Add Dev ID
661
  $order = new WC_Order($order_id);
662
  }
663
  if ($this->disable_tracking($this->ga_eeT) || current_user_can("manage_options") || get_post_meta($order_id, "_tracked", true) == 1 || !is_order_received_page() ){
664
+ return;
665
  }
666
  get_post_meta($order_id, "_tracked", true);
667
  // Doing eCommerce tracking so unhook standard tracking from the footer
public/class-enhanced-ecommerce-google-analytics-public.php CHANGED
@@ -97,6 +97,8 @@ class Enhanced_Ecommerce_Google_Analytics_Public {
97
  protected $remarketing_snippet_id;
98
  protected $remarketing_snippets;
99
  protected $tvc_conversion_tracking_type;
 
 
100
 
101
  protected $ee_options;
102
 
@@ -114,9 +116,9 @@ class Enhanced_Ecommerce_Google_Analytics_Public {
114
 
115
  $this->ee_options = $this->TVC_Admin_Helper->get_ee_options_settings();
116
  $this->tvc_conversion_tracking_type = sanitize_text_field($this->get_option("tvc_conversion_tracking_type"));
117
-
 
118
  $this->tvc_call_hooks();
119
-
120
  $this->ga_id = sanitize_text_field($this->get_option("ga_id"));
121
  $this->ga_eeT = sanitize_text_field($this->get_option("ga_eeT"));
122
  $this->ga_ST = sanitize_text_field($this->get_option("ga_ST")); //add_gtag_snippet
@@ -162,17 +164,25 @@ class Enhanced_Ecommerce_Google_Analytics_Public {
162
  }else{
163
  add_action("woocommerce_thankyou", array($this, "ecommerce_tracking_code"));
164
  }
165
- //add_action("woocommerce_after_single_product", array($this, "product_detail_view"));
166
- add_action("wp_head", array($this, "product_detail_view"));
167
- add_action("woocommerce_after_cart",array($this, "remove_cart_tracking"));
 
 
 
 
 
168
  //check out step 1,2,3
169
- //add_action("woocommerce_before_checkout_form", array($this, "checkout_step_1_tracking"));
170
- //add_action("woocommerce_before_checkout_form", array($this, "checkout_step_2_tracking"));
171
- //add_action("woocommerce_before_checkout_form", array($this, "checkout_step_3_tracking"));
172
- add_action("wp_head", array($this, "checkout_step_1_tracking"));
173
- add_action("wp_head", array($this, "checkout_step_2_tracking"));
174
- add_action("wp_head", array($this, "checkout_step_3_tracking"));
175
- //add_action("woocommerce_after_add_to_cart_button", array($this, "add_to_cart"));
 
 
 
176
  add_action("wp_footer", array($this, "single_add_to_cart"));
177
  //add version details in footer
178
  add_action("wp_footer", array($this, "add_plugin_details"));
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
 
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_tracking_type"));
120
+ $this->tvc_checkout_tracking_type = sanitize_text_field($this->get_option("tvc_checkout_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"));
124
  $this->ga_ST = sanitize_text_field($this->get_option("ga_ST")); //add_gtag_snippet
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 version details in footer
188
  add_action("wp_footer", array($this, "add_plugin_details"));
readme.txt CHANGED
@@ -8,8 +8,8 @@ Author: Tatvic
8
  Requires at least: 3.5.0
9
  Tested up to: 5.9.3
10
  Requires PHP: 5.6 or Higher
11
- Stable tag: 4.7.1
12
- Version: 4.7.1
13
  License: GPLv3
14
  License URI: http://www.gnu.org/licenses/gpl-3.0.html
15
 
@@ -392,6 +392,10 @@ You can resolve the duplication of data by removing the manually implemented GA
392
 
393
 
394
  == Changelog ==
 
 
 
 
395
  = 4.7.1 - 13/04/2022 =
396
  * New: (PRO) Product sync feture now compatible with various Brand plugins like Perfect Brands for WooCommerce, YITH WooCommerce Brands️ and WooCommerce Brands.
397
 
8
  Requires at least: 3.5.0
9
  Tested up to: 5.9.3
10
  Requires PHP: 5.6 or Higher
11
+ Stable tag: 4.7.2
12
+ Version: 4.7.2
13
  License: GPLv3
14
  License URI: http://www.gnu.org/licenses/gpl-3.0.html
15
 
392
 
393
 
394
  == Changelog ==
395
+ = 4.7.2 - 21/04/2022 =
396
+ * Tweak: Now, Customer can choose the tracking trigger for addTocart (product detail), checkout steps and thenkyou page.
397
+ * New: (PRO) Now compatible with WooCommerce custom attribute mapping for the brands (product) in the product sync.
398
+
399
  = 4.7.1 - 13/04/2022 =
400
  * New: (PRO) Product sync feture now compatible with various Brand plugins like Perfect Brands for WooCommerce, YITH WooCommerce Brands️ and WooCommerce Brands.
401