Skip to main content
Version: 1.3.0

Identify User

Associates a known web user with Braze and sets custom user attributes.

Code Example

braze.changeUser("user_98765");
const user = braze.getUser();
user.setCustomUserAttribute("loyalty_tier", "gold");
user.setCustomUserAttribute("preferred_store", "store_042");
user.setCustomUserAttribute("marketing_opt_in", true);

Event Properties

PropertyTypeConstraintsExamplesDescription
userIdstringrequired
"user_98765"
"usr_12345"
The unique external identifier for the user.
minLength: 1
loyalty_tierstringenum: [bronze, silver, gold]
"gold"
"silver"
The user's loyalty tier.
preferred_storestring
"store_042"
"berlin_mitte"
The user's preferred store or fulfillment location.
marketing_opt_inboolean
true
false
Whether the user has opted into marketing communication.
View Raw JSON Schema
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://tracking-docs-demo.buchert.digital/schemas/1.3.0/braze/identify-user.json",
  "title": "Identify User",
  "description": "Associates a known web user with Braze and sets custom user attributes.",
  "x-tracking-targets": [
    "web-braze-js"
  ],
  "x-method": "identify",
  "type": "object",
  "properties": {
    "userId": {
      "type": "string",
      "description": "The unique external identifier for the user.",
      "minLength": 1,
      "examples": [
        "user_98765",
        "usr_12345"
      ]
    },
    "loyalty_tier": {
      "type": "string",
      "description": "The user's loyalty tier.",
      "enum": [
        "bronze",
        "silver",
        "gold"
      ],
      "examples": [
        "gold",
        "silver"
      ]
    },
    "preferred_store": {
      "type": "string",
      "description": "The user's preferred store or fulfillment location.",
      "examples": [
        "store_042",
        "berlin_mitte"
      ]
    },
    "marketing_opt_in": {
      "type": "boolean",
      "description": "Whether the user has opted into marketing communication.",
      "examples": [
        true,
        false
      ]
    }
  },
  "required": [
    "userId"
  ]
}