Skip to main content

@latimer-woods-tech/analytics

Dual-track analytics: PostHog for product analytics and a first-party factory_events table for business intelligence. Depends on @latimer-woods-tech/errors and @latimer-woods-tech/neon.

Installation

Secrets required

Database

Run the DDL constant to create the table:
Schema:

API

track(opts)

Sends an event to PostHog and inserts into factory_events.

identify(opts)

Creates or updates a PostHog person profile.

getEvents(db, opts)

Queries factory_events with optional filtering.

Example