• Resolved Andrew Miguelez

    (@andrewmiguelez)


    Strange, intermittent issue I’m dealing with.

    I noticed after a couple days from launching my site that WPP seemed to stop logging data on post views. So I cleared my WP Super Cache files and noticed that hits to the posts were logging views again in the plugin settings page. Sweet!

    Then a few days later, I noticed the same thing. Again, clearing cache files seemed to work. Again, same problem a few days later. The third time I tried this, I noticed that not all posts did resume working correctly so I’ve found out that you post messages to the console and I’ve been monitoring them.

    Some of my posts repeatedly show: “WPP: OK. Execution time: 0.001936 seconds
    While others repeatedly show: “WPP: Oops, invalid request!

    If I do nothing, later the same day some of the posts will swap and show the other message. But then it’s all they show, over and over. So something appears to be allowing certain posts to update their view count and others not. But the behavior seems sporadic.

    Is there any way to get more information from the “Oops, invalid request!” message? Have you seen this issue before? Any advice will be much appreciated.

Viewing 6 replies - 1 through 6 (of 6 total)
  • Thread Starter Andrew Miguelez

    (@andrewmiguelez)

    I’m sure you’re busy, no worries. I’m going to have to go a different route and try some other plugins. However, I would be happy to revisit if I get any suggestions or support on this topic.

    Aside from this issue I’m experiencing, I think you have a great plugin and I hope I can get it to work in the future.

    I have the same problem
    Any solution?

    Plugin Author Hector Cabrera

    (@hcabrera)

    Hey guys,

    WPP uses a security token each time it updates the views count to make sure that the request is coming from your site. If the security token is missing or doesn’t match the current one, WPP will throw that warning message.

    The only “normal” way this could happen is if a caching plugin is installed on your site and the cache expiry time is way too long, and in that case when the page loads it sends an already expired security token causing WPP to reject the request and send back that message.

    So, do you guys have a caching plugin installed on your site?

    Thread Starter Andrew Miguelez

    (@andrewmiguelez)

    Yes. You’ll notice in the original post I mention clearing my cache files manually.

    A site that doesn’t get updated more than a couple times a month gains nothing from a short cache expiry time. So is there a workaround for someone using caching longer than a day?

    Plugin Author Hector Cabrera

    (@hcabrera)

    So is there a workaround for someone using caching longer than a day?

    Unfortunately, no.

    WPP -as many other plugins out there, like Akismet and Contact Form 7- uses WordPress’ nonces to verify requests (eg. updating the views count of a post.) Nonces’ default lifetime -as far as I know- is around a day, after that it expires automatically and WordPress issues a new nonce.

    I believe it’s possible to extend the lifetime of WordPress nonces (which would fix your problem), however this is not recommended for security reasons: a malicious user might try using a cached nonce intended for someone else and exploit it for whatever reasons.

    TLDR;

    No, there’s no safe workaround for this. Please set your cache to expire in 24 hours or less so this plugin (and other you might have / might install in the future) can work on your site as intended.

    Thread Starter Andrew Miguelez

    (@andrewmiguelez)

    Thanks for the info. 24 hour cache time makes no sense for small sites with low traffic. Most hits wouldn’t be cached in that scenario. So if you’re trying to improve performance on a slow, shared server, you have no other option than to run a long cache expiry.

    FOR OTHERS DEALING WITH THE SAME:
    The Jetpack plugin uses JS to track views to pages/posts. This is basically the same thing that WPP is doing. However, Jetpack is able to maintain view count tracking throughout the entire cache cycle (regardless of timeframe). For those in the same boat, you may consider switching to Jetpack.

    Keep in mind that Jetpack does not give you the customization controls that WPP does. So if you want to style the popular posts, you’ll have to do a lot of digging and live-environment testing to get the look you want.

    If that sounds terrible (and it is) then stick with WPP and just ignore the fact that some of your views aren’t being tracked. The popular posts will still display and they will more or less be relatively accurate.

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘WPP: Oops, invalid request!’ is closed to new replies.