Custom events
Track any other action in your app or site as your own event. It appears in Swan on its own, ready for segments and journeys.
Use a custom event for anything the standard e-commerce events don't cover, for example a banner tap, a quiz answer or a store-locator search.
There is nothing to set up. The first time Swan receives an event name, it is added to your events together with its fields, and you can use it in segments and journeys.
Use a standard event whenever one fits. If the action is on the Standard events page, call that method instead: segments, journeys and reports understand the standard events straight away.
Send a custom event
Pass an event name and the fields you want to keep with it.
Swan.track("bannerClicked", mapOf(
"bannerId" to "summer-sale",
"position" to 2,
"personalised" to true,
"tags" to listOf("sale", "summer"),
))
// An event with no fields
Swan.track("onboardingDismissed")Swan.shared.track("bannerClicked", attributes: [
"bannerId": "summer-sale",
"position": 2,
"personalised": true,
"tags": ["sale", "summer"],
])
// An event with no fields
Swan.shared.track("onboardingDismissed")sdk?.customEvent('bannerClicked', {
bannerId: 'summer-sale',
position: 2,
personalised: true,
tags: ['sale', 'summer'],
});
// An event with no fields
sdk?.customEvent('onboardingDismissed');Swan.track('bannerClicked', {
bannerId: 'summer-sale',
position: 2,
personalised: true,
tags: ['sale', 'summer'],
});
// An event with no fields
Swan.track('onboardingDismissed');Every custom event also carries the details listed under Sent automatically with every event: platform, device, session, the customer, country, currency and business unit. You don't pass those.
Naming your events
- Describe what happened, in camelCase:
bannerClicked,quizCompleted,storeLocatorSearched. - Keep names stable. A renamed event, or an event name spelled differently, is a new event in Swan.
- Field names are case-sensitive. Use the same field name every time,
for example always
bannerId, never sometimesbannerID.
Field values
| Value | Example | In Swan |
|---|---|---|
| Text | "summer-sale" | Text |
| Number | 2, 149.50 | Number |
| True / false | true | True / false |
| List of values | ["sale", "summer"] | List |
| Date and time | "2026-10-14T10:30:00Z" | Text, in ISO 8601 format |
Swan sets each field's type from the first value it receives, so always
send the same kind of value for a field: a number as a number (2), not
sometimes as text ("2"). Send amounts as numbers in the currency's main
unit, for example 149.50.
Reference
- Standard e-commerce events: the methods for shopper actions such as product views, the wishlist, the cart and purchases
- Identify users:
login,identifyandlogout, so events are recorded against the right customer - Concepts → Event model: sessions and how events are sent
Standard e-commerce events
Which SDK method to call for each of Swan's standard e-commerce events, on every platform, and what to pass to it, with required fields marked.
Push notifications
Receive, render, and respond to push notifications — campaigns, channels, deep linking and click acknowledgement.