Your analytics, in your Cloudflare account.
PostDeploy Analytics is a Worker, a D1 database and a small tracking script. You deploy it from the GitHub repository, own the data it collects, and decide who can read it.
Before you start
- Your Cloudflare accountThe verified installation uses Workers Paid. The setup does not buy or change a plan; Free-plan password CPU is not certified.
- A GitHub or GitLab accountCloudflare copies the public source into the Git provider account you authorize.
- An HTTPS addressA workers.dev subdomain or your own domain. Production sign-in requires HTTPS.
- Optional email setupBefore invitations or password-reset emails, onboard a sender domain in Cloudflare Email Service and configure the binding. Initial administrator password login works without email.
- For the command lineNode 24.22.x, npm 11.x, and Wrangler signed in to your account. Check with
npx wrangler whoami. - A quiet place for secretsThe setup secret creates the first administrator. Keep it out of chats, screenshots and Git.
Two ways to deploy
Both start from the same repository and end with the same installation. Pick the one that suits how you work.
Deploy to Cloudflare
Start from your browser. Cloudflare’s guided flow copies the repository, connects Workers Builds and provisions D1 in your account. It prompts for your installation’s configuration; first-owner setup follows deployment.
- Select Deploy to Cloudflare and sign in to your Cloudflare account.
- Authorize GitHub or GitLab and choose the copied repository and Worker name.
- Provide the exact HTTPS
APP_ORIGINand a private randomBOOTSTRAP_SECRETof at least 32 characters. - Review your account and D1 binding, then deploy. The command builds the dashboard and applies migrations to
DBbefore uploading the Worker.
Guided command line
Clone the repository and let the setup script plan each step before it changes anything. Remote steps run only with explicit confirmation flags.
# get the source
git clone https://github.com/Alplus-Tech/postdeploy-analytics.git
cd postdeploy-analytics && npm ci
# describe your installation, then inspect the plan
npm run setup -- init --name postdeploy-team \
--account YOUR_ACCOUNT_ID \
--origin https://postdeploy-team.example.workers.dev \
--sender analytics@your-domain.example
npm run setup -- plan --name postdeploy-team
# create the database, set the setup secret, deploy
npm run setup -- provision --name postdeploy-team --execute postdeploy-team
npm run setup -- secret --name postdeploy-team --execute postdeploy-team --confirm-worker postdeploy-team
npm run deploy -- --name postdeploy-team --execute postdeploy-team --confirm-worker postdeploy-teamFirst run
- Open
/authat your installation’s address and enter the setup secret to create the first administrator. - Sign in to confirm it works. Remove
BOOTSTRAP_SECRETfrom the Worker’s settings. With the guided command-line route, use the documentednpm run setup -- sealcommand and its target flags. - After configuring Email, invite your team as Administrators or Viewers and confirm delivery before relying on email recovery.
- Create an organisation and a project, add the website’s hostname and any aliases, and paste the tracking snippet.
- Use the installation check to see the first event arrive.
<!-- in the <head> of every page -->
<script defer
src="https://YOUR-INSTALLATION/script.js"
data-site="YOUR-SITE-ID"></script>Single-page apps are covered: the tracker records navigation through the browser history.
Running it
- Updates
- Workers Builds deploys configured branch pushes from your own copy. Upstream changes are not merged automatically. Review updates and the offline upgrade guide before schema changes; ordinary deploys apply pending migrations before upload.
- Retention
- An hourly job removes events older than each website’s setting, in bounded batches.
- Backups
- Export the D1 database with Wrangler, then verify the copy in isolation before you rely on it. The guide covers restoring without losing newer data.
- Recovery
- If every administrator is locked out, an operator can restore access from a private terminal.
- Capacity
- Storage grows with traffic, projects and retention, and a D1 database has a size limit. Read the performance notes before choosing retention for busy websites.
Read these before going live. The repository’s documentation covers each operation step by step.
MIT licensed
Use it, change it and run it for your clients. The project’s own code is under the MIT license. bcryptjs keeps its BSD-3-Clause license, and the Onest and Open Runde fonts keep the SIL Open Font License.
Start from the repository.
Read the code, then deploy it to an account you control.