Enhanced Ecommerce Google Analytics Plugin for WooCommerce - Version 4.8.5

Version Description

  • 03/08/2022 =
  • Optimization in code pretaining to Enhanced Conversions and GA4 dashboard time out issue.
  • Network site compatibility enabled.
Download this release

Release Info

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

Code changes from version 4.8.4 to 4.8.5

admin/class-conversios-admin.php CHANGED
@@ -231,7 +231,10 @@ if ( ! class_exists( 'Conversios_Admin' ) ) {
231
  add_menu_page(
232
  esc_html__('Tatvic EE Plugin','conversios'), esc_html__('Tatvic EE Plugin','conversios'), 'manage_options', "conversios", array($this, 'showPage'), esc_url_raw(plugin_dir_url(__FILE__) . 'images/tatvic_logo.png'), 26
233
  );
234
- if( in_array( 'woocommerce/woocommerce.php', apply_filters( 'active_plugins', get_option( 'active_plugins' ) ) ) ) {
 
 
 
235
  add_submenu_page(
236
  'conversios',
237
  esc_html__('Dashboard','conversios'),
231
  add_menu_page(
232
  esc_html__('Tatvic EE Plugin','conversios'), esc_html__('Tatvic EE Plugin','conversios'), 'manage_options', "conversios", array($this, 'showPage'), esc_url_raw(plugin_dir_url(__FILE__) . 'images/tatvic_logo.png'), 26
233
  );
234
+ if ( ! function_exists( 'is_plugin_active_for_network' ) ) {
235
+ require_once( ABSPATH . '/wp-admin/includes/woocommerce.php' );
236
+ }
237
+ if ( is_plugin_active_for_network( 'woocommerce/woocommerce.php') || in_array( 'woocommerce/woocommerce.php', apply_filters( 'active_plugins', get_option( 'active_plugins' ) ) ) ) {
238
  add_submenu_page(
239
  'conversios',
240
  esc_html__('Dashboard','conversios'),
admin/partials/class-conversios-header.php CHANGED
@@ -39,7 +39,7 @@ if ( ! class_exists( 'Conversios_Header' ) ) {
39
  * @since 4.1.4
40
  */
41
  public function header_notices(){
42
- if( !in_array( 'woocommerce/woocommerce.php', apply_filters( 'active_plugins', get_option( 'active_plugins' ) ) ) ) {
43
  ?>
44
  <div class="errormsgtopbx claimalert">
45
  <div class="errmscntbx">
@@ -47,7 +47,7 @@ if ( ! class_exists( 'Conversios_Header' ) ) {
47
  <span class="errmsgicon"><img src="<?php echo esc_url_raw(ENHANCAD_PLUGIN_URL.'/admin/images/error-white-icon.png'); ?>" alt="error" /></span>
48
  </div>
49
  <div class="erralertrigt">
50
- <h6><?php echo esc_html_e("Hey,.","conversios"); ?></h6>
51
  <p><?php echo esc_html_e("It seems WooCommerce plugin is not active on your wp-admin. Conversios.io - Google Analytics and Google Shopping plugin required.","conversios"); ?> </p>
52
  </div>
53
  </div>
@@ -128,7 +128,10 @@ if ( ! class_exists( 'Conversios_Header' ) ) {
128
  public function conversios_menu_list(){
129
  //slug => arra();
130
  $conversios_menu_list = array();
131
- if( in_array( 'woocommerce/woocommerce.php', apply_filters( 'active_plugins', get_option( 'active_plugins' ) ) ) ) {
 
 
 
132
  $conversios_menu_list = array(
133
  'conversios' => array(
134
  'title'=>'Dashboard',
39
  * @since 4.1.4
40
  */
41
  public function header_notices(){
42
+ if ( !is_network_admin() && !is_plugin_active_for_network( 'woocommerce/woocommerce.php') && !in_array( 'woocommerce/woocommerce.php', apply_filters( 'active_plugins', get_option( 'active_plugins' ) ) )){
43
  ?>
44
  <div class="errormsgtopbx claimalert">
45
  <div class="errmscntbx">
47
  <span class="errmsgicon"><img src="<?php echo esc_url_raw(ENHANCAD_PLUGIN_URL.'/admin/images/error-white-icon.png'); ?>" alt="error" /></span>
48
  </div>
49
  <div class="erralertrigt">
50
+ <h6><?php echo esc_html_e("Hey,","conversios"); ?></h6>
51
  <p><?php echo esc_html_e("It seems WooCommerce plugin is not active on your wp-admin. Conversios.io - Google Analytics and Google Shopping plugin required.","conversios"); ?> </p>
52
  </div>
53
  </div>
128
  public function conversios_menu_list(){
129
  //slug => arra();
130
  $conversios_menu_list = array();
131
+ if ( ! function_exists( 'is_plugin_active_for_network' ) ) {
132
+ require_once( ABSPATH . '/wp-admin/includes/woocommerce.php' );
133
+ }
134
+ if ( is_plugin_active_for_network( 'woocommerce/woocommerce.php') || in_array( 'woocommerce/woocommerce.php', apply_filters( 'active_plugins', get_option( 'active_plugins' ) ) ) ){
135
  $conversios_menu_list = array(
136
  'conversios' => array(
137
  'title'=>'Dashboard',
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.4
19
  * Author: Conversios
20
  * Author URI: conversios.io
21
  * License: GPL-2.0+
@@ -23,7 +23,7 @@
23
  * Text Domain: conversios.io
24
  * Domain Path: /languages
25
  * WC requires at least: 3.5.0
26
- * WC tested up to: 6.6.1
27
  */
28
 
29
  /**
@@ -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.4' );
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.8.5
19
  * Author: Conversios
20
  * Author URI: conversios.io
21
  * License: GPL-2.0+
23
  * Text Domain: conversios.io
24
  * Domain Path: /languages
25
  * WC requires at least: 3.5.0
26
+ * WC tested up to: 6.7.0
27
  */
28
 
29
  /**
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.5' );
41
  $fullName = plugin_basename( __FILE__ );
42
  $dir = str_replace('/enhanced-ecommerce-google-analytics.php','',$fullName);
43
  if ( ! defined( 'ENHANCAD_PLUGIN_NAME' ) ) {
includes/class-enhanced-ecommerce-google-analytics-activator.php CHANGED
@@ -31,9 +31,9 @@ class Enhanced_Ecommerce_Google_Analytics_Activator {
31
  * @since 1.0.0
32
  */
33
  public static function activate() {
34
- if (!is_plugin_active( 'woocommerce/woocommerce.php' ) ) {
35
  wp_die(wp_sprintf("%s <br><a href='" . esc_url_raw(admin_url( 'plugins.php' )) . "'>&laquo; %s</a>", esc_html__("Hey, It seems WooCommerce plugin is not active on your wp-admin. Conversios.io - Google Analytics and Google Shopping plugin can only be activated if you have active WooCommerce plugin in your wp-admin.","conversios"), esc_html__("Return to Plugins","conversios")));
36
- }
37
  $TVC_Admin_Helper = new TVC_Admin_Helper();
38
  $TVC_Admin_Helper->update_app_status();
39
  }
31
  * @since 1.0.0
32
  */
33
  public static function activate() {
34
+ /*if (!is_plugin_active( 'woocommerce/woocommerce.php' ) ) {
35
  wp_die(wp_sprintf("%s <br><a href='" . esc_url_raw(admin_url( 'plugins.php' )) . "'>&laquo; %s</a>", esc_html__("Hey, It seems WooCommerce plugin is not active on your wp-admin. Conversios.io - Google Analytics and Google Shopping plugin can only be activated if you have active WooCommerce plugin in your wp-admin.","conversios"), esc_html__("Return to Plugins","conversios")));
36
+ }*/
37
  $TVC_Admin_Helper = new TVC_Admin_Helper();
38
  $TVC_Admin_Helper->update_app_status();
39
  }
includes/class-enhanced-ecommerce-google-analytics.php CHANGED
@@ -140,7 +140,10 @@ class Enhanced_Ecommerce_Google_Analytics {
140
  * The class responsible for defining all actions that occur in the public-facing
141
  * side of the site.
142
  */
143
- if( in_array( 'woocommerce/woocommerce.php', apply_filters( 'active_plugins', get_option( 'active_plugins' ) ) ) ) {
 
 
 
144
  $TVC_Admin_Helper = new TVC_Admin_Helper();
145
  $plan_id = $TVC_Admin_Helper->get_plan_id();
146
  if($plan_id == 1){
@@ -192,7 +195,7 @@ class Enhanced_Ecommerce_Google_Analytics {
192
  * @access private
193
  */
194
  public function define_public_hooks() {
195
- if( in_array( 'woocommerce/woocommerce.php', apply_filters( 'active_plugins', get_option( 'active_plugins' ) ) ) ) {
196
  new Enhanced_Ecommerce_Google_Analytics_Public( $this->get_plugin_name(), $this->get_version() );
197
  }
198
  }
@@ -203,16 +206,16 @@ class Enhanced_Ecommerce_Google_Analytics {
203
  * @since 1.0.0
204
  */
205
  public function run() {
206
- if ( in_array( 'woocommerce/woocommerce.php', apply_filters( 'active_plugins', get_option( 'active_plugins' ) ) ) ) {
207
  add_action('woocommerce_init' , function (){
208
  $this->loader->run();
209
  });
210
  }
211
  else{
212
  include_once( ABSPATH . 'wp-admin/includes/plugin.php' );
213
- if ( is_plugin_active( 'woocommerce/woocommerce.php' ) ) {
214
  $this->loader->run();
215
- }else if( is_plugin_active( 'enhanced-e-commerce-for-woocommerce-store/enhanced-ecommerce-google-analytics.php' ) ){
216
  if(!isset($_POST['action'])){
217
  printf('<div class="notice tvc-notice notice-error"><p>%s</p></div>',esc_html__("Hey, It seems WooCommerce plugin is not active on your wp-admin. Conversios.io - Google Analytics and Google Shopping plugin can only be activated if you have active WooCommerce plugin in your wp-admin.","conversios"));
218
  }
@@ -256,8 +259,10 @@ class Enhanced_Ecommerce_Google_Analytics {
256
  public function tvc_plugin_action_links($links) {
257
  $deactivate_link = $links['deactivate'];
258
  unset($links['deactivate']);
259
- $setting_url = esc_url_raw('admin.php?page=conversios-google-analytics');
260
- $links[] = '<a href="' . get_admin_url(null, $setting_url) . '">'.esc_html__("Settings","conversios").'</a>';
 
 
261
 
262
  $links[] = '<a href="'.esc_url_raw("https://wordpress.org/plugins/enhanced-e-commerce-for-woocommerce-store/#faq").'" target="_blank">'.esc_html__("FAQ","conversios").'</a>';
263
  $links[] = '<a href="'.esc_url_raw("https://conversios.io/help-center/Installation-Manual.pdf").'" target="_blank">'.esc_html__("Documentation","conversios").'</a>';
140
  * The class responsible for defining all actions that occur in the public-facing
141
  * side of the site.
142
  */
143
+ if ( ! function_exists( 'is_plugin_active_for_network' ) ) {
144
+ require_once( ABSPATH . '/wp-admin/includes/woocommerce.php' );
145
+ }
146
+ if ( is_plugin_active_for_network( 'woocommerce/woocommerce.php') || in_array( 'woocommerce/woocommerce.php', apply_filters( 'active_plugins', get_option( 'active_plugins' ) ) ) ) {
147
  $TVC_Admin_Helper = new TVC_Admin_Helper();
148
  $plan_id = $TVC_Admin_Helper->get_plan_id();
149
  if($plan_id == 1){
195
  * @access private
196
  */
197
  public function define_public_hooks() {
198
+ if ( is_plugin_active_for_network( 'woocommerce/woocommerce.php') || in_array( 'woocommerce/woocommerce.php', apply_filters( 'active_plugins', get_option( 'active_plugins' ) ) ) ) {
199
  new Enhanced_Ecommerce_Google_Analytics_Public( $this->get_plugin_name(), $this->get_version() );
200
  }
201
  }
206
  * @since 1.0.0
207
  */
208
  public function run() {
209
+ if ( is_plugin_active_for_network( 'woocommerce/woocommerce.php') || in_array( 'woocommerce/woocommerce.php', apply_filters( 'active_plugins', get_option( 'active_plugins' ) ) ) ){
210
  add_action('woocommerce_init' , function (){
211
  $this->loader->run();
212
  });
213
  }
214
  else{
215
  include_once( ABSPATH . 'wp-admin/includes/plugin.php' );
216
+ if ( is_plugin_active( 'woocommerce/woocommerce.php' ) || is_plugin_active_for_network( 'woocommerce/woocommerce.php') ) {
217
  $this->loader->run();
218
+ }else if( is_admin() && !is_network_admin() && is_plugin_active( 'enhanced-e-commerce-for-woocommerce-store/enhanced-ecommerce-google-analytics.php' ) ){
219
  if(!isset($_POST['action'])){
220
  printf('<div class="notice tvc-notice notice-error"><p>%s</p></div>',esc_html__("Hey, It seems WooCommerce plugin is not active on your wp-admin. Conversios.io - Google Analytics and Google Shopping plugin can only be activated if you have active WooCommerce plugin in your wp-admin.","conversios"));
221
  }
259
  public function tvc_plugin_action_links($links) {
260
  $deactivate_link = $links['deactivate'];
261
  unset($links['deactivate']);
262
+ if ( is_plugin_active( 'woocommerce/woocommerce.php' ) || is_plugin_active_for_network( 'woocommerce/woocommerce.php') ) {
263
+ $setting_url = esc_url_raw('admin.php?page=conversios-google-analytics');
264
+ $links[] = '<a href="' . get_admin_url(null, $setting_url) . '">'.esc_html__("Settings","conversios").'</a>';
265
+ }
266
 
267
  $links[] = '<a href="'.esc_url_raw("https://wordpress.org/plugins/enhanced-e-commerce-for-woocommerce-store/#faq").'" target="_blank">'.esc_html__("FAQ","conversios").'</a>';
268
  $links[] = '<a href="'.esc_url_raw("https://conversios.io/help-center/Installation-Manual.pdf").'" target="_blank">'.esc_html__("Documentation","conversios").'</a>';
includes/setup/CustomApi.php CHANGED
@@ -135,6 +135,7 @@ class CustomApi{
135
  return $return;
136
  }
137
  $args = array(
 
138
  'headers' =>$header,
139
  'method' => 'POST',
140
  'body' => wp_json_encode($data)
@@ -377,6 +378,7 @@ class CustomApi{
377
  $url = $this->apiDomain . "/actionable-dashboard/analytics-viewid-currency";
378
  $postData['access_token']= $this->generateAccessToken($this->get_tvc_access_token(), $this->get_tvc_refresh_token());
379
  $args = array(
 
380
  'headers' =>$header,
381
  'method' => 'POST',
382
  'body' => wp_json_encode($postData)
@@ -420,6 +422,7 @@ class CustomApi{
420
  if($access_token != ""){
421
  $postData['access_token']= $access_token;
422
  $args = array(
 
423
  'headers' =>$header,
424
  'method' => 'POST',
425
  'body' => wp_json_encode($postData)
@@ -468,6 +471,7 @@ class CustomApi{
468
  if($access_token != ""){
469
  $postData['access_token']= $access_token;
470
  $args = array(
 
471
  'headers' =>$header,
472
  'method' => 'POST',
473
  'body' => wp_json_encode($postData)
@@ -513,6 +517,7 @@ class CustomApi{
513
  $url = $this->apiDomain . "/actionable-dashboard/analytics-get-ga4-property-id";
514
  $postData['access_token'] = $this->generateAccessToken($this->get_tvc_access_token(), $this->get_tvc_refresh_token());
515
  $args = array(
 
516
  'headers' =>$header,
517
  'method' => 'POST',
518
  'body' => wp_json_encode($postData)
135
  return $return;
136
  }
137
  $args = array(
138
+ 'timeout' => 10000,
139
  'headers' =>$header,
140
  'method' => 'POST',
141
  'body' => wp_json_encode($data)
378
  $url = $this->apiDomain . "/actionable-dashboard/analytics-viewid-currency";
379
  $postData['access_token']= $this->generateAccessToken($this->get_tvc_access_token(), $this->get_tvc_refresh_token());
380
  $args = array(
381
+ 'timeout' => 10000,
382
  'headers' =>$header,
383
  'method' => 'POST',
384
  'body' => wp_json_encode($postData)
422
  if($access_token != ""){
423
  $postData['access_token']= $access_token;
424
  $args = array(
425
+ 'timeout' => 10000,
426
  'headers' =>$header,
427
  'method' => 'POST',
428
  'body' => wp_json_encode($postData)
471
  if($access_token != ""){
472
  $postData['access_token']= $access_token;
473
  $args = array(
474
+ 'timeout' => 10000,
475
  'headers' =>$header,
476
  'method' => 'POST',
477
  'body' => wp_json_encode($postData)
517
  $url = $this->apiDomain . "/actionable-dashboard/analytics-get-ga4-property-id";
518
  $postData['access_token'] = $this->generateAccessToken($this->get_tvc_access_token(), $this->get_tvc_refresh_token());
519
  $args = array(
520
+ 'timeout' => 10000,
521
  'headers' =>$header,
522
  'method' => 'POST',
523
  'body' => wp_json_encode($postData)
includes/setup/google-ads.php CHANGED
@@ -48,10 +48,8 @@ class GoogleAds {
48
  }
49
  if(isset($_POST['ga_EC'])){
50
  update_option('ga_EC', sanitize_text_field($_POST['ga_EC']) );
51
- $googleDetail_setting->ga_EC = sanitize_text_field($_POST['ga_EC']);
52
  }else{
53
  update_option('ga_EC', 0);
54
- $googleDetail_setting->ga_EC = 0;
55
  }
56
  if(isset($_POST['ee_conversio_send_to'])){
57
  update_option('ee_conversio_send_to', sanitize_text_field($_POST['ee_conversio_send_to']) );
@@ -191,11 +189,12 @@ class GoogleAds {
191
  </div>
192
  </div>
193
  </div>
194
- <div class="form-group google_ads_conversion_sec <?php echo ($googleDetail->google_ads_conversion_tracking!=1)?"google_ads_conversion_sec_hide":""; ?>" id="google_ads_conversion_sec">
 
195
  <div class="col-md-12">
196
  <div class="form-group">
197
  <div class="tvc-custom-control tvc-custom-checkbox">
198
- <input type="checkbox" class="tvc-custom-control-input" id="ga_EC" name="ga_EC" value="1"<?php if(!empty($googleDetail->ga_EC)){ echo (esc_attr($googleDetail->ga_EC) == 1) ? 'checked="checked"' : '';}?> <?php if($googleDetail->google_ads_conversion_tracking!=1){ echo 'disabled'; } ?>>
199
  <label for="ga_EC"><?php esc_html_e("Enable Google Ads Enhanced Conversion tracking","conversios"); ?>
200
  </label>
201
  </div>
48
  }
49
  if(isset($_POST['ga_EC'])){
50
  update_option('ga_EC', sanitize_text_field($_POST['ga_EC']) );
 
51
  }else{
52
  update_option('ga_EC', 0);
 
53
  }
54
  if(isset($_POST['ee_conversio_send_to'])){
55
  update_option('ee_conversio_send_to', sanitize_text_field($_POST['ee_conversio_send_to']) );
189
  </div>
190
  </div>
191
  </div>
192
+ <div class="form-group google_ads_conversion_sec" id="google_ads_conversion_sec">
193
+ <?php $ga_EC = get_option("ga_EC"); ?>
194
  <div class="col-md-12">
195
  <div class="form-group">
196
  <div class="tvc-custom-control tvc-custom-checkbox">
197
+ <input type="checkbox" class="tvc-custom-control-input" id="ga_EC" name="ga_EC" value="1"<?php if(!empty($ga_EC)){ echo (esc_attr($ga_EC) == 1) ? 'checked="checked"' : '';}?> <?php if($googleDetail->google_ads_conversion_tracking!=1){ echo 'disabled'; } ?>>
198
  <label for="ga_EC"><?php esc_html_e("Enable Google Ads Enhanced Conversion tracking","conversios"); ?>
199
  </label>
200
  </div>
public/class-enhanced-ecommerce-google-analytics-public-pro.php CHANGED
@@ -589,6 +589,7 @@ class Enhanced_Ecommerce_Google_Analytics_Public {
589
  }
590
  //add remarketing snippets
591
  if($this->ads_tracking_id && ( $this->ads_ert || $this->ads_edrt || $this->ga_EC )){
 
592
  ?>
593
  <script async src="https://www.googletagmanager.com/gtag/js?id=<?php echo esc_js($this->remarketing_snippet_id); ?>">
594
  </script>
@@ -596,7 +597,7 @@ class Enhanced_Ecommerce_Google_Analytics_Public {
596
  window.dataLayer = window.dataLayer || [];
597
  function gtag(){dataLayer.push(arguments);}
598
  gtag('js', new Date());
599
- gtag('config','<?php echo esc_js($this->remarketing_snippet_id); ?>', {'allow_enhanced_conversions':true});
600
  </script>
601
  <?php
602
  }
@@ -605,13 +606,17 @@ class Enhanced_Ecommerce_Google_Analytics_Public {
605
  global $current_user;
606
  wp_get_current_user();
607
  $enhanced_conversion = array();
 
 
608
  $phone = get_user_meta($current_user->ID,'billing_phone',true);
609
  if($phone != ""){
610
- $enhanced_conversion["phone_number"] = $phone;
 
 
611
  }
612
  $email = esc_js($current_user->user_email);
613
  if($email != ""){
614
- $enhanced_conversion["email"] = $email;
615
  }
616
  $first_name = esc_js($current_user->user_firstname);
617
  if($first_name != ""){
@@ -672,13 +677,17 @@ class Enhanced_Ecommerce_Google_Analytics_Public {
672
  $order = new WC_Order($order_id);
673
  }
674
  $enhanced_conversion = array();
 
 
675
  $billing_email = $order->get_billing_email();
676
  if($billing_email != ""){
677
  $enhanced_conversion["email"] = esc_js($billing_email);
678
  }
679
  $billing_phone = $order->get_billing_phone();
680
  if($billing_phone != ""){
681
- $enhanced_conversion["phone"] = esc_js($billing_phone);
 
 
682
  }
683
  $billing_first_name = $order->get_billing_first_name();
684
  if($billing_first_name != ""){
589
  }
590
  //add remarketing snippets
591
  if($this->ads_tracking_id && ( $this->ads_ert || $this->ads_edrt || $this->ga_EC )){
592
+ if($this->ga_EC){$this->allow_enhanced_conversions = "true";}else{$this->allow_enhanced_conversions = "false";}
593
  ?>
594
  <script async src="https://www.googletagmanager.com/gtag/js?id=<?php echo esc_js($this->remarketing_snippet_id); ?>">
595
  </script>
597
  window.dataLayer = window.dataLayer || [];
598
  function gtag(){dataLayer.push(arguments);}
599
  gtag('js', new Date());
600
+ gtag('config','<?php echo esc_js($this->remarketing_snippet_id); ?>', {'allow_enhanced_conversions':'<?php echo esc_js($this->allow_enhanced_conversions); ?>'});
601
  </script>
602
  <?php
603
  }
606
  global $current_user;
607
  wp_get_current_user();
608
  $enhanced_conversion = array();
609
+ $billing_country = WC()->customer->get_billing_country();
610
+ $calling_code = WC()->countries->get_country_calling_code($billing_country);
611
  $phone = get_user_meta($current_user->ID,'billing_phone',true);
612
  if($phone != ""){
613
+ $phone = str_replace($calling_code,"", $phone);
614
+ $phone = $calling_code.$phone;
615
+ $enhanced_conversion["phone_number"] = esc_js($phone);
616
  }
617
  $email = esc_js($current_user->user_email);
618
  if($email != ""){
619
+ $enhanced_conversion["email"] = esc_js($email);
620
  }
621
  $first_name = esc_js($current_user->user_firstname);
622
  if($first_name != ""){
677
  $order = new WC_Order($order_id);
678
  }
679
  $enhanced_conversion = array();
680
+ $billing_country = $order->get_billing_country();
681
+ $calling_code = WC()->countries->get_country_calling_code($billing_country);
682
  $billing_email = $order->get_billing_email();
683
  if($billing_email != ""){
684
  $enhanced_conversion["email"] = esc_js($billing_email);
685
  }
686
  $billing_phone = $order->get_billing_phone();
687
  if($billing_phone != ""){
688
+ $billing_phone = str_replace($calling_code,"", $billing_phone);
689
+ $billing_phone = $calling_code.$billing_phone;
690
+ $enhanced_conversion["phone_number"] = esc_js($billing_phone);
691
  }
692
  $billing_first_name = $order->get_billing_first_name();
693
  if($billing_first_name != ""){
readme.txt CHANGED
@@ -8,8 +8,8 @@ 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.4
12
- Version: 4.8.4
13
  License: GPLv3
14
  License URI: http://www.gnu.org/licenses/gpl-3.0.html
15
 
@@ -416,6 +416,9 @@ In GA3 (Universal Analytics) usually, it takes 0 to 45 mins and in GA4 it can ta
416
 
417
 
418
  == Changelog ==
 
 
 
419
 
420
  = 4.8.4 - 21/07/2022 =
421
  * Fix: Code optimization in terms of Google ads Conversion tracking.
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.5
12
+ Version: 4.8.5
13
  License: GPLv3
14
  License URI: http://www.gnu.org/licenses/gpl-3.0.html
15
 
416
 
417
 
418
  == Changelog ==
419
+ = 4.8.5 - 03/08/2022 =
420
+ * Optimization in code pretaining to Enhanced Conversions and GA4 dashboard time out issue.
421
+ * Network site compatibility enabled.
422
 
423
  = 4.8.4 - 21/07/2022 =
424
  * Fix: Code optimization in terms of Google ads Conversion tracking.