Enhanced Ecommerce Google Analytics Plugin for WooCommerce - Version 4.8.2

Version Description

  • 12/07/2022 =
  • NEW: (PRO) You can also track your order refund in Google Analytics GA4 and GA3.
Download this release

Release Info

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

Code changes from version 4.8.1 to 4.8.2

admin/class-conversios-admin.php CHANGED
@@ -25,13 +25,19 @@ if ( ! class_exists( 'Conversios_Admin' ) ) {
25
  protected $google_detail;
26
  protected $url;
27
  protected $version;
 
28
  public function __construct() {
29
  $this->version = PLUGIN_TVC_VERSION;
30
  $this->includes();
31
  $this->url = $this->get_onboarding_page_url(); // use in setting page
32
  $this->google_detail = $this->get_ee_options_data();
33
  add_action( 'admin_menu', array( $this, 'add_admin_pages' ) );
34
- add_action('admin_init',array($this, 'init'));
 
 
 
 
 
35
  }
36
  public function includes() {
37
  if (!class_exists('Conversios_Header')) {
@@ -46,6 +52,113 @@ if ( ! class_exists( 'Conversios_Admin' ) ) {
46
  add_action( 'admin_enqueue_scripts', array($this,'enqueue_styles'));
47
  add_action( 'admin_enqueue_scripts', array($this,'enqueue_scripts'));
48
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
49
 
50
  /**
51
  * Register the stylesheets for the admin area.
25
  protected $google_detail;
26
  protected $url;
27
  protected $version;
28
+ protected $plan_id;
29
  public function __construct() {
30
  $this->version = PLUGIN_TVC_VERSION;
31
  $this->includes();
32
  $this->url = $this->get_onboarding_page_url(); // use in setting page
33
  $this->google_detail = $this->get_ee_options_data();
34
  add_action( 'admin_menu', array( $this, 'add_admin_pages' ) );
35
+ add_action('admin_init',array($this, 'init'));
36
+ $this->plan_id = $this->get_plan_id();
37
+ if( in_array( 'woocommerce/woocommerce.php', apply_filters( 'active_plugins', get_option( 'active_plugins' ) ) ) && $this->plan_id != 1 ) {
38
+ add_action( 'woocommerce_order_fully_refunded', array($this,'action_woocommerce_order_refunded'),10,2 );
39
+ add_action( 'woocommerce_order_partially_refunded', array($this,'woocommerce_partial_order_refunded'),10,2 );
40
+ }
41
  }
42
  public function includes() {
43
  if (!class_exists('Conversios_Header')) {
52
  add_action( 'admin_enqueue_scripts', array($this,'enqueue_styles'));
53
  add_action( 'admin_enqueue_scripts', array($this,'enqueue_scripts'));
54
  }
55
+
56
+ /**
57
+ * Woo Full order refund.
58
+ *
59
+ * @since 1.0.0
60
+ */
61
+ public function action_woocommerce_order_refunded($order_id, $refund_id) {
62
+ $data = unserialize(get_option('ee_options'));
63
+ if (empty($data['ga_eeT']) ||
64
+ get_post_meta($order_id, "tvc_tracked_refund", true) == 1 || $this->plan_id == 1){
65
+ return;
66
+ }
67
+ $refund = wc_get_order( $refund_id );
68
+ $value = $refund->get_amount();
69
+ $query = urlencode( '/refundorders/' );
70
+ $currency = $this->get_woo_currency();
71
+ $client_id =mt_rand(1000000000,9999999999).".".time();
72
+ $ga_id = $data['ga_id'];
73
+ $total_refunds = 0;
74
+ if($ga_id){
75
+ $url = "https://www.google-analytics.com/collect?v=1&t=event&ni=1&cu=".$currency."&ec=Enhanced-Ecommerce&ea=click&el=full_refund&tid=".$ga_id."&cid=".$client_id."&ti=".$order_id."&pa=refund&tr=".$value."&dp=".$query;
76
+ $request = wp_remote_get(esc_url_raw($url),array( 'timeout' => 1000 ));
77
+ }
78
+ $gm_id = sanitize_text_field($data['gm_id']);
79
+ $api_secret = sanitize_text_field($data['ga4_api_secret']);
80
+ if($gm_id && $api_secret){
81
+ $postData = array(
82
+ "client_id"=> $client_id,
83
+ "non_personalized_ads" => true,
84
+ "events" => [array(
85
+ "name" => "refund",
86
+ "params" => array(
87
+ "currency" => $currency,
88
+ "transaction_id" => $order_id,
89
+ "value" => $value
90
+ )
91
+ )]
92
+ );
93
+ $args = array(
94
+ 'method' => 'POST',
95
+ 'body' => wp_json_encode($postData)
96
+ );
97
+ $url = "https://www.google-analytics.com/mp/collect?measurement_id=".$gm_id."&api_secret=".$api_secret;
98
+ $request = wp_remote_post(esc_url_raw($url),$args);
99
+ }
100
+ update_post_meta($order_id, "tvc_tracked_refund", 1);
101
+ }
102
+
103
+ /**
104
+ * Woo Partial order refund.
105
+ *
106
+ * @since 1.0.0
107
+ */
108
+ public function woocommerce_partial_order_refunded($order_id, $refund_id) {
109
+ $data = unserialize(get_option('ee_options'));
110
+ if (empty($data['ga_eeT']) || $this->plan_id == 1){
111
+ return;
112
+ }
113
+ $refund = wc_get_order( $refund_id );
114
+ $value = $refund->get_amount();
115
+ $refunded_items = array();
116
+ $currency = $this->get_woo_currency();
117
+ $client_id =mt_rand(1000000000,9999999999).".".time();
118
+ $query_params = array();
119
+ $i = 1;
120
+ //GA3
121
+ $ga_id = $data['ga_id'];
122
+ if($ga_id){
123
+ foreach($refund->get_items('line_item') as $item_id=>$item) {
124
+ $query_params["pr{$i}id"] = $item['product_id'];
125
+ $query_params["pr{$i}qt"] = abs($item['qty']);
126
+ $query_params["pr{$i}pr"] = abs($item['total']);
127
+ $i++;
128
+ }
129
+ $param_url = http_build_query( $query_params, '', '&' );
130
+ $url = "https://www.google-analytics.com/collect?v=1&t=event&ni=1&cu=".$currency."&ec=Enhanced-Ecommerce&ea=Refund&el=partial_refunded&tid=".sanitize_text_field($ga_id)."&cid=".$client_id."&tr=".$value."&ti=".$order_id."&pa=refund&".$param_url;
131
+ $request = wp_remote_get(esc_url_raw($url),array( 'timeout' => 1000 ));
132
+ }
133
+ //GA4
134
+ $gm_id = sanitize_text_field($data['gm_id']);
135
+ $api_secret = sanitize_text_field($data['ga4_api_secret']);
136
+ if($gm_id && $api_secret){
137
+ $items = array();
138
+ foreach($refund->get_items('line_item') as $item_id=>$item) {
139
+ $items[] = array("item_id" => $item['product_id'],"item_name" => $item['name'],"quantity" => abs($item['qty']),"price" => abs($item['total']),"currency" => $currency);
140
+ }
141
+ $postData = array(
142
+ "client_id"=> $client_id,
143
+ "non_personalized_ads" => true,
144
+ "events" => [array(
145
+ "name" => "refund",
146
+ "params" => array(
147
+ "items" => $items,
148
+ "currency" => $currency,
149
+ "transaction_id" => $order_id,
150
+ "value" => $value
151
+ )
152
+ )]
153
+ );
154
+ $args = array(
155
+ 'method' => 'POST',
156
+ 'body' => wp_json_encode($postData)
157
+ );
158
+ $url = "https://www.google-analytics.com/mp/collect?measurement_id=".$gm_id."&api_secret=".$api_secret;
159
+ $request = wp_remote_post(esc_url_raw($url),$args);
160
+ }
161
+ }
162
 
163
  /**
164
  * Register the stylesheets for the admin area.
admin/class-tvc-admin-helper.php CHANGED
@@ -52,7 +52,8 @@ Class TVC_Admin_Helper{
52
  add_filter('sanitize_option_ee_prod_mapped_cats', array($this, 'sanitize_option_ee_general'), 10, 2);
53
  add_filter('sanitize_option_ee_prod_mapped_attrs', array($this, 'sanitize_option_ee_general'), 10, 2);
54
 
55
- add_filter( 'sanitize_post_meta__tracked', array($this, 'sanitize_meta_ee_number'));
 
56
  }
57
 
58
  public function sanitize_meta_ee_number($value){
@@ -108,13 +109,16 @@ Class TVC_Admin_Helper{
108
  }
109
  if( version_compare($ee_p_version , PLUGIN_TVC_VERSION, ">=")){
110
  return;
 
 
111
  }
112
  if(!isset($ee_additional_data['ee_p_version']) || empty($ee_additional_data)){
113
  $ee_additional_data = array();
114
  }
 
115
  $ee_additional_data['ee_p_version'] = PLUGIN_TVC_VERSION;
116
  $this->set_ee_additional_data($ee_additional_data);
117
- $this->update_app_status();
118
  }
119
  /*
120
  * verstion auto updated
52
  add_filter('sanitize_option_ee_prod_mapped_cats', array($this, 'sanitize_option_ee_general'), 10, 2);
53
  add_filter('sanitize_option_ee_prod_mapped_attrs', array($this, 'sanitize_option_ee_general'), 10, 2);
54
 
55
+ add_filter( 'sanitize_post_meta__tracked', array($this, 'sanitize_meta_ee_number'));
56
+ add_filter('sanitize_option_tvc_tracked_refund', array($this, 'sanitize_option_ee_general'), 10, 2);
57
  }
58
 
59
  public function sanitize_meta_ee_number($value){
109
  }
110
  if( version_compare($ee_p_version , PLUGIN_TVC_VERSION, ">=")){
111
  return;
112
+ }else{
113
+ $this->update_app_status();
114
  }
115
  if(!isset($ee_additional_data['ee_p_version']) || empty($ee_additional_data)){
116
  $ee_additional_data = array();
117
  }
118
+
119
  $ee_additional_data['ee_p_version'] = PLUGIN_TVC_VERSION;
120
  $this->set_ee_additional_data($ee_additional_data);
121
+
122
  }
123
  /*
124
  * verstion auto updated
admin/css/style.css CHANGED
@@ -391,6 +391,11 @@ button:disabled,button[disabled], button:disabled:hover,button[disabled]:hover{b
391
  -webkit-user-select: none;
392
  cursor: pointer;
393
  margin-bottom: 6px;
 
 
 
 
 
394
  }
395
 
396
  .tvc-dropdown-content .tvc-select-items .option:hover, .tvc-dropdown-content .tvc-select-items option:hover, .tvc-dropdown-content .option:hover{
391
  -webkit-user-select: none;
392
  cursor: pointer;
393
  margin-bottom: 6px;
394
+ white-space: normal; /* collapse WS, wrap as necessary, collapse LB */
395
+ white-space: nowrap; /* collapse WS, no wrapping, collapse LB */
396
+ white-space: pre; /* preserve WS, no wrapping, preserve LB */
397
+ white-space: pre-wrap; /* preserve WS, wrap as necessary, preserve LB */
398
+ white-space: inherit; /* all as parent element */
399
  }
400
 
401
  .tvc-dropdown-content .tvc-select-items .option:hover, .tvc-dropdown-content .tvc-select-items option:hover, .tvc-dropdown-content .option:hover{
admin/helper/class-onboarding-helper.php CHANGED
@@ -320,6 +320,7 @@ if(!class_exists('Conversios_Onboarding_Helper')):
320
  $settings['ga_PrivacyPolicy'] = 'on';
321
  $settings['google-analytic'] = '';
322
  $settings['fb_pixel_id'] = isset($old_setting['fb_pixel_id'])?$old_setting['fb_pixel_id']:"";
 
323
  $settings['ga_CG'] = isset($old_setting['ga_CG'])?$old_setting['ga_CG']:"";
324
  $settings['ga_optimize_id'] = isset($old_setting['ga_optimize_id'])?$old_setting['ga_optimize_id']:"";
325
 
320
  $settings['ga_PrivacyPolicy'] = 'on';
321
  $settings['google-analytic'] = '';
322
  $settings['fb_pixel_id'] = isset($old_setting['fb_pixel_id'])?$old_setting['fb_pixel_id']:"";
323
+ $settings['ga4_api_secret'] = isset($old_setting['ga4_api_secret'])?$old_setting['ga4_api_secret']:"";
324
  $settings['ga_CG'] = isset($old_setting['ga_CG'])?$old_setting['ga_CG']:"";
325
  $settings['ga_optimize_id'] = isset($old_setting['ga_optimize_id'])?$old_setting['ga_optimize_id']:"";
326
 
admin/partials/general-fields.php CHANGED
@@ -37,6 +37,7 @@ if (isset($_POST['ee_submit_plugin'])) {
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
 
41
  $TVC_Admin_Helper->save_ee_options_settings($settings);
42
  $TVC_Admin_Helper->update_app_status();
@@ -189,6 +190,19 @@ if(isset($google_detail['setting'])){
189
  </label>
190
  </td>
191
  </tr>
 
 
 
 
 
 
 
 
 
 
 
 
 
192
  <tr>
193
  <th>
194
  <label class="align-middle" for= "ga_CG" ><?php esc_html_e("Content Grouping","conversios"); ?> <span class="tvc-pro"> (PRO)</span></label>
@@ -199,7 +213,7 @@ if(isset($google_detail['setting'])){
199
  if($plan_id==1){ $ga_CG ="";}?>
200
  <input type="checkbox" name="ga_CG" id="ga_CG" <?php if($plan_id==1){?> onclick="return false;"<?php } ?> <?php echo esc_attr($ga_CG);?> >
201
  <label class="custom-control-label" for="ga_CG"><?php esc_html_e("Add Code to enable content grouping","conversios"); ?> <i>(Optional)</i></label>
202
- <p class="description" style="text-align: justify;"><?php esc_html_e("Content grouping helps you group your web pages (content). To use this feature create Content Grouping in your GA as instructed in the","conversios"); ?> <a href="<?php echo esc_url_raw("https://conversios.io/help-center/Installation-Manual.pdf"); ?>" target="_blank"><?php esc_html_e("Installation Doc","conversios"); ?></a>.</p>
203
  </label>
204
  </td>
205
  </tr>
@@ -307,12 +321,12 @@ if(isset($google_detail['setting'])){
307
  </tr> */ ?>
308
  <tr>
309
  <th>
310
- <img style="height: 20px;" src="<?php echo esc_url_raw(ENHANCAD_PLUGIN_URL . "/admin/images/fb-icon.png"); ?>" > Facebook pixel ID
311
  </th>
312
  <td>
313
  <?php $fb_pixel_id = isset($data['fb_pixel_id'])?$data['fb_pixel_id']:""; ?>
314
  <input type="text" class="fromfiled" name="fb_pixel_id" id="fb_pixel_id" value="<?php echo esc_attr($fb_pixel_id); ?>">
315
- <small>The Facebook pixel ID looks like. 518896233175751</small>
316
  </td>
317
  </tr>
318
  <tr>
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();
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>
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>
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>
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.1
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.5.0
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.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.8.2
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.6.1
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.2' );
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
@@ -82,7 +82,8 @@ class CustomApi{
82
  $fb_pixel_enable = "0";
83
  if(isset($options['fb_pixel_id']) && $options['fb_pixel_id'] != ""){
84
  $fb_pixel_enable = "1";
85
- }
 
86
  $postData = array(
87
  "subscription_id" => $subscription_id,
88
  "domain" => esc_url_raw(get_site_url()),
@@ -93,6 +94,9 @@ class CustomApi{
93
  "app_verstion" => PLUGIN_TVC_VERSION,
94
  "domain" => esc_url_raw(get_site_url()),
95
  "update_date" => date("Y-m-d")
 
 
 
96
  )
97
  )
98
  );
82
  $fb_pixel_enable = "0";
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()),
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
  );
includes/setup/google-shopping-feed.php CHANGED
@@ -105,14 +105,14 @@ class GoogleShoppingFeed {
105
  $campaignSales = $campaignSales + esc_attr($campaign->sales);
106
  }
107
  if (count($campaigns_list) > 0) {
108
- $campaignConversions = $campaignConversions / count($campaigns_list);
109
  }
110
  }
111
  $campaignActive = (isset($googleDetail->google_ads_id) && esc_attr($googleDetail->google_ads_id) != "" ? esc_attr($campaignActive) : '0');
112
- $campaignCost = (isset($googleDetail->google_ads_id) && esc_attr($googleDetail->google_ads_id) != "" ? esc_attr($currency) . esc_attr($campaignCost) : '0');
113
  $campaignClicks = (isset($googleDetail->google_ads_id) && esc_attr($googleDetail->google_ads_id) != "" ? $campaignClicks : '0');
114
  $campaignConversions = (isset($googleDetail->google_ads_id) && esc_attr($googleDetail->google_ads_id) != "" ? esc_attr($campaignConversions) : '0');
115
- $campaignSales = (isset($googleDetail->google_ads_id) && esc_attr($googleDetail->google_ads_id) != "" ? esc_attr($currency) . esc_attr($campaignSales) : '0');
116
  }
117
  $last_api_sync_up = "";
118
  $date_formate=get_option('date_format')." ".get_option('time_format');
105
  $campaignSales = $campaignSales + esc_attr($campaign->sales);
106
  }
107
  if (count($campaigns_list) > 0) {
108
+ $campaignConversions = number_format($campaignConversions / count($campaigns_list),1);
109
  }
110
  }
111
  $campaignActive = (isset($googleDetail->google_ads_id) && esc_attr($googleDetail->google_ads_id) != "" ? esc_attr($campaignActive) : '0');
112
+ $campaignCost = (isset($googleDetail->google_ads_id) && esc_attr($googleDetail->google_ads_id) != "" ? esc_attr($currency) . esc_attr(number_format($campaignCost,1)) : '0');
113
  $campaignClicks = (isset($googleDetail->google_ads_id) && esc_attr($googleDetail->google_ads_id) != "" ? $campaignClicks : '0');
114
  $campaignConversions = (isset($googleDetail->google_ads_id) && esc_attr($googleDetail->google_ads_id) != "" ? esc_attr($campaignConversions) : '0');
115
+ $campaignSales = (isset($googleDetail->google_ads_id) && esc_attr($googleDetail->google_ads_id) != "" ? esc_attr($currency) . esc_attr(number_format($campaignSales,1)) : '0');
116
  }
117
  $last_api_sync_up = "";
118
  $date_formate=get_option('date_format')." ".get_option('time_format');
public/class-enhanced-ecommerce-google-analytics-public-pro.php CHANGED
@@ -458,7 +458,7 @@ class Enhanced_Ecommerce_Google_Analytics_Public {
458
  <script src="https://www.googleoptimize.com/optimize.js?id=<?php echo esc_js($this->ga_optimize_id); ?>"></script>
459
  <!--Conversios.io – Google optimize end-->
460
  <?php } ?>
461
- <script type="text/javascript" defer="defer">
462
  var adsTringId = '<?php echo esc_js($this->ads_tracking_id); ?>';
463
  var ads_ert = '<?php echo esc_js($this->ads_ert); ?>';
464
  var ads_edrt = '<?php echo esc_js($this->ads_edrt)?>';
458
  <script src="https://www.googleoptimize.com/optimize.js?id=<?php echo esc_js($this->ga_optimize_id); ?>"></script>
459
  <!--Conversios.io – Google optimize end-->
460
  <?php } ?>
