Events
This topic describes how send events using the Optimizely Data Platform (ODP) React Native SDK.
📘
AvailabilityOnly 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. SeeEvents.
Sending events
ODP usesZaius.event() to send events.
Zaius.event({ type: string, action: string, identifiers: { ... }, data: { ... },})| Description | |
|---|---|
type | The type of event; what the event is happening about. SeeEvents. |
action | What the customer is doing about which ODP should be told. |
identifiers | Various bits of information that can identify a Customer. This will include things like theVUID, push token, or email. Values in this object should be strings. |
data | Relevant 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 viaZaius.event() or automatically, it gets enqueued into the event queue—the event isnot 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 thestartQueue option toZaius.configure() istrue, the queue processes events as soon as it can load them from the phone's storage.
IfstartQueue isfalse, then you must manually start the queue by callingz.queue.start() (wherez is the return value ofZaius.configure()).
🚧
ImportantYou should **NOT **set
startQueuetofalse.
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.
📘
NoteOn Android, the notification will always show. On iOS, the notification will show only if the app is in the background.
Updated 25 days ago