Better Google Analytics - Version 1.1.3

Version Description

  • Feature: New option under Advanced tab - Hide "API Not Linked" Notice
  • Feature: New option under Advanced tab - Ability to limit access to settings to current admin account
  • Enhancement: Added option for tracking downloads of .dmg files
  • Fixed cosmetic issue within Goal Management with WordPress 4.4
  • Updated for WordPress 4.4
Download this release

Release Info

Developer digitalpoint
Plugin Icon 128x128 Better Google Analytics
Version 1.1.3
Comparing to
See all releases

Code changes from version 1.1.2 to 1.1.3

better-analytics.php CHANGED
@@ -7,7 +7,7 @@
7
  Plugin Name: Better Analytics
8
  Plugin URI: https://marketplace.digitalpoint.com/better-analytics.3354/item
9
  Description: Adds Google Universal Analytics code to your WordPress site. Options to track most everything (social button interactions, advertising clicks, emails sent/opened, YouTube video engagement, custom dimension tracking of authors/categories, etc.) Integrates with API for reports/charts on dashboard, heat maps and real-time traffic tracking.
10
- Version: 1.1.2
11
  Author: Digital Point
12
  Author URI: https://www.digitalpoint.com/
13
  License: GPLv2
@@ -23,7 +23,7 @@ if (!function_exists('add_action'))
23
  exit;
24
  }
25
 
26
- define('BETTER_ANALYTICS_VERSION', '1.1.2');
27
  define('BETTER_ANALYTICS_MINIMUM_WP_VERSION', '3.8'); // Dashicons: https://codex.wordpress.org/Function_Reference/add_menu_page
28
  define('BETTER_ANALYTICS_PRODUCT_URL', 'https://marketplace.digitalpoint.com/better-analytics.3354/item');
29
  define('BETTER_ANALYTICS_PRO_PRODUCT_URL', 'https://marketplace.digitalpoint.com/better-analytics-pro.3355/item');
7
  Plugin Name: Better Analytics
8
  Plugin URI: https://marketplace.digitalpoint.com/better-analytics.3354/item
9
  Description: Adds Google Universal Analytics code to your WordPress site. Options to track most everything (social button interactions, advertising clicks, emails sent/opened, YouTube video engagement, custom dimension tracking of authors/categories, etc.) Integrates with API for reports/charts on dashboard, heat maps and real-time traffic tracking.
10
+ Version: 1.1.3
11
  Author: Digital Point
12
  Author URI: https://www.digitalpoint.com/
13
  License: GPLv2
23
  exit;
24
  }
25
 
26
+ define('BETTER_ANALYTICS_VERSION', '1.1.3');
27
  define('BETTER_ANALYTICS_MINIMUM_WP_VERSION', '3.8'); // Dashicons: https://codex.wordpress.org/Function_Reference/add_menu_page
28
  define('BETTER_ANALYTICS_PRODUCT_URL', 'https://marketplace.digitalpoint.com/better-analytics.3354/item');
29
  define('BETTER_ANALYTICS_PRO_PRODUCT_URL', 'https://marketplace.digitalpoint.com/better-analytics-pro.3355/item');
library/DigitalPointBetterAnalytics/Base/Admin.php CHANGED
@@ -59,13 +59,16 @@ class DigitalPointBetterAnalytics_Base_Admin
59
  add_action('admin_notices', array($this, 'not_configured' ) );
60
  }
61
 
62
- if (!get_site_option('ba_site_tokens') && !get_option('ba_tokens'))
63
  {
64
- add_action('admin_notices', array($this, 'cant_auto_configure' ) );
65
- }
66
- elseif (!$betterAnalyticsOptions['api']['profile'])
67
- {
68
- add_action('admin_notices', array($this, 'can_auto_configure' ) );
 
 
 
69
  }
70
 
71
  if (get_transient('ba_last_error'))
@@ -85,6 +88,10 @@ class DigitalPointBetterAnalytics_Base_Admin
85
 
86
  public function admin_menu()
