Skip to content

Count visits with Cloudflare Web Analytics - #23

Open
stphnwlsh wants to merge 1 commit into
mainfrom
feature/cloudflare-analytics
Open

stphnwlsh wants to merge 1 commit into
mainfrom
feature/cloudflare-analytics

Conversation

@stphnwlsh

@stphnwlsh stphnwlsh commented Nov 7, 2026 •

Copy link
Copy Markdown
Contributor

Closes LeanMeanCleanApps/.github#92

Summary

Adds Cloudflare Web Analytics to every page on the site: the home page, all five template docs and the brand pages. It's cookieless and keeps no personal data, so there's no consent banner to click through.

  • src/components/Analytics.astro adds Cloudflare's beacon script. Base.astro and the docs Head.astro both include it.
  • The token comes from the CLOUDFLARE_ANALYTICS_TOKEN repository variable, which site.yml passes to the build. When it isn't set (forks, local builds or before you add it), no script is added.
  • The README's Publishing section says how it works.

To switch it on, add the site leanmeancleanapps.github.io in Cloudflare under Analytics & Logs > Web Analytics and choose the JS snippet option. Copy the token from the snippet, add it as a repository variable (not a secret) called CLOUDFLARE_ANALYTICS_TOKEN, then merge or re-run the Site workflow.

@stphnwlsh stphnwlsh self-assigned this Nov 7, 2026
Adds Cloudflare's cookieless beacon to every page, docs and brand pages included. The token comes from the CLOUDFLARE_ANALYTICS_TOKEN repository variable, so forks and local builds add nothing.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Count website visits with Cloudflare Web Analytics

1 participant