Version Description
- Google Analytics Stats Widget has two new options that allows you to show stats on a per page basis if you want as well as making the widget private (only viewable to certain roles)
- Disallow PHP auto_append_file directive within the JavaScript loader
- Added a 1 Day option for the Google Analytics dashboard widget
- Works with WordPress 4.2.3
Download this release
Release Info
Developer | digitalpoint |
Plugin | Better Google Analytics |
Version | 1.0.9 |
Comparing to | |
See all releases |
Code changes from version 1.0.8 to 1.0.9
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.0.
|
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.0.
|
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.0.9
|
11 |
Author: Digital Point
|
12 |
Author URI: https://www.digitalpoint.com/
|
13 |
License: GPLv2
|
23 |
exit;
|
24 |
}
|
25 |
|
26 |
+
define('BETTER_ANALYTICS_VERSION', '1.0.9');
|
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');
|
js/loader.php
CHANGED
@@ -10,4 +10,5 @@
|
|
10 |
{
|
11 |
readfile('../../better-analytics-ecommerce/js/ba.js');
|
12 |
}
|
13 |
-
echo 'BetterAnalytics._BA=new BetterAnalytics.BA();';
|
|
10 |
{
|
11 |
readfile('../../better-analytics-ecommerce/js/ba.js');
|
12 |
}
|
13 |
+
echo 'BetterAnalytics._BA=new BetterAnalytics.BA();';
|
14 |
+
exit;
|
languages/better-analytics.pot
CHANGED
@@ -2,9 +2,9 @@
|
|
2 |
# This file is distributed under the same license as the Better Analytics package.
|
3 |
msgid ""
|
4 |
msgstr ""
|
5 |
-
"Project-Id-Version: Better Analytics 1.0.
|
6 |
"Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/better-analytics\n"
|
7 |
-
"POT-Creation-Date: 2015-07-16
|
8 |
"MIME-Version: 1.0\n"
|
9 |
"Content-Type: text/plain; charset=UTF-8\n"
|
10 |
"Content-Transfer-Encoding: 8bit\n"
|
@@ -68,7 +68,7 @@ msgstr ""
|
|
68 |
msgid "Test Setup"
|
69 |
msgstr ""
|
70 |
|
71 |
-
#. #-#-#-#-# plugin.pot (Better Analytics 1.0.
|
72 |
#. Plugin Name of the plugin/theme
|
73 |
#: library/DigitalPointBetterAnalytics/Base/Admin.php:106
|
74 |
#: library/DigitalPointBetterAnalytics/Base/Admin.php:199
|
@@ -266,7 +266,7 @@ msgid "Visitors"
|
|
266 |
msgstr ""
|
267 |
|
268 |
#: library/DigitalPointBetterAnalytics/ControllerAdmin/Analytics.php:54
|
269 |
-
#: library/DigitalPointBetterAnalytics/ViewAdmin/dashboard.php:
|
270 |
msgid "Real-time"
|
271 |
msgstr ""
|
272 |
|
@@ -1593,7 +1593,7 @@ msgstr ""
|
|
1593 |
msgid "Taboola"
|
1594 |
msgstr ""
|
1595 |
|
1596 |
-
#. #-#-#-#-# plugin.pot (Better Analytics 1.0.
|
1597 |
#. Author of the plugin/theme
|
1598 |
#: library/DigitalPointBetterAnalytics/ViewAdmin/config.php:657
|
1599 |
msgid "Digital Point"
|
@@ -1913,38 +1913,42 @@ msgid "for last"
|
|
1913 |
msgstr ""
|
1914 |
|
1915 |
#: library/DigitalPointBetterAnalytics/ViewAdmin/dashboard.php:63
|
1916 |
-
msgid "
|
1917 |
msgstr ""
|
1918 |
|
1919 |
#: library/DigitalPointBetterAnalytics/ViewAdmin/dashboard.php:64
|
1920 |
-
msgid "
|
1921 |
msgstr ""
|
1922 |
|
1923 |
#: library/DigitalPointBetterAnalytics/ViewAdmin/dashboard.php:65
|
|
|
|
|
|
|
|
|
1924 |
#: library/DigitalPointBetterAnalytics/ViewAdmin/reports/area_charts.php:57
|
1925 |
msgid "1 Month"
|
1926 |
msgstr ""
|
1927 |
|
1928 |
-
#: library/DigitalPointBetterAnalytics/ViewAdmin/dashboard.php:
|
1929 |
msgid "3 Months"
|
1930 |
msgstr ""
|
1931 |
|
1932 |
-
#: library/DigitalPointBetterAnalytics/ViewAdmin/dashboard.php:
|
1933 |
#: library/DigitalPointBetterAnalytics/ViewAdmin/reports/area_charts.php:58
|
1934 |
msgid "1 Year"
|
1935 |
msgstr ""
|
1936 |
|
1937 |
-
#: library/DigitalPointBetterAnalytics/ViewAdmin/dashboard.php:
|
1938 |
#: library/DigitalPointBetterAnalytics/ViewAdmin/reports/area_charts.php:60
|
1939 |
msgid "5 Years"
|
1940 |
msgstr ""
|
1941 |
|
1942 |
-
#: library/DigitalPointBetterAnalytics/ViewAdmin/dashboard.php:
|
1943 |
#: library/DigitalPointBetterAnalytics/ViewAdmin/reports/area_charts.php:61
|
1944 |
msgid "10 Years"
|
1945 |
msgstr ""
|
1946 |
|
1947 |
-
#: library/DigitalPointBetterAnalytics/ViewAdmin/dashboard.php:
|
1948 |
msgid "active users"
|
1949 |
msgstr ""
|
1950 |
|
@@ -2557,14 +2561,14 @@ msgid "Display the most popular content right now."
|
|
2557 |
msgstr ""
|
2558 |
|
2559 |
#: library/DigitalPointBetterAnalytics/Widget/PopularPosts.php:48
|
2560 |
-
#: library/DigitalPointBetterAnalytics/Widget/Stats.php:
|
2561 |
msgid ""
|
2562 |
"No Linked Google Analytics Account (API access required for this widget). "
|
2563 |
"You can link one in the %1$sBetter Analytics API settings%2$s."
|
2564 |
msgstr ""
|
2565 |
|
2566 |
#: library/DigitalPointBetterAnalytics/Widget/PopularPosts.php:53
|
2567 |
-
#: library/DigitalPointBetterAnalytics/Widget/Stats.php:
|
2568 |
msgid "Title:"
|
2569 |
msgstr ""
|
2570 |
|
@@ -2580,20 +2584,28 @@ msgstr ""
|
|
2580 |
msgid "Display your Analytics stats publicly."
|
2581 |
msgstr ""
|
2582 |
|
2583 |
-
#: library/DigitalPointBetterAnalytics/Widget/Stats.php:
|
2584 |
msgid "Number of days to show:"
|
2585 |
msgstr ""
|
2586 |
|
2587 |
-
#: library/DigitalPointBetterAnalytics/Widget/Stats.php:
|
2588 |
msgid "HTML Format For Widget:"
|
2589 |
msgstr ""
|
2590 |
|
2591 |
-
#: library/DigitalPointBetterAnalytics/Widget/Stats.php:
|
2592 |
msgid ""
|
2593 |
"You can add HTML formatting here if you wish. %1$s = metric name, %2$s = "
|
2594 |
"value"
|
2595 |
msgstr ""
|
2596 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2597 |
#. Plugin URI of the plugin/theme
|
2598 |
msgid "https://marketplace.digitalpoint.com/better-analytics.3354/item"
|
2599 |
msgstr ""
|
2 |
# This file is distributed under the same license as the Better Analytics package.
|
3 |
msgid ""
|
4 |
msgstr ""
|
5 |
+
"Project-Id-Version: Better Analytics 1.0.8\n"
|
6 |
"Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/better-analytics\n"
|
7 |
+
"POT-Creation-Date: 2015-07-24 16:30:44+00:00\n"
|
8 |
"MIME-Version: 1.0\n"
|
9 |
"Content-Type: text/plain; charset=UTF-8\n"
|
10 |
"Content-Transfer-Encoding: 8bit\n"
|
68 |
msgid "Test Setup"
|
69 |
msgstr ""
|
70 |
|
71 |
+
#. #-#-#-#-# plugin.pot (Better Analytics 1.0.8) #-#-#-#-#
|
72 |
#. Plugin Name of the plugin/theme
|
73 |
#: library/DigitalPointBetterAnalytics/Base/Admin.php:106
|
74 |
#: library/DigitalPointBetterAnalytics/Base/Admin.php:199
|
266 |
msgstr ""
|
267 |
|
268 |
#: library/DigitalPointBetterAnalytics/ControllerAdmin/Analytics.php:54
|
269 |
+
#: library/DigitalPointBetterAnalytics/ViewAdmin/dashboard.php:82
|
270 |
msgid "Real-time"
|
271 |
msgstr ""
|
272 |
|
1593 |
msgid "Taboola"
|
1594 |
msgstr ""
|
1595 |
|
1596 |
+
#. #-#-#-#-# plugin.pot (Better Analytics 1.0.8) #-#-#-#-#
|
1597 |
#. Author of the plugin/theme
|
1598 |
#: library/DigitalPointBetterAnalytics/ViewAdmin/config.php:657
|
1599 |
msgid "Digital Point"
|
1913 |
msgstr ""
|
1914 |
|
1915 |
#: library/DigitalPointBetterAnalytics/ViewAdmin/dashboard.php:63
|
1916 |
+
msgid "1 Day"
|
1917 |
msgstr ""
|
1918 |
|
1919 |
#: library/DigitalPointBetterAnalytics/ViewAdmin/dashboard.php:64
|
1920 |
+
msgid "7 Days"
|
1921 |
msgstr ""
|
1922 |
|
1923 |
#: library/DigitalPointBetterAnalytics/ViewAdmin/dashboard.php:65
|
1924 |
+
msgid "14 Days"
|
1925 |
+
msgstr ""
|
1926 |
+
|
1927 |
+
#: library/DigitalPointBetterAnalytics/ViewAdmin/dashboard.php:66
|
1928 |
#: library/DigitalPointBetterAnalytics/ViewAdmin/reports/area_charts.php:57
|
1929 |
msgid "1 Month"
|
1930 |
msgstr ""
|
1931 |
|
1932 |
+
#: library/DigitalPointBetterAnalytics/ViewAdmin/dashboard.php:67
|
1933 |
msgid "3 Months"
|
1934 |
msgstr ""
|
1935 |
|
1936 |
+
#: library/DigitalPointBetterAnalytics/ViewAdmin/dashboard.php:68
|
1937 |
#: library/DigitalPointBetterAnalytics/ViewAdmin/reports/area_charts.php:58
|
1938 |
msgid "1 Year"
|
1939 |
msgstr ""
|
1940 |
|
1941 |
+
#: library/DigitalPointBetterAnalytics/ViewAdmin/dashboard.php:69
|
1942 |
#: library/DigitalPointBetterAnalytics/ViewAdmin/reports/area_charts.php:60
|
1943 |
msgid "5 Years"
|
1944 |
msgstr ""
|
1945 |
|
1946 |
+
#: library/DigitalPointBetterAnalytics/ViewAdmin/dashboard.php:70
|
1947 |
#: library/DigitalPointBetterAnalytics/ViewAdmin/reports/area_charts.php:61
|
1948 |
msgid "10 Years"
|
1949 |
msgstr ""
|
1950 |
|
1951 |
+
#: library/DigitalPointBetterAnalytics/ViewAdmin/dashboard.php:87
|
1952 |
msgid "active users"
|
1953 |
msgstr ""
|
1954 |
|
2561 |
msgstr ""
|
2562 |
|
2563 |
#: library/DigitalPointBetterAnalytics/Widget/PopularPosts.php:48
|
2564 |
+
#: library/DigitalPointBetterAnalytics/Widget/Stats.php:54
|
2565 |
msgid ""
|
2566 |
"No Linked Google Analytics Account (API access required for this widget). "
|
2567 |
"You can link one in the %1$sBetter Analytics API settings%2$s."
|
2568 |
msgstr ""
|
2569 |
|
2570 |
#: library/DigitalPointBetterAnalytics/Widget/PopularPosts.php:53
|
2571 |
+
#: library/DigitalPointBetterAnalytics/Widget/Stats.php:59
|
2572 |
msgid "Title:"
|
2573 |
msgstr ""
|
2574 |
|
2584 |
msgid "Display your Analytics stats publicly."
|
2585 |
msgstr ""
|
2586 |
|
2587 |
+
#: library/DigitalPointBetterAnalytics/Widget/Stats.php:93
|
2588 |
msgid "Number of days to show:"
|
2589 |
msgstr ""
|
2590 |
|
2591 |
+
#: library/DigitalPointBetterAnalytics/Widget/Stats.php:96
|
2592 |
msgid "HTML Format For Widget:"
|
2593 |
msgstr ""
|
2594 |
|
2595 |
+
#: library/DigitalPointBetterAnalytics/Widget/Stats.php:98
|
2596 |
msgid ""
|
2597 |
"You can add HTML formatting here if you wish. %1$s = metric name, %2$s = "
|
2598 |
"value"
|
2599 |
msgstr ""
|
2600 |
|
2601 |
+
#: library/DigitalPointBetterAnalytics/Widget/Stats.php:104
|
2602 |
+
msgid "Stats for current page only"
|
2603 |
+
msgstr ""
|
2604 |
+
|
2605 |
+
#: library/DigitalPointBetterAnalytics/Widget/Stats.php:110
|
2606 |
+
msgid "Private (adheres to role/author permissions)"
|
2607 |
+
msgstr ""
|
2608 |
+
|
2609 |
#. Plugin URI of the plugin/theme
|
2610 |
msgid "https://marketplace.digitalpoint.com/better-analytics.3354/item"
|
2611 |
msgstr ""
|
library/DigitalPointBetterAnalytics/Model/Widget.php
CHANGED
@@ -78,28 +78,65 @@ class DigitalPointBetterAnalytics_Model_Widget
|
|
78 |
|
79 |
foreach ($settings as $setting)
|
80 |
{
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
$split[0], // metric
|
87 |
-
'', // dimensions
|
88 |
-
'', // sort
|
89 |
-
@$split[1] // filters
|
90 |
-
);
|
91 |
}
|
92 |
|
93 |
-
|
94 |
{
|
95 |
-
$
|
96 |
-
|
97 |
-
|
98 |
-
|
99 |
-
intval(@$results['rows'][0][0]),
|
100 |
-
21600 // 6 hour cache
|
101 |
-
);
|
102 |
}
|
103 |
}
|
104 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
105 |
}
|
78 |
|
79 |
foreach ($settings as $setting)
|
80 |
{
|
81 |
+
if (empty($setting['this_page_only']))
|
82 |
+
{
|
83 |
+
$cacheKeys[] = self::getStatsWidgetStart($setting);
|
84 |
+
}
|
85 |
+
|
|
|
|
|
|
|
|
|
|
|
86 |
}
|
87 |
|
88 |
+
if ($cacheKeys)
|
89 |
{
|
90 |
+
foreach ($cacheKeys as $cacheKey)
|
91 |
+
{
|
92 |
+
self::getStatsWidgetEnd($setting, $cacheKey);
|
93 |
+
}
|
|
|
|
|
|
|
94 |
}
|
95 |
}
|
96 |
}
|
97 |
+
|
98 |
+
public static function getStatsWidgetStart($setting, $uri = '')
|
99 |
+
{
|
100 |
+
if (!$uri)
|
101 |
+
{
|
102 |
+
$uri = $_SERVER['REQUEST_URI'];
|
103 |
+
}
|
104 |
+
|
105 |
+
$split = explode('|', $setting['metric']);
|
106 |
+
|
107 |
+
if (!empty($setting['this_page_only']))
|
108 |
+
{
|
109 |
+
@$split[1] .= (empty($split[1]) ? '' : ';') . 'ga:pagePath==' . $uri;
|
110 |
+
}
|
111 |
+
|
112 |
+
return DigitalPointBetterAnalytics_Helper_Reporting::getInstance()->getData(
|
113 |
+
absint($setting['days']) . 'daysAgo',
|
114 |
+
'yesterday',
|
115 |
+
$split[0], // metric
|
116 |
+
'', // dimensions
|
117 |
+
'', // sort
|
118 |
+
@$split[1] // filters
|
119 |
+
);
|
120 |
+
}
|
121 |
+
|
122 |
+
public static function getStatsWidgetEnd($setting, $cacheKey, $uri = '')
|
123 |
+
{
|
124 |
+
if (!$uri)
|
125 |
+
{
|
126 |
+
$uri = $_SERVER['REQUEST_URI'];
|
127 |
+
}
|
128 |
+
|
129 |
+
$results = DigitalPointBetterAnalytics_Helper_Reporting::getInstance()->getResults($cacheKey);
|
130 |
+
|
131 |
+
$value = intval(@$results['rows'][0][0]);
|
132 |
+
|
133 |
+
set_transient(
|
134 |
+
'ba_stats_' . md5(@$setting['metric'] . '-' . @$setting['days'] . '-' . (@$setting['this_page_only'] ? $uri : '')),
|
135 |
+
$value,
|
136 |
+
21600 // 6 hour cache
|
137 |
+
);
|
138 |
+
|
139 |
+
return $value;
|
140 |
+
}
|
141 |
+
|
142 |
}
|
library/DigitalPointBetterAnalytics/ViewAdmin/dashboard.php
CHANGED
@@ -60,6 +60,7 @@ else
|
|
60 |
|
61 |
|
62 |
$chartDays = array(
|
|
|
63 |
'7' => esc_html__('7 Days', 'better-analytics'),
|
64 |
'14' => esc_html__('14 Days', 'better-analytics'),
|
65 |
'30' => esc_html__('1 Month', 'better-analytics'),
|
60 |
|
61 |
|
62 |
$chartDays = array(
|
63 |
+
'1' => esc_html__('1 Day', 'better-analytics'),
|
64 |
'7' => esc_html__('7 Days', 'better-analytics'),
|
65 |
'14' => esc_html__('14 Days', 'better-analytics'),
|
66 |
'30' => esc_html__('1 Month', 'better-analytics'),
|
library/DigitalPointBetterAnalytics/Widget/Stats.php
CHANGED
@@ -44,6 +44,8 @@ class DigitalPointBetterAnalytics_Widget_Stats extends WP_Widget {
|
|
44 |
$metric = isset($instance['metric']) ? $instance['metric'] : 'ga:sessions';
|
45 |
$days = isset($instance['days']) ? absint( $instance['days'] ) : 1;
|
46 |
$format = isset($instance['format']) ? $instance['format'] : '%1$s: <strong>%2$s</strong>';
|
|
|
|
|
47 |
|
48 |
$betterAnalyticsOptions = get_option('better_analytics');
|
49 |
|
@@ -94,9 +96,19 @@ class DigitalPointBetterAnalytics_Widget_Stats extends WP_Widget {
|
|
94 |
<p><label for="<?php echo $this->get_field_id('format'); ?>"><?php esc_html_e('HTML Format For Widget:', 'better-analytics'); ?></label>
|
95 |
<textarea id="<?php echo $this->get_field_id('format'); ?>" name="<?php echo $this->get_field_name('format'); ?>" type="text" style="display:block;width:100%"><?php echo esc_textarea($format); ?></textarea>
|
96 |
<span class="description"><?php esc_html_e('You can add HTML formatting here if you wish. %1$s = metric name, %2$s = value', 'better-analytics'); ?></span>
|
|
|
97 |
|
|
|
|
|
|
|
|
|
98 |
</p>
|
99 |
|
|
|
|
|
|
|
|
|
|
|
100 |
|
101 |
<?php
|
102 |
}
|
@@ -107,6 +119,8 @@ class DigitalPointBetterAnalytics_Widget_Stats extends WP_Widget {
|
|
107 |
$instance['days'] = absint($new_instance['days']);
|
108 |
$instance['format'] = $new_instance['format'];
|
109 |
$instance['metric'] = $new_instance['metric'];
|
|
|
|
|
110 |
|
111 |
if (!DigitalPointBetterAnalytics_Model_Reporting::getMetricNameByKey($instance['metric']))
|
112 |
{
|
@@ -122,7 +136,21 @@ class DigitalPointBetterAnalytics_Widget_Stats extends WP_Widget {
|
|
122 |
|
123 |
function widget($args, $instance)
|
124 |
{
|
125 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
126 |
|
127 |
if (!empty($stats))
|
128 |
{
|
@@ -137,9 +165,7 @@ class DigitalPointBetterAnalytics_Widget_Stats extends WP_Widget {
|
|
137 |
}
|
138 |
printf($instance['format'], $metricTitle, number_format_i18n($stats));
|
139 |
echo $args['after_widget'];
|
140 |
-
|
141 |
}
|
142 |
-
|
143 |
}
|
144 |
|
145 |
static function register_widget()
|
44 |
$metric = isset($instance['metric']) ? $instance['metric'] : 'ga:sessions';
|
45 |
$days = isset($instance['days']) ? absint( $instance['days'] ) : 1;
|
46 |
$format = isset($instance['format']) ? $instance['format'] : '%1$s: <strong>%2$s</strong>';
|
47 |
+
$thisPageOnly = (isset($instance['this_page_only']) ? $instance['this_page_only'] : '');
|
48 |
+
$private = (isset($instance['private']) ? $instance['private'] : '');
|
49 |
|
50 |
$betterAnalyticsOptions = get_option('better_analytics');
|
51 |
|
96 |
<p><label for="<?php echo $this->get_field_id('format'); ?>"><?php esc_html_e('HTML Format For Widget:', 'better-analytics'); ?></label>
|
97 |
<textarea id="<?php echo $this->get_field_id('format'); ?>" name="<?php echo $this->get_field_name('format'); ?>" type="text" style="display:block;width:100%"><?php echo esc_textarea($format); ?></textarea>
|
98 |
<span class="description"><?php esc_html_e('You can add HTML formatting here if you wish. %1$s = metric name, %2$s = value', 'better-analytics'); ?></span>
|
99 |
+
</p>
|
100 |
|
101 |
+
<p>
|
102 |
+
<label for="<?php echo $this->get_field_id('this_page_only'); ?>">
|
103 |
+
<input id="<?php echo $this->get_field_id('this_page_only'); ?>" name="<?php echo $this->get_field_name( 'this_page_only' ); ?>" type="checkbox" value="1" <?php checked('1', $thisPageOnly ); ?>>
|
104 |
+
<?php esc_html_e('Stats for current page only', 'better-analytics');?></label>
|
105 |
</p>
|
106 |
|
107 |
+
<p>
|
108 |
+
<label for="<?php echo $this->get_field_id('private'); ?>">
|
109 |
+
<input id="<?php echo $this->get_field_id('private'); ?>" name="<?php echo $this->get_field_name( 'private' ); ?>" type="checkbox" value="1" <?php checked('1', $private ); ?>>
|
110 |
+
<?php esc_html_e('Private (adheres to role/author permissions)', 'better-analytics');?></label>
|
111 |
+
</p>
|
112 |
|
113 |
<?php
|
114 |
}
|
119 |
$instance['days'] = absint($new_instance['days']);
|
120 |
$instance['format'] = $new_instance['format'];
|
121 |
$instance['metric'] = $new_instance['metric'];
|
122 |
+
$instance['this_page_only'] = $new_instance['this_page_only'];
|
123 |
+
$instance['private'] = $new_instance['private'];
|
124 |
|
125 |
if (!DigitalPointBetterAnalytics_Model_Reporting::getMetricNameByKey($instance['metric']))
|
126 |
{
|
136 |
|
137 |
function widget($args, $instance)
|
138 |
{
|
139 |
+
if (!empty($instance['private']))
|
140 |
+
{
|
141 |
+
if (!DigitalPointBetterAnalytics_Base_Public::getInstance()->canViewReports())
|
142 |
+
{
|
143 |
+
return;
|
144 |
+
}
|
145 |
+
}
|
146 |
+
|
147 |
+
$stats = get_transient('ba_stats_' . md5(@$instance['metric'] . '-' . @$instance['days'] . '-' . (@$instance['this_page_only'] ? $_SERVER['REQUEST_URI'] : '')));
|
148 |
+
|
149 |
+
if (@$stats === false && !empty($instance['this_page_only']))
|
150 |
+
{
|
151 |
+
$cacheKey = DigitalPointBetterAnalytics_Model_Widget::getStatsWidgetStart($instance);
|
152 |
+
$stats = DigitalPointBetterAnalytics_Model_Widget::getStatsWidgetEnd($instance, $cacheKey);
|
153 |
+
}
|
154 |
|
155 |
if (!empty($stats))
|
156 |
{
|
165 |
}
|
166 |
printf($instance['format'], $metricTitle, number_format_i18n($stats));
|
167 |
echo $args['after_widget'];
|
|
|
168 |
}
|
|
|
169 |
}
|
170 |
|
171 |
static function register_widget()
|
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
|
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.2.
|
7 |
-
Stable tag: 1.0.
|
8 |
License: GPLv2
|
9 |
License URI: https://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
@@ -183,6 +183,12 @@ Thank you to all the individuals who have contributed translations for Better Go
|
|
183 |
22. Advanced settings allow you to fine tune how the system works with Google Analytics.
|
184 |
|
185 |
== Changelog ==
|
|
|
|
|
|
|
|
|
|
|
|
|
186 |
= 1.0.8 =
|
187 |
* Made a few minor cosmetic changes to Google Analytics Goal list view (including responsive)
|
188 |
* Moved Web Property ID slot on Test Setup tool to make it clear a new Web Property can be automatically created if needed (new site)
|
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
|
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.2.3
|
7 |
+
Stable tag: 1.0.9
|
8 |
License: GPLv2
|
9 |
License URI: https://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
183 |
22. Advanced settings allow you to fine tune how the system works with Google Analytics.
|
184 |
|
185 |
== Changelog ==
|
186 |
+
= 1.0.9 =
|
187 |
+
* Google Analytics Stats Widget has two new options that allows you to show stats on a per page basis if you want as well as making the widget private (only viewable to certain roles)
|
188 |
+
* Disallow PHP auto_append_file directive within the JavaScript loader
|
189 |
+
* Added a 1 Day option for the Google Analytics dashboard widget
|
190 |
+
* Works with WordPress 4.2.3
|
191 |
+
|
192 |
= 1.0.8 =
|
193 |
* Made a few minor cosmetic changes to Google Analytics Goal list view (including responsive)
|
194 |
* Moved Web Property ID slot on Test Setup tool to make it clear a new Web Property can be automatically created if needed (new site)
|