@databuddy/sdk 1.1.0 → 1.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,8 +1,14 @@
1
- # Databuddy SDK
1
+ # Databuddy SDK & React Component
2
2
 
3
- A modern, type-safe analytics SDK and React component for integrating [Databuddy](https://www.databuddy.cc) into your web apps.
3
+ [![npm version](https://img.shields.io/npm/v/@databuddy/sdk?style=flat-square)](https://www.npmjs.com/package/@databuddy/sdk)
4
+ [![License](https://img.shields.io/npm/l/@databuddy/sdk?style=flat-square)](./LICENSE)
5
+ [![Docs](https://img.shields.io/badge/docs-databuddy.cc-blue?style=flat-square)](https://docs.databuddy.cc)
4
6
 
5
- ## Features
7
+ > **The easiest, privacy-first way to add analytics to your web app.**
8
+
9
+ ---
10
+
11
+ ## ✨ Features
6
12
 
7
13
  - 📊 **Automatic page/screen view tracking**
8
14
  - ⚡ **Performance, Web Vitals, and error tracking**
@@ -13,7 +19,7 @@ A modern, type-safe analytics SDK and React component for integrating [Databuddy
13
19
 
14
20
  ---
15
21
 
16
- ## Installation
22
+ ## 🚀 Quickstart
17
23
 
18
24
  ```sh
19
25
  bun add @databuddy/sdk
@@ -21,13 +27,7 @@ bun add @databuddy/sdk
21
27
  npm install @databuddy/sdk
22
28
  ```
23
29
 
24
- ---
25
-
26
- ## Usage
27
-
28
- ### 1. **React/Next.js: Drop-in Component**
29
-
30
- Add the `<Databuddy />` component to your root layout (e.g. `app/layout.tsx`):
30
+ Add to your root layout (Next.js/React):
31
31
 
32
32
  ```tsx
33
33
  import { Databuddy } from '@databuddy/sdk';
@@ -50,63 +50,62 @@ export default function RootLayout({ children }) {
50
50
  }
51
51
  ```
52
52
 
53
- - **All config options are type-safe and passed as data attributes to the script.**
54
- - **No need to manually add `<Script />` or manage the script tag.**
53
+ ---
55
54
 
56
- ### 2. **Script Tag (Vanilla HTML/JS)**
55
+ ## 🛠️ Configuration Options
57
56
 
58
- If you don't use React, you can add the script directly:
57
+ All options are type-safe and documented in `DatabuddyConfig`:
59
58
 
60
- ```html
61
- <script
62
- src="https://app.databuddy.cc/databuddy.js"
63
- data-client-id="YOUR_CLIENT_ID"
64
- data-track-screen-views="true"
65
- data-track-performance="true"
66
- defer
67
- ></script>
68
- ```
59
+ | Option | Type | Default | Description |
60
+ |-----------------------|-----------|--------------|-------------|
61
+ | `clientId` | string | — | **Required.** Your Databuddy project client ID. |
62
+ | `clientSecret` | string | — | (Advanced) For server-side use only. |
63
+ | `apiUrl` | string | `https://api.databuddy.cc` | Custom API endpoint. |
64
+ | `scriptUrl` | string | `https://app.databuddy.cc/databuddy.js` | Custom script URL. |
65
+ | `sdk` | string | `web` | SDK name. Only override for custom builds. |
66
+ | `sdkVersion` | string | *auto* | SDK version. Defaults to package version. |
67
+ | `disabled` | boolean | `false` | Disable all tracking. |
68
+ | `waitForProfile` | boolean | `false` | Wait for user profile before sending events. |
69
+ | `trackScreenViews` | boolean | `true` | Auto-track page/screen views. |
70
+ | `trackHashChanges` | boolean | `false` | Track hash changes in URL. |
71
+ | `trackAttributes` | boolean | `false` | Track data-* attributes. |
72
+ | `trackOutgoingLinks` | boolean | `false` | Track outgoing link clicks. |
73
+ | `trackSessions` | boolean | `true` | Track user sessions. |
74
+ | `trackPerformance` | boolean | `true` | Track page performance. |
75
+ | `trackWebVitals` | boolean | `true` | Track Web Vitals. |
76
+ | `trackEngagement` | boolean | `false` | Track engagement metrics. |
77
+ | `trackScrollDepth` | boolean | `false` | Track scroll depth. |
78
+ | `trackExitIntent` | boolean | `false` | Track exit intent. |
79
+ | `trackInteractions` | boolean | `false` | Track user interactions. |
80
+ | `trackErrors` | boolean | `true` | Track JS errors. |
81
+ | `trackBounceRate` | boolean | `false` | Track bounce rate. |
82
+ | `samplingRate` | number | `1.0` | Sampling rate (0.0–1.0). |
83
+ | `enableRetries` | boolean | `true` | Retry failed requests. |
84
+ | `maxRetries` | number | `3` | Max retries. |
85
+ | `initialRetryDelay` | number | `500` | Initial retry delay (ms). |
86
+ | `enableBatching` | boolean | `true` | Enable event batching. |
87
+ | `batchSize` | number | `20` | Events per batch (1–50). |
88
+ | `batchTimeout` | number | `5000` | Batch timeout (ms, 100–30000). |
69
89
 
70
90
  ---
71
91
 
72
- ## Configuration Options
92
+ ## 💡 FAQ
73
93
 
74
- All options are type-safe and documented in `DatabuddyConfig`:
94
+ **Q: Is Databuddy privacy-friendly?**
95
+ A: Yes! All analytics are anonymized by default. No cookies, no fingerprinting, no PII.
96
+
97
+ **Q: Can I use this in Next.js, Remix, or plain React?**
98
+ A: Yes! `<Databuddy />` works in any React app. For non-React, use the script tag directly.
99
+
100
+ **Q: How do I disable analytics in development?**
101
+ A: Use the `disabled` prop: `<Databuddy disabled={process.env.NODE_ENV === 'development'} ... />`
75
102
 
76
- | Option | Type | Default | Description |
77
- |---------------------|-----------|--------------|-------------|
78
- | `clientId` | string | — | **Required.** Your Databuddy project client ID. |
79
- | `clientSecret` | string | — | (Advanced) For server-side use only. |
80
- | `apiUrl` | string | `https://api.databuddy.cc` | Custom API endpoint. |
81
- | `scriptUrl` | string | `https://app.databuddy.cc/databuddy.js` | Custom script URL. |
82
- | `sdk` | string | `web` | SDK name. Only override for custom builds. |
83
- | `sdkVersion` | string | `1.0.0` | SDK version. Only override for custom builds. |
84
- | `disabled` | boolean | `false` | Disable all tracking. |
85
- | `waitForProfile` | boolean | `false` | Wait for user profile before sending events. |
86
- | `trackScreenViews` | boolean | `true` | Auto-track page/screen views. |
87
- | `trackHashChanges` | boolean | `false` | Track hash changes in URL. |
88
- | `trackAttributes` | boolean | `false` | Track data-* attributes. |
89
- | `trackOutgoingLinks`| boolean | `false` | Track outgoing link clicks. |
90
- | `trackSessions` | boolean | `false` | Track user sessions. |
91
- | `trackPerformance` | boolean | `true` | Track page performance. |
92
- | `trackWebVitals` | boolean | `true` | Track Web Vitals. |
93
- | `trackEngagement` | boolean | `false` | Track engagement metrics. |
94
- | `trackScrollDepth` | boolean | `false` | Track scroll depth. |
95
- | `trackExitIntent` | boolean | `false` | Track exit intent. |
96
- | `trackInteractions` | boolean | `false` | Track user interactions. |
97
- | `trackErrors` | boolean | `true` | Track JS errors. |
98
- | `trackBounceRate` | boolean | `false` | Track bounce rate. |
99
- | `samplingRate` | number | `1.0` | Sampling rate (0.0–1.0). |
100
- | `enableRetries` | boolean | `true` | Retry failed requests. |
101
- | `maxRetries` | number | `3` | Max retries. |
102
- | `initialRetryDelay` | number | `500` | Initial retry delay (ms). |
103
- | `enableBatching` | boolean | `true` | Enable event batching. |
104
- | `batchSize` | number | `20` | Events per batch (1–50). |
105
- | `batchTimeout` | number | `5000` | Batch timeout (ms, 100–30000). |
103
+ **Q: Where do I find my `clientId`?**
104
+ A: In your [Databuddy dashboard](https://app.databuddy.cc).
106
105
 
107
106
  ---
108
107
 
109
- ## Troubleshooting
108
+ ## 🧑‍💻 Troubleshooting
110
109
 
111
110
  - **Script not loading?**
112
111
  - Make sure your `clientId` is correct and the script URL is reachable.
@@ -119,7 +118,7 @@ All options are type-safe and documented in `DatabuddyConfig`:
119
118
 
120
119
  ---
121
120
 
122
- ## Documentation & Support
121
+ ## 📚 Documentation & Support
123
122
 
124
123
  - [Databuddy Docs](https://docs.databuddy.cc)
125
124
  - [Dashboard](https://app.databuddy.cc)
@@ -0,0 +1,8 @@
1
+ import type { DatabuddyConfig } from './types';
2
+ /**
3
+ * <Databuddy /> component for Next.js/React apps
4
+ * Injects the databuddy.js script with all config as data attributes
5
+ * Usage: <Databuddy clientId="..." trackScreenViews trackPerformance ... />
6
+ */
7
+ export declare function Databuddy(props: DatabuddyConfig): null;
8
+ export default Databuddy;
@@ -0,0 +1,47 @@
1
+ 'use client';
2
+ import pkg from '../package.json';
3
+ import { useEffect } from 'react';
4
+ /**
5
+ * <Databuddy /> component for Next.js/React apps
6
+ * Injects the databuddy.js script with all config as data attributes
7
+ * Usage: <Databuddy clientId="..." trackScreenViews trackPerformance ... />
8
+ */
9
+ export function Databuddy(props) {
10
+ useEffect(() => {
11
+ if (typeof window === 'undefined')
12
+ return;
13
+ if (props.disabled)
14
+ return;
15
+ if (document.querySelector('script[data-databuddy-injected]'))
16
+ return;
17
+ const script = document.createElement('script');
18
+ script.src = props.scriptUrl || 'https://app.databuddy.cc/databuddy.js';
19
+ script.async = true;
20
+ script.crossOrigin = 'anonymous';
21
+ script.setAttribute('data-databuddy-injected', 'true');
22
+ // Always set sdkVersion from package.json unless explicitly overridden
23
+ const sdkVersion = props.sdkVersion || pkg.version;
24
+ script.setAttribute('data-sdk-version', sdkVersion);
25
+ for (const [key, value] of Object.entries(props)) {
26
+ if (value !== undefined && key !== 'sdkVersion') {
27
+ const dataKey = `data-${key.replace(/([A-Z])/g, '-$1').toLowerCase()}`;
28
+ // Convert booleans and numbers to string for HTML attributes
29
+ if (typeof value === 'boolean') {
30
+ script.setAttribute(dataKey, value ? 'true' : 'false');
31
+ }
32
+ else if (typeof value === 'number') {
33
+ script.setAttribute(dataKey, value.toString());
34
+ }
35
+ else {
36
+ script.setAttribute(dataKey, String(value));
37
+ }
38
+ }
39
+ }
40
+ document.head.appendChild(script);
41
+ return () => {
42
+ script.remove();
43
+ };
44
+ }, [props]);
45
+ return null;
46
+ }
47
+ export default Databuddy;
package/dist/index.d.ts CHANGED
@@ -1,2 +1,3 @@
1
- export * from './DatabuddyProvider';
1
+ export * from './Databuddy';
2
2
  export * from './types';
3
+ export * from './tracker';
package/dist/index.js CHANGED
@@ -1,2 +1,4 @@
1
- export * from './DatabuddyProvider';
1
+ // Main exports
2
+ export * from './Databuddy';
2
3
  export * from './types';
4
+ export * from './tracker';
@@ -0,0 +1,43 @@
1
+ /**
2
+ * Databuddy SDK Client-side Tracker
3
+ * Provides type-safe tracking functions
4
+ */
5
+ import type { DatabuddyTracker, TrackFunction } from './types';
6
+ /**
7
+ * Check if the Databuddy tracker is available
8
+ */
9
+ export declare function isTrackerAvailable(): boolean;
10
+ /**
11
+ * Get the Databuddy tracker instance
12
+ */
13
+ export declare function getTracker(): DatabuddyTracker | null;
14
+ /**
15
+ * Type-safe track function
16
+ */
17
+ export declare const track: TrackFunction;
18
+ /**
19
+ * Clear the current session
20
+ */
21
+ export declare function clear(): void;
22
+ /**
23
+ * Flush any queued events
24
+ */
25
+ export declare function flush(): void;
26
+ /**
27
+ * Track an error event
28
+ */
29
+ export declare function trackError(message: string, properties?: {
30
+ filename?: string;
31
+ lineno?: number;
32
+ colno?: number;
33
+ stack?: string;
34
+ error_type?: string;
35
+ [key: string]: any;
36
+ }): Promise<void>;
37
+ declare const _default: {
38
+ track: TrackFunction;
39
+ clear: typeof clear;
40
+ flush: typeof flush;
41
+ trackError: typeof trackError;
42
+ };
43
+ export default _default;
@@ -0,0 +1,86 @@
1
+ /**
2
+ * Databuddy SDK Client-side Tracker
3
+ * Provides type-safe tracking functions
4
+ */
5
+ /**
6
+ * Check if the Databuddy tracker is available
7
+ */
8
+ export function isTrackerAvailable() {
9
+ return typeof window !== 'undefined' &&
10
+ (!!window.databuddy || !!window.db);
11
+ }
12
+ /**
13
+ * Get the Databuddy tracker instance
14
+ */
15
+ export function getTracker() {
16
+ if (typeof window === 'undefined')
17
+ return null;
18
+ return window.databuddy || null;
19
+ }
20
+ /**
21
+ * Type-safe track function
22
+ */
23
+ export const track = async (eventName, properties) => {
24
+ var _a, _b;
25
+ if (typeof window === 'undefined') {
26
+ return;
27
+ }
28
+ // Try window.db first (shorthand), then window.databuddy
29
+ const tracker = ((_a = window.db) === null || _a === void 0 ? void 0 : _a.track) || ((_b = window.databuddy) === null || _b === void 0 ? void 0 : _b.track);
30
+ if (!tracker) {
31
+ return;
32
+ }
33
+ try {
34
+ await tracker(eventName, properties);
35
+ }
36
+ catch (error) {
37
+ }
38
+ };
39
+ /**
40
+ * Clear the current session
41
+ */
42
+ export function clear() {
43
+ var _a, _b;
44
+ if (typeof window === 'undefined') {
45
+ return;
46
+ }
47
+ const tracker = ((_a = window.db) === null || _a === void 0 ? void 0 : _a.clear) || ((_b = window.databuddy) === null || _b === void 0 ? void 0 : _b.clear);
48
+ if (!tracker) {
49
+ return;
50
+ }
51
+ try {
52
+ tracker();
53
+ }
54
+ catch (error) {
55
+ }
56
+ }
57
+ /**
58
+ * Flush any queued events
59
+ */
60
+ export function flush() {
61
+ var _a, _b;
62
+ if (typeof window === 'undefined') {
63
+ return;
64
+ }
65
+ const tracker = ((_a = window.db) === null || _a === void 0 ? void 0 : _a.flush) || ((_b = window.databuddy) === null || _b === void 0 ? void 0 : _b.flush);
66
+ if (!tracker) {
67
+ return;
68
+ }
69
+ try {
70
+ tracker();
71
+ }
72
+ catch (error) {
73
+ }
74
+ }
75
+ /**
76
+ * Track an error event
77
+ */
78
+ export function trackError(message, properties) {
79
+ return track('error', { message, ...properties });
80
+ }
81
+ export default {
82
+ track,
83
+ clear,
84
+ flush,
85
+ trackError,
86
+ };
package/dist/types.d.ts CHANGED
@@ -16,7 +16,7 @@ export interface DatabuddyConfig {
16
16
  clientSecret?: string;
17
17
  /**
18
18
  * Custom API endpoint for event ingestion.
19
- * Default: 'https://api.databuddy.cc'
19
+ * Default: 'https://basket.databuddy.cc'
20
20
  */
21
21
  apiUrl?: string;
22
22
  /**
@@ -30,7 +30,7 @@ export interface DatabuddyConfig {
30
30
  */
31
31
  sdk?: string;
32
32
  /**
33
- * SDK version (default: '1.0.0').
33
+ * SDK version (defaults to package.json version).
34
34
  * Only override for custom builds.
35
35
  */
36
36
  sdkVersion?: string;
@@ -51,6 +51,10 @@ export interface DatabuddyConfig {
51
51
  * Track hash changes in the URL (default: false).
52
52
  */
53
53
  trackHashChanges?: boolean;
54
+ /**
55
+ * Track user sessions (default: true).
56
+ */
57
+ trackSessions?: boolean;
54
58
  /**
55
59
  * Track data-* attributes on elements (default: false).
56
60
  */
@@ -60,17 +64,9 @@ export interface DatabuddyConfig {
60
64
  */
61
65
  trackOutgoingLinks?: boolean;
62
66
  /**
63
- * Track user sessions (default: false).
64
- */
65
- trackSessions?: boolean;
66
- /**
67
- * Track page performance metrics (default: true).
68
- */
69
- trackPerformance?: boolean;
70
- /**
71
- * Track Web Vitals metrics (default: true).
67
+ * Track user interactions (default: false).
72
68
  */
73
- trackWebVitals?: boolean;
69
+ trackInteractions?: boolean;
74
70
  /**
75
71
  * Track user engagement metrics (default: false).
76
72
  */
@@ -84,17 +80,21 @@ export interface DatabuddyConfig {
84
80
  */
85
81
  trackExitIntent?: boolean;
86
82
  /**
87
- * Track user interactions (default: false).
83
+ * Track bounce rate (default: false).
88
84
  */
89
- trackInteractions?: boolean;
85
+ trackBounceRate?: boolean;
90
86
  /**
91
- * Track JavaScript errors (default: true).
87
+ * Track page performance metrics (default: true).
92
88
  */
93
- trackErrors?: boolean;
89
+ trackPerformance?: boolean;
94
90
  /**
95
- * Track bounce rate (default: false).
91
+ * Track Web Vitals metrics (default: false).
96
92
  */
97
- trackBounceRate?: boolean;
93
+ trackWebVitals?: boolean;
94
+ /**
95
+ * Track JavaScript errors (default: false).
96
+ */
97
+ trackErrors?: boolean;
98
98
  /**
99
99
  * Sampling rate for events (0.0 to 1.0, default: 1.0).
100
100
  * Example: 0.5 = 50% of events sent.
@@ -115,26 +115,184 @@ export interface DatabuddyConfig {
115
115
  */
116
116
  initialRetryDelay?: number;
117
117
  /**
118
- * Enable event batching (default: true).
118
+ * Enable event batching (default: false).
119
119
  */
120
120
  enableBatching?: boolean;
121
121
  /**
122
- * Number of events to batch before sending (default: 20).
122
+ * Number of events to batch before sending (default: 10).
123
123
  * Only used if enableBatching is true.
124
124
  * Min: 1, Max: 50
125
125
  */
126
126
  batchSize?: number;
127
127
  /**
128
- * Batch timeout in milliseconds (default: 5000).
128
+ * Batch timeout in milliseconds (default: 2000).
129
129
  * Only used if enableBatching is true.
130
130
  * Min: 100, Max: 30000
131
131
  */
132
132
  batchTimeout?: number;
133
133
  }
134
134
  /**
135
- * Event properties that can be attached to any event
135
+ * Base event properties that can be attached to any event
136
136
  */
137
- export interface EventProperties {
137
+ export interface BaseEventProperties {
138
+ /** Page URL */
139
+ __path?: string;
140
+ /** Page title */
141
+ __title?: string;
142
+ /** Referrer URL */
143
+ __referrer?: string;
144
+ /** Event timestamp in milliseconds */
145
+ __timestamp_ms?: number;
146
+ /** Session ID */
147
+ sessionId?: string;
148
+ /** Session start time */
149
+ sessionStartTime?: number;
150
+ /** Page count in session */
151
+ page_count?: number;
152
+ /** Screen resolution */
153
+ screen_resolution?: string;
154
+ /** Viewport size */
155
+ viewport_size?: string;
156
+ /** User timezone */
157
+ timezone?: string;
158
+ /** User language */
159
+ language?: string;
160
+ /** UTM parameters */
161
+ utm_source?: string;
162
+ utm_medium?: string;
163
+ utm_campaign?: string;
164
+ utm_term?: string;
165
+ utm_content?: string;
166
+ }
167
+ /**
168
+ * Custom event properties that can be attached to any event
169
+ */
170
+ export interface EventProperties extends BaseEventProperties {
138
171
  /** Custom properties for the event */
139
- [key: string]: string | number | boolean | null | undefined | EventProperties;
172
+ [key: string]: string | number | boolean | null | undefined;
140
173
  }
174
+ /**
175
+ * Pre-defined event types with their specific properties
176
+ */
177
+ export interface EventTypeMap {
178
+ screen_view: {
179
+ time_on_page?: number;
180
+ scroll_depth?: number;
181
+ interaction_count?: number;
182
+ has_exit_intent?: boolean;
183
+ is_bounce?: 0 | 1;
184
+ };
185
+ page_exit: {
186
+ time_on_page: number;
187
+ scroll_depth: number;
188
+ interaction_count: number;
189
+ has_exit_intent: boolean;
190
+ page_count: number;
191
+ is_bounce: 0 | 1;
192
+ };
193
+ button_click: {
194
+ button_text?: string;
195
+ button_type?: string;
196
+ button_id?: string;
197
+ element_class?: string;
198
+ };
199
+ link_out: {
200
+ href: string;
201
+ text?: string;
202
+ target_domain?: string;
203
+ };
204
+ form_submit: {
205
+ form_id?: string;
206
+ form_name?: string;
207
+ form_type?: string;
208
+ success?: boolean;
209
+ };
210
+ web_vitals: {
211
+ fcp?: number;
212
+ lcp?: number;
213
+ cls?: string;
214
+ fid?: number;
215
+ ttfb?: number;
216
+ load_time?: number;
217
+ dom_ready_time?: number;
218
+ render_time?: number;
219
+ request_time?: number;
220
+ };
221
+ error: {
222
+ message: string;
223
+ filename?: string;
224
+ lineno?: number;
225
+ colno?: number;
226
+ stack?: string;
227
+ error_type?: string;
228
+ };
229
+ [eventName: string]: EventProperties;
230
+ }
231
+ /**
232
+ * Available event names
233
+ */
234
+ export type EventName = keyof EventTypeMap;
235
+ /**
236
+ * Properties for a specific event type
237
+ */
238
+ export type PropertiesForEvent<T extends EventName> = T extends keyof EventTypeMap ? EventTypeMap[T] & EventProperties : EventProperties;
239
+ /**
240
+ * Databuddy tracker instance interface
241
+ */
242
+ export interface DatabuddyTracker {
243
+ /**
244
+ * Track a custom event
245
+ */
246
+ track<T extends EventName>(eventName: T, properties?: PropertiesForEvent<T>): Promise<void>;
247
+ /**
248
+ * Track a screen/page view
249
+ */
250
+ screenView(path?: string, properties?: EventProperties): void;
251
+ /**
252
+ * Set global properties that will be attached to all events
253
+ */
254
+ setGlobalProperties(properties: EventProperties): void;
255
+ /**
256
+ * Clear the current user session and generate new IDs
257
+ */
258
+ clear(): void;
259
+ /**
260
+ * Flush any queued events immediately
261
+ */
262
+ flush(): void;
263
+ /**
264
+ * Track a custom event with full type safety
265
+ */
266
+ trackCustomEvent(eventName: string, properties?: EventProperties): void;
267
+ }
268
+ /**
269
+ * Global window interface extensions
270
+ */
271
+ declare global {
272
+ interface Window {
273
+ databuddy?: DatabuddyTracker;
274
+ db?: {
275
+ track: DatabuddyTracker['track'];
276
+ screenView: DatabuddyTracker['screenView'];
277
+ clear: DatabuddyTracker['clear'];
278
+ flush: DatabuddyTracker['flush'];
279
+ setGlobalProperties: DatabuddyTracker['setGlobalProperties'];
280
+ trackCustomEvent: DatabuddyTracker['trackCustomEvent'];
281
+ };
282
+ }
283
+ }
284
+ /**
285
+ * Helper type for HTML data attributes for automatic tracking
286
+ */
287
+ export interface DataAttributes {
288
+ /** Event name to track when element is clicked */
289
+ 'data-track': string;
290
+ /** Additional data attributes (converted to camelCase) */
291
+ [key: `data-${string}`]: string;
292
+ }
293
+ /**
294
+ * Utility types for creating typed event tracking functions
295
+ */
296
+ export type TrackFunction = <T extends EventName>(eventName: T, properties?: PropertiesForEvent<T>) => Promise<void>;
297
+ export type ScreenViewFunction = (path?: string, properties?: EventProperties) => void;
298
+ export type SetGlobalPropertiesFunction = (properties: EventProperties) => void;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@databuddy/sdk",
3
- "version": "1.1.0",
3
+ "version": "1.3.0",
4
4
  "private": false,
5
5
  "description": "Official Databuddy Analytics SDK",
6
6
  "main": "dist/index.js",