analytics

package
v0.1.21 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 23, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Package analytics is a tiny PostHog wrapper for the codag CLI.

Defaults: enabled. Opt out with CODAG_TELEMETRY=0 or `codag config set telemetry off`. distinct_id is a random UUID persisted in ~/.config/codag/config.json (CLIDistinctID) on first invocation; this keeps installs anonymous but stable across runs.

Every event auto-tags source=cli, codag_version, os, arch so it joins cleanly with console/website/server events in the same PostHog project.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Capture

func Capture(event string, props map[string]any)

Capture fires an event with the standard set of super-properties merged in. No-op when the client is disabled.

func Identify

func Identify(serverUserID string, email string)

Identify links the anonymous CLI distinct_id to a server user id once the user signs in via `codag auth login`. After this call, future events from this machine show up on the same person profile as console/server events for the same user.

func Init

func Init(cliVersion string)

Init wires up the PostHog client. Safe to call multiple times. cliVersion is stamped onto every event so cohort-by-version is trivial.

func Shutdown

func Shutdown()

Shutdown flushes pending events. Call once at the end of cmd.Execute.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL