Tallying Visits Across Numerous Generated Sites, Each On Its Own
Tallying visits across numerous generated sites, each on its own
Anyone who builds sites from a generator meets the same problem sooner or later: each site needs a counter, and the easy answer is to insert one common snippet into the template. It functions on the first day. It also means each site holds one identifier, feeds into a shared 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.
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, given to a client or taken down, its history is mixed 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 deleted on its own, and nothing in the page source of one site points to the others. The challenge has always been the administration, not the idea.
With clx this works through an open interface. A site is added with one call, the snippet comes back ready to embed during the build, the counter runs as a process in the Cloudflare account that hosts the site, and the totals are read through the same API, so the whole cycle fits into the generator.
The same calls cover 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.
The counting setup 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 output, like the sitemap, and it is created and removed together with the site.
Where the data lives matters even more at this scale. If every counter reports into a third-party account, the information for all your sites sits in one place you do not manage. 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 requests, the sequence they come in and what each one yields: website visitor counter
In brief
Records kept with the hosting remain put when the property switches hands.
Doing that setup inside the build, through an interface, eliminates the manual work that made the shared line appealing.
Pasting a single snippet into the template ties every generated site to the others and combines their visitors.