humanbehavior-js 0.2.8 → 0.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/dist/cjs/index.js CHANGED
@@ -5948,7 +5948,8 @@ if (isBrowser) {
5948
5948
  * Identify user from server-side (NextAuth, Firebase, etc.)
5949
5949
  * Use this in your auth events to track users immediately on sign-in
5950
5950
  */
5951
- function identifyUser(userData, apiKey) {
5951
+ function identifyUser(userId, // Separate userId parameter (should be stable unique identifier)
5952
+ userData, apiKey) {
5952
5953
  return __awaiter$1(this, void 0, void 0, function* () {
5953
5954
  try {
5954
5955
  const response = yield fetch('https://ingest.humanbehavior.co/api/ingestion/user', {
@@ -5958,9 +5959,9 @@ function identifyUser(userData, apiKey) {
5958
5959
  'Authorization': `Bearer ${apiKey}`
5959
5960
  },
5960
5961
  body: JSON.stringify({
5961
- userId: userData.email,
5962
- userAttributes: userData,
5963
- sessionId: null, // Will be set by client-side session recording
5962
+ userId: userId, // Use stable unique identifier
5963
+ userAttributes: userData, // Email and other data go here
5964
+ sessionId: 'server-side-identification', // Dummy sessionId for server-side requests
5964
5965
  posthogName: userData.email || userData.name || null // Update posthogName with email
5965
5966
  })
5966
5967
  });