Skip to content
Menu

Reference

Event payload spec

Markdown version

Every event type the SDK sends, with its fields and the server's constraints, and the device context sent with each batch in its two tiers.

Every SDK call that records something becomes an event in the device's queue. Events travel to Herald inside a batch, through POST /api/v1/sdk/batch (SDK REST endpoints). This page lists every event type and the device context, with the rules the server enforces.

Lengths count UTF-16 code units. The SDKs check these rules on the device and drop a call that breaks them. If an event still breaks a rule, Herald rejects only that event, keeps the rest of the batch and lists it in the response's rejected (see Rejected events). An event can be up to 32 KB as JSON.

Fields on every event

FieldTypeRules
idstring1 to 128 characters. A UUID the SDK creates. Herald stores each ID once per connection.
typestringOne of the types below
timestampstringISO 8601 date-time with offset; when the call was made, by the device's clock. Herald stores it corrected for the device's clock (see Clock correction) and rejects events more than 30 days old
sessionIdstringOptional, 1 to 64 characters. The session start time in epoch milliseconds.

Event types

session_start

FieldTypeRules
properties.session_indexintegerOptional (SDK 0.6.0 and later), 1 or more. Sessions started on this install, counting from 1.
properties.previous_session_idstring or nullOptional (SDK 0.6.0 and later), 1 to 64 characters. The session before this one on the install; null for the first. After an update from an earlier SDK, the first new session has session_index 1 but can name the last session of the old SDK.

Queued when a session starts. A wrong type rejects the event (invalid_field); other keys in properties are dropped. SDKs before 0.6.0 send no properties. See Sessions.

session_end

FieldTypeRules
durationSecondsnumber0 or more; last activity minus start

Queued when the next session starts, at sign-out and at a user switch. Its timestamp is the session's last activity.

identify

FieldTypeRules
userIdstring1 to 200 characters
traitsobjectOptional. Attribute map (see below).

From identify. Traits are merged into the profile of a verified user.

track

FieldTypeRules
namestring1 to 255 characters
propertiesobjectOptional. Keys up to 255 characters; values any JSON.
schemaVersionstringOptional. SDK 0.6.0 and later. The event schema version to check the event against, such as 1-0-0; without it (or null), the latest version. Ignored, whatever its value, when the event name has no schema; when it has one, a value that isn't one of its versions rejects the event (unknown_schema_version). The SDKs send only well-formed versions.

From track, and the SDK's lifecycle events below.

Lifecycle events

SDK 0.6.0 and later send these track events on their own. Each property is checked for its type when present; a wrong type rejects the event (invalid_field). They are sent in minimal data collection too, since they carry no personal data. They show as system events on the Events page, and you can pick them as goals and in segment rules like any event name.

NameFiresProperties
$app_installedThe first launch of this install. Doesn't start a session.version, build (strings)
$app_updatedThe first launch with a different app version or build than the last launch. Doesn't start a session.version, build, previous_version, previous_build (strings)
$app_openedThe first foreground of the app's process: a cold start, or a process the system started in the background that the person then opensfrom_push (boolean): the launch came from a notification tap the SDK saw first (see below)
$app_foregroundEvery move from the background to the foreground, and a launch's first foreground. Not after a system alert, Control Center, Face ID or a call banner (iOS), nor a rotation, dark mode change or resize (Android).None
$app_backgroundEvery move to the background. Never starts or ends a session.None
$deep_link_openedA deep link goes through the SDK: a push tap's link, or openDeepLink (iOS) / openUrl (Android), which the default message and card views usescheme, host, path, query (strings), source (push or link)

trackLifecycleEvents (default on) turns off the first five, trackDeepLinks (default on) the last. $deep_link_opened never has the fragment or ;parameters, and has the query only with trackDeepLinkQuery on. A URL without a host (mailto:, tel:, sms:, data:) sends scheme and source only, so an address or number never reaches the event log. In minimal data collection it has scheme, host and source only. The path of a web link is sent, so keep tokens out of link paths.

On iOS, from_push is reliable only in apps that forward the notification response (handleNotificationResponse) before the app becomes active. Scene-based apps, including SwiftUI apps, usually get the response after activation, so they usually report false even for a launch from a push. On Android it is reliable when handleNotificationIntent runs in the activity's onCreate.

