Support » Plugin: Jetpack Post Views » Stats not updating

  • Hello Steven, I fear something is not being correctly updated.
    I’m having an issue similar to others reported here. Example:
    I posted several articles in the last week, and it even get comments, but your counter show 0 visits for any of them.

    I went to /wp-content/plugins/jetpack-post-views.php and set $DEBUG = true. I have 578 public posts, but the DEBUG info is telling that you are able to retrieve 598 using the JetPack API. And debug info is showing that those articles had more than 3 visits each. Althoug your plugin is showing zero.

    I see the custom fields for those articles and i.e. they show:
    jetpack-post-views = 0
    jetpack-post-views-Day = 1
    jetpack-post-views-Month = 3
    jetpack-post-views-Week = 4
    jetpack-post-views-Year = 3

    The API is showing
    [views] => 1

    And in the posts list, your plugin show 0 visits.

    I tested this for several other posts and the latest published show this issue on 5/7 posts.

    In the other hand, there are old, very popular posts, where this mismatch doesnt happen. Example:
    – API says: [views] => 44496
    – Post page says: 44496
    – Custom field: jetpack-post-views = 44496

    I have latest version of WordPress, your plugin and JetPack plugin. is this a bug? May be that your plugin is not really updating the custom fields? I use Cloudflare for basic CDN and W3 Total Cache to cache html pages only. May some of the above effect the collecting of stats? A couple months ago this worked ok.

    Any ideas?

Viewing 15 replies - 1 through 15 (of 15 total)
  • Plugin Author Steven Lambert


    The DEBUG info shows how many posts you have, but it doesn’t track how many posts I received from the Jetpack API. The Jetpack API doesn’t allow me to grab more than 500 posts at a time, and so blogs with more than 500 posts suffer from this problem.

    ok, got it. And you can ask what posts to retrieve in every check in? Or they send you an array of data and you have to deal with it?
    Because, if you are able to ask for a number of IDs, or a range, you could ask for different sets of posts in order to populate the different posts in a big site.
    Otherwise, you are telling your plugin is not useful for really big websites? πŸ™

    Plugin Author Steven Lambert


    They don’t have offsets for their API, but they do allow a list of IDs. What that would mean is I would have to get every id for every post (a large call for large sites), then make my own offset function and ping the Jetpack API for every set of 500 posts, giving it a string of 500 ids.

    However, this doesn’t work because of the max length of URL’s, and I would have to do less than 500 ids per call (I think somewhere around 200 would fit without problem). With a site of 2000 posts, that would mean 10 calls to the Jetpack API per hour. Combined with multiple sites, I don’t think they want that kind of traffic to the API every hour.

    Wow that’s such a complication. Maybe you could try one strategy or another depending on the amount of posts you detect in every install.

    This lead me to another good question: what about multisites? Let’s say your plugin is enabled in 10 sites within a multisite scenario. This limit of 500 posts per call are applied to every individual domain or to the master domain on what the multisite is mounted on?

    Maybe we should invite someone from JetPack to this debate and help us think a solution. It’s a pity one good plugin like yours is unable to retrieve useful information like individual hits on big sites.


    As per our guidelines:

    Please don’t abuse the API. Use of our API is free. We just ask that you not abuse it by making excessive calls through your apps.

    Here’s what I suggest. Contact the friendly developers who take care of our APIs, and detail what you’d like to do (a link to this thread may be enough, but they may have other questions for you). They may even have a better way of doing what you need to do.

    Thank you Richard! I knew I could get a neat answer from you guys.

    Steven, I can help debug this thing if you want/need help. Let me know if you contact the API developers. I could do it too if required.

    In case developers join the conversation here, this is the brief:

    We are wondering how to find a workaround to this issue, which is a limitation on the JetPack API usage.
    JetPack Post Views is a very useful plugin, which allows to show the total amount of visits received for every post when you browse the Posts list. That’s very insightful information because you are able to know that precious data in a very thorough manner.

    But it is facing a problem on big sites, because JetPack API allows the retrieval of only 500 posts. That way, websites with 500+ posts are not receiving updates for all the posts.

    What would you suggest to Steven Lambert, the plugin developer, to workaround this and allow big sites to be provided with such an important data?

    Big thanks in advance.

    Plugin Author Steven Lambert


    I just wrote the WordPress developers and pointed them to this tread as well as the thread where I was told to use the post_ids (by Jetpack themselves). Hopefully this will lead to something that will resolve this issue.

    Thanks for your help Marcelo and richardmtl.

    Hi Steven,

    I have problem with your plugin. It was working perfectly and 3 weeks ago it stopped updating the info about total views. I haven’t changed anything from that time. Also all the 3 options are green, and i tried to use every single combination of active/deactive settings, nothing helps. I have 350 posts so far.

    Please can you see what’s the problem.

    Thanks in advance!

    @stephane, are you suggesting to switch to REST API?

    Plugin Author Steven Lambert


    From what I can tell about the REST API, the “stats” calls do not give individual post view information, only site-wide views for each day. The “posts” calls do not give view information about a particular post either. Unless there is something I am missing, the REST API doesn’t give me individual post views like Jetpack’s API does.

    are you suggesting to switch to REST API?

    Nope, that’s not what I said. πŸ™‚

    I suggested Steven can feel free to make his multiple queries.

    I only suggested he can look into the REST API for more goodness, not as a replacement.

    Maybe he (Steven) could write a routine to keep track of what posts have been queried and when was the last query. So that he can ask for stats for posts with more visits first, and run queries for the least visited ones on, let’s say, weekends?
    The problem with keeping track of posts and dates, it may add an important overhead in the db for really huge websites…

    It’s not made to get all posts (so for this plugin’s core needs), but for top posts (daily), we do have a handy endpoint, which will return multiple days worth of:

Viewing 15 replies - 1 through 15 (of 15 total)
  • The topic ‘Stats not updating’ is closed to new replies.