{
  "$schema": "http://json-schema.org/draft-07/schema#",
  "$id": "https://raw.githubusercontent.com/api-evangelist/ninetailed/main/json-schema/ninetailed-event.json",
  "title": "NinetailedEvent",
  "description": "A behavioral or identity event sent to the Ninetailed Experience API to build or update a visitor profile.",
  "type": "object",
  "required": ["type"],
  "properties": {
    "type": {
      "type": "string",
      "enum": ["page", "track", "identify", "screen", "component"],
      "description": "The type of event being recorded."
    },
    "userId": {
      "type": "string",
      "description": "Stable user identifier for linking anonymous and identified sessions."
    },
    "anonymousId": {
      "type": "string",
      "description": "Anonymous identifier for unidentified visitors."
    },
    "name": {
      "type": "string",
      "description": "Name of the page, screen, or track event."
    },
    "traits": {
      "type": "object",
      "description": "Key-value pairs describing user attributes. Used with identify events.",
      "additionalProperties": true,
      "properties": {
        "email": {
          "type": "string",
          "format": "email",
          "description": "Visitor email address."
        },
        "name": {
          "type": "string",
          "description": "Visitor full name."
        },
        "plan": {
          "type": "string",
          "description": "Visitor's subscription plan."
        }
      }
    },
    "properties": {
      "type": "object",
      "description": "Key-value pairs describing event properties. Used with page and track events.",
      "additionalProperties": true,
      "properties": {
        "url": {
          "type": "string",
          "format": "uri",
          "description": "Full URL of the page."
        },
        "path": {
          "type": "string",
          "description": "Path portion of the URL."
        },
        "title": {
          "type": "string",
          "description": "Page title."
        },
        "referrer": {
          "type": "string",
          "format": "uri",
          "description": "Referring URL."
        }
      }
    },
    "timestamp": {
      "type": "string",
      "format": "date-time",
      "description": "ISO 8601 timestamp of when the event occurred."
    }
  }
}
