@click-chutney/clickanalytics
Version:
Simplified analytics library inspired by Vercel Analytics - privacy-first, lightweight tracking
42 lines (41 loc) • 1.05 kB
TypeScript
import ClickAnalyticsCore from './core';
import { ClickAnalyticsConfig } from './types';
/**
* Initialize analytics for any JavaScript framework
* Inspired by Vercel Analytics inject() function
*
* @example
* ```javascript
* import { inject } from '@click-chutney/clickanalytics';
*
* inject({
* trackingId: 'your-tracking-id',
* debug: true
* });
* ```
*/
export declare function inject(config?: Partial<ClickAnalyticsConfig>): ClickAnalyticsCore | null;
/**
* Get the current analytics instance
*/
export declare function getAnalytics(): ClickAnalyticsCore | null;
/**
* Track a page view
*/
export declare function pageview(url?: string, title?: string): void;
/**
* Track a custom event
*/
export declare function event(name: string, properties?: Record<string, any>): void;
/**
* Identify a user
*/
export declare function identify(userId: string): void;
/**
* Manually flush queued events
*/
export declare function flush(): Promise<void>;
/**
* Reset analytics session
*/
export declare function reset(): void;