• Resolved Brent Wilson

    (@bwbama)


    Do URL parameters impact if a page view is counted? For example, if an article is shared on Facebook and a user clicks, the URL usually has a parameter added, ?fbclid.

    One thing I seem to be noticing is if a post or page is shared on Facebook and the majority of the traffic comes from people clicking out via Facebook, then the view count isn’t updated. I have one article that isn’t showing hardly any views, yet should be number one on my list today.

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author Hector Cabrera

    (@hcabrera)

    Hi @bwbama,

    URL parameters have no effect whatsoever on how WPP tracks page views. Your issue is likely being caused by something else, can’t say what exactly though without more details.

    Thread Starter Brent Wilson

    (@bwbama)

    It appears to be an issue with Cloudflare APO: https://support.cloudflare.com/hc/en-us/articles/360049822312-Understanding-Automatic-Platform-Optimization-APO-with-WordPress

    Is there some kind of nonce set that expires?

    It seems after a certain amount of time of the page being cached a 403 is returned:

    POST wpp.min.js?ver=5.2.4:1 POST https://www.bamapolitics.com/wp-json/wordpress-popular-posts/v1/popular-posts 403

    • This reply was modified 3 years, 7 months ago by Brent Wilson.
    Plugin Author Hector Cabrera

    (@hcabrera)

    Yes, WordPress Popular Posts uses a nonce when updating the views count of a post / page for security reasons (the REST API itself, which WPP uses to perform the views count update, requires that for the same reasons.)

    This nonce expires roughly every 24 hours. Because of that any sort of caching system you use on your website (a caching plugin, or CloudFlare’s APO in this case) needs to be regenerated every 24 hours or less, otherwise if the browser loads a cached post/page that’s over 24 hours old it’ll contain an expired nonce. When WPP attempts to use it to update the post/page views count the REST API will reject the request because the nonce is -as explained earlier- no longer valid, hence the 403 Forbidden error message you’re seeing.

    So, if you want to continue using WPP in conjunction with CF’s APO (or any other plugin that relies on nonces, like Contact Form 7 and many others) please make sure that APO’s cache expires at least every 24 hours (twice a day is what I recommend.)

    • This reply was modified 3 years, 7 months ago by Hector Cabrera. Reason: Included explanation about the 403 error
    Plugin Author Hector Cabrera

    (@hcabrera)

    Marking as resolved due to inactivity.

    OP if you still need a hand with this please feel free to leave a comment below.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘How does WPP count a view?’ is closed to new replies.