Skip to main content
Version: 3.7.0

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:

  1. 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)
  1. 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 NameTypeDescription
userIdStringUser ID
  • Example

    Bonree.setUserID('user-id');
2. Set user additional information in Key-Value form. Interface as follows:
setExtraInfo(userInfo)
  • Interface Description
Parameter NameTypeDescription
extraInfoObjectUser 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 NameTypeDescription
exceptionTypeStringException type. Required parameter, call is invalid if empty or null.
causedByStringException cause
errorDumpStringException 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 NameTypeDescription
pageNameStringPage name. Required parameter, call is invalid if empty or null.
pageAliasStringPage 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 NameTypeDescription
eventIDStringEvent ID. Required parameter, call is invalid if empty or null.
eventNameStringEvent name
eventLabelStringEvent label
paramStringEvent additional information
infoObjectEvent 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 NameTypeDescription
eventIDStringEvent ID. Required parameter, call is invalid if empty or null.
eventNameStringEvent name
eventLabelStringEvent label
paramStringEvent additional information
infoObjectEvent 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 NameTypeDescription
logInfoStringLog information. Required parameter, call is invalid if empty or null.
paramStringAdditional 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 NameTypeDescription
metricNameStringMetric name. Required parameter, call is invalid if empty or null.
metricValueIntMetric value. Required parameter, call is invalid if metric is empty.
paramStringAdditional information (reserved field, no current usage scenario)
  • Example

    Bonree.setCustomMetric('Test Metric 01', 1, '');