Skip to content
Menu

Concepts

Event schemas

Markdown version

Optional, versioned definitions of a custom event's properties. Herald checks every track event with that name, and either rejects or flags the ones that don't match.

Custom track events take any properties. That is flexible, but a typo or a type change in one app release can quietly break the goals, segments and personalization built on that event. An event schema states which properties an event should have, so Herald can catch that.

Schemas are optional. You define them only for the events you care about; every other event is accepted as it is.

What a schema holds

A schema belongs to one app and one event name. Set it up in the console under Settings → Event schemas (admins). Names starting with $ are reserved for the SDK's own events and can't have a schema. Each property has:

FieldValues
NameThe property key
Typestring, number, integer, boolean, object or array
RequiredWhether the event must have it. A null value counts as missing
Allowed valuesStrings only: the values it may take
Max lengthStrings only: the most characters it may have
Min and maxNumbers only: the range it must be in

Properties the schema doesn't list are allowed and kept. An app can have up to 100 event schemas, each with up to 50 properties and 50 versions (see Limits).

Versions

Every save creates a new version; a saved version never changes. Versions use SchemaVer, MODEL-REVISION-ADDITION, starting at 1-0-0. The console shows the next version before you save, with the reason:

Change from the latest versionNext versionConsole reason
Only new optional properties, or anything else that keeps earlier events valid (more allowed values, a looser rule, a property made optional)ADDITION: 1-0-0 → 1-0-1New optional properties only
Only the modeADDITION: 1-0-1 → 1-0-2Mode change only
A new required property, a removed property, a type change, fewer allowed values, a stricter max length, min or max, or an optional property made requiredMODEL: 1-0-1 → 2-0-0Breaking change

REVISION is reserved: Herald doesn't produce it. A save with no changes is refused (No changes to save). If someone else saved a newer version after you opened the form, your save is refused and you reload to see it. Each schema's version history is shown read-only in the console.

Modes

ModeAn event that doesn't match
Reject invalid eventsIs rejected with reason schema_violation and left out of the batch; the rest of the batch is kept
Accept and warnIs kept as usual, and recorded as a warning

Mode belongs to each version. An event checked against a version, the latest or a pinned one, uses that version's mode, so saving a new version in Accept and warn doesn't change how events that pin an older version are checked.

Use Accept and warn while you roll out a change: save the new version in that mode, watch the warnings while app versions update, then save it again with Reject invalid events. Each mode switch saves a new ADDITION version.

Pinning a version from the app

By default an event is checked against the latest version of its schema. An app release built for an older version can name it, so a breaking change for newer releases doesn't reject its events:

swift
Herald.shared.track("signup", properties: ["plan": "pro"], schemaVersion: "1-0-0")
kotlin
Herald.track("signup", mapOf("plan" to "pro"), schemaVersion = "1-0-0")

schemaVersion is optional, in SDK 0.6.0 and later; existing track calls are unchanged. It is sent as the event's schemaVersion field (Event payload). A version the schema doesn't have rejects the event with unknown_schema_version. For an event name with no schema, schemaVersion is ignored. The SDKs leave off a value that isn't a version like 1-0-0, with a debug log, and still send the event.

Events your backend sends with POST /api/v1/events are checked the same way, and take the same optional schemaVersion field.

How failures show up

Rejected events and warnings, from the SDK or your backend, are listed under Rejected events on the SDK connection's page in the console (Settings → Sending & SDK, then the connection), kept for 30 days. A warning shows as Schema warning (accepted). Up to 200 warnings are stored per app a day, apart from the 1,000 rejected events, so a busy event in Accept and warn mode never hides real rejects. The detail names the first failing property and rule, and the version checked, such as properties.plan: must be one of free, pro (schema signup 1-0-0).

A rejected event is also listed in the response's rejected, which the SDKs log at debug level and never retry. A warning isn't. See Rejected events for every reason code.

See Herald decide live →