@junobuild/analytics
Version:
Tracker for Juno analytics
15 lines (14 loc) • 885 B
TypeScript
import type { UserEnvironment } from './types/env';
export { trackEvent, trackEventAsync, trackPageView, trackPageViewAsync } from './tracker';
export type * from './types/env';
/**
* Initializes the Juno Analytics.
*
* Although this function is synchronous, it triggers asynchronous tracking of the initial page view
* and, optionally, the initialization of web vitals, without awaiting their completion.
* This design ensures better performance and avoids blocking your application's boot time.
*
* @param {UserEnvironment} [userEnv] - The optional user environment configuration. If no environment is provided, the variables injected by the Vite or NextJS plugins will be used.
* @returns {() => void} A cleanup function that removes hooks (such as navigation tracking) added for analytics.
*/
export declare const initOrbiter: (userEnv?: UserEnvironment) => (() => void);