Enhanced Ecommerce Google Analytics Plugin for WooCommerce - Version 4.3.0

Version Description

  • 29/09/2021 =

  • We have added Campaign performance data in the dashboard. This will allow you to have visibility on your Google ads campaigns. It will show you clicks, cost, conversions, and sales like important metric for each campaign so that you can take informed decisions to increase your marketing ROI.

  • Enhanced Google authentication flow in order to manage expiry of tokens.

  • Resolved some bugs on the onboarding page for better performance

Download this release

Release Info

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

Code changes from version 4.2.1 to 4.3.0

admin/class-enhanced-ecommerce-google-analytics-admin.php CHANGED
@@ -89,6 +89,13 @@ class Enhanced_Ecommerce_Google_Analytics_Admin extends TVC_Admin_Helper {
89
  }
90
  }
91
  }
 
 
 
 
 
 
 
92
  ?>
93
  <script>
94
  var tvc_ajax_url = '<?php echo admin_url( 'admin-ajax.php' ); ?>';
89
  }
90
  }
91
  }
92
+ if(isset($ee_additional_data['dismissed_ee_adimin_notic_c']) && $ee_additional_data['dismissed_ee_adimin_notic_a'] == 1){
93
+ }else{
94
+ echo '<div class="notice notice-info is-dismissible" data-id="ee_adimin_notic_c">
95
+ <p>Now access important eCommerce KPIs and Google Ads campaign performance data directly in your wordpress backend to improve your marketing ROI. <a href="admin.php?page=conversios"><b><u>View it from here.</u></b></a></p>
96
+ </div>';
97
+
98
+ }
99
  ?>
100
  <script>
101
  var tvc_ajax_url = '<?php echo admin_url( 'admin-ajax.php' ); ?>';
admin/class-tvc-admin-helper.php CHANGED
@@ -242,13 +242,13 @@ Class TVC_Admin_Helper{
242
  }
243
  $syncProduct_list_res = $this->customApiObj->getSyncProductList($args);
