Skip to content

AnalyticsEvent

Type: schema

Description

Model for analytics event

TypeScript Definition

typescript
AnalyticsEvent: {{
            /** @description event name */
            event: string;
            /** @constant */
            type: "track";
            /** @description commercengine user id */
            userId: string;
            /** @constant */
            channel: "website";
            context: {
                ip: string;
                userAgent: string;
            };
            /** @description properties of the event */
            properties: Record<string, never>;
            /** @description unique hash string. */
            messageId: string;
            /**
             * Format: date-time
             * @description timestamp when event occured
             */
            timestamp: string;
            /**
             * Format: date-time
             * @description time when event sent to server
             */
            sentAt: string;
        };
        /** AnonymousUser */
}

OpenAPI Schema

json
{
  "title": "AnalyticsEvent",
  "description": "Model for analytics event",
  "type": "object",
  "externalDocs": {
    "url": "https://llm-docs.commercengine.io/storefront/schemas/AnalyticsEvent",
    "description": "API reference for the AnalyticsEvent schema"
  },
  "required": [
    "event",
    "type",
    "userId",
    "channel",
    "context",
    "properties",
    "messageId",
    "timestamp",
    "sentAt"
  ],
  "properties": {
    "event": {
      "description": "event name",
      "type": "string"
    },
    "type": {
      "const": "track"
    },
    "userId": {
      "description": "commercengine user id",
      "type": "string"
    },
    "channel": {
      "const": "website"
    },
    "context": {
      "type": "object",
      "properties": {
        "ip": {
          "type": "string"
        },
        "userAgent": {
          "type": "string"
        }
      },
      "required": [
        "ip",
        "userAgent"
      ]
    },
    "properties": {
      "description": "properties of the event",
      "type": "object"
    },
    "messageId": {
      "description": "unique hash string.",
      "type": "string"
    },
    "timestamp": {
      "description": "timestamp when event occured",
      "type": "string",
      "format": "date-time"
    },
    "sentAt": {
      "description": "time when event sent to server",
      "type": "string",
      "format": "date-time"
    }
  }
}

Auto-generated from OpenAPI spec and TypeScript definitions

Last updated: