Documentation
¶
Index ¶
- func CaptureCommand(userID string, cmd *cobra.Command, args []string)
- func CaptureCommandError()
- func CaptureFeedback(userID, message string)
- func Close()
- func GetOrCreateAnalyticsID() string
- func IdentifyUser(userID string)
- func IsAnalyticsEnabled() bool
- func IsAnalyticsFeatureEnabled() bool
- func IsDisabledByEnv() (disabled bool, varName string)
- func RecordCommandStart(cmd *cobra.Command, args []string)
- func SetAnalyticsPreference(enabled bool) error
- func SetUserStore(s UserStore)
- func TrackEvent(data EventData) error
- type EventData
- type UserStore
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
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 CaptureFeedback ¶ added in v0.6.320
func CaptureFeedback(userID, message string)
CaptureFeedback sends a brev-cli-feedback event to PostHog. This is sent regardless of analytics opt-in since the user explicitly chose to send feedback.
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 the user's distinct ID for tracking. It prefers the real user ID from the store if available, falling back to a stable anonymous UUID.
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
func IsAnalyticsEnabled() bool
IsAnalyticsEnabled defaults to true; DO_NOT_TRACK and BREV_NO_ANALYTICS override.
func IsAnalyticsFeatureEnabled ¶ added in v0.6.317
func IsAnalyticsFeatureEnabled() bool
IsAnalyticsFeatureEnabled is the remote kill switch for PostHog telemetry only — gating PostHog capture lets us turn it off without a release. It does NOT gate analytics.TrackEvent (the brev-internal endpoint), which has its own channel.
func IsDisabledByEnv ¶ added in v0.6.323
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.
func SetUserStore ¶ added in v0.6.323
func SetUserStore(s UserStore)
SetUserStore configures the store used to resolve the current user ID.