posthog

package
v0.14.2 Latest Latest
Warning

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

Go to latest
Published: Jul 14, 2026 License: LGPL-3.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

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

Client is a thin wrapper around posthog-go that supports no-op usage when disabled and adds optional OpenTelemetry trace correlation.

func New

func New(opt Options) (*Client, error)

New creates a PostHog client. If APIKey is empty, a disabled client is returned.

func (*Client) Capture

func (c *Client) Capture(ctx context.Context, event string, properties map[string]any) error

Capture sends a PostHog capture event. When disabled, it is a no-op. If ctx contains an active span, trace identifiers are added to properties.

func (*Client) Shutdown

func (c *Client) Shutdown() error

Shutdown closes the client and flushes queued events. When disabled, it is a no-op.

type Options

type Options struct {
	// APIKey for your PostHog project.
	APIKey string
	// DistinctID for the posthog project.
	DistinctID string
	// BaseProperties to add to all events.
	BaseProperties map[string]any
}

Options configures the PostHog client. If APIKey is empty, the client will be disabled and methods become no-ops.

Jump to

Keyboard shortcuts

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