WD Google Analytics - Version 1.0.15

Version Description

  • Fixed: Bug on date picker
  • Changed: Improved error handling
  • Added: New featured plugins
Download this release

Release Info

Developer webdorado
Plugin Icon 128x128 WD Google Analytics
Version 1.0.15
Comparing to
See all releases

Code changes from version 1.0.14 to 1.0.15

admin/gawd_google_class.php CHANGED
@@ -35,16 +35,18 @@ class GAWD_google_client {
35
  private function set_google_client() {
36
 
37
  $access_token = isset($this->gawd_user_data['access_token']) ? $this->gawd_user_data['access_token'] : '' ;
38
- $this->google_client->setAccessToken($access_token);
 
39
 
40
- if ($this->google_client->isAccessTokenExpired()) {
41
- $refresh_token = $this->gawd_user_data['refresh_token'];
42
 
43
- $this->google_client->setClientId(GAWD::get_instance()->get_project_client_id());
44
- $this->google_client->setClientSecret(GAWD::get_instance()->get_project_client_secret());
45
- $this->google_client->setRedirectUri(GAWD::get_instance()->redirect_uri);
46
- // $this->google_client->setAuthConfigFile(GAWD_DIR . '/client_secrets.json');
47
- $this->google_client->refreshToken($refresh_token);
 
48
  }
49
  }
50
 
@@ -67,7 +69,8 @@ class GAWD_google_client {
67
  $client->setClientId(GAWD::get_instance()->get_project_client_id());
68
  $client->setClientSecret(GAWD::get_instance()->get_project_client_secret());
69
  $client->setRedirectUri(GAWD::get_instance()->redirect_uri);
70
- try {
 
71
  $client->authenticate($code);
72
 
73
  if ($client->isAccessTokenExpired()) {
@@ -89,7 +92,7 @@ class GAWD_google_client {
89
  if ($profiles instanceof Google_Service_Exception) {
90
 
91
  delete_option('gawd_user_data');
92
- $errors = $profiles->getErrors();
93
  return $errors[0]["message"];
94
  }
95
 
@@ -102,17 +105,19 @@ class GAWD_google_client {
102
  );
103
  return true;
104
  }
105
- } catch (Google_Service_Exception $e) {
106
- delete_option('gawd_user_data');
107
- $errors = $e->getErrors();
108
- return $errors[0]["message"];
109
- } catch (Exception $e) {
110
- $myFile = GAWD_UPLOAD_DIR."/logfile.txt"; ;
111
- $fh = fopen($myFile, 'a');
112
- fwrite($fh, $e->getMessage(). "----authenticate function".PHP_EOL);
113
- fclose($fh);
114
- return $e->getMessage();
 
115
  }
 
116
  }
117
 
118
  public function get_management_accounts() {
@@ -486,29 +491,30 @@ class GAWD_google_client {
486
  }
487
 
488
  public function get_management_filters() {
489
- $analytics = $this->analytics_member;
490
- $this->gawd_user_data = get_option('gawd_user_data');
491
- $accountId = $this->get_profile_accountId();
492
- $profileId = $this->get_profile_id();
493
- $webPropertyId = $this->get_profile_webPropertyId();
494
-
495
  try {
496
- $view_filters = $analytics->management_profileFilterLinks->listManagementProfileFilterLinks($accountId, $webPropertyId, $profileId);
497
- $filters = $view_filters->getItems();
498
- foreach ($filters as $filter) {
499
- $filter_info = $analytics->management_filters->get($accountId,$filter['modelData']['filterRef']['id']);
500
- $all_filters[] = array(
501
- 'name' => $filter['modelData']['filterRef']['name'],
502
- 'id' => $filter['modelData']['filterRef']['id'],
503
- 'type' => $filter_info['excludeDetails']['field'],
504
- 'value' => $filter_info['excludeDetails']['expressionValue'],
505
- 'view' => $filter['modelData']['profileRef']['name']
506
- );
507
- }
508
- if (isset($all_filters)) {
509
- return $all_filters;
510
- }
511
- } catch (Exception $e) {
 
512
 
513
  $myFile = GAWD_UPLOAD_DIR."/logfile.txt"; ;
514
  $fh = fopen($myFile, 'a');
@@ -521,17 +527,20 @@ class GAWD_google_client {
521
  }
522
  return json_encode($error);
523
  }
 
524
  }
525
 
526
  public function get_management_goals() {
527
- $this->gawd_user_data = get_option('gawd_user_data');
528
- $profileId = $this->get_profile_id();
529
- $accountId = $this->get_profile_accountId();
530
- $webPropertyId = $this->get_profile_webPropertyId();
531
- $goals = array();
 
532
  try {
533
  $goals = $this->analytics_member->management_goals->listManagementGoals($accountId, $webPropertyId, $profileId)->getItems();
534
- } catch (Exception $e) {
 
535
 
536
  $myFile = GAWD_UPLOAD_DIR."/logfile.txt"; ;
537
  $fh = fopen($myFile, 'a');
@@ -550,6 +559,7 @@ class GAWD_google_client {
550
  }
551
  return $goals_light;
552
  }
 
553
  }
554
 
555
  public function get_default_goals() {
@@ -1049,6 +1059,7 @@ class GAWD_google_client {
1049
 
1050
  $metric = lcfirst($metric);
1051
  $profileId = $this->get_profile_id();
 
1052
  $analytics = $this->analytics_member;
1053
  $selected_metric = $metric;
1054
  if (strpos($selected_metric, 'ga:') > -1) {
@@ -1132,13 +1143,14 @@ class GAWD_google_client {
1132
  );
1133
  }
1134
  }
1135
-
1136
  try {
1137
  $results = $analytics->data_ga->get(
1138
  'ga:' . $profileId, $start_date, $end_date, $metric, $gawd_dimension
1139
  );
1140
 
1141
- } catch (Exception $e) {
 
1142
  $myFile = GAWD_UPLOAD_DIR."/logfile.txt"; ;
1143
  $fh = fopen($myFile, 'a');
1144
  fwrite($fh, $e->getMessage(). "----get_data function".PHP_EOL);
@@ -1368,6 +1380,7 @@ class GAWD_google_client {
1368
 
1369
  return json_encode(array('chart_data' => $empty));
1370
  }
 
1371
  }
1372
 
1373
  public function get_data_compact($metric, $dimension, $start_date, $end_date, $timezone) {
35
  private function set_google_client() {
36
 
37
  $access_token = isset($this->gawd_user_data['access_token']) ? $this->gawd_user_data['access_token'] : '' ;
38
+ if($access_token != ''){
39
+ $this->google_client->setAccessToken($access_token);
40
 
41
+ if ($this->google_client->isAccessTokenExpired()) {
42
+ $refresh_token = $this->gawd_user_data['refresh_token'];
43
 
44
+ $this->google_client->setClientId(GAWD::get_instance()->get_project_client_id());
45
+ $this->google_client->setClientSecret(GAWD::get_instance()->get_project_client_secret());
46
+ $this->google_client->setRedirectUri(GAWD::get_instance()->redirect_uri);
47
+ // $this->google_client->setAuthConfigFile(GAWD_DIR . '/client_secrets.json');
48
+ $this->google_client->refreshToken($refresh_token);
49
+ }
50
  }
51
  }
52
 
69
  $client->setClientId(GAWD::get_instance()->get_project_client_id());
70
  $client->setClientSecret(GAWD::get_instance()->get_project_client_secret());
71
  $client->setRedirectUri(GAWD::get_instance()->redirect_uri);
72
+ if(isset($code) && $code != ''){
73
+ try {
74
  $client->authenticate($code);
75
 
76
  if ($client->isAccessTokenExpired()) {
92
  if ($profiles instanceof Google_Service_Exception) {
93
 
94
  delete_option('gawd_user_data');
95
+ $errors = $profiles->getErrors();
96
  return $errors[0]["message"];
97
  }
98
 
105
  );
106
  return true;
107
  }
108
+ } catch (Google_Service_Exception $e) {
109
+ delete_option('gawd_user_data');
110
+ $errors = $e->getErrors();
111
+ return $errors[0]["message"];
112
+ } catch (Exception $e) {
113
+ $myFile = GAWD_UPLOAD_DIR."/logfile.txt"; ;
114
+ $fh = fopen($myFile, 'a');
115
+ fwrite($fh, $e->getMessage(). "----authenticate function".PHP_EOL);
116
+ fclose($fh);
117
+ return $e->getMessage();
118
+ }
119
  }
120
+
121
  }
122
 
123
  public function get_management_accounts() {
491
  }
492
 
493
  public function get_management_filters() {
494
+ $analytics = $this->analytics_member;
495
+ $this->gawd_user_data = get_option('gawd_user_data');
496
+ $accountId = $this->get_profile_accountId();
497
+ $profileId = $this->get_profile_id();
498
+ $webPropertyId = $this->get_profile_webPropertyId();
499
+ if( (isset($accountId) && $accountId != '') && (isset($webPropertyId) && $webPropertyId != '') && (isset($profileId) && $profileId != '')){
500
  try {
501
+ $view_filters = $analytics->management_profileFilterLinks->listManagementProfileFilterLinks($accountId, $webPropertyId, $profileId);
502
+ $filters = $view_filters->getItems();
503
+ foreach ($filters as $filter) {
504
+ $filter_info = $analytics->management_filters->get($accountId,$filter['modelData']['filterRef']['id']);
505
+ $all_filters[] = array(
506
+ 'name' => $filter['modelData']['filterRef']['name'],
507
+ 'id' => $filter['modelData']['filterRef']['id'],
508
+ 'type' => $filter_info['excludeDetails']['field'],
509
+ 'value' => $filter_info['excludeDetails']['expressionValue'],
510
+ 'view' => $filter['modelData']['profileRef']['name']
511
+ );
512
+ }
513
+ if (isset($all_filters)) {
514
+ return $all_filters;
515
+ }
516
+ }
517
+ catch (Exception $e) {
518
 
519
  $myFile = GAWD_UPLOAD_DIR."/logfile.txt"; ;
520
  $fh = fopen($myFile, 'a');
527
  }
528
  return json_encode($error);
529
  }
530
+ }
531
  }
532
 
533
  public function get_management_goals() {
534
+ $this->gawd_user_data = get_option('gawd_user_data');
535
+ $profileId = $this->get_profile_id();
536
+ $accountId = $this->get_profile_accountId();
537
+ $webPropertyId = $this->get_profile_webPropertyId();
538
+ $goals = array();
539
+ if(isset($profileId) && $profileId != '' && isset($webPropertyId) && $webPropertyId != ''){
540
  try {
541
  $goals = $this->analytics_member->management_goals->listManagementGoals($accountId, $webPropertyId, $profileId)->getItems();
542
+ }
543
+ catch (Exception $e) {
544
 
545
  $myFile = GAWD_UPLOAD_DIR."/logfile.txt"; ;
546
  $fh = fopen($myFile, 'a');
559
  }
560
  return $goals_light;
561
  }
562
+ }
563
  }
564
 
565
  public function get_default_goals() {
1059
 
1060
  $metric = lcfirst($metric);
1061
  $profileId = $this->get_profile_id();
1062
+
1063
  $analytics = $this->analytics_member;
1064
  $selected_metric = $metric;
1065
  if (strpos($selected_metric, 'ga:') > -1) {
1143
  );
1144
  }
1145
  }
1146
+ if(isset($profileId) && $profileId != ''){
1147
  try {
1148
  $results = $analytics->data_ga->get(
1149
  'ga:' . $profileId, $start_date, $end_date, $metric, $gawd_dimension
1150
  );
1151
 
1152
+ }
1153
+ catch (Exception $e) {
1154
  $myFile = GAWD_UPLOAD_DIR."/logfile.txt"; ;
1155
  $fh = fopen($myFile, 'a');
1156
  fwrite($fh, $e->getMessage(). "----get_data function".PHP_EOL);
1380
 
1381
  return json_encode(array('chart_data' => $empty));
1382
  }
1383
+ }
1384
  }
1385
 
