Enhanced Ecommerce Google Analytics Plugin for WooCommerce - Version 4.6.8

Version Description

  • 17/03/2022 =
  • New: In this release, we have add GA4 dashboard with important e-commerce reports.
Download this release

Release Info

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

Code changes from version 4.6.7 to 4.6.8

admin/css/style.css CHANGED
@@ -2,6 +2,26 @@
2
  @import url('https://fonts.googleapis.com/css2?family=Roboto:ital,wght@0,400;0,500;0,700;1,500&display=swap');
3
  /*rc */
4
  /* 11 */
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
5
  select#tvc_conversion_tracking_type{
6
  border: 1px solid #C6C6C6;
7
  border-radius: 6px;
@@ -1093,7 +1113,7 @@ button:disabled,button[disabled], button:disabled:hover,button[disabled]:hover{b
1093
  .blueupgrdbtn:hover {color:#fff;}
1094
  .shop-category .form-label-control small{display: inline-block;}
1095
  .tvc-sync-progress-gmc{display: none;}
1096
- .ecomchartinfoitem::first-child {padding-left: 0;}
1097
  .chartpercarrow{ padding: 9px 0px 9px 2px; right: 12px;}
1098
  .navinfotopnav .navinfonavtext{line-height: 24px;}
1099
  .container-fluid{padding: 5px 15px;}
2
  @import url('https://fonts.googleapis.com/css2?family=Roboto:ital,wght@0,400;0,500;0,700;1,500&display=swap');
3
  /*rc */
4
  /* 11 */
5
+ /*dasboard*/
6
+ .ga_swatch{
7
+ flex: 1;
8
+ display: flex;
9
+ justify-content: flex-start;
10
+ align-items: center;
11
+ }
12
+ .ga_swatch span{
13
+ margin: 0 10px 0px 0px;
14
+ line-height: 24px;
15
+ font-size: 14px;
16
+ font-weight: 500;
17
+ color: #515151;
18
+ cursor: pointer;
19
+ }
20
+ .ga_swatch span.active{
21
+ color: #002BFC;
22
+ border-bottom: 1px solid;
23
+ }
24
+ /*dasboard*/
25
  select#tvc_conversion_tracking_type{
26
  border: 1px solid #C6C6C6;
27
  border-radius: 6px;
1113
  .blueupgrdbtn:hover {color:#fff;}
1114
  .shop-category .form-label-control small{display: inline-block;}
1115
  .tvc-sync-progress-gmc{display: none;}
1116
+ .ecomchartinfoitem:first-child {padding-left: 0;}
1117
  .chartpercarrow{ padding: 9px 0px 9px 2px; right: 12px;}
1118
  .navinfotopnav .navinfonavtext{line-height: 24px;}
1119
  .container-fluid{padding: 5px 15px;}
admin/helper/class-dashboard-helper.php CHANGED
@@ -117,6 +117,7 @@ if(!class_exists('Conversios_Dashboard_Helper')){
117
  $ga_traking_type = sanitize_text_field(isset($post_data->ga_traking_type)?$post_data->ga_traking_type:"");
118
  $subscription_id = sanitize_text_field(isset($post_data->subscription_id)?$post_data->subscription_id:"");
119
  $view_id = sanitize_text_field(isset($post_data->view_id)?$post_data->view_id:"");
 
120
 
121
  $start_date = str_replace(' ', '',(isset($_POST['start_date']))?sanitize_text_field($_POST['start_date']):"");
122
  if($start_date != ""){
@@ -134,15 +135,38 @@ if(!class_exists('Conversios_Dashboard_Helper')){
134
  $start_date = sanitize_text_field($start_date);
135
  $end_date = sanitize_text_field($end_date);
136
  $return = array();
137
- if($subscription_id != "" && $view_id !="" &&( $ga_traking_type == "UA" || $ga_traking_type == "BOTH" )){
138
- $data = array(
139
- 'subscription_id'=>sanitize_text_field($subscription_id),
140
- 'view_id'=>sanitize_text_field($view_id),
141
- 'start_date'=>$start_date,
142
- 'end_date'=>$end_date
143
- );
144
 
145
- $api_rs = $this->CustomApi->get_google_analytics_reports($data);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
146
  if(isset($api_rs->error) && $api_rs->error == '') {
147
  if(isset($api_rs->data) && $api_rs->data != ""){
148
  $return = array('error'=>false, 'data'=>$api_rs->data,'errors'=>'');
@@ -151,7 +175,7 @@ if(!class_exists('Conversios_Dashboard_Helper')){
151
  $return = array('error'=>true,'errors'=>$api_rs->message);
152
  }
153
  }else if($subscription_id != "" && ( $ga_traking_type == "GA4" || $ga_traking_type == "BOTH" )){
154
- $return = array('error'=>true,'errors'=>esc_html__("GA4 Coming soon...","conversios"));
155
  }
156
  }else{
157
  $return = array('error'=>true,'errors'=>esc_html__("Admin security nonce is not verified.","conversios"));
117
  $ga_traking_type = sanitize_text_field(isset($post_data->ga_traking_type)?$post_data->ga_traking_type:"");
118
  $subscription_id = sanitize_text_field(isset($post_data->subscription_id)?$post_data->subscription_id:"");
119
  $view_id = sanitize_text_field(isset($post_data->view_id)?$post_data->view_id:"");
120
+ $ga4_property_id = sanitize_text_field(isset($post_data->property_id)?$post_data->property_id:"");
121
 
122
  $start_date = str_replace(' ', '',(isset($_POST['start_date']))?sanitize_text_field($_POST['start_date']):"");
123
  if($start_date != ""){
135
  $start_date = sanitize_text_field($start_date);
136
  $end_date = sanitize_text_field($end_date);
137
  $return = array();
138
+ if($subscription_id != "" && ( $ga_traking_type == "UA" || $ga_traking_type == "GA4" ||$ga_traking_type == "BOTH" )){
139
+
 
 
 
 
 
140
 
141
+ $ga_swatch = sanitize_text_field(isset($post_data->ga_swatch)?$post_data->ga_swatch:"ga3");
142
+
143
+ $api_rs = "";
144
+ if($ga_swatch == "ga3" || $ga_swatch == ""){
145
+ if($view_id !=""){
146
+ $data = array(
147
+ 'subscription_id'=>sanitize_text_field($subscription_id),
148
+ 'view_id'=>sanitize_text_field($view_id),
149
+ 'start_date'=>$start_date,
150
+ 'end_date'=>$end_date
151
+ );
152
+ $api_rs = $this->CustomApi->get_google_analytics_reports($data);
153
+ }else{
154
+ $return = array('error'=>true, 'errors'=>esc_html__("GA3 view id is not to be null","conversios"));
155
+ }
156
+ }else{
157
+ if( $ga4_property_id !="" ){
158
+ $data = array(
159
+ 'subscription_id'=>sanitize_text_field($subscription_id),
160
+ 'property_id'=>sanitize_text_field($ga4_property_id),
161
+ 'start_date'=>$start_date,
162
+ 'end_date'=>$end_date
163
+ );
164
+ $api_rs = $this->CustomApi->get_google_analytics_reports_ga4($data);
165
+ }else{
166
+ $return = array('error'=>true, 'errors'=>esc_html__("GA4 property id is not to be null","conversios"));
167
+ }
168
+ }
169
+
170
  if(isset($api_rs->error) && $api_rs->error == '') {
171
  if(isset($api_rs->data) && $api_rs->data != ""){
172
  $return = array('error'=>false, 'data'=>$api_rs->data,'errors'=>'');
175
  $return = array('error'=>true,'errors'=>$api_rs->message);
176
  }
177
  }else if($subscription_id != "" && ( $ga_traking_type == "GA4" || $ga_traking_type == "BOTH" )){
178
+ $return = array('error'=>true,'errors'=>esc_html__("GA tracking type is not to be null","conversios"));
179
  }
180
  }else{
181
  $return = array('error'=>true,'errors'=>esc_html__("Admin security nonce is not verified.","conversios"));
admin/js/tvc-ee-custom.js CHANGED
@@ -359,48 +359,96 @@ var tvc_helper = {
359
  var v_this = this;
360
  data = JSON.parse(data);
361
  //console.log(data);
 
 
 
 
362
  var basic_data = data.dashboard_data_point;
363
  var currency_code = post_data.ga_currency;
364
  var plugin_url = post_data.plugin_url;
365
- var s_1_div_id ={
366
- 'conversion_rate':{
367
- 'id':'transactionsPerSession',
368
- 'type':'rate'
369
- },'revenue':{
370
- 'id':'transactionRevenue',
371
- 'type':'currency'
372
- },'total_transactions':{
373
- 'id':'transactions',
374
- 'type':'number'
375
- },'avg_order_value':{
376
- 'id':'revenuePerTransaction',
377
- 'type':'currency'
378
- },'added_to_cart':{
379
- 'id':'productAddsToCart',
380
- 'type':'number'
381
- },'sessions':{
382
- 'id':'sessions',
383
- 'type':'number'
384
- },'users':{
385
- 'id':'users',
386
- 'type':'number'
387
- },'new_users':{
388
- 'id':'newUsers',
389
- 'type':'number'
390
- },'product_views':{
391
- 'id':'productDetailViews',
392
- 'type':'number'
393
- },'removed_from_cart':{
394
- 'id':'productRemovesFromCart',
395
- 'type':'number'
396
- },'transaction_shipping':{
397
- 'id':'transactionShipping',
398
- 'type':'currency'
399
- },'transaction_tax':{
400
- 'id':'transactionTax',
401
- 'type':'currency'
402
- }
403
- };
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
404
  var reports_typs = {
405
  basec_data:{
406
  is_free:true
@@ -445,19 +493,36 @@ var tvc_helper = {
445
  if(p_p_r != undefined && Object.keys(p_p_r).length > 0){
446
  $.each(p_p_r, function (propKey, propValue) {
447
  table_row = '';
448
- product_revenue_per = ((propValue['itemRevenue']*100)/basic_data.transactionRevenue).toFixed(1);
449
- if(product_revenue_per == 'NaN'){product_revenue_per = 0;}
450
- product_revenue_per = data
451
- table_row += '<tr><td class="prdnm-cell">'+propValue['productName']+'</td>';
452
- table_row += '<td>'+propValue['productDetailViews']+'</td>';
453
- table_row += '<td>'+propValue['productAddsToCart']+'</td>';
454
- table_row += '<td>'+propValue['uniquePurchases']+'</td>';
455
- table_row += '<td>'+propValue['itemQuantity']+'</td>';
456
- table_row += '<td>'+propValue['itemRevenue']+'<span class="tddshpertg"></span></td>';
457
- table_row += '<td>'+propValue['revenuePerItem']+'</td>';
458
- table_row += '<td>'+propValue['productRefundAmount']+'</td>';
459
- table_row += '<td>'+propValue['cartToDetailRate']+'%</td>';
460
- table_row += '<td>'+propValue['buyToDetailRate']+'%</td></tr>';
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
461
  jQuery("#product_performance_report table tbody").append(table_row);
462
  })
463
  }else{
@@ -471,24 +536,48 @@ var tvc_helper = {
471
  var table_row = '';
472
 
473
  $.each(m_p_r, function (propKey, propValue) {
474
- table_row = '';
475
- table_row += '<tr><td class="prdnm-cell">'+((propValue["medium"]!=undefined)?propValue["medium"]:0)+'</td>';
476
- table_row += '<td>'+((propValue["transactionsPerSession"]!=undefined)?propValue["transactionsPerSession"]:0)+'</td>';
477
- table_row += '<td>'+((propValue["transactionRevenue"]!=undefined)?propValue["transactionRevenue"]:0)+'</td>';
478
- table_row += '<td>'+((propValue["transactions"]!=undefined)?propValue["transactions"]:0)+'</td>';
479
- table_row += '<td>'+((propValue["revenuePerTransaction"]!=undefined)?propValue["revenuePerTransaction"]:0)+'</td>';
480
- table_row += '<td>'+((propValue["productAddsToCart"]!=undefined)?propValue["productAddsToCart"]:0)+'</td>';
481
- table_row += '<td>'+((propValue["productRemovesFromCart"]!=undefined)?propValue["productRemovesFromCart"]:0)+'</td>';
482
- table_row += '<td>'+((propValue["productDetailViews"]!=undefined)?propValue["productDetailViews"]:0)+'</td>';
483
- table_row += '<td>'+((propValue["users"]!=undefined)?propValue["users"]:0)+'</td>';
484
- table_row += '<td>'+((propValue["sessions"]!=undefined)?propValue["sessions"]:0)+'</td></tr>';
 
 
 
 
 
 
 
 
 
 
 
 
 
485
  jQuery("#medium_performance_report table tbody").append(table_row);
486
  })
487
  }
488
  if(reports_typs.conversion_funnel.is_free || paln_type == 'paid'){
489
- if(Object.keys(data.ecommerce_funnel).length >1){
490
- this.set_ecommerce_conversion_funnel(basic_data,data.ecommerce_funnel.shoppingStage);
491
- this.set_ecommerce_checkout_funnel(data.ecommerce_funnel.shoppingStage);
 
 
 
 
 
 
 
 
 
 
 
492
  }else{
493
  jQuery(".conversion_s1, .conversion_s2, .conversion_s3, .conversion_s4, .checkoutfunn_s1, .checkoutfunn_s2, .checkoutfunn_s3").html("");
494
  }
@@ -694,6 +783,9 @@ var tvc_helper = {
694
  },
695
  display_field_val:function(div_id, field, field_val, field_type, currency_code, plugin_url){
696
  if(field_type == "currency"){
 
 
 
697
  var currency = this.get_currency_symbols(currency_code);
698
  jQuery(div_id).html(currency +''+field_val);
699
  }else if(field_type == "rate"){
@@ -707,6 +799,10 @@ var tvc_helper = {
707
  }
708
  jQuery(div_id).html(img+field_val+'%');
709
  }else {
 
 
 
 
710
  jQuery(div_id).html(field_val);
711
  }
712
 
@@ -759,7 +855,7 @@ var tvc_helper = {
759
  var canvas = document.getElementById(propKey);
760
  if( canvas != null){
761
  var is_blank = v_this.is_canvas_blank(canvas);
762
- console.log(propValue+"-"+canvas+"-"+is_blank);
763
  if(!is_blank){
764
  chart_ids[propKey].destroy();
765
  }
359
  var v_this = this;
360
  data = JSON.parse(data);
361
  //console.log(data);
362
+ var ga_swatch = "ga3";
363
+ if(post_data.hasOwnProperty('ga_swatch')){
364
+ ga_swatch = post_data.ga_swatch;
365
+ }
366
  var basic_data = data.dashboard_data_point;
367
  var currency_code = post_data.ga_currency;
368
  var plugin_url = post_data.plugin_url;
369
+ var s_1_div_id = {};
370
+ if(ga_swatch == "ga3"){
371
+ s_1_div_id = {
372
+ 'conversion_rate':{
373
+ 'id':'transactionsPerSession',
374
+ 'type':'rate'
375
+ },'revenue':{
376
+ 'id':'transactionRevenue',
377
+ 'type':'currency'
378
+ },'total_transactions':{
379
+ 'id':'transactions',
380
+ 'type':'number'
381
+ },'avg_order_value':{
382
+ 'id':'revenuePerTransaction',
383
+ 'type':'currency'
384
+ },'added_to_cart':{
385
+ 'id':'productAddsToCart',
386
+ 'type':'number'
387
+ },'sessions':{
388
+ 'id':'sessions',
389
+ 'type':'number'
390
+ },'users':{
391
+ 'id':'users',
392
+ 'type':'number'
393
+ },'new_users':{
394
+ 'id':'newUsers',
395
+ 'type':'number'
396
+ },'product_views':{
397
+ 'id':'productDetailViews',
398
+ 'type':'number'
399
+ },'removed_from_cart':{
400
+ 'id':'productRemovesFromCart',
401
+ 'type':'number'
402
+ },'transaction_shipping':{
403
+ 'id':'transactionShipping',
404
+ 'type':'currency'
405
+ },'transaction_tax':{
406
+ 'id':'transactionTax',
407
+ 'type':'currency'
408
+ }
409
+ };
410
+ }else{
411
+ currency_code = data.currencyCode;
412
+ s_1_div_id = {
413
+ /*'conversion_rate':{
414
+ 'id':'transactionsPerSession',
415
+ 'type':'rate'
416
+ },*/'revenue':{
417
+ 'id':'totalRevenue',
418
+ 'type':'currency'
419
+ },'total_transactions':{
420
+ 'id':'transactions',
421
+ 'type':'number'
422
+ },'avg_order_value':{
423
+ 'id':'averagePurchaseRevenue',
424
+ 'type':'currency'
425
+ },'added_to_cart':{
426
+ 'id':'addToCarts',
427
+ 'type':'number'
428
+ },'sessions':{
429
+ 'id':'sessions',
430
+ 'type':'number'
431
+ },'users':{
432
+ 'id':'totalUsers',
433
+ 'type':'number'
434
+ },'new_users':{
435
+ 'id':'newUsers',
436
+ 'type':'number'
437
+ },'product_views':{
438
+ 'id':'itemViews',
439
+ 'type':'number'
440
+ }/*,'removed_from_cart':{
441
+ 'id':'productRemovesFromCart',
442
+ 'type':'number'
443
+ }*/,'transaction_shipping':{
444
+ 'id':'transactionShipping',
445
+ 'type':'currency'
446
+ },'transaction_tax':{
447
+ 'id':'transactionTax',
448
+ 'type':'currency'
449
+ }
450
+ };
451
+ }
452
  var reports_typs = {
453
  basec_data:{
454
  is_free:true
493
  if(p_p_r != undefined && Object.keys(p_p_r).length > 0){
494
  $.each(p_p_r, function (propKey, propValue) {
495
  table_row = '';
496
+ if(ga_swatch == "ga3"){
497
+ product_revenue_per = ((propValue['itemRevenue']*100)/basic_data.transactionRevenue).toFixed(1);
498
+ if(product_revenue_per == 'NaN'){product_revenue_per = 0;}
499
+ product_revenue_per = data
500
+ table_row += '<tr><td class="prdnm-cell">'+propValue['productName']+'</td>';
501
+ table_row += '<td>'+propValue['productDetailViews']+'</td>';
502
+ table_row += '<td>'+propValue['productAddsToCart']+'</td>';
503
+ table_row += '<td>'+propValue['uniquePurchases']+'</td>';
504
+ table_row += '<td>'+propValue['itemQuantity']+'</td>';
505
+ table_row += '<td>'+parseFloat(propValue['itemRevenue']).toFixed(2)+'<span class="tddshpertg"></span></td>';
506
+ table_row += '<td>'+propValue['revenuePerItem']+'</td>';
507
+ table_row += '<td>'+propValue['productRefundAmount']+'</td>';
508
+ table_row += '<td>'+propValue['cartToDetailRate']+'%</td>';
509
+ table_row += '<td>'+propValue['buyToDetailRate']+'%</td></tr>';
510
+ }else{
511
+ jQuery(".ga_currency_symbols").html(v_this.get_currency_symbols(currency_code));
512
+ product_revenue_per = ((propValue['itemRevenue']*100)/basic_data.transactionRevenue).toFixed(1);
513
+ if(product_revenue_per == 'NaN'){product_revenue_per = 0;}
514
+ product_revenue_per = data
515
+ table_row += '<tr><td class="prdnm-cell">'+propValue['itemName']+'</td>';
516
+ table_row += '<td>'+propValue['itemViews']+'</td>';
517
+ table_row += '<td>'+propValue['addToCarts']+'</td>';
518
+ table_row += '<td>'+propValue['transactions']+'</td>';
519
+ table_row += '<td>'+propValue['itemPurchaseQuantity']+'</td>';
520
+ table_row += '<td>'+parseFloat(propValue['itemRevenue']).toFixed(2)+'</td>';
521
+ //table_row += '<td>'+propValue['revenuePerItem']+'</td>';
522
+ //table_row += '<td>'+propValue['productRefundAmount']+'</td>';
523
+ table_row += '<td>'+propValue['cartToViewRate']+'%</td>';
524
+ table_row += '<td>'+propValue['purchaseToViewRate']+'%</td></tr>';
525
+ }
526
  jQuery("#product_performance_report table tbody").append(table_row);
527
  })
528
  }else{
536
  var table_row = '';
537
 
538
  $.each(m_p_r, function (propKey, propValue) {
539
+ table_row = '';
540
+ if(ga_swatch == "ga3"){
541
+ table_row += '<tr><td class="prdnm-cell">'+((propValue["medium"]!=undefined)?propValue["medium"]:0)+'</td>';
542
+ table_row += '<td>'+((propValue["transactionsPerSession"]!=undefined)?propValue["transactionsPerSession"]:0)+'</td>';
543
+ table_row += '<td>'+((propValue["transactionRevenue"]!=undefined)?parseFloat(propValue["transactionRevenue"]).toFixed(2):0)+'</td>';
544
+ table_row += '<td>'+((propValue["transactions"]!=undefined)?propValue["transactions"]:0)+'</td>';
545
+ table_row += '<td>'+((propValue["revenuePerTransaction"]!=undefined)?parseFloat(propValue["revenuePerTransaction"]).toFixed(2):0)+'</td>';
546
+ table_row += '<td>'+((propValue["productAddsToCart"]!=undefined)?propValue["productAddsToCart"]:0)+'</td>';
547
+ table_row += '<td>'+((propValue["productRemovesFromCart"]!=undefined)?propValue["productRemovesFromCart"]:0)+'</td>';
548
+ table_row += '<td>'+((propValue["productDetailViews"]!=undefined)?propValue["productDetailViews"]:0)+'</td>';
549
+ table_row += '<td>'+((propValue["users"]!=undefined)?propValue["users"]:0)+'</td>';
550
+ table_row += '<td>'+((propValue["sessions"]!=undefined)?propValue["sessions"]:0)+'</td></tr>';
551
+ }else{
552
+ table_row += '<tr><td class="prdnm-cell">'+((propValue["medium"]!=undefined)?propValue["medium"]:0)+'</td>';
553
+ //table_row += '<td>'+((propValue["transactionsPerSession"]!=undefined)?propValue["transactionsPerSession"]:0)+'</td>';
554
+ table_row += '<td>'+((propValue["totalRevenue"]!=undefined)?parseFloat(propValue["totalRevenue"]).toFixed(2):0)+'</td>';
555
+ table_row += '<td>'+((propValue["transactions"]!=undefined)?propValue["transactions"]:0)+'</td>';
556
+ table_row += '<td>'+((propValue["averagePurchaseRevenue"]!=undefined)?parseFloat(propValue["averagePurchaseRevenue"]).toFixed(2):0)+'</td>';
557
+ table_row += '<td>'+((propValue["addToCarts"]!=undefined)?propValue["addToCarts"]:0)+'</td>';
558
+ //table_row += '<td>'+((propValue["productRemovesFromCart"]!=undefined)?propValue["productRemovesFromCart"]:0)+'</td>';
559
+ table_row += '<td>'+((propValue["itemViews"]!=undefined)?propValue["itemViews"]:0)+'</td>';
560
+ table_row += '<td>'+((propValue["totalUsers"]!=undefined)?propValue["totalUsers"]:0)+'</td>';
561
+ table_row += '<td>'+((propValue["sessions"]!=undefined)?propValue["sessions"]:0)+'</td></tr>';
562
+ }
563
  jQuery("#medium_performance_report table tbody").append(table_row);
564
  })
565
  }
566
  if(reports_typs.conversion_funnel.is_free || paln_type == 'paid'){
567
+ if(( data.hasOwnProperty('ecommerce_funnel') && Object.keys(data.ecommerce_funnel).length >1) || ga_swatch == "ga4"){
568
+ if(ga_swatch == "ga3"){
569
+ this.set_ecommerce_conversion_funnel(basic_data, data.ecommerce_funnel.shoppingStage);
570
+ this.set_ecommerce_checkout_funnel(data.ecommerce_funnel.shoppingStage);
571
+ }else{
572
+ let shoppingStage = {
573
+ ALL_VISITS:basic_data.totalUsers,
574
+ PRODUCT_VIEW:basic_data.itemViews,
575
+ ADD_TO_CART:basic_data.addToCarts,
576
+ CHECKOUT:basic_data.checkouts,
577
+ TRANSACTION:basic_data.transactions
578
+ };
579
+ this.set_ecommerce_conversion_funnel(basic_data,shoppingStage);
580
+ }
581
  }else{
582
  jQuery(".conversion_s1, .conversion_s2, .conversion_s3, .conversion_s4, .checkoutfunn_s1, .checkoutfunn_s2, .checkoutfunn_s3").html("");
583
  }
783
  },
784
  display_field_val:function(div_id, field, field_val, field_type, currency_code, plugin_url){
785
  if(field_type == "currency"){
786
+ if(Math.floor(field_val) != field_val){
787
+ field_val = parseFloat(field_val).toFixed(2);
788
+ }
789
  var currency = this.get_currency_symbols(currency_code);
790
  jQuery(div_id).html(currency +''+field_val);
791
  }else if(field_type == "rate"){
799
  }
800
  jQuery(div_id).html(img+field_val+'%');
801
  }else {
802
+ if(Math.floor(field_val) != field_val){
803
+ field_val = parseFloat(field_val).toFixed(2);
804
+ }
805
+
806
  jQuery(div_id).html(field_val);
807
  }
808
 
855
  var canvas = document.getElementById(propKey);
856
  if( canvas != null){
857
  var is_blank = v_this.is_canvas_blank(canvas);
858
+ //console.log(propValue+"-"+canvas+"-"+is_blank);
859
  if(!is_blank){
860
  chart_ids[propKey].destroy();
861
  }
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.6.7
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.6.7' );
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.6.8
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.6.8' );
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
@@ -94,7 +94,6 @@ class CustomApi{
94
  'body' => wp_json_encode($data)
95
  );
96
  $result = $this->tc_wp_remot_call_post(esc_url_raw($url), $args);
97
- //print_r($result);
98
  $return = new \stdClass();
99
  if($result->status == 200){
100
  $return->status = $result->status;
@@ -381,7 +380,6 @@ class CustomApi{
381
  'body' => wp_json_encode($postData)
382
  );
383
  $result = $this->tc_wp_remot_call_post(esc_url_raw($url), $args);
384
- //print_r($result);
385
  $return = new \stdClass();
386
  if($result->status == 200){
387
  $return->status = $result->status;
@@ -405,6 +403,84 @@ class CustomApi{
405
  }
406
  }
407
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
408
  public function setGmcCategoryMapping($postData) {
409
  try {
410
  if(!empty($postData)){
94
  'body' => wp_json_encode($data)
95
  );
96
  $result = $this->tc_wp_remot_call_post(esc_url_raw($url), $args);
 
97
  $return = new \stdClass();
98
  if($result->status == 200){
99
  $return->status = $result->status;
380
  'body' => wp_json_encode($postData)
381
  );
382
  $result = $this->tc_wp_remot_call_post(esc_url_raw($url), $args);
 
383
  $return = new \stdClass();
384
  if($result->status == 200){
385
  $return->status = $result->status;
403
  }
404
  }
405
 
406
+ /**
407
+ * @since 4.6.8
408
+ * Get google analytics reports call using reporting API
409
+ */
410
+ public function get_google_analytics_reports_ga4($postData) {
411
+ try {
412
+ if(!empty($postData)){
413
+ foreach ($postData as $key => $value) {
414
+ $postData[$key] = sanitize_text_field($value);
415
+ }
416
+ }
417
+ $url = $this->apiDomain . "/actionable-dashboard/google-analytics-reports-ga4";
418
+ $header = array(
419
+ "Authorization: Bearer MTIzNA==",
420
+ "Content-Type" => "application/json"
421
+ );
422
+ $access_token = $this->generateAccessToken($this->get_tvc_access_token(), $this->get_tvc_refresh_token());
423
+ if($access_token != ""){
424
+ $postData['access_token']= $access_token;
425
+ $args = array(
426
+ 'headers' =>$header,
427
+ 'method' => 'POST',
428
+ 'body' => wp_json_encode($postData)
429
+ );
430
+ $result = $this->tc_wp_remot_call_post(esc_url_raw($url), $args);
431
+ $return = new \stdClass();
432
+ if($result->status == 200){
433
+ $return->status = $result->status;
434
+ $return->data = $result->data;
435
+ $return->error = false;
436
+ return $return;
437
+ }else{
438
+ $return->error = true;
439
+ $return->data = $result->data;
440
+ $return->status = $result->status;
441
+ return $return;
442
+ }
443
+ }else{
444
+ $return = new \stdClass();
445
+ $return->error = true;
446
+ $return->message = 'access_token_error';
447
+ return $return;
448
+ }
449
+ } catch (Exception $e) {
450
+ return $e->getMessage();
451
+ }
452
+ }
453
+ /**
454
+ * @since 4.6.8
455
+ * Get Property ID for GA4 reporting API
456
+ */
457
+ public function analytics_get_ga4_property_id($postData) {
458
+ try {
459
+ if(!empty($postData)){
460
+ foreach ($postData as $key => $value) {
461
+ $postData[$key] = sanitize_text_field($value);
462
+ }
463
+ }
464
+ $header = array(
465
+ "Authorization: Bearer MTIzNA==",
466
+ "Content-Type" => "application/json"
467
+ );
468
+ $url = $this->apiDomain . "/actionable-dashboard/analytics-get-ga4-property-id";
469
+ $postData['access_token'] = $this->generateAccessToken($this->get_tvc_access_token(), $this->get_tvc_refresh_token());
470
+ $args = array(
471
+ 'headers' =>$header,
472
+ 'method' => 'POST',
473
+ 'body' => wp_json_encode($postData)
474
+ );
475
+ $request = wp_remote_post(esc_url_raw($url), $args);
476
+ $response_code = wp_remote_retrieve_response_code($request);
477
+ $response_message = wp_remote_retrieve_response_message($request);
478
+ return json_decode(wp_remote_retrieve_body($request));
479
+ } catch (Exception $e) {
480
+ return $e->getMessage();
481
+ }
482
+ }
483
+
484
  public function setGmcCategoryMapping($postData) {
485
  try {
486
  if(!empty($postData)){
includes/setup/class-conversios-dashboard.php CHANGED
@@ -16,6 +16,7 @@ if ( ! class_exists( 'Conversios_Dashboard' ) ) {
16
  protected $ga_currency;
17
  protected $ga_currency_symbols;
18
  protected $ga4_measurement_id;
 
19
  protected $ga4_property_id;
20
  protected $subscription_data;
21
  protected $plan_id=1;
@@ -28,8 +29,10 @@ if ( ! class_exists( 'Conversios_Dashboard' ) ) {
28
  protected $connect_url;
29
  protected $g_mail;
30
  protected $is_refresh_token_expire;
 
 
31
  public function __construct( ){
32
-
33
  $this->TVC_Admin_Helper = new TVC_Admin_Helper();
34
  $this->CustomApi = new CustomApi();
35
  $this->connect_url = $this->TVC_Admin_Helper->get_custom_connect_url(admin_url().'admin.php?page=conversios');
@@ -58,10 +61,19 @@ if ( ! class_exists( 'Conversios_Dashboard' ) ) {
58
  $this->ga_traking_type = $this->subscription_data->tracking_option; // UA,GA4,BOTH
59
  $this->ga3_property_id = $this->subscription_data->property_id; // GA3
60
  $this->ga3_ua_analytic_account_id = $this->subscription_data->ua_analytic_account_id;
 
 
 
61
  if($this->is_refresh_token_expire == false){
62
- $this->set_ga3_view_id_and_ga3_currency();
 
 
 
 
 
 
63
  }
64
- $this->ga4_measurement_id = $this->subscription_data->measurement_id; //GA4 ID
65
  }else{
66
  wp_redirect("admin.php?page=conversios_onboarding");
67
  exit;
@@ -82,13 +94,31 @@ if ( ! class_exists( 'Conversios_Dashboard' ) ) {
82
  public function init(){
83
 
84
  }
85
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
86
  public function set_ga3_view_id_and_ga3_currency(){
87
  if(isset($this->subscription_data->view_id) && isset($this->subscription_data->analytics_currency) && $this->subscription_data->view_id!="" && $this->subscription_data->analytics_currency!=""){
88
  $this->ga3_view_id = $this->subscription_data->view_id;
89
  $this->ga_currency = $this->subscription_data->analytics_currency;
90
- $this->ga_currency_symbols = $this->TVC_Admin_Helper->get_currency_symbols($this->ga_currency);
91
-
92
  }else{
93
  $data = array(
94
  "subscription_id" => sanitize_text_field($this->subscription_id),
@@ -102,7 +132,7 @@ if ( ! class_exists( 'Conversios_Dashboard' ) ) {
102
  $this->ga3_view_id = $data->view_id;
103
  $this->ga_currency = $data->analytics_currency;
104
  $this->ga_currency_symbols = $this->TVC_Admin_Helper->get_currency_symbols($this->ga_currency);
105
- $this->is_need_to_update_api_data_wp_db = true;
106
  }
107
  }
108
  }
@@ -130,12 +160,12 @@ if ( ! class_exists( 'Conversios_Dashboard' ) ) {
130
  if(notice != ""){
131
  tvc_helper.tvc_alert("error","Email error",notice);
132
  }
133
- var plan_id = '<?php echo esc_attr($this->plan_id); ?>';
134
  var g_mail = '<?php echo esc_attr($this->g_mail); ?>';
 
 
135
  var is_refresh_token_expire = '<?php echo esc_attr($this->is_refresh_token_expire); ?>';
136
  is_refresh_token_expire = (is_refresh_token_expire == "")?false:true;
137
- console.log(is_refresh_token_expire);
138
-
139
  var start = moment().subtract(30, 'days');
140
  var end = moment();
141
  function cb(start, end) {
@@ -150,9 +180,11 @@ if ( ! class_exists( 'Conversios_Dashboard' ) ) {
150
  action:'get_google_analytics_reports',
151
  subscription_id:'<?php echo esc_attr($this->subscription_id); ?>',
152
  plan_id:plan_id,
 
153
  ga_traking_type:'<?php echo esc_attr($this->ga_traking_type); ?>',
154
  view_id :'<?php echo esc_attr($this->ga3_view_id); ?>',
155
- ga4_property_id:'<?php echo esc_attr($this->ga4_property_id); ?>',
 
156
  ga_currency :'<?php echo esc_attr($this->ga_currency); ?>',
157
  plugin_url:'<?php echo esc_url_raw(ENHANCAD_PLUGIN_URL); ?>',
158
  start_date :jQuery.trim(start_date.replace(/\//g,"-")),
@@ -281,15 +313,23 @@ if ( ! class_exists( 'Conversios_Dashboard' ) ) {
281
  * @since 4.1.4
282
  */
283
  public function current_html(){
 
284
  ?>
285
  <div class="dashbrdpage-wrap">
286
  <div class="dflex align-items-center mt24 dshbrdtoparea">
 
 
 
 
 
 
 
 
287
  <div class="dashtp-left">
288
  <button class="dashtpleft-btn <?php echo esc_attr($this->add_upgrdsbrs_btn_calss('download_pdf')); ?>"><img src="<?php echo esc_url_raw(ENHANCAD_PLUGIN_URL.'/admin/images/download-icon.png'); ?>" alt="" /><?php esc_html_e("Download PDF","conversios"); ?></button>
289
  <button class="dashtpleft-btn <?php echo esc_attr($this->add_upgrdsbrs_btn_calss('schedule_email')); ?>"><img src="<?php echo esc_url_raw(ENHANCAD_PLUGIN_URL.'/admin/images/clock-icon.png'); ?>" alt="" /><?php esc_html_e("Schedule Email","conversios"); ?></button>
290
  </div>
291
  <div class="dashtp-right">
292
-
293
  <?php /*
294
  <div class="dshtprightselect">
295
  <select>
@@ -300,30 +340,31 @@ if ( ! class_exists( 'Conversios_Dashboard' ) ) {
300
  </div>*/ ?>
301
  <?php if($this->plan_id != 1){?>
302
  <div id="reportrange" class="dshtpdaterange" >
303
- <div class="dateclndicn">
304
- <img src="<?php echo esc_url_raw(ENHANCAD_PLUGIN_URL.'/admin/images/claendar-icon.png'); ?>" alt="" />
305
- </div>
306
- <span class="daterangearea report_range_val"></span>
307
- <div class="careticn"><img src="<?php echo esc_url_raw(ENHANCAD_PLUGIN_URL.'/admin/images/caret-down.png'); ?>" alt="" /></div>
308
  </div>
309
  <?php } else{ ?>
310
  <div class="dshtpdaterange <?php echo esc_attr($this->add_upgrdsbrs_btn_calss('download_pdf')); ?>">
311
- <div class="dateclndicn">
312
- <img src="<?php echo esc_url_raw(ENHANCAD_PLUGIN_URL.'/admin/images/claendar-icon.png'); ?>" alt="" />
313
- </div>
314
- <span class="daterangearea report_range_val"></span>
315
- <div class="careticn"><img src="<?php echo esc_url_raw(ENHANCAD_PLUGIN_URL.'/admin/images/caret-down.png'); ?>" alt="" /></div>
316
  </div>
317
  <?php }?>
318
 
319
  </div>
320
  </div>
321
- <?php if($this->ga_traking_type == "GA4"){?>
322
  <div class="temp_note"><p><?php esc_html_e("The reporting dashboard feature is only available for Google Analytics 3 properties currently. We are working on Google Analytics 4 dashboard, we will update you once it is live.","conversios"); ?></p></div>
323
- <?php } ?>
324
  <!--- dashboard summary section start -->
325
  <div class="wht-rnd-shdwbx mt24 dashsmry-wrap">
326
  <div class="dashsmry-item">
 
327
  <div class="dashsmrybx" id="s1_transactionsPerSession">
328
  <div class="dshsmrycattxt dash-smry-title"><?php esc_html_e("Conversion Rate","conversios"); ?></div>
329
  <div class="dshsmrylrgtxt dash-smry-value">-</div>
@@ -407,6 +448,78 @@ if ( ! class_exists( 'Conversios_Dashboard' ) ) {
407
  </div>
408
  <div class="dshsmryprdtxt"><?php esc_html_e("From Previous Period","conversios"); ?></div>
409
  </div>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
410
 
411
  </div>
412
  <?php /*
@@ -493,7 +606,7 @@ if ( ! class_exists( 'Conversios_Dashboard' ) ) {
493
  </div>
494
  <?php }?>
495
 
496
- <?php if($this->plan_id != 1){?>
497
  <div class="col50">
498
  <div class="chartbx ecomfunnchrtbx ecom-checkout-funn-chrt-bx">
499
  <div class="chartcntnbx">
@@ -526,7 +639,7 @@ if ( ! class_exists( 'Conversios_Dashboard' ) ) {
526
  </div>
527
  </div>
528
  </div>
529
- <?php }else{ ?>
530
  <div class="col50">
531
  <div class="chartbx ecomfunnchrtbx">
532
  <div class="chartcntnbx prochrtftr">
@@ -572,9 +685,11 @@ if ( ! class_exists( 'Conversios_Dashboard' ) ) {
572
  <th><?php esc_html_e("Added to Cart","conversios"); ?></th>
573
  <th><?php esc_html_e("Orders","conversios"); ?></th>
574
  <th><?php esc_html_e("Qty","conversios"); ?></th>
575
- <th><?php esc_html_e("Revenue","conversios"); ?> (<?php echo esc_attr($this->ga_currency_symbols); ?>)</th>
 
576
  <th><?php esc_html_e("Avg Price","conversios"); ?> (<?php echo esc_attr($this->ga_currency_symbols); ?>)</th>
577
  <th><?php esc_html_e("Refund Amount","conversios"); ?> (<?php echo esc_attr($this->ga_currency_symbols); ?>)</th>
 
578
  <th><?php esc_html_e("Cart to details (%)","conversios"); ?></th>
579
  <th><?php esc_html_e("Buy to details (%)","conversios"); ?></th>
580
  </tr>
@@ -627,12 +742,16 @@ if ( ! class_exists( 'Conversios_Dashboard' ) ) {
627
  <thead>
628
  <tr>
629
  <th class="prdnm-cell"><?php esc_html_e("Source/Medium","conversios"); ?></th>
630
- <th><?php esc_html_e("Conversion (%)","conversios"); ?></th>
631
- <th><?php esc_html_e("Revenue","conversios"); ?> (<?php echo esc_attr($this->ga_currency_symbols); ?>)</th>
 
 
632
  <th><?php esc_html_e("Total transactions","conversios"); ?></th>
633
- <th><?php esc_html_e("Avg Order value","conversios"); ?> (<?php echo esc_attr($this->ga_currency_symbols); ?>)</th>
634
  <th><?php esc_html_e("Added to carts","conversios"); ?></th>
635
- <th><?php esc_html_e("removed from cart","conversios"); ?></th>
 
 
636
  <th><?php esc_html_e("Product views","conversios"); ?></th>
637
  <th><?php esc_html_e("Users","conversios"); ?></th>
638
  <th><?php esc_html_e("Sessions","conversios"); ?></th>
16
  protected $ga_currency;
17
  protected $ga_currency_symbols;
18
  protected $ga4_measurement_id;
19
+ protected $ga4_analytic_account_id;
20
  protected $ga4_property_id;
21
  protected $subscription_data;
22
  protected $plan_id=1;
29
  protected $connect_url;
30
  protected $g_mail;
31
  protected $is_refresh_token_expire;
32
+
33
+ protected $ga_swatch;
34
  public function __construct( ){
35
+ $this->ga_swatch = (isset($_GET['ga_type']))?sanitize_text_field($_GET['ga_type']):"ga3";
36
  $this->TVC_Admin_Helper = new TVC_Admin_Helper();
37
  $this->CustomApi = new CustomApi();
38
  $this->connect_url = $this->TVC_Admin_Helper->get_custom_connect_url(admin_url().'admin.php?page=conversios');
61
  $this->ga_traking_type = $this->subscription_data->tracking_option; // UA,GA4,BOTH
62
  $this->ga3_property_id = $this->subscription_data->property_id; // GA3
63
  $this->ga3_ua_analytic_account_id = $this->subscription_data->ua_analytic_account_id;
64
+ if($this->ga_traking_type == "GA4"){
65
+ $this->ga_swatch = "ga4";
66
+ }
67
  if($this->is_refresh_token_expire == false){
68
+ if($this->ga_swatch == "ga3" || $this->ga_swatch == ""){
69
+ $this->set_ga3_view_id_and_ga3_currency();
70
+ }else{
71
+ $this->ga4_measurement_id = $this->subscription_data->measurement_id; //GA4 ID
72
+ $this->ga4_analytic_account_id = $this->subscription_data->ga4_analytic_account_id; //GA4 ID
73
+ $this->set_analytics_get_ga4_property_id();
74
+ }
75
  }
76
+
77
  }else{
78
  wp_redirect("admin.php?page=conversios_onboarding");
79
  exit;
94
  public function init(){
95
 
96
  }
97
+ /* Need to For GA4 API call */
98
+ public function set_analytics_get_ga4_property_id(){
99
+ if(isset($this->subscription_data->ga4_property_id) && $this->subscription_data->ga4_property_id!="" ){
100
+ $this->ga4_property_id = $this->subscription_data->ga4_property_id;
101
+ }else{
102
+ $data = array(
103
+ "subscription_id" => sanitize_text_field($this->subscription_id),
104
+ "ga4_analytic_account_id" => sanitize_text_field($this->ga4_analytic_account_id)
105
+ );
106
+ $api_rs = $this->CustomApi->analytics_get_ga4_property_id($data);
107
+ if (isset($api_rs->error) && $api_rs->error == '') {
108
+ if(isset($api_rs->ga4_property_id) && $api_rs->ga4_property_id != ""){
109
+ $this->ga4_property_id = $api_rs->ga4_property_id;
110
+ $this->ga_currency_symbols = $this->TVC_Admin_Helper->get_currency_symbols($this->ga_currency);
111
+ //$this->is_need_to_update_api_data_wp_db = true;
112
+ }
113
+ }
114
+ }
115
+ }
116
+ /* Need to For GA3 API call */
117
  public function set_ga3_view_id_and_ga3_currency(){
118
  if(isset($this->subscription_data->view_id) && isset($this->subscription_data->analytics_currency) && $this->subscription_data->view_id!="" && $this->subscription_data->analytics_currency!=""){
119
  $this->ga3_view_id = $this->subscription_data->view_id;
120
  $this->ga_currency = $this->subscription_data->analytics_currency;
121
+ $this->ga_currency_symbols = $this->TVC_Admin_Helper->get_currency_symbols($this->ga_currency);
 
122
  }else{
123
  $data = array(
124
  "subscription_id" => sanitize_text_field($this->subscription_id),
132
  $this->ga3_view_id = $data->view_id;
133
  $this->ga_currency = $data->analytics_currency;
134
  $this->ga_currency_symbols = $this->TVC_Admin_Helper->get_currency_symbols($this->ga_currency);
135
+ //$this->is_need_to_update_api_data_wp_db = true;
136
  }
137
  }
138
  }
160
  if(notice != ""){
161
  tvc_helper.tvc_alert("error","Email error",notice);
162
  }
 
163
  var g_mail = '<?php echo esc_attr($this->g_mail); ?>';
164
+ var plan_id = '<?php echo esc_attr($this->plan_id); ?>';
165
+ var ga_swatch = '<?php echo esc_attr($this->ga_swatch); ?>';
166
  var is_refresh_token_expire = '<?php echo esc_attr($this->is_refresh_token_expire); ?>';
167
  is_refresh_token_expire = (is_refresh_token_expire == "")?false:true;
168
+ console.log(is_refresh_token_expire);
 
169
  var start = moment().subtract(30, 'days');
170
  var end = moment();
171
  function cb(start, end) {
180
  action:'get_google_analytics_reports',
181
  subscription_id:'<?php echo esc_attr($this->subscription_id); ?>',
182
  plan_id:plan_id,
183
+ ga_swatch:ga_swatch,
184
  ga_traking_type:'<?php echo esc_attr($this->ga_traking_type); ?>',
185
  view_id :'<?php echo esc_attr($this->ga3_view_id); ?>',
186
+ property_id:'<?php echo esc_attr($this->ga4_property_id); ?>',
187
+ ga4_analytic_account_id:'<?php echo esc_attr($this->ga4_analytic_account_id); ?>',
188
  ga_currency :'<?php echo esc_attr($this->ga_currency); ?>',
189
  plugin_url:'<?php echo esc_url_raw(ENHANCAD_PLUGIN_URL); ?>',
190
  start_date :jQuery.trim(start_date.replace(/\//g,"-")),
313
  * @since 4.1.4
314
  */
315
  public function current_html(){
316
+ $current_page = admin_url( "admin.php?page=conversios");
317
  ?>
318
  <div class="dashbrdpage-wrap">
319
  <div class="dflex align-items-center mt24 dshbrdtoparea">
320
+ <div class="ga_swatch">
321
+ <?php if($this->ga_traking_type == "UA" || $this->ga_traking_type == "BOTH"){?>
322
+ <span class="<?php echo esc_attr($this->ga_swatch == "ga3")?"active":""; ?>" id="ga3"><a href="<?php echo esc_url_raw($current_page."&ga_type=ga3"); ?>">GA3</a></span>
323
+ <?php }
324
+ if($this->ga_traking_type == "GA4" || $this->ga_traking_type == "BOTH"){?>
325
+ <span class="<?php echo esc_attr($this->ga_swatch == "ga4")?"active":""; ?>" id="ga4"><a href="<?php echo esc_url_raw($current_page."&ga_type=ga4"); ?>">GA4</a></span>
326
+ <?php } ?>
327
+ </div>
328
  <div class="dashtp-left">
329
  <button class="dashtpleft-btn <?php echo esc_attr($this->add_upgrdsbrs_btn_calss('download_pdf')); ?>"><img src="<?php echo esc_url_raw(ENHANCAD_PLUGIN_URL.'/admin/images/download-icon.png'); ?>" alt="" /><?php esc_html_e("Download PDF","conversios"); ?></button>
330
  <button class="dashtpleft-btn <?php echo esc_attr($this->add_upgrdsbrs_btn_calss('schedule_email')); ?>"><img src="<?php echo esc_url_raw(ENHANCAD_PLUGIN_URL.'/admin/images/clock-icon.png'); ?>" alt="" /><?php esc_html_e("Schedule Email","conversios"); ?></button>
331
  </div>
332
  <div class="dashtp-right">
 
333
  <?php /*
334
  <div class="dshtprightselect">
335
  <select>
340
  </div>*/ ?>
341
  <?php if($this->plan_id != 1){?>
342
  <div id="reportrange" class="dshtpdaterange" >
343
+ <div class="dateclndicn">
344
+ <img src="<?php echo esc_url_raw(ENHANCAD_PLUGIN_URL.'/admin/images/claendar-icon.png'); ?>" alt="" />
345
+ </div>
346
+ <span class="daterangearea report_range_val"></span>
347
+ <div class="careticn"><img src="<?php echo esc_url_raw(ENHANCAD_PLUGIN_URL.'/admin/images/caret-down.png'); ?>" alt="" /></div>
348
  </div>
349
  <?php } else{ ?>
350
  <div class="dshtpdaterange <?php echo esc_attr($this->add_upgrdsbrs_btn_calss('download_pdf')); ?>">
351
+ <div class="dateclndicn">
352
+ <img src="<?php echo esc_url_raw(ENHANCAD_PLUGIN_URL.'/admin/images/claendar-icon.png'); ?>" alt="" />
353
+ </div>
354
+ <span class="daterangearea report_range_val"></span>
355
+ <div class="careticn"><img src="<?php echo esc_url_raw(ENHANCAD_PLUGIN_URL.'/admin/images/caret-down.png'); ?>" alt="" /></div>
356
  </div>
357
  <?php }?>
358
 
359
  </div>
360
  </div>
361
+ <?php /*if($this->ga_traking_type == "GA4"){?>
362
  <div class="temp_note"><p><?php esc_html_e("The reporting dashboard feature is only available for Google Analytics 3 properties currently. We are working on Google Analytics 4 dashboard, we will update you once it is live.","conversios"); ?></p></div>
363
+ <?php }*/ ?>
364
  <!--- dashboard summary section start -->
365
  <div class="wht-rnd-shdwbx mt24 dashsmry-wrap">
366
  <div class="dashsmry-item">
367
+ <?php if($this->ga_swatch == "" || $this->ga_swatch == "ga3"){ ?>
368
  <div class="dashsmrybx" id="s1_transactionsPerSession">
369
  <div class="dshsmrycattxt dash-smry-title"><?php esc_html_e("Conversion Rate","conversios"); ?></div>
370
  <div class="dshsmrylrgtxt dash-smry-value">-</div>
448
  </div>
449
  <div class="dshsmryprdtxt"><?php esc_html_e("From Previous Period","conversios"); ?></div>
450
  </div>
451
+
452
+ <?php }else { ?>
453
+
454
+ <div class="dashsmrybx" id="s1_totalRevenue">
455
+ <div class="dshsmrycattxt dash-smry-title"><?php esc_html_e("Revenue","conversios"); ?></div>
456
+ <div class="dshsmrylrgtxt dash-smry-value">-</div>
457
+ <div class="updownsmry dash-smry-compare-val">
458
+ %
459
+ </div>
460
+ <div class="dshsmryprdtxt"><?php esc_html_e("From Previous Period","conversios"); ?></div>
461
+ </div>
462
+ <div class="dashsmrybx mblsmry3bx" id="s1_transactions">
463
+ <div class="dshsmrycattxt dash-smry-title"><?php esc_html_e("Total Transactions","conversios"); ?></div>
464
+ <div class="dshsmrylrgtxt dash-smry-value">-</div>
465
+ <div class="updownsmry dash-smry-compare-val">
466
+ %
467
+ </div>
468
+ <div class="dshsmryprdtxt"><?php esc_html_e("From Previous Period","conversios"); ?></div>
469
+ </div>
470
+ <div class="dashsmrybx mblsmry3bx" id="s1_averagePurchaseRevenue">
471
+ <div class="dshsmrycattxt dash-smry-title"><?php esc_html_e("Avg. Order Value","conversios"); ?></div>
472
+ <div class="dshsmrylrgtxt dash-smry-value">-</div>
473
+ <div class="updownsmry dash-smry-compare-val">
474
+ %
475
+ </div>
476
+ <div class="dshsmryprdtxt"><?php esc_html_e("From Previous Period","conversios"); ?></div>
477
+ </div>
478
+ <div class="dashsmrybx mblsmry3bx flwdthmblbx" id="s1_addToCarts">
479
+ <div class="dshsmrycattxt dash-smry-title"><?php esc_html_e("Added to Cart","conversios"); ?></div>
480
+ <div class="dshsmrylrgtxt dash-smry-value">-</div>
481
+ <div class="updownsmry dash-smry-compare-val">
482
+ %
483
+ </div>
484
+ <div class="dshsmryprdtxt"><?php esc_html_e("From Previous Period","conversios"); ?></div>
485
+ </div>
486
+ </div>
487
+ <div class="dashsmry-item">
488
+
489
+ <div class="dashsmrybx" id="s1_sessions">
490
+ <div class="dshsmrycattxt dash-smry-title"><?php esc_html_e("Sessions","conversios"); ?></div>
491
+ <div class="dshsmrylrgtxt dash-smry-value">-</div>
492
+ <div class="updownsmry dash-smry-compare-val">
493
+ %
494
+ </div>
495
+ <div class="dshsmryprdtxt"><?php esc_html_e("From Previous Period","conversios"); ?></div>
496
+ </div>
497
+ <div class="dashsmrybx" id="s1_totalUsers">
498
+ <div class="dshsmrycattxt dash-smry-title"><?php esc_html_e("Total Users","conversios"); ?></div>
499
+ <div class="dshsmrylrgtxt dash-smry-value">-</div>
500
+ <div class="updownsmry dash-smry-compare-val">
501
+ %
502
+ </div>
503
+ <div class="dshsmryprdtxt"><?php esc_html_e("From Previous Period","conversios"); ?></div>
504
+ </div>
505
+ <div class="dashsmrybx" id="s1_newUsers">
506
+ <div class="dshsmrycattxt dash-smry-title"><?php esc_html_e("New Users","conversios"); ?></div>
507
+ <div class="dshsmrylrgtxt dash-smry-value">-</div>
508
+ <div class="updownsmry dash-smry-compare-val">
509
+ %
510
+ </div>
511
+ <div class="dshsmryprdtxt"><?php esc_html_e("From Previous Period","conversios"); ?></div>
512
+ </div>
513
+ <div class="dashsmrybx" id="s1_itemViews">
514
+ <div class="dshsmrycattxt dash-smry-title"><?php esc_html_e("Product Views","conversios"); ?></div>
515
+ <div class="dshsmrylrgtxt dash-smry-value">-</div>
516
+ <div class="updownsmry dash-smry-compare-val">
517
+ %
518
+ </div>
519
+ <div class="dshsmryprdtxt"><?php esc_html_e("From Previous Period","conversios"); ?></div>
520
+ </div>
521
+ <?php
522
+ } ?>
523
 
524
  </div>
525
  <?php /*
606
  </div>
607
  <?php }?>
608
 
609
+ <?php if($this->plan_id != 1 && ($this->ga_swatch == "" || $this->ga_swatch == "ga3") ){?>
610
  <div class="col50">
611
  <div class="chartbx ecomfunnchrtbx ecom-checkout-funn-chrt-bx">
612
  <div class="chartcntnbx">
639
  </div>
640
  </div>
641
  </div>
642
+ <?php }else if($this->ga_swatch == "" || $this->ga_swatch == "ga3"){ ?>
643
  <div class="col50">
644
  <div class="chartbx ecomfunnchrtbx">
645
  <div class="chartcntnbx prochrtftr">
685
  <th><?php esc_html_e("Added to Cart","conversios"); ?></th>
686
  <th><?php esc_html_e("Orders","conversios"); ?></th>
687
  <th><?php esc_html_e("Qty","conversios"); ?></th>
688
+ <th><?php esc_html_e("Revenue","conversios"); ?> (<spn class="ga_currency_symbols"><?php echo esc_attr($this->ga_currency_symbols); ?></spn>)</th>
689
+ <?php if($this->ga_swatch == "" || $this->ga_swatch == "ga3"){ ?>
690
  <th><?php esc_html_e("Avg Price","conversios"); ?> (<?php echo esc_attr($this->ga_currency_symbols); ?>)</th>
691
  <th><?php esc_html_e("Refund Amount","conversios"); ?> (<?php echo esc_attr($this->ga_currency_symbols); ?>)</th>
692
+ <?php } ?>
693
  <th><?php esc_html_e("Cart to details (%)","conversios"); ?></th>
694
  <th><?php esc_html_e("Buy to details (%)","conversios"); ?></th>
695
  </tr>
742
  <thead>
743
  <tr>
744
  <th class="prdnm-cell"><?php esc_html_e("Source/Medium","conversios"); ?></th>
745
+ <?php if($this->ga_swatch == "" || $this->ga_swatch == "ga3"){ ?>
746
+ <th><?php esc_html_e("Conversion (%)","conversios"); ?></th>
747
+ <?php } ?>
748
+ <th><?php esc_html_e("Revenue","conversios"); ?> (<spn class="ga_currency_symbols"><?php echo esc_attr($this->ga_currency_symbols); ?></spn>)</th>
749
  <th><?php esc_html_e("Total transactions","conversios"); ?></th>
750
+ <th><?php esc_html_e("Avg Order value","conversios"); ?> (<spn class="ga_currency_symbols"><?php echo esc_attr($this->ga_currency_symbols); ?></spn>)</th>
751
  <th><?php esc_html_e("Added to carts","conversios"); ?></th>
752
+ <?php if($this->ga_swatch == "" || $this->ga_swatch == "ga3"){ ?>
753
+ <th><?php esc_html_e("removed from cart","conversios"); ?></th>
754
+ <?php } ?>
755
  <th><?php esc_html_e("Product views","conversios"); ?></th>
756
  <th><?php esc_html_e("Users","conversios"); ?></th>
757
  <th><?php esc_html_e("Sessions","conversios"); ?></th>
readme.txt CHANGED
@@ -8,8 +8,8 @@ Author: Tatvic
8
  Requires at least: 3.5.0
9
  Tested up to: 5.9.1
10
  Requires PHP: 5.6 or Higher
11
- Stable tag: 4.6.7
12
- Version: 4.6.7
13
  License: GPLv3
14
  License URI: http://www.gnu.org/licenses/gpl-3.0.html
15
 
@@ -379,8 +379,11 @@ You can resolve the duplication of data by removing the manually implemented GA
379
 
380
 
381
  == Changelog ==
 
 
 
382
  = 4.6.7 - 11/03/2022 =
383
- * Fix: - Fixed the Google ads converstion tracking issue for some users.
384
 
385
  = 4.6.6 - 03/03/2022 =
386
  * New: In this release, we have Enhanced and optimized in Google Analytics tracking event.
8
  Requires at least: 3.5.0
9
  Tested up to: 5.9.1
10
  Requires PHP: 5.6 or Higher
11
+ Stable tag: 4.6.8
12
+ Version: 4.6.8
13
  License: GPLv3
14
  License URI: http://www.gnu.org/licenses/gpl-3.0.html
15
 
379
 
380
 
381
  == Changelog ==
382
+ = 4.6.8 - 17/03/2022 =
383
+ * New: In this release, we have add GA4 dashboard with important e-commerce reports.
384
+
385
  = 4.6.7 - 11/03/2022 =
386
+ * Fix: - Fixed the Google ads converstion tracking issue for some users.
387
 
388
  = 4.6.6 - 03/03/2022 =
389
  * New: In this release, we have Enhanced and optimized in Google Analytics tracking event.