diff --git a/packages/client-sdk/src/tracker.ts b/packages/client-sdk/src/tracker.ts index 27772f5..0d07fa0 100644 --- a/packages/client-sdk/src/tracker.ts +++ b/packages/client-sdk/src/tracker.ts @@ -68,3 +68,27 @@ export async function initTianjiTracker(options: InjectTrackerOptions) { ); }); } + +export function reportEvent(eventName: string, data: Record) { + const tianji = (window as any).tianji; + if (!tianji) { + return; + } + + tianji.report(eventName, data); +} + +interface IdentifyPayload { + email?: string; + username?: string; + avatar?: string; + [key: string]: any; +} +export function identify(data: IdentifyPayload) { + const tianji = (window as any).tianji; + if (!tianji) { + return; + } + + tianji.identify(data); +}