Skip to content

identity

diapason.analytics.identity

Anonymous identity for external analytics.

One UUID v4 per install, persisted to disk on first use. The same file is referenced by scripts/install/install.sh so install-time beacon events tie back to the same person across the install→first-run funnel.

No email, no name, no hardware fingerprint — just an opaque UUID.

get_or_create_anon_id(path)

Return the persisted anon ID, generating one on first call.

Idempotent across processes — if the file already exists with a non-empty value, return it; otherwise generate a fresh UUID v4 and write atomically (rename-after-write so a crashed write leaves no half-file).

is_analytics_enabled(cfg)

Return True if analytics is enabled in config.

Local-only mode overrides [analytics] enabled, which ships as True with a hard-coded PostHog host and project key. Telemetry is anonymous and carries no conversation content, but "nothing leaves this machine" that still phones home on every launch is not a promise — it is a caveat.

This single predicate is the whole gate: AnalyticsClient.__init__ consults it before calling _init_sdk, so under local-only no PostHog client is ever constructed and the project key is never read.

reset_anon_id(path)

Delete the persisted ID and generate a fresh one (privacy reset).