Cloudflare Web Analytics is not working for site deployed to Cloudflare Pages
What steps have you taken to resolve the issue?
I have disabled and re-enabled Web Analytics multiple times
Deployment the site numerous times after enabling Web Analytics
Waited for over 10 hrs just to see if Analytics data would be populated
Confirmed that site is accessible and has received traffic in the last 10 hrs
I have 3 websites that are hosted on 3 domains (blog., tracker. & notes.).
The sites that are deployed to tracker. and notes.* utilizes Quartz and is showing analytics data.
The site deployed to blog.* is not capturing any analytics data. This site is using Jekyll with the Chirpy Theme.
What feature, service or problem is this related to?
When I look at the Account Level analytics and DNS level analytics I can see that there has been numerous visits for the site hosted at blog.. In fact there should be more traffic to the site at blog. that the ones on the other 2 subdomains.
This is a way to manually enable Web Analytics for a site that is deployed to Cloudflare Pages? The Jekyll site does have a option in its configuration file to setup an Cloudflare Tag.
The names shown in the 1st image are the names under which they are deployed to .pages.dev. The analytics instance was created automatically do it does have filter for the custom domain as well hence the +1 in the name. I have a bulk redirect rule setup to forward traffic from the .pages.dev domain to .davidvarghese.dev domain.
I also have a Page Rule setup to forward traffic from davidvarghese.dev to blog.davidvarghese.dev but I do not thing the page rule and bulk redirect rule should be causing any problem.
If you’re not seeing any data in your Cloudflare analytics, here are a few things to try that might help:
Clear Cache: Sometimes, Cloudflare’s caching can cause delays in analytics updates. Try clearing the cache in your Cloudflare dashboard, then refresh the page to see if new data comes in.
Check Settings: Double-check that analytics is enabled for your site. Sometimes a small setting can be overlooked, so go to the Analytics section and make sure everything is set up as it should be.
Try Incognito Mode: Ad blockers or browser extensions can block analytics scripts. To rule this out, open your site in an incognito window or with ad blockers disabled and see if that makes a difference.
Look at Security Settings: High security levels in Cloudflare can sometimes block analytics tracking. Go to the Security settings and check if there are any rules that might be interfering.
Give it Time: Occasionally, there’s just a delay with Cloudflare’s analytics updating. If everything else seems right, give it a bit and check back.
I tried all of the above but none of it worked. In the end I created a Web Analytics instance and manually added the JS code into the header and now the analytics data is being collected.
Still not sure why it did not work out of the box especially considering it worked fine for my other 2 sites.