Documentation
¶
Index ¶
Constants ¶
const ( // SourcePropertyKey is the event property used to identify the analytics source (e.g. ios, web). // For PostHog, where a single API key is shared across sources, this property distinguishes events. SourcePropertyKey = "source" )
Variables ¶
var ( // Providers are what we provide to dependency injection. Providers = wire.NewSet( ProvideMultiSourceEventReporter, ) )
Functions ¶
func RegisterMultiSourceEventReporter ¶
RegisterMultiSourceEventReporter registers a *MultiSourceEventReporter with the injector. Prerequisite: map[string]*analyticscfg.SourceConfig must be registered in the injector.
Types ¶
type MultiSourceEventReporter ¶
type MultiSourceEventReporter struct {
// contains filtered or unexported fields
}
MultiSourceEventReporter delegates events to per-source EventReporters.
func NewMultiSourceEventReporter ¶
func NewMultiSourceEventReporter( reporters map[string]analytics.EventReporter, logger logging.Logger, tracerProvider tracing.TracerProvider, ) *MultiSourceEventReporter
NewMultiSourceEventReporter returns a new MultiSourceEventReporter.
func ProvideMultiSourceEventReporter ¶
func ProvideMultiSourceEventReporter( ctx context.Context, proxySources map[string]*analyticscfg.SourceConfig, logger logging.Logger, tracerProvider tracing.TracerProvider, metricsProvider metrics.Provider, ) (*MultiSourceEventReporter, error)
ProvideMultiSourceEventReporter builds a MultiSourceEventReporter from proxy sources config. For each source, attempts to create an EventReporter via ProvideCollector. If creation fails (e.g. missing credentials) or provider is unset, uses Noop for that source.
For PostHog: a single API key is shared across all sources. One PostHog client is created and reused for every PostHog source; the source name is logged as a property on each event.
func (*MultiSourceEventReporter) TrackAnonymousEvent ¶
func (m *MultiSourceEventReporter) TrackAnonymousEvent(ctx context.Context, source, event, anonymousID string, properties map[string]any) error
TrackAnonymousEvent records an event for an anonymous user.
func (*MultiSourceEventReporter) TrackEvent ¶
func (m *MultiSourceEventReporter) TrackEvent(ctx context.Context, source, event, userID string, properties map[string]any) error
TrackEvent records an event for an identified user.