identity

Version:

Type

Function

Import path

@sitecore-cloudsdk/events/server

Sends an IDENTITY event.

Signature

export function identity(
  request: Request,
  identityData: IdentityData
): Promise<EPResponse | null>

Parameters

Name

Type

Description

request

Request

Required.

The HTTP request.

identityData

IdentityData

Required.

Data for IDENTITY events.

Return value

Returns a promise.

Examples

Example 47. 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:

import type { NextRequest } from "next/server";
import { NextResponse } from "next/server";
import { CloudSDK } from "@sitecore-cloudsdk/core/server";
import { identity } from "@sitecore-cloudsdk/events/server";

export default async function middleware(request: NextRequest) {
  const response = NextResponse.next();

  // Initialize the SDK and the package...

  // Send event:
  const eventData: any = {
    identifiers: [
        {
            id: "123456",
            provider: "BXLP"
        }
    ]
  };

  const identityResponse = await identity(request, eventData);
  console.log("Sent IDENTITY event.", identityResponse);

  return response;
};


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