analytics

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Aug 18, 2025 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// PostHog project configuration
	// PostHogAPIKey is a public key for PostHog analytics - not a secret credential
	PostHogAPIKey = "phc_oX8UUqsZVs6ifWJRTZ0yNtwTv852ccqRsk09SsZbHHb" // #nosec G101
	PostHogHost   = "https://us.i.posthog.com"

	// Event names following PostHog conventions
	EventCommandExecuted = "cli_command_executed"
	EventCommandFailed   = "cli_command_failed"
	EventSessionStarted  = "cli_session_started"
	EventError           = "cli_error"
)

Variables

This section is empty.

Functions

func Close

func Close()

Close properly shuts down the analytics client

func Initialize

func Initialize()

Initialize creates and configures the analytics client

func IsEnabled

func IsEnabled() bool

IsEnabled returns whether analytics is enabled

func LogOptOutStatus

func LogOptOutStatus() map[string]interface{}

LogOptOutStatus provides information about analytics status for debugging

func TrackCommand

func TrackCommand(command, subcommand string, success bool, duration time.Duration, errorMsg string)

TrackCommand tracks CLI command usage

func TrackCommandWithContext

func TrackCommandWithContext(cmdName, subCmd string, context map[string]interface{}, fn func(cmd *cobra.Command, args []string) error) func(cmd *cobra.Command, args []string) error

TrackCommandWithContext wraps a command with additional context properties

func TrackCommandWrapper

func TrackCommandWrapper(cmdName, subCmd string, fn func(cmd *cobra.Command, args []string) error) func(cmd *cobra.Command, args []string) error

TrackCommandWrapper wraps a cobra command function with analytics tracking

func TrackError

func TrackError(errorMsg string, context map[string]interface{})

TrackError tracks errors with anonymized information

func TrackEvent

func TrackEvent(event string, properties map[string]interface{})

TrackEvent sends an analytics event (no-op if opted out)

Types

type Client

type Client struct {
	// contains filtered or unexported fields
}

Client wraps PostHog client with privacy controls

Jump to

Keyboard shortcuts

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