$app_opened, $app_foreground and the app's other events count as app activity (last active, active days, send-time checks); $app_installed, $app_updated, $app_background and $external_push don't: iOS and Android can launch an app in the background, and a push your app reports isn't the person using it. Server events from your backend (other than $external_push) do update last active, active days and DAU/MAU, but never the send-time checks, which count only activity from the device. An app updated from an SDK before 0.6.0 doesn't send $app_updated on its first 0.6.0 launch; it stores the version then.

$external_push is a reserved track name for a push your app sent itself. Its properties are category (transactional, marketing or other; default other; any other value rejects the event with invalid_field), an optional message_id (1 to 200 characters) and an optional source (1 to 100 characters). Other properties are dropped, so a title or body is never stored. Events with the same message_id for the same user are stored once, whether the SDK or your backend sends them. The SDKs send it with trackExternalPush. See Pushes your app sends.

Geofence events

SDK 0.7.0 and later (not released yet) send these track events from the HeraldGeofence (iOS) and herald-geofence (Android) modules, only after the app calls enableGeofences(). Each property is checked for its type when present; a wrong type rejects the event (invalid_field). They don't count as app activity: crossings happen in the background.

NameFiresProperties
$geofence_enterThe device entered one of the app's geofences. At most once per geofence every 5 minutes.geofence_id, geofence_name (strings)
$geofence_exitThe device left one. At most once per geofence every 5 minutes.geofence_id, geofence_name (strings)

No coordinates are sent. See Geofences.

screen

Same fields as track. From screen.

purchase

FieldTypeRules
productIdstring1 to 255 characters
pricenumberAny number; the SDKs require it to be finite
currencystringExactly 3 characters; the SDKs send it upper-cased
quantityinteger1 or more
propertiesobjectOptional. Same rules as track.

From trackPurchase.

attributes

FieldTypeRules
attributesobjectAttribute map (see below)

From setAttribute, setAttributes, setEmail, setPhone and setLocation.

Attribute map. Keys 1 to 255 characters. Values: string, number, boolean, null, or an array of strings. Reserved keys:

KeyStored as
$emailThe user's email contact. An invalid address is skipped; the rest of the event is kept.
$phoneThe user's SMS contact, E.164. An invalid number is skipped.
$latitude, $longitudeThe device's location (numbers, -90 to 90 and -180 to 180). Not written to the user profile.
computed_…Reserved for computed attributes. An event with such a key is rejected with invalid_field.

Every other key is merged into the verified user's profile: a key you send replaces the stored value, and keys you do not send stay.

subscription

FieldTypeRules
channelstringpush, email, sms
statestringsubscribed, unsubscribed, opted_in

From setSubscription and requestPushAuthorization. unsubscribed suppresses the channel: for push, this device's tokens; for email and SMS, the user's addresses. The other states lift an earlier unsubscribe, never a bounce or complaint. With no matching contact, the event changes nothing.

push_token

FieldTypeRules
platformstringapns, fcm, or apns_live_activity (the iOS Live Activity push-to-start token)
tokenstring1 to 4,096 characters. APNs tokens are lowercase hex.
environmentstringOptional, APNs only: production or sandbox
bundleIdstringOptional, 1 to 255 characters

From setPushToken, and sent again after identify, a user switch and reset(). Within a batch, a push_token always comes before a push subscription. A new token replaces this device's previous one.

interaction

FieldTypeRules
messageIdstring1 to 200 characters
kindstringcontent_card, in_app, push
actionstringimpression, click, dismiss, open, button, video_play, video_complete
buttonIdstring1 to 200 characters; required when action is button
decisionIdstring or nullOptional, 1 to 200 characters
KindActions the SDK sendsFrom
content_cardimpression, click, dismiss, video_play, video_completeThe default feed, or logImpression, logClick, logDismissal, logVideoPlay, logVideoComplete
in_appimpression, click, button, dismiss, video_play, video_completeThe presenter, or logVideoPlay, logVideoComplete (iOS) and InAppMessageActions or InAppMessageCallbacks (Android)
pushopen, button, dismiss (iOS, with a custom dismiss action)handleNotificationResponse (iOS), handleNotificationIntent (Android)

For a push, messageId is the push's herald_message_id, else its decision ID. A push button tap sends open, then button.

