ReactNative API Description
I. Startup Configuration Interface
Custom Cold Launch End Time
recordCustomLaunchEnd()
If you need to customize the end timing of a cold launch, you need to call the following two interfaces to complete the custom functionality. The specific usage is as follows:
- Call the custom cold launch switch interface in the native project to enable the custom cold launch function. (This interface must be set before BonreeSDK starts)
Android
Bonree.withAppID("<#AppID#>")
.withUseCustomLaunch(true)
.start(this);
iOS
// Must be set before BonreeSDK starts
[BRSAgent useCustomLaunch:YES];
// Must be set before BonreeSDK starts
BRSAgent.useCustomLaunch(true)
- Call the cold launch end interface at the desired timing to record the end of the cold launch.
Bonree.recordCustomLaunchEnd()
Note: After enabling the custom cold launch function, if the record cold launch end interface is not called within 30 seconds, the cold launch monitoring process will be forcibly terminated.
II. Custom Functionality Interface
Custom User Information
BonreeSDK supports setting user-related information to fulfill requirement scenarios where performance data needs to be associated with actual users.
There are two ways to set user information:
1. Set User ID, identifying the user with a string. Interface as follows:
setUserID(userId)
- Interface Description
| Parameter Name | Type | Description |
|---|---|---|
| userId | String | User ID |
-
Example
Bonree.setUserID('user-id');
2. Set user additional information in Key-Value form. Interface as follows:
setExtraInfo(userInfo)
- Interface Description
| Parameter Name | Type | Description |
|---|---|---|
| extraInfo | Object | User additional information. Value restricted to string or number types. |
-
Example
Bonree.setExtraInfo({ id: '123456', name: 'Tom' });
Custom Exception
Call the interface and pass the corresponding parameters to complete the statistical function for custom exception data.
setCustomException(exceptionType,causedBy,errorDump)
- Interface Description
| Parameter Name | Type | Description |
|---|---|---|
| exceptionType | String | Exception type. Required parameter, call is invalid if empty or null. |
| causedBy | String | Exception cause |
| errorDump | String | Exception stack trace |
-
Example
Bonree.setCustomException('Custom exception type',
'Caused by customer.',
'Custom error dump 0\nCustom error dump 1');
Custom View
Call the interface and pass the corresponding parameters to complete the statistical function for custom view data.
setCustomPageStart(pageName,pageAlias)
setCustomPageEnd(pageName,pageAlias)
- Interface Description
| Parameter Name | Type | Description |
|---|---|---|
| pageName | String | Page name. Required parameter, call is invalid if empty or null. |
| pageAlias | String | Page alias |
-
Example
Bonree.setCustomPageStart('page01', 'Home Page');
Bonree.setCustomPageEnd('page01', 'Home Page');
Note: The start and end recording interfaces for custom views must be called in pairs, and the pageName for the same view must be consistent, in order to correctly count and report a complete custom view data.
Custom Event (Full Version)
/// Custom event
setCustomEventStart(eventId,eventName,eventLabel,param,info)
setCustomEventEnd(eventId,eventName,eventLabel,param,info)
- Interface Description
| Parameter Name | Type | Description |
|---|---|---|
| eventID | String | Event ID. Required parameter, call is invalid if empty or null. |
| eventName | String | Event name |
| eventLabel | String | Event label |
| param | String | Event additional information |
| info | Object | Event business information.Length after converting to JSON must be within 7000 characters, otherwise the interface call fails. |
- Example
Bonree.setCustomEventStart('001', 'Login', 'eventLabel','param',{a:111,b:222})
Bonree.setCustomEventEnd('001', 'Login', 'eventLabel','param',{a:111,b:222})
Custom Event (Simplified Version)
Call the interface and pass the corresponding parameters to complete the statistical function for custom event data.
/// Custom event
setCustomEvent(eventId,eventName,eventLabel,param,info)
- Interface Description
| Parameter Name | Type | Description |
|---|---|---|
| eventID | String | Event ID. Required parameter, call is invalid if empty or null. |
| eventName | String | Event name |
| eventLabel | String | Event label |
| param | String | Event additional information |
| info | Object | Event business information.Length after converting to JSON must be within 7000 characters, otherwise the interface call fails. |
-
Example
Bonree.setCustomEvent('001', 'Login', 'eventLabel','param',{a:111,b:222});
Custom Log
Call the interface and pass the corresponding parameters to complete the statistical function for custom log data.
setCustomLog(logInfo,param)
- Interface Description
| Parameter Name | Type | Description |
|---|---|---|
| logInfo | String | Log information. Required parameter, call is invalid if empty or null. |
| param | String | Additional information (reserved field, no current usage scenario) |
-
Example
Bonree.setCustomLog('2020-01-01 08:30:00 Print log info.', '');
Custom Metric
Call the interface and pass the corresponding parameters to complete the statistical function for custom metric data.
setCustomMetric(metricName,metricValue,param)
- Interface Description
| Parameter Name | Type | Description |
|---|---|---|
| metricName | String | Metric name. Required parameter, call is invalid if empty or null. |
| metricValue | Int | Metric value. Required parameter, call is invalid if metric is empty. |
| param | String | Additional information (reserved field, no current usage scenario) |
-
Example
Bonree.setCustomMetric('Test Metric 01', 1, '');