Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Analytics ¶
type Analytics struct {
// contains filtered or unexported fields
}
func New ¶
New initializes a new Analytics instance. The config.Config parameters is required, but the others are optional. Analytics won't be sent if the api.ClientWithResponses is nil.
func (*Analytics) Identify ¶
Identify associates the provided properties with the user for the sake of analytics. It automatically includes common properties like ProjectID. The identification is only sent if the client is initialized and analytics are enabled in the config, otherwise it is skipped.
func (*Analytics) Track ¶
Track sends an analytics event with the provided event name and properties. It automatically includes common properties like ProjectID, OS, and architecture. Events are only sent if the client is initialized and analytics are enabled in the config, otherwise they are skipped.
type Option ¶
Option is a function that modifies analytics event properties. Options are passed to Track and Identify methods to customize the data sent with events.
func Error ¶
Error creates an Option that adds success and error information to event properties. If err is nil, sets success: true. If err is not nil, sets success: false and includes the error message.
This is commonly used at the end of command execution to track whether operations succeeded or failed, and what errors occurred.
func FlagSet ¶
FlagSet creates an Option that adds all flags that were explicitly set by the user (via Visit). Flag names are converted from kebab-case to snake_case (e.g., "no-wait" becomes "no_wait"). Flags in the ignore list are skipped.
This is useful for tracking which flags users actually use when running commands.