Update components/kleap-analytics.tsx

This commit is contained in:
kleap-admin 2026-01-15 14:29:09 +00:00
parent 97f9ea3142
commit a1f36c9fc8
1 changed files with 28 additions and 0 deletions

View File

@ -0,0 +1,28 @@
'use client'
import { useEffect } from 'react'
/**
* Kleap Analytics Component
* Loads analytics when configured
* Note: In production, analytics ID will be injected via Vercel deployment
*/
export function KleapAnalytics() {
useEffect(() => {
// Only load analytics when inside an iframe (Kleap environment)
if (typeof window !== 'undefined' && window.parent !== window) {
// In preview mode, we don't have real analytics
// This is just a placeholder for the structure
// Real analytics will be injected during Vercel deployment
// Add window.kleap.track function for compatibility
(window as any).kleap = (window as any).kleap || {};
(window as any).kleap.track = function(name: string, data?: any) {
console.debug('[Kleap Analytics]', name, data);
// In production, this will call umami.track
};
}
}, []);
return null;
}