UNPKG

@nuxt/scripts

Version:

Load third-party scripts with better performance, privacy and DX in Nuxt Apps.

78 lines (77 loc) 5.72 kB
import type { RegistryScriptInput } from '#nuxt-scripts/types'; export declare const DatabuddyAnalyticsOptions: import("valibot").ObjectSchema<{ readonly clientId: import("valibot").StringSchema<undefined>; readonly scriptUrl: import("valibot").OptionalSchema<import("valibot").StringSchema<undefined>, undefined>; readonly apiUrl: import("valibot").OptionalSchema<import("valibot").StringSchema<undefined>, undefined>; readonly disabled: import("valibot").OptionalSchema<import("valibot").BooleanSchema<undefined>, undefined>; readonly trackScreenViews: import("valibot").OptionalSchema<import("valibot").BooleanSchema<undefined>, undefined>; readonly trackPerformance: import("valibot").OptionalSchema<import("valibot").BooleanSchema<undefined>, undefined>; readonly trackSessions: import("valibot").OptionalSchema<import("valibot").BooleanSchema<undefined>, undefined>; readonly trackWebVitals: import("valibot").OptionalSchema<import("valibot").BooleanSchema<undefined>, undefined>; readonly trackErrors: import("valibot").OptionalSchema<import("valibot").BooleanSchema<undefined>, undefined>; readonly trackOutgoingLinks: import("valibot").OptionalSchema<import("valibot").BooleanSchema<undefined>, undefined>; readonly trackScrollDepth: import("valibot").OptionalSchema<import("valibot").BooleanSchema<undefined>, undefined>; readonly trackEngagement: import("valibot").OptionalSchema<import("valibot").BooleanSchema<undefined>, undefined>; readonly trackInteractions: import("valibot").OptionalSchema<import("valibot").BooleanSchema<undefined>, undefined>; readonly trackAttributes: import("valibot").OptionalSchema<import("valibot").BooleanSchema<undefined>, undefined>; readonly trackHashChanges: import("valibot").OptionalSchema<import("valibot").BooleanSchema<undefined>, undefined>; readonly trackExitIntent: import("valibot").OptionalSchema<import("valibot").BooleanSchema<undefined>, undefined>; readonly trackBounceRate: import("valibot").OptionalSchema<import("valibot").BooleanSchema<undefined>, undefined>; readonly enableBatching: import("valibot").OptionalSchema<import("valibot").BooleanSchema<undefined>, undefined>; readonly batchSize: import("valibot").OptionalSchema<import("valibot").NumberSchema<undefined>, undefined>; readonly batchTimeout: import("valibot").OptionalSchema<import("valibot").NumberSchema<undefined>, undefined>; readonly enableRetries: import("valibot").OptionalSchema<import("valibot").BooleanSchema<undefined>, undefined>; readonly maxRetries: import("valibot").OptionalSchema<import("valibot").NumberSchema<undefined>, undefined>; readonly initialRetryDelay: import("valibot").OptionalSchema<import("valibot").NumberSchema<undefined>, undefined>; readonly samplingRate: import("valibot").OptionalSchema<import("valibot").NumberSchema<undefined>, undefined>; readonly sdk: import("valibot").OptionalSchema<import("valibot").StringSchema<undefined>, undefined>; readonly sdkVersion: import("valibot").OptionalSchema<import("valibot").StringSchema<undefined>, undefined>; readonly enableObservability: import("valibot").OptionalSchema<import("valibot").BooleanSchema<undefined>, undefined>; readonly observabilityService: import("valibot").OptionalSchema<import("valibot").StringSchema<undefined>, undefined>; readonly observabilityEnvironment: import("valibot").OptionalSchema<import("valibot").StringSchema<undefined>, undefined>; readonly observabilityVersion: import("valibot").OptionalSchema<import("valibot").StringSchema<undefined>, undefined>; readonly enableLogging: import("valibot").OptionalSchema<import("valibot").BooleanSchema<undefined>, undefined>; readonly enableTracing: import("valibot").OptionalSchema<import("valibot").BooleanSchema<undefined>, undefined>; readonly enableErrorTracking: import("valibot").OptionalSchema<import("valibot").BooleanSchema<undefined>, undefined>; }, undefined>; export type DatabuddyAnalyticsInput = RegistryScriptInput<typeof DatabuddyAnalyticsOptions, false>; export interface DatabuddyAnalyticsApi { /** * Track a custom event. * @param eventName Name of the event (use snake_case) * @param properties Optional event properties */ track: (eventName: string, properties?: Record<string, any>) => Promise<any> | any | void; /** * Manually record a page / screen view. Useful for SPA route changes. * @param path Optional path to record (defaults to current location) * @param properties Optional additional properties for the screen view */ screenView: (path?: string, properties?: Record<string, any>) => void; /** * Set properties that will be attached to all future events (e.g. user_id). * @param properties Key/value map of properties to attach globally */ setGlobalProperties: (properties: Record<string, any>) => void; /** * Track a custom event alias (compatibility helper present on the global) * @param eventName Name of the event * @param properties Optional event properties */ trackCustomEvent: (eventName: string, properties?: Record<string, any>) => void; /** * Clears session and anonymous identifiers (useful on logout). */ clear: () => void; /** * Force immediate sending of any queued/batched events. */ flush: () => void; } declare global { interface Window { databuddy?: DatabuddyAnalyticsApi; db?: DatabuddyAnalyticsApi; } } export declare function useScriptDatabuddyAnalytics<T extends DatabuddyAnalyticsApi>(_options?: DatabuddyAnalyticsInput): import("#nuxt-scripts/types").UseScriptContext<T>;