87
  {
 
 
 
 
88
  add_management_page( esc_html__('Test Analytics Setup', 'better-analytics'), esc_html__('Test Analytics Setup', 'better-analytics'), 'manage_options', 'better-analytics_test', array($this, 'display_test_page') );
89
  add_management_page( esc_html__('OAuth2 Endpoint', 'better-analytics'), esc_html__('OAuth2 Endpoint', 'better-analytics'), 'manage_options', 'better-analytics_auth', array($this, 'api_authentication') );
90
 
@@ -100,12 +107,20 @@ class DigitalPointBetterAnalytics_Base_Admin
100
 
101
  add_submenu_page( 'better-analytics_heatmaps', esc_html__('Goals', 'better-analytics'), esc_html__('Goals', 'better-analytics'), 'manage_options', 'better-analytics_goals', array($this, 'display_page') );
102
  add_submenu_page( 'better-analytics_heatmaps', esc_html__('A/B Testing', 'better-analytics'), esc_html__('A/B Testing', 'better-analytics'), 'manage_options', 'better-analytics_experiments', array($this, 'display_page') );
103
- add_submenu_page( 'better-analytics_heatmaps', esc_html__('Settings', 'better-analytics'), esc_html__('Settings', 'better-analytics'), 'manage_options', 'options-general.php' . '?page=better-analytics' );
 
 
 
 
 
104
  add_submenu_page( 'better-analytics_heatmaps', esc_html__('Test Setup', 'better-analytics'), esc_html__('Test Setup', 'better-analytics'), 'manage_options', 'tools.php' . '?page=better-analytics_test' );
105
 
 
 
 
 
 
106
 
107
- $hook = add_options_page( esc_html__('Better Analytics', 'better-analytics'), esc_html__('Better Analytics', 'better-analytics'), 'manage_options', 'better-analytics', array($this, 'display_configuration_page'));
108
- add_action( "load-$hook", array($this, 'admin_help'));
109
  }
110
 
111
  public function network_admin_menu()
59
  add_action('admin_notices', array($this, 'not_configured' ) );
60
  }
61
 
62
+ if (strpos(@$_SERVER['REQUEST_URI'], 'page=better-analytics') !== false || @!$betterAnalyticsOptions['hide_api_message'])
63
  {
64
+ if (!get_site_option('ba_site_tokens') && !get_option('ba_tokens'))
65
+ {
66
+ add_action('admin_notices', array($this, 'cant_auto_configure' ) );
67
+ }
68
+ elseif (!$betterAnalyticsOptions['api']['profile'])
69
+ {
70
+ add_action('admin_notices', array($this, 'can_auto_configure' ) );
71
+ }
72
  }
73
 
74
  if (get_transient('ba_last_error'))
88
 
89
  public function admin_menu()
90
  {
91
+ $betterAnalyticsOptions = get_option('better_analytics');
92
+ $currentUser = wp_get_current_user();
93
+ $canViewSettings = (empty($betterAnalyticsOptions['lock_settings_user_id']) || $betterAnalyticsOptions['lock_settings_user_id'] == $currentUser->ID);
94
+
95
  add_management_page( esc_html__('Test Analytics Setup', 'better-analytics'), esc_html__('Test Analytics Setup', 'better-analytics'), 'manage_options', 'better-analytics_test', array($this, 'display_test_page') );
96
  add_management_page( esc_html__('OAuth2 Endpoint', 'better-analytics'), esc_html__('OAuth2 Endpoint', 'better-analytics'), 'manage_options', 'better-analytics_auth', array($this, 'api_authentication') );
97
 
107
 
108
  add_submenu_page( 'better-analytics_heatmaps', esc_html__('Goals', 'better-analytics'), esc_html__('Goals', 'better-analytics'), 'manage_options', 'better-analytics_goals', array($this, 'display_page') );
109
  add_submenu_page( 'better-analytics_heatmaps', esc_html__('A/B Testing', 'better-analytics'), esc_html__('A/B Testing', 'better-analytics'), 'manage_options', 'better-analytics_experiments', array($this, 'display_page') );
110
+
111
+ if ($canViewSettings)
112
+ {
113
+ add_submenu_page('better-analytics_heatmaps', esc_html__('Settings', 'better-analytics'), esc_html__('Settings', 'better-analytics'), 'manage_options', 'options-general.php' . '?page=better-analytics');
114
+ }
115
+
116
  add_submenu_page( 'better-analytics_heatmaps', esc_html__('Test Setup', 'better-analytics'), esc_html__('Test Setup', 'better-analytics'), 'manage_options', 'tools.php' . '?page=better-analytics_test' );
117
 
118
+ if ($canViewSettings)
119
+ {
120
+ $hook = add_options_page( esc_html__('Better Analytics', 'better-analytics'), esc_html__('Better Analytics', 'better-analytics'), 'manage_options', 'better-analytics', array($this, 'display_configuration_page'));
121
+ add_action( "load-$hook", array($this, 'admin_help'));
122
+ }
123
 
 
 
124
  }
