@talkfurther/events
v0.2.0
Published
Shared analytics event definitions used across Further's products. Each event is defined with a [zod](https://zod.dev/) schema that documents its fields, types, and descriptions.
Keywords
Readme
@talkfurther/events
Shared analytics event definitions used across Further's products. Each event is defined with a zod schema that documents its fields, types, and descriptions.
If you are looking for event documentation please see Analytics Profiles in Further Dashboard settings.
Usage
import { analyticsEvents, getEventFields } from "@talkfurther/events";
import type { AnalyticsEventName, AnalyticsEventData } from "@talkfurther/events";
// Access an event definition
const event = analyticsEvents.form_submitted;
console.log(event.defaultName); // "further.form_submitted"
console.log(event.description); // "Fired when a form is successfully submitted"
// Validate event data against the schema
const result = event.schema.safeParse(data);
// Get field metadata (used by the dashboard to render event docs)
const fields = getEventFields("form_submitted");
// [{ name: "formId", description: "...", required: true }, ...]Adding a new event
- Define the event in
events.tswith adefaultName,description, and zodschema - Use
.describe()on each field — these descriptions are shown in the dashboard profile editor - Rebuild:
npm run build
Building
npm run build # one-time build with microbundle
npm run dev # watch mode