video_play and video_complete (SDK 0.6.0) are sent once per play of a video in a card or an in-app message. They are stored as events and are not credited to a decision: they change none of the viewed, clicked or dismissed states.

How Herald credits a decision: impression counts as delivered; click and button count as a click; dismiss as a dismissal; a push open as an open. Credit goes only to a decision that belongs to the verified user.

Context

Each batch carries a context object with the device's current data. Tier 2 keys are absent, not null, in minimal mode.

Tier 1: always sent

FieldTypeMax lengthExample
app.namestring255Lumen
app.versionstring644.2.0
app.buildstring64812
app.namespacestring255com.lumen.app (bundle ID or package name)
os.namestring1 to 64iOS, Android
os.versionstring6418.1
regionstring or null8US, from the device locale

The batch also carries deviceId, sdk.name and sdk.version at the top level.

Tier 2: standard mode only

FieldTypeMax lengthValues
device.manufacturerstring128Apple, or the Android build manufacturer
device.modelstring128Model identifier, such as iPhone16,1
device.typestring32iOS: phone, tablet, tv, desktop, car, headset. Android: phone, tablet.
screen.width, screen.heightnumberPoints on iOS, dp on Android
screen.densitynumberScale factor
localestring64BCP 47 tag, such as en-US
languagestring32en
timezonestring64IANA zone, such as America/Chicago
network.typestring32wifi, cellular, ethernet, other, none
push.authorizationstring32iOS: authorized, denied, provisional, ephemeral, not_determined. Android: authorized, denied, not_determined (Android 13 and later, before the permission is requested).

The SDKs cut over-long strings to these maxima. A field the device cannot read is left out.

SDK 0.6.0+. Sent in both modes from the app's setConsent call until clearConsent. An invalid or null value is left out and the rest of the batch is kept; Herald stores it as a rejected event with reason invalid_consent (see Rejected events).

FieldTypeMax lengthValues
consent.basisstringconsent, contract, legal_obligation, vital_interests, public_task, legitimate_interests
consent.documentIdstring, optional100Your policy or terms, such as privacy-policy
consent.documentVersionstring, optional100Such as 2026-11
consent.recordedAtISO 8601 timeWhen the app called setConsent

Herald keeps it on the device record and, for a verified user, as the reserved attribute $consent (the latest one sent). Apps can't set $consent through attributes.

Never sent: advertising identifiers, IDFV, Android ID, carrier, IP address, and location (unless your app calls setLocation).

Example

json
{
  "sdk": { "name": "herald-android", "version": "0.4.0" },
  "deviceId": "0f5e8c1a-7d1b-4b9e-8a52-3c6d2e1f4a90",
  "userId": "u_123",
  "sentAt": "2026-11-09T14:00:05Z",
  "dropped": 0,
  "context": {
    "app": { "name": "Lumen", "version": "4.2.0", "build": "812", "namespace": "com.lumen.app" },
    "os": { "name": "Android", "version": "15" },
    "region": "US",
    "device": { "manufacturer": "Google", "model": "Pixel 8", "type": "phone" },
    "screen": { "width": 412, "height": 915, "density": 2.625 },
    "locale": "en-US", "language": "en", "timezone": "America/Chicago",
    "network": { "type": "wifi" }, "push": { "authorization": "authorized" }
  },
  "events": [
    { "id": "e1", "type": "session_start", "timestamp": "2026-11-09T13:58:00Z", "sessionId": "1762696680000",
      "properties": { "session_index": 4, "previous_session_id": "1762610280000" } },
    { "id": "e2", "type": "push_token", "timestamp": "2026-11-09T13:58:01Z", "sessionId": "1762696680000",
      "platform": "fcm", "token": "fcm-token", "bundleId": "com.lumen.app" },
    { "id": "e3", "type": "subscription", "timestamp": "2026-11-09T13:58:01Z", "sessionId": "1762696680000",
      "channel": "push", "state": "opted_in" },
    { "id": "e4", "type": "track", "timestamp": "2026-11-09T13:59:58Z", "sessionId": "1762696680000",
      "name": "workout_completed", "properties": { "minutes": 32 } },
    { "id": "e5", "type": "interaction", "timestamp": "2026-11-09T14:00:02Z", "sessionId": "1762696680000",
      "messageId": "msg_1", "kind": "content_card", "action": "click", "decisionId": "dec_1" }
  ]
}

See Herald decide live →