Configuration
Configure your Once Analytics installation through environment variables and the settings panel.
Environment variables
These are set as Worker bindings in Cloudflare (Workers & Pages → Your Worker → Settings → Variables and Secrets):
| Variable | Description | Required |
|---|---|---|
HASH_SALT | Secret salt for visitor hashing | Yes |
INSTANCE_ID | Unique installation identifier | Yes |
VERSION | Current app version | Yes |
PINCODE | Dashboard PIN (if using PIN auth) | No |
Changing the PIN
Edit the PINCODE variable in your Worker settings and click Save and Deploy. This immediately logs out all sessions.
Site settings
Site-specific settings are stored in the database and can be changed through the dashboard.
Privacy mode
Change via Dashboard → Settings:
- Mode 0: Anonymous (no visitor identification)
- Mode 1: Daily (default, daily rotating hash)
- Mode 2: Fingerprint (persistent hash)
- Mode 3: Cookie (persistent cookie)
See Privacy Modes for details.
Settings API
You can also change settings programmatically:
# Get current settings
curl https://stats.yoursite.com/config
# Update privacy mode
curl -X POST https://stats.yoursite.com/settings \
-H "Content-Type: application/json" \
-d '{"privacyMode": 1}'Worker bindings
The Worker connects to your D1 database through a DB binding, configured automatically during installation.
Updates
Once Analytics checks for updates automatically and shows a notification in the dashboard when a new version is available.
Auto-updates
If you enabled auto-updates during installation, updates are applied automatically when a new version is released. A secure, IP-restricted token was created specifically for this purpose.
Manual updates
If you didn't enable auto-updates, you can update manually using a one-time API token:
- Click the update link in your dashboard notification (or use the upgrade link from your purchase email)
- Create a minimal Cloudflare API token with only Workers Scripts: Edit permission
- The installer will deploy the latest worker code
- Delete the API token after the update completes
Tip: Manual updates only require Workers Scripts permission — much simpler than the initial installation token.
Note: Database schema migrations are applied automatically when the Worker starts with a new version.
Questions? Email hello@onceanalytics.com