Skip to main content
Version: 1.3.0

Identify User

Associates a user with traits via the identify() call. userId is optional — omit it for anonymous users and the SDK will use its own anonymousId.

Code Example

analytics.identify("usr_12345", {
"email": "jane@example.com",
"name": "Jane Doe",
"plan": "free",
"created_at": "2024-01-15T10:30:00Z"
});

Event Properties

PropertyTypeConstraintsExamplesDescription
$schemastringrequired
"https://tracking-docs-demo.buchert.digital/schemas/analytics-js/identify-user.json"
Defines the structure of the event.
const: "https://tracking-docs-demo.buchert.digital/schemas/analytics-js/identify-user.json"
userIdstring
"usr_12345"
"user@example.com"
The unique identifier for the user in your database. Optional — omit for anonymous users.
emailstring
"jane@example.com"
"john.doe@company.com"
The email address of the user.
namestring
"Jane Doe"
"John Smith"
The full name of the user.
planstringenum: [free, pro, enterprise]
"free"
"pro"
"enterprise"
The subscription plan of the user.
created_atstring
"2024-01-15T10:30:00Z"
"2023-06-01T00:00:00Z"
ISO 8601 timestamp of when the user account was created.
View Raw JSON Schema
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://tracking-docs-demo.buchert.digital/schemas/analytics-js/identify-user.json",
  "title": "Identify User",
  "description": "Associates a user with traits via the identify() call. userId is optional — omit it for anonymous users and the SDK will use its own anonymousId.",
  "x-tracking-targets": [
    "web-segment-js",
    "web-rudderstack-js",
    "web-hightouch-js"
  ],
  "x-method": "identify",
  "type": "object",
  "properties": {
    "$schema": {
      "type": "string",
      "description": "Defines the structure of the event.",
      "const": "https://tracking-docs-demo.buchert.digital/schemas/analytics-js/identify-user.json"
    },
    "userId": {
      "type": "string",
      "description": "The unique identifier for the user in your database. Optional — omit for anonymous users.",
      "examples": [
        "usr_12345",
        "user@example.com"
      ]
    },
    "email": {
      "type": "string",
      "description": "The email address of the user.",
      "examples": [
        "jane@example.com",
        "john.doe@company.com"
      ]
    },
    "name": {
      "type": "string",
      "description": "The full name of the user.",
      "examples": [
        "Jane Doe",
        "John Smith"
      ]
    },
    "plan": {
      "type": "string",
      "description": "The subscription plan of the user.",
      "enum": [
        "free",
        "pro",
        "enterprise"
      ],
      "examples": [
        "free",
        "pro",
        "enterprise"
      ]
    },
    "created_at": {
      "type": "string",
      "description": "ISO 8601 timestamp of when the user account was created.",
      "examples": [
        "2024-01-15T10:30:00Z",
        "2023-06-01T00:00:00Z"
      ]
    }
  },
  "required": [
    "$schema"
  ]
}