-
Notifications
You must be signed in to change notification settings - Fork 3
Description
Summary
User data is correctly populated and visible in the Userback dashboard when using userback.open(), but the same user data is missing when a survey is opened via userback.openSurvey() — even though both calls use the same Userback instance.
This makes it seem like openSurvey() is not inheriting or attaching the initialized user_data.
Expected Behavior
When a survey is opened using userback.openSurvey(surveyId), the survey submission should include the same user_data that was provided during Userback initialization.
Actual Behavior
User data is correctly sent when calling:
userback.open();
User data is NOT being sent with survey when calling:
userback.openSurvey(surveyId);
The survey submission only shows the user id
Setup Details
Userback initialization (works correctly)
Userback is initialized after the user is available, and user data is passed at init time:
const instance = await Userback(clientEnv.NEXT_PUBLIC_USERBACK_TOKEN, {
user_data: {
id: user.id,
info: {
name: user.name,
email: user.email,
},
},
autohide: true,
});
This instance is stored in React context and reused across the app.
Survey trigger logic (problematic case)
Surveys are triggered after a usage threshold is reached:
if (next.count >= FEEDBACK_TRIGGER_COUNT && userback) {
userback.openSurvey(surveyId);
next.triggeredAt = Date.now();
}
- userback here is the same instance created during initialization.
- No re-initialization or mutation happens before calling openSurvey().
Why this seems like a Userback issue
The same Userback instance correctly includes user data when calling open()
Initialization happens before any survey is triggered
This strongly suggests that:
- openSurvey() does not automatically attach user_data, or
- surveys require user data to be passed differently / explicitly