244
  if(isset($syncProduct_list_res->data) && isset($syncProduct_list_res->status) && $syncProduct_list_res->status == 200){
245
- if (isset($syncProduct_list_res->data->products)) {
246
  $rs_next_page_token = $syncProduct_list_res->data->nextPageToken;
247
  $sync_product_list = $syncProduct_list_res->data->products;
248
  if(!empty($sync_product_list)){
249
- foreach ($sync_product_list as $key => $value) {
250
  $googleStatus =$value->googleStatus;
251
- if ($value->googleStatus != "disapproved" && $value->googleStatus != "approved") {
252
  $googleStatus = "pending";
253
  }
254
  $t_data = array(
@@ -416,6 +416,17 @@ Class TVC_Admin_Helper{
416
  return $this->connect_url;
417
  }
418
  }
 
 
 
 
 
 
 
 
 
 
 
419
 
420
  public function get_onboarding_page_url(){
421
  if(!empty($this->onboarding_page_url)){
242
  }
243
  $syncProduct_list_res = $this->customApiObj->getSyncProductList($args);
244
  if(isset($syncProduct_list_res->data) && isset($syncProduct_list_res->status) && $syncProduct_list_res->status == 200){
245
+ if(isset($syncProduct_list_res->data->products)){
246
  $rs_next_page_token = $syncProduct_list_res->data->nextPageToken;
247
  $sync_product_list = $syncProduct_list_res->data->products;
248
  if(!empty($sync_product_list)){
249
+ foreach($sync_product_list as $key => $value) {
250
  $googleStatus =$value->googleStatus;
251
+ if($value->googleStatus != "disapproved" && $value->googleStatus != "approved") {
252
  $googleStatus = "pending";
253
  }
254
  $t_data = array(
416
  return $this->connect_url;
417
  }
418
  }
419
+ public function get_custom_connect_url($confirm_url = ""){
420
+ if(!empty($this->connect_url)){
421
+ return $this->connect_url;
422
+ }else{
423
+ if($confirm_url == ""){
424
+ $confirm_url = admin_url();
425
+ }
426
+ $this->connect_url = "https://".TVC_AUTH_CONNECT_URL."/config/ga_rdr_gmc.php?return_url=".TVC_AUTH_CONNECT_URL."/config/ads-analytics-form.php?domain=" . $this->get_connect_actual_link() . "&amp;country=" . $this->get_woo_country(). "&amp;user_currency=".$this->get_woo_currency()."&amp;subscription_id=" . $this->get_subscriptionId() . "&amp;confirm_url=" . $confirm_url . "&amp;timezone=".$this->get_time_zone();
427
+ return $this->connect_url;
428
+ }
429
+ }
430
 
431
  public function get_onboarding_page_url(){
432
  if(!empty($this->onboarding_page_url)){
admin/css/style.css CHANGED
@@ -187,7 +187,12 @@ button:disabled,button[disabled], button:disabled:hover,button[disabled]:hover{b
187
  background: #1669f2;
188
  }
189
  .google-btn .btn-text.mr-35{margin-right: 35px;}
 
190
  /*google button*/
 
 
 
 
191
  /*.google_connect_url{
192
  display: block;
193
  background: white;
@@ -255,7 +260,7 @@ button:disabled,button[disabled], button:disabled:hover,button[disabled]:hover{b
255
  background-position: 0% 50%;
256
  }
257
  }
258
- .product_performance_report table, .medium_performance_report table{min-height: 200px;}
259
 
260
  .errmscntbx .tvc-nb-spinner {
261
  display: inline-block;
187
  background: #1669f2;
188
  }
189
  .google-btn .btn-text.mr-35{margin-right: 35px;}
190
+
191
  /*google button*/
192
+ #tvc_popup_box span.google_connect_url{
193
+ cursor: pointer;
194
+ color: #7B5DFC;
195
+ }
196
  /*.google_connect_url{
197
  display: block;
198
  background: white;
260
  background-position: 0% 50%;
261
  }
262
  }
263
+ .product_performance_report table, .medium_performance_report table, .campaign_performance_report table{min-height: 200px;}
264
 
265
  .errmscntbx .tvc-nb-spinner {
266
  display: inline-block;
admin/helper/class-dashboard-helper.php CHANGED
@@ -22,7 +22,8 @@ if(!class_exists('Conversios_Dashboard_Helper')){
22
  $this->CustomApi = new CustomApi();
23
  $this->ShoppingApi = new ShoppingApi();
24
  add_action('wp_ajax_get_google_analytics_reports', array($this,'get_google_analytics_reports') );
25
- add_action('wp_ajax_get_google_ads_reports', array($this,'get_google_ads_reports') );
 
26
  }
27
 
28
  public function req_int(){
@@ -41,7 +42,42 @@ if(!class_exists('Conversios_Dashboard_Helper')){
41
  return false;
42
  }
43
  }
44
- public function get_google_ads_reports(){
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
45
  $nonce = (isset($_POST['conversios_nonce']))?$_POST['conversios_nonce']:"";
46
  if($this->admin_safe_ajax_call($nonce, 'conversios_nonce')){
47
  $post_data = (object)$_POST;
@@ -61,17 +97,21 @@ if(!class_exists('Conversios_Dashboard_Helper')){
61
  }
62
  $end_date == (false !==strtotime( $end_date ))?date('Y-m-d', strtotime($end_date)):date( 'Y-m-d', strtotime( 'now' ));
63
 
64
- $api_rs = $this->ShoppingApi->accountPerformance(2, 7, $start_date, $end_date);
65
  if (isset($api_rs->error) && $api_rs->error == '') {
66
  if(isset($api_rs->data) && $api_rs->data != ""){
67
- $return = array('error'=>false, 'data'=>$api_rs->data,'message'=>'');
68
  }
69
  }else{
70
- $return = array('error'=>true,'message'=>$api_rs->error);
71
  }
72
  //print_r($account_performance_res);
73
 
74
- }
 
 
 
 
75
  }
76
  public function get_google_analytics_reports(){
77
  $nonce = (isset($_POST['conversios_nonce']))?$_POST['conversios_nonce']:"";
@@ -110,7 +150,7 @@ if(!class_exists('Conversios_Dashboard_Helper')){
110
  $return = array('error'=>false, 'data'=>$api_rs->data,'errors'=>'');
111
  }
112
  }else{
113
- $return = array('error'=>true,'errors'=>$api_rs->error);
114
  }
115
  }else if($subscription_id != "" && ( $ga_traking_type == "GA4" || $ga_traking_type == "BOTH" )){
116
  $return = array('error'=>true,'errors'=>'GA4 Coming soon...');
22
  $this->CustomApi = new CustomApi();
23
  $this->ShoppingApi = new ShoppingApi();
24
  add_action('wp_ajax_get_google_analytics_reports', array($this,'get_google_analytics_reports') );
25
+ add_action('wp_ajax_get_google_ads_reports_chart', array($this,'get_google_ads_reports_chart') );
26
+ add_action('wp_ajax_get_google_ads_campaign_performance', array($this,'get_google_ads_campaign_performance') );
27
  }
28
 
29
  public function req_int(){
42
  return false;
43
  }
44
  }
45
+ public function get_google_ads_campaign_performance(){
46
+ $nonce = (isset($_POST['conversios_nonce']))?$_POST['conversios_nonce']:"";
47
+ if($this->admin_safe_ajax_call($nonce, 'conversios_nonce')){
48
+ $post_data = (object)$_POST;
49
+ //$start_date = isset($post_data->start_date)?$post_data->start_date:date('Y-m-d',strtotime('-31 days'));
50
+ $start_date = str_replace(' ', '',(isset($_POST['start_date']))?$_POST['start_date']:"");
51
+ if($start_date != ""){
52
+ $date = DateTime::createFromFormat('d-m-Y', $start_date);
53
+ $start_date = $date->format('Y-m-d');
54
+ }
55
+ $start_date == (false !==strtotime( $start_date ))?date('Y-m-d', strtotime($start_date)):date( 'Y-m-d', strtotime( '-1 month' ));
56
+
57
+ $end_date = str_replace(' ', '',(isset($_POST['end_date']))?$_POST['end_date']:"");
58
+ if($end_date != ""){
59
+ $date = DateTime::createFromFormat('d-m-Y', $end_date);
60
+ $end_date = $date->format('Y-m-d');
61
+ }
62
+ $end_date == (false !==strtotime( $end_date ))?date('Y-m-d', strtotime($end_date)):date( 'Y-m-d', strtotime( 'now' ));
63
+
64
+ $api_rs = $this->ShoppingApi->campaign_performance(2, 7, $start_date, $end_date);
65
+ if (isset($api_rs->error) && $api_rs->error == '') {
66
+ if(isset($api_rs->data) && $api_rs->data != ""){
67
+ $return = array('error'=>false, 'data'=>$api_rs->data);
68
+ }
69
+ }else{
70
+ $return = array('error'=>true,'errors'=>$api_rs->error);
71
+ }
72
+ //print_r($account_performance_res);
73
+
74
+ }else{
75
+ $return = array('error'=>true,'errors'=>'Admin security nonce is not verified.');
76
+ }
77
+ echo json_encode($return);
78
+ wp_die();
79
+ }
80
+ public function get_google_ads_reports_chart(){
81
  $nonce = (isset($_POST['conversios_nonce']))?$_POST['conversios_nonce']:"";
82
  if($this->admin_safe_ajax_call($nonce, 'conversios_nonce')){
83
  $post_data = (object)$_POST;
97
  }
98
  $end_date == (false !==strtotime( $end_date ))?date('Y-m-d', strtotime($end_date)):date( 'Y-m-d', strtotime( 'now' ));
99
 
100
+ $api_rs = $this->ShoppingApi->accountPerformance_for_dashboard(2, 7, $start_date, $end_date);
101
  if (isset($api_rs->error) && $api_rs->error == '') {
102
  if(isset($api_rs->data) && $api_rs->data != ""){
103
+ $return = array('error'=>false, 'data'=>$api_rs->data);
104
  }
105
  }else{
106
+ $return = array('error'=>true,'errors'=>$api_rs->error);
107
  }
108
  //print_r($account_performance_res);
109
 
110
+ }else{
111
+ $return = array('error'=>true,'errors'=>'Admin security nonce is not verified.');
112
+ }
113
+ echo json_encode($return);
114
+ wp_die();
115
  }
116
  public function get_google_analytics_reports(){
117
  $nonce = (isset($_POST['conversios_nonce']))?$_POST['conversios_nonce']:"";
150
  $return = array('error'=>false, 'data'=>$api_rs->data,'errors'=>'');
151
  }
152
  }else{
153
+ $return = array('error'=>true,'errors'=>$api_rs->message);
154
  }
155
  }else if($subscription_id != "" && ( $ga_traking_type == "GA4" || $ga_traking_type == "BOTH" )){
156
  $return = array('error'=>true,'errors'=>'GA4 Coming soon...');
admin/js/onboarding-custom.js CHANGED
@@ -494,26 +494,30 @@ function list_analytics_web_properties(type, tvc_data) {
494
  url: tvc_ajax_url,
495
  data: {action: "get_analytics_web_properties", type: type, tvc_data:tvc_data, conversios_onboarding_nonce:conversios_onboarding_nonce},
496
  success: function (response) {
497
- if (response.error === false) {
 
498
  if (type == "UA" || type == "BOTH") {
499
  //web_properties_dropdown
500
  var subscriptionPropertyId = $("#subscriptionPropertyId").val();
501
  var ga_view_id = $("#ga_view_id").val();
502
  var PropOptions = '<option value="">Select Property Id</option>';
503
- $.each(response.data.wep_properties, function (propKey, propValue) {
504
- var selected ="";
505
- if (subscriptionPropertyId == propValue.webPropertyId) {
506
- if(ga_view_id != "" && ga_view_id == propValue.id){
507
- selected = "selected='selected'";
508
- }else if(ga_view_id =="" ){
509
- selected = "selected='selected'";
 
 
 
 
 
 
510
  }
511
-
512
- }else{
513
- selected = "";
514
- }
515
- PropOptions = PropOptions + '<option value="' + propValue.webPropertyId + '" ' + selected + ' data-accountid="' + propValue.accountId + '" data-profileid="' + propValue.id + '"> ' + propValue.accountName + ' - ' + propValue.propertyName + ' - ' + propValue.name + '</option>';
516
- });
517
  $('#ua_web_property_id').html(PropOptions);
518
  $('#both_web_property_id').html(PropOptions);
519
  }
@@ -521,19 +525,24 @@ function list_analytics_web_properties(type, tvc_data) {
521
  //web_measurement_dropdown
522
  var subscriptionMeasurementId = $("#subscriptionMeasurementId").val();
523
  var MeasOptions = '<option value="">Select Measurement Id</option>';
524
- $.each(response.data.wep_measurement, function (measKey, measValue) {
525
- if (subscriptionMeasurementId == measValue.measurementId) {
526
- var selected = "selected='selected'";
527
- } else {
528
- var selected = "";
529
- }
530
- var web_property = measValue.name.split("/");
531
- MeasOptions = MeasOptions + '<option value="' + measValue.measurementId + '" ' + selected + ' data-name="'+web_property[1] +'"'+ ' data-accountid="' + measValue.accountId + '"> ' + measValue.accountName + ' - ' + web_property[1] + ' - ' + measValue.measurementId + '</option>';
532
- });
 
 
533
  $('#ga4_web_measurement_id').html(MeasOptions);
534
  $('#both_web_measurement_id').html(MeasOptions);
535
  }
536
  $(".slect2bx").select2();
 
 
 
537
  }
538
  is_validate_step("step_1");
539
  loaderSection(false);
@@ -566,18 +575,19 @@ function list_googl_ads_account(tvc_data) {
566
  if (response.data.length == 0) {
567
  add_message("warning","There are no Google ads accounts associated with email.");
568
  } else {
569
- $.each(response.data, function (key, value) {
570
-
571
- if (selectedValue == value) {
572
- $('#ads-account').append($('<option>', { value: value, text: value,selected: "selected"}));
573
- } else {
574
- if(selectedValue == "" && key == 0){
575
  $('#ads-account').append($('<option>', { value: value, text: value,selected: "selected"}));
576
- }else{
577
- $('#ads-account').append($('<option>', { value: value, text: value,}));
 
 
 
 
578
  }
579
- }
580
- });
581
  }
582
  } else {
583
  add_message("warning","There are no Google ads accounts associated with email.");
494
  url: tvc_ajax_url,
495
  data: {action: "get_analytics_web_properties", type: type, tvc_data:tvc_data, conversios_onboarding_nonce:conversios_onboarding_nonce},
496
  success: function (response) {
497
+ // console.log(response);
498
+ if (response.error == false) {
499
  if (type == "UA" || type == "BOTH") {
500
  //web_properties_dropdown
501
  var subscriptionPropertyId = $("#subscriptionPropertyId").val();
502
  var ga_view_id = $("#ga_view_id").val();
503
  var PropOptions = '<option value="">Select Property Id</option>';
504
+ //console.log(Object.keys(response.data.wep_properties).length +"=="+response.data.wep_properties.length);
505
+ if(response.data.wep_properties.length > 0){
506
+ $.each(response.data.wep_properties, function (propKey, propValue) {
507
+ var selected ="";
508
+ if (subscriptionPropertyId == propValue.webPropertyId) {
509
+ if(ga_view_id != "" && ga_view_id == propValue.id){
510
+ selected = "selected='selected'";
511
+ }else if(ga_view_id =="" ){
512
+ selected = "selected='selected'";
513
+ }
514
+
515
+ }else{
516
+ selected = "";
517
  }
518
+ PropOptions = PropOptions + '<option value="' + propValue.webPropertyId + '" ' + selected + ' data-accountid="' + propValue.accountId + '" data-profileid="' + propValue.id + '"> ' + propValue.accountName + ' - ' + propValue.propertyName + ' - ' + propValue.name + '</option>';
519
+ });
520
+ }
 
 
 
521
  $('#ua_web_property_id').html(PropOptions);
522
  $('#both_web_property_id').html(PropOptions);
523
  }
525
  //web_measurement_dropdown
526
  var subscriptionMeasurementId = $("#subscriptionMeasurementId").val();
527
  var MeasOptions = '<option value="">Select Measurement Id</option>';
528
+ if(response.data.wep_measurement.length > 0){
529
+ $.each(response.data.wep_measurement, function (measKey, measValue) {
530
+ if (subscriptionMeasurementId == measValue.measurementId) {
531
+ var selected = "selected='selected'";
532
+ } else {
533
+ var selected = "";
534
+ }
535
+ var web_property = measValue.name.split("/");
536
+ MeasOptions = MeasOptions + '<option value="' + measValue.measurementId + '" ' + selected + ' data-name="'+web_property[1] +'"'+ ' data-accountid="' + measValue.accountId + '"> ' + measValue.accountName + ' - ' + web_property[1] + ' - ' + measValue.measurementId + '</option>';
537
+ });
538
+ }
539
  $('#ga4_web_measurement_id').html(MeasOptions);
540
  $('#both_web_measurement_id').html(MeasOptions);
541
  }
542
  $(".slect2bx").select2();
543
+ }else{
544
+ const errors = JSON.parse(response.errors[0]);
545
+ add_message("error",errors.message);
546
  }
547
  is_validate_step("step_1");
548
  loaderSection(false);
575
  if (response.data.length == 0) {
576
  add_message("warning","There are no Google ads accounts associated with email.");
577
  } else {
578
+ if(response.data.length > 0){
579
+ $.each(response.data, function (key, value) {
580
+ if (selectedValue == value) {
 
 
 
581
  $('#ads-account').append($('<option>', { value: value, text: value,selected: "selected"}));
582
+ } else {
583
+ if(selectedValue == "" && key == 0){
584
+ $('#ads-account').append($('<option>', { value: value, text: value,selected: "selected"}));
585
+ }else{
586
+ $('#ads-account').append($('<option>', { value: value, text: value,}));
587
+ }
588
  }
589
+ });
590
+ }
591
  }
592
  } else {
593
  add_message("warning","There are no Google ads accounts associated with email.");
admin/js/tvc-ee-custom.js CHANGED
@@ -4,6 +4,7 @@ var conversion_bar_chart = "";
4
  var checkout_funnel_chart = "";
5
  var checkout_bar_chart = "";
6
  });
 
7
  var tvc_helper = {
8
  tvc_alert:function(msg_type=null, msg_subject=null, msg, auto_close=false, tvc_time=7000){
9
  document.getElementById('tvc_msg_title').innerHTML ="";
@@ -65,11 +66,13 @@ var tvc_helper = {
65
  this.cleare_dashboard();
66
  this.add_loader_for_analytics_reports();
67
  this.google_analytics_reports_call_api(post_data);
68
- //this.google_ads_reports_call_api(post_data);
 
 
69
  },
70
  google_ads_reports_call_api:function(post_data){
71
-
72
- post_data['action']='get_google_ads_reports';
73
  var v_this = this;
74
  $.ajax({
75
  type: "POST",
@@ -77,33 +80,255 @@ var tvc_helper = {
77
  url: tvc_ajax_url,
78
  data: post_data,
79
  success: function (response) {
 
80
  if(response.error == false){
81
  if(Object.keys(response.data).length > 0){
82
- v_this.set_google_analytics_reports_value(response.data, post_data);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
83
  }
84
  }else{
85
  v_this.tvc_alert("error","",response.error);
86
  }
87
- //console.log(JSON.parse(response.data));
88
  v_this.remove_loader_for_analytics_reports();
89
  }
90
  });
91
  },
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
92
  google_analytics_reports_call_api:function(post_data){
93
  var v_this = this;
 
94
  $.ajax({
95
  type: "POST",
96
  dataType: "json",
97
  url: tvc_ajax_url,
98
  data: post_data,
99
  success: function (response) {
 
100
  if(response.error == false){
101
  if(Object.keys(response.data).length > 0){
102
  v_this.set_google_analytics_reports_value(response.data, post_data);
103
  }
104
  }else if(response.error == true && response.errors != undefined){
105
  const errors = response.errors;
106
- v_this.tvc_alert("error","Error",errors);
 
 
 
 
 
 
 
 
107
  }else{
108
  v_this.tvc_alert("error","Error","Analytics report data not fetched");
109
  }
@@ -114,7 +339,7 @@ var tvc_helper = {
114
  set_google_analytics_reports_value:function(data, post_data){
115
  var v_this = this;
116
  data = JSON.parse(data);
117
- console.log(data);
118
  var basic_data = data.dashboard_data_point;
119
  var currency_code = post_data.ga_currency;
120
  var plugin_url = post_data.plugin_url;
@@ -242,8 +467,12 @@ var tvc_helper = {
242
  })
243
  }
244
  if(reports_typs.conversion_funnel.is_free || paln_type == 'paid'){
245
- this.set_ecommerce_conversion_funnel(basic_data,data.ecommerce_funnel.shoppingStage);
246
- this.set_ecommerce_checkout_funnel(data.ecommerce_funnel.shoppingStage);
 
 
 
 
247
  }
248
  },
249
  set_ecommerce_conversion_funnel:function(data,shoppingStage){
@@ -485,8 +714,10 @@ var tvc_helper = {
485
  }
486
  },
487
  cleare_dashboard:function(){
 
488
  $("#product_performance_report table tbody").html("");
489
  $("#medium_performance_report table tbody").html("");
 
490
  var canvas = document.getElementById('ecomfunchart');
491
  if( canvas != null){
492
  var is_blank = this.is_canvas_blank(canvas);
@@ -503,6 +734,19 @@ var tvc_helper = {
503
  checkout_bar_chart.destroy();
504
  }
505
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
506
  },
507
  add_loader_for_analytics_reports:function(){
508
  var reg_section = this.get_analytics_reports_section();
@@ -553,6 +797,21 @@ var tvc_helper = {
553
  },'medium_performance_report':{
554
  'loading-type':'gif',
555
  'main-class':'medium_performance_report',
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
556
  }
557
  };
558
  },get_currency_symbols:function(code){
4
  var checkout_funnel_chart = "";
5
  var checkout_bar_chart = "";
6
  });
7
+ var chart_ids = {};
8
  var tvc_helper = {
9
  tvc_alert:function(msg_type=null, msg_subject=null, msg, auto_close=false, tvc_time=7000){
10
  document.getElementById('tvc_msg_title').innerHTML ="";
66
  this.cleare_dashboard();
67
  this.add_loader_for_analytics_reports();
68
  this.google_analytics_reports_call_api(post_data);
69
+ if(post_data.plan_id != 1 && post_data.google_ads_id != ""){
70
+ this.google_ads_reports_call_api(post_data);
71
+ }
72
  },
73
  google_ads_reports_call_api:function(post_data){
74
+ // Shopping and Google Ads Performance
75
+ /*post_data['action']='get_google_ads_reports_chart';
76
  var v_this = this;
77
  $.ajax({
78
  type: "POST",
80
  url: tvc_ajax_url,
81
  data: post_data,
82
  success: function (response) {
83
+ console.log(response);
84
  if(response.error == false){
85
  if(Object.keys(response.data).length > 0){
86
+ v_this.set_google_ads_reports_chart_value(response.data, post_data);
87
+ }
88
+ }else{
89
+ v_this.tvc_alert("error","",response.error);
90
+ }
91
+ v_this.remove_loader_for_analytics_reports();
92
+ }
93
+ });*/
94
+ //Compaign Performance
95
+ post_data['action']='get_google_ads_campaign_performance';
96
+ var v_this = this;
97
+ $.ajax({
98
+ type: "POST",
99
+ dataType: "json",
100
+ url: tvc_ajax_url,
101
+ data: post_data,
102
+ success: function (response) {
103
+ console.log(response);
104
+ if(response.error == false){
105
+ if(Object.keys(response.data).length > 0){
106
+ v_this.set_google_ads_reports_campaign_performance_value(response.data, post_data);
107
  }
108
  }else{
109
  v_this.tvc_alert("error","",response.error);
110
  }
 
111
  v_this.remove_loader_for_analytics_reports();
112
  }
113
  });
114
  },
115
+ set_google_ads_reports_campaign_performance_value:function(data, post_data){
116
+ //if(data.hasOwnProperty('data')){
117
+ //var p_p_r = data.product_performance_report.products;
118
+ //console.log(p_p_r);
119
+ var table_row = '';
120
+ var product_revenue_per = 0;
121
+ var status = "";
122
+ if(data != undefined && Object.keys(data).length > 0){
123
+ var i=0;
124
+ $.each(data, function (propKey, propValue) {
125
+ if(i<5){
126
+ table_row = '';
127
+ status = (propValue['active'] == 1)?'active':'deactivate';
128
+ table_row += '<tr><td class="prdnm-cell">'+propValue['compaignName']+'</td>';
129
+ table_row += '<td>'+propValue['dailyBudget']+'</td>';
130
+ table_row += '<td>'+status+'</td>';
131
+ table_row += '<td>'+propValue['clicks']+'</td>';
132
+ table_row += '<td>'+propValue['cost']+'</td>';
133
+ table_row += '<td>'+propValue['conversions']+'</td>';
134
+ table_row += '<td>'+propValue['sales']+'</td></tr>';
135
+ $("#campaign_performance_report table tbody").append(table_row);
136
+ i = i+1;
137
+ }
138
+ })
139
+ }else{
140
+ $("#campaign_performance_report table tbody").append("<tr><td colspan='7'>Data not available</td></tr>");
141
+ }
142
+ //}
143
+ },
144
+ set_google_ads_reports_chart_value:function(data, post_data){
145
+ var v_this = this;
146
+ var s_1_div_id ={
147
+ 'daily_clicks':{
148
+ 'id':'dailyClicks',
149
+ 'type':'number',
150
+ 'is_chart':true,
151
+ 'chart_type':'line',
152
+ 'chart_value_field_id':'clicks',
153
+ 'chart_title':'Clicks',
154
+ 'chart_id':'dailyClicks'
155
+ },'daily_cost':{
156
+ 'id':'dailyCost',
157
+ 'type':'currency',
158
+ 'is_chart':true,
159
+ 'chart_type':'line',
160
+ 'chart_value_field_id':'costs',
161
+ 'chart_title':'Cost',
162
+ 'chart_id':'dailyCost'
163
+ },'daily_conversions':{
164
+ 'id':'dailyConversions',
165
+ 'type':'number',
166
+ 'is_chart':true,
167
+ 'chart_type':'line',
168
+ 'chart_value_field_id':'conversions',
169
+ 'chart_title':'Conversions',
170
+ 'chart_id':'dailyConversions'
171
+ },'daily_sales':{
172
+ 'id':'dailySales',
173
+ 'type':'number',
174
+ 'is_chart':true,
175
+ 'chart_type':'line',
176
+ 'chart_value_field_id':'sales',
177
+ 'chart_title':'Sales',
178
+ 'chart_id':'dailySales'
179
+ }
180
+ };
181
+ if(Object.keys(s_1_div_id).length > 0){
182
+ var labels_key = "";
183
+ if(data.hasOwnProperty('graph_type')){
184
+ labels_key = data['graph_type'];
185
+ }
186
+ $.each(s_1_div_id, function (propKey, propValue) {
187
+ if(data.hasOwnProperty(propValue['id'])){
188
+ if(propValue['chart_id']!= undefined && propValue['is_chart'] != undefined && propValue['chart_type'] != undefined){
189
+
190
+ var chart_id = propValue['chart_id'];
191
+ var field_id = propValue['chart_value_field_id'];
192
+ var chart_title = propValue['chart_title'];
193
+ //console.log(propValue['chart_type']+"call"+chart_id);
194
+ if(propValue['chart_type'] == 'line'){
195
+ v_this.drow_google_ads_chart(chart_id, data[propValue['id']], field_id, chart_title, labels_key);
196
+ }
197
+ }
198
+ }
199
+ });
200
+ }
201
+
202
+ },
203
+ drow_google_ads_chart:function(chart_id, alldata, field_key, d_label, labels_key){
204
+ var chart_data = alldata;
205
+ var ctx = document.getElementById(chart_id).getContext('2d');
206
+ var gradientFill = ctx.createLinearGradient(0, 0, 0, 500);
207
+ if(chart_id == 'dailyClicks'){
208
+ gradientFill.addColorStop(0.4, 'rgba(153, 170, 255, 0.9)');
209
+ gradientFill.addColorStop(0.85, 'rgba(255, 255, 255, 0.7)');
210
+ }else if(chart_id =='dailyCost'){
211
+ gradientFill.addColorStop(0.4, 'rgba(110, 245, 197, 0.9)');
212
+ gradientFill.addColorStop(0.85, 'rgba(255, 255, 255, 0.7)');
213
+ }else if(chart_id =='dailyConversions'){
214
+ gradientFill.addColorStop(0.4, 'rgba(255, 229, 139, 0.9)');
215
+ gradientFill.addColorStop(0.85, 'rgba(255, 255, 255, 0.7)');
216
+ }else if(chart_id =='dailySales'){
217
+ gradientFill.addColorStop(0.4, 'rgba(107, 232, 255, 0.9)');
218
+ gradientFill.addColorStop(0.85, 'rgba(255, 255, 255, 0.75)');
219
+ }
220
+ const labels = [];
221
+ const chart_val = [];
222
+ var t_labels = "";
223
+
224
+ //var d_backgroundColors = ['#FF6384','#22CFCF','#0ea50b','#FF9F40','#FFCD56']
225
+ $.each(chart_data, function (key, value) {
226
+ if(labels_key != "" && value.hasOwnProperty(labels_key)){
227
+ t_labels =value[labels_key];
228
+ }else{
229
+ t_labels = value['date'];
230
+ }
231
+ labels.push(t_labels.toString());
232
+ //chart_val.push(value[field_key]);
233
+ chart_val.push(((value[field_key]!=null)?value[field_key]:0));
234
+ });
235
+ //console.log(alldata);
236
+ //console.log(field_key);
237
+ //console.log(chart_val);
238
+ const data = {
239
+ labels: labels,
240
+ datasets: [
241
+ {
242
+ data: chart_val,
243
+ borderColor: '#002BFC',
244
+ pointBorderColor: '#002BFC',
245
+ pointBackgroundColor: '#fff',
246
+ pointBorderWidth: 1,
247
+ pointRadius: 2,
248
+ fill: true,
249
+ backgroundColor: gradientFill,
250
+ borderWidth: 1
251
+ }
252
+ ]
253
+ };
254
+ const config = {
255
+ type: 'line',
256
+ data: data,
257
+ options: {
258
+ animation: {
259
+ easing: "easeInOutBack"
260
+ },
261
+ plugins:{
262
+ legend:false
263
+ },
264
+ responsive: true,
265
+ scales: {
266
+ y:{
267
+ fontColor: "#ffffff",
268
+ fontStyle: "normal",
269
+ beginAtZero: true,
270
+ maxTicksLimit: 5,
271
+ padding: 30,
272
+ grid:{
273
+ borderWidth:0,
274
+ },
275
+ ticks: {
276
+ stepSize: 1000,
277
+ callback: function(value) {
278
+ var ranges = [
279
+ { divider: 1e6, suffix: 'M' },
280
+ { divider: 1e3, suffix: 'k' }
281
+ ];
282
+ function formatNumber(n) {
283
+ for (var i = 0; i < ranges.length; i++) {
284
+ if (n >= ranges[i].divider) {
285
+ return (n / ranges[i].divider).toString() + ranges[i].suffix;
286
+ }
287
+ }
288
+ return n;
289
+ }
290
+ return '' + formatNumber(value);
291
+ }
292
+ }
293
+ },
294
+ x:{
295
+ padding: 10,
296
+ fontColor: "#ffffff",
297
+ fontStyle: "normal",
298
+ grid: {
299
+ display:false
300
+ }
301
+ }
302
+ }
303
+ }
304
+ };
305
+ chart_ids[chart_id] = new Chart(ctx,config);
306
+ },
307
  google_analytics_reports_call_api:function(post_data){
308
  var v_this = this;
309
+ var g_mail = post_data.g_mail;
310
  $.ajax({
311
  type: "POST",
312
  dataType: "json",
313
  url: tvc_ajax_url,
314
  data: post_data,
315
  success: function (response) {
316
+ console.log(post_data);
317
  if(response.error == false){
318
  if(Object.keys(response.data).length > 0){
319
  v_this.set_google_analytics_reports_value(response.data, post_data);
320
  }
321
  }else if(response.error == true && response.errors != undefined){
322
  const errors = response.errors;
323
+ if(response.errors == "access_token_error"){
324
+ if(g_mail != ""){
325
+ v_this.tvc_alert("error","","It seems the token to access your Google Analytics account is expired. Sign in with "+g_mail+" again to reactivate the token. <span class='google_connect_url'>Click here..</span>");
326
+ }else{
327
+ v_this.tvc_alert("error","","It seems the token to access your Google Analytics account is expired. Sign in with the connected email again to reactivate the token. <span class='google_connect_url'>Click here..</span>");
328
+ }
329
+ }else{
330
+ v_this.tvc_alert("error","Error",errors);
331
+ }
332
  }else{
333
  v_this.tvc_alert("error","Error","Analytics report data not fetched");
334
  }
339
  set_google_analytics_reports_value:function(data, post_data){
340
  var v_this = this;
341
  data = JSON.parse(data);
342
+ //console.log(data);
343
  var basic_data = data.dashboard_data_point;
344
  var currency_code = post_data.ga_currency;
345
  var plugin_url = post_data.plugin_url;
467
  })
468
  }
469
  if(reports_typs.conversion_funnel.is_free || paln_type == 'paid'){
470
+ if(Object.keys(data.ecommerce_funnel).length >1){
471
+ this.set_ecommerce_conversion_funnel(basic_data,data.ecommerce_funnel.shoppingStage);
472
+ this.set_ecommerce_checkout_funnel(data.ecommerce_funnel.shoppingStage);
473
+ }else{
474
+ $(".conversion_s1, .conversion_s2, .conversion_s3, .conversion_s4, .checkoutfunn_s1, .checkoutfunn_s2, .checkoutfunn_s3").html("");
475
+ }
476
  }
477
  },
478
  set_ecommerce_conversion_funnel:function(data,shoppingStage){
714
  }
715
  },
716
  cleare_dashboard:function(){
717
+ var v_this = this;
718
  $("#product_performance_report table tbody").html("");
719
  $("#medium_performance_report table tbody").html("");
720
+ $("#campaign_performance_report table tbody").html("");
721
  var canvas = document.getElementById('ecomfunchart');
722
  if( canvas != null){
723
  var is_blank = this.is_canvas_blank(canvas);
734
  checkout_bar_chart.destroy();
735
  }
736
  }
737
+
738
+ if(Object.keys(chart_ids).length > 0){
739
+ $.each(chart_ids, function (propKey, propValue) {
740
+ var canvas = document.getElementById(propKey);
741
+ if( canvas != null){
742
+ var is_blank = v_this.is_canvas_blank(canvas);
743
+ console.log(propValue+"-"+canvas+"-"+is_blank);
744
+ if(!is_blank){
745
+ chart_ids[propKey].destroy();
746
+ }
747
+ }
748
+ });
749
+ }
750
  },
751
  add_loader_for_analytics_reports:function(){
752
  var reg_section = this.get_analytics_reports_section();
797
  },'medium_performance_report':{
798
  'loading-type':'gif',
799
  'main-class':'medium_performance_report',
800
+ },'daily_clicks':{
801
+ 'loading-type':'gif',
802
+ 'main-class':'daily-clicks-bx',
803
+ },'daily_cost':{
804
+ 'loading-type':'gif',
805
+ 'main-class':'daily-cost-bx',
806
+ },'daily_sales':{
807
+ 'loading-type':'gif',
808
+ 'main-class':'daily-sales-bx',
809
+ },'daily_conversions':{
810
+ 'loading-type':'gif',
811
+ 'main-class':'daily-conversions-bx',
812
+ },'campaign_performance_report':{
813
+ 'loading-type':'gif',
814
+ 'main-class':'campaign_performance_report',
815
  }
816
  };
817
  },get_currency_symbols:function(code){
enhanced-ecommerce-google-analytics.php CHANGED
@@ -12,10 +12,10 @@
12
  * @package Enhanced E-commerce for Woocommerce store
13
  *
14
  * @wordpress-plugin
15
- * Plugin Name: Enhanced E-commerce for Woocommerce store
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.2.1
19
  * Author: Tatvic
20
  * Author URI: www.tatvic.com
21
  * License: GPL-2.0+
@@ -37,7 +37,7 @@ if ( ! defined( 'WPINC' ) ) {
37
  * Start at version 1.0.0 and use SemVer - https://semver.org
38
  * Rename this for your plugin and update it as you release new versions.
39
  */
40
- define( 'PLUGIN_TVC_VERSION', '4.2.1' );
41
  $fullName = plugin_basename( __FILE__ );
42
  $dir = str_replace('/enhanced-ecommerce-google-analytics.php','',$fullName);
43
  if ( ! defined( 'ENHANCAD_PLUGIN_NAME' ) ) {
12
  * @package Enhanced E-commerce for Woocommerce store
13
  *
14
  * @wordpress-plugin
15
+ * Plugin Name: 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.3.0
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.3.0' );
41
  $fullName = plugin_basename( __FILE__ );
42
  $dir = str_replace('/enhanced-ecommerce-google-analytics.php','',$fullName);
43
  if ( ! defined( 'ENHANCAD_PLUGIN_NAME' ) ) {
includes/setup/CustomApi.php CHANGED
@@ -406,6 +406,7 @@ class CustomApi{
406
  "Authorization: Bearer MTIzNA==",
407
  "content-type: application/json"
408
  );
 
409
  $access_token = $this->generateAccessToken($this->get_tvc_access_token(), $this->get_tvc_refresh_token());
410
  if($access_token != ""){
411
  $postData['access_token']= $access_token;
@@ -424,7 +425,7 @@ class CustomApi{
424
  }else{
425
  $return = new \stdClass();
426
  $return->error = true;
427
- $return->message = 'access_token_not_generate';
428
  return $return;
429
  }
430
  } catch (Exception $e) {
@@ -805,7 +806,7 @@ class CustomApi{
805
  if(isset($response->access_token)){
806
  return $response->access_token;
807
  }else{
808
- return $access_token;
809
  }
810
  } else {
811
  return $access_token;
406
  "Authorization: Bearer MTIzNA==",
407
  "content-type: application/json"
408
  );
409
+
410
  $access_token = $this->generateAccessToken($this->get_tvc_access_token(), $this->get_tvc_refresh_token());
411
  if($access_token != ""){
412
  $postData['access_token']= $access_token;
425
  }else{
426
  $return = new \stdClass();
427
  $return->error = true;
428
+ $return->message = 'access_token_error';
429
  return $return;
430
  }
431
  } catch (Exception $e) {
806
  if(isset($response->access_token)){
807
  return $response->access_token;
808
  }else{
809
+ //return $access_token;
810
  }
811
  } else {
812
  return $access_token;
includes/setup/ShoppingApi.php CHANGED
@@ -125,6 +125,8 @@ class ShoppingApi {
125
  'body' => wp_json_encode($data)
126
  );
127
 
 
 
128
  // Send remote request
129
  $request = wp_remote_post($url, $args);
130
 
@@ -148,6 +150,82 @@ class ShoppingApi {
148
  }
149
  }
150
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
151
  public function campaignPerformance($date_range_type, $days = 0, $from_date = '', $to_date = '') {
152
  try {
153
  $url = $this->apiDomain . '/reports/campaign-performance';
125
  'body' => wp_json_encode($data)
126
  );
127
 
128
+
129
+
130
  // Send remote request
131
  $request = wp_remote_post($url, $args);
132
 
150
  }
151
  }
152
 
153
+ public function accountPerformance_for_dashboard($date_range_type, $days = 0, $from_date = '', $to_date = '') {
154
+ try {
155
+ $days_diff = 0;
156
+ if ($date_range_type == 2) {
157
+ $days_diff = strtotime($to_date) - strtotime($from_date);
158
+ $days_diff = abs(round($days_diff / 86400));
159
+ }
160
+ $curl_url = $this->apiDomain . '/reports/account-performance';
161
+ $data = [
162
+ 'customer_id' => $this->customerId,
163
+ 'graph_type' => ($date_range_type == 2 && $days_diff > 61) ? 'month' : 'day',
164
+ 'date_range_type' => $date_range_type,
165
+ 'days' => $days,
166
+ 'from_date' => $from_date,
167
+ 'to_date' => $to_date
168
+ ];
169
+
170
+ $header = array(
171
+ "Authorization: Bearer $this->token",
172
+ "content-type: application/json"
173
+ );
174
+ $postData = json_encode($data);
175
+ $ch = curl_init();
176
+ curl_setopt_array($ch, array(
177
+ CURLOPT_URL => esc_url($curl_url),
178
+ CURLOPT_RETURNTRANSFER => true,
179
+ CURLOPT_TIMEOUT => 2000,
180
+ CURLOPT_HTTPHEADER => $header,
181
+ CURLOPT_POSTFIELDS => $postData
182
+ ));
183
+ $response = curl_exec($ch);
184
+ $response = json_decode($response);
185
+ $response->data->graph_type = $data['graph_type'];
186
+ return $response;
187
+ } catch (Exception $e) {
188
+ return $e->getMessage();
189
+ }
190
+ }
191
+ public function campaign_performance($date_range_type, $days = 0, $from_date = '', $to_date = '') {
192
+ try {
193
+ $curl_url = $this->apiDomain . '/reports/campaign-performance';
194
+ $days_diff = 0;
195
+ if ($date_range_type == 2) {
196
+ $days_diff = strtotime($to_date) - strtotime($from_date);
197
+ $days_diff = abs(round($days_diff / 86400));
198
+ }
199
+ $data = [
200
+ 'customer_id' => $this->customerId,
201
+ 'graph_type' => ($date_range_type == 2 && $days_diff > 61) ? 'month' : 'day',
202
+ 'date_range_type' => $date_range_type,
203
+ 'days' => $days,
204
+ 'from_date' => $from_date,
205
+ 'to_date' => $to_date
206
+ ];
207
+ $header = array(
208
+ "Authorization: Bearer $this->token",
209
+ "content-type: application/json"
210
+ );
211
+ $postData = json_encode($data);
212
+ $ch = curl_init();
213
+ curl_setopt_array($ch, array(
214
+ CURLOPT_URL => esc_url($curl_url),
215
+ CURLOPT_RETURNTRANSFER => true,
216
+ CURLOPT_TIMEOUT => 2000,
217
+ CURLOPT_HTTPHEADER => $header,
218
+ CURLOPT_POSTFIELDS => $postData
219
+ ));
220
+ $response = curl_exec($ch);
221
+ $response = json_decode($response);
222
+ // $response->data->graph_type = $data['graph_type'];
223
+ return $response;
224
+ } catch (Exception $e) {
225
+ return $e->getMessage();
226
+ }
227
+ }
228
+
229
  public function campaignPerformance($date_range_type, $days = 0, $from_date = '', $to_date = '') {
230
  try {
231
  $url = $this->apiDomain . '/reports/campaign-performance';
includes/setup/class-conversios-dashboard.php CHANGED
@@ -22,17 +22,39 @@ if ( ! class_exists( 'Conversios_Dashboard' ) ) {
22
  protected $is_need_to_update_api_data_wp_db = false;
23
  protected $pro_plan_site;
24
  protected $report_data;
 
 
 
 
 
25
  public function __construct( ){
 
26
  $this->TVC_Admin_Helper = new TVC_Admin_Helper();
27
  $this->CustomApi = new CustomApi();
 
28
  $this->subscription_id = $this->TVC_Admin_Helper->get_subscriptionId();
 
 
 
 
 
 
 
 
 
29
  $this->subscription_data = $this->TVC_Admin_Helper->get_user_subscription_data();
30
  $this->pro_plan_site = $this->TVC_Admin_Helper->get_pro_plan_site().'?utm_source=EE+Plugin+User+Interface&utm_medium=dashboard&utm_campaign=Upsell+at+Conversios';
31
  if(isset($this->subscription_data->plan_id) && !in_array($this->subscription_data->plan_id, array("1"))){
32
  $this->plan_id = $this->subscription_data->plan_id;
33
  }
 
 
 
 
 
34
 
35
  if( $this->subscription_id != "" ){
 
36
  $this->ga_traking_type = $this->subscription_data->tracking_option; // UA,GA4,BOTH
37
  $this->ga3_property_id = $this->subscription_data->property_id; // GA3
38
  $this->ga3_ua_analytic_account_id = $this->subscription_data->ua_analytic_account_id;
@@ -103,7 +125,12 @@ if ( ! class_exists( 'Conversios_Dashboard' ) ) {
103
  /**
104
  * daterage script
105
  **/
 
 
 
 
106
  var plan_id = '<?php echo $this->plan_id; ?>';
 
107
  //$(function() {
108
  var start = moment().subtract(30, 'days');
109
  var end = moment();
@@ -127,10 +154,14 @@ if ( ! class_exists( 'Conversios_Dashboard' ) ) {
127
  plugin_url:'<?php echo ENHANCAD_PLUGIN_URL; ?>',
128
  start_date :$.trim(start_date.replace(/\//g,"-")),
129
  end_date :$.trim(end_date.replace(/\//g,"-")),
 
 
130
  conversios_nonce:'<?php echo wp_create_nonce( 'conversios_nonce' ); ?>'
131
  };
132
  // Call API
133
- tvc_helper.get_google_analytics_reports(data);
 
 
134
  }
135
  $('#reportrange').daterangepicker({
136
  startDate: start,
@@ -184,305 +215,41 @@ if ( ! class_exists( 'Conversios_Dashboard' ) ) {
184
 
185
  $(".prmoclsbtn").on( "click", function() {
186
  $(this).parents('.promobandtop').fadeOut()
187
- });
188
 
189
  /**
190
- * click chart
191
- **/
192
- /*var click_ctx = document.getElementById('clickChart').getContext('2d');
193
- var clcikgradientFill = click_ctx.createLinearGradient(0, 0, 0, 500);
194
- clcikgradientFill.addColorStop(0.4, 'rgba(153, 170, 255, 0.9)');
195
- clcikgradientFill.addColorStop(0.85, 'rgba(255, 255, 255, 0.7)');
196
- var myChart = new Chart(click_ctx, {
197
-
198
- type: 'line',
199
- data: {
200
- labels: ['01/07/2021', '02/07/2021', '03/07/2021', '04/07/2021', '05/07/2021', '06/07/2021', '07/07/2021', '08/07/2021', '09/07/2021', '10/07/2021', '11/07/2021', '12/07/2021'],
201
- datasets: [{
202
- borderColor: '#002BFC',
203
- pointBorderColor: '#002BFC',
204
- pointBackgroundColor: '#fff',
205
- pointBorderWidth: 1,
206
- pointRadius: 2,
207
- fill: true,
208
- backgroundColor: clcikgradientFill,
209
- borderWidth: 1,
210
- data: [0,2500,2800,3000,4000,3200,4500,4400,3800,3400,3400,3950,2800,6000]
211
- }]
212
- },
213
- options: {
214
- animation: {
215
- easing: "easeInOutBack"
216
- },
217
- plugins:{
218
- legend:false
219
- },
220
- scales: {
221
- y:{
222
- fontColor: "#ffffff",
223
- fontStyle: "normal",
224
- beginAtZero: true,
225
- maxTicksLimit: 5,
226
- padding: 30,
227
- grid:{
228
- borderWidth:0,
229
- },
230
- ticks: {
231
- stepSize: 1000,
232
- callback: function(value) {
233
- var ranges = [
234
- { divider: 1e6, suffix: 'M' },
235
- { divider: 1e3, suffix: 'k' }
236
- ];
237
- function formatNumber(n) {
238
- for (var i = 0; i < ranges.length; i++) {
239
- if (n >= ranges[i].divider) {
240
- return (n / ranges[i].divider).toString() + ranges[i].suffix;
241
- }
242
- }
243
- return n;
244
- }
245
- return '' + formatNumber(value);
246
- }
247
- }
248
- },
249
- x:{
250
- padding: 10,
251
- fontColor: "#ffffff",
252
- fontStyle: "normal",
253
- grid: {
254
- display:false
255
- }
256
- }
257
-
258
- },
259
- }
260
- });
261
- /**
262
- * cost chart
263
- **/
264
- /*var ctx = document.getElementById('myChart').getContext("2d");
265
- var costgradientFill = ctx.createLinearGradient(0, 0, 0, 500);
266
- costgradientFill.addColorStop(0.4, 'rgba(110, 245, 197, 0.9)');
267
- costgradientFill.addColorStop(0.85, 'rgba(255, 255, 255, 0.7)');
268
-
269
- var myChart = new Chart(ctx, {
270
- type: 'line',
271
- data: {
272
- labels: ['01/07/2021', '02/07/2021', '03/07/2021', '04/07/2021', '05/07/2021', '06/07/2021', '07/07/2021', '08/07/2021', '09/07/2021', '10/07/2021', '11/07/2021', '12/07/2021','13/07/2021',],
273
- datasets: [{
274
- borderColor: '#14AE77',
275
- pointBorderColor: '#14AE77',
276
- pointBackgroundColor: '#fff',
277
- pointBorderWidth: 1,
278
- pointRadius: 2,
279
- fill: true,
280
- backgroundColor: costgradientFill,
281
- borderWidth: 1,
282
- data: [0,2500,2800,3000,4000,3200,4500,4400,3800,3400,3400,3950,2800,6000]
283
- }]
284
- },
285
- options: {
286
- animation: {
287
- easing: "easeInOutBack"
288
- },
289
- plugins:{
290
- legend:false
291
- },
292
- scales: {
293
- y:{
294
- fontColor: "#ffffff",
295
- fontStyle: "normal",
296
- beginAtZero: true,
297
- maxTicksLimit: 5,
298
- padding: 30,
299
- grid:{
300
- borderWidth:0,
301
- },
302
- ticks: {
303
- stepSize: 1000,
304
- callback: function(value) {
305
- var ranges = [
306
- { divider: 1e6, suffix: 'M' },
307
- { divider: 1e3, suffix: 'k' }
308
- ];
309
- function formatNumber(n) {
310
- for (var i = 0; i < ranges.length; i++) {
311
- if (n >= ranges[i].divider) {
312
- return (n / ranges[i].divider).toString() + ranges[i].suffix;
313
- }
314
- }
315
- return n;
316
- }
317
- return '' + formatNumber(value);
318
- }
319
- }
320
- },
321
- x:{
322
- padding: 10,
323
- fontColor: "#ffffff",
324
- fontStyle: "normal",
325
- grid: {
326
- display:false
327
- }
328
- }
329
-
330
- },
331
- }
332
- });
333
- /**
334
- * Conversions chart
335
- **/
336
- /*var conversions_ctx = document.getElementById('conversionsChart').getContext('2d');
337
- var conversionsgradientFill = click_ctx.createLinearGradient(0, 0, 0, 500);
338
- conversionsgradientFill.addColorStop(0.4, 'rgba(255, 229, 139, 0.9)');
339
- conversionsgradientFill.addColorStop(0.85, 'rgba(255, 255, 255, 0.7)');
340
- var myChart = new Chart(conversions_ctx, {
341
-
342
- type: 'line',
343
- data: {
344
- labels: ['01/07/2021', '02/07/2021', '03/07/2021', '04/07/2021', '05/07/2021', '06/07/2021', '07/07/2021', '08/07/2021', '09/07/2021', '10/07/2021', '11/07/2021', '12/07/2021'],
345
- datasets: [{
346
- borderColor: '#C0980E',
347
- pointBorderColor: '#C0980E',
348
- pointBackgroundColor: '#fff',
349
- pointBorderWidth: 1,
350
- pointRadius: 2,
351
- fill: true,
352
- backgroundColor: conversionsgradientFill,
353
- borderWidth: 1,
354
- data: [0,2500,2800,3000,4000,3200,4500,4400,3800,3400,3400,3950,2800,6000]
355
- }]
356
- },
357
- options: {
358
- animation: {
359
- easing: "easeInOutBack"
360
- },
361
- plugins:{
362
- legend:false
363
- },
364
- scales: {
365
- y:{
366
- fontColor: "#ffffff",
367
- fontStyle: "normal",
368
- beginAtZero: true,
369
- maxTicksLimit: 5,
370
- padding: 30,
371
- grid:{
372
- borderWidth:0,
373
- },
374
- ticks: {
375
- stepSize: 1000,
376
- callback: function(value) {
377
- var ranges = [
378
- { divider: 1e6, suffix: 'M' },
379
- { divider: 1e3, suffix: 'k' }
380
- ];
381
- function formatNumber(n) {
382
- for (var i = 0; i < ranges.length; i++) {
383
- if (n >= ranges[i].divider) {
384
- return (n / ranges[i].divider).toString() + ranges[i].suffix;
385
- }
386
- }
387
- return n;
388
- }
389
- return '' + formatNumber(value);
390
- }
391
- }
392
- },
393
- x:{
394
- padding: 10,
395
- fontColor: "#ffffff",
396
- fontStyle: "normal",
397
- grid: {
398
- display:false
399
- }
400
- }
401
-
402
- },
403
- }
404
- });
405
- /**
406
- * Sales chart
407
- **/
408
- /*var sales_ctx = document.getElementById('salesChart').getContext('2d');
409
- var salesgradientFill = click_ctx.createLinearGradient(0, 0, 0, 500);
410
- salesgradientFill.addColorStop(0.4, 'rgba(107, 232, 255, 0.9)');
411
- salesgradientFill.addColorStop(0.85, 'rgba(255, 255, 255, 0.75)');
412
-
413
- var myChart = new Chart(sales_ctx, {
414
-
415
- type: 'line',
416
- data: {
417
- labels: ['01/07/2021', '02/07/2021', '03/07/2021', '04/07/2021', '05/07/2021', '06/07/2021', '07/07/2021', '08/07/2021', '09/07/2021', '10/07/2021', '11/07/2021', '12/07/2021'],
418
- datasets: [{
419
- borderColor: '#159EB8',
420
- pointBorderColor: '#159EB8',
421
- pointBackgroundColor: '#fff',
422
- pointBorderWidth: 1,
423
- pointRadius: 2,
424
- fill: true,
425
- backgroundColor: salesgradientFill,
426
- borderWidth: 1,
427
- data: [0,2500,2800,3000,4000,3200,4500,4400,3800,3400,3400,3950,2800,6000]
428
- }]
429
- },
430
- options: {
431
- animation: {
432
- easing: "easeInOutBack"
433
- },
434
- plugins:{
435
- legend:false
436
- },
437
- scales: {
438
- y:{
439
- fontColor: "#ffffff",
440
- fontStyle: "normal",
441
- beginAtZero: true,
442
- maxTicksLimit: 5,
443
- padding: 30,
444
- grid:{
445
- borderWidth:0,
446
- },
447
- ticks: {
448
- stepSize: 1000,
449
- callback: function(value) {
450
- var ranges = [
451
- { divider: 1e6, suffix: 'M' },
452
- { divider: 1e3, suffix: 'k' }
453
- ];
454
- function formatNumber(n) {
455
- for (var i = 0; i < ranges.length; i++) {
456
- if (n >= ranges[i].divider) {
457
- return (n / ranges[i].divider).toString() + ranges[i].suffix;
458
- }
459
- }
460
- return n;
461
- }
462
- return '' + formatNumber(value);
463
- }
464
- }
465
-
466
- },
467
- x:{
468
- padding: 10,
469
- fontColor: "#ffffff",
470
- fontStyle: "normal",
471
- grid: {
472
- display:false
473
- }
474
- }
475
- },
476
- }
477
- });
478
- /**
479
- * End chart
480
  * table responcive
481
  **/
482
  $('.mbl-table').basictable({
483
  breakpoint: 768
484
  });
485
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
486
 
487
  });
488
  </script>
@@ -552,7 +319,7 @@ if ( ! class_exists( 'Conversios_Dashboard' ) ) {
552
  <div class="dshsmrycattxt dash-smry-title">Conversion Rate</div>
553
  <div class="dshsmrylrgtxt dash-smry-value">-</div>
554
  <div class="updownsmry dash-smry-compare-val">
555
- <img src="<?php echo ENHANCAD_PLUGIN_URL.'/admin/images/green-up.png'; ?>" alt="" />
556
  %
557
  </div>
558
  <div class="dshsmryprdtxt">From Previous Period</div>
@@ -651,7 +418,6 @@ if ( ! class_exists( 'Conversios_Dashboard' ) ) {
651
  </div>
652
  <div class="dshsmryprdtxt">From Previous Period</div>
653
  </div>
654
-
655
  </div> */?>
656
  </div>
657
  <!--- dashboard summary section end -->
@@ -900,54 +666,211 @@ if ( ! class_exists( 'Conversios_Dashboard' ) ) {
900
 
901
 
902
  <!--- Shopping and Google Ads Performance section start -->
903
- <?php /*
904
  <div class="mt24 whiteroundedbx ggladsperfom-sec">
905
  <h4>Shopping and Google Ads Performance</h4>
906
  <div class="row">
907
  <div class="col50">
908
- <div class="chartbx ggladschrtbx">
909
  <div class="chartcntnbx">
910
  <h5>Clicks</h5>
911
  <div class="chartarea">
912
- <canvas id="clickChart" width="400" height="300" class="chartcntainer"></canvas>
913
  </div>
914
  </div>
915
  </div>
916
  </div>
917
  <div class="col50">
918
- <div class="chartbx ggladschrtbx">
919
  <div class="chartcntnbx">
920
  <h5>Cost</h5>
921
  <div class="chartarea">
922
- <canvas id="myChart" width="400" height="300" class="chartcntainer"></canvas>
923
  </div>
924
  </div>
925
  </div>
926
  </div>
927
 
928
  <div class="col50">
929
- <div class="chartbx ggladschrtbx">
930
  <div class="chartcntnbx">
931
  <h5>Conversions</h5>
932
  <div class="chartarea">
933
- <canvas id="conversionsChart" width="400" height="300" class="chartcntainer"></canvas>
934
  </div>
935
  </div>
936
  </div>
937
  </div>
938
  <div class="col50">
939
- <div class="chartbx ggladschrtbx">
940
  <div class="chartcntnbx">
941
  <h5>Sales</h5>
942
  <div class="chartarea">
943
- <canvas id="salesChart" width="400" height="300" class="chartcntainer"></canvas>
944
  </div>
945
  </div>
946
  </div>
947
  </div>
948
  </div>
949
- </div> */ ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
950
  <!--- Shopping and Google Ads Performance section start -->
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
951
  <!-- UPGRADE SUBSCRIPTION -->
952
  <div id="upgradsbscrptn" class="pp-modal whitepopup upgradsbscrptn-pp">
953
  <div class="sycnprdct-ppcnt">
22
  protected $is_need_to_update_api_data_wp_db = false;
23
  protected $pro_plan_site;
24
  protected $report_data;
25
+ protected $notice;
26
+ protected $google_ads_id;
27
+
28
+ protected $connect_url;
29
+ protected $g_mail;
30
  public function __construct( ){
31
+
32
  $this->TVC_Admin_Helper = new TVC_Admin_Helper();
33
  $this->CustomApi = new CustomApi();
34
+ $this->connect_url = $this->TVC_Admin_Helper->get_custom_connect_url(admin_url().'admin.php?page=conversios');
35
  $this->subscription_id = $this->TVC_Admin_Helper->get_subscriptionId();
36
+ // update API data to DB while expired token
37
+
38
+ if ( isset($_GET['subscription_id']) && $_GET['subscription_id'] == $this->subscription_id){
39
+ if ( isset($_GET['g_mail']) && $_GET['g_mail']){
40
+ $this->TVC_Admin_Helper->update_subscription_details_api_to_db();
41
+ }
42
+ } else if(isset($_GET['subscription_id']) && $_GET['subscription_id']){
43
+ $this->notice = "You tried signing in with different email. Please try again by signing it with the email id that you used to set up the plugin earlier. <a href=\'".$this->TVC_Admin_Helper->get_conversios_site_url()."\' target=\'_blank\'>Reach out to us</a> if you have any difficulty.";
44
+ }
45
  $this->subscription_data = $this->TVC_Admin_Helper->get_user_subscription_data();
46
  $this->pro_plan_site = $this->TVC_Admin_Helper->get_pro_plan_site().'?utm_source=EE+Plugin+User+Interface&utm_medium=dashboard&utm_campaign=Upsell+at+Conversios';
47
  if(isset($this->subscription_data->plan_id) && !in_array($this->subscription_data->plan_id, array("1"))){
48
  $this->plan_id = $this->subscription_data->plan_id;
49
  }
50
+ if(isset($this->subscription_data->google_ads_id) && $this->subscription_data->google_ads_id != ""){
51
+ $this->google_ads_id = $this->subscription_data->google_ads_id;
52
+ }
53
+
54
+
55
 
56
  if( $this->subscription_id != "" ){
57
+ $this->g_mail = get_option('ee_customer_gmail');
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;
125
  /**
126
  * daterage script
127
  **/
128
+ var notice='<?php echo $this->notice; ?>';
129
+ if(notice != ""){
130
+ tvc_helper.tvc_alert("error","Email error",notice);
131
+ }
132
  var plan_id = '<?php echo $this->plan_id; ?>';
133
+ var g_mail = '<?php echo $this->g_mail; ?>';
134
  //$(function() {
135
  var start = moment().subtract(30, 'days');
136
  var end = moment();
154
  plugin_url:'<?php echo ENHANCAD_PLUGIN_URL; ?>',
155
  start_date :$.trim(start_date.replace(/\//g,"-")),
156
  end_date :$.trim(end_date.replace(/\//g,"-")),
157
+ g_mail:g_mail,
158
+ google_ads_id:'<?php echo $this->google_ads_id; ?>',
159
  conversios_nonce:'<?php echo wp_create_nonce( 'conversios_nonce' ); ?>'
160
  };
161
  // Call API
162
+ if(notice == ""){
163
+ tvc_helper.get_google_analytics_reports(data);
164
+ }
165
  }
166
  $('#reportrange').daterangepicker({
167
  startDate: start,
215
 
216
  $(".prmoclsbtn").on( "click", function() {
217
  $(this).parents('.promobandtop').fadeOut()
218
+ });
219
 
220
  /**
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
221
  * table responcive
222
  **/
223
  $('.mbl-table').basictable({
224
  breakpoint: 768
225
  });
226
 
227
+ /**
228
+ * Convesios custom script
229
+ */
230
+ //Step-0
231
+ $("#tvc_popup_box").on( "click",'span.google_connect_url', function() {
232
+ console.log("call");
233
+ const w =600; const h=650;
234
+ const dualScreenLeft = window.screenLeft !== undefined ? window.screenLeft : window.screenX;
235
+ const dualScreenTop = window.screenTop !== undefined ? window.screenTop : window.screenY;
236
+
237
+ const width = window.innerWidth ? window.innerWidth : document.documentElement.clientWidth ? document.documentElement.clientWidth : screen.width;
238
+ const height = window.innerHeight ? window.innerHeight : document.documentElement.clientHeight ? document.documentElement.clientHeight : screen.height;
239
+
240
+ const systemZoom = width / window.screen.availWidth;
241
+ const left = (width - w) / 2 / systemZoom + dualScreenLeft;
242
+ const top = (height - h) / 2 / systemZoom + dualScreenTop;
243
+ var url ='<?php echo $this->connect_url; ?>';
244
+ url = url.replace(/&amp;/g, '&');
245
+ const newWindow = window.open(url, "newwindow", config= `scrollbars=yes,
246
+ width=${w / systemZoom},
247
+ height=${h / systemZoom},
248
+ top=${top},
249
+ left=${left},toolbar=no,menubar=no,scrollbars=no,resizable=no,location=no,directories=no,status=no
250
+ `);
251
+ if (window.focus) newWindow.focus();
252
+ });
253
 
254
  });
255
  </script>
319
  <div class="dshsmrycattxt dash-smry-title">Conversion Rate</div>
320
  <div class="dshsmrylrgtxt dash-smry-value">-</div>
321
  <div class="updownsmry dash-smry-compare-val">
322
+ <img src="<?php echo ENHANCAD_PLUGIN_URL.'/admin/images/green-up.png'; ?>" alt="" />
323
  %
324
  </div>
325
  <div class="dshsmryprdtxt">From Previous Period</div>
418
  </div>
419
  <div class="dshsmryprdtxt">From Previous Period</div>
420
  </div>
 
421
  </div> */?>
422
  </div>
423
  <!--- dashboard summary section end -->
666
 
667
 
668
  <!--- Shopping and Google Ads Performance section start -->
669
+ <?php /* if($this->plan_id != 1){?>
670
  <div class="mt24 whiteroundedbx ggladsperfom-sec">
671
  <h4>Shopping and Google Ads Performance</h4>
672
  <div class="row">
673
  <div class="col50">
674
+ <div class="chartbx ggladschrtbx daily-clicks-bx">
675
  <div class="chartcntnbx">
676
  <h5>Clicks</h5>
677
  <div class="chartarea">
678
+ <canvas id="dailyClicks" width="400" height="300" class="chartcntainer"></canvas>
679
  </div>
680
  </div>
681
  </div>
682
  </div>
683
  <div class="col50">
684
+ <div class="chartbx ggladschrtbx daily-cost-bx">
685
  <div class="chartcntnbx">
686
  <h5>Cost</h5>
687
  <div class="chartarea">
688
+ <canvas id="dailyCost" width="400" height="300" class="chartcntainer"></canvas>
689
  </div>
690
  </div>
691
  </div>
692
  </div>
693
 
694
  <div class="col50">
695
+ <div class="chartbx ggladschrtbx daily-conversions-bx">
696
  <div class="chartcntnbx">
697
  <h5>Conversions</h5>
698
  <div class="chartarea">
699
+ <canvas id="dailyConversions" width="400" height="300" class="chartcntainer"></canvas>
700
  </div>
701
  </div>
702
  </div>
703
  </div>
704
  <div class="col50">
705
+ <div class="chartbx ggladschrtbx daily-sales-bx">
706
  <div class="chartcntnbx">
707
  <h5>Sales</h5>
708
  <div class="chartarea">
709
+ <canvas id="dailySales" width="400" height="300" class="chartcntainer"></canvas>
710
  </div>
711
  </div>
712
  </div>
713
  </div>
714
  </div>
715
+ </div>
716
+ <?php }else{ ?>
717
+ <div class="mt24 whiteroundedbx ggladsperfom-sec">
718
+ <h4>Shopping and Google Ads Performance</h4>
719
+ <div class="row">
720
+ <div class="col50">
721
+ <div class="chartbx ecomfunnchrtbx">
722
+ <div class="chartcntnbx prochrtftr">
723
+ <h5>Google Ads Clicks Performance</h5>
724
+ <div class="chartarea">
725
+ <img src="<?php echo ENHANCAD_PLUGIN_URL.'/admin/images/table-data.jpg'; ?>" alt="" />
726
+ </div>
727
+ </div>
728
+ <div class="prochrtovrbox">
729
+ <div class="prochrtcntn">
730
+ <div class="prochrttop">
731
+ <img src="<?php echo ENHANCAD_PLUGIN_URL.'/admin/images/lock-orange.png'; ?>" alt="" />
732
+ Locked
733
+ </div>
734
+ <h5>Google Ads Clicks Performance</h5>
735
+ <p>This report will help you .</p>
736
+ <a class="blueupgrdbtn" href="<?php echo $this->pro_plan_site; ?>" target="_blank">Upgrade Now</a>
737
+ </div>
738
+ </div>
739
+ </div>
740
+ </div>
741
+ <div class="col50">
742
+ <div class="chartbx ecomfunnchrtbx">
743
+ <div class="chartcntnbx prochrtftr">
744
+ <h5>Google Ads Cost Performance</h5>
745
+ <div class="chartarea">
746
+ <img src="<?php echo ENHANCAD_PLUGIN_URL.'/admin/images/table-data.jpg'; ?>" alt="" />
747
+ </div>
748
+ </div>
749
+ <div class="prochrtovrbox">
750
+ <div class="prochrtcntn">
751
+ <div class="prochrttop">
752
+ <img src="<?php echo ENHANCAD_PLUGIN_URL.'/admin/images/lock-orange.png'; ?>" alt="" />
753
+ Locked
754
+ </div>
755
+ <h5>Google Ads Cost Performance</h5>
756
+ <p>This report will help you understand how products in your store are performing and based on it you can take informed merchandising decision to further increase your revenue.</p>
757
+ <a class="blueupgrdbtn" href="<?php echo $this->pro_plan_site; ?>" target="_blank">Upgrade Now</a>
758
+ </div>
759
+ </div>
760
+ </div>
761
+ </div>
762
+
763
+ <div class="col50">
764
+ <div class="chartbx ecomfunnchrtbx">
765
+ <div class="chartcntnbx prochrtftr">
766
+ <h5>Google Ads Conversions Performance</h5>
767
+ <div class="chartarea">
768
+ <img src="<?php echo ENHANCAD_PLUGIN_URL.'/admin/images/table-data.jpg'; ?>" alt="" />
769
+ </div>
770
+ </div>
771
+ <div class="prochrtovrbox">
772
+ <div class="prochrtcntn">
773
+ <div class="prochrttop">
774
+ <img src="<?php echo ENHANCAD_PLUGIN_URL.'/admin/images/lock-orange.png'; ?>" alt="" />
775
+ Locked
776
+ </div>
777
+ <h5>Google Ads Conversions Performance</h5>
778
+ <p>This report will help you </p>
779
+ <a class="blueupgrdbtn" href="<?php echo $this->pro_plan_site; ?>" target="_blank">Upgrade Now</a>
780
+ </div>
781
+ </div>
782
+ </div>
783
+ </div>
784
+ <div class="col50">
785
+ <div class="chartbx ecomfunnchrtbx">
786
+ <div class="chartcntnbx prochrtftr">
787
+ <h5>Google Ads Sales Performance</h5>
788
+ <div class="chartarea">
789
+ <img src="<?php echo ENHANCAD_PLUGIN_URL.'/admin/images/table-data.jpg'; ?>" alt="" />
790
+ </div>
791
+ </div>
792
+ <div class="prochrtovrbox">
793
+ <div class="prochrtcntn">
794
+ <div class="prochrttop">
795
+ <img src="<?php echo ENHANCAD_PLUGIN_URL.'/admin/images/lock-orange.png'; ?>" alt="" />
796
+ Locked
797
+ </div>
798
+ <h5>Google Ads Sales Performance</h5>
799
+ <p>This report will help you.</p>
800
+ <a class="blueupgrdbtn" href="<?php echo $this->pro_plan_site; ?>" target="_blank">Upgrade Now</a>
801
+ </div>
802
+ </div>
803
+ </div>
804
+ </div>
805
+ </div>
806
+ </div>
807
+
808
+ <?php } */ ?>
809
  <!--- Shopping and Google Ads Performance section start -->
810
+
811
+ <!--- Compaign section start -->
812
+ <?php if($this->plan_id != 1){?>
813
+ <div class="mt24 whiteroundedbx dshreport-sec">
814
+ <div class="row dsh-reprttop">
815
+ <div class="dshrprttp-left">
816
+ <h4>Campaign Performance</h4>
817
+ <a href="" class="viewallbtn <?php echo $this->add_upgrdsbrs_btn_calss('download_pdf'); ?>">View all <img src="<?php echo ENHANCAD_PLUGIN_URL.'/admin/images/blue-right-arrow.png'; ?>" alt="" /></a>
818
+ </div>
819
+ </div>
820
+ <div class="dashtablewrp campaign_performance_report" id="campaign_performance_report">
821
+ <?php if($this->google_ads_id == ""){
822
+ ?>
823
+ <p>Set up your google ads account from <a href="<?php echo $this->TVC_Admin_Helper->get_onboarding_page_url(); ?>">here</a> in order to access Campaign performance data.</p>
824
+ <?php
825
+ } ?>
826
+ <table class="dshreporttble mbl-table" >
827
+ <thead>
828
+ <tr>
829
+ <th class="prdnm-cell">Campaign Name</th>
830
+ <th>Daily Budget</th>
831
+ <th>Status</th>
832
+ <th>Clicks</th>
833
+ <th>Cost</th>
834
+ <th>Conversions</th>
835
+ <th>Sales</th>
836
+ </tr>
837
+ </thead>
838
+ <tbody>
839
+
840
+ </tbody>
841
+ </table>
842
+
843
+ </div>
844
+ </div>
845
+ <?php }else{ ?>
846
+ <div class="mt24 whiteroundedbx dshreport-sec">
847
+ <div class="row dsh-reprttop">
848
+ <div class="col">
849
+ <div class="chartbx ecomfunnchrtbx">
850
+ <div class="chartcntnbx prochrtftr">
851
+ <h5>Campaign Performance</h5>
852
+ <div class="chartarea">
853
+ <img src="<?php echo ENHANCAD_PLUGIN_URL.'/admin/images/table-data.jpg'; ?>" alt="" />
854
+ </div>
855
+ </div>
856
+ <div class="prochrtovrbox">
857
+ <div class="prochrtcntn">
858
+ <div class="prochrttop">
859
+ <img src="<?php echo ENHANCAD_PLUGIN_URL.'/admin/images/lock-orange.png'; ?>" alt="" />
860
+ Locked
861
+ </div>
862
+ <h5>Campaign Performance</h5>
863
+ <p>Access your campaign performance data to know how are they performing and take actionable decisions to increase your marketing ROI.</p>
864
+ <a class="blueupgrdbtn" href="<?php echo $this->pro_plan_site; ?>" target="_blank">Upgrade Now</a>
865
+ </div>
866
+ </div>
867
+ </div>
868
+ </div>
869
+ </div>
870
+ </div>
871
+ <?php } ?>
872
+ <!--- Source Performance Report section over -->
873
+
874
  <!-- UPGRADE SUBSCRIPTION -->
875
  <div id="upgradsbscrptn" class="pp-modal whitepopup upgradsbscrptn-pp">
876
  <div class="sycnprdct-ppcnt">
includes/setup/google-shopping-feed-shopping-campaigns.php CHANGED
@@ -231,7 +231,7 @@ class CampaignsConfiguration
231
  <div class="account-performance">
232
  <div class="row">
233
  <div class="col-lg-8">
234
- <h3 class="title">Compaign Performance</h3>
235
  <div class="table-section">
236
  <table id="campaingPerformance" class="table dt-responsive nowrap" style="width:100%">
237
  <thead>
231
  <div class="account-performance">
232
  <div class="row">
233
  <div class="col-lg-8">
234
+ <h3 class="title">Campaign Performance</h3>
235
  <div class="table-section">
236
  <table id="campaingPerformance" class="table dt-responsive nowrap" style="width:100%">
237
  <thead>
readme.txt CHANGED
@@ -8,8 +8,8 @@ Author: Tatvic
8
  Requires at least: 1.4.1
9
  Tested up to: 5.8.1
10
  Requires PHP: 5.6 or Higher
11
- Stable tag: 4.2.1
12
- Version: 4.2.1
13
  License: GPLv3
14
  License URI: http://www.gnu.org/licenses/gpl-3.0.html
15
 
@@ -379,6 +379,13 @@ You can resolve the duplication of data by removing the manually implemented GA
379
 
380
 
381
  == Changelog ==
 
 
 
 
 
 
 
382
 
383
  = 4.2.1 - 21/09/2021 =
384
 
8
  Requires at least: 1.4.1
9
  Tested up to: 5.8.1
10
  Requires PHP: 5.6 or Higher
11
+ Stable tag: 4.3.0
12
+ Version: 4.3.0
13
  License: GPLv3
14
  License URI: http://www.gnu.org/licenses/gpl-3.0.html
15
 
379
 
380
 
381
  == Changelog ==
382
+ = 4.3.0 - 29/09/2021 =
383
+
384
+ * We have added Campaign performance data in the dashboard. This will allow you to have visibility on your Google ads campaigns. It will show you clicks, cost, conversions, and sales like important metric for each campaign so that you can take informed decisions to increase your marketing ROI.
385
+
386
+ * Enhanced Google authentication flow in order to manage expiry of tokens.
387
+
388
+ * Resolved some bugs on the onboarding page for better performance
389
 
390
  = 4.2.1 - 21/09/2021 =
391