Braze JavaScript SDK
    Preparing search index...

    Function setCustomUserAttribute

    • Sets a custom user attribute. This can be any key/value pair and is used to collect extra information about the current user.

      Parameters

      • key: string

        The identifier of the custom attribute. Limited to 255 characters in length, cannot begin with a $, and can only contain alphanumeric characters and punctuation.

      • value: CustomUserAttributeValue

        Can be numeric, boolean, a Date object, a string, or an array of strings. Strings are limited to 255 characters in length, cannot begin with a $ and cannot contain new lines, tabs or double quotes. It can only include alphanumeric characters and other punctuation. Passing a null value will remove this custom attribute from the user.

      • Optionalmerge: boolean

        Whether the value should be merged with the existing value on the backend. If false (default), any existing attribute will be overwritten. If true, existing objects and arrays of objects will be merged. To update an array of objects, follow the guidelines in our public docs.

      Returns Promise<boolean | undefined>

      Resolves to a boolean that indicates whether the attribute was successfully enqueued. Resolves to undefined if the SDK is not initialized.