Documentation
¶
Index ¶
- func CaptureAnalyticsOptIn(optedIn bool)
- func CaptureCommand(userID string, cmd *cobra.Command, args []string)
- func CaptureCommandError()
- func Close()
- func GetOrCreateAnalyticsID() string
- func IdentifyUser(userID string)
- func IsAnalyticsEnabled() (enabled bool, hasBeenAsked bool)
- func IsAnalyticsFeatureEnabled() bool
- func RecordCommandStart(cmd *cobra.Command, args []string)
- func SetAnalyticsPreference(enabled bool) error
- func TrackEvent(data EventData) error
- type EventData
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CaptureAnalyticsOptIn ¶ added in v0.6.317
func CaptureAnalyticsOptIn(optedIn bool)
CaptureAnalyticsOptIn sends an event recording the user's analytics consent choice. This is sent regardless of the user's choice so we can measure opt-in rates.
func CaptureCommand ¶ added in v0.6.317
CaptureCommand captures a CLI command invocation event (success path).
func CaptureCommandError ¶ added in v0.6.317
func CaptureCommandError()
CaptureCommandError captures a CLI command failure event from main.go. Uses stored command context from PersistentPreRunE/PersistentPostRunE.
func Close ¶ added in v0.6.317
func Close()
Close flushes any pending events and closes the PostHog client.
func GetOrCreateAnalyticsID ¶ added in v0.6.317
func GetOrCreateAnalyticsID() string
GetOrCreateAnalyticsID returns a stable anonymous UUID for tracking, creating one if needed.
func IdentifyUser ¶ added in v0.6.317
func IdentifyUser(userID string)
IdentifyUser links the anonymous analytics ID to a real user ID using PostHog Alias.
func IsAnalyticsEnabled ¶ added in v0.6.317
IsAnalyticsEnabled returns whether analytics is enabled and whether the user has been asked.
func IsAnalyticsFeatureEnabled ¶ added in v0.6.317
func IsAnalyticsFeatureEnabled() bool
IsAnalyticsFeatureEnabled checks the PostHog feature flag to determine whether to prompt the user about analytics opt-in.
func RecordCommandStart ¶ added in v0.6.317
RecordCommandStart should be called from PersistentPreRunE to record the start time and store the command context for potential error-path capture.
func SetAnalyticsPreference ¶ added in v0.6.317
SetAnalyticsPreference persists the user's analytics preference.