• Resolved Fernanda

    (@fcthiesen)


    hello there. is there a way to not track page views if it’s coming from a logged in user? thanks.

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author Patrick Robrecht

    (@patrickrobrecht)

    Hello Fernanda,

    if you haven’t changed the default behavior (using the hook statify__skip_tracking), Statify will not track views by logged in users (cp. Statify, FAQ section, 1st question).

    Cheers
    Patrick

    Plugin Support Stefan Kalscheuer

    (@stklcode)

    Edit: Oops, I read over the word “not“…
    Answer below solves the opposite, track uathenticated users ??

    ———-

    Yes, adding something simple like
    return is_logged_in() ? true : null;
    but be aware that this skips all following default filters is a user is logged in. Consider picking some additional filters from the highlighted lines:
    https://github.com/pluginkollektiv/statify/blob/master/inc/class-statify-frontend.php#L161-L175

    Assuming authenticated users are usually no spam bots or crawlers, a simple error and feed exclusion might do the job here:

    add_filter(
        'statify__skip_tracking',
        function() {
            if ( is_logged_in() ) {
                // Track logged in users, excluding feed, preview, error and search (skip otherwise)
                return !is_feed() && !is_preview() && !is_404() && !is_search();
            }
    	
            // Continue regular processing.
            return null;
        }
    );
    • This reply was modified 6 years, 2 months ago by Stefan Kalscheuer. Reason: Answered wrong question
    Thread Starter Fernanda

    (@fcthiesen)

    Perfect, thanks for the quick replies. I guess the plug-in comes with the settings I need as default. ??

    thank you for your work and this nice plug-in.

    cheers!

    Fernanda

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Logged in users’ is closed to new replies.