Global Delegate - React Native

The SDK is triggering global delegate events that the hosting application can choose to handle. You can find more information about the different delegates functions on the native section here.


Declaration

BlazeSDK.init({
    ...,
    globalDelegate: {
      onEventTriggered: (params => {
        console.log('GlobalDelegate - onEventTriggered - event_action: ' + params.event.event_action);
      }),
      onErrorThrown: (params => {
        console.error('GlobalDelegate - onErrorThrown - error: ' + params.error);
      })
    }
})

Analytics events

params.event of onEventTriggered is typed as IBlazeAnalytics. From React Native SDK 2.0.1, it follows the unified events schema of native SDK 2.0 on iOS and Android:

  • Every enumerated value is lowercase snake_case, for example, event_category: 'story'. TypeScript reports a comparison against an old value, such as 'Story', as an error.
  • sdk_type is ios-rtn or android-rtn.
  • The exit triggers back_button and pip_dismissed are Android only, and are marked as such in the type.

For the event and field mapping from 1.x, see Migrate to the unified events schema. For changes in how many events you receive, see Reporting changes to expect.

Errors

params.error of onErrorThrown is a BlazeError, which carries domain and reason. From React Native SDK 2.0.1, on Android they are the values native declares. See BlazeError.


Did this page help you?