User & session data
When you know who is using the app, or something about the session, attach it to every report. Issues in the dashboard can be searched by these values.
User identity
Set a user identifier — an email address, an account id — and Bugsee adds it to every report from then on. If the value is an email address, the server may link the report to an existing user.
- Objective-C
- Swift
[Bugsee setUserIdentifier:@"name@example.com"];
// nil when none is set
NSString *identifier = [Bugsee getUserIdentifier];
[Bugsee clearUserIdentifier];
Bugsee.setUserIdentifier("name@example.com")
// nil when none is set
let identifier = Bugsee.getUserIdentifier()
Bugsee.clearUserIdentifier()
- The identifier persists across launches until you clear it. It is kept in the Keychain; if the
Keychain refuses the write, in
UserDefaultsuntil the Keychain accepts it again. setUserIdentifier:withnilor an empty string clears it, likeclearUserIdentifier.- These calls work before launch too.
- Feedback sends the identifier with the user's messages when they gave no
email on its email screen, and skips that screen when the identifier contains
@.
In 6.x these were setEmail:, getEmail and clearEmail.
User and session attributes
Attributes are arbitrary key–value pairs — a plan name, a feature flag, a count — attached to every report.
- Objective-C
- Swift
[Bugsee setAttribute:@"name" withValue:@"John Doe"];
[Bugsee setAttribute:@"age" withValue:@23];
[Bugsee setAttribute:@"married" withValue:@YES];
id age = [Bugsee getAttribute:@"age"];
// nil when no attribute is set
NSDictionary<NSString *, id> *all = [Bugsee getAllAttributes];
Bugsee.setAttribute("name", value: "John Doe")
Bugsee.setAttribute("age", value: 23)
Bugsee.setAttribute("married", value: true)
let age = Bugsee.getAttribute("age")
// nil when no attribute is set
let all = Bugsee.getAllAttributes()
Values may be strings, numbers or booleans.
Attributes persist across launches, until you clear them or the app is uninstalled:
- Objective-C
- Swift
// One attribute
[Bugsee clearAttribute:@"name"];
// All of them
[Bugsee clearAllAttributes];
// One attribute
Bugsee.clearAttribute("name")
// All of them
Bugsee.clearAllAttributes()
Each attribute is limited to about 1 KB and all attributes together to about 25 KB, measured on
their archived form. An attribute over the limit is ignored, and one that would push the total
over it is removed, together with any earlier value under that name. setAttribute:withValue:
still returns YES in both cases. For larger data, attach a file instead — see
Report handler.
getAllAttributes is new in 7.x.
Attributes on a single report
The calls above set attributes on every report. To set one on a single report, use
setAttribute:withValue: on the report itself — in a report handler, or
on a BugseeExtendedReport you build in code.
Deleting it
deleteCollectedDataOnDevice does not touch the user identifier or the attributes: clear them with
the calls above. See Privacy: cleanup.