analytics

package
v0.0.0-...-f1bff1d Latest Latest
Warning

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

Go to latest
Published: Apr 29, 2024 License: Apache-2.0 Imports: 4 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AmplitudeConfig

type AmplitudeConfig struct {
	// Amplitude API Key
	AmplitudeAPIKey string `yaml:"amplitude_api_key"`

	// Amplitude endpoint
	AmplitudeEndpoint string `yaml:"amplitude_endpoint"`

	// Toggle for logging sent events
	IsLoggingEnabled bool `yaml:"logging_enabled"`

	// Toggle for batching events. Make sure to set batch amplitude endpoint
	IsBatchingEnabled bool `yaml:"batching_enabled"`

	// The maximum number of events to send in a single batch
	FlushQueueSize int `yaml:"flush_queue_size"`
}

type AppInfo

type AppInfo struct {
	Name      string `yaml:"name"`
	Version   string `yaml:"version"`
	Build     string `yaml:"build"`
	Namespace string `yaml:"namespace"`
}

Data pertaining to the application such as name, version, and build If set, the specified values will be added globally to each event context

type Client

type Client interface {
	// Sends the given tracking event to Segment and Mixpanel (if enabled).
	TrackEvent(event *Event) error

	// A shorthand wrapper method for TrackEvent that sends a tracking event with the given distinct id, name and properties.
	Track(distinctID string, name string, properties map[string]any) error

	Close() error
}

func NewClient

func NewClient(config Config) (Client, error)

type Config

type Config struct {
	App AppInfo `yaml:"app"`

	// Toggle for logging sent events
	IsLoggingEnabled bool `yaml:"logging_enabled"`

	// Disable batching (used for CLI) by setting this parameter to 1
	BatchSize int `yaml:"batch_size"`

	// Toggle for sending events to Amplitude
	IsAmplitudeEnabled bool `yaml:"amplitude_enabled"`

	// Toggle for whether client is used in agent or internal service
	IsInternalService bool `yaml:"is_internal_service"`

	// Separate config for amplitude client
	AmplitudeConfig AmplitudeConfig `yaml:"amplitude"`
}

type Event

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

Holds the name and properties of an analytics event.

func NewEvent

func NewEvent(distinctID string, name string, properties map[string]any) *Event

Returns a new event with the given name and properties. The event is initialized with the current time as the timestamp.

Jump to

Keyboard shortcuts

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