Sending events
Instead of using direct HTTP requests, we recommend that you send events using the Engage SDK. Using the Engage SDK, you have to format and send your event data differently than described in this section. See Sending events.
GET /v1.2/event/create.json?client_key=client_key&message=event
To send events to Sitecore CDP using direct HTTP requests, for example, a VIEW event, make GET
requests using the Event API (Stream API type). Pass the event object in the message
parameter. Make sure to format the event object correctly and to include all the required attributes.
Parameter |
Type |
Description |
Example |
---|---|---|---|
|
string |
Your client key. |
|
|
JSON object |
All the event details. |
|
The event data is sent as a JSON object in the URL. Attend to the following:
-
Wrap the object in curly braces
{}
. -
Wrap every key and every value in double quotes
""
. -
Don't add line breaks.
-
Don't add spaces around keys and around values.
{"channel":"MOBILE_APP","type":"VIEW","language":"EN","currency":"EUR","page":"homepage","pos":"myretailsite/ireland","browser_id":"a38b230c-11eb-4cf9-8d5d-274e9f344925"}
At a minimum, every event data object must include the following attributes. Note that event data objects for different event types may require more attributes than listed in this table.
Attribute |
Type |
Description |
Example |
---|---|---|---|
|
string (uppercase) |
The touchpoint where the user interacts with your brand. For example, for webpages, the channel is |
Must be one of:
|
|
string (uppercase) |
The type of the event that takes place when the user interacts with your brand. To send a Sitecore CDP standard event, for example, VIEW or IDENTITY, set the value to a Sitecore CDP reserved event name. To send a custom event, set the value to a custom event name of your choice. The custom event name must be different than Sitecore CDP reserved event names. Sitecore CDP reserved event names:
|
|
|
string (uppercase ISO 639-1) |
The language the user is using your app in. For example, if the user selects the Japanese language on your website, the language is |
|
|
string (uppercase ISO 4217) |
The alphabetic currency code of the currency the user is using in your app. For example, if the user selects Australian dollars as the currency on your website, the currency is |
|
|
string |
The name of the webpage where the interaction with your brand takes place. This is a custom value of your choice. |
|
|
string |
The name of the point of sale where the interaction with your brand takes place. You must set this value to the name of a point of sale that exists in your instance of Sitecore CDP. |
|
|
string |
The browser ID. |
The browser ID is a string similar to:
|
curl -X GET -g '<baseURL>/v1.2/event/create.json?client_key=<client_key>&message={"channel":"MOBILE_APP","type":"VIEW","language":"EN","currency":"EUR","page":"homepage","pos":"myretailsite/ireland","browser_id":"a38b230c-11eb-4cf9-8d5d-274e9f344925"}'
{
"status": "OK",
"version": "1.2",
"client_key": "ZpHxO9WvLOfQRVPlvo0BqB8YjGYuFfNe",
"ref": "dcb27c41-688d-4c36-8ed7-536e7bf590ba"
}