125
 
126
  public function network_admin_menu()
library/DigitalPointBetterAnalytics/Base/Public.php CHANGED
@@ -206,7 +206,7 @@ class DigitalPointBetterAnalytics_Base_Public
206
  ),
207
  'roles_view_reports' => array('administrator'),
208
  'file_extensions' => array(
209
- 'avi', 'doc', 'exe', 'gz', 'mpg', 'mp3', 'pdf', 'ppt', 'psd', 'rar', 'wmv', 'xls', 'zip'
210
  ),
211
  'track_blocked' => 'never',
212
  'javascript' => array(
206
  ),
207
  'roles_view_reports' => array('administrator'),
208
  'file_extensions' => array(
209
+ 'avi', 'dmg', 'doc', 'exe', 'gz', 'mpg', 'mp3', 'pdf', 'ppt', 'psd', 'rar', 'wmv', 'xls', 'zip'
210
  ),
211
  'track_blocked' => 'never',
212
  'javascript' => array(
library/DigitalPointBetterAnalytics/CronEntry/Jobs.php CHANGED
@@ -14,6 +14,8 @@ class DigitalPointBetterAnalytics_CronEntry_Jobs
14
  {
15
  DigitalPointBetterAnalytics_Model_Widget::getStatsWidgetData();
16
 
 
 
17
  if (get_transient('ba_exp_live') || date('G', current_time('timestamp')) == 0)
18
  {
19
  $betterAnalyticsOptions = get_option('better_analytics');
14
  {
15
  DigitalPointBetterAnalytics_Model_Widget::getStatsWidgetData();
16
 
17
+ //TODO: do this based on a hash of site name instead of current_time() - API method stats are showing very few sites change default UTC time, so there's a flood of API calls at midnight UTC
18
+
19
  if (get_transient('ba_exp_live') || date('G', current_time('timestamp')) == 0)
20
  {
21
  $betterAnalyticsOptions = get_option('better_analytics');
library/DigitalPointBetterAnalytics/Formatting/GoalTable.php CHANGED
@@ -198,7 +198,7 @@ class DigitalPointBetterAnalytics_Formatting_GoalTable extends WP_List_Table
198
  $this->single_row_columns($item);
199
  echo '</tr>';
200
 
201
- echo '<tr class="extra_info' . ($item['active'] ? ' active' : '') . '"><td></td><td colspan="' . (count($this->get_columns()) - 1) . '">' . '<div>' . DigitalPointBetterAnalytics_Model_Goals::getTypeNameByCode($item['type']) . ': ' . '<strong style="padding-left: 5px;">';
202
 
203
  switch ($item['type'])
204
  {
198
  $this->single_row_columns($item);
199
  echo '</tr>';
200
 
201
+ echo '<tr class="extra_info no-items' . ($item['active'] ? ' active' : '') . '"><td></td><td colspan="' . (count($this->get_columns()) - 1) . '">' . '<div>' . DigitalPointBetterAnalytics_Model_Goals::getTypeNameByCode($item['type']) . ': ' . '<strong style="padding-left: 5px;">';
202
 
203
  switch ($item['type'])
204
  {
library/DigitalPointBetterAnalytics/Model/Admin.php CHANGED
@@ -5,6 +5,7 @@ class DigitalPointBetterAnalytics_Model_Admin
5
  public static function isLocaleSupported(&$locales = array())
6
  {
7
  $locales = array('en_US');
 
8
  foreach(glob(BETTER_ANALYTICS_PLUGIN_DIR . 'languages/*.mo') as $file)
9
  {
10
  if (preg_match('#better-analytics-(.*?)\.mo#si', $file, $matches))
@@ -12,6 +13,7 @@ class DigitalPointBetterAnalytics_Model_Admin
12
  $locales[] = $matches[1];
13
  }
14
  }
 
15
  return (array_search(get_locale(), $locales) !== false ? true : false);
16
  }
17
  }
5
  public static function isLocaleSupported(&$locales = array())
6
  {
7
  $locales = array('en_US');
8
+ /*
9
  foreach(glob(BETTER_ANALYTICS_PLUGIN_DIR . 'languages/*.mo') as $file)
10
  {
11
  if (preg_match('#better-analytics-(.*?)\.mo#si', $file, $matches))
13
  $locales[] = $matches[1];
14
  }
15
  }
16
+ */
17
  return (array_search(get_locale(), $locales) !== false ? true : false);
18
  }
19
  }
library/DigitalPointBetterAnalytics/ViewAdmin/config.php CHANGED
@@ -79,6 +79,7 @@
79
  <div>
80
  <?php
81
 
 
82
  if (version_compare($GLOBALS['wp_version'], '4.0.0', '<' ))
83
  {
84
  $localeName = get_locale();
@@ -101,7 +102,8 @@
101
  }
102
  printf('Better Analytics currently supports %1$u languages, but unfortunately %3$s%2$s%4$s isn\'t one of them.', count($locales), $localeName, '<strong>', '</strong>');
103
  echo '<p />';
104
- printf('If you would like to help translate it into your language, please visit the %1$ssupport forum%2$s and we can show you how it\'s done.', '<a href="' . esc_url(BETTER_ANALYTICS_SUPPORT_URL . '#utm_source=admin_settings&utm_medium=wordpress&utm_campaign=plugin') . '" target="_blank">', '</a>');
 
105
  ?>
106
  </div>
107
  </div>
@@ -129,9 +131,9 @@
129
  <li>
130
  <?php esc_html_e('More A/B testing objective metrics', 'better-analytics'); ?>
131
  </li>
132
- <li>
133
- <?php esc_html_e('eCommerce tracking', 'better-analytics'); ?>
134
- </li>
135
  <li>
136
  <?php esc_html_e('Option for server-side tracking of users (or bots) with Analytics/privacy blockers', 'better-analytics'); ?>
137
  </li>
@@ -929,6 +931,25 @@
929
  </td>
930
  </tr>
931
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
932
 
933
  <tr valign="top" class="group_advanced tab_content">
934
  <th scope="row"><?php esc_html_e('File Extensions To Track As Downloads', 'better-analytics');?> <span class="dashicons-before dashicons-info tooltip" title="<?php esc_html_e('If a logged in user is part of one of these groups, Analytics will not track them.', 'better-analytics');?>"></span></th>
@@ -939,6 +960,7 @@
939
  <?php
940
  $fileTypes = array(
941
  'avi' => esc_html__('Audio Video Interleave (.avi)', 'better-analytics'),
 
942
  'doc' => esc_html__('Word (.doc)', 'better-analytics'),
943
  'exe' => esc_html__('Executable (.exe)', 'better-analytics'),
944
  'gz' => esc_html__('gzip (.gz)', 'better-analytics'),
@@ -1114,6 +1136,19 @@
1114
  </td>
1115
  </tr>
1116
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1117
 
1118
  </table>
1119
 
79
  <div>
80
  <?php
81
 
82
+ /*
83
  if (version_compare($GLOBALS['wp_version'], '4.0.0', '<' ))
84
  {
85
  $localeName = get_locale();
102
  }
103
  printf('Better Analytics currently supports %1$u languages, but unfortunately %3$s%2$s%4$s isn\'t one of them.', count($locales), $localeName, '<strong>', '</strong>');
104
  echo '<p />';
105
+ */
106
+ printf('If you would like to help translate Better Analytics into your language, please visit the %1$swordpress.org translation site%2$s and you can help in translating.', '<a href="' . esc_url('https://translate.wordpress.org/projects/wp-plugins/better-analytics/dev') . '" target="_blank">', '</a>');
107
  ?>
108
  </div>
109
  </div>
131
  <li>
132
  <?php esc_html_e('More A/B testing objective metrics', 'better-analytics'); ?>
133
  </li>
134
+
135
+ <?php //esc_html_e('eCommerce tracking', 'better-analytics'); ?>
136
+
137
  <li>
138
  <?php esc_html_e('Option for server-side tracking of users (or bots) with Analytics/privacy blockers', 'better-analytics'); ?>
139
  </li>
931
  </td>
932
  </tr>
933
 
934
+ <?php
935
+ $currentUser = wp_get_current_user();
936
+ ?>
937
+
938
+ <tr valign="top" class="group_advanced tab_content">
939
+ <th scope="row"><?php esc_html_e('Permissions To Settings', 'better-analytics');?></th>
940
+ <td>
941
+ <fieldset>
942
+ <label for="ba_lock_settings_user_id">
943
+ <input name="better_analytics[lock_settings_user_id]" type="checkbox" id="ba_lock_settings_user_id" value="<?php echo @$currentUser->ID; ?>" <?php checked('1', @$betterAnalyticsOptions['lock_settings_user_id'] ); ?>>
944
+ <?php esc_html_e('Only Your User Account', 'better-analytics');?></label>
945
+ <span class="dashicons-before dashicons-info tooltip" title="<?php esc_html_e('If you want to disable all other admin accounts from having access to the Better Analytics settings, use this option. Keep in mind, that only your account will have access to change any Better Analytics settings.', 'better-analytics');?>"></span>
946
+
947
+ </fieldset>
948
+
949
+ </td>
950
+ </tr>
951
+
952
+
953
 
954
  <tr valign="top" class="group_advanced tab_content">
955
  <th scope="row"><?php esc_html_e('File Extensions To Track As Downloads', 'better-analytics');?> <span class="dashicons-before dashicons-info tooltip" title="<?php esc_html_e('If a logged in user is part of one of these groups, Analytics will not track them.', 'better-analytics');?>"></span></th>
960
  <?php
961
  $fileTypes = array(
962
  'avi' => esc_html__('Audio Video Interleave (.avi)', 'better-analytics'),
963
+ 'dmg' => esc_html__('Apple Disk Image (.dmg)', 'better-analytics'),
964
  'doc' => esc_html__('Word (.doc)', 'better-analytics'),
965
  'exe' => esc_html__('Executable (.exe)', 'better-analytics'),
966
  'gz' => esc_html__('gzip (.gz)', 'better-analytics'),
1136
  </td>
1137
  </tr>
1138
 
1139
+ <tr valign="top" class="group_advanced tab_content">
1140
+ <th scope="row"><?php esc_html_e('Suppress Dashboard Notices', 'better-analytics');?></th>
1141
+ <td>
1142
+ <fieldset>
1143
+ <label for="ba_hide_api_message">
1144
+ <input name="better_analytics[hide_api_message]" type="checkbox" id="ba_hide_api_message" value="1" <?php checked('1', @$betterAnalyticsOptions['hide_api_message'] ); ?>>
1145
+ <?php esc_html_e('Hide "API Not Linked" Notice', 'better-analytics');?></label>
1146
+ <span class="dashicons-before dashicons-info tooltip" title="<?php esc_html_e('If you choose not to link your Google Analytics account for reporting and management, you can disable the notice about it with this option (the notice will still show on Better Analytics config/reporting pages).', 'better-analytics');?>"></span>
1147
+
1148
+ </fieldset>
1149
+
1150
+ </td>
1151
+ </tr>
1152
 
1153
  </table>
1154
 
readme.txt CHANGED
@@ -3,8 +3,8 @@ Contributors: digitalpoint
3
  Tags: analytics, google analytics, universal analytics, statistics, tracking, code, dashboard, analytics dashboard, google analytics dashboard, google analytics plugin, google analytics widget, reports, charts, multisite, api, stats, web stats, visits, javascript, pageviews, marketing, widget, realtime, real time, youtube, outbrain, taboola, adsense, twitter, pinterest, linkedin, facebook, google, digitalpoint, ab testing, ab tests, split testing, google analytics content experiments, content experiments
4
  Donate link: https://marketplace.digitalpoint.com/better-analytics.3354/item#utm_source=readme&utm_medium=wordpress&utm_campaign=plugin
5
  Requires at least: 3.8
6
- Tested up to: 4.3.1
7
- Stable tag: 1.1.2
8
  License: GPLv2
9
  License URI: https://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -134,7 +134,7 @@ If you are using Google PageSpeed to combine JavaScript files, you will want to
134
  You need a WordPress site (of course), running WordPress 3.8 or higher and a Google Analytics account (which is [free over here](https://www.google.com/analytics/) if you don't already have a Google Analytics account).
135
 
136
  = Can Better Google Analytics be used with legacy Google Analytics code? =
137
- No, the Better Google Analytics plugin is for Google Universal Analytics. You can upgrade any old non-Universal Google Analytics property to support both legacy and Universal under your [Google Analytics Property Settings](https://www.google.com/analytics/web/?#management/Settings/).
138
 
139
  = What do I do with the JavaScript code that Google gives me from within my Google Analytics account? =
140
  Nothing. Better Google Analytics handles all the JavaScript code generation internally. If you want to add your own custom JavaScript, there is an option for that under the Advanced settings.
@@ -201,6 +201,13 @@ Thank you to all the individuals who have contributed translations for Better Go
201
  26. Advanced settings allow you to fine tune how the system works with Google Analytics.
202
 
203
  == Changelog ==
 
 
 
 
 
 
 
204
  = 1.1.2 =
205
  * Feature: User Engagement Time can be set by the user (under Advanced settings tab)
206
  * Bug: Workaround Internet Explorer not having location origin variable available
3
  Tags: analytics, google analytics, universal analytics, statistics, tracking, code, dashboard, analytics dashboard, google analytics dashboard, google analytics plugin, google analytics widget, reports, charts, multisite, api, stats, web stats, visits, javascript, pageviews, marketing, widget, realtime, real time, youtube, outbrain, taboola, adsense, twitter, pinterest, linkedin, facebook, google, digitalpoint, ab testing, ab tests, split testing, google analytics content experiments, content experiments
4
  Donate link: https://marketplace.digitalpoint.com/better-analytics.3354/item#utm_source=readme&utm_medium=wordpress&utm_campaign=plugin
5
  Requires at least: 3.8
6
+ Tested up to: 4.4
7
+ Stable tag: 1.1.3
8
  License: GPLv2
9
  License URI: https://www.gnu.org/licenses/gpl-2.0.html
10
 
134
  You need a WordPress site (of course), running WordPress 3.8 or higher and a Google Analytics account (which is [free over here](https://www.google.com/analytics/) if you don't already have a Google Analytics account).
135
 
136
  = Can Better Google Analytics be used with legacy Google Analytics code? =
137
+ No, the Better Google Analytics plugin is for Google Universal Analytics. And really, you wouldn't want to. All Google Analytics accounts have been upgraded to Universal Analytics, and the [non-Universal tracking libraries have been deprecated](https://developers.google.com/analytics/devguides/collection/upgrade/) by Google.
138
 
139
  = What do I do with the JavaScript code that Google gives me from within my Google Analytics account? =
140
  Nothing. Better Google Analytics handles all the JavaScript code generation internally. If you want to add your own custom JavaScript, there is an option for that under the Advanced settings.
201
  26. Advanced settings allow you to fine tune how the system works with Google Analytics.
202
 
203
  == Changelog ==
204
+ = 1.1.3 =
205
+ * Feature: New option under Advanced tab - Hide "API Not Linked" Notice
206
+ * Feature: New option under Advanced tab - Ability to limit access to settings to current admin account
207
+ * Enhancement: Added option for tracking downloads of .dmg files
208
+ * Fixed cosmetic issue within Goal Management with WordPress 4.4
209
+ * Updated for WordPress 4.4
210
+
211
  = 1.1.2 =
212
  * Feature: User Engagement Time can be set by the user (under Advanced settings tab)
213
  * Bug: Workaround Internet Explorer not having location origin variable available