Identify User

This section covers how to bind each report to the identity of the user reporting the problem. You have the flexibility to add some extra attributes about the device as well as the user.

User Email and Name

By default, we ask for the user to enter their email in any report. You can set the email as a required or optional field as explained here. In both cases, the email text area will be visible.

However, you can set the email as well as the username yourself and the email field will be prefilled with the one you already provided. Ideally, this API should be called as soon as a user logs into your app.

Instabug.identifyUserWithEmail("john.appleseed@apple.com", "John Appleseed");

User Attributes

You can assign custom attributes to your users and they will show up on your Instabug dashboard with each report. Those attributes can later be used to filter the reports on the dashboard.

User Attributes - Dashboard

User Attributes - Dashboard

To add a new user attribute use the following method.

Instabug.setUserAttribute("Age", "18");
Instabug.setUserAttribute("Logged", "True");

You can also retrieve or remove the current value of a certain user attribute, or retrieve all user attributes.

// Getting attribute
Instabug.getUserAttribute("Logged in", function(attribute) {
  // `attribute` is the return value
});

// Loading all attributes
Instabug.getAllUserAttributes(function (allAttributes) {
  // `allAttributes` Object containing all keys and attributes
});
Instabug.removeUserAttribute("Completed IAP");

User Data

You can add additional data about users that would help you better assist them. This API is best used for dumping large amounts of data.

Instabug.setUserData("User data sample");

Each call to this method overrides the user data to be attached. Maximum size of the string is 1,000 characters.

Logout

When a user logs out, the following API should be called.

Instabug.logOut();

Calling logOut will reset the value of the email and name previously set. It will also remove any currently set user attributes, user events, user chats, and user data.