Instabug helps you better identify the bug reports or feedback you get by associating the user's identity to them.
By default, we ask 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 as shown below.
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:@"firstname.lastname@example.org" name:@"John Appleseed"];
Instabug.identifyUser(withEmail: "email@example.com", name: "John Appleseed")
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
To add a new user attribute use the following method.
[Instabug setUserAttribute:@"True" withKey:@"Logged in"]; [Instabug setUserAttribute:@"18" withKey:@"Age"];
Instabug.setUserAttribute("True", withKey: "Logged in") Instabug.setUserAttribute("False", withKey: "Completed IAP")
You can also retrieve or remove the current value of a certain user attribute, or retrieve all user attributes.
NSString *loggedIn = [Instabug userAttributeForKey:@"Logged in"]; [Instabug removeUserAttributeForKey:@"Logged in"];
let loggedIn = Instabug.userAttribute(forKey: "Logged in") Instabug.removeUserAttribute(forKey: "Logged in")
NSDictionary *allUserAttributes = [Instabug userAttributes];
let allUserAttributes = Instabug.userAttributes()
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.
NSDictionary *profileDetails = [user allProfileDetails]; NSString *profileDetailsString = [NSString stringWithFormat:@"%@", profileDetails]; Instabug.userData = profileDetailsString;
let profileDetails = user.allProfileDetails() let profileDetailsString = "\(profileDetails)" Instabug.userData = profileDetailsString
Each call to this method overrides the user data to be attached. Maximum size of the string is 1,000 characters.
When a user logs out, the following API should be called.
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.