11 lines
343 B
TypeScript
11 lines
343 B
TypeScript
export const track = (event: string, params: Record<string, any> = {}) => {
|
|
if (typeof window !== 'undefined' && (window as any).gtag) {
|
|
(window as any).gtag('event', event, params);
|
|
}
|
|
|
|
// Also log to console in development
|
|
if (process.env.NODE_ENV === 'development') {
|
|
console.log('Analytics event:', event, params);
|
|
}
|
|
};
|