diff --git a/CHANGELOG.md b/CHANGELOG.md index 562bafd..74e9165 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,7 +3,8 @@ All notable changes to this project will be documented in this file. This projec ## unreleased * Scaled datapoint size to number of records in dashboard widget to improve legibility -* Added JS source maps to avoid warnings with developer tools +* Added JS source maps to avoid warnings with developer tools +* Add JS snippet to output even if tracking is skipped to avoid caching problems ## 1.6.0 * Added hook statify__visit_saved which is fired after a visit was stored in the database. diff --git a/inc/statify_frontend.class.php b/inc/statify_frontend.class.php index 2fd1630..c9af358 100644 --- a/inc/statify_frontend.class.php +++ b/inc/statify_frontend.class.php @@ -145,11 +145,22 @@ private static function _skip_tracking() { } /** Skip tracking via Referrer check and Conditional_Tags. */ - return ( self::check_referrer() || is_feed() || is_trackback() || is_robots() - || is_preview() || is_user_logged_in() || is_404() || is_search() + return ( self::check_referrer() || is_trackback() || is_robots() || is_user_logged_in() + || self::_is_internal() ); } + /** + * Rules to detect internal calls to skip tracking and not print code snippet. + * + * @since 1.7.0 + * + * @return boolean $skip_hook TRUE if NO tracking is desired + */ + private static function _is_internal() { + return is_feed() || is_preview() || is_404() || is_search(); + } + /** * Compare the referrer url to the blacklist data. * De/activate this feature via settings in the Dashboard widget. @@ -264,8 +275,8 @@ public static function wp_footer() { return; } - /* Skip by rules */ - if ( self::_skip_tracking() ) { + /* Skip by internal rules (#84) */ + if ( self::_is_internal() ) { return; }