Disclaimer: This website requires Please enable JavaScript in your browser settings for the best experience.

Dev GuideAPI Reference
Dev GuideAPI ReferenceUser GuideLegal TermsGitHubDev CommunityOptimizely AcademySubmit a ticketLog In
Dev Guide

Events

This topic describes how send events using the Optimizely Data Platform (ODP) React Native SDK.

📘

Availability

Only customers onboarded prior to July 15, 2022 have access to the ODP Campaigns and have the ability to send Event data through the ODP React Native SDK. For more information, contact your Customer Success Manager.

Events are the main way that an app communicates with ODP. See Events.

Sending events

ODP uses Zaius.event() to send events.

Zaius.event({
    type: string,
    action: string,
    identifiers: {
        ...
    },
    data: {
        ...
    },
})
Description
typeThe type of event; what the event is happening about. See Events.
actionWhat the customer is doing about which ODP should be told.
identifiersVarious bits of information that can identify a Customer. This will include things like the VUID, push token, or email. Values in this object should be strings.
dataRelevant data to the event. For example, the event sent when push notifications permission is granted will also contain the push token for the phone (so ODP can actually deliver notifications). The values should be strings.

Event queue

Each time an event is sent to ODP via Zaius.event() or automatically, it gets enqueued into the event queue—the event is not sent immediately.

The event queue retains the pending events but is deleted every 30 seconds and all pending requests are made to ODP. Each time a new event is added, the queue state is persisted to survive app quits and crashes. Queueing this way allows for more efficient network communication in a way that does not interrupt your customer's flow.

If the startQueue option to Zaius.configure() is true, the queue processes events as soon as it can load them from the phone's storage.

If startQueue is false, then you must manually start the queue by calling z.queue.start() (where z is the return value of Zaius.configure()).

🚧

Important

You should NOT set startQueue to false.

Automatic Events

Some events are sent automatically by the SDK . They are:

  • Add Push Token – Sent when the phone finishes registering for push notifications. If this event gets sent, then the phone is capable of receiving pushes.
  • Push Notification Open – Sent when the user taps on a push notification.

📘

Note

On Android, the notification will always show. On iOS, the notification will show only if the app is in the background.