Documentation
¶
Overview ¶
Package posthog is a dumb analytics.Sink over the PostHog batch capture API. It maps each analytics event to a PostHog event and POSTs one gzipped batch per flush. Apps that need a different mapping can bring their own sink.
PostHog requires a distinct_id. This package uses the app-supplied identity from analytics.Tracker.Identify (Event.UserID) when present, falling back to the ephemeral session id — it never synthesises a device identifier.
Index ¶
Constants ¶
const DefaultHost = "https://us.i.posthog.com"
DefaultHost is PostHog's US cloud host. Pass a different host to New for EU cloud or self-hosted instances.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Sink ¶
type Sink struct {
// contains filtered or unexported fields
}
Sink delivers events to PostHog's /batch endpoint.
func New ¶
New returns a PostHog analytics.Sink for the given project API key, using DefaultHost.
func NewWithHost ¶
NewWithHost returns a PostHog analytics.Sink posting to a custom host (EU cloud or self-hosted).