Tracking Events
Track events and properties for Experiences, targeting, and analytics.
Events describe what customers do in your app. Send one when a customer opens a screen, completes onboarding, or reaches a usage limit. Nuxie uses the same event to trigger Experiences, build audiences, and measure results.
The trigger method
NuxieSDK.shared.trigger("item_added_to_cart", properties: [
"item_id": "sku_999",
"price": 29.99
])
Call trigger() from the action you are recording. In this example, the event can start an Experience for a customer who has added an item to their cart. It also records the action even when no Experience matches. The call returns immediately; the SDK handles delivery and Experience matching.
Method signature
public func trigger(
_ event: String,
properties: [String: Any]? = nil
)
| Parameter | Description |
|---|---|
event |
The event name. Use the exact name configured on the Experience. |
properties |
Optional values describing this occurrence. |
Use customer properties for persistent information about the person.
Event properties
NuxieSDK.shared.trigger("purchase_started", properties: [
"product_id": "com.app.premium",
"price": 9.99,
"currency": "USD",
"source": "settings_screen"
])
Properties are stored with the event and available for targeting and analytics. Use beforeSend to remove sensitive values before storage and delivery.
System events
The SDK captures lifecycle and Experience events automatically, including $app_opened, $experience_shown, and $purchase_completed. The $ prefix is reserved; use names without it for your app events.
The system event reference lists event names, timing, and properties.
How events are processed
The SDK captures the current customer ID, adds device context, normalizes properties, and applies beforeSend. Accepted events are stored, evaluated against Experience triggers, and queued for server delivery.
Returning nil from beforeSend drops the event before those steps continue.
Batching and delivery
The SDK batches events, retries temporary failures, and resumes delivery when the app returns to the foreground. Captured events remain queued across process restarts. No manual flush or queue configuration is required.
Storage limits
Local event history is limited to 10,000 events and 30 days. Cleanup retains events needed for pending delivery or recovery.
See Presenting Experiences to handle presentation and Segments for audience updates.