Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix #84: separate internal-rules from other skip_tracking rules #86

Merged
merged 1 commit into from
May 19, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
19 changes: 15 additions & 4 deletions inc/statify_frontend.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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;
}

Expand Down