Nested Conditional Event
An event demonstrating if/then/else conditional properties nested inside a property. The shipping details depend on the selected method.
DataLayer Example
conditional options:
- When condition is met
- When condition is not met
window.dataLayer.push({
"event": "order_placed",
"$schema": "https://tracking-docs-demo.buchert.digital/schemas/1.3.0/web/nested-conditional-event.json",
"order_id": "ORD-12345",
"shipping": {
"method": "express",
"priority_level": "high",
"guaranteed_by": "2026-03-01"
}
});
window.dataLayer.push({
"event": "order_placed",
"$schema": "https://tracking-docs-demo.buchert.digital/schemas/1.3.0/web/nested-conditional-event.json",
"order_id": "ORD-12345",
"shipping": {
"method": "express",
"estimated_days": 5
}
});
Event Properties
| Property | Type | Constraints | Examples | Description |
|---|---|---|---|---|
| event | string | required | | The name of the event. |
const: "order_placed" | ||||
| $schema | string | const: "https://tracking-docs-demo.buchert.digital/schemas/1.3.0/web/nested-conditional-event.json" | | Defines the structure of the event. This can be used to validate an event against the schema provided. |
| order_id | string | required | | Unique identifier for the order. |
| {}shipping | object | required | Shipping details for the order. | |
| method | string | required | | The shipping method selected by the customer. |
enum: [express, standard] | ||||
| If | ||||
| method | object | required | | |
const: "express" | ||||
Express shipping includes a priority level. | ||||
| priority_level | string | required | | Priority level for express delivery. |
enum: [high, critical] | ||||
| guaranteed_by | string | format: date | | Guaranteed delivery date (ISO 8601). |
Standard shipping includes estimated delivery days. | ||||
View Raw JSON Schema
{
: "https://json-schema.org/draft/2020-12/schema",
: "https://tracking-docs-demo.buchert.digital/schemas/1.3.0/web/nested-conditional-event.json",
"title": "Nested Conditional Event",
"description": "An event demonstrating if/then/else conditional properties nested inside a property. The shipping details depend on the selected method.",
"x-tracking-targets": [
"web-datalayer-js"
],
"type": "object",
"properties": {
"$schema": {
"type": "string",
"description": "Defines the structure of the event. This can be used to validate an event against the schema provided.",
"const": "https://tracking-docs-demo.buchert.digital/schemas/1.3.0/web/nested-conditional-event.json"
},
"event": {
"type": "string",
"const": "order_placed",
"description": "The event name.",
"examples": [
"order_placed"
]
},
"order_id": {
"type": "string",
"description": "Unique identifier for the order.",
"examples": [
"ORD-12345"
]
},
"shipping": {
"type": "object",
"description": "Shipping details for the order.",
"properties": {
"method": {
"type": "string",
"description": "The shipping method selected by the customer.",
"enum": [
"express",
"standard"
],
"examples": [
"express"
]
}
},
"required": [
"method"
],
"if": {
"properties": {
"method": {
"const": "express"
}
},
"required": [
"method"
]
},
"then": {
"description": "Express shipping includes a priority level.",
"properties": {
"priority_level": {
"type": "string",
"description": "Priority level for express delivery.",
"enum": [
"high",
"critical"
],
"examples": [
"high"
]
},
"guaranteed_by": {
"type": "string",
"description": "Guaranteed delivery date (ISO 8601).",
"format": "date",
"examples": [
"2026-03-01"
]
}
},
"required": [
"priority_level"
]
},
"else": {
"description": "Standard shipping includes estimated delivery days.",
"properties": {
"estimated_days": {
"type": "integer",
"description": "Estimated number of days for delivery.",
"minimum": 1,
"maximum": 30,
"examples": [
5
]
}
}
}
}
},
"required": [
"event",
"order_id",
"shipping"
]
}