identity

Version:

Type

Function

Import path

@sitecore-cloudsdk/events/browser

Sends an IDENTITY event.

Signature

export async function identity(
  identityData: IdentityData
): Promise<EPResponse | null>

Parameters

Name

Type

Description

identityData

IdentityData

Required.

Data for IDENTITY events.

Return value

Returns a promise.

Examples

Example 33. Running the identity function

Next.js

Note

To run this function, you have to first initialize the Cloud SDK.

See more examples and other data you can include in the event.

Here's an example of how to use the identity function:

"use client"; // Used only in Next.js App Router
import { identity } from "@sitecore-cloudsdk/events/browser";

export default function Component(){
  const sendIdentityEvent = async () => {
    const eventData: any = {
      identifiers: [
        {
          id: "123456",
          provider: "BXLP"
        }
      ]
    };

    await identity(eventData);
    console.log("Sent IDENTITY event.");
  };

  return (
    <div>
      <button onClick={sendIdentityEvent}>send IDENTITY event</button>
    </div>
  );
};


If you have suggestions for improving this article, let us know!