461
+ <script type="text/javascript">
462
  var adsTringId = '<?php echo esc_js($this->ads_tracking_id); ?>';
463
  var ads_ert = '<?php echo esc_js($this->ads_ert); ?>';
464
  var ads_edrt = '<?php echo esc_js($this->ads_edrt)?>';
public/class-enhanced-ecommerce-google-analytics-public.php CHANGED
@@ -333,7 +333,7 @@ class Enhanced_Ecommerce_Google_Analytics_Public {
333
  } else {
334
  $ga_ip_anonymization ="";
335
  } ?>
336
- <script type="text/javascript" defer="defer">
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); ?>';
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); ?>';
readme.txt CHANGED
@@ -8,8 +8,8 @@ Author: Conversios
8
  Requires at least: 3.5.0
9
  Tested up to: 6.0
10
  Requires PHP: 5.6 or Higher
11
- Stable tag: 4.8.1
12
- Version: 4.8.1
13
  License: GPLv3
14
  License URI: http://www.gnu.org/licenses/gpl-3.0.html
15
 
@@ -193,6 +193,7 @@ Enhanced eCommerce Google analytics plugin tracks the entire user journey on you
193
  * CRO consultation (Boost your eCommerce conversation with proven hypothesis) (Paid)
194
  * Customization as per your requirements(Paid)
