Enhanced Ecommerce Google Analytics Plugin for WooCommerce - Version 4.4.1

Version Description

  • 15/11/2021 =

  • Earlier, agency owners having multiple Google analytics accounts associated with a single email id used to face issues in loading all the Google analytics accounts on the onboarding screen. We have added load more capability in order to provide smooth user experience

Download this release

Release Info

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

Code changes from version 4.4.0 to 4.4.1

admin/class-conversios-onboarding.php CHANGED
@@ -270,9 +270,19 @@ if ( ! class_exists( 'Conversios_Onboarding' ) ) {
270
  Universal Analytics (Google Analytics 3)
271
  </label>
272
  <div id="UA" class="slctunivr-filed">
273
- <select class="slect2bx google_analytics_sel" id="ua_web_property_id">
274
  <option value=''>Select Property Id</option>
275
- </select>
 
 
 
 
 
 
 
 
 
 
276
  </div>
277
  </div>
278
  <div class="cstmrdobtn-item">
@@ -282,9 +292,21 @@ if ( ! class_exists( 'Conversios_Onboarding' ) ) {
282
  Google Analytics 4
283
  </label>
284
  <div id="GA4" class="slctunivr-filed">
285
- <select class="slect2bx google_analytics_sel" id="ga4_web_measurement_id">
286
  <option value=''>Select Measurement Id</option>
287
- </select>
 
 
 
 
 
 
 
 
 
 
 
 
288
  </div>
289
  </div>
290
  <div class="cstmrdobtn-item">
@@ -295,15 +317,37 @@ if ( ! class_exists( 'Conversios_Onboarding' ) ) {
295
  </label>
296
  <div id="BOTH" class="slctunivr-filed">
297
  <div class="botslectbxitem">
298
- <select class="slect2bx google_analytics_sel" id="both_web_property_id">
299
  <option value=''>Select Property Id</option>
300
- </select>
 
 
 
 
 
 
 
 
 
 
301
  </div>
302
  <div class="botslectbxitem">
303
- <select class="slect2bx google_analytics_sel" id="both_web_measurement_id">
304
  <option value=''>Select Measurement Id</option>
305
- </select>
 
 
 
 
 
 
 
 
 
 
 
306
  </div>
 
307
  </div>
308
  </div>
309
  </div>
@@ -741,6 +785,20 @@ if ( ! class_exists( 'Conversios_Onboarding' ) ) {
741
  $("#"+tracking_option).slideDown();
742
  //is_validate_step("step_1");
743
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
744
 
745
  $("input[type=radio][name=analytic_tag_type]").on( "change", function() {
746
  let tracking_option = this.value;
@@ -809,7 +867,7 @@ if ( ! class_exists( 'Conversios_Onboarding' ) ) {
809
  var conversios_onboarding_nonce = $("#conversios_onboarding_nonce").val();
810
  var tracking_option = $('input[type=radio][name=analytic_tag_type]:checked').val();
811
  var view_id = "";
812
- add_message("warning","Process to save your settings. Do not refresh..",false);
813
  if(tracking_option == "UA"){
814
  ga_view_id = $("#ua_web_property_id").find(':selected').data('profileid');
815
  }else{
270
  Universal Analytics (Google Analytics 3)
271
  </label>
272
  <div id="UA" class="slctunivr-filed">
273
+ <?php /*<select class="slect2bx google_analytics_sel" id="ua_web_property_id">
274
  <option value=''>Select Property Id</option>
275
+ </select> */ ?>
276
+ <div class="tvc-dropdown">
277
+ <div class="tvc-dropdown-header" id="ua_web_property_id_option_val" data-accountid="<?php if($googleDetail->ua_analytic_account_id){ echo $googleDetail->ua_analytic_account_id; } ?>" data-val="<?php if($googleDetail->property_id){ echo $googleDetail->property_id; } ?>"><?php if($googleDetail->property_id){
278
+ echo $googleDetail->property_id;
279
+ }else{?>Select Property Id<?php } ?></div>
280
+ <div class="tvc-dropdown-content" id="ua_web_property_id_option">
281
+ <div class="tvc-select-items"><option value="">Select Property Id</option></div>
282
+ <div class="tvc-ua-option-more option">Load More</div>
283
+ </div>
284
+ </div>
285
+
286
  </div>
287
  </div>
288
  <div class="cstmrdobtn-item">
292
  Google Analytics 4
293
  </label>
294
  <div id="GA4" class="slctunivr-filed">
295
+ <?php /*<select class="slect2bx google_analytics_sel" id="ga4_web_measurement_id">
296
  <option value=''>Select Measurement Id</option>
297
+ </select> */ ?>
298
+ <div class="tvc-dropdown">
299
+ <div class="tvc-dropdown-header" id="ga4_web_measurement_id_option_val" data-accountid="<?php if($googleDetail->ga4_analytic_account_id){ echo $googleDetail->ga4_analytic_account_id; } ?>" data-val="<?php if($googleDetail->measurement_id){ echo $googleDetail->measurement_id; } ?>">
300
+ <?php if($googleDetail->measurement_id){
301
+ echo $googleDetail->measurement_id;
302
+ }else{?>Select Measurement Id
303
+ <?php } ?></div>
304
+ <div class="tvc-dropdown-content" id="ga4_web_measurement_id_option">
305
+ <div class="tvc-select-items"><option value="">Select Measurement Id</option></div>
306
+ <div class="tvc-ga4-option-more option">Load More</div>
307
+ </div>
308
+ </div>
309
+
310
  </div>
311
  </div>
312
  <div class="cstmrdobtn-item">
317
  </label>
318
  <div id="BOTH" class="slctunivr-filed">
319
  <div class="botslectbxitem">
320
+ <?php /*<select class="slect2bx google_analytics_sel" id="both_web_property_id">
321
  <option value=''>Select Property Id</option>
322
+ </select>*/ ?>
323
+ <div class="tvc-dropdown">
324
+ <div class="tvc-dropdown-header" id="both_ua_web_property_id_option_val" data-accountid="<?php if($googleDetail->ua_analytic_account_id){ echo $googleDetail->ua_analytic_account_id; } ?>" data-val="<?php if($googleDetail->property_id){ echo $googleDetail->property_id; } ?>"><?php if($googleDetail->property_id){
325
+ echo $googleDetail->property_id;
326
+ }else{?>Select Property Id<?php } ?></div>
327
+ <div class="tvc-dropdown-content" id="both_ua_web_property_id_option">
328
+ <div class="tvc-select-items"><option value="">Select Property Id</option></div>
329
+ <div class="tvc-ua-option-more option">Load More</div>
330
+ </div>
331
+ </div>
332
+
333
  </div>
334
  <div class="botslectbxitem">
335
+ <?php /*<select class="slect2bx google_analytics_sel" id="both_web_measurement_id">
336
  <option value=''>Select Measurement Id</option>
337
+ </select> */ ?>
338
+ <div class="tvc-dropdown">
339
+ <div class="tvc-dropdown-header" id="both_ga4_web_measurement_id_option_val" data-accountid="<?php if($googleDetail->ga4_analytic_account_id){ echo $googleDetail->ga4_analytic_account_id; } ?>" data-val="<?php if($googleDetail->measurement_id){ echo $googleDetail->measurement_id; } ?>">
340
+ <?php if($googleDetail->measurement_id){
341
+ echo $googleDetail->measurement_id;
342
+ }else{?>Select Measurement Id
343
+ <?php } ?></div>
344
+ <div class="tvc-dropdown-content" id="both_ga4_web_measurement_id_option">
345
+ <div class="tvc-select-items"><option value="">Select Measurement Id</option></div>
346
+ <div class="tvc-ga4-option-more option">Load More</div>
347
+ </div>
348
+ </div>
349
  </div>
350
+ <div id="old_tracking" data-tracking_option="<?php echo $tracking_option; ?>" data-measurement_id="<?php echo $googleDetail->measurement_id; ?>" data-property_id="<?php echo $googleDetail->property_id; ?>"></div>
351
  </div>
352
  </div>
353
  </div>
785
  $("#"+tracking_option).slideDown();
786
  //is_validate_step("step_1");
787
  }
788
+ var ua_page =2;
789
+ var ga4_page =2;
790
+ $('.tvc-ua-option-more').click(function(event){
791
+ //let tracking_option = $('input[type=radio][name=analytic_tag_type]:checked').val();
792
+ call_list_analytics_web_properties("UA", tvc_data, ua_page);
793
+ ua_page++;
794
+ event.stopPropagation();
795
+ })
796
+ $('.tvc-ga4-option-more').click(function(event){
797
+ //let tracking_option = $('input[type=radio][name=analytic_tag_type]:checked').val();
798
+ call_list_analytics_web_properties("GA4", tvc_data, ga4_page);
799
+ ga4_page++;
800
+ event.stopPropagation();
801
+ })
802
 
803
  $("input[type=radio][name=analytic_tag_type]").on( "change", function() {
804
  let tracking_option = this.value;
867
  var conversios_onboarding_nonce = $("#conversios_onboarding_nonce").val();
868
  var tracking_option = $('input[type=radio][name=analytic_tag_type]:checked').val();
869
  var view_id = "";
870
+ add_message("warning","Processing... Do not refresh.",false);
871
  if(tracking_option == "UA"){
872
  ga_view_id = $("#ua_web_property_id").find(':selected').data('profileid');
873
  }else{
admin/css/style.css CHANGED
@@ -277,6 +277,75 @@ button:disabled,button[disabled], button:disabled:hover,button[disabled]:hover{b
277
  -webkit-animation: 1s spin linear infinite;
278
  animation: 1s tvc-spin linear infinite;
279
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
280
  /*rc */
281
  @charset "utf-8";
282
  @import url('https://fonts.googleapis.com/css2?family=Roboto:ital,wght@0,300;0,400;0,500;0,700;1,500&display=swap');
277
  -webkit-animation: 1s spin linear infinite;
278
  animation: 1s tvc-spin linear infinite;
279
  }
280
+ /*onboarding page*/
281
+ .tvc-dropdown{
282
+ max-width: 400px;
283
+ display: block;
284
+ position: relative;
285
+ }
286
+
287
+ .tvc-dropdown-content{
288
+ display: none;
289
+ border-top: none;
290
+ border-top-left-radius: 0;
291
+ border-top-right-radius: 0;
292
+ box-shadow: 0px 3px 6px rgb(0 0 0 / 12%);
293
+ overflow: hidden;
294
+ }
295
+ .tvc-select-items {
296
+ height: 150px;
297
+ overflow-y: auto;
298
+
299
+ left: 0;
300
+ right: 0;
301
+ z-index: 99;
302
+ }
303
+ .tvc-dropdown-content .tvc-select-items .option, .tvc-dropdown-content .option, .tvc-dropdown-content .tvc-select-items option{
304
+ padding: 6px 14px;
305
+ user-select: none;
306
+ -webkit-user-select: none;
307
+ cursor: pointer;
308
+ margin-bottom: 6px;
309
+ }
310
+
311
+ .tvc-dropdown-content .tvc-select-items .option:hover, .tvc-dropdown-content .tvc-select-items option:hover, .tvc-dropdown-content .option:hover{
312
+ background-color: lightgray;
313
+ }
314
+
315
+ .tvc-dropdown-header{
316
+ padding: 2px 10px;
317
+ background-color: #fff;
318
+ border: 1px solid #C6C6C6;
319
+ border-radius: 6px;
320
+ box-sizing: border-box;
321
+ cursor: pointer;
322
+ display: block;
323
+ height: 42px;
324
+ user-select: none;
325
+ -webkit-user-select: none;
326
+ top: 50%;
327
+ width: 400px;
328
+ vertical-align: middle;
329
+ display: table-cell;
330
+ }
331
+ .tvc-dropdown-content .tvc-ga4-option-more, .tvc-dropdown-content .tvc-ua-option-more{
332
+ text-decoration: none;
333
+ color: #002BFC;
334
+ margin-bottom: 0;
335
+ }
336
+ .tvc-dropdown .tvc-dropdown-header:before, .tvc-dropdown .tvc-dropdown-header:before {
337
+ content: "";
338
+ background-image: url(../images/step-down-arrow.png);
339
+ width: 24px;
340
+ height: 24px;
341
+ background-repeat: no-repeat;
342
+ background-size: 100%;
343
+ position: absolute;
344
+ right: 10px;
345
+ top: 22px;
346
+ transform: translateY(-50%);
347
+ }
348
+ /*end onboarding page*/
349
  /*rc */
350
  @charset "utf-8";
351
  @import url('https://fonts.googleapis.com/css2?family=Roboto:ital,wght@0,300;0,400;0,500;0,700;1,500&display=swap');
admin/helper/class-onboarding-helper.php CHANGED
@@ -572,11 +572,19 @@ if(!class_exists('Conversios_Onboarding_ApiCall') ){
572
  //$tvc_data = json_decode(base64_decode($postData['tvc_data']));
573
  //unset($postData['tvc_data']);
574
  $url = $this->apiDomain . '/google-analytics/account-list';
575
- $header = array("Authorization: Bearer MTIzNA==", "content-type: application/json", "AccessToken:$this->access_token");
 
 
 
 
 
 
576
  $data = [
577
- 'merchant_id' => $this->merchantId,
578
- 'type' => $postData['type']
 
579
  ];
 
580
  $curl_url = $url;
581
  $postData = json_encode($data);
582
  $ch = curl_init();
572
  //$tvc_data = json_decode(base64_decode($postData['tvc_data']));
573
  //unset($postData['tvc_data']);
574
  $url = $this->apiDomain . '/google-analytics/account-list';
575
+ $header = array("Authorization: Bearer MTIzNA==", "content-type: application/json", "AccessToken:$this->access_token");
576
+ $max_results = 10;
577
+ $page = (isset($postData['page']) && $postData['page'] >1)?$postData['page']:"1";
578
+ if($page > 1){
579
+ //set index
580
+ $page = (($page-1) * $max_results)+1;
581
+ }
582
  $data = [
583
+ 'type' => $postData['type'],
584
+ 'page'=>$page,
585
+ 'max_results'=>$max_results
586
  ];
587
+ //print_r($data);
588
  $curl_url = $url;
589
  $postData = json_encode($data);
590
  $ch = curl_init();
admin/js/onboarding-custom.js CHANGED
@@ -32,28 +32,28 @@ function is_validate_step(step){
32
  var tracking_option = $('input[type=radio][name=analytic_tag_type]:checked').val();
33
  //console.log(tracking_option);
34
  if(tracking_option == "UA"){
35
- web_property_id = $('#ua_web_property_id').val();
36
- ua_account_id = $("#ua_web_property_id").find(':selected').data('accountid');
37
- if(web_property_id == ""){
38
  msg = "Please select web property id.";
39
  }else{
40
  is_valide = true;
41
  }
42
  }else if(tracking_option == "GA4"){
43
- web_measurement_id = $('#ga4_web_measurement_id').val();
44
- ga4_account_id = $("#ga4_web_measurement_id").find(':selected').data('accountid');
45
- if(web_measurement_id == ""){
46
  msg = "Please select measurement id.";
47
  }else{
48
  is_valide = true;
49
  }
50
  }else{
51
- web_property_id = $('#both_web_property_id').val();
52
- ua_account_id = $("#both_web_property_id").find(':selected').data('accountid');
53
- web_measurement_id = $('#both_web_measurement_id').val();
54
- ga4_account_id = $("#both_web_measurement_id").find(':selected').data('accountid');
55
-
56
- if(web_property_id == "" || web_measurement_id == ""){
57
  msg = "Please select property/measurement id.";
58
  }else{
59
  is_valide = true;
@@ -84,6 +84,51 @@ function is_validate_step(step){
84
  $(document).ready(function () {
85
  loaderSection(false);
86
  //step-1
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
87
  $(".google_analytics_sel").on( "change", function() {
88
  is_validate_step("step_1");
89
  $(".onbrdstep-1").removeClass('selectedactivestep');
@@ -118,9 +163,52 @@ $(document).ready(function () {
118
  e.stopPropagation();
119
  });
120
  });
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
121
  //save nalytics web properties while next button click
122
  function save_analytics_web_properties(tracking_option, tvc_data, subscription_id){
123
- if(subscription_id != ""){
 
124
  var web_measurement_id = "";
125
  var web_property_id = "";
126
  var ga4_account_id = "";
@@ -128,24 +216,24 @@ function save_analytics_web_properties(tracking_option, tvc_data, subscription_i
128
  var is_valide = true;
129
  var msg ="";
130
  if(tracking_option == "UA"){
131
- web_property_id = $('#ua_web_property_id').val();
132
- ua_account_id = $("#ua_web_property_id").find(':selected').data('accountid');
133
  if(web_property_id == ""){
134
  is_valide = false;
135
  msg = "Please select web property id.";
136
  }
137
  }else if(tracking_option == "GA4"){
138
- web_measurement_id = $('#ga4_web_measurement_id').val();
139
- ga4_account_id = $("#ga4_web_measurement_id").find(':selected').data('accountid');
140
  if(web_measurement_id == ""){
141
  is_valide = false;
142
  msg = "Please select measurement id.";
143
  }
144
  }else{
145
- web_property_id = $('#both_web_property_id').val();
146
- ua_account_id = $("#both_web_property_id").find(':selected').data('accountid');
147
- web_measurement_id = $('#both_web_measurement_id').val();
148
- ga4_account_id = $("#both_web_measurement_id").find(':selected').data('accountid');
149
 
150
  if(web_property_id == "" || web_measurement_id == ""){
151
  is_valide = false;
@@ -171,6 +259,7 @@ function save_analytics_web_properties(tracking_option, tvc_data, subscription_i
171
  tvc_data:tvc_data,
172
  conversios_onboarding_nonce:conversios_onboarding_nonce
173
  };
 
174
  $.ajax({
175
  type: "POST",
176
  dataType: "json",
@@ -196,7 +285,7 @@ function save_analytics_web_properties(tracking_option, tvc_data, subscription_i
196
  add_message("warning",msg);
197
  return false;
198
  }
199
- }else{
200
  add_message("warning","Missing value of subscription id.");
201
  return false;
202
  }
@@ -233,20 +322,25 @@ function save_google_ads_data(google_ads_id, tvc_data, subscription_id, is_skip=
233
  if(plan_id != 1){
234
  check_oradd_conversion_list(google_ads_id, tvc_data);
235
  }
236
- if ($("#link_google_analytics_with_google_ads").is(':checked')) {
 
237
  if(tracking_option == "UA" || tracking_option == "BOTH"){
 
 
 
 
238
  var UalinkData = {
239
  action: "link_analytic_to_ads_account",
240
  type: "UA",
241
  ads_customer_id: google_ads_id,
242
- analytics_id: $("#"+s_tracking_option+"_web_property_id").find(':selected').data('accountid'),
243
- web_property_id: $("#"+s_tracking_option+"_web_property_id").val(),
244
- profile_id: $("#"+s_tracking_option+"_web_property_id").find(':selected').data('profileid'),
245
  tvc_data:tvc_data,
246
  conversios_onboarding_nonce:conversios_onboarding_nonce
247
  };
248
  //console.log(UalinkData);
249
- if(google_ads_id != ""){
250
  setTimeout(function(){
251
  link_analytic_to_ads_account(UalinkData);
252
  }, 1000);
@@ -254,16 +348,21 @@ function save_google_ads_data(google_ads_id, tvc_data, subscription_id, is_skip=
254
 
255
  }
256
  if(tracking_option == "GA4" || tracking_option == "BOTH"){
 
 
 
 
257
  var Ga4linkData = {
258
  action: "link_analytic_to_ads_account",
259
  type: "GA4",
260
  ads_customer_id: google_ads_id,
261
- web_property_id: $("#"+s_tracking_option+"_web_measurement_id").val(),
262
- web_property: $("#"+s_tracking_option+"_web_measurement_id").find(':selected').data('name'),
263
  tvc_data:tvc_data,
264
  conversios_onboarding_nonce:conversios_onboarding_nonce
265
  };
266
- if(google_ads_id != ""){
 
267
  setTimeout(function(){
268
  link_analytic_to_ads_account(Ga4linkData);
269
  }, 1500);
@@ -465,44 +564,55 @@ function get_subscription_details(tvc_data, subscription_id) {
465
  }
466
  /* List function */
467
  //call get list propertie function base on tracking_option
468
- function call_list_analytics_web_properties(tracking_option, tvc_data){
469
  if (tracking_option == 'UA'){
470
- let web_property_id_length = $('#ua_web_property_id option').length;
471
- if(web_property_id_length < 2){
472
- list_analytics_web_properties("UA", tvc_data);
 
 
473
  }
474
- }else if (tracking_option == 'GA4'){
475
- let web_measurement_id_length = $('#ga4_web_measurement_id option').length;
476
  if(web_measurement_id_length < 2){
477
- list_analytics_web_properties("GA4", tvc_data);
478
- }
 
 
479
  }else if (tracking_option == 'BOTH'){
480
- let web_property_id_length = $('#both_web_property_id option').length;
481
- let web_measurement_id_length = $('#both_web_measurement_id option').length;
482
- if(web_measurement_id_length < 2 || web_property_id_length < 2){
483
  list_analytics_web_properties("BOTH", tvc_data);
 
 
 
 
484
  }
 
485
  }
486
  }
487
  // get list properties dropdown options
488
- function list_analytics_web_properties(type, tvc_data) {
489
  loaderSection(true);
490
  var conversios_onboarding_nonce = $("#conversios_onboarding_nonce").val();
 
491
  $.ajax({
492
  type: "POST",
493
  dataType: "json",
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 != null && 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) {
@@ -517,15 +627,18 @@ function list_analytics_web_properties(type, tvc_data) {
517
  }
518
  PropOptions = PropOptions + '<option value="' + propValue.webPropertyId + '" ' + selected + ' data-accountid="' + propValue.accountId + '" data-profileid="' + propValue.id + '"> ' + propValue.accountName + ' - ' + propValue.propertyName + ' - ' + propValue.name + ' - ' + propValue.webPropertyId +'</option>';
519
  });
 
 
 
520
  }
521
- $('#ua_web_property_id').html(PropOptions);
522
- $('#both_web_property_id').html(PropOptions);
523
  }
524
  if (type == "GA4" || type == "BOTH") {
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'";
@@ -535,9 +648,12 @@ function list_analytics_web_properties(type, tvc_data) {
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 if( response != null && response.error == true && response.errors != undefined){
32
  var tracking_option = $('input[type=radio][name=analytic_tag_type]:checked').val();
33
  //console.log(tracking_option);
34
  if(tracking_option == "UA"){
35
+ web_property_id = $('#ua_web_property_id_option_val').attr("data-val");
36
+ ua_account_id = $("#ua_web_property_id_option_val").data('accountid');
37
+ if(web_property_id == undefined || web_property_id == ""){
38
  msg = "Please select web property id.";
39
  }else{
40
  is_valide = true;
41
  }
42
  }else if(tracking_option == "GA4"){
43
+ web_measurement_id = $('#ga4_web_measurement_id_option_val').attr("data-val");
44
+ ga4_account_id = $("#ga4_web_measurement_id_option_val").data('accountid');
45
+ if(web_measurement_id == undefined || web_measurement_id == ""){
46
  msg = "Please select measurement id.";
47
  }else{
48
  is_valide = true;
49
  }
50
  }else{
51
+ web_property_id = $('#both_ua_web_property_id_option_val').attr("data-val");
52
+ ua_account_id = $("#both_ua_web_property_id_option_val").data('accountid');
53
+ web_measurement_id = $('#both_ga4_web_measurement_id_option_val').attr("data-val");
54
+ ga4_account_id = $("#both_ga4_web_measurement_id_option_val").data('accountid');
55
+ //console.log(web_property_id+"=="+web_measurement_id);
56
+ if((web_property_id == undefined || web_property_id == "") || (web_measurement_id == undefined || web_measurement_id == "") ){
57
  msg = "Please select property/measurement id.";
58
  }else{
59
  is_valide = true;
84
  $(document).ready(function () {
85
  loaderSection(false);
86
  //step-1
87
+ $('.tvc-dropdown-header').click(function(event){
88
+ $(this).next().toggle();
89
+ event.stopPropagation();
90
+ })
91
+
92
+ $(window).click(function(){
93
+ $('.tvc-dropdown-content').hide();
94
+ })
95
+ $(document.body).on('click', 'option:not(.more)', function(event){
96
+ //alert('clicked option ' + this.innerHTML);
97
+
98
+ var option_id = $(this).parent().parent().attr("id");
99
+ //console.log(option_id);
100
+ var val = $(this).attr("value");
101
+ var accountid = $(this).attr("data-accountid");
102
+
103
+ var text = $(this).html();
104
+ let tracking_option = $('input:radio[name=analytic_tag_type]:checked').val();
105
+
106
+ if(tracking_option == "UA" || tracking_option == "BOTH"){
107
+ var profileid = $(this).attr("data-profileid");
108
+ profileid = (profileid == undefined)?"":profileid;
109
+ accountid = (accountid == undefined)?"":accountid;
110
+ console.log(accountid+"="+profileid);
111
+
112
+ $("#"+option_id+"_val").html(text);
113
+ $("#"+option_id+"_val").attr("data-accountid",accountid);
114
+ $("#"+option_id+"_val").attr("data-profileid",profileid);
115
+ $("#"+option_id+"_val").attr("data-val",val);
116
+
117
+ }else if(tracking_option == "GA4" || tracking_option == "BOTH"){
118
+ var name = $(this).attr("data-name");
119
+ name = (name == undefined)?"":name;
120
+ accountid = (accountid == undefined)?"":accountid;
121
+ $("#"+option_id+"_val").html(text);
122
+ $("#"+option_id+"_val").attr("data-accountid",accountid);
123
+ $("#"+option_id+"_val").attr("data-name",name);
124
+ $("#"+option_id+"_val").attr("data-val",val);
125
+ }
126
+ $(this).parent().parent().toggle();
127
+ validate_google_analytics_sel();
128
+ event.stopPropagation();
129
+ })
130
+
131
+
132
  $(".google_analytics_sel").on( "change", function() {
133
  is_validate_step("step_1");
134
  $(".onbrdstep-1").removeClass('selectedactivestep');
163
  e.stopPropagation();
164
  });
165
  });
166
+ function validate_google_analytics_sel(){
167
+ is_validate_step("step_1");
168
+ $(".onbrdstep-1").removeClass('selectedactivestep');
169
+ $(".onbrdstep-3").removeClass('selectedactivestep');
170
+ $(".onbrdstep-2").removeClass('selectedactivestep');
171
+ $("[data-id=step_1]").attr("data-is-done",0);
172
+ $("[data-id=step_2]").attr("data-is-done",0);
173
+ $("[data-id=step_3]").attr("data-is-done",0);
174
+ }
175
+ function is_change_analytics_account(){
176
+ let tracking_option = $('input[type=radio][name=analytic_tag_type]:checked').val();
177
+ let old_tracking_option = $('#old_tracking').attr("data-tracking_option");
178
+ if(tracking_option != old_tracking_option){
179
+ return true;
180
+ }else if(tracking_option == "UA"){
181
+ let web_property_id = $('#ua_web_property_id_option_val').attr("data-val");
182
+ let old_web_property_id = $('#old_tracking').attr("data-property_id");
183
+ if(web_property_id != old_web_property_id){
184
+ return true;
185
+ }else{
186
+ return false;
187
+ }
188
+ }else if(tracking_option == "GA4"){
189
+ let web_measurement_id = $('#ga4_web_measurement_id_option_val').attr("data-val");
190
+ let old_web_measurement_id = $('#old_tracking').attr("data-measurement_id");
191
+ if(web_measurement_id != old_web_measurement_id){
192
+ return true;
193
+ }else{
194
+ return false;
195
+ }
196
+ }else if(tracking_option == "BOTH"){
197
+ let web_property_id = $('#both_ua_web_property_id_option_val').attr("data-val");
198
+ let web_measurement_id = $('#both_ga4_web_measurement_id_option_val').attr("data-val");
199
+ let old_web_property_id = $('#old_tracking').attr("data-property_id");
200
+ let old_web_measurement_id = $('#old_tracking').attr("data-measurement_id");
201
+ if(web_measurement_id != old_web_measurement_id || web_property_id != old_web_property_id){
202
+ return true;
203
+ }else{
204
+ return false;
205
+ }
206
+ }
207
+ }
208
  //save nalytics web properties while next button click
209
  function save_analytics_web_properties(tracking_option, tvc_data, subscription_id){
210
+
211
+ if(subscription_id != "" && is_change_analytics_account()){
212
  var web_measurement_id = "";
213
  var web_property_id = "";
214
  var ga4_account_id = "";
216
  var is_valide = true;
217
  var msg ="";
218
  if(tracking_option == "UA"){
219
+ web_property_id = $('#ua_web_property_id_option_val').attr("data-val");
220
+ ua_account_id = $("#ua_web_property_id_option_val").attr('data-accountid');
221
  if(web_property_id == ""){
222
  is_valide = false;
223
  msg = "Please select web property id.";
224
  }
225
  }else if(tracking_option == "GA4"){
226
+ web_measurement_id = $('#ga4_web_measurement_id_option_val').attr("data-val");
227
+ ga4_account_id = $("#ga4_web_measurement_id_option_val").attr('data-accountid');
228
  if(web_measurement_id == ""){
229
  is_valide = false;
230
  msg = "Please select measurement id.";
231
  }
232
  }else{
233
+ web_property_id = $('#both_ua_web_property_id_option_val').attr("data-val");
234
+ ua_account_id = $("#both_ua_web_property_id_option_val").attr('data-accountid');
235
+ web_measurement_id = $('#both_ga4_web_measurement_id_option_val').attr("data-val");
236
+ ga4_account_id = $("#both_ga4_web_measurement_id_option_val").attr('data-accountid');
237
 
238
  if(web_property_id == "" || web_measurement_id == ""){
239
  is_valide = false;
259
  tvc_data:tvc_data,
260
  conversios_onboarding_nonce:conversios_onboarding_nonce
261
  };
262
+ //console.log(data);
263
  $.ajax({
264
  type: "POST",
265
  dataType: "json",
285
  add_message("warning",msg);
286
  return false;
287
  }
288
+ }else if( subscription_id == "" ){
289
  add_message("warning","Missing value of subscription id.");
290
  return false;
291
  }
322
  if(plan_id != 1){
323
  check_oradd_conversion_list(google_ads_id, tvc_data);
324
  }
325
+ //console.log("s_tracking_option"+s_tracking_option);
326
+ if ($("#link_google_analytics_with_google_ads").is(':checked')) {
327
  if(tracking_option == "UA" || tracking_option == "BOTH"){
328
+ if(tracking_option == "BOTH"){
329
+ s_tracking_option = "both_ua";
330
+ }
331
+ var profile_id = $("#"+s_tracking_option+"_web_property_id_option_val").attr('data-profileid');
332
  var UalinkData = {
333
  action: "link_analytic_to_ads_account",
334
  type: "UA",
335
  ads_customer_id: google_ads_id,
336
+ analytics_id: $("#"+s_tracking_option+"_web_property_id_option_val").attr('data-accountid'),
337
+ web_property_id: $("#"+s_tracking_option+"_web_property_id_option_val").attr("data-val"),
338
+ profile_id: profile_id,
339
  tvc_data:tvc_data,
340
  conversios_onboarding_nonce:conversios_onboarding_nonce
341
  };
342
  //console.log(UalinkData);
343
+ if(google_ads_id != "" && profile_id != undefined){
344
  setTimeout(function(){
345
  link_analytic_to_ads_account(UalinkData);
346
  }, 1000);
348
 
349
  }
350
  if(tracking_option == "GA4" || tracking_option == "BOTH"){
351
+ if(tracking_option == "BOTH"){
352
+ s_tracking_option = "both_ga4";
353
+ }
354
+ var web_property = $("#"+s_tracking_option+"_web_measurement_id_option_val").attr('data-name');
355
  var Ga4linkData = {
356
  action: "link_analytic_to_ads_account",
357
  type: "GA4",
358
  ads_customer_id: google_ads_id,
359
+ web_property_id: $("#"+s_tracking_option+"_web_measurement_id_option_val").attr("data-val"),
360
+ web_property: web_property,
361
  tvc_data:tvc_data,
362
  conversios_onboarding_nonce:conversios_onboarding_nonce
363
  };
364
+ //console.log("web_property"+web_property);
365
+ if(google_ads_id != "" && web_property != undefined){
366
  setTimeout(function(){
367
  link_analytic_to_ads_account(Ga4linkData);
368
  }, 1500);
564
  }
565
  /* List function */
566
  //call get list propertie function base on tracking_option
567
+ function call_list_analytics_web_properties(tracking_option, tvc_data, page =1){
568
  if (tracking_option == 'UA'){
569
+ let web_property_id_length = $('#ua_web_property_id_option option').length;
570
+ if(web_property_id_length < 2 || page != 1){
571
+ list_analytics_web_properties("UA", tvc_data, page);
572
+ }else if( page != 1){
573
+ list_analytics_web_properties("UA", tvc_data, page);
574
  }
575
+ }else if (tracking_option == 'GA4' ){
576
+ let web_measurement_id_length = $('#ga4_web_measurement_id_option option').length;
577
  if(web_measurement_id_length < 2){
578
+ list_analytics_web_properties("GA4", tvc_data, page);
579
+ }else if( page != 1){
580
+ list_analytics_web_properties("GA4", tvc_data, page);
581
+ }
582
  }else if (tracking_option == 'BOTH'){
583
+ let web_property_id_length = $('#both_ua_web_property_id_option option').length;
584
+ let web_measurement_id_length = $('#both_ga4_web_measurement_id_option option').length;
585
+ if(web_measurement_id_length < 2 && web_property_id_length < 2){
586
  list_analytics_web_properties("BOTH", tvc_data);
587
+ }else if(web_property_id_length < 2 ){
588
+ list_analytics_web_properties("UA", tvc_data);
589
+ }else if(web_measurement_id_length < 2 ){
590
+ list_analytics_web_properties("GA4", tvc_data);
591
  }
592
+
593
  }
594
  }
595
  // get list properties dropdown options
596
+ function list_analytics_web_properties(type, tvc_data, page =1) {
597
  loaderSection(true);
598
  var conversios_onboarding_nonce = $("#conversios_onboarding_nonce").val();
599
+ //console.log("page"+page);
600
  $.ajax({
601
  type: "POST",
602
  dataType: "json",
603
  url: tvc_ajax_url,
604
+ data: {action: "get_analytics_web_properties", type: type, page:page, tvc_data:tvc_data, conversios_onboarding_nonce:conversios_onboarding_nonce},
605
  success: function (response) {
606
+ //console.log(response);
607
  if (response != null && response.error == false) {
608
  if (type == "UA" || type == "BOTH") {
609
  //web_properties_dropdown
610
  var subscriptionPropertyId = $("#subscriptionPropertyId").val();
611
  var ga_view_id = $("#ga_view_id").val();
612
+ var PropOptions = '';
613
+ //console.log("call option");
614
  //console.log(Object.keys(response.data.wep_properties).length +"=="+response.data.wep_properties.length);
615
+ if(response.data != null && response.data.wep_properties.length > 0){
616
  $.each(response.data.wep_properties, function (propKey, propValue) {
617
  var selected ="";
618
  if (subscriptionPropertyId == propValue.webPropertyId) {
627
  }
628
  PropOptions = PropOptions + '<option value="' + propValue.webPropertyId + '" ' + selected + ' data-accountid="' + propValue.accountId + '" data-profileid="' + propValue.id + '"> ' + propValue.accountName + ' - ' + propValue.propertyName + ' - ' + propValue.name + ' - ' + propValue.webPropertyId +'</option>';
629
  });
630
+ }else{
631
+ //console.log("hide option");
632
+ $(".tvc-ua-option-more").hide();
633
  }
634
+ $('#ua_web_property_id_option > .tvc-select-items').append(PropOptions);
635
+ $('#both_ua_web_property_id_option > .tvc-select-items').append(PropOptions);
636
  }
637
  if (type == "GA4" || type == "BOTH") {
638
  //web_measurement_dropdown
639
  var subscriptionMeasurementId = $("#subscriptionMeasurementId").val();
640
+ var MeasOptions = '';
641
+ if(response.data != null && response.data.wep_measurement.length > 0){
642
  $.each(response.data.wep_measurement, function (measKey, measValue) {
643
  if (subscriptionMeasurementId == measValue.measurementId) {
644
  var selected = "selected='selected'";
648
  var web_property = measValue.name.split("/");
649
  MeasOptions = MeasOptions + '<option value="' + measValue.measurementId + '" ' + selected + ' data-name="'+web_property[1] +'"'+ ' data-accountid="' + measValue.accountId + '"> ' + measValue.accountName + ' - ' + web_property[1] + ' - ' + measValue.measurementId + '</option>';
650
  });
651
+ }else{
652
+ //console.log("hide option");
653
+ $(".tvc-ga4-option-more").hide();
654
  }
655
+ $('#ga4_web_measurement_id_option > .tvc-select-items').append(MeasOptions);
656
+ $('#both_ga4_web_measurement_id_option > .tvc-select-items').append(MeasOptions);
657
  }
658
  $(".slect2bx").select2();
659
  }else if( response != null && response.error == true && response.errors != undefined){
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.4.0
19
  * Author: Tatvic
20
  * Author URI: www.tatvic.com
21
  * License: GPL-2.0+
@@ -23,7 +23,7 @@
23
  * Text Domain: www.tatvic.com
24
  * Domain Path: /languages
25
  * WC requires at least: 1.4.1
26
- * WC tested up to: 5.8.0
27
  */
28
 
29
  /**
@@ -37,7 +37,7 @@ if ( ! defined( 'WPINC' ) ) {
37
  * Start at version 1.0.0 and use SemVer - https://semver.org
38
  * Rename this for your plugin and update it as you release new versions.
39
  */
40
- define( 'PLUGIN_TVC_VERSION', '4.4.0' );
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.4.1
19
  * Author: Tatvic
20
  * Author URI: www.tatvic.com
21
  * License: GPL-2.0+
23
  * Text Domain: www.tatvic.com
24
  * Domain Path: /languages
25
  * WC requires at least: 1.4.1
26
+ * WC tested up to: 5.9.0
27
  */
28
 
29
  /**
37
  * Start at version 1.0.0 and use SemVer - https://semver.org
38
  * Rename this for your plugin and update it as you release new versions.
39
  */
40
+ define( 'PLUGIN_TVC_VERSION', '4.4.1' );
41
  $fullName = plugin_basename( __FILE__ );
42
  $dir = str_replace('/enhanced-ecommerce-google-analytics.php','',$fullName);
43
  if ( ! defined( 'ENHANCAD_PLUGIN_NAME' ) ) {
readme.txt CHANGED
@@ -6,10 +6,10 @@ Tags: Google Analytics tracking, Dynamic Remarketing, Google Shopping automation
6
  Author URI: https://conversios.io/
7
  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.4.0
12
- Version: 4.4.0
13
  License: GPLv3
14
  License URI: http://www.gnu.org/licenses/gpl-3.0.html
15
 
@@ -380,6 +380,10 @@ You can resolve the duplication of data by removing the manually implemented GA
380
 
381
  == Changelog ==
382
 
 
 
 
 
383
  = 4.4.0 - 01/11/2021 =
384
 
385
  * In this release, we have added product type and custom attributes for the product sync capability which will help in enhancing your product feeds in Google Merchant Center. These attributed will automatically collected and pushed to GMC when you are syncing products.
6
  Author URI: https://conversios.io/
7
  Author: Tatvic
8
  Requires at least: 1.4.1
9
+ Tested up to: 5.8.2
10
  Requires PHP: 5.6 or Higher
11
+ Stable tag: 4.4.1
12
+ Version: 4.4.1
13
  License: GPLv3
14
  License URI: http://www.gnu.org/licenses/gpl-3.0.html
15
 
380
 
381
  == Changelog ==
382
 
383
+ = 4.4.1 - 15/11/2021 =
384
+
385
+ * Earlier, agency owners having multiple Google analytics accounts associated with a single email id used to face issues in loading all the Google analytics accounts on the onboarding screen. We have added load more capability in order to provide smooth user experience
386
+
387
  = 4.4.0 - 01/11/2021 =
388
 
389
  * In this release, we have added product type and custom attributes for the product sync capability which will help in enhancing your product feeds in Google Merchant Center. These attributed will automatically collected and pushed to GMC when you are syncing products.