@tracelog/lib 2.6.1 → 2.6.2-rc.94.7

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
@@ -94,13 +94,19 @@ await tracelog.init({
94
94
  }
95
95
  });
96
96
 
97
- // 6. Track custom events (after init)
97
+ // 6. Identify user (after init, optional)
98
+ tracelog.identify('cust_123', { name: 'Maria Garcia', plan: 'pro' });
99
+
100
+ // 7. Track custom events (after init)
98
101
  tracelog.event('button_clicked', {
99
102
  buttonId: 'signup-cta',
100
103
  source: 'homepage'
101
104
  });
102
105
 
103
- // 7. Cleanup (on consent revoke or app unmount)
106
+ // 8. On logout: reset identity
107
+ await tracelog.resetIdentity();
108
+
109
+ // 9. Cleanup (on consent revoke or app unmount)
104
110
  tracelog.destroy();
105
111
  ```
106
112
 
@@ -130,6 +136,8 @@ tracelog.destroy();
130
136
  | `removeTransformer(hook)` | Remove a previously set transformer |
131
137
  | `setCustomHeaders(provider)` | Add custom HTTP headers to requests (see [Custom Headers](#custom-headers)) |
132
138
  | `removeCustomHeaders()` | Remove custom headers provider |
139
+ | `identify(userId, traits?)` | Associate visitor with a known user identity |
140
+ | `resetIdentity()` | Clear identity, regenerate UUID, start new session |
133
141
  | `isInitialized()` | Check initialization status |
134
142
  | `getSessionId()` | Get current session ID (or null) |
135
143
  | `setQaMode(enabled)` | Enable/disable QA mode (console logging) |