Skip to content

User data not attached when opening surveys via openSurvey() #98

@abdulrafay-07

Description

@abdulrafay-07

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions