Tracking web analytics for a workers subdomain instead of custom domain
Hey there!
I've looked through both Pages and Web Analytics docs, but couldn't find an answer to the following question. And I am sure I am not the only one with this situation.
1. I have a custom domain, which is managed on Cloudflare custom-domain-whatever.com
2. I host a Pages static blog on this custom domain *pages.dev
3. I enabled Web Analytics both on custom domain and ont the pages worker
4. My DNS for the custom domain is setup as per Pages instructions (pointing to the worker as content)
Issue / problem: the web analytics dashboard weirdly shows all traffic as if it's coming to the workers subdomain.
Question: Is it possible to setup analytics to report traffic only for the custom domain?

1 Reply
Its normal for it to show the pages.dev there, that's just the name of the web analytics "site" and if you click into it you can see a list of hostnames which you can filter under the analytics data
But also to answer your question about using only the custom domain, you'll want to disable web analytics on the pages project and set it up through the web analytics system instead which it looks like you did.
So just disable it on pages now. If you see it still doesn't work, try adding and removing from web analytics and make sure script injection is happening automatically