1386
  public function get_data_compact($metric, $dimension, $start_date, $end_date, $timezone) {
admin/pages/date.php CHANGED
@@ -1,60 +1,62 @@
1
- <div class="gawd_wrapper">
2
- <div class="opacity_div_compact"> </div>
3
- <div class="loading_div_compact">
4
- <img src="<?php echo GAWD_URL . '/assets/ajax_loader.gif'; ?>" style="margin-top: 200px; width:50px;">
5
- </div>
6
- <div style="float:left">
7
- <div id="first_metric" >
8
- <select class="gawd_compact_metric_change" name="gawd_metric_compact" id="gawd_metric_compact" >
9
- <option value="sessions"><?php echo __('Sessions', 'gawd'); ?></option>
10
- <option value="percentNewSessions"><?php echo __('% New Sessions', 'gawd'); ?></option>
11
- <option value="users" ><?php echo __('Users', 'gawd'); ?></option>
12
- <option value="bounceRate" ><?php echo __('Bounce Rate', 'gawd'); ?></option>
13
- <option value="avgSessionDuration" ><?php echo __('Avg Session Duration', 'gawd'); ?></option>
14
- <option value="pageviews" ><?php echo __('Pageviews', 'gawd'); ?></option>
15
- <option value="pageviewsPerSession" ><?php echo __('Pages/Session', 'gawd'); ?></option>
16
- </select>
17
- </div>
18
- <div id="metric_compare">
19
- <select class="gawd_compact_metric_change" name="gawd_metric_compare" id="gawd_metric_compare_compact">
20
- <option value="users" ><?php echo __('Users', 'gawd'); ?></option>
21
- <option value="sessions"><?php echo __('Sessions', 'gawd'); ?></option>
22
- <option value="percentNewSessions"><?php echo __('% New Sessions', 'gawd'); ?></option>
23
- <option value="bounceRate" ><?php echo __('Bounce Rate', 'gawd'); ?></option>
24
- <option value="avgSessionDuration" ><?php echo __('Avg Session Duration', 'gawd'); ?></option>
25
- <option value="pageviews" ><?php echo __('Pageviews', 'gawd'); ?></option>
26
- <option value="pageviewsPerSession" ><?php echo __('Pages/Session', 'gawd'); ?></option>
27
- <option value="0"><?php echo __('None', 'gawd'); ?></option>
28
- </select>
29
- </div>
30
- </div>
31
- <div style="float:left;margin:16px 0 0 0 " class="vs_image" class="gawd_metrics">
32
- <img width="30px" src="<?php echo GAWD_URL; ?>/assets/vs.png">
33
- </div>
34
- <div class="clear"></div>
35
-
36
- <div id="gawd_date_meta"></div>
37
- </div>
38
- <script>
39
- jQuery(document).ready(function(){
40
- hide_same_metric(jQuery('#gawd_metric_compare_compact'));
41
- hide_same_metric(jQuery('#gawd_metric_compact'));
42
- var _end_date = (Date.today().add(-1).days()).toString("yyyy-MM-dd");
43
- var start_date_7 = (Date.today().add(-1).days()).add(-7).days().toString("yyyy-MM-dd");
44
- var start_end_date = typeof jQuery('#gawd_start_end_date_compact').val() != 'undefined' ? jQuery('#gawd_start_end_date_compact').val() : start_date_7 + '/-/' + _end_date;
45
-
46
- var start_end_date = start_end_date.split('/-/');
47
- var start_date = start_end_date[0];
48
- var end_date = start_end_date[1];
49
- jQuery('#gawd_metric_compact').on('change', function () {
50
- hide_same_metric(this);
51
- gawd_draw_analytics_compact(jQuery('#gawd_metric_compact').val(), jQuery('#gawd_metric_compare_compact').val(), 'date', 'line', 'gawd_date_meta');
52
- })
53
- jQuery('#gawd_metric_compare_compact').on('change', function () {
54
- hide_same_metric(this);
55
- gawd_draw_analytics_compact(jQuery('#gawd_metric_compact').val(), jQuery('#gawd_metric_compare_compact').val(), 'date', 'line', 'gawd_date_meta');
56
- })
57
- //gawd_draw_analytics_compact('sessions', 'users', 'date', 'line', start_date, end_date, 'gawd_date_meta');
58
-
59
- });
 
 
60
  </script>
1
+ <div class="gawd_wrapper">
2
+ <div class="opacity_div_compact"> </div>
3
+ <div class="loading_div_compact">
4
+ <img src="<?php echo GAWD_URL . '/assets/ajax_loader.gif'; ?>" style="margin-top: 200px; width:50px;">
5
+ </div>
6
+ <div style="float:left">
7
+ <div id="first_metric" >
8
+ <select class="gawd_compact_metric_change" name="gawd_metric_compact" id="gawd_metric_compact" >
9
+ <option value="sessions"><?php echo __('Sessions', 'gawd'); ?></option>
10
+ <option value="percentNewSessions"><?php echo __('% New Sessions', 'gawd'); ?></option>
11
+ <option value="users" ><?php echo __('Users', 'gawd'); ?></option>
12
+ <option value="bounceRate" ><?php echo __('Bounce Rate', 'gawd'); ?></option>
13
+ <option value="avgSessionDuration" ><?php echo __('Avg Session Duration', 'gawd'); ?></option>
14
+ <option value="pageviews" ><?php echo __('Pageviews', 'gawd'); ?></option>
15
+ <option value="pageviewsPerSession" ><?php echo __('Pages/Session', 'gawd'); ?></option>
16
+ </select>
17
+ </div>
18
+ <div id="metric_compare">
19
+ <select class="gawd_compact_metric_change" name="gawd_metric_compare" id="gawd_metric_compare_compact">
20
+ <option value="users" ><?php echo __('Users', 'gawd'); ?></option>
21
+ <option value="sessions"><?php echo __('Sessions', 'gawd'); ?></option>
22
+ <option value="percentNewSessions"><?php echo __('% New Sessions', 'gawd'); ?></option>
23
+ <option value="bounceRate" ><?php echo __('Bounce Rate', 'gawd'); ?></option>
24
+ <option value="avgSessionDuration" ><?php echo __('Avg Session Duration', 'gawd'); ?></option>
25
+ <option value="pageviews" ><?php echo __('Pageviews', 'gawd'); ?></option>
26
+ <option value="pageviewsPerSession" ><?php echo __('Pages/Session', 'gawd'); ?></option>
27
+ <option value="0"><?php echo __('None', 'gawd'); ?></option>
28
+ </select>
29
+ </div>
30
+ </div>
31
+ <div style="float:left;margin:16px 0 0 0 " class="vs_image" class="gawd_metrics">
32
+ <img width="30px" src="<?php echo GAWD_URL; ?>/assets/vs.png">
33
+ </div>
34
+ <div class="clear"></div>
35
+
36
+ <div id="gawd_date_meta"></div>
37
+ </div>
38
+ <script>
39
+ jQuery(document).ready(function(){
40
+ hide_same_metric(jQuery('#gawd_metric_compare_compact'));
41
+ hide_same_metric(jQuery('#gawd_metric_compact'));
42
+ /*var _end_date = (Date.today().add(-1).days()).toString("yyyy-MM-dd");
43
+ var start_date_7 = (Date.today().add(-1).days()).add(-7).days().toString("yyyy-MM-dd");*/
44
+ var _end_date = (moment().subtract(1, 'day')).format("YYYY-MM-DD");
45
+ var start_date_7 = (moment().subtract(8, 'day')).format("YYYY-MM-DD");
46
+ var start_end_date = typeof jQuery('#gawd_start_end_date_compact').val() != 'undefined' ? jQuery('#gawd_start_end_date_compact').val() : start_date_7 + '/-/' + _end_date;
47
+
48
+ var start_end_date = start_end_date.split('/-/');
49
+ var start_date = start_end_date[0];
50
+ var end_date = start_end_date[1];
51
+ jQuery('#gawd_metric_compact').on('change', function () {
52
+ hide_same_metric(this);
53
+ gawd_draw_analytics_compact(jQuery('#gawd_metric_compact').val(), jQuery('#gawd_metric_compare_compact').val(), 'date', 'line', 'gawd_date_meta');
54
+ })
55
+ jQuery('#gawd_metric_compare_compact').on('change', function () {
56
+ hide_same_metric(this);
57
+ gawd_draw_analytics_compact(jQuery('#gawd_metric_compact').val(), jQuery('#gawd_metric_compare_compact').val(), 'date', 'line', 'gawd_date_meta');
58
+ })
59
+ //gawd_draw_analytics_compact('sessions', 'users', 'date', 'line', start_date, end_date, 'gawd_date_meta');
60
+
61
+ });
62
  </script>
admin/pages/settings.php CHANGED
@@ -151,15 +151,7 @@ foreach($roles->role_names as $key => $name){
151
  <span class="gawd_goal_label">View</span>
152
 
153
  <span class="gawd_goal_input">
154
- <!--<select title="Click to pick the website, filters of which you’d like to display." name="gawd_id" onchange="change_filter_account(this)">
155
- <?php
156
-
157
- /* foreach ($accounts as $account_name ){
158
- $selected = $account_name['id'] == $gawd_user_data['accountId'] ? 'selected="selected"' : "";
159
- */
160
- ?>
161
- <option value="<?php echo $account_name['id']; ?>" <?php echo $selected; ?>><?php echo $account_name['name'] ; ?></option>
162
- <?php //} ?>-->
163
  </select>
164
  <select title="Click to pick the website, filters of which you’d like to display." name="gawd_id" onchange="change_filter_account(this)">
165
  <?php
151
  <span class="gawd_goal_label">View</span>
152
 
153
  <span class="gawd_goal_input">
154
+
 
 
 
 
 
 
 
 
155
  </select>
156
  <select title="Click to pick the website, filters of which you’d like to display." name="gawd_id" onchange="change_filter_account(this)">
157
  <?php
featured/featured.php CHANGED
@@ -7,6 +7,12 @@ function gawd_featured_plugins($current_plugin = '') {
7
  'content' => 'Form Maker is a modern and advanced tool for creating WordPress forms easily and fast.',
8
  'href' => 'https://web-dorado.com/products/wordpress-form.html'
9
  ),
 
 
 
 
 
 
10
  "photo-gallery" => array(
11
  'title' => 'Photo Gallery',
12
  'text' => 'WordPress Photo Gallery plugin',
@@ -121,12 +127,24 @@ function gawd_featured_plugins($current_plugin = '') {
121
  'content' => 'Post Slider WD is designed to show off the selected posts of your website in a slider.',
122
  'href' => 'https://web-dorado.com/products/wordpress-post-slider-plugin.html'
123
  ),
124
- "google-maps" => array(
125
- 'title' => 'Google Map',
126
- 'text' => 'WordPress Google Maps Plugin',
127
- 'content' => 'Google Maps WD is an intuitive tool for creating Google maps with advanced markers, custom layers and overlays for your website.',
128
  'href' => 'https://web-dorado.com/products/wordpress-google-maps-plugin.html'
129
- ),
 
 
 
 
 
 
 
 
 
 
 
 
130
  "wd-google-analytics" => array(
131
  'title' => 'Wd Google Analytics',
132
  'text' => 'WordPress Google Analytics Plugin',
@@ -139,7 +157,7 @@ function gawd_featured_plugins($current_plugin = '') {
139
  <h3>Featured Plugins</h3>
140
  <div class="featured_header">
141
  <a target="_blank" href="https://web-dorado.com/wordpress-plugins-bundle.html?source=<?php echo $current_plugin; ?>">
142
- <h1>GET <?php echo $plugins[$current_plugin]["title"]; ?> +23 PLUGINS</h1>
143
  <h1 class="get_plugins">FOR $100 ONLY <span>- SAVE 70%</span></h1>
144
  <div class="try-now">
145
  <span>TRY NOW</span>
@@ -168,4 +186,4 @@ function gawd_featured_plugins($current_plugin = '') {
168
  </ul>
169
  </div>
170
  <?php
171
- }
7
  'content' => 'Form Maker is a modern and advanced tool for creating WordPress forms easily and fast.',
8
  'href' => 'https://web-dorado.com/products/wordpress-form.html'
9
  ),
10
+ "mailchimp" => array(
11
+ 'title' => 'MailChimp WD',
12
+ 'text' => 'MailChimp WD plugin',
13
+ 'content' => 'MailChimp WD is a functional plugin developed to create MailChimp subscribe/unsubscribe forms and manage lists from your WordPress site.',
14
+ 'href' => 'https://web-dorado.com/products/wordpress-mailchimp-wd.html'
15
+ ),
16
  "photo-gallery" => array(
17
  'title' => 'Photo Gallery',
18
  'text' => 'WordPress Photo Gallery plugin',
127
  'content' => 'Post Slider WD is designed to show off the selected posts of your website in a slider.',
128
  'href' => 'https://web-dorado.com/products/wordpress-post-slider-plugin.html'
129
  ),
130
+ "wd-google-maps" => array(
131
+ 'title' => 'WD Google Maps',
132
+ 'text' => 'WD Google Maps plugin',
133
+ 'content' => 'Google Maps WD is an intuitive tool for creating Google maps with advanced markers, custom layers and overlays for your website.',
134
  'href' => 'https://web-dorado.com/products/wordpress-google-maps-plugin.html'
135
+ ),
136
+ "facebook-feed" => array(
137
+ 'title' => 'Facebook Feed WD',
138
+ 'text' => 'Facebook Feed WD plugin',
139
+ 'content' => 'Facebook Feed WD is a comprehensive tool for displaying Facebook feed, events and photos in your website.',
140
+ 'href' => 'https://web-dorado.com/products/wordpress-facebook-feed-plugin.html'
141
+ ),
142
+ "ecommerce-wd" => array(
143
+ 'title' => 'Ecommerce',
144
+ 'text' => 'Wordpress ecommerce plugin',
145
+ 'content' => 'Ecommerce WD is a highly-functional, user friendly WordPress Ecommerce plugin, which is perfect for developing online stores for any level of complexity.',
146
+ 'href' => 'https://web-dorado.com/products/wordpress-ecommerce.html'
147
+ ),
148
  "wd-google-analytics" => array(
149
  'title' => 'Wd Google Analytics',
150
  'text' => 'WordPress Google Analytics Plugin',
157
  <h3>Featured Plugins</h3>
158
  <div class="featured_header">
159
  <a target="_blank" href="https://web-dorado.com/wordpress-plugins-bundle.html?source=<?php echo $current_plugin; ?>">
160
+ <h1>GET <?php echo $plugins[$current_plugin]["title"]; ?> +24 PLUGINS</h1>
161
  <h1 class="get_plugins">FOR $100 ONLY <span>- SAVE 70%</span></h1>
162
  <div class="try-now">
163
  <span>TRY NOW</span>
186
  </ul>
187
  </div>
188
  <?php
189
+ }
featured/images/ecommerce.png ADDED
Binary file
featured/images/facebook-feed.png ADDED
Binary file
featured/images/mailchimp.png ADDED
Binary file
featured/style.css CHANGED
@@ -1,4 +1,5 @@
1
  @import url(https://fonts.googleapis.com/css?family=Oswald);
 
2
  #main_featured_plugins_page {
3
  font-family: Oswald;
4
  width: 90%;
@@ -72,7 +73,10 @@
72
  #main_featured_plugins_page #featured-plugins-list li.faq_wd .product {background:url("images/faq_wd.png") center center no-repeat;}
73
  #main_featured_plugins_page #featured-plugins-list li.instagram_feed .product {background:url("images/instagram_feed.png") center center no-repeat;}
74
  #main_featured_plugins_page #featured-plugins-list li.post-slider .product {background:url("images/post-slider.png") center center no-repeat;}
75
- #main_featured_plugins_page #featured-plugins-list li.google-maps .product {background:url("images/google-maps.png") center center no-repeat;}
 
 
 
76
 
77
  #main_featured_plugins_page #featured-plugins-list li .title .heading {
78
  display: block;
@@ -202,4 +206,4 @@
202
  font-size: 20px;
203
  line-height: 25px;
204
  }
205
- }
1
  @import url(https://fonts.googleapis.com/css?family=Oswald);
2
+
3
  #main_featured_plugins_page {
4
  font-family: Oswald;
5
  width: 90%;
73
  #main_featured_plugins_page #featured-plugins-list li.faq_wd .product {background:url("images/faq_wd.png") center center no-repeat;}
74
  #main_featured_plugins_page #featured-plugins-list li.instagram_feed .product {background:url("images/instagram_feed.png") center center no-repeat;}
75
  #main_featured_plugins_page #featured-plugins-list li.post-slider .product {background:url("images/post-slider.png") center center no-repeat;}
76
+ #main_featured_plugins_page #featured-plugins-list li.facebook-feed .product {background:url("images/facebook-feed.png") center center no-repeat;}
77
+ #main_featured_plugins_page #featured-plugins-list li.mailchimp .product {background:url("images/mailchimp.png") center center no-repeat;}
78
+ #main_featured_plugins_page #featured-plugins-list li.ecommerce-wd .product {background:url("images/ecommerce.png") center center no-repeat;}
79
+ #main_featured_plugins_page #featured-plugins-list li.wd-google-maps .product {background:url("images/google-maps.png") center center no-repeat;}
80
 
81
  #main_featured_plugins_page #featured-plugins-list li .title .heading {
82
  display: block;
206
  font-size: 20px;
207
  line-height: 25px;
208
  }
209
+ }
gawd_class.php CHANGED
@@ -620,7 +620,6 @@ class GAWD
620
  wp_enqueue_script('gawd_tables', GAWD_URL . '/inc/js/loader.js', array('jquery'), GAWD_VERSION);
621
  wp_enqueue_script('gawd_grid', GAWD_URL . '/inc/js/jquery.jqGrid.min.js', array('jquery'), GAWD_VERSION);
622
  wp_enqueue_script('gawd_grid_locale', GAWD_URL . '/inc/js/grid.locale-en.js', array('jquery'), GAWD_VERSION);
623
- wp_enqueue_script('date-js', GAWD_URL . '/inc/js/date.js', array('jquery'), GAWD_VERSION);
624
  wp_enqueue_script('timepicker_js', GAWD_URL . '/inc/js/jquery.timepicker.min.js', array('jquery'), GAWD_VERSION);
625
  wp_enqueue_script('admin_js', GAWD_URL . '/inc/js/gawd_admin.js', array('jquery'), GAWD_VERSION);
626
  wp_enqueue_script('chosen.jquery.js', GAWD_URL . '/inc/js/chosen.jquery.js', array('jquery'), GAWD_VERSION);
@@ -854,21 +853,23 @@ class GAWD
854
  {
855
  check_ajax_referer('gawd_admin_page_nonce', 'security');
856
  $code = $_POST['token'];
857
- $status = GAWD_google_client::authenticate($code);
858
- if ($status === true) {
859
- $res = array(
860
- 'message' => 'successfully saved',
861
- 'status' => $status,
862
- );
863
- } else {
864
- $res = array(
865
- 'message' => 'there is an error',
866
- 'status' => $status
867
- );
 
 
 
 
 
868
  }
869
- header('content-type: application/json');
870
- echo json_encode($res);
871
- wp_die();
872
  }
873
 
874
  /**
@@ -2351,24 +2352,29 @@ class GAWD
2351
  }
2352
  }
2353
 
2354
- public function check_property_delete()
2355
- {
2356
  global $gawd_client;
2357
  $gawd_client = GAWD_google_client::get_instance();
2358
  $accountId = $gawd_client->get_default_accountId();
2359
  $webPropertyId = $gawd_client->get_default_webPropertyId();
 
2360
  $screen = get_current_screen();
 
 
 
2361
  if (strpos($screen->base, 'gawd') !== false && $accountId != null && $webPropertyId != null && $gawd_client->analytics_member->management_webproperties != null ) {
2362
  try {
2363
  $deleted = $gawd_client->analytics_member->management_webproperties->get($accountId, $webPropertyId);
2364
- } catch (Exception $e) {
2365
-
2366
- $myFile = GAWD_UPLOAD_DIR."/logfile.txt";
2367
-
2368
- $fh = fopen($myFile, 'a');
2369
- fwrite($fh, $e->getMessage(). "----check_property_delete function".PHP_EOL);
2370
- fclose($fh);
2371
-
 
 
2372
  if (strpos($e->getMessage(), 'not found.') !== false) {
2373
  echo '<div class="notice notice-error"><p>You have deleted your web-properties with current site url, please <a href="' . admin_url() . 'admin.php?page=gawd_settings">reauthenticate</a>. </p></div>';
2374
  }
620
  wp_enqueue_script('gawd_tables', GAWD_URL . '/inc/js/loader.js', array('jquery'), GAWD_VERSION);
621
  wp_enqueue_script('gawd_grid', GAWD_URL . '/inc/js/jquery.jqGrid.min.js', array('jquery'), GAWD_VERSION);
622
  wp_enqueue_script('gawd_grid_locale', GAWD_URL . '/inc/js/grid.locale-en.js', array('jquery'), GAWD_VERSION);
 
623
  wp_enqueue_script('timepicker_js', GAWD_URL . '/inc/js/jquery.timepicker.min.js', array('jquery'), GAWD_VERSION);
624
  wp_enqueue_script('admin_js', GAWD_URL . '/inc/js/gawd_admin.js', array('jquery'), GAWD_VERSION);
625
  wp_enqueue_script('chosen.jquery.js', GAWD_URL . '/inc/js/chosen.jquery.js', array('jquery'), GAWD_VERSION);
853
  {
854
  check_ajax_referer('gawd_admin_page_nonce', 'security');
855
  $code = $_POST['token'];
856
+ if(isset($code) && $code != ''){
857
+ $status = GAWD_google_client::authenticate($code);
858
+ if ($status === true) {
859
+ $res = array(
860
+ 'message' => 'successfully saved',
861
+ 'status' => $status,
862
+ );
863
+ } else {
864
+ $res = array(
865
+ 'message' => 'there is an error',
866
+ 'status' => $status
867
+ );
868
+ }
869
+ header('content-type: application/json');
870
+ echo json_encode($res);
871
+ wp_die();
872
  }
 
 
 
873
  }
874
 
875
  /**
2352
  }
2353
  }
2354
 
2355
+ public function check_property_delete(){
 
2356
  global $gawd_client;
2357
  $gawd_client = GAWD_google_client::get_instance();
2358
  $accountId = $gawd_client->get_default_accountId();
2359
  $webPropertyId = $gawd_client->get_default_webPropertyId();
2360
+ $gawd_user_data = get_option('gawd_user_data');
2361
  $screen = get_current_screen();
2362
+ if ($webPropertyId == null) {
2363
+ echo '<div class="notice notice-error"><p>You have deleted your web-properties with current site url, please <a href="' . admin_url() . 'admin.php?page=gawd_settings">reauthenticate</a>. </p></div>';
2364
+ }
2365
  if (strpos($screen->base, 'gawd') !== false && $accountId != null && $webPropertyId != null && $gawd_client->analytics_member->management_webproperties != null ) {
2366
  try {
2367
  $deleted = $gawd_client->analytics_member->management_webproperties->get($accountId, $webPropertyId);
2368
+ }
2369
+ catch (Exception $e) {
2370
+ $gawd_user_data['webPropertyId'] = null;
2371
+ $gawd_user_data['default_webPropertyId'] = null;
2372
+ $gawd_user_data['gawd_id'] = null;
2373
+ update_option('gawd_user_data', $gawd_user_data);
2374
+ $myFile = GAWD_UPLOAD_DIR."/logfile.txt";
2375
+ $fh = fopen($myFile, 'a');
2376
+ fwrite($fh, $e->getMessage(). "----check_property_delete function".PHP_EOL);
2377
+ fclose($fh);
2378
  if (strpos($e->getMessage(), 'not found.') !== false) {
2379
  echo '<div class="notice notice-error"><p>You have deleted your web-properties with current site url, please <a href="' . admin_url() . 'admin.php?page=gawd_settings">reauthenticate</a>. </p></div>';
2380
  }
google-analytics-wd.php CHANGED
@@ -4,7 +4,7 @@
4
  * Plugin Name: Google Analytics
5
  * Plugin URI: https://web-dorado.com/products/wordpress-google-analytics-plugin.html
6
  * Description: Google Analytics WD is a user-friendly all in one plugin, which allows to manage and monitor your website analytics from WordPress dashboard.
7
- * Version: 1.0.14
8
  * Author: WebDorado
9
  * Author URI: https://web-dorado.com
10
  * License: GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html
@@ -26,7 +26,7 @@ if (!defined('GAWD_INC')) {
26
  }
27
 
28
  if (!defined('GAWD_VERSION')) {
29
- define('GAWD_VERSION', '1.0.14');
30
  }
31
 
32
 
4
  * Plugin Name: Google Analytics
5
  * Plugin URI: https://web-dorado.com/products/wordpress-google-analytics-plugin.html
6
  * Description: Google Analytics WD is a user-friendly all in one plugin, which allows to manage and monitor your website analytics from WordPress dashboard.
7
+ * Version: 1.0.15
8
  * Author: WebDorado
9
  * Author URI: https://web-dorado.com
10
  * License: GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html
26
  }
27
 
28
  if (!defined('GAWD_VERSION')) {
29
+ define('GAWD_VERSION', '1.0.15');
30
  }
31
 
32
 
inc/js/date.js DELETED
@@ -1,104 +0,0 @@
1
- /**
2
- * Version: 1.0 Alpha-1
3
- * Build Date: 13-Nov-2007
4
- * Copyright (c) 2006-2007, Coolite Inc. (http://www.coolite.com/). All rights reserved.
5
- * License: Licensed under The MIT License. See license.txt and http://www.datejs.com/license/.
6
- * Website: http://www.datejs.com/ or http://www.coolite.com/datejs/
7
- */
8
- Date.CultureInfo={name:"en-US",englishName:"English (United States)",nativeName:"English (United States)",dayNames:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],abbreviatedDayNames:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],shortestDayNames:["Su","Mo","Tu","We","Th","Fr","Sa"],firstLetterDayNames:["S","M","T","W","T","F","S"],monthNames:["January","February","March","April","May","June","July","August","September","October","November","December"],abbreviatedMonthNames:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],amDesignator:"AM",pmDesignator:"PM",firstDayOfWeek:0,twoDigitYearMax:2029,dateElementOrder:"mdy",formatPatterns:{shortDate:"M/d/yyyy",longDate:"dddd, MMMM dd, yyyy",shortTime:"h:mm tt",longTime:"h:mm:ss tt",fullDateTime:"dddd, MMMM dd, yyyy h:mm:ss tt",sortableDateTime:"yyyy-MM-ddTHH:mm:ss",universalSortableDateTime:"yyyy-MM-dd HH:mm:ssZ",rfc1123:"ddd, dd MMM yyyy HH:mm:ss GMT",monthDay:"MMMM dd",yearMonth:"MMMM, yyyy"},regexPatterns:{jan:/^jan(uary)?/i,feb:/^feb(ruary)?/i,mar:/^mar(ch)?/i,apr:/^apr(il)?/i,may:/^may/i,jun:/^jun(e)?/i,jul:/^jul(y)?/i,aug:/^aug(ust)?/i,sep:/^sep(t(ember)?)?/i,oct:/^oct(ober)?/i,nov:/^nov(ember)?/i,dec:/^dec(ember)?/i,sun:/^su(n(day)?)?/i,mon:/^mo(n(day)?)?/i,tue:/^tu(e(s(day)?)?)?/i,wed:/^we(d(nesday)?)?/i,thu:/^th(u(r(s(day)?)?)?)?/i,fri:/^fr(i(day)?)?/i,sat:/^sa(t(urday)?)?/i,future:/^next/i,past:/^last|past|prev(ious)?/i,add:/^(\+|after|from)/i,subtract:/^(\-|before|ago)/i,yesterday:/^yesterday/i,today:/^t(oday)?/i,tomorrow:/^tomorrow/i,now:/^n(ow)?/i,millisecond:/^ms|milli(second)?s?/i,second:/^sec(ond)?s?/i,minute:/^min(ute)?s?/i,hour:/^h(ou)?rs?/i,week:/^w(ee)?k/i,month:/^m(o(nth)?s?)?/i,day:/^d(ays?)?/i,year:/^y((ea)?rs?)?/i,shortMeridian:/^(a|p)/i,longMeridian:/^(a\.?m?\.?|p\.?m?\.?)/i,timezone:/^((e(s|d)t|c(s|d)t|m(s|d)t|p(s|d)t)|((gmt)?\s*(\+|\-)\s*\d\d\d\d?)|gmt)/i,ordinalSuffix:/^\s*(st|nd|rd|th)/i,timeContext:/^\s*(\:|a|p)/i},abbreviatedTimeZoneStandard:{GMT:"-000",EST:"-0400",CST:"-0500",MST:"-0600",PST:"-0700"},abbreviatedTimeZoneDST:{GMT:"-000",EDT:"-0500",CDT:"-0600",MDT:"-0700",PDT:"-0800"}};
9
- Date.getMonthNumberFromName=function(name){var n=Date.CultureInfo.monthNames,m=Date.CultureInfo.abbreviatedMonthNames,s=name.toLowerCase();for(var i=0;i<n.length;i++){if(n[i].toLowerCase()==s||m[i].toLowerCase()==s){return i;}}
10
- return-1;};Date.getDayNumberFromName=function(name){var n=Date.CultureInfo.dayNames,m=Date.CultureInfo.abbreviatedDayNames,o=Date.CultureInfo.shortestDayNames,s=name.toLowerCase();for(var i=0;i<n.length;i++){if(n[i].toLowerCase()==s||m[i].toLowerCase()==s){return i;}}
11
- return-1;};Date.isLeapYear=function(year){return(((year%4===0)&&(year%100!==0))||(year%400===0));};Date.getDaysInMonth=function(year,month){return[31,(Date.isLeapYear(year)?29:28),31,30,31,30,31,31,30,31,30,31][month];};Date.getTimezoneOffset=function(s,dst){return(dst||false)?Date.CultureInfo.abbreviatedTimeZoneDST[s.toUpperCase()]:Date.CultureInfo.abbreviatedTimeZoneStandard[s.toUpperCase()];};Date.getTimezoneAbbreviation=function(offset,dst){var n=(dst||false)?Date.CultureInfo.abbreviatedTimeZoneDST:Date.CultureInfo.abbreviatedTimeZoneStandard,p;for(p in n){if(n[p]===offset){return p;}}
12
- return null;};Date.prototype.clone=function(){return new Date(this.getTime());};Date.prototype.compareTo=function(date){if(isNaN(this)){throw new Error(this);}
13
- if(date instanceof Date&&!isNaN(date)){return(this>date)?1:(this<date)?-1:0;}else{throw new TypeError(date);}};Date.prototype.equals=function(date){return(this.compareTo(date)===0);};Date.prototype.between=function(start,end){var t=this.getTime();return t>=start.getTime()&&t<=end.getTime();};Date.prototype.addMilliseconds=function(value){this.setMilliseconds(this.getMilliseconds()+value);return this;};Date.prototype.addSeconds=function(value){return this.addMilliseconds(value*1000);};Date.prototype.addMinutes=function(value){return this.addMilliseconds(value*60000);};Date.prototype.addHours=function(value){return this.addMilliseconds(value*3600000);};Date.prototype.addDays=function(value){return this.addMilliseconds(value*86400000);};Date.prototype.addWeeks=function(value){return this.addMilliseconds(value*604800000);};Date.prototype.addMonths=function(value){var n=this.getDate();this.setDate(1);this.setMonth(this.getMonth()+value);this.setDate(Math.min(n,this.getDaysInMonth()));return this;};Date.prototype.addYears=function(value){return this.addMonths(value*12);};Date.prototype.add=function(config){if(typeof config=="number"){this._orient=config;return this;}
14
- var x=config;if(x.millisecond||x.milliseconds){this.addMilliseconds(x.millisecond||x.milliseconds);}
15
- if(x.second||x.seconds){this.addSeconds(x.second||x.seconds);}
16
- if(x.minute||x.minutes){this.addMinutes(x.minute||x.minutes);}
17
- if(x.hour||x.hours){this.addHours(x.hour||x.hours);}
18
- if(x.month||x.months){this.addMonths(x.month||x.months);}
19
- if(x.year||x.years){this.addYears(x.year||x.years);}
20
- if(x.day||x.days){this.addDays(x.day||x.days);}
21
- return this;};Date._validate=function(value,min,max,name){if(typeof value!="number"){throw new TypeError(value+" is not a Number.");}else if(value<min||value>max){throw new RangeError(value+" is not a valid value for "+name+".");}
22
- return true;};Date.validateMillisecond=function(n){return Date._validate(n,0,999,"milliseconds");};Date.validateSecond=function(n){return Date._validate(n,0,59,"seconds");};Date.validateMinute=function(n){return Date._validate(n,0,59,"minutes");};Date.validateHour=function(n){return Date._validate(n,0,23,"hours");};Date.validateDay=function(n,year,month){return Date._validate(n,1,Date.getDaysInMonth(year,month),"days");};Date.validateMonth=function(n){return Date._validate(n,0,11,"months");};Date.validateYear=function(n){return Date._validate(n,1,9999,"seconds");};Date.prototype.set=function(config){var x=config;if(!x.millisecond&&x.millisecond!==0){x.millisecond=-1;}
23
- if(!x.second&&x.second!==0){x.second=-1;}
24
- if(!x.minute&&x.minute!==0){x.minute=-1;}
25
- if(!x.hour&&x.hour!==0){x.hour=-1;}
26
- if(!x.day&&x.day!==0){x.day=-1;}
27
- if(!x.month&&x.month!==0){x.month=-1;}
28
- if(!x.year&&x.year!==0){x.year=-1;}
29
- if(x.millisecond!=-1&&Date.validateMillisecond(x.millisecond)){this.addMilliseconds(x.millisecond-this.getMilliseconds());}
30
- if(x.second!=-1&&Date.validateSecond(x.second)){this.addSeconds(x.second-this.getSeconds());}
31
- if(x.minute!=-1&&Date.validateMinute(x.minute)){this.addMinutes(x.minute-this.getMinutes());}
32
- if(x.hour!=-1&&Date.validateHour(x.hour)){this.addHours(x.hour-this.getHours());}
33
- if(x.month!==-1&&Date.validateMonth(x.month)){this.addMonths(x.month-this.getMonth());}
34
- if(x.year!=-1&&Date.validateYear(x.year)){this.addYears(x.year-this.getFullYear());}
35
- if(x.day!=-1&&Date.validateDay(x.day,this.getFullYear(),this.getMonth())){this.addDays(x.day-this.getDate());}
36
- if(x.timezone){this.setTimezone(x.timezone);}
37
- if(x.timezoneOffset){this.setTimezoneOffset(x.timezoneOffset);}
38
- return this;};Date.prototype.clearTime=function(){this.setHours(0);this.setMinutes(0);this.setSeconds(0);this.setMilliseconds(0);return this;};Date.prototype.isLeapYear=function(){var y=this.getFullYear();return(((y%4===0)&&(y%100!==0))||(y%400===0));};Date.prototype.isWeekday=function(){return!(this.is().sat()||this.is().sun());};Date.prototype.getDaysInMonth=function(){return Date.getDaysInMonth(this.getFullYear(),this.getMonth());};Date.prototype.moveToFirstDayOfMonth=function(){return this.set({day:1});};Date.prototype.moveToLastDayOfMonth=function(){return this.set({day:this.getDaysInMonth()});};Date.prototype.moveToDayOfWeek=function(day,orient){var diff=(day-this.getDay()+7*(orient||+1))%7;return this.addDays((diff===0)?diff+=7*(orient||+1):diff);};Date.prototype.moveToMonth=function(month,orient){var diff=(month-this.getMonth()+12*(orient||+1))%12;return this.addMonths((diff===0)?diff+=12*(orient||+1):diff);};Date.prototype.getDayOfYear=function(){return Math.floor((this-new Date(this.getFullYear(),0,1))/86400000);};Date.prototype.getWeekOfYear=function(firstDayOfWeek){var y=this.getFullYear(),m=this.getMonth(),d=this.getDate();var dow=firstDayOfWeek||Date.CultureInfo.firstDayOfWeek;var offset=7+1-new Date(y,0,1).getDay();if(offset==8){offset=1;}
39
- var daynum=((Date.UTC(y,m,d,0,0,0)-Date.UTC(y,0,1,0,0,0))/86400000)+1;var w=Math.floor((daynum-offset+7)/7);if(w===dow){y--;var prevOffset=7+1-new Date(y,0,1).getDay();if(prevOffset==2||prevOffset==8){w=53;}else{w=52;}}
40
- return w;};Date.prototype.isDST=function(){console.log('isDST');return this.toString().match(/(E|C|M|P)(S|D)T/)[2]=="D";};Date.prototype.getTimezone=function(){return Date.getTimezoneAbbreviation(this.getUTCOffset,this.isDST());};Date.prototype.setTimezoneOffset=function(s){var here=this.getTimezoneOffset(),there=Number(s)*-6/10;this.addMinutes(there-here);return this;};Date.prototype.setTimezone=function(s){return this.setTimezoneOffset(Date.getTimezoneOffset(s));};Date.prototype.getUTCOffset=function(){var n=this.getTimezoneOffset()*-10/6,r;if(n<0){r=(n-10000).toString();return r[0]+r.substr(2);}else{r=(n+10000).toString();return"+"+r.substr(1);}};Date.prototype.getDayName=function(abbrev){return abbrev?Date.CultureInfo.abbreviatedDayNames[this.getDay()]:Date.CultureInfo.dayNames[this.getDay()];};Date.prototype.getMonthName=function(abbrev){return abbrev?Date.CultureInfo.abbreviatedMonthNames[this.getMonth()]:Date.CultureInfo.monthNames[this.getMonth()];};Date.prototype._toString=Date.prototype.toString;Date.prototype.toString=function(format){var self=this;var p=function p(s){return(s.toString().length==1)?"0"+s:s;};return format?format.replace(/dd?d?d?|MM?M?M?|yy?y?y?|hh?|HH?|mm?|ss?|tt?|zz?z?/g,function(format){switch(format){case"hh":return p(self.getHours()<13?self.getHours():(self.getHours()-12));case"h":return self.getHours()<13?self.getHours():(self.getHours()-12);case"HH":return p(self.getHours());case"H":return self.getHours();case"mm":return p(self.getMinutes());case"m":return self.getMinutes();case"ss":return p(self.getSeconds());case"s":return self.getSeconds();case"yyyy":return self.getFullYear();case"yy":return self.getFullYear().toString().substring(2,4);case"dddd":return self.getDayName();case"ddd":return self.getDayName(true);case"dd":return p(self.getDate());case"d":return self.getDate().toString();case"MMMM":return self.getMonthName();case"MMM":return self.getMonthName(true);case"MM":return p((self.getMonth()+1));case"M":return self.getMonth()+1;case"t":return self.getHours()<12?Date.CultureInfo.amDesignator.substring(0,1):Date.CultureInfo.pmDesignator.substring(0,1);case"tt":return self.getHours()<12?Date.CultureInfo.amDesignator:Date.CultureInfo.pmDesignator;case"zzz":case"zz":case"z":return"";}}):this._toString();};
41
- Date.now=function(){return new Date();};Date.today=function(){return Date.now().clearTime();};Date.prototype._orient=+1;Date.prototype.next=function(){this._orient=+1;return this;};Date.prototype.last=Date.prototype.prev=Date.prototype.previous=function(){this._orient=-1;return this;};Date.prototype._is=false;Date.prototype.is=function(){this._is=true;return this;};Number.prototype._dateElement="day";Number.prototype.fromNow=function(){var c={};c[this._dateElement]=this;return Date.now().add(c);};Number.prototype.ago=function(){var c={};c[this._dateElement]=this*-1;return Date.now().add(c);};(function(){var $D=Date.prototype,$N=Number.prototype;var dx=("sunday monday tuesday wednesday thursday friday saturday").split(/\s/),mx=("january february march april may june july august september october november december").split(/\s/),px=("Millisecond Second Minute Hour Day Week Month Year").split(/\s/),de;var df=function(n){return function(){if(this._is){this._is=false;return this.getDay()==n;}
42
- return this.moveToDayOfWeek(n,this._orient);};};for(var i=0;i<dx.length;i++){$D[dx[i]]=$D[dx[i].substring(0,3)]=df(i);}
43
- var mf=function(n){return function(){if(this._is){this._is=false;return this.getMonth()===n;}
44
- return this.moveToMonth(n,this._orient);};};for(var j=0;j<mx.length;j++){$D[mx[j]]=$D[mx[j].substring(0,3)]=mf(j);}
45
- var ef=function(j){return function(){if(j.substring(j.length-1)!="s"){j+="s";}
46
- return this["add"+j](this._orient);};};var nf=function(n){return function(){this._dateElement=n;return this;};};for(var k=0;k<px.length;k++){de=px[k].toLowerCase();$D[de]=$D[de+"s"]=ef(px[k]);$N[de]=$N[de+"s"]=nf(de);}}());Date.prototype.toJSONString=function(){return this.toString("yyyy-MM-ddThh:mm:ssZ");};Date.prototype.toShortDateString=function(){return this.toString(Date.CultureInfo.formatPatterns.shortDatePattern);};Date.prototype.toLongDateString=function(){return this.toString(Date.CultureInfo.formatPatterns.longDatePattern);};Date.prototype.toShortTimeString=function(){return this.toString(Date.CultureInfo.formatPatterns.shortTimePattern);};Date.prototype.toLongTimeString=function(){return this.toString(Date.CultureInfo.formatPatterns.longTimePattern);};Date.prototype.getOrdinal=function(){switch(this.getDate()){case 1:case 21:case 31:return"st";case 2:case 22:return"nd";case 3:case 23:return"rd";default:return"th";}};
47
- (function(){Date.Parsing={Exception:function(s){this.message="Parse error at '"+s.substring(0,10)+" ...'";}};var $P=Date.Parsing;var _=$P.Operators={rtoken:function(r){return function(s){var mx=s.match(r);if(mx){return([mx[0],s.substring(mx[0].length)]);}else{throw new $P.Exception(s);}};},token:function(s){return function(s){return _.rtoken(new RegExp("^\s*"+s+"\s*"))(s);};},stoken:function(s){return _.rtoken(new RegExp("^"+s));},until:function(p){return function(s){var qx=[],rx=null;while(s.length){try{rx=p.call(this,s);}catch(e){qx.push(rx[0]);s=rx[1];continue;}
48
- break;}
49
- return[qx,s];};},many:function(p){return function(s){var rx=[],r=null;while(s.length){try{r=p.call(this,s);}catch(e){return[rx,s];}
50
- rx.push(r[0]);s=r[1];}
51
- return[rx,s];};},optional:function(p){return function(s){var r=null;try{r=p.call(this,s);}catch(e){return[null,s];}
52
- return[r[0],r[1]];};},not:function(p){return function(s){try{p.call(this,s);}catch(e){return[null,s];}
53
- throw new $P.Exception(s);};},ignore:function(p){return p?function(s){var r=null;r=p.call(this,s);return[null,r[1]];}:null;},product:function(){var px=arguments[0],qx=Array.prototype.slice.call(arguments,1),rx=[];for(var i=0;i<px.length;i++){rx.push(_.each(px[i],qx));}
54
- return rx;},cache:function(rule){var cache={},r=null;return function(s){try{r=cache[s]=(cache[s]||rule.call(this,s));}catch(e){r=cache[s]=e;}
55
- if(r instanceof $P.Exception){throw r;}else{return r;}};},any:function(){var px=arguments;return function(s){var r=null;for(var i=0;i<px.length;i++){if(px[i]==null){continue;}
56
- try{r=(px[i].call(this,s));}catch(e){r=null;}
57
- if(r){return r;}}
58
- throw new $P.Exception(s);};},each:function(){var px=arguments;return function(s){var rx=[],r=null;for(var i=0;i<px.length;i++){if(px[i]==null){continue;}
59
- try{r=(px[i].call(this,s));}catch(e){throw new $P.Exception(s);}
60
- rx.push(r[0]);s=r[1];}
61
- return[rx,s];};},all:function(){var px=arguments,_=_;return _.each(_.optional(px));},sequence:function(px,d,c){d=d||_.rtoken(/^\s*/);c=c||null;if(px.length==1){return px[0];}
62
- return function(s){var r=null,q=null;var rx=[];for(var i=0;i<px.length;i++){try{r=px[i].call(this,s);}catch(e){break;}
63
- rx.push(r[0]);try{q=d.call(this,r[1]);}catch(ex){q=null;break;}
64
- s=q[1];}
65
- if(!r){throw new $P.Exception(s);}
66
- if(q){throw new $P.Exception(q[1]);}
67
- if(c){try{r=c.call(this,r[1]);}catch(ey){throw new $P.Exception(r[1]);}}
68
- return[rx,(r?r[1]:s)];};},between:function(d1,p,d2){d2=d2||d1;var _fn=_.each(_.ignore(d1),p,_.ignore(d2));return function(s){var rx=_fn.call(this,s);return[[rx[0][0],r[0][2]],rx[1]];};},list:function(p,d,c){d=d||_.rtoken(/^\s*/);c=c||null;return(p instanceof Array?_.each(_.product(p.slice(0,-1),_.ignore(d)),p.slice(-1),_.ignore(c)):_.each(_.many(_.each(p,_.ignore(d))),px,_.ignore(c)));},set:function(px,d,c){d=d||_.rtoken(/^\s*/);c=c||null;return function(s){var r=null,p=null,q=null,rx=null,best=[[],s],last=false;for(var i=0;i<px.length;i++){q=null;p=null;r=null;last=(px.length==1);try{r=px[i].call(this,s);}catch(e){continue;}
69
- rx=[[r[0]],r[1]];if(r[1].length>0&&!last){try{q=d.call(this,r[1]);}catch(ex){last=true;}}else{last=true;}
70
- if(!last&&q[1].length===0){last=true;}
71
- if(!last){var qx=[];for(var j=0;j<px.length;j++){if(i!=j){qx.push(px[j]);}}
72
- p=_.set(qx,d).call(this,q[1]);if(p[0].length>0){rx[0]=rx[0].concat(p[0]);rx[1]=p[1];}}
73
- if(rx[1].length<best[1].length){best=rx;}
74
- if(best[1].length===0){break;}}
75
- if(best[0].length===0){return best;}
76
- if(c){try{q=c.call(this,best[1]);}catch(ey){throw new $P.Exception(best[1]);}
77
- best[1]=q[1];}
78
- return best;};},forward:function(gr,fname){return function(s){return gr[fname].call(this,s);};},replace:function(rule,repl){return function(s){var r=rule.call(this,s);return[repl,r[1]];};},process:function(rule,fn){return function(s){var r=rule.call(this,s);return[fn.call(this,r[0]),r[1]];};},min:function(min,rule){return function(s){var rx=rule.call(this,s);if(rx[0].length<min){throw new $P.Exception(s);}
79
- return rx;};}};var _generator=function(op){return function(){var args=null,rx=[];if(arguments.length>1){args=Array.prototype.slice.call(arguments);}else if(arguments[0]instanceof Array){args=arguments[0];}
80
- if(args){for(var i=0,px=args.shift();i<px.length;i++){args.unshift(px[i]);rx.push(op.apply(null,args));args.shift();return rx;}}else{return op.apply(null,arguments);}};};var gx="optional not ignore cache".split(/\s/);for(var i=0;i<gx.length;i++){_[gx[i]]=_generator(_[gx[i]]);}
81
- var _vector=function(op){return function(){if(arguments[0]instanceof Array){return op.apply(null,arguments[0]);}else{return op.apply(null,arguments);}};};var vx="each any all".split(/\s/);for(var j=0;j<vx.length;j++){_[vx[j]]=_vector(_[vx[j]]);}}());(function(){var flattenAndCompact=function(ax){var rx=[];for(var i=0;i<ax.length;i++){if(ax[i]instanceof Array){rx=rx.concat(flattenAndCompact(ax[i]));}else{if(ax[i]){rx.push(ax[i]);}}}
82
- return rx;};Date.Grammar={};Date.Translator={hour:function(s){return function(){this.hour=Number(s);};},minute:function(s){return function(){this.minute=Number(s);};},second:function(s){return function(){this.second=Number(s);};},meridian:function(s){return function(){this.meridian=s.slice(0,1).toLowerCase();};},timezone:function(s){return function(){var n=s.replace(/[^\d\+\-]/g,"");if(n.length){this.timezoneOffset=Number(n);}else{this.timezone=s.toLowerCase();}};},day:function(x){var s=x[0];return function(){this.day=Number(s.match(/\d+/)[0]);};},month:function(s){return function(){this.month=((s.length==3)?Date.getMonthNumberFromName(s):(Number(s)-1));};},year:function(s){return function(){var n=Number(s);this.year=((s.length>2)?n:(n+(((n+2000)<Date.CultureInfo.twoDigitYearMax)?2000:1900)));};},rday:function(s){return function(){switch(s){case"yesterday":this.days=-1;break;case"tomorrow":this.days=1;break;case"today":this.days=0;break;case"now":this.days=0;this.now=true;break;}};},finishExact:function(x){x=(x instanceof Array)?x:[x];var now=new Date();this.year=now.getFullYear();this.month=now.getMonth();this.day=1;this.hour=0;this.minute=0;this.second=0;for(var i=0;i<x.length;i++){if(x[i]){x[i].call(this);}}
83
- this.hour=(this.meridian=="p"&&this.hour<13)?this.hour+12:this.hour;if(this.day>Date.getDaysInMonth(this.year,this.month)){throw new RangeError(this.day+" is not a valid value for days.");}
84
- var r=new Date(this.year,this.month,this.day,this.hour,this.minute,this.second);if(this.timezone){r.set({timezone:this.timezone});}else if(this.timezoneOffset){r.set({timezoneOffset:this.timezoneOffset});}
85
- return r;},finish:function(x){x=(x instanceof Array)?flattenAndCompact(x):[x];if(x.length===0){return null;}
86
- for(var i=0;i<x.length;i++){if(typeof x[i]=="function"){x[i].call(this);}}
87
- if(this.now){return new Date();}
88
- var today=Date.today();var method=null;var expression=!!(this.days!=null||this.orient||this.operator);if(expression){var gap,mod,orient;orient=((this.orient=="past"||this.operator=="subtract")?-1:1);if(this.weekday){this.unit="day";gap=(Date.getDayNumberFromName(this.weekday)-today.getDay());mod=7;this.days=gap?((gap+(orient*mod))%mod):(orient*mod);}
89
- if(this.month){this.unit="month";gap=(this.month-today.getMonth());mod=12;this.months=gap?((gap+(orient*mod))%mod):(orient*mod);this.month=null;}
90
- if(!this.unit){this.unit="day";}
91
- if(this[this.unit+"s"]==null||this.operator!=null){if(!this.value){this.value=1;}
92
- if(this.unit=="week"){this.unit="day";this.value=this.value*7;}
93
- this[this.unit+"s"]=this.value*orient;}
94
- return today.add(this);}else{if(this.meridian&&this.hour){this.hour=(this.hour<13&&this.meridian=="p")?this.hour+12:this.hour;}
95
- if(this.weekday&&!this.day){this.day=(today.addDays((Date.getDayNumberFromName(this.weekday)-today.getDay()))).getDate();}
96
- if(this.month&&!this.day){this.day=1;}
97
- return today.set(this);}}};var _=Date.Parsing.Operators,g=Date.Grammar,t=Date.Translator,_fn;g.datePartDelimiter=_.rtoken(/^([\s\-\.\,\/\x27]+)/);g.timePartDelimiter=_.stoken(":");g.whiteSpace=_.rtoken(/^\s*/);g.generalDelimiter=_.rtoken(/^(([\s\,]|at|on)+)/);var _C={};g.ctoken=function(keys){var fn=_C[keys];if(!fn){var c=Date.CultureInfo.regexPatterns;var kx=keys.split(/\s+/),px=[];for(var i=0;i<kx.length;i++){px.push(_.replace(_.rtoken(c[kx[i]]),kx[i]));}
98
- fn=_C[keys]=_.any.apply(null,px);}
99
- return fn;};g.ctoken2=function(key){return _.rtoken(Date.CultureInfo.regexPatterns[key]);};g.h=_.cache(_.process(_.rtoken(/^(0[0-9]|1[0-2]|[1-9])/),t.hour));g.hh=_.cache(_.process(_.rtoken(/^(0[0-9]|1[0-2])/),t.hour));g.H=_.cache(_.process(_.rtoken(/^([0-1][0-9]|2[0-3]|[0-9])/),t.hour));g.HH=_.cache(_.process(_.rtoken(/^([0-1][0-9]|2[0-3])/),t.hour));g.m=_.cache(_.process(_.rtoken(/^([0-5][0-9]|[0-9])/),t.minute));g.mm=_.cache(_.process(_.rtoken(/^[0-5][0-9]/),t.minute));g.s=_.cache(_.process(_.rtoken(/^([0-5][0-9]|[0-9])/),t.second));g.ss=_.cache(_.process(_.rtoken(/^[0-5][0-9]/),t.second));g.hms=_.cache(_.sequence([g.H,g.mm,g.ss],g.timePartDelimiter));g.t=_.cache(_.process(g.ctoken2("shortMeridian"),t.meridian));g.tt=_.cache(_.process(g.ctoken2("longMeridian"),t.meridian));g.z=_.cache(_.process(_.rtoken(/^(\+|\-)?\s*\d\d\d\d?/),t.timezone));g.zz=_.cache(_.process(_.rtoken(/^(\+|\-)\s*\d\d\d\d/),t.timezone));g.zzz=_.cache(_.process(g.ctoken2("timezone"),t.timezone));g.timeSuffix=_.each(_.ignore(g.whiteSpace),_.set([g.tt,g.zzz]));g.time=_.each(_.optional(_.ignore(_.stoken("T"))),g.hms,g.timeSuffix);g.d=_.cache(_.process(_.each(_.rtoken(/^([0-2]\d|3[0-1]|\d)/),_.optional(g.ctoken2("ordinalSuffix"))),t.day));g.dd=_.cache(_.process(_.each(_.rtoken(/^([0-2]\d|3[0-1])/),_.optional(g.ctoken2("ordinalSuffix"))),t.day));g.ddd=g.dddd=_.cache(_.process(g.ctoken("sun mon tue wed thu fri sat"),function(s){return function(){this.weekday=s;};}));g.M=_.cache(_.process(_.rtoken(/^(1[0-2]|0\d|\d)/),t.month));g.MM=_.cache(_.process(_.rtoken(/^(1[0-2]|0\d)/),t.month));g.MMM=g.MMMM=_.cache(_.process(g.ctoken("jan feb mar apr may jun jul aug sep oct nov dec"),t.month));g.y=_.cache(_.process(_.rtoken(/^(\d\d?)/),t.year));g.yy=_.cache(_.process(_.rtoken(/^(\d\d)/),t.year));g.yyy=_.cache(_.process(_.rtoken(/^(\d\d?\d?\d?)/),t.year));g.yyyy=_.cache(_.process(_.rtoken(/^(\d\d\d\d)/),t.year));_fn=function(){return _.each(_.any.apply(null,arguments),_.not(g.ctoken2("timeContext")));};g.day=_fn(g.d,g.dd);g.month=_fn(g.M,g.MMM);g.year=_fn(g.yyyy,g.yy);g.orientation=_.process(g.ctoken("past future"),function(s){return function(){this.orient=s;};});g.operator=_.process(g.ctoken("add subtract"),function(s){return function(){this.operator=s;};});g.rday=_.process(g.ctoken("yesterday tomorrow today now"),t.rday);g.unit=_.process(g.ctoken("minute hour day week month year"),function(s){return function(){this.unit=s;};});g.value=_.process(_.rtoken(/^\d\d?(st|nd|rd|th)?/),function(s){return function(){this.value=s.replace(/\D/g,"");};});g.expression=_.set([g.rday,g.operator,g.value,g.unit,g.orientation,g.ddd,g.MMM]);_fn=function(){return _.set(arguments,g.datePartDelimiter);};g.mdy=_fn(g.ddd,g.month,g.day,g.year);g.ymd=_fn(g.ddd,g.year,g.month,g.day);g.dmy=_fn(g.ddd,g.day,g.month,g.year);g.date=function(s){return((g[Date.CultureInfo.dateElementOrder]||g.mdy).call(this,s));};g.format=_.process(_.many(_.any(_.process(_.rtoken(/^(dd?d?d?|MM?M?M?|yy?y?y?|hh?|HH?|mm?|ss?|tt?|zz?z?)/),function(fmt){if(g[fmt]){return g[fmt];}else{throw Date.Parsing.Exception(fmt);}}),_.process(_.rtoken(/^[^dMyhHmstz]+/),function(s){return _.ignore(_.stoken(s));}))),function(rules){return _.process(_.each.apply(null,rules),t.finishExact);});var _F={};var _get=function(f){return _F[f]=(_F[f]||g.format(f)[0]);};g.formats=function(fx){if(fx instanceof Array){var rx=[];for(var i=0;i<fx.length;i++){rx.push(_get(fx[i]));}
100
- return _.any.apply(null,rx);}else{return _get(fx);}};g._formats=g.formats(["yyyy-MM-ddTHH:mm:ss","ddd, MMM dd, yyyy H:mm:ss tt","ddd MMM d yyyy HH:mm:ss zzz","d"]);g._start=_.process(_.set([g.date,g.time,g.expression],g.generalDelimiter,g.whiteSpace),t.finish);g.start=function(s){try{var r=g._formats.call({},s);if(r[1].length===0){return r;}}catch(e){}
101
- return g._start.call({},s);};}());Date._parse=Date.parse;Date.parse=function(s){var r=null;if(!s){return null;}
102
- try{r=Date.Grammar.start.call({},s);}catch(e){return null;}
103
- return((r[1].length===0)?r[0]:null);};Date.getParseFunction=function(fx){var fn=Date.Grammar.formats(fx);return function(s){var r=null;try{r=fn.call({},s);}catch(e){return null;}
104
- return((r[1].length===0)?r[0]:null);};};Date.parseExact=function(s,fx){return Date.getParseFunction(fx)(s);};
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
inc/js/gawd_admin.js CHANGED
@@ -36,8 +36,8 @@ monthnames[12] = 'December';
36
  function gawd_compare() {
37
  jQuery("#gawd_metric_compare").show();
38
  jQuery("#filter_conteiner").show();
39
- var _end_date = (Date.today().add(-1).days()).toString("yyyy-MM-dd");
40
- var start_date_7 = (Date.today().add(-1).days()).add(-7).days().toString("yyyy-MM-dd");
41
  var start_end_date_compare = jQuery('#gawd_start_end_date_compare').val().split('/-/');
42
  var start_date_compare = start_end_date_compare[0] ? start_end_date_compare[0] : start_date_7;
43
  var end_date_compare = start_end_date_compare[1] ? start_end_date_compare[1] : _end_date;
@@ -276,6 +276,9 @@ function gawd_compare() {
276
  var week_compare = filter_type != '' ? weekdays[new Date(graphDataItem.dataContext[(filter_type+' compare').replace(/([A-Z])/g, " $1").trim().charAt(0).toUpperCase() + (filter_type+' compare').replace(/([A-Z])/g, " $1").trim().slice(1)]).getDay()] : weekdays[new Date(graphDataItem.dataContext[((dimension == 'siteSpeed' || dimension == 'sales_performance' ? 'Date' : dimension)+' compare').replace(/([A-Z])/g, " $1").trim().charAt(0).toUpperCase() + ((dimension == 'siteSpeed' || dimension == 'sales_performance' ? 'Date' : dimension)+' compare').replace(/([A-Z])/g, " $1").trim().slice(1)]).getDay()];
277
  var date_compare = filter_type != '' ? graphDataItem.dataContext[(filter_type+' compare').replace(/([A-Z])/g, " $1").trim().charAt(0).toUpperCase() + (filter_type+' compare').replace(/([A-Z])/g, " $1").trim().slice(1)] : graphDataItem.dataContext[((dimension == 'siteSpeed' || dimension == 'sales_performance' ? 'Date' : dimension) + 'compare' ).replace(/([A-Z])/g, " $1").trim().charAt(0).toUpperCase() + ((dimension == 'siteSpeed' || dimension == 'sales_performance' ? 'Date' : dimension)+' compare').replace(/([A-Z])/g, " $1").trim().slice(1)]
278
  //week_compare = dimension+' compare' != 'date compare' && dimension+' compare' != 'week compare' && dimension+' compare' != 'month compare' ? '' : week_compare;
 
 
 
279
  if (filter_type == 'week' || filter_type == 'month') {
280
  week_compare = '';
281
  //date_compare = graphDataItem.category;
@@ -302,7 +305,8 @@ function gawd_compare() {
302
  metric_compare_value = sec_to_normal(metric_compare_value);
303
  }
304
  metric_compare_value = metric_compare == "Bounce Rate compare" || metric_compare == "Percent New Sessions compare" ? metric_compare_value +'%' : metric_compare_value;
305
- var compare = date_compare.toString().indexOf("GMT") > -1 ? '' : metric_compare + ': ' + metric_compare_value.toLocaleString();
 
306
  }
307
  metric_value = metric == "Bounce Rate" || metric == "Percent New Sessions" ? parseFloat(metric_value).toLocaleString() +'%' : metric != 'Avg Session Duration' ? parseFloat(metric_value).toLocaleString() : metric_value;
308
 
@@ -433,8 +437,8 @@ function gawd_compare() {
433
  })
434
  }
