Skip to main content
Users
CloudPortalLogin
  • Powered byPowered by
Developing with Sitecore CDP
Data privacy
Before you start sending data
Integrating with Sitecore CDP
Stream API
Batch API
REST APIs
Data lake export service
  • Sitecore CDP for developers
  • Integrating with Sitecore CDP
  • Walkthroughs for integrating
  • Integrate using direct HTTP requests

Integrate using direct HTTP requests

This topic explains how to integrate using direct HTTP requests. This is useful if you want to integrate Sitecore CDP with a native app or native mobile app.

This walkthrough assumes that you:

  • Have collected the required details about your Sitecore CDP instance.

  • Are familiar with the HTTP request-response cycle and with making HTTP requests in the terminal using cURL.

To follow this walkthrough, you'll use a terminal or an API testing tool, for example, Postman. This walkthrough uses cURL in the Git Bash terminal to demonstrate making HTTP requests. In production, you make the HTTP requests in your code base.

This walkthrough describes how to:

  • Get the browser ID from Sitecore CDP.

  • Send your first VIEW event.

  • Verify that Sitecore CDP captured your VIEW event.

Get the browser ID from Sitecore CDP

The first step to integrating is to make an HTTP request to Sitecore CDP to get the browser ID. You have to include the browser ID in every subsequent request you make to Sitecore CDP.

To get the browser ID:

  1. In your terminal, make the following HTTP request.

    Replace the placeholder values with the required details from your Sitecore CDP instance.

    RequestResponse
    curl -X GET -g '<stream_api_target_endpoint_PLACEHOLDER>/v1.2/browser/create.json?client_key=<client_key_PLACEHOLDER>'

    Example request:

    RequestResponse
    curl -X GET -g 'https://api.boxever.com/v1.2/browser/create.json?client_key=ZpHxO9WvLOfQRVPlvo0BqB8YjGYuFfNe'

    The HTTP response body is a JSON object that contains a ref key.

    The ref key contains the browser ID.

    RequestResponse
       "ref" : "a38b230c-11eb-4cf9-8d5d-274e9f344925​",
    
  2. Note down the browser ID. You'll include it in every subsequent request you make to Sitecore CDP.

Send your first VIEW event

After you have retrieved the browser ID, you send an event as key-value pairs.

To send an event:

  1. Prepare the key-value pairs that describe the VIEW event. In a later step, you pass them to the message query parameter in the URL. You must prepare the key-value pairs to be valid in the URL. Make sure that you:

    • Wrap every key and every value in double quotes "".

    • Don't add line breaks.

    • Don't add spaces around keys and around values.

    Example key-value pairs:

    RequestResponse
    "browser_id":"a38b230c-11eb-4cf9-8d5d-274e9f344925​","channel":"MOBILE_APP","type":"VIEW","language":"EN","currency":"EUR","page":"homepage","pos":"myretailsite/ireland"
    Important

    Note that the "browser_id" key contains the browser ID that you retrieved in a previous step.

    Every event that you send to Sitecore CDP must include the browser ID.

  2. In your terminal, make the following HTTP request, passing the key-value pairs to the message query parameter.

    Replace the placeholder values with the required details from your Sitecore CDP instance.

    In the message query parameter, replace the placeholder values with event object values specific to your organization.

    RequestResponse
    curl -X GET -g '<stream_api_target_endpoint_PLACEHOLDER>/v1.2/event/create.json?client_key=<client_key_PLACEHOLDER>&message={"browser_id":"<browser_id_PLACEHOLDER>","channel":"<channel_PLACEHOLDER>","type":"<type_PLACEHOLDER>","language":"<language_PLACEHOLDER>","currency":"<currency_PLACEHOLDER>","page":"<page_PLACEHOLDER>","pos":"<pos_PLACEHOLDER>"}'

    Example request:

    RequestResponse
    curl -X GET -g 'https://api.boxever.com/v1.2/event/create.json?client_key=ZpHxO9WvLOfQRVPlvo0BqB8YjGYuFfNe&message={"browser_id":"a38b230c-11eb-4cf9-8d5d-274e9f344925​","channel":"MOBILE_APP","type":"VIEW","language":"EN","currency":"EUR","page":"homepage","pos":"myretailsite/ireland"}'

    The event data is sent to Sitecore CDP.

Verify that Sitecore CDP captured your VIEW event

After you have sent a VIEW event, you log in to Sitecore CDP and find the event.

To verify that Sitecore CDP captured your VIEW event:

  1. In Sitecore CDP, click Guests, then in the search dropdown, select Browser ID and enter the browser ID that you retrieved in a previous step.

    Example search string:

    a38b230c-11eb-4cf9-8d5d-274e9f344925​

    An anonymous guest displays.

    Search field in the Guests screen.

    This is you making an HTTP request to get the browser ID in a previous step. Next, you find the VIEW event associated with this guest.

  2. Click the guest. The guest profile displays.

  3. On the guest profile page, click Event viewer. A list of events associated with this guest displays. The list contains a VIEW event. This is the event that was triggered in the previous procedure.

Next steps

You've now successfully integrated your app with Sitecore CDP. You made an HTTP request to get the browser ID. Then, using the browser ID, you sent a VIEW event and verified that Sitecore CDP captures data about your users in real time.

Next, you can:

  • Send other types of events, for example, an IDENTITY event.

  • Learn more about the browser ID.

Do you have some feedback for us?

If you have suggestions for improving this article,

Privacy policySitecore Trust CenterCopyright © 1999-2025 Sitecore