• Resolved Sevil Yilmaz

    (@sevilyilmaz)


    Hello,

    We’ve been using WPP for a long time. But since last week it stopped working. I didn’t get any errors at all. But the view count looks zero as you can see it in here: https://www.evernote.com/l/AFbZz3F6NmJPoo_vz_76EzynqNcnp_qyO1Q

    I tried to reinstall the plugin but it didn’t work either.

    So I moved to another plugin until I find a solution to this.

    Do you have any ideas?

    Thanks,

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

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

    (@hcabrera)

    Hi @sevilyilmaz,

    That screenshot alone without any further info from you doesn’t tell me much, so please:

    1. Enable WordPress’ debugging options, enable WPP, visit any of your posts using another browser (or via Incognito Mode), and share the contents of your debug.log file (via pastebin or some other mean, please don’t paste it here).
    2. Go to Settings > WordPress Popular Posts, append &tab=debug to the URL in the address bar of your browser and hit Enter.
    3. Copy the information displayed on the Debug screen and share it here.
    Thread Starter Sevil Yilmaz

    (@sevilyilmaz)

    Here you go.

    This is the log file: https://pastebin.com/Vih7Et32

    And this is the debug screen: https://www.evernote.com/l/AFahaTIoZe1BQKeGT4cOmvLG-1ZZqansH80

    Please let me know if you need more information

    Plugin Author Hector Cabrera

    (@hcabrera)

    Thanks Sevil.

    I didn’t find anything related to WordPress Popular Posts in your debug log so my guess is that the culprit is the LiteSpeed cache plugin (see here, 4th point).

    How often does it regenerate your site’s cache?

    Thread Starter Sevil Yilmaz

    (@sevilyilmaz)

    The cache renews every week (default 604800 seconds).

    The problem started when I started using WP Fastest Cache to see the performance difference. After a while I moved to that we started losing views on the WPP stats. I checked GA but I couldn’t see any problems. Than I moved back to LS Cache plugin but as we can see that didn’t solve the problem.

    Plugin Author Hector Cabrera

    (@hcabrera)

    This right here is the problem:

    The cache renews every week (default 604800 seconds).

    WPP (and any other plugin that relies on nonces) won’t work on your site as it is now.

    Nonces are basically security tokens. WordPress’ nonces expire, by default, every 12 hours or so. When these expire, WordPress issues new nonces so plugins and themes can do whatever they need to do while using nonces.

    In WPP’s case, the plugin uses it to prevent malicious actors from inflating the views count of your posts and pages from outside your site.

    Since LiteSpeed is set to cache your posts & pages for a week, nonces expire and aren’t regenerated until LiteSpeed’s cache is rebuilt one week later. This means that all requests sent by WPP to the server are rejected because the security token (nonce) is invalid, and so WPP will refuse to update the views count of your posts and pages until the cache is regenerated a week later, and the cycle will repeat itself again.

    TLDR;

    Set LiteSpeed to expire its cache every 12 hours and you’re good to go. And make sure you clear its cache once after making this change so WPP can start tracking your visits right away.

    Thread Starter Sevil Yilmaz

    (@sevilyilmaz)

    Thanks for the insight. I did the change and am waiting to see the results.

    Plugin Author Hector Cabrera

    (@hcabrera)

    Hey @sevilyilmaz,

    No problem, glad to be of help.

    However, I just noticed that you may have enabled LiteSpeed’s JS minification feature. While it helps decrease the size of JS scripts, it might also break them in some scenarios.

    When WPP includes its script into your theme, it insert a few JS variables it needs in order to work. If the script can’t detect these variables, it won’t run. This is what’s going on on your site.

    Please go to LiteSpeed Cache > Settings, click on Advanced View, then on Tuning, and under JS Excludes add the following string: wordpress-popular-posts/public/js/wpp. Hit Save Changes when you’re done.

    You may need to clear LiteSpeed’s cache afterwards for changes to take effect. If so, then please go to LiteSpeed Cache > Manage and click on Purge All.

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘WPP stopped working’ is closed to new replies.