HomeDocumentationAPI Reference
Getting StartedAPI ReferenceHelp CenterVideo Tours

Setting Custom Data

Discussed here is how to set user attributes and tags, as well as log user events, and their relevant APIs.

User Attributes

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

This is where additional user attributes appear in your bug reports.This is where additional user attributes appear in your bug reports.

This is where additional user attributes appear in your bug reports.

To add a new user attribute use the following method.

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

You can also retrieve 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
});

Or remove the current value of a certain user attribute

Instabug.removeUserAttribute("Completed IAP");

User Events

You can log custom user events throughout your application. Custom events are automatically included with each report.

Instabug.logUserEventWithName("OnFeedbackButtonClicked");

Tags

You can add custom tags to your bug and crash reports. These tags can later be used to filter reports or set custom rules from your dashboard.

This is where tags appear in your bug reports.This is where tags appear in your bug reports.

This is where tags appear in your bug reports.

The example below demonstrates how to add tags to a report.

Instabug.appendTags(["Tag 1", "Tag 2"]);

📘

Adding tags before sending reports

Sometimes it's useful to be able to add a tag to a bug report before it's been sent. In these cases, the perfect solution would be use the event handlers of the bug reporting class. You can find more details here.

You can also get all the currently set tags as follows.

Instabug.getTags(function (tags) {
  // `tags` is the returned values
});

Last, you can reset all the tags.

Instabug.resetTags();

Managing Tags

If you'd like to remove a particular tag from your dashboard to prevent it from appearing again when entering a new tag manually, you can do so by navigating to the tags page under the settings options and remove the tag. You can also edit and rename the tag.

Experiments

📘

Only in Crash Reporting

This feature is currently only available for crash occurrences.

In certain scenarios, you might find that you're rolling out different experiments to different users, where your user base would be seeing different features depending on what's enabled for them. In scenarios such as these, you'll want to keep track of the enabled experiments for each user, of which there could be many, and even filter by them.

This is currently possible using the experiments methods provided by the SDK. You can have up to a limit of 600 experiments, with no duplicates. Each experiment can consist of 70 characters at most and are not removed at the end of the session or if logOut is called.

📘

Minimum SDK Requirement

Please note that the experiments feature is available starting from SDK version 10.13.0

Add Experiment

You can use the below method to add experiments to the next report:

Instabug.addExperiments(['exp1']);

Remove Experiment

You can use the below method to remove certain experiments from the next report:

Instabug.removeExperiments(['exp1']);

Clear Experiment

You can use the below method to clear experiments from the next report:

Instabug.clearAllExperiments();

What’s Next

You now have more information than ever about each bug and crash report, so we suggest you read up more on bug and crash reporting.