After connecting the site to Cloudflare, views on WP site are not counted

Hi. I am writing here because I don’t know which topic to choose. There is a small problem. I connected the WordPress site to Cloudflare and now the built-in counter of the post views does not work. Tell me what can be done in such a situation?

With what are you counting the views?
Google Analytics? WP internal tool? or even with a particular file?

Do you have “Cache Everything” enabled?
Are you able to provide us with your domain?

1 Like

This is my site https://mi-faq.ru. Everything that is possible is cached. The view counter is built into the theme.

I dont see any failed request nor any trackingrequest related to Wordpress going out. Could you please elaborate how exactly the tracking was working before? What technic are they using so we can see if it now gets blocked.

But I see:

  1. Google Analytics
  2. Yandex Metrica

These two also work properly.
Guessing into the wild: can you try to disable RocketLoader and try to purge cache after it?

1 Like

For example, on this page Список всех нужных файлов для прошивки телефона Xiaomi - Mi-FAQ.ru, the counter counts only my visits when I logged into the admin panel. The views of posts in the sidebar are shown as well. Analytics from Google and Yandex shows fine, everything works.

The only problem is that views of all posts are not counted. Although, judging by the metric, there have already been more than 10k hits on the new pages.

That page is cached by APO. I don’t know how your site counts visits, but I bet it involves a resource that you’re now caching at Cloudflare.

It’s also possible that it’s counting behind the scenes, but because that page is cached, the count isn’t showing the latest stat. Maybe when the Cloudflare cache refreshes, you’ll see the new value.

Thought so aswell, but all HTML files are properly bypassed:
image

My guess would be: RocketLoader is breaking something, if thats not the case I dont know what

It’s caching for me:

1 Like

True, I have disabled cache in network section. Probably its APO.
Two options are now possible:

  1. disable APO
  2. implement another counter that works AJAX based on something thats not cachable, or excluded.
2 Likes

Thank you very much for your help. In Cloudflare, can not somehow add exceptions or a rule so that the counter still works? Or just look for a plugin that will work through ajax?

As this counter seems to work based on “hitting the origin server” and Cloudflare prevents that by caching I guess there is no way around if you want to keep the good performance.
If you bypass HTML files you will end up having as slower site but therefore the counter will work again.

I would recommend a plugin which will add counter function by another technic which will not have an impact on performance if it gety bypassed.

1 Like

Got it, thanks a lot for your help! Performance is a priority :), then I will try third-party ajax viewers.

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.