Viewing 7 replies - 1 through 7 (of 7 total)
  • Plugin Support Torsten Landsiedel

    (@zodiac1978)

    The default is, that logged in users are not tracked. But you can use the filter statify_skip_tracking to change that.

    All the best,
    Torsten

    Thread Starter sisamlimamzuri

    (@sisamlimamzuri)

    Hallo Torsten, where can I define this filter?

    Plugin Support Torsten Landsiedel

    (@zodiac1978)

    In a functions.php file from your (child) theme or you can make a functionality plugin out of it:

    // See: https://github.com/pluginkollektiv/statify/blob/ff86f46553b55691df4f4854c02f39d37259b346/inc/statify_frontend.class.php#L106-L119
    // See: https://github.com/pluginkollektiv/statify/wiki/Hooks
    add_filter(
        'statify_skip_tracking',
        function() {
            /* Skip tracking via User Agent */
            if ( ! isset($_SERVER['HTTP_USER_AGENT']) OR ! preg_match('/(?:Windows|Macintosh|Linux|iPhone|iPad)/', $_SERVER['HTTP_USER_AGENT']) ) {
                return true;
            }
            /* Skip tracking via Conditional_Tags */
            return ( is_feed() OR is_trackback() OR is_robots() OR is_preview() OR is_404() OR is_search() );
        }
    );

    We duplicate the check for the filter and omit the check for logged in users.

    All the best,
    Torsten

    Thread Starter sisamlimamzuri

    (@sisamlimamzuri)

    Hallo Torsten,

    I’m not really an expert in doing things like this. But I found this

    /* Skip tracking via Conditional_Tags */
            return ( is_feed() OR is_trackback() OR is_robots() OR is_preview() OR is_404() OR is_search() );

    in the statify/inc/statify_frontend.class.php.
    I deleted “OR is_user_logged_in()” and it works.

    Thank you very much!

    It would be wonderfull, if I could skip my own trackings. I tried to ad “OR is_administrator” – but that doesn’t work. )-:

    It’s not so important, but it would be nice. Can you help me second time?

    Greetings from Sisam

    Plugin Support Torsten Landsiedel

    (@zodiac1978)

    You shouldn’t edit the plugin itself. The code in my last post does exactly the same but is update safe.

    It would be wonderfull, if I could skip my own trackings. I tried to ad “OR is_administrator” – but that doesn’t work. )-:

    There is no is_administrator function, but you can use current_user_can() for that.

    But you shouldn’t check for the role “administrator” but for a capability the admin has, see note in code:

    * While checking against particular roles in place of a capability is supported
    409
    * in part, this practice is discouraged as it may produce unreliable results.

    See also for capabilities you can use:
    http://codex.wordpress.org/Roles_and_Capabilities

    All the best,
    Torsten

    Thread Starter sisamlimamzuri

    (@sisamlimamzuri)

    The end of the Fahnenstange is erreicht.

    That means: I reached the end of my coding-knowledge and my english. I would prefer to continue the discussion about the problem in german.

    @torsten Landsiedel: Your name let me hope (-;

    Plugin Support Torsten Landsiedel

    (@zodiac1978)

    As these are the international forums we can’t switch to German here.

    But I’m happy to help you in German at http://de.forums.wordpress.org/

    Please open a thread there and post the link here, so I can follow-up.

    Thank you!

    All the best,
    Torsten

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Can Statify lount all hits?’ is closed to new replies.