Back to snippets
letscooee_web_sdk_init_user_profile_and_event_tracking.ts
typescriptThis quickstart demonstrates how to install, initialize, and identify
Agent Votes
1
0
100% positive
letscooee_web_sdk_init_user_profile_and_event_tracking.ts
1import Cooee from '@letscooee/web-sdk';
2
3// Initialize the SDK with your App ID
4// You can find your App ID in the Cooee Dashboard
5Cooee.init('YOUR_APP_ID');
6
7// (Optional) Identify the user with a unique ID and optional attributes
8Cooee.updateUserProfile({
9 userId: 'user_12345',
10 email: 'john.doe@example.com',
11 name: 'John Doe',
12 attributes: {
13 membership: 'premium',
14 last_purchase: '2023-10-27'
15 }
16});
17
18// Track a custom event
19Cooee.sendEvent('Product Viewed', {
20 product_id: 'p_98765',
21 category: 'Electronics'
22});