UNPKG

@vutolabs/analytics

Version:

Vuto Analytics - instant, Stripe-native analytics for SaaS apps built with Next.js or React.

29 lines (27 loc) 1.12 kB
type Mode = "auto" | "development" | "production"; type AllowedPropertyValues = string | number | boolean | null; interface AnalyticsProps { /** * @param [props.mode] - The mode to use for the analytics script. Defaults to `auto`. * - `auto` - Automatically detect the environment. Uses `production` if the environment cannot be determined. * - `production` - Always use the production script. (Sends events to the server) * - `development` - Always use the development script. (Logs events to the console) */ mode?: Mode; /** * @param [props.projectId] - The project ID to use for the analytics. */ projectId: string; } type AnalyticsEvent = "event" | "pageview" | "identify"; declare global { interface Window { va?: (event: AnalyticsEvent, properties?: unknown) => void; vaq?: [string, unknown?][]; vai?: boolean; vam?: Mode; } } type PlainFlags = Record<string, unknown>; type FlagsDataInput = (string | PlainFlags)[] | PlainFlags; export type { AnalyticsProps as A, FlagsDataInput as F, AllowedPropertyValues as a };