Skip to main content
Version: 1.3.0

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:

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"
}
});

Event Properties

PropertyTypeConstraintsExamplesDescription
eventstringrequired
"order_placed"
The name of the event.
const: "order_placed"
$schemastringconst: "https://tracking-docs-demo.buchert.digital/schemas/1.3.0/web/nested-conditional-event.json"
"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_idstringrequired
"ORD-12345"
Unique identifier for the order.
{}shippingobjectrequiredShipping details for the order.
methodstringrequired
"express"
The shipping method selected by the customer.
enum: [express, standard]
iThe properties below define the condition. When the condition is met, the “Then” branch applies. Otherwise, the “Else” branch applies.If
methodobjectrequired
"express"
const: "express"

Express shipping includes a priority level.

priority_levelstringrequired
"high"
Priority level for express delivery.
enum: [high, critical]
guaranteed_bystringformat: date
"2026-03-01"
Guaranteed delivery date (ISO 8601).

Standard shipping includes estimated delivery days.

View Raw JSON Schema
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "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"
  ]
}