Version Description
Download this release
Release Info
| Developer | pluginkollektiv |
| Plugin | |
| Version | 1.8.1 |
| Comparing to | |
| See all releases | |
Code changes from version 1.8.0 to 1.8.1
- CHANGELOG.md +7 -0
- inc/class-statify-frontend.php +64 -28
- inc/class-statify.php +6 -3
- readme.txt +13 -2
- statify.php +2 -2
CHANGELOG.md
CHANGED
|
@@ -1,6 +1,13 @@
|
|
| 1 |
# Changelog
|
| 2 |
All notable changes to this project will be documented in this file. This project adheres to [Semantic Versioning](http://semver.org/).
|
| 3 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 4 |
## 1.8.0
|
| 5 |
* Fix date offset in dashboard widget in WP 5.3+ environments with mixed timezones (#167)
|
| 6 |
* Allow to deactivate the nonce check during JavaScript tracking (#168)
|
| 1 |
# Changelog
|
| 2 |
All notable changes to this project will be documented in this file. This project adheres to [Semantic Versioning](http://semver.org/).
|
| 3 |
|
| 4 |
+
## 1.8.1
|
| 5 |
+
* Fix AMP compatibility for Standard and Transitional mode (#181) (#182)
|
| 6 |
+
* JavaScript is no longer embedded if request is served by AMP (#181) (#182)
|
| 7 |
+
* Always register the action for the cleanup (#184)
|
| 8 |
+
* Exclude sitemap calls (WP 5.5+) from tracking (#185) (#186)
|
| 9 |
+
* Tested up to WordPress 5.6
|
| 10 |
+
|
| 11 |
## 1.8.0
|
| 12 |
* Fix date offset in dashboard widget in WP 5.3+ environments with mixed timezones (#167)
|
| 13 |
* Allow to deactivate the nonce check during JavaScript tracking (#168)
|
inc/class-statify-frontend.php
CHANGED
|
@@ -252,9 +252,10 @@ class Statify_Frontend extends Statify {
|
|
| 252 |
* @return boolean $skip_hook TRUE if NO tracking is desired
|
| 253 |
*/
|
| 254 |
private static function _is_internal() {
|
| 255 |
-
// Skip for preview, 404 calls, feed, search and
|
| 256 |
return is_preview() || is_404() || is_feed() || is_search()
|
| 257 |
-
|| ( function_exists( 'is_favicon' ) && is_favicon() )
|
|
|
|
| 258 |
}
|
| 259 |
|
| 260 |
/**
|
|
@@ -374,8 +375,12 @@ class Statify_Frontend extends Statify {
|
|
| 374 |
* @version 1.4.1
|
| 375 |
*/
|
| 376 |
public static function wp_footer() {
|
| 377 |
-
//
|
| 378 |
-
if (
|
|
|
|
|
|
|
|
|
|
|
|
|
| 379 |
return;
|
| 380 |
}
|
| 381 |
|
|
@@ -404,7 +409,30 @@ class Statify_Frontend extends Statify {
|
|
| 404 |
}
|
| 405 |
|
| 406 |
/**
|
| 407 |
-
* Add amp-analytics.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 408 |
*
|
| 409 |
* @see https://amp-wp.org/documentation/playbooks/analytics/
|
| 410 |
*
|
|
@@ -420,32 +448,40 @@ class Statify_Frontend extends Statify {
|
|
| 420 |
$analytics['statify'] = array(
|
| 421 |
'type' => '',
|
| 422 |
'attributes' => array(),
|
| 423 |
-
'config_data' =>
|
| 424 |
-
'extraUrlParams' => array(
|
| 425 |
-
'action' => 'statify_track',
|
| 426 |
-
'_ajax_nonce' => wp_create_nonce( 'statify_track' ),
|
| 427 |
-
'statify_referrer' => '${documentReferrer}',
|
| 428 |
-
'statify_target' => '${canonicalPath}amp/',
|
| 429 |
-
),
|
| 430 |
-
'requests' => array(
|
| 431 |
-
'event' => admin_url( 'admin-ajax.php' ),
|
| 432 |
-
),
|
| 433 |
-
'triggers' => array(
|
| 434 |
-
'trackPageview' => array(
|
| 435 |
-
'on' => 'visible',
|
| 436 |
-
'request' => 'event',
|
| 437 |
-
'vars' => array(
|
| 438 |
-
'eventId' => 'pageview',
|
| 439 |
-
),
|
| 440 |
-
),
|
| 441 |
-
),
|
| 442 |
-
'transport' => array(
|
| 443 |
-
'xhrpost' => true,
|
| 444 |
-
),
|
| 445 |
-
),
|
| 446 |
);
|
| 447 |
}
|
| 448 |
|
| 449 |
return $analytics;
|
| 450 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 451 |
}
|
| 252 |
* @return boolean $skip_hook TRUE if NO tracking is desired
|
| 253 |
*/
|
| 254 |
private static function _is_internal() {
|
| 255 |
+
// Skip for preview, 404 calls, feed, search, favicon and sitemap access.
|
| 256 |
return is_preview() || is_404() || is_feed() || is_search()
|
| 257 |
+
|| ( function_exists( 'is_favicon' ) && is_favicon() )
|
| 258 |
+
|| '' !== get_query_var( 'sitemap' ) || '' !== get_query_var( 'sitemap-stylesheet' );
|
| 259 |
}
|
| 260 |
|
| 261 |
/**
|
| 375 |
* @version 1.4.1
|
| 376 |
*/
|
| 377 |
public static function wp_footer() {
|
| 378 |
+
// JS tracking disabled or AMP is used for the current request.
|
| 379 |
+
if (
|
| 380 |
+
! self::is_javascript_tracking_enabled() ||
|
| 381 |
+
( function_exists( 'amp_is_request' ) && amp_is_request() ) ||
|
| 382 |
+
( function_exists( 'is_amp_endpoint' ) && is_amp_endpoint() )
|
| 383 |
+
) {
|
| 384 |
return;
|
| 385 |
}
|
| 386 |
|
| 409 |
}
|
| 410 |
|
| 411 |
/**
|
| 412 |
+
* Add amp-analytics for Standard and Transitional mode.
|
| 413 |
+
*
|
| 414 |
+
* @see https://amp-wp.org/documentation/playbooks/analytics/
|
| 415 |
+
*
|
| 416 |
+
* @param array $analytics_entries Analytics entries.
|
| 417 |
+
*/
|
| 418 |
+
public static function amp_analytics_entries( $analytics_entries ) {
|
| 419 |
+
if ( ! is_array( $analytics_entries ) ) {
|
| 420 |
+
$analytics_entries = array();
|
| 421 |
+
}
|
| 422 |
+
|
| 423 |
+
// Analytics script is only relevant, if "JS" tracking is enabled, to prevent double tracking.
|
| 424 |
+
if ( self::is_javascript_tracking_enabled() ) {
|
| 425 |
+
$analytics_entries['statify'] = array(
|
| 426 |
+
'type' => '',
|
| 427 |
+
'config' => wp_json_encode( self::make_amp_config() ),
|
| 428 |
+
);
|
| 429 |
+
}
|
| 430 |
+
|
| 431 |
+
return $analytics_entries;
|
| 432 |
+
}
|
| 433 |
+
|
| 434 |
+
/**
|
| 435 |
+
* Add AMP-analytics for Reader mode.
|
| 436 |
*
|
| 437 |
* @see https://amp-wp.org/documentation/playbooks/analytics/
|
| 438 |
*
|
| 448 |
$analytics['statify'] = array(
|
| 449 |
'type' => '',
|
| 450 |
'attributes' => array(),
|
| 451 |
+
'config_data' => self::make_amp_config(),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 452 |
);
|
| 453 |
}
|
| 454 |
|
| 455 |
return $analytics;
|
| 456 |
}
|
| 457 |
+
|
| 458 |
+
/**
|
| 459 |
+
* Generate AMP-analytics configuration.
|
| 460 |
+
*
|
| 461 |
+
* @return array Configuration array.
|
| 462 |
+
*/
|
| 463 |
+
private static function make_amp_config() {
|
| 464 |
+
return array(
|
| 465 |
+
'requests' => array(
|
| 466 |
+
'pageview' => admin_url( 'admin-ajax.php' ),
|
| 467 |
+
),
|
| 468 |
+
'extraUrlParams' => array(
|
| 469 |
+
'action' => 'statify_track',
|
| 470 |
+
'_ajax_nonce' => wp_create_nonce( 'statify_track' ),
|
| 471 |
+
'statify_referrer' => '${documentReferrer}',
|
| 472 |
+
'statify_target' => '${canonicalPath}amp/',
|
| 473 |
+
),
|
| 474 |
+
'triggers' => array(
|
| 475 |
+
'trackPageview' => array(
|
| 476 |
+
'on' => 'visible',
|
| 477 |
+
'request' => 'pageview',
|
| 478 |
+
),
|
| 479 |
+
),
|
| 480 |
+
'transport' => array(
|
| 481 |
+
'beacon' => true,
|
| 482 |
+
'xhrpost' => true,
|
| 483 |
+
'image' => false,
|
| 484 |
+
),
|
| 485 |
+
);
|
| 486 |
+
}
|
| 487 |
}
|
inc/class-statify.php
CHANGED
|
@@ -60,13 +60,14 @@ class Statify {
|
|
| 60 |
)
|
| 61 |
);
|
| 62 |
|
|
|
|
|
|
|
|
|
|
| 63 |
if ( defined( 'DOING_AJAX' ) && DOING_AJAX ) {
|
| 64 |
add_action( 'wp_ajax_nopriv_statify_track', array( 'Statify_Frontend', 'track_visit_ajax' ) );
|
| 65 |
add_action( 'wp_ajax_statify_track', array( 'Statify_Frontend', 'track_visit_ajax' ) );
|
| 66 |
} elseif ( defined( 'XMLRPC_REQUEST' ) && XMLRPC_REQUEST ) { // XMLRPC.
|
| 67 |
add_filter( 'xmlrpc_methods', array( 'Statify_XMLRPC', 'xmlrpc_methods' ) );
|
| 68 |
-
} elseif ( defined( 'DOING_CRON' ) && DOING_CRON ) { // Cron.
|
| 69 |
-
add_action( 'statify_cleanup', array( 'Statify_Cron', 'cleanup_data' ) );
|
| 70 |
} elseif ( is_admin() ) { // Backend.
|
| 71 |
add_action( 'wpmu_new_blog', array( 'Statify_Install', 'init_site' ) );
|
| 72 |
add_action( 'delete_blog', array( 'Statify_Uninstall', 'init_site' ) );
|
|
@@ -80,7 +81,9 @@ class Statify {
|
|
| 80 |
add_action( 'template_redirect', array( 'Statify_Frontend', 'track_visit' ) );
|
| 81 |
add_filter( 'query_vars', array( 'Statify_Frontend', 'query_vars' ) );
|
| 82 |
add_action( 'wp_footer', array( 'Statify_Frontend', 'wp_footer' ) );
|
| 83 |
-
if ( function_exists( '
|
|
|
|
|
|
|
| 84 |
add_filter( 'amp_post_template_analytics', array( 'Statify_Frontend', 'amp_post_template_analytics' ) );
|
| 85 |
}
|
| 86 |
}
|
| 60 |
)
|
| 61 |
);
|
| 62 |
|
| 63 |
+
// Cron.
|
| 64 |
+
add_action( 'statify_cleanup', array( 'Statify_Cron', 'cleanup_data' ) );
|
| 65 |
+
|
| 66 |
if ( defined( 'DOING_AJAX' ) && DOING_AJAX ) {
|
| 67 |
add_action( 'wp_ajax_nopriv_statify_track', array( 'Statify_Frontend', 'track_visit_ajax' ) );
|
| 68 |
add_action( 'wp_ajax_statify_track', array( 'Statify_Frontend', 'track_visit_ajax' ) );
|
| 69 |
} elseif ( defined( 'XMLRPC_REQUEST' ) && XMLRPC_REQUEST ) { // XMLRPC.
|
| 70 |
add_filter( 'xmlrpc_methods', array( 'Statify_XMLRPC', 'xmlrpc_methods' ) );
|
|
|
|
|
|
|
| 71 |
} elseif ( is_admin() ) { // Backend.
|
| 72 |
add_action( 'wpmu_new_blog', array( 'Statify_Install', 'init_site' ) );
|
| 73 |
add_action( 'delete_blog', array( 'Statify_Uninstall', 'init_site' ) );
|
| 81 |
add_action( 'template_redirect', array( 'Statify_Frontend', 'track_visit' ) );
|
| 82 |
add_filter( 'query_vars', array( 'Statify_Frontend', 'query_vars' ) );
|
| 83 |
add_action( 'wp_footer', array( 'Statify_Frontend', 'wp_footer' ) );
|
| 84 |
+
if ( function_exists( 'amp_is_request' ) || function_exists( 'is_amp_endpoint' ) ) {
|
| 85 |
+
// Automattic AMP plugin present.
|
| 86 |
+
add_filter( 'amp_analytics_entries', array( 'Statify_Frontend', 'amp_analytics_entries' ) );
|
| 87 |
add_filter( 'amp_post_template_analytics', array( 'Statify_Frontend', 'amp_post_template_analytics' ) );
|
| 88 |
}
|
| 89 |
}
|
readme.txt
CHANGED
|
@@ -3,9 +3,9 @@
|
|
| 3 |
* Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=TD4AMD2D8EMZW
|
| 4 |
* Tags: analytics, dashboard, pageviews, privacy, statistics, stats, visits, web stats, widget
|
| 5 |
* Requires at least: 4.7
|
| 6 |
-
* Tested up to: 5.
|
| 7 |
* Requires PHP: 5.2
|
| 8 |
-
* Stable tag: 1.8.
|
| 9 |
* License: GPLv3 or later
|
| 10 |
* License URI: https://www.gnu.org/licenses/gpl-3.0.html
|
| 11 |
|
|
@@ -65,6 +65,7 @@ If you've problems or think you’ve found a bug (e.g. you’re experiencing une
|
|
| 65 |
* views by logged in users (unless tracking is activated via the settings page)
|
| 66 |
* error pages
|
| 67 |
* favicon (as of WP 5.4)
|
|
|
|
| 68 |
|
| 69 |
This behavior can be modified with the `statify__skip_tracking` hook.
|
| 70 |
|
|
@@ -116,6 +117,13 @@ has to be added to the theme's `functions.php`. The condition has modified such
|
|
| 116 |
## Changelog ##
|
| 117 |
You can find the full changelog in [our GitHub repository](https://github.com/pluginkollektiv/statify/blob/master/CHANGELOG.md).
|
| 118 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 119 |
### 1.8.0
|
| 120 |
* Fix date offset in dashboard widget in WP 5.3+ environments with mixed timezones (#167)
|
| 121 |
* Allow to deactivate the nonce check during JavaScript tracking (#168)
|
|
@@ -155,6 +163,9 @@ For the complete changelog, check out our [GitHub repository](https://github.com
|
|
| 155 |
|
| 156 |
## Upgrade Notice ##
|
| 157 |
|
|
|
|
|
|
|
|
|
|
| 158 |
### 1.8.0 ###
|
| 159 |
Some minor improvements. The most important one: This version offers to deactivate the nonce check for JavaScript tracking (recommend if a caching plugin with a long caching time is used).
|
| 160 |
|
| 3 |
* Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=TD4AMD2D8EMZW
|
| 4 |
* Tags: analytics, dashboard, pageviews, privacy, statistics, stats, visits, web stats, widget
|
| 5 |
* Requires at least: 4.7
|
| 6 |
+
* Tested up to: 5.6
|
| 7 |
* Requires PHP: 5.2
|
| 8 |
+
* Stable tag: 1.8.1
|
| 9 |
* License: GPLv3 or later
|
| 10 |
* License URI: https://www.gnu.org/licenses/gpl-3.0.html
|
| 11 |
|
| 65 |
* views by logged in users (unless tracking is activated via the settings page)
|
| 66 |
* error pages
|
| 67 |
* favicon (as of WP 5.4)
|
| 68 |
+
* sitemap (as of WP 5.5)
|
| 69 |
|
| 70 |
This behavior can be modified with the `statify__skip_tracking` hook.
|
| 71 |
|
| 117 |
## Changelog ##
|
| 118 |
You can find the full changelog in [our GitHub repository](https://github.com/pluginkollektiv/statify/blob/master/CHANGELOG.md).
|
| 119 |
|
| 120 |
+
### 1.8.1
|
| 121 |
+
* Fix AMP compatibility for Standard and Transitional mode (#181) (#182)
|
| 122 |
+
* JavaScript is no longer embedded if request is served by AMP (#181) (#182)
|
| 123 |
+
* Always register the action for the cleanup (#184)
|
| 124 |
+
* Exclude sitemap calls (WP 5.5+) from tracking (#185) (#186)
|
| 125 |
+
* Tested up to WordPress 5.6
|
| 126 |
+
|
| 127 |
### 1.8.0
|
| 128 |
* Fix date offset in dashboard widget in WP 5.3+ environments with mixed timezones (#167)
|
| 129 |
* Allow to deactivate the nonce check during JavaScript tracking (#168)
|
| 163 |
|
| 164 |
## Upgrade Notice ##
|
| 165 |
|
| 166 |
+
### 1.8.1 ###
|
| 167 |
+
This is a bugfix release improving AMP compatibility and excluding native sitemaps as of WordPress 5.5. It is recommended for all users.
|
| 168 |
+
|
| 169 |
### 1.8.0 ###
|
| 170 |
Some minor improvements. The most important one: This version offers to deactivate the nonce check for JavaScript tracking (recommend if a caching plugin with a long caching time is used).
|
| 171 |
|
statify.php
CHANGED
|
@@ -7,7 +7,7 @@
|
|
| 7 |
* Author URI: https://pluginkollektiv.org
|
| 8 |
* Plugin URI: https://wordpress.org/plugins/statify/
|
| 9 |
* License: GPLv3 or later
|
| 10 |
-
* Version: 1.8.
|
| 11 |
*
|
| 12 |
* @package WordPress
|
| 13 |
*/
|
|
@@ -20,7 +20,7 @@ defined( 'ABSPATH' ) || exit;
|
|
| 20 |
define( 'STATIFY_FILE', __FILE__ );
|
| 21 |
define( 'STATIFY_DIR', dirname( __FILE__ ) );
|
| 22 |
define( 'STATIFY_BASE', plugin_basename( __FILE__ ) );
|
| 23 |
-
define( 'STATIFY_VERSION', '1.8.
|
| 24 |
|
| 25 |
|
| 26 |
/* Hooks */
|
| 7 |
* Author URI: https://pluginkollektiv.org
|
| 8 |
* Plugin URI: https://wordpress.org/plugins/statify/
|
| 9 |
* License: GPLv3 or later
|
| 10 |
+
* Version: 1.8.1
|
| 11 |
*
|
| 12 |
* @package WordPress
|
| 13 |
*/
|
| 20 |
define( 'STATIFY_FILE', __FILE__ );
|
| 21 |
define( 'STATIFY_DIR', dirname( __FILE__ ) );
|
| 22 |
define( 'STATIFY_BASE', plugin_basename( __FILE__ ) );
|
| 23 |
+
define( 'STATIFY_VERSION', '1.8.1' );
|
| 24 |
|
| 25 |
|
| 26 |
/* Hooks */
|
