Skip to main content
Version: 1.3.0

Complex Event with Validation Constraints

A generic event demonstrating various validation constraints and recursive documentation capabilities.

This is a non-ecommerce example event, useful for checking generic payload snippets.

DataLayer Example

window.dataLayer.push({
"user_data": null
});
window.dataLayer.push({
"event": "user_update",
"user_data": {
"user_id": "U_999",
"is_active": true,
"attributes": {
"segment": "premium",
"score": 95,
"loyalty_tier": "gold",
"custom_ltv": 12
},
"addresses": [
{
"street": "123 Main St",
"city": "New York",
"zip": "10001"
}
]
},
"$schema": "https://tracking-docs-demo.buchert.digital/schemas/1.3.0/web/complex-event.json",
"timestamp": 16788922,
"string_constraints": "example",
"number_constraints": 50,
"exclusive_number_constraints": 50,
"array_constraints": [
"a",
"b"
],
"contains_array_constraints": [
1,
"text",
2
],
"object_constraints": {
"prop_a": "some_value",
"prop_b": "another_value"
},
"dependent_required_constraint": {
"credit_card": 1234567890123456,
"billing_address": "123 Billing Address, Anytown, USA"
},
"enum_constraint": "admin",
"const_constraint": "must_be_this"
});

Event Properties

