Workers Analytics For Custom Domains

Hi all. I am looking for a snippet or tutorial to display standard analytics on custom domains that will work with workers.

For example: I have 2 custom domains bcom and ccom that are attached to acom. I would like to display seperate basic analytics like visits + page views for the last 24 hours for acom, bcom and ccom on the custom domain being visited.

How to go about that?

How can I display basic analytics such as page visits and view for each custom domain using workers? Example:

bccom and ccom are custom domains of acom. I would like to display only bcom’s individual statistics when a visitor goes to bcom and likewise for ccom. For acom i would like to disply aggregate data.

Any snippets or tutorial links welcome.
Thannk you