Skip to content
OddlyticsRelease 1.0.2

Configuration ​

Oddlytics has three places to configure: the Worker, the dashboard build, and the Swift package in each app.

Worker ​

The Worker reads its settings from packages/worker/wrangler.toml and from Cloudflare secrets.

SettingWhereDefaultWhat it does
AUTH_KEYSecret (npx wrangler secret put AUTH_KEY), or .dev.vars locallynoneThe API key. POST /track, renaming events, changing app settings and every delete need it in the X-API-KEY header.
DB[[d1_databases]] binding in wrangler.tomloddlytics-dbThe D1 database that holds events. Set database_id to the ID from wrangler d1 create.
ENVIRONMENT[vars] in wrangler.tomlproductionWhen it is anything other than production, error responses include the underlying error message.
namewrangler.tomloddlytics-workerThe Worker's name, which is part of its workers.dev address.

WARNING

Only POST /track, the alias and app settings writes, and the delete endpoints check AUTH_KEY. The read endpoints under /stats and GET /aliases answer anyone who knows the Worker's address. See Privacy & Data.

The Worker also enforces these limits on every event:

LimitValue
Events per request100
event, app_id, session_id length255 characters each
metadata size10 KB as JSON

Dashboard ​

The dashboard reads two variables at build time. Set them in packages/dashboard/.env.local, or in your hosting provider's build settings.

VariableDefaultWhat it does
NEXT_PUBLIC_API_URLhttp://localhost:8787The Worker's address.
NEXT_PUBLIC_API_KEYoddlytics-local-keySent as X-API-KEY with every request. Must match the Worker's AUTH_KEY.

Because these are compiled into the static files, rebuild and redeploy the dashboard after changing them.

The dashboard's own preferences (pretty event names, default time range, compact mode) are kept in your browser. See Dashboard.

Swift Package ​

Each app passes its settings to Analytics.configure at launch:

swift
Analytics.configure(
    endpoint: "https://oddlytics-worker.<your-subdomain>.workers.dev",
    apiKey: "your-auth-key",
    appId: "MyApp",
    batchSize: 10,
    batchInterval: 5.0,
    debugMode: false
)
ParameterDefaultWhat it does
endpointrequiredThe Worker's address. Events are posted to <endpoint>/track. An address that isn't a valid URL stops the app with a fatal error.
apiKeyrequiredThe Worker's AUTH_KEY.
appIdrequiredThe name this app's events are stored under. The dashboard lists one app per appId.
batchSize10Send as soon as this many events are queued. Keep it at 100 or less, the most the Worker accepts in one request.
batchInterval5.0Seconds between automatic sends.
debugModefalsePrints what the package does to the Xcode console, prefixed with [Oddlytics].

Use a different appId for each app. Two apps that share an appId show up as one app in the dashboard.

Odd Omens is a one-person studio building privacy-first software.