Skip to main content
Sitecore Documentation
  • Learn
  • Downloads
  • Changelog
  • Roadmap
CDPCloud Portal
Sitecore CDP Developer Documentation
  • Developing with Sitecore CDP
            • Engage.init(settings)
            • Engage.initServer(settings)
            • Engage.initServer.handleCookie(req, res)
            • Engage.getBrowserId()
            • Engage.getGuestId()
            • Engage.updatePointOfSale(pointOfSale)
            • Engage.pageView(eventData[, extensionData])
            • Engage.identity(eventData[, extensionData])
            • Engage.event(type, eventData[, extensionData])
            • Engage.addToEventQueue(type, eventData[, extensionData])
            • Engage.processEventQueue()
            • Engage.clearEventQueue()
            • EngageServer.pageView(eventData, req[, extensionData])
            • EngageServer.identity(eventData, req[, extensionData])
            • EngageServer.event(type, eventData, req[, extensionData])
            • window.Engage.triggerExperiences()
        • Troubleshooting
        • Release notes
  1. Functions
  1. Stream API
  2. Functions
  3. EngageServer.identity(eventData, req[, extensionData])

EngageServer.identity(eventData, req[, extensionData])

Note

This is a server-side function used for implementing server-side tracking. If you want to implement client-side tracking instead, use the client-side functions.

The identity() function sends an IDENTITY event. The IDENTITY event is used to resolve the identity of an anonymous user of your app and turn them into a known user.

sidebar. Parameters

Parameter

Type

Description

eventData

object

All the event data.

req

object

The HTTP request.

[extensionData]

optional

object

Custom data about an event.

Maximum 50 custom attributes of your choice.

Example 14. Next app

Here's an example of how to use the identity() function in a Next app.

export async function middleware(req) {
  const res = NextResponse.next();

  // Load Engage API
  const engageSettings = {
    clientKey: "<client_key_PLACEHOLDER>",
    targetURL: "<stream_api_target_endpoint_PLACEHOLDER>",
    pointOfSale: "<point_of_sale_PLACEHOLDER>"
  };

  const engageServer = await initServer(engageSettings);

  // Send IDENTITY event
  const eventData = {
    channel: "WEB",
    currency: "EUR",
    identifiers: [
        {
            id: "123456",
            provider: "BXLP"
        }
    ]
  };

  const extensionData = {
    customKey: "customValue"
  };

  await engageServer.identity(eventData, req, extensionData);
  return res;
};


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

Documentation Assistant

This assistant uses AI to generate responses based on Sitecore documentation. While it has access to official sources, answers may be incomplete or inaccurate and should not be considered official advice or support.
Powered by
k
kapa.ai
Protected by reCAPTCHA

© Copyright 2026, Sitecore A/S or a Sitecore affiliated company.
All rights reserved.

Privacy policySitecore Trust CenterTerms of use