Last Updated on June 4, 2023 by sandeeppote
The ADD
event captures the product details when a user adds the product(s) to their online cart.
To know more what should be the API endpoint and api version see this blog
Pre-requisite- The guest has to be created which can be identitfied as browserid
Generate browser id – see how to generate browserid using postman here
URL – contains event to create Add event. – highlighted below.
Add the Product details the user must have added in cart and send the below request to Sitecore CDP.
At this point the Guest must have been identified as the Customer. Search Customer by browserid or Name.
Should the current activity of the customer.
Click on Timeline and View Session details
The session should show the product been added to the cart. Based on this if the product remains in cart for certain time and the user doen’t checkout you may provision to trigger abandon cart event.
cURL code snippet-
curl --location -g --request GET 'https://api.boxever.com/v1.2/event/create.json?client_key=<<Client Key>>&message={"channel":"WEB","type":"CONFIRM","language":"EN","currency":"GBP","page":"home page","pos":"pastoral-witty-grill","browser_id":"7ed103bd-08c2-47f4-8f69-91141ca3200d","product":[{"item_id":"EXACT_90"}]}'
C# code snippet-
var client = new RestClient("https://api.boxever.com/v1.2/event/create.json?client_key=<<Client Key>>&message={\"channel\":\"WEB\",\"type\":\"CONFIRM\",\"language\":\"EN\",\"currency\":\"GBP\",\"page\":\"home page\",\"pos\":\"pastoral-witty-grill\",\"browser_id\":\"7ed103bd-08c2-47f4-8f69-91141ca3200d\",\"product\":[{\"item_id\":\"EXACT_90\"}]}");
client.Timeout = -1;
var request = new RestRequest(Method.GET);
IRestResponse response = client.Execute(request);
Console.WriteLine(response.Content);
Python code snippet-
import http.client
conn = http.client.HTTPSConnection("api.boxever.com")
payload = ''
headers = {}
conn.request("GET", "/v1.2/event/create.json?client_key=<<Client Key>>&message=%7B%22channel%22:%22WEB%22,%22type%22:%22CONFIRM%22,%22language%22:%22EN%22,%22currency%22:%22GBP%22,%22page%22:%22home%20page%22,%22pos%22:%22pastoral-witty-grill%22,%22browser_id%22:%227ed103bd-08c2-47f4-8f69-91141ca3200d%22,%22product%22:%5B%7B%22item_id%22:%22EXACT_90%22%7D%5D%7D", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
Reference-