posthog

package
v4.1.1 Latest Latest
Warning

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

Go to latest
Published: Mar 30, 2026 License: AGPL-3.0 Imports: 8 Imported by: 2 modules, 1 package

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrEmptyAPIToken indicates an empty API token was provided.
	ErrEmptyAPIToken = platformerrors.New("empty Posthog API token")
)

Functions

func NewPostHogEventReporter

func NewPostHogEventReporter(logger logging.Logger, tracerProvider tracing.TracerProvider, apiKey string, circuitBreaker circuitbreaking.CircuitBreaker, configModifiers ...func(*posthog.Config)) (analytics.EventReporter, error)

NewPostHogEventReporter returns a new PostHog-backed EventReporter.

Types

type Config

type Config struct {
	APIKey string `env:"API_KEY" json:"apiKey"`
}

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, userID string, properties map[string]any) error

EventOccurred associates events with a user.

func (*EventReporter) EventOccurredAnonymous

func (c *EventReporter) EventOccurredAnonymous(ctx context.Context, event, anonymousID string, properties map[string]any) error

EventOccurredAnonymous records an event for an anonymous user.

Jump to

Keyboard shortcuts

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