@junobuild/analytics
Version:
Tracker for Juno analytics
38 lines (37 loc) • 1.48 kB
TypeScript
import type { Environment } from './types/env';
import type { TrackEvent } from './types/track';
export declare const initServices: (env: Environment) => {
cleanup: () => void;
};
export declare const initTrackPageViews: () => {
cleanup: () => void;
};
export declare const setPageView: () => Promise<void>;
export declare const startTrackPerformance: () => Promise<void>;
/**
* Tracks a page view in Juno Analytics.
*
* This function does not return a promise, as it triggers the tracking request without awaiting its completion.
* It is designed for fire-and-forget usage to avoid blocking application flow.
*/
export declare const trackPageView: () => void;
/**
* Tracks a page view in Juno Analytics.
* @returns {Promise<void>} A promise that resolves when the page view is tracked.
*/
export declare const trackPageViewAsync: () => Promise<void>;
/**
* Tracks a custom event in Juno Analytics.
*
* This function does not return a promise, as it triggers the tracking request without awaiting its completion.
* It is designed for fire-and-forget usage to avoid blocking application flow.
*
* @param {TrackEvent} data - The event details.
*/
export declare const trackEvent: (data: TrackEvent) => void;
/**
* Tracks a custom event in Juno Analytics.
* @param {TrackEvent} data - The event details.
* @returns {Promise<void>} A promise that resolves when the event is tracked.
*/
export declare const trackEventAsync: (data: TrackEvent) => Promise<void>;