435
  function gawd_draw_analytics_compact(metric, metric_compare, dimension, chart_type, chart_id) {
436
- var _end_date = (Date.today().add(-1).days()).toString("yyyy-MM-dd");
437
- var start_date_7 = (Date.today().add(-1).days()).add(-7).days().toString("yyyy-MM-dd");
438
  var start_end_date = typeof jQuery('#gawd_start_end_date_compact').val() != 'undefined' ? jQuery('#gawd_start_end_date_compact').val() : start_date_7 + '/-/' + _end_date;
439
 
440
  var start_end_date = start_end_date.split('/-/');
@@ -531,7 +535,7 @@ function gawd_draw_analytics_compact(metric, metric_compare, dimension, chart_ty
531
  float="style='float:left'";
532
  var total = data.data_sum[metric_compare];
533
  var avg = '';
534
- var diff = ((Date.parse(end_date).getTime() - Date.parse(start_date).getTime()) / 3600 / 24 / 1000)+1;
535
  var show_hide = 'gawd_show_total';
536
  if(metric == 'Bounce Rate' || metric == 'Percent New Sessions' || metric == 'Pageviews Per Session'){
537
  avg = parseFloat(total).toFixed(2);
@@ -568,7 +572,7 @@ function gawd_draw_analytics_compact(metric, metric_compare, dimension, chart_ty
568
  }
569
  var total = data.data_sum[metric];
570
  var avg = '';
571
- var diff = ((Date.parse(end_date).getTime() - Date.parse(start_date).getTime()) / 3600 / 24 / 1000)+1;
572
  var show_hide = 'gawd_show_total';
573
  if(metric == 'Bounce Rate' || metric == 'Percent New Sessions' || metric == 'Pageviews Per Session'){
574
  avg = parseFloat(total).toFixed(2);
@@ -823,8 +827,8 @@ function gawd_draw_analytics() {
823
  }
824
  }
825
 
826
- var _end_date = (Date.today().add(-1).days()).toString("yyyy-MM-dd");
827
- var start_date_7 = (Date.today().add(-1).days()).add(-7).days().toString("yyyy-MM-dd");
828
  var start_end_date = typeof jQuery('#gawd_start_end_date').val() != 'undefined' ? jQuery('#gawd_start_end_date').val() : start_date_7 + '/-/' + _end_date;
829
 
830
  var start_end_date = start_end_date.split('/-/');
@@ -990,7 +994,7 @@ function gawd_draw_analytics() {
990
  float="style='float:left'";
991
  var total = _data.data_sum[metric_compare];
992
  var avg = '';
993
- var diff = ((Date.parse(end_date).getTime() - Date.parse(start_date).getTime()) / 3600 / 24 / 1000)+1;
994
  var show_hide = 'gawd_show_total';
995
  if(metric_compare == 'Bounce Rate' || metric_compare == 'Percent New Sessions' || metric_compare == 'Pageviews Per Session'){
996
  avg = parseFloat(total).toFixed(2);
@@ -1028,7 +1032,7 @@ function gawd_draw_analytics() {
1028
 
1029
  var total = _data.data_sum[metric];
1030
  var avg = '';
1031
- var diff = ((Date.parse(end_date).getTime() - Date.parse(start_date).getTime()) / 3600 / 24 / 1000)+1;
1032
  var show_hide = 'gawd_show_total';
1033
  if(metric == 'Bounce Rate' || metric == 'Percent New Sessions' || metric == 'Pageviews Per Session'){
1034
  avg = parseFloat(total).toFixed(2);
@@ -1475,9 +1479,9 @@ function draw_canvas(svg, canvas) {
1475
  canvg(canvas, svgString);
1476
  }
1477
  function gawd_draw_analytics_widget() {
1478
- var end_date = (Date.today().add(-1).days()).toString("yyyy-MM-dd");
1479
- var start_date_30 = (Date.today().add(-1).days()).add(-30).days().toString("yyyy-MM-dd");
1480
- var start_date_7 = (Date.today().add(-1).days()).days().toString("yyyy-MM-dd");
1481
  start_date = typeof jQuery("#gawd_widget_date").val() != 'undefined' ? jQuery("#gawd_widget_date").val() : start_date_7;
1482
  var metric = jQuery("#gawd_metric_widget").val();
1483
  if (start_date == 'realTime') {
@@ -1489,7 +1493,6 @@ function gawd_draw_analytics_widget() {
1489
  }
1490
  }
1491
  function gawd_widget_real_time(chart_id) {
1492
-
1493
  jQuery.post(gawd_admin.ajaxurl, {
1494
  action: 'get_realtime',
1495
  security: gawd_admin.ajaxnonce,
@@ -1502,7 +1505,7 @@ function gawd_widget_real_time(chart_id) {
1502
  }).done(function (data) {
1503
  var result = JSON.parse(data);
1504
  jQuery(chart_id).empty();
1505
- jQuery("#gawd_right_conteiner").find('#griddiv').remove();
1506
  var grid = '<table id="griddiv"></table><div id="pager"></div>';
1507
  jQuery('#gawd_right_conteiner').append(grid);
1508
  var array = [];
@@ -1732,8 +1735,8 @@ function gawd_pie_chart() {
1732
  jQuery("#metric_compare").hide();
1733
  jQuery("#compare_time_conteiner").hide();
1734
  jQuery(".vs_image").hide();
1735
- var _end_date = (Date.today().add(-1).days()).toString("yyyy-MM-dd");
1736
- var start_date_7 = (Date.today().add(-1).days()).add(-7).days().toString("yyyy-MM-dd");
1737
  var start_end_date = typeof jQuery('#gawd_start_end_date').val() != 'undefined' ? jQuery('#gawd_start_end_date').val() : start_date_7 + '/-/' + _end_date;
1738
 
1739
  var start_end_date = start_end_date.split('/-/');
@@ -1917,8 +1920,8 @@ function gawd_pie_chart() {
1917
  })
1918
  }
1919
  function gawd_pie_chart_compact(metric, dimension, chart_type, chart_id) {
1920
- var _end_date = (Date.today().add(-1).days()).toString("yyyy-MM-dd");
1921
- var start_date_7 = (Date.today().add(-1).days()).add(-7).days().toString("yyyy-MM-dd");
1922
  var start_end_date = typeof jQuery('#gawd_start_end_date_compact').val() != 'undefined' ? jQuery('#gawd_start_end_date_compact').val() : start_date_7 + '/-/' + _end_date;
1923
 
1924
  var start_end_date = start_end_date.split('/-/');
@@ -1949,7 +1952,7 @@ function gawd_pie_chart_compact(metric, dimension, chart_type, chart_id) {
1949
  if(typeof result.data_sum != 'undefined'){
1950
  var total = result.data_sum[metric];
1951
  var avg = '';
1952
- var diff = ((Date.parse(end_date).getTime() - Date.parse(start_date).getTime()) / 3600 / 24 / 1000)+1;
1953
  var show_hide = 'gawd_show_total';
1954
  if(metric == 'Bounce Rate' || metric == 'Percent New Sessions' || metric == 'Pageviews Per Session'){
1955
  avg = parseFloat(total).toFixed(2);
@@ -2042,8 +2045,8 @@ function gawd_pie_chart_post_page(uri, divID) {
2042
  var date_this_month = gawd_admin.date_this_month;
2043
  var date_last_month = gawd_admin.date_last_month;
2044
  var date_last_week = gawd_admin.date_last_week;
2045
- var _end_date = (Date.today().add(-1).days()).toString("yyyy-MM-dd");
2046
- var start_date_7 = (Date.today().add(-1).days()).add(-7).days().toString("yyyy-MM-dd");
2047
  var start_end_date = start_date_7 + '/-/' + _end_date;
2048
  if(typeof jQuery('#gawd_start_end_date').val() != 'undefined'){
2049
  start_end_date = jQuery('#gawd_start_end_date').val();
@@ -2115,7 +2118,7 @@ function gawd_pie_chart_post_page(uri, divID) {
2115
  }
2116
  var result = JSON.parse(data);
2117
  result = result.chart_data
2118
- var diff = ((Date.parse(start_end_date[1]).getTime() - Date.parse(start_end_date[0]).getTime()) / 3600 / 24 / 1000)+1;
2119
  if(diff > 8){
2120
  dimension = 'Week';
2121
  metric = metric.replace(/([A-Z])/g, " $1").trim();
@@ -2193,16 +2196,16 @@ function gawd_chart_type() {
2193
  } else {
2194
  gawd_draw_analytics();
2195
  }
2196
- var _end_date = (Date.today().add(-1).days()).toString("yyyy-MM-dd");
2197
- var start_date_7 = (Date.today().add(-1).days()).add(-7).days().toString("yyyy-MM-dd");
2198
  var start_end_date = typeof jQuery('#gawd_start_end_date').val() != 'undefined' ? jQuery('#gawd_start_end_date').val() : start_date_7 + '/-/' + _end_date;
2199
  var start_end_date = start_end_date.split('/-/');
2200
  var start_date = start_end_date[0];
2201
  var end_date = start_end_date[1];
2202
- var diff = ((Date.parse(end_date).getTime() - Date.parse(start_date).getTime()) / 3600 / 24 / 1000)+1;
2203
- var period_compare_start_date = Date.parse(start_date).add(-diff).days().toString("yyyy-MM-dd");
2204
- var year_compare_start_date = Date.parse(start_date).add(-1).years().toString("yyyy-MM-dd");
2205
- var year_compare_end_date = Date.parse(end_date).add(-1).years().toString("yyyy-MM-dd");
2206
  jQuery('#compare_datepicker_wraper').daterangepicker({
2207
  'ranges': {
2208
  'Previous period': [moment(period_compare_start_date), moment(start_date).subtract(1, 'days')],
@@ -2273,8 +2276,8 @@ function post_page_stats(uri, divID) {
2273
  var date_this_month = gawd_admin.date_this_month;
2274
  var date_last_month = gawd_admin.date_last_month;
2275
  var date_last_week = gawd_admin.date_last_week;
2276
- var _end_date = (Date.today().add(-1).days()).toString("yyyy-MM-dd");
2277
- var start_date_7 = (Date.today().add(-1).days()).add(-7).days().toString("yyyy-MM-dd");
2278
  var start_end_date = start_date_7 + '/-/' + _end_date;
2279
  if(typeof jQuery('#gawd_start_end_date').val() != 'undefined'){
2280
  start_end_date = jQuery('#gawd_start_end_date').val();
@@ -2778,8 +2781,8 @@ function datepicker_js(opens,callback) {
2778
  "applyClass": 'gawd_main_apply'
2779
 
2780
  }, window[callback]);
2781
- var _end_date = (Date.today().add(-1).days()).toString("yyyy-MM-dd");
2782
- var start_date_7 = (Date.today().add(-1).days()).add(-7).days().toString("yyyy-MM-dd");
2783
  var start_end_date = typeof jQuery('#gawd_start_end_date').val() != 'undefined' ? jQuery('#gawd_start_end_date').val() : start_date_7 + '/-/' + _end_date;
2784
  var start_end_date = start_end_date.split('/-/');
2785
  var start_date = start_end_date[0];
@@ -2819,8 +2822,8 @@ function onDashboardLoad() {
2819
 
2820
 
2821
 
2822
- var _end_date = (Date.today().add(-1).days()).toString("yyyy-MM-dd");
2823
- var start_date_7 = (Date.today().add(-1).days()).add(-7).days().toString("yyyy-MM-dd");
2824
  var start_end_date = typeof jQuery('#gawd_start_end_date').val() != 'undefined' ? jQuery('#gawd_start_end_date').val() : start_date_7 + '/-/' + _end_date;
2825
 
2826
  var start_end_date = start_end_date.split('/-/');
@@ -3165,7 +3168,7 @@ function gawd_draw_table_pages_compare(_data, data, dimension, data_sum, _data_s
3165
  table += '<td ></td>';
3166
  }
3167
  else if(metrics[j] == 'Page Path' || metrics[j] == 'Landing Page'){
3168
- table += '<td>' + Date.parse(d_start_date).toString('MMMM dd, yyyy') + ' - ' + Date.parse(d_end_date).toString('MMMM dd, yyyy') +'</td>';
3169
  }
3170
  else{
3171
  if(all_pages[keys[i]][0] != 'no'){
@@ -3198,7 +3201,7 @@ function gawd_draw_table_pages_compare(_data, data, dimension, data_sum, _data_s
3198
  table += '<td style="text-align:right"></td>';
3199
  }
3200
  else if(metrics[j] == 'Page Path' || metrics[j] == 'Landing Page'){
3201
- table += '<td>' + Date.parse(start_date).toString('MMMM dd, yyyy') + ' - ' + Date.parse(end_date).toString('MMMM dd, yyyy') +'</td>';
3202
  }
3203
  else{
3204
  if(all_pages[keys[i]][1] != 'no'){
@@ -3532,8 +3535,8 @@ function gawd_draw_analytics_country(country_name, geo_type) {
3532
  jQuery("#gawd_metric_compare").show();
3533
  jQuery("#filter_conteiner").show();
3534
  jQuery("#chartdiv").show();
3535
- var _end_date = (Date.today().add(-1).days()).toString("yyyy-MM-dd");
3536
- var start_date_7 = (Date.today().add(-1).days()).add(-7).days().toString("yyyy-MM-dd");
3537
  var start_end_date = typeof jQuery('#gawd_start_end_date').val() != 'undefined' ? jQuery('#gawd_start_end_date').val() : start_date_7 + '/-/' + _end_date;
3538
 
3539
  var start_end_date = start_end_date.split('/-/');
@@ -3701,8 +3704,8 @@ function gawd_draw_analytics_country_pie(country_name, geo_type) {
3701
  jQuery("#gawd_metric_compare").show();
3702
  jQuery("#filter_conteiner").show();
3703
  jQuery("#chartdiv").show();
3704
- var _end_date = (Date.today().add(-1).days()).toString("yyyy-MM-dd");
3705
- var start_date_7 = (Date.today().add(-1).days()).add(-7).days().toString("yyyy-MM-dd");
3706
  var start_end_date = typeof jQuery('#gawd_start_end_date').val() != 'undefined' ? jQuery('#gawd_start_end_date').val() : start_date_7 + '/-/' + _end_date;
3707
 
3708
  var start_end_date = start_end_date.split('/-/');
@@ -3860,75 +3863,79 @@ function gawd_tracking_display_manage() {
3860
  }
3861
  });
3862
  }
3863
- function gawd_auth_popup(url, w, h) {
3864
- var left = (screen.width / 2) - (w / 2);
3865
  var top = (screen.height / 8);
3866
  jQuery('#gawd_auth_code').show();
3867
  jQuery('.auth_description').hide();
3868
  jQuery('#gawd_auth_url').hide();
3869
  jQuery('.gawd_submit').hide();
3870
  authwindow = window.open(url, 'gawd_auth_window', 'toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=no, resizable=no, copyhistory=no, width=' + w + ', height=' + h + ', top=' + top + ', left=' + left);
3871
- jQuery('#gawd_auth_code_submit').on('click', function () {
3872
- jQuery.ajax({
3873
- type: 'POST',
3874
- url: gawd_admin.ajaxurl,
3875
- data: {
3876
- action: 'gawd_auth',
3877
- token: jQuery('#gawd_token').val(),
3878
- security: gawd_admin.ajaxnonce
3879
- },
3880
- beforeSend: function () {
3881
- jQuery('#opacity_div').show();
3882
- jQuery('#loading_div').show();
3883
- },
3884
- success: function (r) {
3885
- if (typeof r.status == "undefined") {
3886
- r.status = false;
3887
- }
3888
-
3889
- if (true == r.status) {
3890
- jQuery('#gawd_auth_code').hide();
3891
- //location.reload();
3892
- window.location.href = gawd_admin.wp_admin_url + 'admin.php?page=gawd_settings&defaultExist=1';
3893
- } else {
3894
- jQuery('#opacity_div').hide();
3895
- jQuery('#loading_div').hide();
3896
- alert(r.status);
3897
- window.location.href = gawd_admin.wp_admin_url + 'admin.php?page=gawd_settings';
3898
- }
3899
- }
3900
- });
3901
- });
3902
- jQuery('#gawd_token').bind("enterKey",function(e){
3903
- jQuery.ajax({
3904
- type: 'POST',
3905
- url: gawd_admin.ajaxurl,
3906
- data: {
3907
- action: 'gawd_auth',
3908
- token: jQuery('#gawd_token').val(),
3909
- security: gawd_admin.ajaxnonce
3910
- },
3911
- beforeSend: function () {
3912
- jQuery('#opacity_div').show();
3913
- jQuery('#loading_div').show();
3914
- },
3915
- success: function (r) {
3916
- if (typeof r.status == "undefined") {
3917
- r.status = false;
3918
- }
3919
 
3920
- if (true == r.status) {
3921
- jQuery('#gawd_auth_code').hide();
3922
- //location.reload();
3923
- window.location.href = gawd_admin.wp_admin_url + 'admin.php?page=gawd_settings&defaultExist=1';
3924
- } else {
3925
- jQuery('#opacity_div').hide();
3926
- jQuery('#loading_div').hide();
3927
- alert(r.status);
3928
- window.location.href = gawd_admin.wp_admin_url + 'admin.php?page=gawd_settings';
3929
- }
 
 
3930
  }
3931
  });
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3932
  });
3933
  jQuery('#gawd_token').keyup(function(e){
3934
  if(e.keyCode == 13)
@@ -3936,6 +3943,7 @@ function gawd_auth_popup(url, w, h) {
3936
  jQuery(this).trigger("enterKey");
3937
  }
3938
  });
 
3939
  }
3940
 
3941
  function gawd_remove_item(dataKey,hidden){
36
  function gawd_compare() {
37
  jQuery("#gawd_metric_compare").show();
38
  jQuery("#filter_conteiner").show();
39
+ var _end_date = (moment().subtract(1, 'day')).format("YYYY-MM-DD");
40
+ var start_date_7 = (moment().subtract(8, 'day')).format("YYYY-MM-DD");
41
  var start_end_date_compare = jQuery('#gawd_start_end_date_compare').val().split('/-/');
42
  var start_date_compare = start_end_date_compare[0] ? start_end_date_compare[0] : start_date_7;
43
  var end_date_compare = start_end_date_compare[1] ? start_end_date_compare[1] : _end_date;
276
  var week_compare = filter_type != '' ? weekdays[new Date(graphDataItem.dataContext[(filter_type+' compare').replace(/([A-Z])/g, " $1").trim().charAt(0).toUpperCase() + (filter_type+' compare').replace(/([A-Z])/g, " $1").trim().slice(1)]).getDay()] : weekdays[new Date(graphDataItem.dataContext[((dimension == 'siteSpeed' || dimension == 'sales_performance' ? 'Date' : dimension)+' compare').replace(/([A-Z])/g, " $1").trim().charAt(0).toUpperCase() + ((dimension == 'siteSpeed' || dimension == 'sales_performance' ? 'Date' : dimension)+' compare').replace(/([A-Z])/g, " $1").trim().slice(1)]).getDay()];
277
  var date_compare = filter_type != '' ? graphDataItem.dataContext[(filter_type+' compare').replace(/([A-Z])/g, " $1").trim().charAt(0).toUpperCase() + (filter_type+' compare').replace(/([A-Z])/g, " $1").trim().slice(1)] : graphDataItem.dataContext[((dimension == 'siteSpeed' || dimension == 'sales_performance' ? 'Date' : dimension) + 'compare' ).replace(/([A-Z])/g, " $1").trim().charAt(0).toUpperCase() + ((dimension == 'siteSpeed' || dimension == 'sales_performance' ? 'Date' : dimension)+' compare').replace(/([A-Z])/g, " $1").trim().slice(1)]
278
  //week_compare = dimension+' compare' != 'date compare' && dimension+' compare' != 'week compare' && dimension+' compare' != 'month compare' ? '' : week_compare;
279
+ if(typeof date_compare === 'undefined'){
280
+ date_compare = graphDataItem.dataContext[((dimension == 'siteSpeed' || dimension == 'sales_performance' ? 'Date' : dimension)).replace(/([A-Z])/g, " $1").trim().charAt(0).toUpperCase() + ((dimension == 'siteSpeed' || dimension == 'sales_performance' ? 'Date' : dimension)).replace(/([A-Z])/g, " $1").trim().slice(1)]
281
+ }
282
  if (filter_type == 'week' || filter_type == 'month') {
283
  week_compare = '';
284
  //date_compare = graphDataItem.category;
305
  metric_compare_value = sec_to_normal(metric_compare_value);
306
  }
307
  metric_compare_value = metric_compare == "Bounce Rate compare" || metric_compare == "Percent New Sessions compare" ? metric_compare_value +'%' : metric_compare_value;
308
+
309
+ var compare = date_compare ? ( date_compare.toString().indexOf("GMT") > -1 ? '' : metric_compare + ': ' + metric_compare_value.toLocaleString() ) : '';
310
  }
311
  metric_value = metric == "Bounce Rate" || metric == "Percent New Sessions" ? parseFloat(metric_value).toLocaleString() +'%' : metric != 'Avg Session Duration' ? parseFloat(metric_value).toLocaleString() : metric_value;
312
 
437
  })
438
  }
439
  function gawd_draw_analytics_compact(metric, metric_compare, dimension, chart_type, chart_id) {
440
+ var _end_date = (moment().subtract(1, 'day')).format("YYYY-MM-DD");
441
+ var start_date_7 = (moment().subtract(8, 'day')).format("YYYY-MM-DD");
442
  var start_end_date = typeof jQuery('#gawd_start_end_date_compact').val() != 'undefined' ? jQuery('#gawd_start_end_date_compact').val() : start_date_7 + '/-/' + _end_date;
443
 
444
  var start_end_date = start_end_date.split('/-/');
535
  float="style='float:left'";
536
  var total = data.data_sum[metric_compare];
537
  var avg = '';
538
+ var diff = ((new Date(end_date).getTime() - new Date(start_date).getTime()) / 3600 / 24 / 1000)+1;
539
  var show_hide = 'gawd_show_total';
540
  if(metric == 'Bounce Rate' || metric == 'Percent New Sessions' || metric == 'Pageviews Per Session'){
541
  avg = parseFloat(total).toFixed(2);
572
  }
573
  var total = data.data_sum[metric];
574
  var avg = '';
575
+ var diff = ((new Date(end_date).getTime() - new Date(start_date).getTime()) / 3600 / 24 / 1000)+1;
576
  var show_hide = 'gawd_show_total';
577
  if(metric == 'Bounce Rate' || metric == 'Percent New Sessions' || metric == 'Pageviews Per Session'){
578
  avg = parseFloat(total).toFixed(2);
827
  }
828
  }
829
 
830
+ var _end_date = (moment().subtract(1, 'day')).format("YYYY-MM-DD");
831
+ var start_date_7 = (moment().subtract(8, 'day')).format("YYYY-MM-DD");
832
  var start_end_date = typeof jQuery('#gawd_start_end_date').val() != 'undefined' ? jQuery('#gawd_start_end_date').val() : start_date_7 + '/-/' + _end_date;
833
 
834
  var start_end_date = start_end_date.split('/-/');
994
  float="style='float:left'";
995
  var total = _data.data_sum[metric_compare];
996
  var avg = '';
997
+ var diff = ((new Date(end_date).getTime() - new Date(start_date).getTime()) / 3600 / 24 / 1000)+1;
998
  var show_hide = 'gawd_show_total';
999
  if(metric_compare == 'Bounce Rate' || metric_compare == 'Percent New Sessions' || metric_compare == 'Pageviews Per Session'){
1000
  avg = parseFloat(total).toFixed(2);
1032
 
1033
  var total = _data.data_sum[metric];
1034
  var avg = '';
1035
+ var diff = ((new Date(end_date).getTime() - new Date(start_date).getTime()) / 3600 / 24 / 1000)+1;
1036
  var show_hide = 'gawd_show_total';
1037
  if(metric == 'Bounce Rate' || metric == 'Percent New Sessions' || metric == 'Pageviews Per Session'){
1038
  avg = parseFloat(total).toFixed(2);
1479
  canvg(canvas, svgString);
1480
  }
1481
  function gawd_draw_analytics_widget() {
1482
+ var end_date = (moment().subtract(1, 'day')).format("YYYY-MM-DD");
1483
+ var start_date_30 = (moment().subtract(31, 'day')).format("YYYY-MM-DD");
1484
+ var start_date_7 = (moment().subtract(8, 'day')).format("YYYY-MM-DD");
1485
  start_date = typeof jQuery("#gawd_widget_date").val() != 'undefined' ? jQuery("#gawd_widget_date").val() : start_date_7;
1486
  var metric = jQuery("#gawd_metric_widget").val();
1487
  if (start_date == 'realTime') {
1493
  }
1494
  }
1495
  function gawd_widget_real_time(chart_id) {
 
1496
  jQuery.post(gawd_admin.ajaxurl, {
1497
  action: 'get_realtime',
1498
  security: gawd_admin.ajaxnonce,
1505
  }).done(function (data) {
1506
  var result = JSON.parse(data);
1507
  jQuery(chart_id).empty();
1508
+ jQuery("#gawd_right_conteiner").find('#gbox_griddiv').remove();
1509
  var grid = '<table id="griddiv"></table><div id="pager"></div>';
1510
  jQuery('#gawd_right_conteiner').append(grid);
1511
  var array = [];
1735
  jQuery("#metric_compare").hide();
1736
  jQuery("#compare_time_conteiner").hide();
1737
  jQuery(".vs_image").hide();
1738
+ var _end_date = (moment().subtract(1, 'day')).format("YYYY-MM-DD");
1739
+ var start_date_7 = (moment().subtract(8, 'day')).format("YYYY-MM-DD");
1740
  var start_end_date = typeof jQuery('#gawd_start_end_date').val() != 'undefined' ? jQuery('#gawd_start_end_date').val() : start_date_7 + '/-/' + _end_date;
1741
 
1742
  var start_end_date = start_end_date.split('/-/');
1920
  })
1921
  }
1922
  function gawd_pie_chart_compact(metric, dimension, chart_type, chart_id) {
1923
+ var _end_date = (moment().subtract(1, 'day')).format("YYYY-MM-DD");
1924
+ var start_date_7 = (moment().subtract(8, 'day')).format("YYYY-MM-DD");
1925
  var start_end_date = typeof jQuery('#gawd_start_end_date_compact').val() != 'undefined' ? jQuery('#gawd_start_end_date_compact').val() : start_date_7 + '/-/' + _end_date;
1926
 
1927
  var start_end_date = start_end_date.split('/-/');
1952
  if(typeof result.data_sum != 'undefined'){
1953
  var total = result.data_sum[metric];
1954
  var avg = '';
1955
+ var diff = ((new Date(end_date).getTime() - new Date(start_date).getTime()) / 3600 / 24 / 1000)+1;
1956
  var show_hide = 'gawd_show_total';
1957
  if(metric == 'Bounce Rate' || metric == 'Percent New Sessions' || metric == 'Pageviews Per Session'){
1958
  avg = parseFloat(total).toFixed(2);
2045
  var date_this_month = gawd_admin.date_this_month;
2046
  var date_last_month = gawd_admin.date_last_month;
2047
  var date_last_week = gawd_admin.date_last_week;
2048
+ var _end_date = (moment().subtract(1, 'day')).format("YYYY-MM-DD");
2049
+ var start_date_7 = (moment().subtract(8, 'day')).format("YYYY-MM-DD");
2050
  var start_end_date = start_date_7 + '/-/' + _end_date;
2051
  if(typeof jQuery('#gawd_start_end_date').val() != 'undefined'){
2052
  start_end_date = jQuery('#gawd_start_end_date').val();
2118
  }
2119
  var result = JSON.parse(data);
2120
  result = result.chart_data
2121
+ var diff = ((new Date(start_end_date[1]).getTime() - new Date(start_end_date[0]).getTime()) / 3600 / 24 / 1000)+1;
2122
  if(diff > 8){
2123
  dimension = 'Week';
2124
  metric = metric.replace(/([A-Z])/g, " $1").trim();
2196
  } else {
2197
  gawd_draw_analytics();
2198
  }
2199
+ var _end_date = (moment().subtract(1, 'day')).format("YYYY-MM-DD");
2200
+ var start_date_7 = (moment().subtract(8, 'day')).format("YYYY-MM-DD");
2201
  var start_end_date = typeof jQuery('#gawd_start_end_date').val() != 'undefined' ? jQuery('#gawd_start_end_date').val() : start_date_7 + '/-/' + _end_date;
2202
  var start_end_date = start_end_date.split('/-/');
2203
  var start_date = start_end_date[0];
2204
  var end_date = start_end_date[1];
2205
+ var diff = ((new Date(end_date).getTime() - new Date(start_date).getTime()) / 3600 / 24 / 1000)+1;
2206
+ var period_compare_start_date = (moment(start_date).subtract(diff, 'day')).format('YYYY-MM-DD');
2207
+ var year_compare_start_date = (moment(start_date).subtract(diff, 'year')).format('YYYY-MM-DD');
2208
+ var year_compare_end_date = (moment(end_date).subtract(1, 'year')).format('YYYY-MM-DD');
2209
  jQuery('#compare_datepicker_wraper').daterangepicker({
2210
  'ranges': {
2211
  'Previous period': [moment(period_compare_start_date), moment(start_date).subtract(1, 'days')],
2276
  var date_this_month = gawd_admin.date_this_month;
2277
  var date_last_month = gawd_admin.date_last_month;
2278
  var date_last_week = gawd_admin.date_last_week;
2279
+ var _end_date = (moment().subtract(1, 'day')).format("YYYY-MM-DD");
2280
+ var start_date_7 = (moment().subtract(8, 'day')).format("YYYY-MM-DD");
2281
  var start_end_date = start_date_7 + '/-/' + _end_date;
2282
  if(typeof jQuery('#gawd_start_end_date').val() != 'undefined'){
2283
  start_end_date = jQuery('#gawd_start_end_date').val();
2781
  "applyClass": 'gawd_main_apply'
2782
 
2783
  }, window[callback]);
2784
+ var _end_date = (moment().subtract(1, 'day')).format("YYYY-MM-DD");
2785
+ var start_date_7 = (moment().subtract(8, 'day')).format("YYYY-MM-DD");
2786
  var start_end_date = typeof jQuery('#gawd_start_end_date').val() != 'undefined' ? jQuery('#gawd_start_end_date').val() : start_date_7 + '/-/' + _end_date;
2787
  var start_end_date = start_end_date.split('/-/');
2788
  var start_date = start_end_date[0];
2822
 
2823
 
2824
 
2825
+ var _end_date = (moment().subtract(1, 'day')).format("YYYY-MM-DD");
2826
+ var start_date_7 = (moment().subtract(8, 'day')).format("YYYY-MM-DD");
2827
  var start_end_date = typeof jQuery('#gawd_start_end_date').val() != 'undefined' ? jQuery('#gawd_start_end_date').val() : start_date_7 + '/-/' + _end_date;
2828
 
2829
  var start_end_date = start_end_date.split('/-/');
3168
  table += '<td ></td>';
3169
  }
3170
  else if(metrics[j] == 'Page Path' || metrics[j] == 'Landing Page'){
3171
+ table += '<td>' + moment(d_start_date).format('YYYY-MM-DD') + ' - ' + moment(d_end_date).format('YYYY-MM-DD') +'</td>';
3172
  }
3173
  else{
3174
  if(all_pages[keys[i]][0] != 'no'){
3201
  table += '<td style="text-align:right"></td>';
3202
  }
3203
  else if(metrics[j] == 'Page Path' || metrics[j] == 'Landing Page'){
3204
+ table += '<td>' + moment(start_date).format('YYYY-MM-DD') + ' - ' + moment(end_date).format('YYYY-MM-DD') +'</td>';
3205
  }
3206
  else{
3207
  if(all_pages[keys[i]][1] != 'no'){
3535
  jQuery("#gawd_metric_compare").show();
3536
  jQuery("#filter_conteiner").show();
3537
  jQuery("#chartdiv").show();
3538
+ var _end_date = (moment().subtract(1, 'day')).format("YYYY-MM-DD");
3539
+ var start_date_7 = (moment().subtract(8, 'day')).format("YYYY-MM-DD");
3540
  var start_end_date = typeof jQuery('#gawd_start_end_date').val() != 'undefined' ? jQuery('#gawd_start_end_date').val() : start_date_7 + '/-/' + _end_date;
3541
 
3542
  var start_end_date = start_end_date.split('/-/');
3704
  jQuery("#gawd_metric_compare").show();
3705
  jQuery("#filter_conteiner").show();
3706
  jQuery("#chartdiv").show();
3707
+ var _end_date = (moment().subtract(1, 'day')).format("YYYY-MM-DD");
3708
+ var start_date_7 = (moment().subtract(8, 'day')).format("YYYY-MM-DD");
3709
  var start_end_date = typeof jQuery('#gawd_start_end_date').val() != 'undefined' ? jQuery('#gawd_start_end_date').val() : start_date_7 + '/-/' + _end_date;
3710
 
3711
  var start_end_date = start_end_date.split('/-/');
3863
  }
3864
  });
3865
  }
3866
+ function gawd_auth_popup(url, w, h) { var left = (screen.width / 2) - (w / 2);
 
3867
  var top = (screen.height / 8);
3868
  jQuery('#gawd_auth_code').show();
3869
  jQuery('.auth_description').hide();
3870
  jQuery('#gawd_auth_url').hide();
3871
  jQuery('.gawd_submit').hide();
3872
  authwindow = window.open(url, 'gawd_auth_window', 'toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=no, resizable=no, copyhistory=no, width=' + w + ', height=' + h + ', top=' + top + ', left=' + left);
3873
+ jQuery('#gawd_auth_code_submit').on('click', function () {
3874
+ if(jQuery('#gawd_token').val() != ''){
3875
+ jQuery.ajax({
3876
+ type: 'POST',
3877
+ url: gawd_admin.ajaxurl,
3878
+ data: {
3879
+ action: 'gawd_auth',
3880
+ token: jQuery('#gawd_token').val(),
3881
+ security: gawd_admin.ajaxnonce
3882
+ },
3883
+ beforeSend: function () {
3884
+ jQuery('#opacity_div').show();
3885
+ jQuery('#loading_div').show();
3886
+ },
3887
+ success: function (r) {
3888
+ if (typeof r.status == "undefined") {
3889
+ r.status = false;
3890
+ }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3891
 
3892
+ if (true == r.status) {
3893
+ jQuery('#gawd_auth_code').hide();
3894
+ //location.reload();
3895
+ window.location.href = gawd_admin.wp_admin_url + 'admin.php?page=gawd_settings&defaultExist=1';
3896
+ } else {
3897
+ jQuery('#opacity_div').hide();
3898
+ jQuery('#loading_div').hide();
3899
+ alert(r.status);
3900
+ window.location.href = gawd_admin.wp_admin_url + 'admin.php?page=gawd_settings';
3901
+ }
3902
+ }
3903
+ });
3904
  }
3905
  });
3906
+ jQuery('#gawd_token').bind("enterKey",function(e){
3907
+ if(jQuery('#gawd_token').val() != ''){
3908
+
3909
+ jQuery.ajax({
3910
+ type: 'POST',
3911
+ url: gawd_admin.ajaxurl,
3912
+ data: {
3913
+ action: 'gawd_auth',
3914
+ token: jQuery('#gawd_token').val(),
3915
+ security: gawd_admin.ajaxnonce
3916
+ },
3917
+ beforeSend: function () {
3918
+ jQuery('#opacity_div').show();
3919
+ jQuery('#loading_div').show();
3920
+ },
3921
+ success: function (r) {
3922
+ if (typeof r.status == "undefined") {
3923
+ r.status = false;
3924
+ }
3925
+
3926
+ if (true == r.status) {
3927
+ jQuery('#gawd_auth_code').hide();
3928
+ //location.reload();
3929
+ window.location.href = gawd_admin.wp_admin_url + 'admin.php?page=gawd_settings&defaultExist=1';
3930
+ } else {
3931
+ jQuery('#opacity_div').hide();
3932
+ jQuery('#loading_div').hide();
3933
+ alert(r.status);
3934
+ window.location.href = gawd_admin.wp_admin_url + 'admin.php?page=gawd_settings';
3935
+ }
3936
+ }
3937
+ });
3938
+ }
3939
  });
3940
  jQuery('#gawd_token').keyup(function(e){
3941
  if(e.keyCode == 13)
3943
  jQuery(this).trigger("enterKey");
3944
  }
3945
  });
3946
+
3947
  }
3948
 
3949
  function gawd_remove_item(dataKey,hidden){
inc/js/gawd_overview.js CHANGED
@@ -1,7 +1,7 @@
1
  function gawd_onclick_refresh() {
2
- var end_date = Date.today().add(-1).days().toString("yyyy-MM-dd");
3
- var start_date_30 = (Date.today().add(-1).days()).add(-30).days().toString("yyyy-MM-dd");
4
- var start_date_7 = (Date.today().add(-1).days()).add(-7).days().toString("yyyy-MM-dd");
5
  start_date = start_date_7;
6
  var current_id = jQuery(this).attr('id');
7
  switch (current_id) {
1
  function gawd_onclick_refresh() {
2
+ var end_date = (moment().subtract(1, 'day')).format("YYYY-MM-DD");
3
+ var start_date_30 = (moment().subtract(31, 'day')).format("YYYY-MM-DD");
4
+ var start_date_7 = (moment().subtract(8, 'day')).format("YYYY-MM-DD");
5
  start_date = start_date_7;
6
  var current_id = jQuery(this).attr('id');
7
  switch (current_id) {
readme.txt CHANGED
@@ -4,7 +4,7 @@ Donate link: https://web-dorado.com/products/wordpress-google-analytics-plugin.h
4
  Tags: google analytics, google analytics dashboard, statistics, tracking, analytics, analytics dashboard, stats, ga, googleanalytics, ecommerce tracking, custom reports, custom dimensions
5
  Requires at least: 3.9
6
  Tested up to: 4.7
7
- Stable tag: 1.0.14
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -100,6 +100,11 @@ Upgrade to Google Analytics WD Pro for premium features:
100
 
101
  == Changelog ==
102
 
 
 
 
 
 
103
  = 1.0.14 =
104
  * Fixed: Analytics back end menu position conflict
105
  * Fixed: Bug on deleted property check
4
  Tags: google analytics, google analytics dashboard, statistics, tracking, analytics, analytics dashboard, stats, ga, googleanalytics, ecommerce tracking, custom reports, custom dimensions
5
  Requires at least: 3.9
6
  Tested up to: 4.7
7
+ Stable tag: 1.0.15
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
100
 
101
  == Changelog ==
102
 
103
+ = 1.0.15 =
104
+ * Fixed: Bug on date picker
105
+ * Changed: Improved error handling
106
+ * Added: New featured plugins
107
+
108
  = 1.0.14 =
109
  * Fixed: Analytics back end menu position conflict
110
  * Fixed: Bug on deleted property check