Skip to content

Commit 93e2971

Browse files
committed
chore(rybbit): improve types
1 parent d1b2aef commit 93e2971

File tree

1 file changed

+27
-1
lines changed

1 file changed

+27
-1
lines changed

src/runtime/registry/rybbit-analytics.ts

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,34 @@ export const RybbitAnalyticsOptions = object({
1414
export type RybbitAnalyticsInput = RegistryScriptInput<typeof RybbitAnalyticsOptions, false>
1515

1616
export interface RybbitAnalyticsApi {
17+
/**
18+
* Tracks a page view
19+
*/
1720
pageview: () => void
18-
event: (eventName: string, properties?: Record<string, any>) => void
21+
22+
/**
23+
* Tracks a custom event
24+
* @param name Name of the event
25+
* @param properties Optional properties for the event
26+
*/
27+
event: (name: string, properties?: Record<string, any>) => void
28+
29+
/**
30+
* Sets a custom user ID for tracking logged-in users
31+
* @param userId The user ID to set (will be stored in localStorage)
32+
*/
33+
identify: (userId: string) => void
34+
35+
/**
36+
* Clears the stored user ID
37+
*/
38+
clearUserId: () => void
39+
40+
/**
41+
* Gets the currently set user ID
42+
* @returns The current user ID or null if not set
43+
*/
44+
getUserId: () => string | null
1945
}
2046

2147
declare global {

0 commit comments

Comments
 (0)