Viewing 7 replies - 1 through 7 (of 7 total)
  • Plugin Author Ajay

    (@ajay)

    Are you thinking about not tracking if they come from a particular user agent or IP?

    I don’t have a way yet, but I think you could remove the wp_enqueue_scripts action which is called by \\WebberZone\Top_Ten\Tracker->enqueue_scripts()

    https://github.com/WebberZone/top-10/blob/master/includes/class-tracker.php#L31

    Thread Starter fidoboy

    (@fidoboy)

    Yes. What I want to do is the same that the options to don’t track administrators or other user roles. I want to exclude a given user agent string or a given IP from the statistics, so it doesn’t count at all as a visit.

    Thread Starter fidoboy

    (@fidoboy)

    Dequeue scripts doesn’t have any sense on this issue, because the user agent string is client side information and you are talking about changes into the rendered page, server-side.

    The issue is on the part where the hit is counted into the DB.

    Plugin Author Ajay

    (@ajay)

    Are you thinking about doing this via JS?

    I haven’t done this but I thought PHP had this via $_SERVER['HTTP_USER_AGENT']

    Thread Starter fidoboy

    (@fidoboy)

    Yes. You can add the feature with that and adding a new option, into the settings page, to allow adding one or more user agent strings. If the user agent match then it souldn’t be counted.

    • This reply was modified 10 months, 2 weeks ago by fidoboy.
    Thread Starter fidoboy

    (@fidoboy)

    Of course it also can be accomplished if you add a filter to allow to hook an action just before the visit is going to be counted into the DB. If the filter returns false, then the visit is not stored into DB. That way any user, like me, could use $_SERVER['HTTP_USER_AGENT'] or what they want to decide if the hit is stored or not. Both ways requires that you make small changes into the source code of this plugin. I prefer to have an option into the settings page to allow adding one or more user agent strings (using wildcards or regex expression also) but make it as you wish. The other alternative, using add_filter/add_action is also valid.

    Plugin Author Ajay

    (@ajay)

    I like the idea of a filter. Implemented in GitHub. A user can hook into there.

    https://github.com/WebberZone/top-10/blob/master/includes/class-tracker.php#L286

    I’m not keen on adding a lot more options into the free version. I’ll be releasing a pro version of Top 10 later this year and working out the roadmap for that currently.

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Hook or filter to allow exclusions by user agent?’ is closed to new replies.