Tracking Hits Across Many Generated Sites, Each On Its Own

From BloomWiki
Jump to navigation Jump to search

Tracking hits across many generated sites, each on its own


Anyone who builds sites from a generator meets the same problem sooner or later: every site needs a counter, and the easy answer is to paste one shared snippet into the template. It works on the first day. It also means each site holds one identifier, reports into a common account and can be linked to its neighbours by anyone who looks at the source. What follows is how to give each site its own counter without turning the setup into a manual task.


With clx this works through an open API. A site is added with one call, the snippet comes back ready to insert during the build, the counter runs as a worker in the Cloudflare account that serves the site, and the totals are read through the same API, so the whole cycle fits into the generator.


The same requests handle short links and their codes, so a generator that already creates sites can also give each of them its own short addresses on its own domain, with no overlap between them.


A shared snippet is convenient because it is one line, and that is precisely its cost. The same tracking identifier on a hundred sites is a fingerprint: it shows that they are linked, and it puts all their visitors into one group that you then have to split by hand. When one site is sold, handed to a client or taken down, its history is tangled with everyone else's.


The tidier arrangement is a separate counter per site, created at the instant the site appears. Each one has its own snippet, reports independently and can be removed on its own, and nothing in the page source of one site links to the others. The challenge has always been the bookkeeping, not the concept.


That part belongs in the build, not in a browser tab. A generator that can call an interface can add a site, receive its snippet, embed it at build time and later read the totals back, all without anyone opening a console. The counter becomes another build artefact, like the sitemap, and it is created and removed together with the site.


Where the data resides matters even more at this scale. If every counter sends into a third-party account, the detail for all your sites sits in one place you do not control. If each site logs into the hosting account it already runs on, the data stays with the site, including when that account belongs to a client rather than to you.



The calls, the order they come in and what each one returns: link shortener for AI agents


In brief


With one per property, each history stays separate and can be removed alone.
Pasting one snippet into the template ties every generated site to the others and combines their visitors.
Doing that setup inside the build, through an interface, eliminates the manual work that made the shared code tempting.