Back to Documentation

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):

VariableDescriptionRequired
HASH_SALTSecret salt for visitor hashingYes
INSTANCE_IDUnique installation identifierYes
VERSIONCurrent app versionYes
PINCODEDashboard 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:

bash
# 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:

  1. Click the update link in your dashboard notification (or use the upgrade link from your purchase email)
  2. Create a minimal Cloudflare API token with only Workers Scripts: Edit permission
  3. The installer will deploy the latest worker code
  4. 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