195
  * Facebook Pixel Conversion Tracking
 
196
  <strong><a target="_blank" href="https://conversios.io/?utm_source=EE+Plugin+WordPress+Listing&utm_medium=Reach+out+to+us+with+your+query+Link&utm_campaign=Raise+query+at+Conversios#wpforms-form-11056">Reach out to us with your query here for a faster solution.</a></strong>
197
 
198
 
@@ -404,6 +405,9 @@ You can resolve the duplication of data by removing the manually implemented GA
404
 
405
 
406
  == Changelog ==
 
 
 
407
  = 4.8.1 - 21/06/2022 =
408
  * Fix: In this release, optimzation of code in terms of Pmax Campaign.
409
 
8
  Requires at least: 3.5.0
9
  Tested up to: 6.0
10
  Requires PHP: 5.6 or Higher
11
+ Stable tag: 4.8.2
12
+ Version: 4.8.2
13
  License: GPLv3
14
  License URI: http://www.gnu.org/licenses/gpl-3.0.html
15
 
193
  * CRO consultation (Boost your eCommerce conversation with proven hypothesis) (Paid)
194
  * Customization as per your requirements(Paid)
195
  * Facebook Pixel Conversion Tracking
196
+ * Order refund tracking for Google Analytics GA4 and GA3
197
  <strong><a target="_blank" href="https://conversios.io/?utm_source=EE+Plugin+WordPress+Listing&utm_medium=Reach+out+to+us+with+your+query+Link&utm_campaign=Raise+query+at+Conversios#wpforms-form-11056">Reach out to us with your query here for a faster solution.</a></strong>
198
 
199
 
405
 
406
 
407
  == Changelog ==
408
+ = 4.8.2 - 12/07/2022 =
409
+ * NEW: (PRO) You can also track your order refund in Google Analytics GA4 and GA3.
410
+
411
  = 4.8.1 - 21/06/2022 =
412
  * Fix: In this release, optimzation of code in terms of Pmax Campaign.
413