Skip to main content
Users
CloudPortalLogin
  • Powered byPowered by
Developing with Sitecore Personalize
Data privacy
Before you start sending data
Integrating with Sitecore Personalize
Stream API
Personalize API Flow execution
REST APIs
  • Sitecore Personalize for developers
  • Integrating with Sitecore Personalize
  • 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 Personalize with a native app or native mobile app.

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:

  1. Get the browser ID from Sitecore Personalize.

  2. Send your first VIEW event.

  3. Verify that Sitecore Personalize captured your VIEW event.

Before you begin
  • Collect the required details about your Sitecore Personalize instance.

  • Make sure you're familiar with the HTTP request-response cycle and with making HTTP requests in the terminal using cURL.

Get the browser ID from Sitecore Personalize

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

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 Personalize 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-engage-eu.sitecorecloud.io/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 Personalize.

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 Personalize 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 Personalize 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-engage-eu.sitecorecloud.io/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 Personalize.

Verify that Sitecore Personalize captured your VIEW event

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

To verify that Sitecore Personalize captured your VIEW event:

  1. In Sitecore Personalize, click Developer center > Event viewer, then in the search dropdown, select Browser ID and paste the copied text into the search field. A list of events associated with this guest displays. The list contains a VIEW event. This is the event that was triggered in a previous procedure.

    Note

    If you have both Sitecore CDP and Sitecore Personalize, you can find the data in Guests.

Next steps

You've now successfully integrated your app with Sitecore Personalize. You made an HTTP request to get the browser ID. Then, using the browser ID, you sent a VIEW event and verified that Sitecore Personalize 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