PropertyTypeConstraintsExamplesDescription
eventstringrequired
"user_update"
The name of the event.
const: "user_update"
{}user_dataobjectrequiredUser related data.
user_idstringrequired
"U_999"
Unique User ID.
is_activeboolean
true
Status of the user.
{}attributesobjectrequired
{
"segment": "premium",
"score": 95,
"loyalty_tier": "gold",
"custom_ltv": 12
}
Nested generic attributes. Declared keys are documented below; undeclared keys are allowed when they satisfy the schema constraint row for additionalProperties.
segmentstring
"premium"
Marketing segment.
scorenumber
95
Engagement score.
additionalPropertiesSchema constraintControls properties not listed in properties and not matched by patternProperties.string
"newsletter_subscriber"
Additional user attribute values keyed by attribute name.
patternProperties/^custom_/Schema constraintApplies the subschema to property names that match the given regular expression.numberminimum: 0
12
Numeric custom attribute values for keys prefixed with custom_.
[]addressesarrayList of user addresses.
streetstring
"123 Main St"
The street address.
citystringrequired
"New York"
The city name.
zipstringrequired
"10001"
The postal ZIP code.
$schemastringrequired
"https://tracking-docs-demo.buchert.digital/schemas/1.3.0/web/complex-event.json"
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/complex-event.json"
timestampinteger
16788922
Unix timestamp of the event.
string_constraintsstringrequired
"example"
A string with various constraints.
minLength: 2
maxLength: 10
format: hostname
pattern: /^[a-z]+$/
number_constraintsnumberrequired
50
A number with various constraints.
minimum: 10
maximum: 100
multipleOf: 5
exclusive_number_constraintsnumberexclusiveMinimum: 10
50
A number with exclusive constraints.
exclusiveMaximum: 100
array_constraintsarrayminItems: 1
[
"a",
"b"
]
An array with various constraints.
maxItems: 5
uniqueItems: true
contains_array_constraintsarrayminContains: 1
[
1,
"text",
2
]
An array with contains constraints.
maxContains: 2
contains: {"type":"integer"}
{}object_constraintsobjectminProperties: 1
{
"prop_a": "some_value",
"prop_b": "another_value"
}
An object with various constraints.
maxProperties: 3
additionalProperties: false
propertyNames: {"pattern":"^[a-z0-9_]+$"}
prop_astring
"some_value"
First arbitrary string property.
prop_bstring
"another_value"
Second arbitrary string property.
{}dependent_required_constraintobjectdependentRequired: credit_card -> [billing_address]
{
"credit_card": 1234567890123456,
"billing_address": "123 Billing Address, Anytown, USA"
}
An object with dependent required properties.
credit_cardnumber
1234567890123456
The credit card number.
billing_addressstring
"123 Billing Address, Anytown, USA"
The billing address associated with the credit card.
enum_constraintstringenum: [admin, editor, viewer]
"admin"
A property with an enum constraint.
const_constraintstringconst: "must_be_this"
"must_be_this"
A property that must have a constant value.
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/complex-event.json",
  "$comment": "Authoring example for schema metadata in the raw schema viewer.",
  "$vocabulary": {
    "https://json-schema.org/draft/2020-12/vocab/core": true,
    "https://json-schema.org/draft/2020-12/vocab/validation": true
  },
  "title": "Complex Event with Validation Constraints",
  "description": "A generic event demonstrating various validation constraints and recursive documentation capabilities.",
  "x-tracking-targets": [
    "web-datalayer-js"
  ],
  "type": "object",
  "required": [
    "$schema",
    "event",
    "number_constraints",
    "string_constraints",
    "user_data"
  ],
  "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/complex-event.json"
    },
    "event": {
      "type": "string",
      "const": "user_update",
      "description": "The event name.",
      "examples": [
        "user_update"
      ]
    },
    "timestamp": {
      "type": "integer",
      "description": "Unix timestamp of the event.",
      "examples": [
        16788922
      ]
    },
    "user_data": {
      "type": "object",
      "description": "Container for user information.",
      "required": [
        "user_id",
        "attributes"
      ],
      "properties": {
        "user_id": {
          "type": "string",
          "description": "Unique User ID.",
          "examples": [
            "U_999"
          ]
        },
        "is_active": {
          "type": "boolean",
          "description": "Status of the user.",
          "examples": [
            true
          ]
        },
        "attributes": {
          "type": "object",
          "description": "Nested generic attributes. Declared keys are documented below; undeclared keys are allowed when they satisfy the schema constraint row for additionalProperties.",
          "properties": {
            "segment": {
              "type": "string",
              "description": "Marketing segment.",
              "examples": [
                "premium"
              ]
            },
            "score": {
              "type": "number",
              "description": "Engagement score.",
              "examples": [
                95
              ]
            }
          },
          "additionalProperties": {
            "type": "string",
            "description": "Additional user attribute values keyed by attribute name.",
            "examples": [
              "newsletter_subscriber"
            ]
          },
          "patternProperties": {
            "^custom_": {
              "type": "number",
              "description": "Numeric custom attribute values for keys prefixed with custom_.",
              "minimum": 0,
              "examples": [
                12
              ]
            }
          },
          "examples": [
            {
              "segment": "premium",
              "score": 95,
              "loyalty_tier": "gold",
              "custom_ltv": 12
            }
          ]
        },
        "addresses": {
          "type": "array",
          "description": "List of user addresses.",
          "items": {
            "type": "object",
            "required": [
              "city",
              "zip"
            ],
            "properties": {
              "street": {
                "type": "string",
                "description": "The street address.",
                "examples": [
                  "123 Main St"
                ]
              },
              "city": {
                "type": "string",
                "description": "The city name.",
                "examples": [
                  "New York"
                ]
              },
              "zip": {
                "type": "string",
                "description": "The postal ZIP code.",
                "examples": [
                  "10001"
                ]
              }
            }
          }
        }
      }
    },
    "string_constraints": {
      "type": "string",
      "description": "A string with various constraints.",
      "minLength": 2,
      "maxLength": 10,
      "pattern": "^[a-z]+$",
      "format": "hostname",
      "examples": [
        "example"
      ]
    },
    "number_constraints": {
      "type": "number",
      "description": "A number with various constraints.",
      "minimum": 10,
      "maximum": 100,
      "multipleOf": 5,
      "examples": [
        50
      ]
    },
    "exclusive_number_constraints": {
      "type": "number",
      "description": "A number with exclusive constraints.",
      "exclusiveMinimum": 10,
      "exclusiveMaximum": 100,
      "examples": [
        50
      ]
    },
    "array_constraints": {
      "type": "array",
      "description": "An array with various constraints.",
      "minItems": 1,
      "maxItems": 5,
      "uniqueItems": true,
      "items": {
        "type": "string"
      },
      "examples": [
        [
          "a",
          "b"
        ]
      ]
    },
    "contains_array_constraints": {
      "type": "array",
      "description": "An array with contains constraints.",
      "contains": {
        "type": "integer"
      },
      "minContains": 1,
      "maxContains": 2,
      "examples": [
        [
          1,
          "text",
          2
        ]
      ]
    },
    "object_constraints": {
      "type": "object",
      "description": "An object with various constraints.",
      "minProperties": 1,
      "maxProperties": 3,
      "additionalProperties": false,
      "propertyNames": {
        "pattern": "^[a-z0-9_]+$"
      },
      "properties": {
        "prop_a": {
          "type": "string",
          "description": "First arbitrary string property.",
          "examples": [
            "some_value"
          ]
        },
        "prop_b": {
          "type": "string",
          "description": "Second arbitrary string property.",
          "examples": [
            "another_value"
          ]
        }
      },
      "examples": [
        {
          "prop_a": "some_value",
          "prop_b": "another_value"
        }
      ]
    },
    "dependent_required_constraint": {
      "type": "object",
      "description": "An object with dependent required properties.",
      "dependentRequired": {
        "credit_card": [
          "billing_address"
        ]
      },
      "properties": {
        "credit_card": {
          "type": "number",
          "description": "The credit card number.",
          "examples": [
            1234567890123456
          ]
        },
        "billing_address": {
          "type": "string",
          "description": "The billing address associated with the credit card.",
          "examples": [
            "123 Billing Address, Anytown, USA"
          ]
        }
      },
      "examples": [
        {
          "credit_card": 1234567890123456,
          "billing_address": "123 Billing Address, Anytown, USA"
        }
      ]
    },
    "enum_constraint": {
      "type": "string",
      "description": "A property with an enum constraint.",
      "enum": [
        "admin",
        "editor",
        "viewer"
      ],
      "examples": [
        "admin"
      ]
    },
    "const_constraint": {
      "type": "string",
      "description": "A property that must have a constant value.",
      "const": "must_be_this",
      "examples": [
        "must_be_this"
      ]
    }
  }
}