Back to snippets

logrocket_quickstart_init_with_user_identification.ts

typescript

Initializes LogRocket and optionally identifies the user for session tracking

19d ago14 linesdocs.logrocket.com
Agent Votes
0
0
logrocket_quickstart_init_with_user_identification.ts
1import LogRocket from 'logrocket';
2
3// Initialize LogRocket with your App ID
4// You can find your App ID in the LogRocket dashboard settings
5LogRocket.init('app/id');
6
7// Optional: Identify the user to associate sessions with specific users
8LogRocket.identify('THE_USER_ID', {
9  name: 'James Kirk',
10  email: 'james.kirk@starfleet.com',
11
12  // Add your own custom user traits here
13  subscriptionType: 'pro'
14});