posthog

package
v0.0.0-...-98cd694 Latest Latest
Warning

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

Go to latest
Published: Feb 29, 2024 License: Unlicense Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrNilConfig indicates a nil config was provided.
	ErrNilConfig = errors.New("nil Posthog configuration")
	// ErrEmptyAPIToken indicates an empty API token was provided.
	ErrEmptyAPIToken = errors.New("empty API token")
)

Functions

func NewPostHogEventReporter

func NewPostHogEventReporter(logger logging.Logger, tracerProvider tracing.TracerProvider, cfg *Config, configModifiers ...func(*posthog.Config)) (analytics.EventReporter, error)

NewPostHogEventReporter returns a new PostHog-backed EventReporter.

Types

type Config

type Config struct {
	APIKey string `json:"apiToken" toml:"api_token,omitempty"`
}

func (*Config) ValidateWithContext

func (cfg *Config) ValidateWithContext(ctx context.Context) error

ValidateWithContext validates a Config struct.

type EventReporter

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

EventReporter is a PostHog-backed EventReporter.

func (*EventReporter) AddUser

func (c *EventReporter) AddUser(ctx context.Context, userID string, properties map[string]any) error

AddUser upsert's a user's identity.

func (*EventReporter) Close

func (c *EventReporter) Close()

Close wraps the internal client's Close method.

func (*EventReporter) EventOccurred

func (c *EventReporter) EventOccurred(ctx context.Context, event types.ServiceEventType, userID string, properties map[string]any) error

EventOccurred associates events with a user.

Jump to

Keyboard shortcuts

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