• Resolved essmeier

    (@essmeier)


    I’ve got a retail site that gets about 1000-1200 unique visitors a day.

    I’ve got WPP tracking a custom post type, called “product.”

    Over 30 days, it’s showing some 12,000 views Over 7 days, it’s showing 182.

    For the past 24 hours, it’s showing nothing.

    Sometime in the past week, WPP seems to have stopped counting views.

    Any idea what might cause this? I’ve made no changes to the site during this time.

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

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

    (@hcabrera)

    Hi @essmeier,

    The problem is that whenever WPP attempts to update the views count of your products WP’s REST API responds with a 403 Forbidden status and the message “Cookie nonce is invalid.”

    REST API 403 response

    This usually means that:

    1. You’re using a caching plugin on your site.
    2. Your caching plugin is set to regenerate its cache long after WP Nonces expire (nonces’ lifetime is roughly ~24 hours).

    If you are indeed using a caching plugin then either of the following solutions will solve the problem:

    • Have your caching plugin regenerate its cache every 24 hours (or less) to make sure that WPP can use valid/non-expired nonces when sending requests to your site’s REST API, or
    • Have your WP Nonces last at least as long as your site’s cache (example and documentation).
    Thread Starter essmeier

    (@essmeier)

    I’m not using a dedicated caching plugin, as I’ve had problems with them on this site.

    I do have Jetpack installed, as my shopping cart system (Woocommerce) seems to require it. As far as I know, Jetpack only caches images.

    I’m also using Cloudflare, which I believe has a cache life of 2 hours for the plan I”m using.

    Just not sure what, if anything, I need to adjust there.

    I’ll try turning off the Jetpack Site Accelerator and see if that helps.

    Thread Starter essmeier

    (@essmeier)

    Turning off Jetpack Site Accelerator made no difference.

    I did see that Woocommerce allows me to generate a Rest API key for third-party applications, but I don’t know if that applies here, or what I would do with it.

    Plugin Author Hector Cabrera

    (@hcabrera)

    No idea to be honest. I don’t think that will make a difference since WPP uses its own REST API endpoints to send/request data from your site. I think that that mostly applies to plugins/services fetching/pushing data directly from/to WC’s REST API endpoints.

    If you have a staging/development version of your website, try disabling all of your plugins (except for WPP and maybe WC), then visit one of your products. If everything went fine, you should see your visit reflected on WPP’s Stats dashboard right away. If that’s the case, then one of your plugins may be causing the issue. Otherwise you may also try switching to a different theme for a moment (eg. Storefront) and repeat the process.

    Thread Starter essmeier

    (@essmeier)

    Woocommerce is the problem.

    There was a recent update to Woocommerce that had massive changes, so I thought I would look there first.

    Current version of Woocommerce is 3.6.2. I reverted to 3.5.8 and WPP is working again.

    Apparently, the current version of Woocommerce (3.6 or greater) is the source of the conflict.

    Reverting to an old version of Woo fixes the problem…temporarily. As I have a retail site, I sort of need to keep Woocommerce current. Having WPP also working would be nice.

    I hope you can find a fix for this. Thanks for the help!

    Plugin Author Hector Cabrera

    (@hcabrera)

    Alright, that’s a good starting point although if WC is the issue then chances are the fix is on their side. I’ll run some tests and get back to you later.

    Plugin Author Hector Cabrera

    (@hcabrera)

    Alright, just set up a demo shop on my local server using the latest version of everything and WPP can track visits to products just fine:

    WPP with WooCommerce

    Setup:

    • WordPress 5.1.1
    • Active plugins: Jetpack by WordPress.com 7.2.1, WooCommerce 3.6.2, WooCommerce PayPal Checkout Gateway 1.6.11, WooCommerce Services 1.19.0, WooCommerce Stripe Gateway 4.1.16, WordPress Popular Posts 4.2.2.

    So I’m not sure WC is to blame here.

    Oddly enough, I just checked one of your products and WPP was able to register my visit normally:

    WPP on rarerecords.net

    Thread Starter essmeier

    (@essmeier)

    WPP started working again on my site when I reverted Woocommerce to version 3.5.8.

    I just tested it again, and it was working.

    Then I upgraded Woocommerce to 3.6.2 again.

    Now it no longer appears to be working.

    Plugin Author Hector Cabrera

    (@hcabrera)

    Something’s changed though:

    REST API error 500 response

    Check your error log and paste its contents somewhere so I can check (eg. pastebin).

    Thread Starter essmeier

    (@essmeier)

    I have also been testing a new version of another plugin – Advanced Dynamic Pricing for Woocommerce Pro, and there are error messages in the log that reflect that.

    The problems with WPP started before I made changes to that other plugin, and I have since (as of ten minutes ago) reverted to the version of that plugin that I was using a month ago when everything worked.

    Still not working.

    Last two weeks of my error log are here:

    https://pastebin.com/AJzJYDiG

    Plugin Author Hector Cabrera

    (@hcabrera)

    Unfortunately the log doesn’t provide anything useful (to me at least). All I saw there were a few PHP notice/error messages coming from the Advanced Dynamic Pricing for Woocommerce Pro plugin.

    Thread Starter essmeier

    (@essmeier)

    I didn’t see anything there, either.

    I just reverted Woocommerce to version 3.5.8. WPP is working again.

    Thread Starter essmeier

    (@essmeier)

    Hector,

    When you tested WPP with Woocommerce 3.6.2, were you using a fresh (never before installed) version of Woocommerce?

    As I’ve mentioned, I’ve upgraded that plugin a number of times, most recently from 3.5.8 to 3.6.2, and there were literally hundreds of changes in that upgrade.

    It makes me wonder if there isn’t something going on with my installation that’s affecting WPP that isn’t present in yours.

    Plugin Author Hector Cabrera

    (@hcabrera)

    Yep, fresh setup of everything. Didn’t even touch the settings (did the entire WC setup thing but that was it.)

    Thread Starter essmeier

    (@essmeier)

    That’s what I suspected. It seems to have something to do with the upgraded version of Woocommerce, rather than the current version of the software itself.

    When I revert to Woocommerce 3.5.8, WPP works. When I upgrade to 3.6.2, it doesn’t. If I revert again, it works again. If I upgrade again, WPP quits working.

    It’s repeatable.

    Is this an issue for the Woocommerce people? Don’t really know what to do here.

Viewing 15 replies - 1 through 15 (of 27 total)
  • The topic ‘Stopped counting stats’ is closed to new replies.