Google Analytics Dashboard for WP (GADWP) - Version 5.2.3

Version Description

  • Enhancements:
    • add Google Analytics user opt-out support
    • add option to exclude tracking for users sending the Do Not Track header
    • add System tab to Errors & Debug screen
    • check to avoid using a redeemed access code
  • Bug Fixes:
    • remove a debugging message
    • cURL options were overwritten during regular API calls
Download this release

Release Info

Developer deconf
Plugin Icon 128x128 Google Analytics Dashboard for WP (GADWP)
Version 5.2.3
Comparing to
See all releases

Code changes from version 5.2.2 to 5.2.3

admin/settings.php CHANGED
@@ -22,6 +22,8 @@ final class GADWP_Settings {
22
  $new_options = $_POST['options'];
23
  if ( 'tracking' == $who ) {
24
  $options['ga_anonymize_ip'] = 0;
 
 
25
  $options['ga_event_tracking'] = 0;
26
  $options['ga_enhanced_links'] = 0;
27
  $options['ga_event_precision'] = 0;
@@ -757,6 +759,30 @@ final class GADWP_Settings {
757
  <div class="switch-desc"><?php echo " ".__("anonymize IPs while tracking", 'google-analytics-dashboard-for-wp' );?></div>
758
  </td>
759
  </tr>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
760
  <tr>
761
  <td colspan="2" class="gadwp-settings-title">
762
  <div class="button-primary gadwp-settings-switchoo">
@@ -1075,7 +1101,7 @@ final class GADWP_Settings {
1075
  <div class="settings-wrapper">
1076
  <div class="inside">
1077
  <?php if (isset($message)) echo $message; ?>
1078
- <?php $tabs = array( 'errors' => __( "Errors & Details", 'google-analytics-dashboard-for-wp' ), 'config' => __( "Plugin Settings", 'google-analytics-dashboard-for-wp' ) ); ?>
1079
  <?php self::navigation_tabs( $tabs ); ?>
1080
  <div id="gadwp-errors">
1081
  <table class="gadwp-settings-logdata">
@@ -1131,6 +1157,20 @@ final class GADWP_Settings {
1131
  </tr>
1132
  </table>
1133
  </div>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1134
  <?php
1135
  self::output_sidebar();
1136
  }
@@ -1148,17 +1188,18 @@ final class GADWP_Settings {
1148
  }
1149
  echo '<script type="text/javascript">jQuery("#gapi-warning").hide()</script>';
1150
  if ( isset( $_POST['gadwp_access_code'] ) ) {
1151
- if ( 1 == ! stripos( 'x' . $_POST['gadwp_access_code'], 'UA-', 1 ) ) {
1152
  try {
1153
  $gadwp_access_code = $_POST['gadwp_access_code'];
 
 
 
1154
  $gadwp->gapi_controller->client->authenticate( $_POST['gadwp_access_code'] );
1155
  $gadwp->config->options['token'] = $gadwp->gapi_controller->client->getAccessToken();
1156
  $gadwp->config->options['automatic_updates_minorversion'] = 1;
1157
  $gadwp->config->set_plugin_options();
1158
  $options = self::update_options( 'general' );
1159
  $message = "<div class='updated' id='gadwp-autodismiss'><p>" . __( "Plugin authorization succeeded.", 'google-analytics-dashboard-for-wp' ) . "</p></div>";
1160
- GADWP_Tools::delete_cache( 'gapi_errors' );
1161
- GADWP_Tools::delete_cache( 'last_error' );
1162
  if ( $gadwp->config->options['token'] && $gadwp->gapi_controller->client->getAccessToken() ) {
1163
  if ( ! empty( $gadwp->config->options['ga_profiles_list'] ) ) {
1164
  $profiles = $gadwp->config->options['ga_profiles_list'];
@@ -1187,7 +1228,11 @@ final class GADWP_Settings {
1187
  $gadwp->gapi_controller->reset_token( true );
1188
  }
1189
  } else {
1190
- $message = "<div class='error' id='gadwp-autodismiss'><p>" . __( "The access code is <strong>not</strong> your <strong>Tracking ID</strong> (UA-XXXXX-X) <strong>nor</strong> your <strong>email address</strong>!", 'google-analytics-dashboard-for-wp' ) . ".</p></div>";
 
 
 
 
1191
  }
1192
  }
1193
  if ( isset( $_POST['Clear'] ) ) {
@@ -1211,15 +1256,16 @@ final class GADWP_Settings {
1211
  if ( isset( $_POST['Reset_Err'] ) ) {
1212
  if ( isset( $_POST['gadwp_security'] ) && wp_verify_nonce( $_POST['gadwp_security'], 'gadwp_form' ) ) {
1213
 
1214
- if ( GADWP_Tools::get_cache( 'gapi_errors' ) || GADWP_Tools::get_cache( 'last_error' ) ) {
1215
 
1216
- $anonim = GADWP_Tools::anonymize_options( $gadwp->config->options );
 
1217
 
1218
  $sep = "\n---------------------------\n";
1219
  $error_report = GADWP_Tools::get_cache( 'last_error' );
1220
  $error_report .= $sep . print_r( GADWP_Tools::get_cache( 'gapi_errors' ), true );
1221
  $error_report .= $sep . GADWP_Tools::get_cache( 'errors_count' );
1222
- $error_report .= $sep . print_r( $anonim, true );
1223
 
1224
  $url = GADWP_ENDPOINT_URL . 'gadwp-report.php';
1225
  /* @formatter:off */
@@ -1295,7 +1341,7 @@ final class GADWP_Settings {
1295
  </tr>
1296
  <tr>
1297
  <td colspan="2" class="gadwp-settings-info">
1298
- <?php printf(__('You should watch the %1$s and read this %2$s before proceeding to authorization. This plugin requires a properly configured Google Analytics account!', 'google-analytics-dashboard-for-wp'), sprintf('<a href="%1$s" target="_blank">%2$s</a>', 'https://deconf.com/google-analytics-dashboard-wordpress/?utm_source=gadwp_config&utm_medium=link&utm_content=top_video&utm_campaign=gadwp', __("video", 'google-analytics-dashboard-for-wp')), sprintf('<a href="%1$s" target="_blank">%2$s</a>', 'https://deconf.com/google-analytics-dashboard-wordpress/?utm_source=gadwp_config&utm_medium=link&utm_content=top_tutorial&utm_campaign=gadwp', __("tutorial", 'google-analytics-dashboard-for-wp')));?>
1299
  </td>
1300
  </tr>
1301
  <?php if (! $options['token'] || ($options['user_api'] && ! $options['network_mode'])) : ?>
@@ -1462,10 +1508,10 @@ final class GADWP_Settings {
1462
 
1463
  echo '<script type="text/javascript">jQuery("#gapi-warning").hide()</script>';
1464
  if ( isset( $_POST['gadwp_access_code'] ) ) {
1465
- if ( 1 == ! stripos( 'x' . $_POST['gadwp_access_code'], 'UA-', 1 ) ) {
1466
  try {
1467
-
1468
  $gadwp_access_code = $_POST['gadwp_access_code'];
 
1469
  $gadwp->gapi_controller->client->authenticate( $_POST['gadwp_access_code'] );
1470
  $gadwp->config->options['token'] = $gadwp->gapi_controller->client->getAccessToken();
1471
  $gadwp->config->options['automatic_updates_minorversion'] = 1;
@@ -1511,7 +1557,11 @@ final class GADWP_Settings {
1511
  $gadwp->gapi_controller->reset_token( true );
1512
  }
1513
  } else {
1514
- $message = "<div class='error' id='gadwp-autodismiss'><p>" . __( "The access code is <strong>not</strong> your <strong>Tracking ID</strong> (UA-XXXXX-X) <strong>nor</strong> your <strong>email address</strong>!", 'google-analytics-dashboard-for-wp' ) . ".</p></div>";
 
 
 
 
1515
  }
1516
  }
1517
  if ( isset( $_POST['Refresh'] ) ) {
@@ -1628,7 +1678,7 @@ final class GADWP_Settings {
1628
  </tr>
1629
  <tr>
1630
  <td colspan="2" class="gadwp-settings-info">
1631
- <?php printf(__('You should watch the %1$s and read this %2$s before proceeding to authorization. This plugin requires a properly configured Google Analytics account!', 'google-analytics-dashboard-for-wp'), sprintf('<a href="%1$s" target="_blank">%2$s</a>', 'https://deconf.com/google-analytics-dashboard-wordpress/?utm_source=gadwp_config&utm_medium=link&utm_content=top_video&utm_campaign=gadwp', __("video", 'google-analytics-dashboard-for-wp')), sprintf('<a href="%1$s" target="_blank">%2$s</a>', 'https://deconf.com/google-analytics-dashboard-wordpress/?utm_source=gadwp_config&utm_medium=link&utm_content=top_tutorial&utm_campaign=gadwp', __("tutorial", 'google-analytics-dashboard-for-wp')));?>
1632
  </td>
1633
  </tr>
1634
  <?php if ( ! $options['token'] || $options['user_api'] ) : ?>
@@ -1801,32 +1851,21 @@ final class GADWP_Settings {
1801
  </div>
1802
  <div class="postbox">
1803
  <h3>
1804
- <span><?php _e("Follow & Review",'google-analytics-dashboard-for-wp')?></span>
1805
  </h3>
1806
  <div class="inside">
1807
  <div class="gadwp-desc">
1808
- <div style="margin-left: -10px;">
1809
- <div class="g-page" data-width="273" data-href="//plus.google.com/+Deconfcom" data-layout="landscape" data-showtagline="false" data-showcoverphoto="false" data-rel="publisher"></div>
1810
- </div>
1811
- <script type="text/javascript">
1812
- (function() {
1813
- var po = document.createElement('script'); po.type = 'text/javascript'; po.async = true;
1814
- po.src = 'https://apis.google.com/js/platform.js';
1815
- var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(po, s);
1816
- })();
1817
- </script>
1818
  </div>
1819
  <br />
1820
  <div class="gadwp-desc">
1821
- <a href="https://twitter.com/deconfcom" class="twitter-follow-button" data-show-count="false" data-size="large">Follow @deconfcom</a>
1822
- <script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0],p=/^http:/.test(d.location)?'http':'https';if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src=p+'://platform.twitter.com/widgets.js';fjs.parentNode.insertBefore(js,fjs);}}(document, 'script', 'twitter-wjs');</script>
1823
  </div>
1824
  <br />
1825
- <div class="gadwp-title">
1826
- <a href="http://wordpress.org/support/view/plugin-reviews/google-analytics-dashboard-for-wp#plugin-info"><img src="<?php echo plugins_url( 'images/star.png' , __FILE__ ); ?>" /></a>
1827
- </div>
1828
  <div class="gadwp-desc">
1829
- <?php printf(__('Your feedback and review are both important, %s!', 'google-analytics-dashboard-for-wp'), sprintf('<a href="http://wordpress.org/support/view/plugin-reviews/google-analytics-dashboard-for-wp#plugin-info">%s</a>', __('rate this plugin', 'google-analytics-dashboard-for-wp')));?>
 
1830
  </div>
1831
  </div>
1832
  </div>
@@ -1850,10 +1889,10 @@ final class GADWP_Settings {
1850
  </div>
1851
  <br />
1852
  <div class="gadwp-title">
1853
- <a href="https://deconf.com/wordpress/?utm_source=gadwp_config&utm_medium=link&utm_content=plugins&utm_campaign=gadwp"><img src="<?php echo plugins_url( 'images/wp.png' , __FILE__ ); ?>" /></a>
1854
  </div>
1855
  <div class="gadwp-desc">
1856
- <?php printf(__('Premium %s', 'google-analytics-dashboard-for-wp'), sprintf('<a href="https://shareasale.com/r.cfm?b=386922&u=926589&m=28169&urllink=&afftrack=">%s</a>', __('WordPress Themes & Plugins', 'google-analytics-dashboard-for-wp')));?>
1857
  </div>
1858
  </div>
1859
  </div>
22
  $new_options = $_POST['options'];
23
  if ( 'tracking' == $who ) {
24
  $options['ga_anonymize_ip'] = 0;
25
+ $options['ga_optout'] = 0;
26
+ $options['ga_dnt_optout'] = 0;
27
  $options['ga_event_tracking'] = 0;
28
  $options['ga_enhanced_links'] = 0;
29
  $options['ga_event_precision'] = 0;
759
  <div class="switch-desc"><?php echo " ".__("anonymize IPs while tracking", 'google-analytics-dashboard-for-wp' );?></div>
760
  </td>
761
  </tr>
762
+ <tr>
763
+ <td colspan="2" class="gadwp-settings-title">
764
+ <div class="button-primary gadwp-settings-switchoo">
765
+ <input type="checkbox" name="options[ga_optout]" value="1" class="gadwp-settings-switchoo-checkbox" id="ga_optout" <?php checked( $options['ga_optout'], 1 ); ?>>
766
+ <label class="gadwp-settings-switchoo-label" for="ga_optout">
767
+ <div class="gadwp-settings-switchoo-inner"></div>
768
+ <div class="gadwp-settings-switchoo-switch"></div>
769
+ </label>
770
+ </div>
771
+ <div class="switch-desc"><?php echo " ".__("enable support for user opt-out", 'google-analytics-dashboard-for-wp' );?></div>
772
+ </td>
773
+ </tr>
774
+ <tr>
775
+ <td colspan="2" class="gadwp-settings-title">
776
+ <div class="button-primary gadwp-settings-switchoo">
777
+ <input type="checkbox" name="options[ga_dnt_optout]" value="1" class="gadwp-settings-switchoo-checkbox" id="ga_dnt_optout" <?php checked( $options['ga_dnt_optout'], 1 ); ?>>
778
+ <label class="gadwp-settings-switchoo-label" for="ga_dnt_optout">
779
+ <div class="gadwp-settings-switchoo-inner"></div>
780
+ <div class="gadwp-settings-switchoo-switch"></div>
781
+ </label>
782
+ </div>
783
+ <div class="switch-desc"> <?php _e( 'exclude tracking for users sending Do Not Track header', 'google-analytics-dashboard-for-wp' ); ?></div>
784
+ </td>
785
+ </tr>
786
  <tr>
787
  <td colspan="2" class="gadwp-settings-title">
788
  <div class="button-primary gadwp-settings-switchoo">
1101
  <div class="settings-wrapper">
1102
  <div class="inside">
1103
  <?php if (isset($message)) echo $message; ?>
1104
+ <?php $tabs = array( 'errors' => __( "Errors & Details", 'google-analytics-dashboard-for-wp' ), 'config' => __( "Plugin Settings", 'google-analytics-dashboard-for-wp' ), 'sysinfo' => __( "System", 'google-analytics-dashboard-for-wp' ) ); ?>
1105
  <?php self::navigation_tabs( $tabs ); ?>
1106
  <div id="gadwp-errors">
1107
  <table class="gadwp-settings-logdata">
1157
  </tr>
1158
  </table>
1159
  </div>
1160
+ <div id="gadwp-sysinfo">
1161
+ <table class="gadwp-settings-options">
1162
+ <tr>
1163
+ <td><?php echo "<h2>" . __( "System Information", 'google-analytics-dashboard-for-wp' ) . "</h2>"; ?></td>
1164
+ </tr>
1165
+ <tr>
1166
+ <td>
1167
+ <pre class="gadwp-settings-logdata"><?php echo esc_html(GADWP_Tools::system_info());?></pre>
1168
+ <br />
1169
+ <hr>
1170
+ </td>
1171
+ </tr>
1172
+ </table>
1173
+ </div>
1174
  <?php
1175
  self::output_sidebar();
1176
  }
1188
  }
1189
  echo '<script type="text/javascript">jQuery("#gapi-warning").hide()</script>';
1190
  if ( isset( $_POST['gadwp_access_code'] ) ) {
1191
+ if ( 1 == ! stripos( 'x' . $_POST['gadwp_access_code'], 'UA-', 1 ) && $_POST['gadwp_access_code'] != get_option( 'gadwp_redeemed_code' ) ) {
1192
  try {
1193
  $gadwp_access_code = $_POST['gadwp_access_code'];
1194
+ update_option( 'gadwp_redeemed_code', $gadwp_access_code );
1195
+ GADWP_Tools::delete_cache( 'gapi_errors' );
1196
+ GADWP_Tools::delete_cache( 'last_error' );
1197
  $gadwp->gapi_controller->client->authenticate( $_POST['gadwp_access_code'] );
1198
  $gadwp->config->options['token'] = $gadwp->gapi_controller->client->getAccessToken();
1199
  $gadwp->config->options['automatic_updates_minorversion'] = 1;
1200
  $gadwp->config->set_plugin_options();
1201
  $options = self::update_options( 'general' );
1202
  $message = "<div class='updated' id='gadwp-autodismiss'><p>" . __( "Plugin authorization succeeded.", 'google-analytics-dashboard-for-wp' ) . "</p></div>";
 
 
1203
  if ( $gadwp->config->options['token'] && $gadwp->gapi_controller->client->getAccessToken() ) {
1204
  if ( ! empty( $gadwp->config->options['ga_profiles_list'] ) ) {
1205
  $profiles = $gadwp->config->options['ga_profiles_list'];
1228
  $gadwp->gapi_controller->reset_token( true );
1229
  }
1230
  } else {
1231
+ if ( 1 == stripos( 'x' . $_POST['gadwp_access_code'], 'UA-', 1 ) ) {
1232
+ $message = "<div class='error' id='gadwp-autodismiss'><p>" . __( "The access code is <strong>not</strong> your <strong>Tracking ID</strong> (UA-XXXXX-X) <strong>nor</strong> your <strong>email address</strong>!", 'google-analytics-dashboard-for-wp' ) . ".</p></div>";
1233
+ } else {
1234
+ $message = "<div class='error' id='gadwp-autodismiss'><p>" . __( "You can only use the access code <strong>once</strong>, please generate a <strong>new access</strong> code following the instructions!", 'google-analytics-dashboard-for-wp' ) . ".</p></div>";
1235
+ }
1236
  }
1237
  }
1238
  if ( isset( $_POST['Clear'] ) ) {
1256
  if ( isset( $_POST['Reset_Err'] ) ) {
1257
  if ( isset( $_POST['gadwp_security'] ) && wp_verify_nonce( $_POST['gadwp_security'], 'gadwp_form' ) ) {
1258
 
1259
+ if ( !GADWP_Tools::get_cache( 'gapi_errors' ) || GADWP_Tools::get_cache( 'last_error' ) ) {
1260
 
1261
+ $info = GADWP_Tools::system_info();
1262
+ $info .= 'GADWP Version: ' . GADWP_CURRENT_VERSION;
1263
 
1264
  $sep = "\n---------------------------\n";
1265
  $error_report = GADWP_Tools::get_cache( 'last_error' );
1266
  $error_report .= $sep . print_r( GADWP_Tools::get_cache( 'gapi_errors' ), true );
1267
  $error_report .= $sep . GADWP_Tools::get_cache( 'errors_count' );
1268
+ $error_report .= $sep . $info;
1269
 
1270
  $url = GADWP_ENDPOINT_URL . 'gadwp-report.php';
1271
  /* @formatter:off */
1341
  </tr>
1342
  <tr>
1343
  <td colspan="2" class="gadwp-settings-info">
1344
+ <?php printf(__('You need to create a %1$s and watch this %2$s before proceeding to authorization.', 'google-analytics-dashboard-for-wp'), sprintf('<a href="%1$s" target="_blank">%2$s</a>', 'https://deconf.com/creating-a-google-analytics-account/?utm_source=gadwp_config&utm_medium=link&utm_content=top_tutorial&utm_campaign=gadwp', __("free analytics account", 'google-analytics-dashboard-for-wp')), sprintf('<a href="%1$s" target="_blank">%2$s</a>', 'https://deconf.com/google-analytics-dashboard-wordpress/?utm_source=gadwp_config&utm_medium=link&utm_content=top_video&utm_campaign=gadwp', __("video tutorial", 'google-analytics-dashboard-for-wp')));?>
1345
  </td>
1346
  </tr>
1347
  <?php if (! $options['token'] || ($options['user_api'] && ! $options['network_mode'])) : ?>
1508
 
1509
  echo '<script type="text/javascript">jQuery("#gapi-warning").hide()</script>';
1510
  if ( isset( $_POST['gadwp_access_code'] ) ) {
1511
+ if ( 1 == ! stripos( 'x' . $_POST['gadwp_access_code'], 'UA-', 1 ) && $_POST['gadwp_access_code'] != get_option( 'gadwp_redeemed_code' ) ) {
1512
  try {
 
1513
  $gadwp_access_code = $_POST['gadwp_access_code'];
1514
+ update_option( 'gadwp_redeemed_code', $gadwp_access_code );
1515
  $gadwp->gapi_controller->client->authenticate( $_POST['gadwp_access_code'] );
1516
  $gadwp->config->options['token'] = $gadwp->gapi_controller->client->getAccessToken();
1517
  $gadwp->config->options['automatic_updates_minorversion'] = 1;
1557
  $gadwp->gapi_controller->reset_token( true );
1558
  }
1559
  } else {
1560
+ if ( 1 == stripos( 'x' . $_POST['gadwp_access_code'], 'UA-', 1 ) ) {
1561
+ $message = "<div class='error' id='gadwp-autodismiss'><p>" . __( "The access code is <strong>not</strong> your <strong>Tracking ID</strong> (UA-XXXXX-X) <strong>nor</strong> your <strong>email address</strong>!", 'google-analytics-dashboard-for-wp' ) . ".</p></div>";
1562
+ } else {
1563
+ $message = "<div class='error' id='gadwp-autodismiss'><p>" . __( "You can only use the access code <strong>once</strong>, please generate a <strong>new access code</strong> using the red link", 'google-analytics-dashboard-for-wp' ) . "!</p></div>";
1564
+ }
1565
  }
1566
  }
1567
  if ( isset( $_POST['Refresh'] ) ) {
1678
  </tr>
1679
  <tr>
1680
  <td colspan="2" class="gadwp-settings-info">
1681
+ <?php printf(__('You need to create a %1$s and watch this %2$s before proceeding to authorization.', 'google-analytics-dashboard-for-wp'), sprintf('<a href="%1$s" target="_blank">%2$s</a>', 'https://deconf.com/creating-a-google-analytics-account/?utm_source=gadwp_config&utm_medium=link&utm_content=top_tutorial&utm_campaign=gadwp', __("free analytics account", 'google-analytics-dashboard-for-wp')), sprintf('<a href="%1$s" target="_blank">%2$s</a>', 'https://deconf.com/google-analytics-dashboard-wordpress/?utm_source=gadwp_config&utm_medium=link&utm_content=top_video&utm_campaign=gadwp', __("video tutorial", 'google-analytics-dashboard-for-wp')));?>
1682
  </td>
1683
  </tr>
1684
  <?php if ( ! $options['token'] || $options['user_api'] ) : ?>
1851
  </div>
1852
  <div class="postbox">
1853
  <h3>
1854
+ <span><?php _e("Stay Updated",'google-analytics-dashboard-for-wp')?></span>
1855
  </h3>
1856
  <div class="inside">
1857
  <div class="gadwp-desc">
1858
+ <div class="g-ytsubscribe" data-channel="TheDeConf" data-layout="default" data-count="default"></div>
 
 
 
 
 
 
 
 
 
1859
  </div>
1860
  <br />
1861
  <div class="gadwp-desc">
1862
+ <div class="g-follow" data-annotation="bubble" data-height="24" data-href="//plus.google.com/u/0/114149166432576972465" data-rel="publisher"></div>
1863
+ <script src="https://apis.google.com/js/platform.js" async defer></script>
1864
  </div>
1865
  <br />
 
 
 
1866
  <div class="gadwp-desc">
1867
+ <a href="https://twitter.com/deconfcom" class="twitter-follow-button" data-show-screen-name="false"></a>
1868
+ <script async src="https://platform.twitter.com/widgets.js" charset="utf-8"></script>
1869
  </div>
1870
  </div>
1871
  </div>
1889
  </div>
1890
  <br />
1891
  <div class="gadwp-title">
1892
+ <a href="http://wordpress.org/support/view/plugin-reviews/google-analytics-dashboard-for-wp#plugin-info"><img src="<?php echo plugins_url( 'images/star.png' , __FILE__ ); ?>" /></a>
1893
  </div>
1894
  <div class="gadwp-desc">
1895
+ <?php printf(__('Your feedback and review are both important, %s!', 'google-analytics-dashboard-for-wp'), sprintf('<a href="http://wordpress.org/support/view/plugin-reviews/google-analytics-dashboard-for-wp#plugin-info">%s</a>', __('rate this plugin', 'google-analytics-dashboard-for-wp')));?>
1896
  </div>
1897
  </div>
1898
  </div>
common/js/reports5.js CHANGED
@@ -1 +1 @@
1
- "use strict";if(gadwpItemData.mapsApiKey){google.charts.load("current",{mapsApiKey:gadwpItemData.mapsApiKey,packages:["corechart","table","orgchart","geochart"]})}else{google.charts.load("current",{packages:["corechart","table","orgchart","geochart"]})}google.charts.setOnLoadCallback(GADWPReportLoad);gadwpItemData.getID=function(a){if(gadwpItemData.scope=="admin-item"){if(typeof a.id=="undefined"){return 0}if(a.id.split("-")[1]=="undefined"){return 0}else{return a.id.split("-")[1]}}else{if(typeof a.id=="undefined"){return 1}if(a.id.split("-")[4]=="undefined"){return 1}else{return a.id.split("-")[4]}}};gadwpItemData.getSelector=function(a){if(a=="admin-item"){return'a[id^="gadwp-"]'}else{return'li[id^="wp-admin-bar-gadwp"] a'}};gadwpItemData.responsiveDialog=function(){var b,a,c;c=jQuery(".ui-dialog:visible");c.each(function(){b=jQuery(this).find(".ui-dialog-content").data("ui-dialog");if(b.options.fluid){a=jQuery(window).width();if(a<(parseInt(b.options.maxWidth)+50)){jQuery(this).css("max-width","90%")}else{jQuery(this).css("max-width",b.options.maxWidth+"px")}b.option("position",b.options.position)}})};jQuery.fn.extend({gadwpItemReport:function(g){var a,d,h,e,f,i,c,b="-"+g;d={setCookie:function(k,m){var j,l=new Date();if(gadwpItemData.scope=="admin-widgets"){k="gadwp_wg_"+k}else{k="gadwp_ir_"+k}l.setTime(l.getTime()+(24*60*60*1000*365));j="expires="+l.toUTCString();document.cookie=k+"="+m+"; "+j+"; path=/"},getCookie:function(j){var l,m,n,k=0;if(gadwpItemData.scope=="admin-widgets"){j="gadwp_wg_"+j+"="}else{j="gadwp_ir_"+j+"="}m=document.cookie.split(";");for(k=0;k<m.length;k++){l=m[k];while(l.charAt(0)==" "){l=l.substring(1)}if(l.indexOf(j)==0){return l.substring(j.length,l.length)}}return false},escape:function(j){div=document.createElement("div");div.appendChild(document.createTextNode(j));return div.innerHTML}};h={addOptions:function(o,n){var j,l,m,k=[];if(!d.getCookie("default_metric")||!d.getCookie("default_dimension")||!d.getCookie("default_swmetric")){j="sessions";l="30daysAgo";if(gadwpItemData.scope=="front-item"||gadwpItemData.scope=="admin-item"){c="pageviews"}else{c="sessions"}d.setCookie("default_metric",j);d.setCookie("default_dimension",l);d.setCookie("default_swmetric",c)}else{j=d.getCookie("default_metric");l=d.getCookie("default_dimension");m=d.getCookie("default_view");c=d.getCookie("default_swmetric")}if(n==false){if(gadwpItemData.scope=="front-item"||gadwpItemData.scope=="admin-item"){k=""}else{k='<span id="gadwp-swmetric-sessions" title="'+gadwpItemData.i18n[5]+'" class="dashicons dashicons-clock" style="font-size:22px;padding:4px;"></span>'}k+='<span id="gadwp-swmetric-users" title="'+gadwpItemData.i18n[6]+'" class="dashicons dashicons-admin-users" style="font-size:22px;padding:4px;"></span>';k+='<span id="gadwp-swmetric-pageviews" title="'+gadwpItemData.i18n[7]+'" class="dashicons dashicons-admin-page" style="font-size:22px;padding:4px;"></span>';jQuery(o).html(k);jQuery("#gadwp-swmetric-"+c).css("color","#008ec2")}else{jQuery.each(n,function(p,q){if(p==j||p==l||p==m){k.push('<option value="'+p+'" selected="selected">'+q+"</option>")}else{k.push('<option value="'+p+'">'+q+"</option>")}});jQuery(o).html(k.join(""))}},init:function(){var j;if(!jQuery("#gadwp-window"+b).length){return}if(jQuery("#gadwp-window"+b).html().length){return}j='<div id="gadwp-container'+b+'">';if(gadwpItemData.viewList!=false){j+='<select id="gadwp-sel-view'+b+'"></select>'}j+='<select id="gadwp-sel-period'+b+'"></select> ';j+='<select id="gadwp-sel-report'+b+'"></select>';j+='<div id="gadwp-sel-metric'+b+'" style="float:right;display:none;">';j+="</div>";j+='<div id="gadwp-progressbar'+b+'"></div>';j+='<div id="gadwp-status'+b+'"></div>';j+='<div id="gadwp-reports'+b+'"></div>';j+='<div style="text-align:right;width:100%;font-size:0.8em;clear:both;margin-right:5px;margin-top:10px;">';j+=gadwpItemData.i18n[14];j+=' <a href="https://deconf.com/google-analytics-dashboard-wordpress/?utm_source=gadwp_report&utm_medium=link&utm_content=back_report&utm_campaign=gadwp" rel="nofollow" style="text-decoration:none;font-size:1em;">GADWP</a>&nbsp;';j+="</div>";j+="</div>",jQuery("#gadwp-window"+b).append(j);h.addOptions("#gadwp-sel-view"+b,gadwpItemData.viewList);h.addOptions("#gadwp-sel-period"+b,gadwpItemData.dateList);h.addOptions("#gadwp-sel-report"+b,gadwpItemData.reportList);h.addOptions("#gadwp-sel-metric"+b,false)}};e={oldViewPort:0,orgChartTableChartData:"",tableChartData:"",orgChartPieChartsData:"",geoChartTableChartData:"",areaChartBottomStatsData:"",realtime:"",rtRuns:null,i18n:null,getTitle:function(j){if(j=="admin-item"){return jQuery("#gadwp"+b).attr("title")}else{return document.getElementsByTagName("title")[0].innerHTML}},alertMessage:function(j){jQuery("#gadwp-status"+b).css({"margin-top":"3px","padding-left":"5px",height:"auto",color:"#000","border-left":"5px solid red"});jQuery("#gadwp-status"+b).html(j)},areaChartBottomStats:function(j){e.areaChartBottomStatsData=j;if(jQuery.isArray(j)){if(!jQuery.isNumeric(j[0])){if(jQuery.isArray(j[0])){jQuery("#gadwp-reports"+b).show();if(a.query=="visitBounceRate,bottomstats"){e.drawAreaChart(j[0],true)}else{e.drawAreaChart(j[0],false)}}else{e.throwDebug(j[0])}}else{jQuery("#gadwp-reports"+b).show();e.throwError("#gadwp-areachart"+b,j[0],"125px")}if(!jQuery.isNumeric(j[1])){if(jQuery.isArray(j[1])){jQuery("#gadwp-reports"+b).show();e.drawBottomStats(j[1])}else{e.throwDebug(j[1])}}else{jQuery("#gadwp-reports"+b).show();e.throwError("#gadwp-bottomstats"+b,j[1],"40px")}}else{e.throwDebug(j)}NProgress.done()},orgChartPieCharts:function(j){var k=0;e.orgChartPieChartsData=j;if(jQuery.isArray(j)){if(!jQuery.isNumeric(j[0])){if(jQuery.isArray(j[0])){jQuery("#gadwp-reports"+b).show();e.drawOrgChart(j[0])}else{e.throwDebug(j[0])}}else{jQuery("#gadwp-reports"+b).show();e.throwError("#gadwp-orgchart"+b,j[0],"125px")}for(k=1;k<j.length;k++){if(!jQuery.isNumeric(j[k])){if(jQuery.isArray(j[k])){jQuery("#gadwp-reports"+b).show();e.drawPieChart("piechart-"+k,j[k],e.i18n[k])}else{e.throwDebug(j[k])}}else{jQuery("#gadwp-reports"+b).show();e.throwError("#gadwp-piechart-"+k+b,j[k],"80px")}}}else{e.throwDebug(j)}NProgress.done()},geoChartTableChart:function(j){e.geoChartTableChartData=j;if(jQuery.isArray(j)){if(!jQuery.isNumeric(j[0])){if(jQuery.isArray(j[0])){jQuery("#gadwp-reports"+b).show();e.drawGeoChart(j[0]);e.drawTableChart(j[0])}else{e.throwDebug(j[0])}}else{jQuery("#gadwp-reports"+b).show();e.throwError("#gadwp-geochart"+b,j[0],"125px");e.throwError("#gadwp-tablechart"+b,j[0],"125px")}}else{e.throwDebug(j)}NProgress.done()},orgChartTableChart:function(j){e.orgChartTableChartData=j;if(jQuery.isArray(j)){if(!jQuery.isNumeric(j[0])){if(jQuery.isArray(j[0])){jQuery("#gadwp-reports"+b).show();e.drawOrgChart(j[0])}else{e.throwDebug(j[0])}}else{jQuery("#gadwp-reports"+b).show();e.throwError("#gadwp-orgchart"+b,j[0],"125px")}if(!jQuery.isNumeric(j[1])){if(jQuery.isArray(j[1])){e.drawTableChart(j[1])}else{e.throwDebug(j[1])}}else{e.throwError("#gadwp-tablechart"+b,j[1],"125px")}}else{e.throwDebug(j)}NProgress.done()},tableChart:function(j){e.tableChartData=j;if(jQuery.isArray(j)){if(!jQuery.isNumeric(j[0])){if(jQuery.isArray(j[0])){jQuery("#gadwp-reports"+b).show();e.drawTableChart(j[0])}else{e.throwDebug(j[0])}}else{jQuery("#gadwp-reports"+b).show();e.throwError("#gadwp-tablechart"+b,j[0],"125px")}}else{e.throwDebug(j)}NProgress.done()},drawTableChart:function(m){var l,j,k;l=google.visualization.arrayToDataTable(m);j={page:"enable",pageSize:10,width:"100%",allowHtml:true};k=new google.visualization.Table(document.getElementById("gadwp-tablechart"+b));k.draw(l,j)},drawOrgChart:function(m){var l,j,k;l=google.visualization.arrayToDataTable(m);j={allowCollapse:true,allowHtml:true,height:"100%"};k=new google.visualization.OrgChart(document.getElementById("gadwp-orgchart"+b));k.draw(l,j)},drawPieChart:function(o,m,n){var l,j,k;l=google.visualization.arrayToDataTable(m);j={is3D:false,tooltipText:"percentage",legend:"none",chartArea:{width:"99%",height:"80%"},title:n,pieSliceText:"value",colors:gadwpItemData.colorVariations};k=new google.visualization.PieChart(document.getElementById("gadwp-"+o+b));k.draw(l,j)},drawGeoChart:function(m){var l,j,k;l=google.visualization.arrayToDataTable(m);j={chartArea:{width:"99%",height:"90%"},colors:[gadwpItemData.colorVariations[5],gadwpItemData.colorVariations[4]]};if(gadwpItemData.region){j.region=gadwpItemData.region;j.displayMode="markers";j.datalessRegionColor="EFEFEF"}k=new google.visualization.GeoChart(document.getElementById("gadwp-geochart"+b));k.draw(l,j)},drawAreaChart:function(n,o){var m,j,l,k;m=google.visualization.arrayToDataTable(n);if(o){k=new google.visualization.NumberFormat({suffix:"%",fractionDigits:2});k.format(m,1)}j={legend:{position:"none"},pointSize:3,colors:[gadwpItemData.colorVariations[0],gadwpItemData.colorVariations[4]],chartArea:{width:"99%",height:"90%"},vAxis:{textPosition:"in",minValue:0},hAxis:{textPosition:"none"}};l=new google.visualization.AreaChart(document.getElementById("gadwp-areachart"+b));l.draw(m,j)},drawBottomStats:function(j){jQuery("#gdsessions"+b).html(j[0]);jQuery("#gdusers"+b).html(j[1]);jQuery("#gdpageviews"+b).html(j[2]);jQuery("#gdbouncerate"+b).html(j[3]);jQuery("#gdorganicsearch"+b).html(j[4]);jQuery("#gdpagespervisit"+b).html(j[5]);jQuery("#gdpagetime"+b).html(j[6]);jQuery("#gdpageload"+b).html(j[7]);jQuery("#gdsessionduration"+b).html(j[8])},rtOnlyUniqueValues:function(l,k,j){return j.indexOf(l)===k},rtCountSessions:function(k,m){var l=0,j=0;for(j=0;j<k.rows.length;j++){if(jQuery.inArray(m,k.rows[j])>-1){l+=parseInt(k.rows[j][6])}}return l},rtGenerateTooltip:function(k){var m=0,l="",j=0;for(j=0;j<k.length;j++){m+=parseInt(k[j].count);l+="<tr><td class='gadwp-pgdetailsl'>"+k[j].value+"</td><td class='gadwp-pgdetailsr'>"+k[j].count+"</td></tr>"}if(m){return("<table>"+l+"</table>")}else{return("")}},rtPageDetails:function(y,n){var w,o,r,x=0,v=0,m=0,s=0,t=0,z=0,C=0,q=0,l=0,u="",A="",p="",k="",B="";y=y.rows;for(x=0;x<y.length;x++){if(y[x][0]==n){o=y[x][5];switch(y[x][3]){case"REFERRAL":t+=parseInt(y[x][6]);u+="<tr><td class='gadwp-pgdetailsl'>"+y[x][1]+"</td><td class='gadwp-pgdetailsr'>"+y[x][6]+"</td></tr>";break;case"ORGANIC":z+=parseInt(y[x][6]);A+="<tr><td class='gadwp-pgdetailsl'>"+y[x][2]+"</td><td class='gadwp-pgdetailsr'>"+y[x][6]+"</td></tr>";break;case"SOCIAL":q+=parseInt(y[x][6]);p+="<tr><td class='gadwp-pgdetailsl'>"+y[x][1]+"</td><td class='gadwp-pgdetailsr'>"+y[x][6]+"</td></tr>";break;case"CUSTOM":l+=parseInt(y[x][6]);k+="<tr><td class='gadwp-pgdetailsl'>"+y[x][1]+"</td><td class='gadwp-pgdetailsr'>"+y[x][6]+"</td></tr>";break;case"DIRECT":C+=parseInt(y[x][6]);break}}}if(t){u="<table><tr><td>"+e.i18n[0]+"("+t+")</td></tr>"+u+"</table><br />"}if(z){A="<table><tr><td>"+e.i18n[1]+"("+z+")</td></tr>"+A+"</table><br />"}if(q){p="<table><tr><td>"+e.i18n[2]+"("+q+")</td></tr>"+p+"</table><br />"}if(l){k="<table><tr><td>"+e.i18n[3]+"("+l+")</td></tr>"+k+"</table><br />"}if(C){B="<table><tr><td>"+e.i18n[4]+"("+C+")</td></tr></table><br />"}return("<p><center><strong>"+o+"</strong></center></p>"+u+A+p+k+B)},rtRefresh:function(){if(e.render.focusFlag){a.from=false;a.to=false;a.query="realtime";jQuery.post(gadwpItemData.ajaxurl,a,function(j){if(jQuery.isArray(j)){jQuery("#gadwp-reports"+b).show();e.realtime=j[0];e.drawRealtime(e.realtime)}else{e.throwDebug(j)}NProgress.done()})}},drawRealtime:function(y){var j,n,o,w,t,r,x=0,v=[],z=[],p=[],m=[],q=[],k=[],l=[],s="",o=[],w=[],t=[],r=[],u=["REFERRAL","ORGANIC","SOCIAL","CUSTOM"],A=["DIRECT","NEW"];jQuery(function(){jQuery("#gadwp-widget *").tooltip({tooltipClass:"gadwp"})});y=y[0];if(jQuery.isNumeric(y)||typeof y==="undefined"){y=[];y.totalsForAllResults=[];y.totalsForAllResults["rt:activeUsers"]="0";y.rows=[]}if(y.totalsForAllResults["rt:activeUsers"]!==document.getElementById("gadwp-online").innerHTML){jQuery("#gadwp-online").fadeOut("slow");jQuery("#gadwp-online").fadeOut(500);jQuery("#gadwp-online").fadeOut("slow",function(){if((parseInt(y.totalsForAllResults["rt:activeUsers"]))<(parseInt(document.getElementById("gadwp-online").innerHTML))){jQuery("#gadwp-online").css({"background-color":"#FFE8E8"})}else{jQuery("#gadwp-online").css({"background-color":"#E0FFEC"})}document.getElementById("gadwp-online").innerHTML=y.totalsForAllResults["rt:activeUsers"]});jQuery("#gadwp-online").fadeIn("slow");jQuery("#gadwp-online").fadeIn(500);jQuery("#gadwp-online").fadeIn("slow",function(){jQuery("#gadwp-online").css({"background-color":"#FFFFFF"})})}if(y.totalsForAllResults["rt:activeUsers"]==0){y.rows=[]}for(x=0;x<y.rows.length;x++){v.push(y.rows[x][0]);if(y.rows[x][3]=="REFERRAL"){z.push(y.rows[x][1])}if(y.rows[x][3]=="ORGANIC"){p.push(y.rows[x][2])}if(y.rows[x][3]=="SOCIAL"){m.push(y.rows[x][1])}if(y.rows[x][3]=="CUSTOM"){k.push(y.rows[x][1])}q.push(y.rows[x][3])}n=v.filter(e.rtOnlyUniqueValues);for(x=0;x<n.length;x++){l[x]={pagepath:n[x],count:e.rtCountSessions(y,n[x])}}l.sort(function(C,B){return B.count-C.count});s="";for(x=0;x<l.length;x++){if(x<gadwpItemData.rtLimitPages){s+='<div class="gadwp-pline"><div class="gadwp-pleft"><a href="#" data-gadwp="'+e.rtPageDetails(y,l[x].pagepath)+'">'+l[x].pagepath.substring(0,70)+'</a></div><div class="gadwp-pright">'+l[x].count+"</div></div>"}}document.getElementById("gadwp-pages").innerHTML='<br /><div class="gadwp-pg">'+s+"</div>";o=z.filter(e.rtOnlyUniqueValues);for(x=0;x<o.length;x++){o[x]={value:o[x],count:e.rtCountSessions(y,o[x])}}o.sort(function(C,B){return B.count-C.count});w=p.filter(e.rtOnlyUniqueValues);for(x=0;x<w.length;x++){w[x]={value:w[x],count:e.rtCountSessions(y,w[x])}}w.sort(function(C,B){return B.count-C.count});t=m.filter(e.rtOnlyUniqueValues);for(x=0;x<t.length;x++){t[x]={value:t[x],count:e.rtCountSessions(y,t[x])}}t.sort(function(C,B){return B.count-C.count});r=k.filter(e.rtOnlyUniqueValues);for(x=0;x<r.length;x++){r[x]={value:r[x],count:e.rtCountSessions(y,r[x])}}r.sort(function(C,B){return B.count-C.count});j='<div class="gadwp-bigtext"><a href="#" data-gadwp="'+e.rtGenerateTooltip(o)+'"><div class="gadwp-bleft">'+e.i18n[0]+'</a></div><div class="gadwp-bright">'+e.rtCountSessions(y,u[0])+"</div></div>";j+='<div class="gadwp-bigtext"><a href="#" data-gadwp="'+e.rtGenerateTooltip(w)+'"><div class="gadwp-bleft">'+e.i18n[1]+'</a></div><div class="gadwp-bright">'+e.rtCountSessions(y,u[1])+"</div></div>";j+='<div class="gadwp-bigtext"><a href="#" data-gadwp="'+e.rtGenerateTooltip(t)+'"><div class="gadwp-bleft">'+e.i18n[2]+'</a></div><div class="gadwp-bright">'+e.rtCountSessions(y,u[2])+"</div></div>";j+='<div class="gadwp-bigtext"><a href="#" data-gadwp="'+e.rtGenerateTooltip(r)+'"><div class="gadwp-bleft">'+e.i18n[3]+'</a></div><div class="gadwp-bright">'+e.rtCountSessions(y,u[3])+"</div></div>";j+='<div class="gadwp-bigtext"><div class="gadwp-bleft">'+e.i18n[4]+'</div><div class="gadwp-bright">'+e.rtCountSessions(y,A[0])+"</div></div>";j+='<div class="gadwp-bigtext"><div class="gadwp-bleft">'+e.i18n[5]+'</div><div class="gadwp-bright">'+e.rtCountSessions(y,A[1])+"</div></div>";document.getElementById("gadwp-tdo-right").innerHTML=j},throwDebug:function(j){jQuery("#gadwp-status"+b).css({"margin-top":"3px","padding-left":"5px",height:"auto",color:"#000","border-left":"5px solid red"});if(j=="-24"){jQuery("#gadwp-status"+b).html(gadwpItemData.i18n[15])}else{jQuery("#gadwp-reports"+b).css({"background-color":"#F7F7F7",height:"auto","margin-top":"10px","padding-top":"50px","padding-bottom":"50px",color:"#000","text-align":"center"});jQuery("#gadwp-reports"+b).html(j);jQuery("#gadwp-reports"+b).show();jQuery("#gadwp-status"+b).html(gadwpItemData.i18n[11]);console.log("\n********************* GADWP Log ********************* \n\n"+j);a={action:"gadwp_set_error",response:j,gadwp_security_set_error:gadwpItemData.security};jQuery.post(gadwpItemData.ajaxurl,a)}},throwError:function(l,j,k){jQuery(l).css({"background-color":"#F7F7F7",height:"auto","padding-top":k,"padding-bottom":k,color:"#000","text-align":"center"});if(j==-21){jQuery(l).html(gadwpItemData.i18n[12])}else{jQuery(l).html(gadwpItemData.i18n[13]+" ("+j+")")}},render:function(j,o,n){var k,q,p,l,m;if(o=="realtime"){jQuery("#gadwp-sel-report"+b).hide()}else{jQuery("#gadwp-sel-report"+b).show();clearInterval(e.rtRuns)}jQuery("#gadwp-status"+b).html("");switch(o){case"today":q="today";p="today";break;case"yesterday":q="yesterday";p="yesterday";break;case"7daysAgo":q="7daysAgo";p="yesterday";break;case"14daysAgo":q="14daysAgo";p="yesterday";break;case"90daysAgo":q="90daysAgo";p="yesterday";break;case"365daysAgo":q="365daysAgo";p="yesterday";break;case"1095daysAgo":q="1095daysAgo";p="yesterday";break;default:q="30daysAgo";p="yesterday";break}d.setCookie("default_metric",n);d.setCookie("default_dimension",o);if(typeof j!=="undefined"){d.setCookie("default_view",j);k=j}else{k=false}if(gadwpItemData.scope=="admin-item"){a={action:"gadwp_backend_item_reports",gadwp_security_backend_item_reports:gadwpItemData.security,from:q,to:p,filter:g}}else{if(gadwpItemData.scope=="front-item"){a={action:"gadwp_frontend_item_reports",gadwp_security_frontend_item_reports:gadwpItemData.security,from:q,to:p,filter:gadwpItemData.filter}}else{a={action:"gadwp_backend_item_reports",gadwp_security_backend_item_reports:gadwpItemData.security,projectId:k,from:q,to:p}}}if(o=="realtime"){e.i18n=gadwpItemData.i18n.slice(20,26);e.render.focusFlag=1;jQuery(window).bind("focus",function(r){e.render.focusFlag=1}).bind("blur",function(r){e.render.focusFlag=0});l='<div id="gadwp-realtime'+b+'">';l+='<div class="gadwp-rt-box">';l+='<div class="gadwp-tdo-left">';l+='<div class="gadwp-online" id="gadwp-online">0</div>';l+="</div>";l+='<div class="gadwp-tdo-right" id="gadwp-tdo-right">';l+='<div class="gadwp-bigtext">';l+='<div class="gadwp-bleft">'+e.i18n[0]+"</div>";l+='<div class="gadwp-bright">0</div>';l+="</div>";l+='<div class="gadwp-bigtext">';l+='<div class="gadwp-bleft">'+e.i18n[1]+"</div>";l+='<div class="gadwp-bright">0</div>';l+="</div>";l+='<div class="gadwp-bigtext">';l+='<div class="gadwp-bleft">'+e.i18n[2]+"</div>";l+='<div class="gadwp-bright">0</div>';l+="</div>";l+='<div class="gadwp-bigtext">';l+='<div class="gadwp-bleft">'+e.i18n[3]+"</div>";l+='<div class="gadwp-bright">0</div>';l+="</div>";l+='<div class="gadwp-bigtext">';l+='<div class="gadwp-bleft">'+e.i18n[4]+"</div>";l+='<div class="gadwp-bright">0</div>';l+="</div>";l+='<div class="gadwp-bigtext">';l+='<div class="gadwp-bleft">'+e.i18n[5]+"</div>";l+='<div class="gadwp-bright">0</div>';l+="</div>";l+="</div>";l+="</div>";l+="<div>";l+='<div id="gadwp-pages" class="gadwp-pages">&nbsp;</div>';l+="</div>";l+="</div>";jQuery("#gadwp-reports"+b).html(l);e.rtRefresh(e.render.focusFlag);e.rtRuns=setInterval(e.rtRefresh,55000)}else{if(jQuery.inArray(n,["referrers","contentpages","searches"])>-1){l='<div id="gadwp-orgcharttablechart'+b+'">';l+='<div id="gadwp-orgchart'+b+'"></div>';l+='<div id="gadwp-tablechart'+b+'"></div>';l+="</div>";jQuery("#gadwp-reports"+b).html(l);jQuery("#gadwp-reports"+b).hide();jQuery("#gadwp-sel-metric"+b).show();a.query="channelGrouping,"+n;a.metric=c;jQuery.post(gadwpItemData.ajaxurl,a,function(r){e.orgChartTableChart(r)})}else{if(n=="404errors"){l='<div id="gadwp-404tablechart'+b+'">';l+='<div id="gadwp-tablechart'+b+'"></div>';l+="</div>";jQuery("#gadwp-reports"+b).html(l);jQuery("#gadwp-reports"+b).hide();jQuery("#gadwp-sel-metric"+b).show();a.query=n;a.metric=c;jQuery.post(gadwpItemData.ajaxurl,a,function(r){e.tableChart(r)})}else{if(n=="trafficdetails"||n=="technologydetails"){l='<div id="gadwp-orgchartpiecharts'+b+'">';l+='<div id="gadwp-orgchart'+b+'"></div>';l+='<div class="gadwp-floatwraper">';l+='<div id="gadwp-piechart-1'+b+'" class="halfsize floatleft"></div>';l+='<div id="gadwp-piechart-2'+b+'" class="halfsize floatright"></div>';l+="</div>";l+='<div class="gadwp-floatwraper">';l+='<div id="gadwp-piechart-3'+b+'" class="halfsize floatleft"></div>';l+='<div id="gadwp-piechart-4'+b+'" class="halfsize floatright"></div>';l+="</div>";l+="</div>";jQuery("#gadwp-reports"+b).html(l);jQuery("#gadwp-reports"+b).hide();jQuery("#gadwp-sel-metric"+b).show();if(n=="trafficdetails"){a.query="channelGrouping,medium,visitorType,source,socialNetwork";e.i18n=gadwpItemData.i18n.slice(0,5)}else{e.i18n=gadwpItemData.i18n.slice(15,20);a.query="deviceCategory,browser,operatingSystem,screenResolution,mobileDeviceBranding"}a.metric=c;jQuery.post(gadwpItemData.ajaxurl,a,function(r){e.orgChartPieCharts(r)})}else{if(n=="locations"){l='<div id="gadwp-geocharttablechart'+b+'">';l+='<div id="gadwp-geochart'+b+'"></div>';l+='<div id="gadwp-tablechart'+b+'"></div>';l+="</div>";jQuery("#gadwp-reports"+b).html(l);jQuery("#gadwp-reports"+b).hide();jQuery("#gadwp-sel-metric"+b).show();a.query=n;a.metric=c;jQuery.post(gadwpItemData.ajaxurl,a,function(r){e.geoChartTableChart(r)})}else{l='<div id="gadwp-areachartbottomstats'+b+'">';l+='<div id="gadwp-areachart'+b+'"></div>';l+='<div id="gadwp-bottomstats'+b+'">';l+='<div class="inside">';l+='<div class="small-box"><h3>'+gadwpItemData.i18n[5]+'</h3><p id="gdsessions'+b+'">&nbsp;</p></div>';l+='<div class="small-box"><h3>'+gadwpItemData.i18n[6]+'</h3><p id="gdusers'+b+'">&nbsp;</p></div>';l+='<div class="small-box"><h3>'+gadwpItemData.i18n[7]+'</h3><p id="gdpageviews'+b+'">&nbsp;</p></div>';l+='<div class="small-box"><h3>'+gadwpItemData.i18n[8]+'</h3><p id="gdbouncerate'+b+'">&nbsp;</p></div>';l+='<div class="small-box"><h3>'+gadwpItemData.i18n[9]+'</h3><p id="gdorganicsearch'+b+'">&nbsp;</p></div>';l+='<div class="small-box"><h3>'+gadwpItemData.i18n[10]+'</h3><p id="gdpagespervisit'+b+'">&nbsp;</p></div>';l+='<div class="small-box"><h3>'+gadwpItemData.i18n[26]+'</h3><p id="gdpagetime'+b+'">&nbsp;</p></div>';l+='<div class="small-box"><h3>'+gadwpItemData.i18n[27]+'</h3><p id="gdpageload'+b+'">&nbsp;</p></div>';l+='<div class="small-box"><h3>'+gadwpItemData.i18n[28]+'</h3><p id="gdsessionduration'+b+'">&nbsp;</p></div>';l+="</div>";l+="</div>";l+="</div>";jQuery("#gadwp-reports"+b).html(l);jQuery("#gadwp-reports"+b).hide();a.query=n+",bottomstats";jQuery.post(gadwpItemData.ajaxurl,a,function(r){e.areaChartBottomStats(r)})}}}}}},refresh:function(){if(jQuery("#gadwp-areachartbottomstats"+b).length>0&&jQuery.isArray(e.areaChartBottomStatsData)){e.areaChartBottomStats(e.areaChartBottomStatsData)}if(jQuery("#gadwp-orgchartpiecharts"+b).length>0&&jQuery.isArray(e.orgChartPieChartsData)){e.orgChartPieCharts(e.orgChartPieChartsData)}if(jQuery("#gadwp-geocharttablechart"+b).length>0&&jQuery.isArray(e.geoChartTableChartData)){e.geoChartTableChart(e.geoChartTableChartData)}if(jQuery("#gadwp-orgcharttablechart"+b).length>0&&jQuery.isArray(e.orgChartTableChartData)){e.orgChartTableChart(e.orgChartTableChartData)}if(jQuery("#gadwp-404tablechart"+b).length>0&&jQuery.isArray(e.tableChartData)){e.tableChart(e.tableChartData)}},init:function(){if(!jQuery("#gadwp-reports"+b).length){return}if(jQuery("#gadwp-reports"+b).html().length){return}try{NProgress.configure({parent:"#gadwp-progressbar"+b,showSpinner:false});NProgress.start()}catch(j){e.alertMessage(gadwpItemData.i18n[0])}e.render(jQuery("#gadwp-sel-view"+b).val(),jQuery("#gadwp-sel-period"+b).val(),jQuery("#gadwp-sel-report"+b).val());jQuery(window).resize(function(){var k=jQuery(window).width()-e.oldViewPort;if((k<-5)||(k>5)){e.oldViewPort=jQuery(window).width();e.refresh()}})}};h.init();e.init();jQuery("#gadwp-sel-view"+b).change(function(){jQuery("#gadwp-reports"+b).html("");e.init()});jQuery("#gadwp-sel-period"+b).change(function(){jQuery("#gadwp-sel-metric"+b).hide();jQuery("#gadwp-reports"+b).html("");e.init()});jQuery("#gadwp-sel-report"+b).change(function(){jQuery("#gadwp-sel-metric"+b).hide();jQuery("#gadwp-reports"+b).html("");e.init()});jQuery("[id^=gadwp-swmetric-]").click(function(){c=this.id.replace("gadwp-swmetric-","");d.setCookie("default_swmetric",c);jQuery("#gadwp-swmetric-sessions").css("color","#444");jQuery("#gadwp-swmetric-users").css("color","#444");jQuery("#gadwp-swmetric-pageviews").css("color","#444");jQuery("#"+this.id).css("color","#008ec2");jQuery("#gadwp-reports"+b).html("");e.init()});if(gadwpItemData.scope=="admin-widgets"){return}else{return this.dialog({width:"auto",maxWidth:510,height:"auto",modal:true,fluid:true,dialogClass:"gadwp wp-dialog",resizable:false,title:e.getTitle(gadwpItemData.scope),position:{my:"top",at:"top+100",of:window}})}}});function GADWPReportLoad(){if(gadwpItemData.scope=="admin-widgets"){jQuery("#gadwp-window-1").gadwpItemReport(1)}else{console.log("Test");jQuery(gadwpItemData.getSelector(gadwpItemData.scope)).click(function(){if(!jQuery("#gadwp-window-"+gadwpItemData.getID(this)).length>0){jQuery("body").append('<div id="gadwp-window-'+gadwpItemData.getID(this)+'"></div>')}jQuery("#gadwp-window-"+gadwpItemData.getID(this)).gadwpItemReport(gadwpItemData.getID(this))})}jQuery(window).resize(function(){gadwpItemData.responsiveDialog()});jQuery(document).on("dialogopen",".ui-dialog",function(a,b){gadwpItemData.responsiveDialog()})};
1
+ "use strict";if(gadwpItemData.mapsApiKey){google.charts.load("current",{mapsApiKey:gadwpItemData.mapsApiKey,packages:["corechart","table","orgchart","geochart"]})}else{google.charts.load("current",{packages:["corechart","table","orgchart","geochart"]})}google.charts.setOnLoadCallback(GADWPReportLoad);gadwpItemData.getID=function(a){if(gadwpItemData.scope=="admin-item"){if(typeof a.id=="undefined"){return 0}if(a.id.split("-")[1]=="undefined"){return 0}else{return a.id.split("-")[1]}}else{if(typeof a.id=="undefined"){return 1}if(a.id.split("-")[4]=="undefined"){return 1}else{return a.id.split("-")[4]}}};gadwpItemData.getSelector=function(a){if(a=="admin-item"){return'a[id^="gadwp-"]'}else{return'li[id^="wp-admin-bar-gadwp"] a'}};gadwpItemData.responsiveDialog=function(){var b,a,c;c=jQuery(".ui-dialog:visible");c.each(function(){b=jQuery(this).find(".ui-dialog-content").data("ui-dialog");if(b.options.fluid){a=jQuery(window).width();if(a<(parseInt(b.options.maxWidth)+50)){jQuery(this).css("max-width","90%")}else{jQuery(this).css("max-width",b.options.maxWidth+"px")}b.option("position",b.options.position)}})};jQuery.fn.extend({gadwpItemReport:function(g){var a,d,h,e,f,i,c,b="-"+g;d={setCookie:function(k,m){var j,l=new Date();if(gadwpItemData.scope=="admin-widgets"){k="gadwp_wg_"+k}else{k="gadwp_ir_"+k}l.setTime(l.getTime()+(24*60*60*1000*365));j="expires="+l.toUTCString();document.cookie=k+"="+m+"; "+j+"; path=/"},getCookie:function(j){var l,m,n,k=0;if(gadwpItemData.scope=="admin-widgets"){j="gadwp_wg_"+j+"="}else{j="gadwp_ir_"+j+"="}m=document.cookie.split(";");for(k=0;k<m.length;k++){l=m[k];while(l.charAt(0)==" "){l=l.substring(1)}if(l.indexOf(j)==0){return l.substring(j.length,l.length)}}return false},escape:function(j){div=document.createElement("div");div.appendChild(document.createTextNode(j));return div.innerHTML}};h={addOptions:function(o,n){var j,l,m,k=[];if(!d.getCookie("default_metric")||!d.getCookie("default_dimension")||!d.getCookie("default_swmetric")){j="sessions";l="30daysAgo";if(gadwpItemData.scope=="front-item"||gadwpItemData.scope=="admin-item"){c="pageviews"}else{c="sessions"}d.setCookie("default_metric",j);d.setCookie("default_dimension",l);d.setCookie("default_swmetric",c)}else{j=d.getCookie("default_metric");l=d.getCookie("default_dimension");m=d.getCookie("default_view");c=d.getCookie("default_swmetric")}if(n==false){if(gadwpItemData.scope=="front-item"||gadwpItemData.scope=="admin-item"){k=""}else{k='<span id="gadwp-swmetric-sessions" title="'+gadwpItemData.i18n[5]+'" class="dashicons dashicons-clock" style="font-size:22px;padding:4px;"></span>'}k+='<span id="gadwp-swmetric-users" title="'+gadwpItemData.i18n[6]+'" class="dashicons dashicons-admin-users" style="font-size:22px;padding:4px;"></span>';k+='<span id="gadwp-swmetric-pageviews" title="'+gadwpItemData.i18n[7]+'" class="dashicons dashicons-admin-page" style="font-size:22px;padding:4px;"></span>';jQuery(o).html(k);jQuery("#gadwp-swmetric-"+c).css("color","#008ec2")}else{jQuery.each(n,function(p,q){if(p==j||p==l||p==m){k.push('<option value="'+p+'" selected="selected">'+q+"</option>")}else{k.push('<option value="'+p+'">'+q+"</option>")}});jQuery(o).html(k.join(""))}},init:function(){var j;if(!jQuery("#gadwp-window"+b).length){return}if(jQuery("#gadwp-window"+b).html().length){return}j='<div id="gadwp-container'+b+'">';if(gadwpItemData.viewList!=false){j+='<select id="gadwp-sel-view'+b+'"></select>'}j+='<select id="gadwp-sel-period'+b+'"></select> ';j+='<select id="gadwp-sel-report'+b+'"></select>';j+='<div id="gadwp-sel-metric'+b+'" style="float:right;display:none;">';j+="</div>";j+='<div id="gadwp-progressbar'+b+'"></div>';j+='<div id="gadwp-status'+b+'"></div>';j+='<div id="gadwp-reports'+b+'"></div>';j+='<div style="text-align:right;width:100%;font-size:0.8em;clear:both;margin-right:5px;margin-top:10px;">';j+=gadwpItemData.i18n[14];j+=' <a href="https://deconf.com/google-analytics-dashboard-wordpress/?utm_source=gadwp_report&utm_medium=link&utm_content=back_report&utm_campaign=gadwp" rel="nofollow" style="text-decoration:none;font-size:1em;">GADWP</a>&nbsp;';j+="</div>";j+="</div>",jQuery("#gadwp-window"+b).append(j);h.addOptions("#gadwp-sel-view"+b,gadwpItemData.viewList);h.addOptions("#gadwp-sel-period"+b,gadwpItemData.dateList);h.addOptions("#gadwp-sel-report"+b,gadwpItemData.reportList);h.addOptions("#gadwp-sel-metric"+b,false)}};e={oldViewPort:0,orgChartTableChartData:"",tableChartData:"",orgChartPieChartsData:"",geoChartTableChartData:"",areaChartBottomStatsData:"",realtime:"",rtRuns:null,i18n:null,getTitle:function(j){if(j=="admin-item"){return jQuery("#gadwp"+b).attr("title")}else{return document.getElementsByTagName("title")[0].innerHTML}},alertMessage:function(j){jQuery("#gadwp-status"+b).css({"margin-top":"3px","padding-left":"5px",height:"auto",color:"#000","border-left":"5px solid red"});jQuery("#gadwp-status"+b).html(j)},areaChartBottomStats:function(j){e.areaChartBottomStatsData=j;if(jQuery.isArray(j)){if(!jQuery.isNumeric(j[0])){if(jQuery.isArray(j[0])){jQuery("#gadwp-reports"+b).show();if(a.query=="visitBounceRate,bottomstats"){e.drawAreaChart(j[0],true)}else{e.drawAreaChart(j[0],false)}}else{e.throwDebug(j[0])}}else{jQuery("#gadwp-reports"+b).show();e.throwError("#gadwp-areachart"+b,j[0],"125px")}if(!jQuery.isNumeric(j[1])){if(jQuery.isArray(j[1])){jQuery("#gadwp-reports"+b).show();e.drawBottomStats(j[1])}else{e.throwDebug(j[1])}}else{jQuery("#gadwp-reports"+b).show();e.throwError("#gadwp-bottomstats"+b,j[1],"40px")}}else{e.throwDebug(j)}NProgress.done()},orgChartPieCharts:function(j){var k=0;e.orgChartPieChartsData=j;if(jQuery.isArray(j)){if(!jQuery.isNumeric(j[0])){if(jQuery.isArray(j[0])){jQuery("#gadwp-reports"+b).show();e.drawOrgChart(j[0])}else{e.throwDebug(j[0])}}else{jQuery("#gadwp-reports"+b).show();e.throwError("#gadwp-orgchart"+b,j[0],"125px")}for(k=1;k<j.length;k++){if(!jQuery.isNumeric(j[k])){if(jQuery.isArray(j[k])){jQuery("#gadwp-reports"+b).show();e.drawPieChart("piechart-"+k,j[k],e.i18n[k])}else{e.throwDebug(j[k])}}else{jQuery("#gadwp-reports"+b).show();e.throwError("#gadwp-piechart-"+k+b,j[k],"80px")}}}else{e.throwDebug(j)}NProgress.done()},geoChartTableChart:function(j){e.geoChartTableChartData=j;if(jQuery.isArray(j)){if(!jQuery.isNumeric(j[0])){if(jQuery.isArray(j[0])){jQuery("#gadwp-reports"+b).show();e.drawGeoChart(j[0]);e.drawTableChart(j[0])}else{e.throwDebug(j[0])}}else{jQuery("#gadwp-reports"+b).show();e.throwError("#gadwp-geochart"+b,j[0],"125px");e.throwError("#gadwp-tablechart"+b,j[0],"125px")}}else{e.throwDebug(j)}NProgress.done()},orgChartTableChart:function(j){e.orgChartTableChartData=j;if(jQuery.isArray(j)){if(!jQuery.isNumeric(j[0])){if(jQuery.isArray(j[0])){jQuery("#gadwp-reports"+b).show();e.drawOrgChart(j[0])}else{e.throwDebug(j[0])}}else{jQuery("#gadwp-reports"+b).show();e.throwError("#gadwp-orgchart"+b,j[0],"125px")}if(!jQuery.isNumeric(j[1])){if(jQuery.isArray(j[1])){e.drawTableChart(j[1])}else{e.throwDebug(j[1])}}else{e.throwError("#gadwp-tablechart"+b,j[1],"125px")}}else{e.throwDebug(j)}NProgress.done()},tableChart:function(j){e.tableChartData=j;if(jQuery.isArray(j)){if(!jQuery.isNumeric(j[0])){if(jQuery.isArray(j[0])){jQuery("#gadwp-reports"+b).show();e.drawTableChart(j[0])}else{e.throwDebug(j[0])}}else{jQuery("#gadwp-reports"+b).show();e.throwError("#gadwp-tablechart"+b,j[0],"125px")}}else{e.throwDebug(j)}NProgress.done()},drawTableChart:function(m){var l,j,k;l=google.visualization.arrayToDataTable(m);j={page:"enable",pageSize:10,width:"100%",allowHtml:true};k=new google.visualization.Table(document.getElementById("gadwp-tablechart"+b));k.draw(l,j)},drawOrgChart:function(m){var l,j,k;l=google.visualization.arrayToDataTable(m);j={allowCollapse:true,allowHtml:true,height:"100%"};k=new google.visualization.OrgChart(document.getElementById("gadwp-orgchart"+b));k.draw(l,j)},drawPieChart:function(o,m,n){var l,j,k;l=google.visualization.arrayToDataTable(m);j={is3D:false,tooltipText:"percentage",legend:"none",chartArea:{width:"99%",height:"80%"},title:n,pieSliceText:"value",colors:gadwpItemData.colorVariations};k=new google.visualization.PieChart(document.getElementById("gadwp-"+o+b));k.draw(l,j)},drawGeoChart:function(m){var l,j,k;l=google.visualization.arrayToDataTable(m);j={chartArea:{width:"99%",height:"90%"},colors:[gadwpItemData.colorVariations[5],gadwpItemData.colorVariations[4]]};if(gadwpItemData.region){j.region=gadwpItemData.region;j.displayMode="markers";j.datalessRegionColor="EFEFEF"}k=new google.visualization.GeoChart(document.getElementById("gadwp-geochart"+b));k.draw(l,j)},drawAreaChart:function(n,o){var m,j,l,k;m=google.visualization.arrayToDataTable(n);if(o){k=new google.visualization.NumberFormat({suffix:"%",fractionDigits:2});k.format(m,1)}j={legend:{position:"none"},pointSize:3,colors:[gadwpItemData.colorVariations[0],gadwpItemData.colorVariations[4]],chartArea:{width:"99%",height:"90%"},vAxis:{textPosition:"in",minValue:0},hAxis:{textPosition:"none"}};l=new google.visualization.AreaChart(document.getElementById("gadwp-areachart"+b));l.draw(m,j)},drawBottomStats:function(j){jQuery("#gdsessions"+b).html(j[0]);jQuery("#gdusers"+b).html(j[1]);jQuery("#gdpageviews"+b).html(j[2]);jQuery("#gdbouncerate"+b).html(j[3]);jQuery("#gdorganicsearch"+b).html(j[4]);jQuery("#gdpagespervisit"+b).html(j[5]);jQuery("#gdpagetime"+b).html(j[6]);jQuery("#gdpageload"+b).html(j[7]);jQuery("#gdsessionduration"+b).html(j[8])},rtOnlyUniqueValues:function(l,k,j){return j.indexOf(l)===k},rtCountSessions:function(k,m){var l=0,j=0;for(j=0;j<k.rows.length;j++){if(jQuery.inArray(m,k.rows[j])>-1){l+=parseInt(k.rows[j][6])}}return l},rtGenerateTooltip:function(k){var m=0,l="",j=0;for(j=0;j<k.length;j++){m+=parseInt(k[j].count);l+="<tr><td class='gadwp-pgdetailsl'>"+k[j].value+"</td><td class='gadwp-pgdetailsr'>"+k[j].count+"</td></tr>"}if(m){return("<table>"+l+"</table>")}else{return("")}},rtPageDetails:function(y,n){var w,o,r,x=0,v=0,m=0,s=0,t=0,z=0,C=0,q=0,l=0,u="",A="",p="",k="",B="";y=y.rows;for(x=0;x<y.length;x++){if(y[x][0]==n){o=y[x][5];switch(y[x][3]){case"REFERRAL":t+=parseInt(y[x][6]);u+="<tr><td class='gadwp-pgdetailsl'>"+y[x][1]+"</td><td class='gadwp-pgdetailsr'>"+y[x][6]+"</td></tr>";break;case"ORGANIC":z+=parseInt(y[x][6]);A+="<tr><td class='gadwp-pgdetailsl'>"+y[x][2]+"</td><td class='gadwp-pgdetailsr'>"+y[x][6]+"</td></tr>";break;case"SOCIAL":q+=parseInt(y[x][6]);p+="<tr><td class='gadwp-pgdetailsl'>"+y[x][1]+"</td><td class='gadwp-pgdetailsr'>"+y[x][6]+"</td></tr>";break;case"CUSTOM":l+=parseInt(y[x][6]);k+="<tr><td class='gadwp-pgdetailsl'>"+y[x][1]+"</td><td class='gadwp-pgdetailsr'>"+y[x][6]+"</td></tr>";break;case"DIRECT":C+=parseInt(y[x][6]);break}}}if(t){u="<table><tr><td>"+e.i18n[0]+"("+t+")</td></tr>"+u+"</table><br />"}if(z){A="<table><tr><td>"+e.i18n[1]+"("+z+")</td></tr>"+A+"</table><br />"}if(q){p="<table><tr><td>"+e.i18n[2]+"("+q+")</td></tr>"+p+"</table><br />"}if(l){k="<table><tr><td>"+e.i18n[3]+"("+l+")</td></tr>"+k+"</table><br />"}if(C){B="<table><tr><td>"+e.i18n[4]+"("+C+")</td></tr></table><br />"}return("<p><center><strong>"+o+"</strong></center></p>"+u+A+p+k+B)},rtRefresh:function(){if(e.render.focusFlag){a.from=false;a.to=false;a.query="realtime";jQuery.post(gadwpItemData.ajaxurl,a,function(j){if(jQuery.isArray(j)){jQuery("#gadwp-reports"+b).show();e.realtime=j[0];e.drawRealtime(e.realtime)}else{e.throwDebug(j)}NProgress.done()})}},drawRealtime:function(y){var j,n,o,w,t,r,x=0,v=[],z=[],p=[],m=[],q=[],k=[],l=[],s="",o=[],w=[],t=[],r=[],u=["REFERRAL","ORGANIC","SOCIAL","CUSTOM"],A=["DIRECT","NEW"];jQuery(function(){jQuery("#gadwp-widget *").tooltip({tooltipClass:"gadwp"})});y=y[0];if(jQuery.isNumeric(y)||typeof y==="undefined"){y=[];y.totalsForAllResults=[];y.totalsForAllResults["rt:activeUsers"]="0";y.rows=[]}if(y.totalsForAllResults["rt:activeUsers"]!==document.getElementById("gadwp-online").innerHTML){jQuery("#gadwp-online").fadeOut("slow");jQuery("#gadwp-online").fadeOut(500);jQuery("#gadwp-online").fadeOut("slow",function(){if((parseInt(y.totalsForAllResults["rt:activeUsers"]))<(parseInt(document.getElementById("gadwp-online").innerHTML))){jQuery("#gadwp-online").css({"background-color":"#FFE8E8"})}else{jQuery("#gadwp-online").css({"background-color":"#E0FFEC"})}document.getElementById("gadwp-online").innerHTML=y.totalsForAllResults["rt:activeUsers"]});jQuery("#gadwp-online").fadeIn("slow");jQuery("#gadwp-online").fadeIn(500);jQuery("#gadwp-online").fadeIn("slow",function(){jQuery("#gadwp-online").css({"background-color":"#FFFFFF"})})}if(y.totalsForAllResults["rt:activeUsers"]==0){y.rows=[]}for(x=0;x<y.rows.length;x++){v.push(y.rows[x][0]);if(y.rows[x][3]=="REFERRAL"){z.push(y.rows[x][1])}if(y.rows[x][3]=="ORGANIC"){p.push(y.rows[x][2])}if(y.rows[x][3]=="SOCIAL"){m.push(y.rows[x][1])}if(y.rows[x][3]=="CUSTOM"){k.push(y.rows[x][1])}q.push(y.rows[x][3])}n=v.filter(e.rtOnlyUniqueValues);for(x=0;x<n.length;x++){l[x]={pagepath:n[x],count:e.rtCountSessions(y,n[x])}}l.sort(function(C,B){return B.count-C.count});s="";for(x=0;x<l.length;x++){if(x<gadwpItemData.rtLimitPages){s+='<div class="gadwp-pline"><div class="gadwp-pleft"><a href="#" data-gadwp="'+e.rtPageDetails(y,l[x].pagepath)+'">'+l[x].pagepath.substring(0,70)+'</a></div><div class="gadwp-pright">'+l[x].count+"</div></div>"}}document.getElementById("gadwp-pages").innerHTML='<br /><div class="gadwp-pg">'+s+"</div>";o=z.filter(e.rtOnlyUniqueValues);for(x=0;x<o.length;x++){o[x]={value:o[x],count:e.rtCountSessions(y,o[x])}}o.sort(function(C,B){return B.count-C.count});w=p.filter(e.rtOnlyUniqueValues);for(x=0;x<w.length;x++){w[x]={value:w[x],count:e.rtCountSessions(y,w[x])}}w.sort(function(C,B){return B.count-C.count});t=m.filter(e.rtOnlyUniqueValues);for(x=0;x<t.length;x++){t[x]={value:t[x],count:e.rtCountSessions(y,t[x])}}t.sort(function(C,B){return B.count-C.count});r=k.filter(e.rtOnlyUniqueValues);for(x=0;x<r.length;x++){r[x]={value:r[x],count:e.rtCountSessions(y,r[x])}}r.sort(function(C,B){return B.count-C.count});j='<div class="gadwp-bigtext"><a href="#" data-gadwp="'+e.rtGenerateTooltip(o)+'"><div class="gadwp-bleft">'+e.i18n[0]+'</a></div><div class="gadwp-bright">'+e.rtCountSessions(y,u[0])+"</div></div>";j+='<div class="gadwp-bigtext"><a href="#" data-gadwp="'+e.rtGenerateTooltip(w)+'"><div class="gadwp-bleft">'+e.i18n[1]+'</a></div><div class="gadwp-bright">'+e.rtCountSessions(y,u[1])+"</div></div>";j+='<div class="gadwp-bigtext"><a href="#" data-gadwp="'+e.rtGenerateTooltip(t)+'"><div class="gadwp-bleft">'+e.i18n[2]+'</a></div><div class="gadwp-bright">'+e.rtCountSessions(y,u[2])+"</div></div>";j+='<div class="gadwp-bigtext"><a href="#" data-gadwp="'+e.rtGenerateTooltip(r)+'"><div class="gadwp-bleft">'+e.i18n[3]+'</a></div><div class="gadwp-bright">'+e.rtCountSessions(y,u[3])+"</div></div>";j+='<div class="gadwp-bigtext"><div class="gadwp-bleft">'+e.i18n[4]+'</div><div class="gadwp-bright">'+e.rtCountSessions(y,A[0])+"</div></div>";j+='<div class="gadwp-bigtext"><div class="gadwp-bleft">'+e.i18n[5]+'</div><div class="gadwp-bright">'+e.rtCountSessions(y,A[1])+"</div></div>";document.getElementById("gadwp-tdo-right").innerHTML=j},throwDebug:function(j){jQuery("#gadwp-status"+b).css({"margin-top":"3px","padding-left":"5px",height:"auto",color:"#000","border-left":"5px solid red"});if(j=="-24"){jQuery("#gadwp-status"+b).html(gadwpItemData.i18n[15])}else{jQuery("#gadwp-reports"+b).css({"background-color":"#F7F7F7",height:"auto","margin-top":"10px","padding-top":"50px","padding-bottom":"50px",color:"#000","text-align":"center"});jQuery("#gadwp-reports"+b).html(j);jQuery("#gadwp-reports"+b).show();jQuery("#gadwp-status"+b).html(gadwpItemData.i18n[11]);console.log("\n********************* GADWP Log ********************* \n\n"+j);a={action:"gadwp_set_error",response:j,gadwp_security_set_error:gadwpItemData.security};jQuery.post(gadwpItemData.ajaxurl,a)}},throwError:function(l,j,k){jQuery(l).css({"background-color":"#F7F7F7",height:"auto","padding-top":k,"padding-bottom":k,color:"#000","text-align":"center"});if(j==-21){jQuery(l).html(gadwpItemData.i18n[12])}else{jQuery(l).html(gadwpItemData.i18n[13]+" ("+j+")")}},render:function(j,o,n){var k,q,p,l,m;if(o=="realtime"){jQuery("#gadwp-sel-report"+b).hide()}else{jQuery("#gadwp-sel-report"+b).show();clearInterval(e.rtRuns)}jQuery("#gadwp-status"+b).html("");switch(o){case"today":q="today";p="today";break;case"yesterday":q="yesterday";p="yesterday";break;case"7daysAgo":q="7daysAgo";p="yesterday";break;case"14daysAgo":q="14daysAgo";p="yesterday";break;case"90daysAgo":q="90daysAgo";p="yesterday";break;case"365daysAgo":q="365daysAgo";p="yesterday";break;case"1095daysAgo":q="1095daysAgo";p="yesterday";break;default:q="30daysAgo";p="yesterday";break}d.setCookie("default_metric",n);d.setCookie("default_dimension",o);if(typeof j!=="undefined"){d.setCookie("default_view",j);k=j}else{k=false}if(gadwpItemData.scope=="admin-item"){a={action:"gadwp_backend_item_reports",gadwp_security_backend_item_reports:gadwpItemData.security,from:q,to:p,filter:g}}else{if(gadwpItemData.scope=="front-item"){a={action:"gadwp_frontend_item_reports",gadwp_security_frontend_item_reports:gadwpItemData.security,from:q,to:p,filter:gadwpItemData.filter}}else{a={action:"gadwp_backend_item_reports",gadwp_security_backend_item_reports:gadwpItemData.security,projectId:k,from:q,to:p}}}if(o=="realtime"){e.i18n=gadwpItemData.i18n.slice(20,26);e.render.focusFlag=1;jQuery(window).bind("focus",function(r){e.render.focusFlag=1}).bind("blur",function(r){e.render.focusFlag=0});l='<div id="gadwp-realtime'+b+'">';l+='<div class="gadwp-rt-box">';l+='<div class="gadwp-tdo-left">';l+='<div class="gadwp-online" id="gadwp-online">0</div>';l+="</div>";l+='<div class="gadwp-tdo-right" id="gadwp-tdo-right">';l+='<div class="gadwp-bigtext">';l+='<div class="gadwp-bleft">'+e.i18n[0]+"</div>";l+='<div class="gadwp-bright">0</div>';l+="</div>";l+='<div class="gadwp-bigtext">';l+='<div class="gadwp-bleft">'+e.i18n[1]+"</div>";l+='<div class="gadwp-bright">0</div>';l+="</div>";l+='<div class="gadwp-bigtext">';l+='<div class="gadwp-bleft">'+e.i18n[2]+"</div>";l+='<div class="gadwp-bright">0</div>';l+="</div>";l+='<div class="gadwp-bigtext">';l+='<div class="gadwp-bleft">'+e.i18n[3]+"</div>";l+='<div class="gadwp-bright">0</div>';l+="</div>";l+='<div class="gadwp-bigtext">';l+='<div class="gadwp-bleft">'+e.i18n[4]+"</div>";l+='<div class="gadwp-bright">0</div>';l+="</div>";l+='<div class="gadwp-bigtext">';l+='<div class="gadwp-bleft">'+e.i18n[5]+"</div>";l+='<div class="gadwp-bright">0</div>';l+="</div>";l+="</div>";l+="</div>";l+="<div>";l+='<div id="gadwp-pages" class="gadwp-pages">&nbsp;</div>';l+="</div>";l+="</div>";jQuery("#gadwp-reports"+b).html(l);e.rtRefresh(e.render.focusFlag);e.rtRuns=setInterval(e.rtRefresh,55000)}else{if(jQuery.inArray(n,["referrers","contentpages","searches"])>-1){l='<div id="gadwp-orgcharttablechart'+b+'">';l+='<div id="gadwp-orgchart'+b+'"></div>';l+='<div id="gadwp-tablechart'+b+'"></div>';l+="</div>";jQuery("#gadwp-reports"+b).html(l);jQuery("#gadwp-reports"+b).hide();jQuery("#gadwp-sel-metric"+b).show();a.query="channelGrouping,"+n;a.metric=c;jQuery.post(gadwpItemData.ajaxurl,a,function(r){e.orgChartTableChart(r)})}else{if(n=="404errors"){l='<div id="gadwp-404tablechart'+b+'">';l+='<div id="gadwp-tablechart'+b+'"></div>';l+="</div>";jQuery("#gadwp-reports"+b).html(l);jQuery("#gadwp-reports"+b).hide();jQuery("#gadwp-sel-metric"+b).show();a.query=n;a.metric=c;jQuery.post(gadwpItemData.ajaxurl,a,function(r){e.tableChart(r)})}else{if(n=="trafficdetails"||n=="technologydetails"){l='<div id="gadwp-orgchartpiecharts'+b+'">';l+='<div id="gadwp-orgchart'+b+'"></div>';l+='<div class="gadwp-floatwraper">';l+='<div id="gadwp-piechart-1'+b+'" class="halfsize floatleft"></div>';l+='<div id="gadwp-piechart-2'+b+'" class="halfsize floatright"></div>';l+="</div>";l+='<div class="gadwp-floatwraper">';l+='<div id="gadwp-piechart-3'+b+'" class="halfsize floatleft"></div>';l+='<div id="gadwp-piechart-4'+b+'" class="halfsize floatright"></div>';l+="</div>";l+="</div>";jQuery("#gadwp-reports"+b).html(l);jQuery("#gadwp-reports"+b).hide();jQuery("#gadwp-sel-metric"+b).show();if(n=="trafficdetails"){a.query="channelGrouping,medium,visitorType,source,socialNetwork";e.i18n=gadwpItemData.i18n.slice(0,5)}else{e.i18n=gadwpItemData.i18n.slice(15,20);a.query="deviceCategory,browser,operatingSystem,screenResolution,mobileDeviceBranding"}a.metric=c;jQuery.post(gadwpItemData.ajaxurl,a,function(r){e.orgChartPieCharts(r)})}else{if(n=="locations"){l='<div id="gadwp-geocharttablechart'+b+'">';l+='<div id="gadwp-geochart'+b+'"></div>';l+='<div id="gadwp-tablechart'+b+'"></div>';l+="</div>";jQuery("#gadwp-reports"+b).html(l);jQuery("#gadwp-reports"+b).hide();jQuery("#gadwp-sel-metric"+b).show();a.query=n;a.metric=c;jQuery.post(gadwpItemData.ajaxurl,a,function(r){e.geoChartTableChart(r)})}else{l='<div id="gadwp-areachartbottomstats'+b+'">';l+='<div id="gadwp-areachart'+b+'"></div>';l+='<div id="gadwp-bottomstats'+b+'">';l+='<div class="inside">';l+='<div class="small-box"><h3>'+gadwpItemData.i18n[5]+'</h3><p id="gdsessions'+b+'">&nbsp;</p></div>';l+='<div class="small-box"><h3>'+gadwpItemData.i18n[6]+'</h3><p id="gdusers'+b+'">&nbsp;</p></div>';l+='<div class="small-box"><h3>'+gadwpItemData.i18n[7]+'</h3><p id="gdpageviews'+b+'">&nbsp;</p></div>';l+='<div class="small-box"><h3>'+gadwpItemData.i18n[8]+'</h3><p id="gdbouncerate'+b+'">&nbsp;</p></div>';l+='<div class="small-box"><h3>'+gadwpItemData.i18n[9]+'</h3><p id="gdorganicsearch'+b+'">&nbsp;</p></div>';l+='<div class="small-box"><h3>'+gadwpItemData.i18n[10]+'</h3><p id="gdpagespervisit'+b+'">&nbsp;</p></div>';l+='<div class="small-box"><h3>'+gadwpItemData.i18n[26]+'</h3><p id="gdpagetime'+b+'">&nbsp;</p></div>';l+='<div class="small-box"><h3>'+gadwpItemData.i18n[27]+'</h3><p id="gdpageload'+b+'">&nbsp;</p></div>';l+='<div class="small-box"><h3>'+gadwpItemData.i18n[28]+'</h3><p id="gdsessionduration'+b+'">&nbsp;</p></div>';l+="</div>";l+="</div>";l+="</div>";jQuery("#gadwp-reports"+b).html(l);jQuery("#gadwp-reports"+b).hide();a.query=n+",bottomstats";jQuery.post(gadwpItemData.ajaxurl,a,function(r){e.areaChartBottomStats(r)})}}}}}},refresh:function(){if(jQuery("#gadwp-areachartbottomstats"+b).length>0&&jQuery.isArray(e.areaChartBottomStatsData)){e.areaChartBottomStats(e.areaChartBottomStatsData)}if(jQuery("#gadwp-orgchartpiecharts"+b).length>0&&jQuery.isArray(e.orgChartPieChartsData)){e.orgChartPieCharts(e.orgChartPieChartsData)}if(jQuery("#gadwp-geocharttablechart"+b).length>0&&jQuery.isArray(e.geoChartTableChartData)){e.geoChartTableChart(e.geoChartTableChartData)}if(jQuery("#gadwp-orgcharttablechart"+b).length>0&&jQuery.isArray(e.orgChartTableChartData)){e.orgChartTableChart(e.orgChartTableChartData)}if(jQuery("#gadwp-404tablechart"+b).length>0&&jQuery.isArray(e.tableChartData)){e.tableChart(e.tableChartData)}},init:function(){if(!jQuery("#gadwp-reports"+b).length){return}if(jQuery("#gadwp-reports"+b).html().length){return}try{NProgress.configure({parent:"#gadwp-progressbar"+b,showSpinner:false});NProgress.start()}catch(j){e.alertMessage(gadwpItemData.i18n[0])}e.render(jQuery("#gadwp-sel-view"+b).val(),jQuery("#gadwp-sel-period"+b).val(),jQuery("#gadwp-sel-report"+b).val());jQuery(window).resize(function(){var k=jQuery(window).width()-e.oldViewPort;if((k<-5)||(k>5)){e.oldViewPort=jQuery(window).width();e.refresh()}})}};h.init();e.init();jQuery("#gadwp-sel-view"+b).change(function(){jQuery("#gadwp-reports"+b).html("");e.init()});jQuery("#gadwp-sel-period"+b).change(function(){jQuery("#gadwp-sel-metric"+b).hide();jQuery("#gadwp-reports"+b).html("");e.init()});jQuery("#gadwp-sel-report"+b).change(function(){jQuery("#gadwp-sel-metric"+b).hide();jQuery("#gadwp-reports"+b).html("");e.init()});jQuery("[id^=gadwp-swmetric-]").click(function(){c=this.id.replace("gadwp-swmetric-","");d.setCookie("default_swmetric",c);jQuery("#gadwp-swmetric-sessions").css("color","#444");jQuery("#gadwp-swmetric-users").css("color","#444");jQuery("#gadwp-swmetric-pageviews").css("color","#444");jQuery("#"+this.id).css("color","#008ec2");jQuery("#gadwp-reports"+b).html("");e.init()});if(gadwpItemData.scope=="admin-widgets"){return}else{return this.dialog({width:"auto",maxWidth:510,height:"auto",modal:true,fluid:true,dialogClass:"gadwp wp-dialog",resizable:false,title:e.getTitle(gadwpItemData.scope),position:{my:"top",at:"top+100",of:window}})}}});function GADWPReportLoad(){if(gadwpItemData.scope=="admin-widgets"){jQuery("#gadwp-window-1").gadwpItemReport(1)}else{jQuery(gadwpItemData.getSelector(gadwpItemData.scope)).click(function(){if(!jQuery("#gadwp-window-"+gadwpItemData.getID(this)).length>0){jQuery("body").append('<div id="gadwp-window-'+gadwpItemData.getID(this)+'"></div>')}jQuery("#gadwp-window-"+gadwpItemData.getID(this)).gadwpItemReport(gadwpItemData.getID(this))})}jQuery(window).resize(function(){gadwpItemData.responsiveDialog()});jQuery(document).on("dialogopen",".ui-dialog",function(a,b){gadwpItemData.responsiveDialog()})};
config.php CHANGED
@@ -96,6 +96,8 @@ if ( ! class_exists( 'GADWP_Config' ) ) {
96
  'ga_event_precision',
97
  'with_endpoint',
98
  'backend_realtime_report',
 
 
99
  );
100
  foreach ( $numerics as $key ) {
101
  if ( isset( $options[$key] ) ) {
@@ -276,6 +278,8 @@ if ( ! class_exists( 'GADWP_Config' ) ) {
276
  'ga_force_ssl', //v5.1.2
277
  'with_endpoint', //v5.2
278
  'backend_realtime_report', //v5.2
 
 
279
  );
280
  foreach ( $zeros as $key ) {
281
  if ( ! isset( $this->options[$key] ) ) {
96
  'ga_event_precision',
97
  'with_endpoint',
98
  'backend_realtime_report',
99
+ 'ga_optout',
100
+ 'ga_dnt_optout',
101
  );
102
  foreach ( $numerics as $key ) {
103
  if ( isset( $options[$key] ) ) {
278
  'ga_force_ssl', //v5.1.2
279
  'with_endpoint', //v5.2
280
  'backend_realtime_report', //v5.2
281
+ 'ga_optout', //v5.2.3
282
+ 'ga_dnt_optout', //v5.2.3
283
  );
284
  foreach ( $zeros as $key ) {
285
  if ( ! isset( $this->options[$key] ) ) {
front/tracking-analytics.php CHANGED
@@ -364,7 +364,11 @@ if ( ! class_exists( 'GADWP_Tracking_Analytics' ) ) {
364
  }
365
  }
366
 
367
- $tracking_script_path = apply_filters( 'gadwp_analytics_script_path', 'https://www.google-analytics.com/analytics.js' );;
 
 
 
 
368
 
369
  GADWP_Tools::load_view( 'front/views/analytics-code.php', array( 'trackingcode' => $trackingcode, 'tracking_script_path' => $tracking_script_path ) );
370
  }
364
  }
365
  }
366
 
367
+ $tracking_script_path = apply_filters( 'gadwp_analytics_script_path', 'https://www.google-analytics.com/analytics.js' );
368
+
369
+ if ( $this->gadwp->config->options['ga_optout'] || $this->gadwp->config->options['ga_dnt_optout'] ) {
370
+ GADWP_Tools::load_view( 'front/views/analytics-optout-code.php', array( 'uaid' => $this->uaid, 'gaDntOptout' => $this->gadwp->config->options['ga_dnt_optout'], 'gaOptout' => $this->gadwp->config->options['ga_optout'] ) );
371
+ }
372
 
373
  GADWP_Tools::load_view( 'front/views/analytics-code.php', array( 'trackingcode' => $trackingcode, 'tracking_script_path' => $tracking_script_path ) );
374
  }
front/tracking-tagmanager.php CHANGED
@@ -96,7 +96,7 @@ if ( ! class_exists( 'GADWP_Tracking_TagManager' ) ) {
96
  }
97
 
98
  if ( $this->gadwp->config->options['tm_category_var'] && is_category() ) {
99
- $this->add_var( 'gadwpCategory', esc_attr( single_tag_title() ) );
100
  }
101
  if ( $this->gadwp->config->options['tm_category_var'] && is_single() ) {
102
  global $post;
@@ -170,4 +170,4 @@ if ( ! class_exists( 'GADWP_Tracking_TagManager' ) ) {
170
  ?><amp-analytics config="https://www.googletagmanager.com/amp.json?id=<?php echo $this->gadwp->config->options['amp_containerid']; ?>&gtm.url=SOURCE_URL" data-credentials="include"></amp-analytics><?php
171
  }
172
  }
173
- }
96
  }
97
 
98
  if ( $this->gadwp->config->options['tm_category_var'] && is_category() ) {
99
+ $this->add_var( 'gadwpCategory', esc_attr( single_tag_title( '', false ) ) );
100
  }
101
  if ( $this->gadwp->config->options['tm_category_var'] && is_single() ) {
102
  global $post;
170
  ?><amp-analytics config="https://www.googletagmanager.com/amp.json?id=<?php echo $this->gadwp->config->options['amp_containerid']; ?>&gtm.url=SOURCE_URL" data-credentials="include"></amp-analytics><?php
171
  }
172
  }
173
+ }
front/views/analytics-optout-code.php ADDED
@@ -0,0 +1,26 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Author: Alin Marcu
4
+ * Copyright 2018 Alin Marcu
5
+ * Author URI: https://deconf.com
6
+ * License: GPLv2 or later
7
+ * License URI: http://www.gnu.org/licenses/gpl-2.0.html
8
+ */
9
+ ?>
10
+ <script>
11
+ var dnt = false;
12
+ var gaProperty = '<?php echo $data['uaid']?>';
13
+ var gaDntOptout = '<?php echo $data['gaDntOptout']?>';
14
+ var gaOptout = '<?php echo $data['gaOptout']?>';
15
+ var disableStr = 'ga-disable-' + gaProperty;
16
+ if(gaDntOptout && (window.doNotTrack === "1" || navigator.doNotTrack === "1" || navigator.doNotTrack === "yes" || navigator.msDoNotTrack === "1")) {
17
+ dnt = true;
18
+ }
19
+ if (dnt || (document.cookie.indexOf(disableStr + '=true') > -1 && gaOptout)) {
20
+ window[disableStr] = true;
21
+ }
22
+ function gaOptout() {
23
+ document.cookie = disableStr + '=true; expires=Thu, 31 Dec 2099 23:59:59 UTC; path=/';
24
+ window[disableStr] = true;
25
+ }
26
+ </script>
gadwp.php CHANGED
@@ -4,7 +4,7 @@
4
  * Plugin URI: https://deconf.com
5
  * Description: Displays Google Analytics Reports and Real-Time Statistics in your Dashboard. Automatically inserts the tracking code in every page of your website.
6
  * Author: Alin Marcu
7
- * Version: 5.2.2
8
  * Author URI: https://deconf.com
9
  * Text Domain: google-analytics-dashboard-for-wp
10
  * Domain Path: /languages
@@ -16,7 +16,7 @@ if ( ! defined( 'ABSPATH' ) )
16
 
17
  // Plugin Version
18
  if ( ! defined( 'GADWP_CURRENT_VERSION' ) ) {
19
- define( 'GADWP_CURRENT_VERSION', '5.2.2' );
20
  }
21
 
22
  if ( ! defined( 'GADWP_ENDPOINT_URL' ) ) {
4
  * Plugin URI: https://deconf.com
5
  * Description: Displays Google Analytics Reports and Real-Time Statistics in your Dashboard. Automatically inserts the tracking code in every page of your website.
6
  * Author: Alin Marcu
7
+ * Version: 5.2.3
8
  * Author URI: https://deconf.com
9
  * Text Domain: google-analytics-dashboard-for-wp
10
  * Domain Path: /languages
16
 
17
  // Plugin Version
18
  if ( ! defined( 'GADWP_CURRENT_VERSION' ) ) {
19
+ define( 'GADWP_CURRENT_VERSION', '5.2.3' );
20
  }
21
 
22
  if ( ! defined( 'GADWP_ENDPOINT_URL' ) ) {
install/install.php CHANGED
@@ -85,6 +85,8 @@ class GADWP_Install {
85
  $options['ga_event_precision'] = 0;
86
  $options['ga_force_ssl'] = 0;
87
  $options['with_endpoint'] = 1;
 
 
88
  } else {
89
  $options = array();
90
  $options['client_id'] = get_option( 'ga_dash_clientid' );
@@ -155,6 +157,8 @@ class GADWP_Install {
155
  $options['ga_event_precision'] = 0;
156
  $options['ga_force_ssl'] = 0;
157
  $options['with_endpoint'] = 1;
 
 
158
 
159
  delete_option( 'ga_dash_clientid' );
160
  delete_option( 'ga_dash_clientsecret' );
85
  $options['ga_event_precision'] = 0;
86
  $options['ga_force_ssl'] = 0;
87
  $options['with_endpoint'] = 1;
88
+ $options['ga_optout'] = 0;
89
+ $options['ga_dnt_optout'] = 0;
90
  } else {
91
  $options = array();
92
  $options['client_id'] = get_option( 'ga_dash_clientid' );
157
  $options['ga_event_precision'] = 0;
158
  $options['ga_force_ssl'] = 0;
159
  $options['with_endpoint'] = 1;
160
+ $options['ga_optout'] = 0;
161
+ $options['ga_dnt_optout'] = 0;
162
 
163
  delete_option( 'ga_dash_clientid' );
164
  delete_option( 'ga_dash_clientsecret' );
readme.txt CHANGED
@@ -4,7 +4,7 @@ Donate link: https://deconf.com/donate/
4
  Tags: analytics,google analytics,google analytics dashboard,google analytics plugin,google analytics widget
5
  Requires at least: 3.5
6
  Tested up to: 4.9.4
7
- Stable tag: 5.2.2
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -165,6 +165,16 @@ Google Analytics Dashboard for WP it's released under the GPLv2, you can use it
165
 
166
  == Changelog ==
167
 
 
 
 
 
 
 
 
 
 
 
168
  = 5.2.2 =
169
  * Enhancements:
170
  * more informative alerts and suggestions on the authorization screen
4
  Tags: analytics,google analytics,google analytics dashboard,google analytics plugin,google analytics widget
5
  Requires at least: 3.5
6
  Tested up to: 4.9.4
7
+ Stable tag: 5.2.3
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
165
 
166
  == Changelog ==
167
 
168
+ = 5.2.3 =
169
+ * Enhancements:
170
+ * add Google Analytics user opt-out support
171
+ * add option to exclude tracking for users sending the <em>Do Not Track</em> header
172
+ * add System tab to Errors & Debug screen
173
+ * check to avoid using a redeemed access code
174
+ * Bug Fixes:
175
+ * remove a debugging message
176
+ * cURL options were overwritten during regular API calls
177
+
178
  = 5.2.2 =
179
  * Enhancements:
180
  * more informative alerts and suggestions on the authorization screen
tools/gapi.php CHANGED
@@ -41,6 +41,7 @@ if ( ! class_exists( 'GADWP_GAPI_Controller' ) ) {
41
  } else {
42
  $rightversion = false;
43
  }
 
44
  if ( $rightversion && defined( 'GADWP_IP_VERSION' ) && GADWP_IP_VERSION ) {
45
  $curl_options[CURLOPT_IPRESOLVE] = GADWP_IP_VERSION; // Force CURL_IPRESOLVE_V4 or CURL_IPRESOLVE_V6
46
  }
@@ -119,11 +120,27 @@ if ( ! class_exists( 'GADWP_GAPI_Controller' ) ) {
119
  $url = $request->getUrl();
120
 
121
  if ( in_array( $url, array( 'https://accounts.google.com/o/oauth2/token', 'https://accounts.google.com/o/oauth2/revoke' ) ) ) {
122
- $curl_options[CURLOPT_SSL_VERIFYPEER] = 0;
123
- $this->client->setClassConfig( 'Deconf_IO_Curl', 'options', $curl_options );
 
 
 
 
 
 
124
  } else {
125
- $curl_options[CURLOPT_SSL_VERIFYPEER] = 1;
126
- $this->client->setClassConfig( 'Deconf_IO_Curl', 'options', $curl_options );
 
 
 
 
 
 
 
 
 
 
127
  }
128
 
129
  $url = str_replace( 'https://accounts.google.com/o/oauth2/token', GADWP_ENDPOINT_URL . 'gadwp-token.php', $url );
@@ -138,6 +155,10 @@ if ( ! class_exists( 'GADWP_GAPI_Controller' ) ) {
138
  }
139
  }
140
 
 
 
 
 
141
  /**
142
  * Handles errors returned by GAPI Library
143
  *
41
  } else {
42
  $rightversion = false;
43
  }
44
+
45
  if ( $rightversion && defined( 'GADWP_IP_VERSION' ) && GADWP_IP_VERSION ) {
46
  $curl_options[CURLOPT_IPRESOLVE] = GADWP_IP_VERSION; // Force CURL_IPRESOLVE_V4 or CURL_IPRESOLVE_V6
47
  }
120
  $url = $request->getUrl();
121
 
122
  if ( in_array( $url, array( 'https://accounts.google.com/o/oauth2/token', 'https://accounts.google.com/o/oauth2/revoke' ) ) ) {
123
+ if ( get_class( $this->client->getIo() ) != 'Deconf_IO_Stream' ) {
124
+ $curl_old_options = $this->client->getClassConfig( 'Deconf_IO_Curl' );
125
+ $curl_options = $curl_old_options['options'];
126
+ $curl_options[CURLOPT_SSL_VERIFYPEER] = 0;
127
+ $this->client->setClassConfig( 'Deconf_IO_Curl', 'options', $curl_options );
128
+ } else {
129
+ add_filter( 'gadwp_endpoint_stream_options', array( $this, 'add_endpoint_stream_ssl' ), 10 );
130
+ }
131
  } else {
132
+ if ( get_class( $this->client->getIo() ) != 'Deconf_IO_Stream' ) {
133
+ $curl_old_options = $this->client->getClassConfig( 'Deconf_IO_Curl' );
134
+ $curl_options = $curl_old_options['options'];
135
+ if ( isset( $curl_options[CURLOPT_SSL_VERIFYPEER] ) ) {
136
+ unset( $curl_options[CURLOPT_SSL_VERIFYPEER] );
137
+ if ( empty( $curl_options ) ) {
138
+ $this->client->setClassConfig( 'Deconf_IO_Curl', 'options', '' );
139
+ } else {
140
+ $this->client->setClassConfig( 'Deconf_IO_Curl', 'options', $curl_options );
141
+ }
142
+ }
143
+ }
144
  }
145
 
146
  $url = str_replace( 'https://accounts.google.com/o/oauth2/token', GADWP_ENDPOINT_URL . 'gadwp-token.php', $url );
155
  }
156
  }
157
 
158
+ public function add_endpoint_stream_ssl( $requestSslContext ) {
159
+ return array( "verify_peer" => false );
160
+ }
161
+
162
  /**
163
  * Handles errors returned by GAPI Library
164
  *
tools/src/Deconf/Client.php CHANGED
@@ -127,7 +127,7 @@ class Deconf_Client
127
  $this->authenticated = true;
128
  return $this->getAuth()->authenticate($code, $crossClient);
129
  }
130
-
131
  /**
132
  * Loads a service account key and parameters from a JSON
133
  * file from the Google Developer Console. Uses that and the
127
  $this->authenticated = true;
128
  return $this->getAuth()->authenticate($code, $crossClient);
129
  }
130
+
131
  /**
132
  * Loads a service account key and parameters from a JSON
133
  * file from the Google Developer Console. Uses that and the
tools/src/Deconf/IO/Curl.php CHANGED
@@ -92,12 +92,12 @@ class Deconf_IO_Curl extends Deconf_IO_Abstract
92
  if ($request->canGzip()) {
93
  curl_setopt($curl, CURLOPT_ENCODING, 'gzip,deflate');
94
  }
95
-
96
  $options = $this->client->getClassConfig('Deconf_IO_Curl', 'options');
97
  if (is_array($options)) {
98
  $this->setOptions($options);
99
  }
100
-
101
  foreach ($this->options as $key => $var) {
102
  curl_setopt($curl, $key, $var);
103
  }
92
  if ($request->canGzip()) {
93
  curl_setopt($curl, CURLOPT_ENCODING, 'gzip,deflate');
94
  }
95
+
96
  $options = $this->client->getClassConfig('Deconf_IO_Curl', 'options');
97
  if (is_array($options)) {
98
  $this->setOptions($options);
99
  }
100
+
101
  foreach ($this->options as $key => $var) {
102
  curl_setopt($curl, $key, $var);
103
  }
tools/src/Deconf/IO/Stream.php CHANGED
@@ -87,6 +87,9 @@ class Deconf_IO_Stream extends Deconf_IO_Abstract
87
  $requestSslContext = array_key_exists('ssl', $default_options) ?
88
  $default_options['ssl'] : array();
89
 
 
 
 
90
  if (!$this->client->isAppEngine() && !array_key_exists("cafile", $requestSslContext)) {
91
  $requestSslContext["cafile"] = dirname(__FILE__) . '/cacerts.pem';
92
  }
87
  $requestSslContext = array_key_exists('ssl', $default_options) ?
88
  $default_options['ssl'] : array();
89
 
90
+ // Add support for GADWP Endpoint
91
+ $requestSslContext = apply_filters('gadwp_endpoint_stream_options', $requestSslContext, $request);
92
+
93
  if (!$this->client->isAppEngine() && !array_key_exists("cafile", $requestSslContext)) {
94
  $requestSslContext["cafile"] = dirname(__FILE__) . '/cacerts.pem';
95
  }
tools/src/Deconf/IO/cacerts.pem CHANGED
@@ -2181,3 +2181,53 @@ IxKVCCIcl85bBu4M4ru8H0ST9tg4RQUh7eStqxK2A6RCLi3ECToDZ2mEmuFZkIoo
2181
  hdVddLHRDiBYmxOlsGOm7XtH/UVVMKTumtTm4ofvmMkyghEpIrwACjFeLQ/Ajulr
2182
  so8uBtjRkcfGEvRM/TAXw8HaOFvjqermobp573PYtlNXLfbQ4ddI
2183
  -----END CERTIFICATE-----
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2181
  hdVddLHRDiBYmxOlsGOm7XtH/UVVMKTumtTm4ofvmMkyghEpIrwACjFeLQ/Ajulr
2182
  so8uBtjRkcfGEvRM/TAXw8HaOFvjqermobp573PYtlNXLfbQ4ddI
2183
  -----END CERTIFICATE-----
2184
+
2185
+ DST Root CA X3
2186
+ ==============
2187
+ -----BEGIN CERTIFICATE-----
2188
+ MIIDSjCCAjKgAwIBAgIQRK+wgNajJ7qJMDmGLvhAazANBgkqhkiG9w0BAQUFADA/MSQwIgYDVQQK
2189
+ ExtEaWdpdGFsIFNpZ25hdHVyZSBUcnVzdCBDby4xFzAVBgNVBAMTDkRTVCBSb290IENBIFgzMB4X
2190
+ DTAwMDkzMDIxMTIxOVoXDTIxMDkzMDE0MDExNVowPzEkMCIGA1UEChMbRGlnaXRhbCBTaWduYXR1
2191
+ cmUgVHJ1c3QgQ28uMRcwFQYDVQQDEw5EU1QgUm9vdCBDQSBYMzCCASIwDQYJKoZIhvcNAQEBBQAD
2192
+ ggEPADCCAQoCggEBAN+v6ZdQCINXtMxiZfaQguzH0yxrMMpb7NnDfcdAwRgUi+DoM3ZJKuM/IUmT
2193
+ rE4Orz5Iy2Xu/NMhD2XSKtkyj4zl93ewEnu1lcCJo6m67XMuegwGMoOifooUMM0RoOEqOLl5CjH9
2194
+ UL2AZd+3UWODyOKIYepLYYHsUmu5ouJLGiifSKOeDNoJjj4XLh7dIN9bxiqKqy69cK3FCxolkHRy
2195
+ xXtqqzTWMIn/5WgTe1QLyNau7Fqckh49ZLOMxt+/yUFw7BZy1SbsOFU5Q9D8/RhcQPGX69Wam40d
2196
+ utolucbY38EVAjqr2m7xPi71XAicPNaDaeQQmxkqtilX4+U9m5/wAl0CAwEAAaNCMEAwDwYDVR0T
2197
+ AQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMCAQYwHQYDVR0OBBYEFMSnsaR7LHH62+FLkHX/xBVghYkQ
2198
+ MA0GCSqGSIb3DQEBBQUAA4IBAQCjGiybFwBcqR7uKGY3Or+Dxz9LwwmglSBd49lZRNI+DT69ikug
2199
+ dB/OEIKcdBodfpga3csTS7MgROSR6cz8faXbauX+5v3gTt23ADq1cEmv8uXrAvHRAosZy5Q6XkjE
2200
+ GB5YGV8eAlrwDPGxrancWYaLbumR9YbK+rlmM6pZW87ipxZzR8srzJmwN0jP41ZL9c8PDHIyh8bw
2201
+ RLtTcm1D9SZImlJnt1ir/md2cXjbDaJWFBM5JDGFoqgCWjBH4d1QB7wCCZAA62RjYJsWvIjJEubS
2202
+ fZGL+T0yjWW06XyxV3bqxbYoOb8VZRzI9neWagqNdwvYkQsEjgfbKbYK7p2CNTUQ
2203
+ -----END CERTIFICATE-----
2204
+
2205
+ ISRG Root X1
2206
+ ============
2207
+ -----BEGIN CERTIFICATE-----
2208
+ MIIFazCCA1OgAwIBAgIRAIIQz7DSQONZRGPgu2OCiwAwDQYJKoZIhvcNAQELBQAwTzELMAkGA1UE
2209
+ BhMCVVMxKTAnBgNVBAoTIEludGVybmV0IFNlY3VyaXR5IFJlc2VhcmNoIEdyb3VwMRUwEwYDVQQD
2210
+ EwxJU1JHIFJvb3QgWDEwHhcNMTUwNjA0MTEwNDM4WhcNMzUwNjA0MTEwNDM4WjBPMQswCQYDVQQG
2211
+ EwJVUzEpMCcGA1UEChMgSW50ZXJuZXQgU2VjdXJpdHkgUmVzZWFyY2ggR3JvdXAxFTATBgNVBAMT
2212
+ DElTUkcgUm9vdCBYMTCCAiIwDQYJKoZIhvcNAQEBBQADggIPADCCAgoCggIBAK3oJHP0FDfzm54r
2213
+ Vygch77ct984kIxuPOZXoHj3dcKi/vVqbvYATyjb3miGbESTtrFj/RQSa78f0uoxmyF+0TM8ukj1
2214
+ 3Xnfs7j/EvEhmkvBioZxaUpmZmyPfjxwv60pIgbz5MDmgK7iS4+3mX6UA5/TR5d8mUgjU+g4rk8K
2215
+ b4Mu0UlXjIB0ttov0DiNewNwIRt18jA8+o+u3dpjq+sWT8KOEUt+zwvo/7V3LvSye0rgTBIlDHCN
2216
+ Aymg4VMk7BPZ7hm/ELNKjD+Jo2FR3qyHB5T0Y3HsLuJvW5iB4YlcNHlsdu87kGJ55tukmi8mxdAQ
2217
+ 4Q7e2RCOFvu396j3x+UCB5iPNgiV5+I3lg02dZ77DnKxHZu8A/lJBdiB3QW0KtZB6awBdpUKD9jf
2218
+ 1b0SHzUvKBds0pjBqAlkd25HN7rOrFleaJ1/ctaJxQZBKT5ZPt0m9STJEadao0xAH0ahmbWnOlFu
2219
+ hjuefXKnEgV4We0+UXgVCwOPjdAvBbI+e0ocS3MFEvzG6uBQE3xDk3SzynTnjh8BCNAw1FtxNrQH
2220
+ usEwMFxIt4I7mKZ9YIqioymCzLq9gwQbooMDQaHWBfEbwrbwqHyGO0aoSCqI3Haadr8faqU9GY/r
2221
+ OPNk3sgrDQoo//fb4hVC1CLQJ13hef4Y53CIrU7m2Ys6xt0nUW7/vGT1M0NPAgMBAAGjQjBAMA4G
2222
+ A1UdDwEB/wQEAwIBBjAPBgNVHRMBAf8EBTADAQH/MB0GA1UdDgQWBBR5tFnme7bl5AFzgAiIyBpY
2223
+ 9umbbjANBgkqhkiG9w0BAQsFAAOCAgEAVR9YqbyyqFDQDLHYGmkgJykIrGF1XIpu+ILlaS/V9lZL
2224
+ ubhzEFnTIZd+50xx+7LSYK05qAvqFyFWhfFQDlnrzuBZ6brJFe+GnY+EgPbk6ZGQ3BebYhtF8GaV
2225
+ 0nxvwuo77x/Py9auJ/GpsMiu/X1+mvoiBOv/2X/qkSsisRcOj/KKNFtY2PwByVS5uCbMiogziUwt
2226
+ hDyC3+6WVwW6LLv3xLfHTjuCvjHIInNzktHCgKQ5ORAzI4JMPJ+GslWYHb4phowim57iaztXOoJw
2227
+ TdwJx4nLCgdNbOhdjsnvzqvHu7UrTkXWStAmzOVyyghqpZXjFaH3pO3JLF+l+/+sKAIuvtd7u+Nx
2228
+ e5AW0wdeRlN8NwdCjNPElpzVmbUq4JUagEiuTDkHzsxHpFKVK7q4+63SM1N95R1NbdWhscdCb+ZA
2229
+ JzVcoyi3B43njTOQ5yOf+1CceWxG1bQVs5ZufpsMljq4Ui0/1lvh+wjChP4kqKOJ2qxq4RgqsahD
2230
+ YVvTH9w7jXbyLeiNdd8XM2w9U/t7y0Ff/9yi0GE44Za4rF2LN9d11TPAmRGunUHBcnWEvgJBQl9n
2231
+ JEiU0Zsnvgc/ubhPgXRR4Xq37Z0j4r7g1SgEEzwxA57demyPxgcYxn/eR44/KJ4EBs+lVDR3veyJ
2232
+ m+kXQ99b21/+jh5Xos1AnX5iItreGCc=
2233
+ -----END CERTIFICATE-----
tools/tools.php CHANGED
@@ -16,7 +16,7 @@ if ( ! class_exists( 'GADWP_Tools' ) ) {
16
  class GADWP_Tools {
17
 
18
  public static function get_countrycodes() {
19
- include_once 'iso3166.php';
20
  return $country_codes;
21
  }
22
 
@@ -257,5 +257,56 @@ if ( ! class_exists( 'GADWP_Tools' ) ) {
257
 
258
  return $options;
259
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
260
  }
261
  }
16
  class GADWP_Tools {
17
 
18
  public static function get_countrycodes() {
19
+ include 'iso3166.php';
20
  return $country_codes;
21
  }
22
 
257
 
258
  return $options;
259
  }
260
+
261
+ public static function system_info() {
262
+ $info = '';
263
+
264
+ // Server Software
265
+ $server_soft = "-";
266
+ if ( isset( $_SERVER['SERVER_SOFTWARE'] ) ) {
267
+ $server_soft = $_SERVER['SERVER_SOFTWARE'];
268
+ }
269
+ $info .= 'Server Info: ' . $server_soft . "\n";
270
+
271
+ // PHP version
272
+ if ( defined( 'PHP_VERSION' ) ) {
273
+ $info .= 'PHP Version: ' . PHP_VERSION . "\n";
274
+ } else if ( defined( 'HHVM_VERSION' ) ) {
275
+ $info .= 'HHVM Version: ' . HHVM_VERSION . "\n";
276
+ } else {
277
+ $info .= 'Other Version: ' . '-' . "\n";
278
+ }
279
+
280
+ /*PHP extensions
281
+ if ( is_callable( 'get_loaded_extensions' ) ) {
282
+ $info .= 'Loaded Extensions: ' . implode(', ', get_loaded_extensions()) . "\n";
283
+ } else {
284
+ $info .= 'Loaded Extensions: ' . '-' . "\n";
285
+ }*/
286
+
287
+ // cURL Info
288
+ if ( function_exists( 'curl_version' ) && function_exists( 'curl_exec' ) ) {
289
+ $curl_version = curl_version();
290
+ if ( ! empty( $curl_version ) ) {
291
+ $curl_ver = $curl_version['version'] . " " . $curl_version['ssl_version'];
292
+ } else {
293
+ $curl_ver = '-';
294
+ }
295
+ } else {
296
+ $curl_ver = '-';
297
+ }
298
+ $info .= 'cURL Info: ' . $curl_ver . "\n";
299
+
300
+ // Gzip
301
+ if ( is_callable( 'gzopen' ) ) {
302
+ $gzip = true;
303
+ } else {
304
+ $gzip = false;
305
+ }
306
+ $gzip_status = ( $gzip ) ? 'Yes' : 'No';
307
+ $info .= 'Gzip: ' . $gzip_status . "\n";
308
+
309
+ return $info;
310
+ }
311
  }
312
  }