Support » Plugin: WordPress Popular Posts » Don’t count page-refreshs (F5-Button)

  • Resolved hobbyinvestor

    (@hobbyinvestor)


    I deployed the plugin on one page. It bothers me that every page refresh (pressing F5) triggers a count on the view-count.
    If a user presses the F5 key 10 times, then the post has 10 views.
    But I don’t want that. A post called by a visitor should also count only once.
    How can I achieve this?

    When i user Super Cache, than the counter is not counting when i press the F5 Button. But is maybe caching – and count later?

    Thanks

    • This topic was modified 2 months, 3 weeks ago by hobbyinvestor.

    The page I need help with: [log in to see the link]

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author Héctor Cabrera

    (@hcabrera)

    Hi @hobbyinvestor,

    If a user presses the F5 key 10 times, then the post has 10 views.
    But I don’t want that. A post called by a visitor should also count only once.
    How can I achieve this?

    Unfortunately the plugin doesn’t provide such feature. What you’re asking sounds like the Visitors vs Unique Pageviews as seen on Google Analytics for example which is of course a far more advanced analytics tool than what WordPress Popular Posts (from now on just WPP) can currently provide.

    The feature (unique pageviews by visitor) can be implemented as the plugin provides some hooks that can be leveraged for that – but you’d need to code it in yourself (or find a developer who can help with that.) See the Wiki for more details.

    When i user Super Cache, than the counter is not counting when i press the F5 Button. But is maybe caching – and count later?

    It seems it’s not counting visits at all. Please read Is WordPress Popular Posts compatible with caching plugins? to make sure WPP can work with WP Super Cache.

    Edit: out of curiosity I just checked one of the articles from your website and WPP was able to track my visit normally. Not sure what you mean with “the counter is not counting” so please elaborate.

    If you have any other questions don’t hesitate to ask.

    Thread Starter hobbyinvestor

    (@hobbyinvestor)

    Thanks, i checked the wiki and i found the hook wpp_pre_update_views. Is this usfull for me?
    I add the hook to the child theme funkctions.php file, like this, or?:

    function do_magic_stuff() {
    // my code here
    }
    add_action( ‘wpp_pre_update_views’, ‘do_magic_stuff’ );

    Are there some parameters like the current post-id?
    Do you have maybe a code-snippet for using wpp_pre_update_views?

    My idea is to store User-IP and Post-id in a db table and check the entries before i trigger popular post counter and flush my table every hour.
    Or, do you have maybe a better idea?

    Thank you very much
    Sebastian

    Plugin Author Héctor Cabrera

    (@hcabrera)

    Are there some parameters like the current post-id?

    Yep, check the Arguments part of the documentation and you’ll find the available parameters (if any) for each hook.

    Or, do you have maybe a better idea?

    Honestly couldn’t say at the moment. Haven’t really tried to tackle this specific issue but I guess your idea sounds good enough. You’ll need to try it out yourself and share your experiences when you’re done so others can learn from it (me included.)

Viewing 3 replies - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.