Events Tracking
This API tracks the different user events. Events tracking is imperative to provide personalized user journeys and improve customer engagement. This also serves to measure and monitor performance of the different recommendation strategies defined for the different touchpoints.
#
AuthenticationYou can use API keys or Requesting URLs based on your requirements & preference. Check here to choose one that suits you the best.
#
Request#
Request TypePOST
#
Request HeadersRequest Headerx-api-key: <api_key>
Note:
You can skip sending x-api-key if you choose authentication via Requesting URL.
#
EndpointThe base URL will be provided to you at the time of onboarding.
POST <base_url>/events/track
#
Request ParametersRequest parameters to be specified within key "data"
Param | Type | Required | Description | Mandatory for Events |
---|---|---|---|---|
mad_uuid | string | yes | Auto generated uuid for a user session. Should be stored in the cookie for the period of 1 year. If Integration Mode is API, set and get mad_uuid using this method. Note: The same mad uuid should be passed in the events, search and recommendations API request. | All |
user_id | string | yes for logged in users | Unique ID associated by the merchant to the user in the site. | All |
url | string | yes | URL of the page. | All |
referrer | string | yes, if applicable | Referrer URL from where the user was redirected to the current page. | All |
medium | string | yes | Unique Identifier for events. Allowed Values: vue_x for website/app events, offline_data for offline events. | All |
source | string | yes | Indicates a unique source. Allowed Value: client name provided at time of onboarding. | All |
platform | string | yes | Indicates the platform of the event. Allowed Values: desktop, mobile, android, ios | All |
name | string | yes | Indicates name of the event. Refer here for event names that we recommend to be tracked. | All |
action | string | yes | Indicates action of the event. Refer here for event actions that we recommend to be tracked. | All |
non_interaction | string | yes | Indicates action triggered by interaction or otherwise. Allowed values: true, false. | All |
metadata -> account_id | string | yes | Client account ID associated with the tool. | All |
metadata -> region | string | yes | Indicates the internal region associated with the client account. Allowed values: us-east-1, ap-southeast-1, eu-central-1 | All |
metadata -> region_code | string | yes if multi- region is supported | Region or Locale code of the site. | All |
metadata -> env | string | yes | Client environment. Allowed values: prod, staging | All |
metadata -> currency | string | yes | Currency supported by the website. | To be passed in addtoCart, pageView of Product Detail Page, orderConfirmation and placeOrder events |
metadata -> page_type | string | yes | Indicates page type. Refer here for the values of pageType for the different pages in the website. | All |
metadata -> module_id | string | yes for some events | Indicates the ID of the module that is rendered in recommendation. | All |
metadata -> strategy_id | string | yes for some events | Indicates the ID of the strategy that is rendered in recommendation. | All |
metadata -> module_name | string | yes for some events | Indicates the module name that is rendered in recommendation. | All |
metadata -> product_list | array of JSON objects | yes for some events/page types | Product list that is under view. | All |
metadata -> referrer_product | JSON object | yes for some events/page types | Source Product for which the recommendation was rendered. | To be passed in recommendedProductView |
metadata -> pos_of_reco | number | yes for some events | Position of the product that was clicked in the recommendation. | recommendedProductView |
metadata -> recos_served | string | yes for some events | Number of recommendations served in the page. | recommendationView |
metadata -> template_type | string | yes for some events | Indicates type of template. Allowed Values: simple-carousel, carousel, simple-grid. | All |
metadata -> module_behaviour | string | yes for some events | Indicates how the recommendation is rendered. Allowed values: inline, popup | All |
metadata -> category | string | yes for some page types | Indicates the category of the page for Product Listing Page. | All |
metadata -> order_by | JSON object | yes, if applicable | Indicates the sort order applied for the Product Listing Page. Sort section describes this in detail. | All |
metadata -> filters | array of JSON objects | yes, if applicable | Indicates the filters applied for the Product Listing Page. Filters section describes this in detail. | All |
metadata -> order_id | string | yes for some events | Indicates the ID of the order placed. | orderConfirmation and placeOrder |
_journey_metadata -> audience_id | string | yes | Indicates the audience ID for which the recommendation is rendered. Read from Recommendation API response. | All |
_journey_metadata -> page_id | string | yes | Indicates the page ID where the recommendation is rendered. Read from Recommendation API response. | All |
_journey_metadata -> experience_id | string | yes | Indicates the experience ID for which the recommendation is rendered. Read from Recommendation API response. | All |
_journey_metadata -> journey_id | string | yes | Indicates the journey ID for which the recommendation is rendered. Read from Recommendation API response. | All |
Note: Refer here for the events that are required to be tracked.
#
Product Detail Object ParametersParam | Type | Required | Description |
---|---|---|---|
product_id | string | yes | For event: recommendationView - Indicates the unique product identifier of the product for which recommendations are viewed. For event: recommendedProductView - Indicates the unique product identifier of the product which was clicked on. |
price | string | yes | The price of the product in reference. |
quantity | integer | no | The no. of quantity selected for the product in reference. |
#
ResponseResponse is a JSON indicating success/failure of the API call
#
Response Status CodeIndicates any response to the event request. For the different response codes we return, please refer the table below.
Response Code | Description |
---|---|
200 | Request successfully processed. |
401 | Authorization has been denied for this request. |
500 | Unhandled application errors |
#
Example 1 - Page View Event for Home PagePublish Page View event when Home Page loads
#
Request- JavaScript
- Python
- Ruby
- cURL
- PHP
- Java
- C#
var data = {"data": {"api_key": "9ed6bd6a23db7dd422893e156","mad_uuid": "2921651f-8ed9-4480-8c40-1021ddb38bc5","user_id": "user_abc","url": "https://example-site.com/","referrer": "","medium": "vue_x","source": "client_name","platform": "desktop","name": "pageView","action": "pageView","non_interaction": "true","metadata": {"account_id": "c17c8af3-e92f-42e7-ba3a-5b316bc14679","region": "us-east-1","env": "prod","currency": "USD","page_type": "home"},"_journey_metadata": {"audience_id": "1","page_id": "2132","experience_id": "1719","journey_id": "855"}}};var xhr = new XMLHttpRequest();xhr.withCredentials = true;xhr.addEventListener("readystatechange", function() {if(this.readyState === 4) {console.log(this.responseText);}});xhr.open("POST", "{{base_url}}/events/track");xhr.setRequestHeader("content-Type", "application/json");xhr.send(data);
import requestsurl = "{{base_url}}/events/track"payload = {"data": {"api_key": "9ed6bd6a23db7dd422893e156","mad_uuid": "2921651f-8ed9-4480-8c40-1021ddb38bc5","user_id": "user_abc","url": "https://example-site.com/","referrer": "","medium": "vue_x","source": "client_name","platform": "desktop","name": "pageView","action": "pageView","non_interaction": "true","metadata": {"account_id": "c17c8af3-e92f-42e7-ba3a-5b316bc14679","region": "us-east-1","env": "prod","currency": "USD","page_type": "home"},"_journey_metadata": {"audience_id": "1","page_id": "2132","experience_id": "1719","journey_id": "855"}}}headers = {"content-Type": "application/json"}response = requests.request("POST", url, headers=headers, data=payload)print(response.text)
require "uri"require "net/http"url = URI("{{base_url}}/events/track")http = Net::HTTP.new(url.host, url.port);request = Net::HTTP::Post.new(url)request["content-Type"] = "application/json"request.body = '{"data": {"api_key": "9ed6bd6a23db7dd422893e156","mad_uuid": "2921651f-8ed9-4480-8c40-1021ddb38bc5","user_id": "user_abc","url": "https://example-site.com/","referrer": "","medium": "vue_x","source": "client_name","platform": "desktop","name": "pageView","action": "pageView","non_interaction": "true","metadata": {"account_id": "c17c8af3-e92f-42e7-ba3a-5b316bc14679","region": "us-east-1","env": "prod","currency": "USD","page_type": "home"},"_journey_metadata": {"audience_id": "1","page_id": "2132","experience_id": "1719","journey_id": "855"}}}'response = http.request(request)puts response.read_body
curl --location -g --request POST '{{base_url}}/events/track'--header 'content-Type: application/json'--data-raw '{"data": {"api_key": "9ed6bd6a23db7dd422893e156","mad_uuid": "2921651f-8ed9-4480-8c40-1021ddb38bc5","user_id": "user_abc","url": "https://example-site.com/","referrer": "","medium": "vue_x","source": "client_name","platform": "desktop","name": "pageView","action": "pageView","non_interaction": "true","metadata": {"account_id": "c17c8af3-e92f-42e7-ba3a-5b316bc14679","region": "us-east-1","env": "prod","currency": "USD","page_type": "home"},"_journey_metadata": {"audience_id": "1","page_id": "2132","experience_id": "1719","journey_id": "855"}}}'
<?phprequire_once 'HTTP/Request2.php';$request = new HTTP_Request2();$request->setUrl('{{base_url}}/events/track');$request->setMethod(HTTP_Request2::METHOD_POST);$request->setConfig(array('follow_redirects' => TRUE));$request->setHeader(array('content-Type' => 'application/json'));$request->setBody('{"data": {"api_key": "9ed6bd6a23db7dd422893e156","mad_uuid": "2921651f-8ed9-4480-8c40-1021ddb38bc5","user_id": "user_abc","url": "https://example-site.com/","referrer": "","medium": "vue_x","source": "client_name","platform": "desktop","name": "pageView","action": "pageView","non_interaction": "true","metadata": {"account_id": "c17c8af3-e92f-42e7-ba3a-5b316bc14679","region": "us-east-1","env": "prod","currency": "USD","page_type": "home"},"_journey_metadata": {"audience_id": "1","page_id": "2132","experience_id": "1719","journey_id": "855"}}}');try {$response = $request->send();if ($response->getStatus() == 200) {echo $response->getBody();}else {echo 'Unexpected HTTP status: ' . $response->getStatus() . ' ' .$response->getReasonPhrase();}}catch(HTTP_Request2_Exception $e) {echo 'Error: ' . $e->getMessage();}
OkHttpClient client = new OkHttpClient().newBuilder().build();MediaType mediaType = MediaType.parse("text/plain");RequestBody body = RequestBody.create(mediaType, "{"data": {"api_key": "9ed6bd6a23db7dd422893e156","mad_uuid": "2921651f-8ed9-4480-8c40-1021ddb38bc5","user_id": "user_abc","url": "https://example-site.com/","referrer": "","medium": "vue_x","source": "client_name","platform": "desktop","name": "pageView","action": "pageView","non_interaction": "true","metadata": {"account_id": "c17c8af3-e92f-42e7-ba3a-5b316bc14679","region": "us-east-1","env": "prod","currency": "USD","page_type": "home"},"_journey_metadata": {"audience_id": "1","page_id": "2132","experience_id": "1719","journey_id": "855"}}}");Request request = new Request.Builder().url("{{base_url}}/events/track").method("POST", body).addHeader("content-Type", "application/json").build();Response response = client.newCall(request).execute();
var client = new RestClient("{{base_url}}/events/track");client.Timeout = -1;var request = new RestRequest(Method.POST);request.AddHeader("content-Type", "application/json")request.AddParameter("text/plain", '{"data": {"api_key": "9ed6bd6a23db7dd422893e156","mad_uuid": "2921651f-8ed9-4480-8c40-1021ddb38bc5","user_id": "user_abc","url": "https://example-site.com/","referrer": "","medium": "vue_x","source": "client_name","platform": "desktop","name": "pageView","action": "pageView","non_interaction": "true","metadata": {"account_id": "c17c8af3-e92f-42e7-ba3a-5b316bc14679","region": "us-east-1","env": "prod","currency": "USD","page_type": "home"},"_journey_metadata": {"audience_id": "1","page_id": "2132","experience_id": "1719","journey_id": "855"}}}', ParameterType.RequestBody);IRestResponse response = client.Execute(request);Console.WriteLine(response.Content);
#
Example 2 - Page View Event for Product Description PagePublish Page Vuew event when Product Description Page loads
- JavaScript
- Python
- Ruby
- cURL
- PHP
- Java
- C#
var data = {"data": {"api_key": "9ed6bd6a23db7dd422893e156","mad_uuid": "2921651f-8ed9-4480-8c40-1021ddb38fc6","user_id": "user_abc","url": "https://example-site.com/product/beige-fanny-pack-33941","referrer": "https://example-site.com","medium": "vue_x","source": "client_name","platform": "desktop","name": "pageView","action": "pageView","non_interaction": "true","metadata": {"account_id": "c17c8af3-e92f-42e7-ba3a-5b316bc14679","region": "us-east-1","env": "prod","currency": "USD","page_type": "pdp","product_list": [{"product_id": "2019000100030423","price": "79.00"}]},"_journey_metadata": {"audience_id": "1","page_id": "2132","experience_id": "1719","journey_id": "855"}}};var xhr = new XMLHttpRequest();xhr.withCredentials = true;xhr.addEventListener("readystatechange", function() {if(this.readyState === 4) {console.log(this.responseText);}});xhr.open("POST", "{{base_url}}/events/track");xhr.setRequestHeader("content-Type", "application/json");xhr.send(data);
import requestsurl = "{{base_url}}/events/track"payload = {"data": {"api_key": "9ed6bd6a23db7dd422893e156","mad_uuid": "2921651f-8ed9-4480-8c40-1021ddb38fc6","user_id": "user_abc","url": "https://example-site.com/product/beige-fanny-pack-33941","referrer": "https://example-site.com","medium": "vue_x","source": "client_name","platform": "desktop","name": "pageView","action": "pageView","non_interaction": "true","metadata": {"account_id": "c17c8af3-e92f-42e7-ba3a-5b316bc14679","region": "us-east-1","env": "prod","currency": "USD","page_type": "pdp","product_list": [{"product_id": "2019000100030423","price": "79.00"}]},"_journey_metadata": {"audience_id": "1","page_id": "2132","experience_id": "1719","journey_id": "855"}}}headers = {"content-Type": "application/json"}response = requests.request("POST", url, headers=headers, data=payload)print(response.text)
require "uri"require "net/http"url = URI("{{base_url}}/events/track")http = Net::HTTP.new(url.host, url.port);request = Net::HTTP::Post.new(url)request["content-Type"] = "application/json"request.body = '{"data": {"api_key": "9ed6bd6a23db7dd422893e156","mad_uuid": "2921651f-8ed9-4480-8c40-1021ddb38fc6","user_id": "user_abc","url": "https://example-site.com/product/beige-fanny-pack-33941","referrer": "https://example-site.com","medium": "vue_x","source": "client_name","platform": "desktop","name": "pageView","action": "pageView","non_interaction": "true","metadata": {"account_id": "c17c8af3-e92f-42e7-ba3a-5b316bc14679","region": "us-east-1","env": "prod","currency": "USD","page_type": "pdp","product_list": [{"product_id": "2019000100030423","price": "79.00"}]},"_journey_metadata": {"audience_id": "1","page_id": "2132","experience_id": "1719","journey_id": "855"}}}'response = http.request(request)puts response.read_body
curl --location -g --request POST '{{base_url}}/events/track'--header 'content-Type: application/json'--data-raw '{"data": {"api_key": "9ed6bd6a23db7dd422893e156","mad_uuid": "2921651f-8ed9-4480-8c40-1021ddb38fc6","user_id": "user_abc","url": "https://example-site.com/product/beige-fanny-pack-33941","referrer": "https://example-site.com","medium": "vue_x","source": "client_name","platform": "desktop","name": "pageView","action": "pageView","non_interaction": "true","metadata": {"account_id": "c17c8af3-e92f-42e7-ba3a-5b316bc14679","region": "us-east-1","env": "prod","currency": "USD","page_type": "pdp","product_list": [{"product_id": "2019000100030423","price": "79.00"}]},"_journey_metadata": {"audience_id": "1","page_id": "2132","experience_id": "1719","journey_id": "855"}}}'
<?phprequire_once 'HTTP/Request2.php';$request = new HTTP_Request2();$request->setUrl('{{base_url}}/events/track');$request->setMethod(HTTP_Request2::METHOD_POST);$request->setConfig(array('follow_redirects' => TRUE));$request->setHeader(array('content-Type' => 'application/json'));$request->setBody('{"data": {"api_key": "9ed6bd6a23db7dd422893e156","mad_uuid": "2921651f-8ed9-4480-8c40-1021ddb38fc6","user_id": "user_abc","url": "https://example-site.com/product/beige-fanny-pack-33941","referrer": "https://example-site.com","medium": "vue_x","source": "client_name","platform": "desktop","name": "pageView","action": "pageView","non_interaction": "true","metadata": {"account_id": "c17c8af3-e92f-42e7-ba3a-5b316bc14679","region": "us-east-1","env": "prod","currency": "USD","page_type": "pdp","product_list": [{"product_id": "2019000100030423","price": "79.00"}]},"_journey_metadata": {"audience_id": "1","page_id": "2132","experience_id": "1719","journey_id": "855"}}}');try {$response = $request->send();if ($response->getStatus() == 200) {echo $response->getBody();}else {echo 'Unexpected HTTP status: ' . $response->getStatus() . ' ' .$response->getReasonPhrase();}}catch(HTTP_Request2_Exception $e) {echo 'Error: ' . $e->getMessage();}
OkHttpClient client = new OkHttpClient().newBuilder().build();MediaType mediaType = MediaType.parse("text/plain");RequestBody body = RequestBody.create(mediaType, "{"data": {"api_key": "9ed6bd6a23db7dd422893e156","mad_uuid": "2921651f-8ed9-4480-8c40-1021ddb38fc6","user_id": "user_abc","url": "https://example-site.com/product/beige-fanny-pack-33941","referrer": "https://example-site.com","medium": "vue_x","source": "client_name","platform": "desktop","name": "pageView","action": "pageView","non_interaction": "true","metadata": {"account_id": "c17c8af3-e92f-42e7-ba3a-5b316bc14679","region": "us-east-1","env": "prod","currency": "USD","page_type": "pdp","product_list": [{"product_id": "2019000100030423","price": "79.00"}]},"_journey_metadata": {"audience_id": "1","page_id": "2132","experience_id": "1719","journey_id": "855"}}}");Request request = new Request.Builder().url("{{base_url}}/events/track").method("POST", body).addHeader("content-Type", "application/json").build();Response response = client.newCall(request).execute();
var client = new RestClient("{{base_url}}/events/track");client.Timeout = -1;var request = new RestRequest(Method.POST);request.AddHeader("content-Type", "application/json")request.AddParameter("text/plain", '{"data": {"api_key": "9ed6bd6a23db7dd422893e156","mad_uuid": "2921651f-8ed9-4480-8c40-1021ddb38fc6","user_id": "user_abc","url": "https://example-site.com/product/beige-fanny-pack-33941","referrer": "https://example-site.com","medium": "vue_x","source": "client_name","platform": "desktop","name": "pageView","action": "pageView","non_interaction": "true","metadata": {"account_id": "c17c8af3-e92f-42e7-ba3a-5b316bc14679","region": "us-east-1","env": "prod","currency": "USD","page_type": "pdp","product_list": [{"product_id": "2019000100030423","price": "79.00"}]},"_journey_metadata": {"audience_id": "1","page_id": "2132","experience_id": "1719","journey_id": "855"}}}', ParameterType.RequestBody);IRestResponse response = client.Execute(request);Console.WriteLine(response.Content);
#
Example 3 - Add To Cart Event from Product Description Page- JavaScript
- Python
- Ruby
- cURL
- PHP
- Java
- C#
var data = {"data": {"api_key": "9ed6bd6a23db7dd422893e167","mad_uuid": "2921651f-8ed9-4480-8c40-1021ddb38fc9","user_id": "user_abc","url": "https://example-site.com/product/beige-fanny-pack-33941","referrer": "https://example-site.com","medium": "vue_x","source": "client_name","platform": "desktop","name": "addToCart","action": "click","non_interaction": "false","metadata": {"account_id": "c17c8af3-e92f-42e7-ba3a-5b316bc14679","region": "us-east-1","env": "prod","currency": "USD","page_type": "pdp","product_list": [{"product_id": "2019000100030423","price": "79.00"}]},"_journey_metadata": {"audience_id": "1","page_id": "2132","experience_id": "1719","journey_id": "855"}}};var xhr = new XMLHttpRequest();xhr.withCredentials = true;xhr.addEventListener("readystatechange", function() {if(this.readyState === 4) {console.log(this.responseText);}});xhr.open("POST", "{{base_url}}/events/track");xhr.setRequestHeader("content-Type", "application/json");xhr.send(data);
import requestsurl = "{{base_url}}/events/track"payload = {"data": {"api_key": "9ed6bd6a23db7dd422893e167","mad_uuid": "2921651f-8ed9-4480-8c40-1021ddb38fc9","user_id": "user_abc","url": "https://example-site.com/product/beige-fanny-pack-33941","referrer": "https://example-site.com","medium": "vue_x","source": "client_name","platform": "desktop","name": "addToCart","action": "click","non_interaction": "false","metadata": {"account_id": "c17c8af3-e92f-42e7-ba3a-5b316bc14679","region": "us-east-1","env": "prod","currency": "USD","page_type": "pdp","product_list": [{"product_id": "2019000100030423","price": "79.00"}]},"_journey_metadata": {"audience_id": "1","page_id": "2132","experience_id": "1719","journey_id": "855"}}}headers = {"content-Type": "application/json"}response = requests.request("POST", url, headers=headers, data=payload)print(response.text)
require "uri"require "net/http"url = URI("{{base_url}}/events/track")http = Net::HTTP.new(url.host, url.port);request = Net::HTTP::Post.new(url)request["content-Type"] = "application/json"request.body = '{"data": {"api_key": "9ed6bd6a23db7dd422893e167","mad_uuid": "2921651f-8ed9-4480-8c40-1021ddb38fc9","user_id": "user_abc","url": "https://example-site.com/product/beige-fanny-pack-33941","referrer": "https://example-site.com","medium": "vue_x","source": "client_name","platform": "desktop","name": "addToCart","action": "click","non_interaction": "false","metadata": {"account_id": "c17c8af3-e92f-42e7-ba3a-5b316bc14679","region": "us-east-1","env": "prod","currency": "USD","page_type": "pdp","product_list": [{"product_id": "2019000100030423","price": "79.00"}]},"_journey_metadata": {"audience_id": "1","page_id": "2132","experience_id": "1719","journey_id": "855"}}}'response = http.request(request)puts response.read_body
curl --location -g --request POST '{{base_url}}/events/track'--header 'content-Type: application/json'--data-raw '{"data": {"api_key": "9ed6bd6a23db7dd422893e167","mad_uuid": "2921651f-8ed9-4480-8c40-1021ddb38fc9","user_id": "user_abc","url": "https://example-site.com/product/beige-fanny-pack-33941","referrer": "https://example-site.com","medium": "vue_x","source": "client_name","platform": "desktop","name": "addToCart","action": "click","non_interaction": "false","metadata": {"account_id": "c17c8af3-e92f-42e7-ba3a-5b316bc14679","region": "us-east-1","env": "prod","currency": "USD","page_type": "pdp","product_list": [{"product_id": "2019000100030423","price": "79.00"}]},"_journey_metadata": {"audience_id": "1","page_id": "2132","experience_id": "1719","journey_id": "855"}}}'
<?phprequire_once 'HTTP/Request2.php';$request = new HTTP_Request2();$request->setUrl('{{base_url}}/events/track');$request->setMethod(HTTP_Request2::METHOD_POST);$request->setConfig(array('follow_redirects' => TRUE));$request->setHeader(array('content-Type' => 'application/json'));$request->setBody('{"data": {"api_key": "9ed6bd6a23db7dd422893e167","mad_uuid": "2921651f-8ed9-4480-8c40-1021ddb38fc9","user_id": "user_abc","url": "https://example-site.com/product/beige-fanny-pack-33941","referrer": "https://example-site.com","medium": "vue_x","source": "client_name","platform": "desktop","name": "addToCart","action": "click","non_interaction": "false","metadata": {"account_id": "c17c8af3-e92f-42e7-ba3a-5b316bc14679","region": "us-east-1","env": "prod","currency": "USD","page_type": "pdp","product_list": [{"product_id": "2019000100030423","price": "79.00"}]},"_journey_metadata": {"audience_id": "1","page_id": "2132","experience_id": "1719","journey_id": "855"}}}');try {$response = $request->send();if ($response->getStatus() == 200) {echo $response->getBody();}else {echo 'Unexpected HTTP status: ' . $response->getStatus() . ' ' .$response->getReasonPhrase();}}catch(HTTP_Request2_Exception $e) {echo 'Error: ' . $e->getMessage();}
OkHttpClient client = new OkHttpClient().newBuilder().build();MediaType mediaType = MediaType.parse("text/plain");RequestBody body = RequestBody.create(mediaType, "{"data": {"api_key": "9ed6bd6a23db7dd422893e167","mad_uuid": "2921651f-8ed9-4480-8c40-1021ddb38fc9","user_id": "user_abc","url": "https://example-site.com/product/beige-fanny-pack-33941","referrer": "https://example-site.com","medium": "vue_x","source": "client_name","platform": "desktop","name": "addToCart","action": "click","non_interaction": "false","metadata": {"account_id": "c17c8af3-e92f-42e7-ba3a-5b316bc14679","region": "us-east-1","env": "prod","currency": "USD","page_type": "pdp","product_list": [{"product_id": "2019000100030423","price": "79.00"}]},"_journey_metadata": {"audience_id": "1","page_id": "2132","experience_id": "1719","journey_id": "855"}}}");Request request = new Request.Builder().url("{{base_url}}/events/track").method("POST", body).addHeader("content-Type", "application/json").build();Response response = client.newCall(request).execute();
var client = new RestClient("{{base_url}}/events/track");client.Timeout = -1;var request = new RestRequest(Method.POST);request.AddHeader("content-Type", "application/json")request.AddParameter("text/plain", '{"data": {"api_key": "9ed6bd6a23db7dd422893e167","mad_uuid": "2921651f-8ed9-4480-8c40-1021ddb38fc9","user_id": "user_abc","url": "https://example-site.com/product/beige-fanny-pack-33941","referrer": "https://example-site.com","medium": "vue_x","source": "client_name","platform": "desktop","name": "addToCart","action": "click","non_interaction": "false","metadata": {"account_id": "c17c8af3-e92f-42e7-ba3a-5b316bc14679","region": "us-east-1","env": "prod","currency": "USD","page_type": "pdp","product_list": [{"product_id": "2019000100030423","price": "79.00"}]},"_journey_metadata": {"audience_id": "1","page_id": "2132","experience_id": "1719","journey_id": "855"}}}', ParameterType.RequestBody);IRestResponse response = client.Execute(request);Console.WriteLine(response.Content);
#
Example 4 - Order Confirmation Event- JavaScript
- Python
- Ruby
- cURL
- PHP
- Java
- C#
var data = {"data": {"api_key": "9ed6bd6a23db7dd422893e167","mad_uuid": "4d3be7e9-0b87-41b9-94c7-b5da57cde234","user_id": "user_abc","url": "https://example-site.com/checkout-finished?orderId=378829558","referrer": "https://example-site.com","medium": "vue_x","source": "client_name","platform": "desktop","name": "orderConfirmation","action": "pageView","non_interaction": "true","metadata": {"account_id": "86a4c9b0-c27f-4a2d-ba7e-f53848da8894","region": "us-east-1","env": "prod","currency": "USD","page_type": "oc","order_id": "378829558","product_list": [{"price": "19","quantity": "1","product_id": "2019000100027007"},{"price": "99","quantity": "1","product_id": "2019000100022951"}]},"_journey_metadata": {"audience_id": "1","page_id": "1600","experience_id": "374","journey_id": "450"}}};var xhr = new XMLHttpRequest();xhr.withCredentials = true;xhr.addEventListener("readystatechange", function() {if(this.readyState === 4) {console.log(this.responseText);}});xhr.open("POST", "{{base_url}}/events/track");xhr.setRequestHeader("content-Type", "application/json");xhr.send(data);
import requestsurl = "{{base_url}}/events/track"payload = {"data": {"api_key": "9ed6bd6a23db7dd422893e167","mad_uuid": "4d3be7e9-0b87-41b9-94c7-b5da57cde234","user_id": "user_abc","url": "https://example-site.com/checkout-finished?orderId=378829558","referrer": "https://example-site.com","medium": "vue_x","source": "client_name","platform": "desktop","name": "orderConfirmation","action": "pageView","non_interaction": "true","metadata": {"account_id": "86a4c9b0-c27f-4a2d-ba7e-f53848da8894","region": "us-east-1","env": "prod","currency": "USD","page_type": "oc","order_id": "378829558","product_list": [{"price": "19","quantity": "1","product_id": "2019000100027007"},{"price": "99","quantity": "1","product_id": "2019000100022951"}]},"_journey_metadata": {"audience_id": "1","page_id": "1600","experience_id": "374","journey_id": "450"}}}headers = {"content-Type": "application/json"}response = requests.request("POST", url, headers=headers, data=payload)print(response.text)
require "uri"require "net/http"url = URI("{{base_url}}/events/track")http = Net::HTTP.new(url.host, url.port);request = Net::HTTP::Post.new(url)request["content-Type"] = "application/json"request.body = '{"data": {"api_key": "9ed6bd6a23db7dd422893e167","mad_uuid": "4d3be7e9-0b87-41b9-94c7-b5da57cde234","user_id": "user_abc","url": "https://example-site.com/checkout-finished?orderId=378829558","referrer": "https://example-site.com","medium": "vue_x","source": "client_name","platform": "desktop","name": "orderConfirmation","action": "pageView","non_interaction": "true","metadata": {"account_id": "86a4c9b0-c27f-4a2d-ba7e-f53848da8894","region": "us-east-1","env": "prod","currency": "USD","page_type": "oc","order_id": "378829558","product_list": [{"price": "19","quantity": "1","product_id": "2019000100027007"},{"price": "99","quantity": "1","product_id": "2019000100022951"}]},"_journey_metadata": {"audience_id": "1","page_id": "1600","experience_id": "374","journey_id": "450"}}}'response = http.request(request)puts response.read_body
curl --location -g --request POST '{{base_url}}/events/track'--header 'content-Type: application/json'--data-raw '{"data": {"api_key": "9ed6bd6a23db7dd422893e167","mad_uuid": "4d3be7e9-0b87-41b9-94c7-b5da57cde234","user_id": "user_abc","url": "https://example-site.com/checkout-finished?orderId=378829558","referrer": "https://example-site.com","medium": "vue_x","source": "client_name","platform": "desktop","name": "orderConfirmation","action": "pageView","non_interaction": "true","metadata": {"account_id": "86a4c9b0-c27f-4a2d-ba7e-f53848da8894","region": "us-east-1","env": "prod","currency": "USD","page_type": "oc","order_id": "378829558","product_list": [{"price": "19","quantity": "1","product_id": "2019000100027007"},{"price": "99","quantity": "1","product_id": "2019000100022951"}]},"_journey_metadata": {"audience_id": "1","page_id": "1600","experience_id": "374","journey_id": "450"}}}'
<?phprequire_once 'HTTP/Request2.php';$request = new HTTP_Request2();$request->setUrl('{{base_url}}/events/track');$request->setMethod(HTTP_Request2::METHOD_POST);$request->setConfig(array('follow_redirects' => TRUE));$request->setHeader(array('content-Type' => 'application/json'));$request->setBody('{"data": {"api_key": "9ed6bd6a23db7dd422893e167","mad_uuid": "4d3be7e9-0b87-41b9-94c7-b5da57cde234","user_id": "user_abc","url": "https://example-site.com/checkout-finished?orderId=378829558","referrer": "https://example-site.com","medium": "vue_x","source": "client_name","platform": "desktop","name": "orderConfirmation","action": "pageView","non_interaction": "true","metadata": {"account_id": "86a4c9b0-c27f-4a2d-ba7e-f53848da8894","region": "us-east-1","env": "prod","currency": "USD","page_type": "oc","order_id": "378829558","product_list": [{"price": "19","quantity": "1","product_id": "2019000100027007"},{"price": "99","quantity": "1","product_id": "2019000100022951"}]},"_journey_metadata": {"audience_id": "1","page_id": "1600","experience_id": "374","journey_id": "450"}}}');try {$response = $request->send();if ($response->getStatus() == 200) {echo $response->getBody();}else {echo 'Unexpected HTTP status: ' . $response->getStatus() . ' ' .$response->getReasonPhrase();}}catch(HTTP_Request2_Exception $e) {echo 'Error: ' . $e->getMessage();}
OkHttpClient client = new OkHttpClient().newBuilder().build();MediaType mediaType = MediaType.parse("text/plain");RequestBody body = RequestBody.create(mediaType, "{"data": {"api_key": "9ed6bd6a23db7dd422893e167","mad_uuid": "4d3be7e9-0b87-41b9-94c7-b5da57cde234","user_id": "user_abc","url": "https://example-site.com/checkout-finished?orderId=378829558","referrer": "https://example-site.com","medium": "vue_x","source": "client_name","platform": "desktop","name": "orderConfirmation","action": "pageView","non_interaction": "true","metadata": {"account_id": "86a4c9b0-c27f-4a2d-ba7e-f53848da8894","region": "us-east-1","env": "prod","currency": "USD","page_type": "oc","order_id": "378829558","product_list": [{"price": "19","quantity": "1","product_id": "2019000100027007"},{"price": "99","quantity": "1","product_id": "2019000100022951"}]},"_journey_metadata": {"audience_id": "1","page_id": "1600","experience_id": "374","journey_id": "450"}}}");Request request = new Request.Builder().url("{{base_url}}/events/track").method("POST", body).addHeader("content-Type", "application/json").build();Response response = client.newCall(request).execute();
var client = new RestClient("{{base_url}}/events/track");client.Timeout = -1;var request = new RestRequest(Method.POST);request.AddHeader("content-Type", "application/json")request.AddParameter("text/plain", '{"data": {"api_key": "9ed6bd6a23db7dd422893e167","mad_uuid": "4d3be7e9-0b87-41b9-94c7-b5da57cde234","user_id": "user_abc","url": "https://example-site.com/checkout-finished?orderId=378829558","referrer": "https://example-site.com","medium": "vue_x","source": "client_name","platform": "desktop","name": "orderConfirmation","action": "pageView","non_interaction": "true","metadata": {"account_id": "86a4c9b0-c27f-4a2d-ba7e-f53848da8894","region": "us-east-1","env": "prod","currency": "USD","page_type": "oc","order_id": "378829558","product_list": [{"price": "19","quantity": "1","product_id": "2019000100027007"},{"price": "99","quantity": "1","product_id": "2019000100022951"}]},"_journey_metadata": {"audience_id": "1","page_id": "1600","experience_id": "374","journey_id": "450"}}}', ParameterType.RequestBody);IRestResponse response = client.Execute(request);Console.WriteLine(response.Content);
#
Example 5 - Recommendation View Event from a Product Description Page- JavaScript
- Python
- Ruby
- cURL
- PHP
- Java
- C#
var data = {"data": {"api_key": "9ed6bd6a23db7dd422893e167","mad_uuid": "2921651f-8ed9-4480-8c40-1021ddb38cdf","user_id": "user_abc","url": "https://example-site.com/product/beige-fanny-pack-33941","referrer": "","medium": "vue_x","source": "client_name","platform": "desktop","name": "recommendationView","action": "pageView","non_interaction": "true","metadata": {"account_id": "c17c8af3-e92f-42e7-ba3a-5b316bc14690","region": "us-east-1","env": "prod","currency": "USD","page_type": "pdp","product_list": [{"product_id": "2019000100030423","price": "79.00"}],"module_id": "1645","module_name": "Similar Module","module_behaviour": "inline","template_type": "simple-carousel","recos_served": 16},"_journey_metadata": {"audience_id": "1","page_id": "2132","experience_id": "1719","journey_id": "855"}}};var xhr = new XMLHttpRequest();xhr.withCredentials = true;xhr.addEventListener("readystatechange", function() {if(this.readyState === 4) {console.log(this.responseText);}});xhr.open("POST", "{{base_url}}/events/track");xhr.setRequestHeader("content-Type", "application/json");xhr.send(data);
import requestsurl = "{{base_url}}/events/track"payload = {"data": {"api_key": "9ed6bd6a23db7dd422893e167","mad_uuid": "2921651f-8ed9-4480-8c40-1021ddb38cdf","user_id": "user_abc","url": "https://example-site.com/product/beige-fanny-pack-33941","referrer": "","medium": "vue_x","source": "client_name","platform": "desktop","name": "recommendationView","action": "pageView","non_interaction": "true","metadata": {"account_id": "c17c8af3-e92f-42e7-ba3a-5b316bc14690","region": "us-east-1","env": "prod","currency": "USD","page_type": "pdp","product_list": [{"product_id": "2019000100030423","price": "79.00"}],"module_id": "1645","module_name": "Similar Module","module_behaviour": "inline","template_type": "simple-carousel","recos_served": 16},"_journey_metadata": {"audience_id": "1","page_id": "2132","experience_id": "1719","journey_id": "855"}}}headers = {"content-Type": "application/json"}response = requests.request("POST", url, headers=headers, data=payload)print(response.text)
require "uri"require "net/http"url = URI("{{base_url}}/events/track")http = Net::HTTP.new(url.host, url.port);request = Net::HTTP::Post.new(url)request["content-Type"] = "application/json"request.body = '{"data": {"api_key": "9ed6bd6a23db7dd422893e167","mad_uuid": "2921651f-8ed9-4480-8c40-1021ddb38cdf","user_id": "user_abc","url": "https://example-site.com/product/beige-fanny-pack-33941","referrer": "","medium": "vue_x","source": "client_name","platform": "desktop","name": "recommendationView","action": "pageView","non_interaction": "true","metadata": {"account_id": "c17c8af3-e92f-42e7-ba3a-5b316bc14690","region": "us-east-1","env": "prod","currency": "USD","page_type": "pdp","product_list": [{"product_id": "2019000100030423","price": "79.00"}],"module_id": "1645","module_name": "Similar Module","module_behaviour": "inline","template_type": "simple-carousel","recos_served": 16},"_journey_metadata": {"audience_id": "1","page_id": "2132","experience_id": "1719","journey_id": "855"}}}'response = http.request(request)puts response.read_body
curl --location -g --request POST '{{base_url}}/events/track'--header 'content-Type: application/json'--data-raw '{"data": {"api_key": "9ed6bd6a23db7dd422893e167","mad_uuid": "2921651f-8ed9-4480-8c40-1021ddb38cdf","user_id": "user_abc","url": "https://example-site.com/product/beige-fanny-pack-33941","referrer": "","medium": "vue_x","source": "client_name","platform": "desktop","name": "recommendationView","action": "pageView","non_interaction": "true","metadata": {"account_id": "c17c8af3-e92f-42e7-ba3a-5b316bc14690","region": "us-east-1","env": "prod","currency": "USD","page_type": "pdp","product_list": [{"product_id": "2019000100030423","price": "79.00"}],"module_id": "1645","module_name": "Similar Module","module_behaviour": "inline","template_type": "simple-carousel","recos_served": 16},"_journey_metadata": {"audience_id": "1","page_id": "2132","experience_id": "1719","journey_id": "855"}}}'
<?phprequire_once 'HTTP/Request2.php';$request = new HTTP_Request2();$request->setUrl('{{base_url}}/events/track');$request->setMethod(HTTP_Request2::METHOD_POST);$request->setConfig(array('follow_redirects' => TRUE));$request->setHeader(array('content-Type' => 'application/json'));$request->setBody('{"data": {"api_key": "9ed6bd6a23db7dd422893e167","mad_uuid": "2921651f-8ed9-4480-8c40-1021ddb38cdf","user_id": "user_abc","url": "https://example-site.com/product/beige-fanny-pack-33941","referrer": "","medium": "vue_x","source": "client_name","platform": "desktop","name": "recommendationView","action": "pageView","non_interaction": "true","metadata": {"account_id": "c17c8af3-e92f-42e7-ba3a-5b316bc14690","region": "us-east-1","env": "prod","currency": "USD","page_type": "pdp","product_list": [{"product_id": "2019000100030423","price": "79.00"}],"module_id": "1645","module_name": "Similar Module","module_behaviour": "inline","template_type": "simple-carousel","recos_served": 16},"_journey_metadata": {"audience_id": "1","page_id": "2132","experience_id": "1719","journey_id": "855"}}}');try {$response = $request->send();if ($response->getStatus() == 200) {echo $response->getBody();}else {echo 'Unexpected HTTP status: ' . $response->getStatus() . ' ' .$response->getReasonPhrase();}}catch(HTTP_Request2_Exception $e) {echo 'Error: ' . $e->getMessage();}
OkHttpClient client = new OkHttpClient().newBuilder().build();MediaType mediaType = MediaType.parse("text/plain");RequestBody body = RequestBody.create(mediaType, "{"data": {"api_key": "9ed6bd6a23db7dd422893e167","mad_uuid": "2921651f-8ed9-4480-8c40-1021ddb38cdf","user_id": "user_abc","url": "https://example-site.com/product/beige-fanny-pack-33941","referrer": "","medium": "vue_x","source": "client_name","platform": "desktop","name": "recommendationView","action": "pageView","non_interaction": "true","metadata": {"account_id": "c17c8af3-e92f-42e7-ba3a-5b316bc14690","region": "us-east-1","env": "prod","currency": "USD","page_type": "pdp","product_list": [{"product_id": "2019000100030423","price": "79.00"}],"module_id": "1645","module_name": "Similar Module","module_behaviour": "inline","template_type": "simple-carousel","recos_served": 16},"_journey_metadata": {"audience_id": "1","page_id": "2132","experience_id": "1719","journey_id": "855"}}}");Request request = new Request.Builder().url("{{base_url}}/events/track").method("POST", body).addHeader("content-Type", "application/json").build();Response response = client.newCall(request).execute();
var client = new RestClient("{{base_url}}/events/track");client.Timeout = -1;var request = new RestRequest(Method.POST);request.AddHeader("content-Type", "application/json")request.AddParameter("text/plain", '{"data": {"api_key": "9ed6bd6a23db7dd422893e167","mad_uuid": "2921651f-8ed9-4480-8c40-1021ddb38cdf","user_id": "user_abc","url": "https://example-site.com/product/beige-fanny-pack-33941","referrer": "","medium": "vue_x","source": "client_name","platform": "desktop","name": "recommendationView","action": "pageView","non_interaction": "true","metadata": {"account_id": "c17c8af3-e92f-42e7-ba3a-5b316bc14690","region": "us-east-1","env": "prod","currency": "USD","page_type": "pdp","product_list": [{"product_id": "2019000100030423","price": "79.00"}],"module_id": "1645","module_name": "Similar Module","module_behaviour": "inline","template_type": "simple-carousel","recos_served": 16},"_journey_metadata": {"audience_id": "1","page_id": "2132","experience_id": "1719","journey_id": "855"}}}', ParameterType.RequestBody);IRestResponse response = client.Execute(request);Console.WriteLine(response.Content);
#
Example 6 - Recommended Product View from a Product Description Page- JavaScript
- Python
- Ruby
- cURL
- PHP
- Java
- C#
var data = {"data": {"api_key": "9ed6bd6a23db7dd422893e167","mad_uuid": "2921651f-8ed9-4480-8c40-1021ddb38c90","user_id": "user_abc","url": "https://example-site.com/product/beige-fanny-pack-33941","referrer": "","medium": "vue_x","source": "client_name","platform": "desktop","name": "recommendedProductView","action": "click","non_interaction": "false","metadata": {"account_id": "c17c8af3-e92f-42e7-ba3a-5b316bc14589","region": "us-east-1","env": "prod","currency": "USD","page_type": "pdp","product_list": [{"product_id": "2018000100019623","price": 39}],"module_id": "1645","module_name": "Similar Module","template_type": "simple-carousel","module_behaviour": "inline","strategy_id": "1578","referrer_product": {"product_id": "2019000100030423"},"pos_of_reco": 1},"_journey_metadata": {"audience_id": "1","page_id": "2132","experience_id": "1719","journey_id": "855"}}};var xhr = new XMLHttpRequest();xhr.withCredentials = true;xhr.addEventListener("readystatechange", function() {if(this.readyState === 4) {console.log(this.responseText);}});xhr.open("POST", "{{base_url}}/events/track");xhr.setRequestHeader("content-Type", "application/json");xhr.send(data);
import requestsurl = "{{base_url}}/events/track"payload = {"data": {"api_key": "9ed6bd6a23db7dd422893e167","mad_uuid": "2921651f-8ed9-4480-8c40-1021ddb38c90","user_id": "user_abc","url": "https://example-site.com/product/beige-fanny-pack-33941","referrer": "","medium": "vue_x","source": "client_name","platform": "desktop","name": "recommendedProductView","action": "click","non_interaction": "false","metadata": {"account_id": "c17c8af3-e92f-42e7-ba3a-5b316bc14589","region": "us-east-1","env": "prod","currency": "USD","page_type": "pdp","product_list": [{"product_id": "2018000100019623","price": 39}],"module_id": "1645","module_name": "Similar Module","template_type": "simple-carousel","module_behaviour": "inline","strategy_id": "1578","referrer_product": {"product_id": "2019000100030423"},"pos_of_reco": 1},"_journey_metadata": {"audience_id": "1","page_id": "2132","experience_id": "1719","journey_id": "855"}}}headers = {"content-Type": "application/json"}response = requests.request("POST", url, headers=headers, data=payload)print(response.text)
require "uri"require "net/http"url = URI("{{base_url}}/events/track")http = Net::HTTP.new(url.host, url.port);request = Net::HTTP::Post.new(url)request["content-Type"] = "application/json"request.body = '{"data": {"api_key": "9ed6bd6a23db7dd422893e167","mad_uuid": "2921651f-8ed9-4480-8c40-1021ddb38c90","user_id": "user_abc","url": "https://example-site.com/product/beige-fanny-pack-33941","referrer": "","medium": "vue_x","source": "client_name","platform": "desktop","name": "recommendedProductView","action": "click","non_interaction": "false","metadata": {"account_id": "c17c8af3-e92f-42e7-ba3a-5b316bc14589","region": "us-east-1","env": "prod","currency": "USD","page_type": "pdp","product_list": [{"product_id": "2018000100019623","price": 39}],"module_id": "1645","module_name": "Similar Module","template_type": "simple-carousel","module_behaviour": "inline","strategy_id": "1578","referrer_product": {"product_id": "2019000100030423"},"pos_of_reco": 1},"_journey_metadata": {"audience_id": "1","page_id": "2132","experience_id": "1719","journey_id": "855"}}}'response = http.request(request)puts response.read_body
curl --location -g --request POST '{{base_url}}/events/track'--header 'content-Type: application/json'--data-raw '{"data": {"api_key": "9ed6bd6a23db7dd422893e167","mad_uuid": "2921651f-8ed9-4480-8c40-1021ddb38c90","user_id": "user_abc","url": "https://example-site.com/product/beige-fanny-pack-33941","referrer": "","medium": "vue_x","source": "client_name","platform": "desktop","name": "recommendedProductView","action": "click","non_interaction": "false","metadata": {"account_id": "c17c8af3-e92f-42e7-ba3a-5b316bc14589","region": "us-east-1","env": "prod","currency": "USD","page_type": "pdp","product_list": [{"product_id": "2018000100019623","price": 39}],"module_id": "1645","module_name": "Similar Module","template_type": "simple-carousel","module_behaviour": "inline","strategy_id": "1578","referrer_product": {"product_id": "2019000100030423"},"pos_of_reco": 1},"_journey_metadata": {"audience_id": "1","page_id": "2132","experience_id": "1719","journey_id": "855"}}}'
<?phprequire_once 'HTTP/Request2.php';$request = new HTTP_Request2();$request->setUrl('{{base_url}}/events/track');$request->setMethod(HTTP_Request2::METHOD_POST);$request->setConfig(array('follow_redirects' => TRUE));$request->setHeader(array('content-Type' => 'application/json'));$request->setBody('{"data": {"api_key": "9ed6bd6a23db7dd422893e167","mad_uuid": "2921651f-8ed9-4480-8c40-1021ddb38c90","user_id": "user_abc","url": "https://example-site.com/product/beige-fanny-pack-33941","referrer": "","medium": "vue_x","source": "client_name","platform": "desktop","name": "recommendedProductView","action": "click","non_interaction": "false","metadata": {"account_id": "c17c8af3-e92f-42e7-ba3a-5b316bc14589","region": "us-east-1","env": "prod","currency": "USD","page_type": "pdp","product_list": [{"product_id": "2018000100019623","price": 39}],"module_id": "1645","module_name": "Similar Module","template_type": "simple-carousel","module_behaviour": "inline","strategy_id": "1578","referrer_product": {"product_id": "2019000100030423"},"pos_of_reco": 1},"_journey_metadata": {"audience_id": "1","page_id": "2132","experience_id": "1719","journey_id": "855"}}}');try {$response = $request->send();if ($response->getStatus() == 200) {echo $response->getBody();}else {echo 'Unexpected HTTP status: ' . $response->getStatus() . ' ' .$response->getReasonPhrase();}}catch(HTTP_Request2_Exception $e) {echo 'Error: ' . $e->getMessage();}
OkHttpClient client = new OkHttpClient().newBuilder().build();MediaType mediaType = MediaType.parse("text/plain");RequestBody body = RequestBody.create(mediaType, "{"data": {"api_key": "9ed6bd6a23db7dd422893e167","mad_uuid": "2921651f-8ed9-4480-8c40-1021ddb38c90","user_id": "user_abc","url": "https://example-site.com/product/beige-fanny-pack-33941","referrer": "","medium": "vue_x","source": "client_name","platform": "desktop","name": "recommendedProductView","action": "click","non_interaction": "false","metadata": {"account_id": "c17c8af3-e92f-42e7-ba3a-5b316bc14589","region": "us-east-1","env": "prod","currency": "USD","page_type": "pdp","product_list": [{"product_id": "2018000100019623","price": 39}],"module_id": "1645","module_name": "Similar Module","template_type": "simple-carousel","module_behaviour": "inline","strategy_id": "1578","referrer_product": {"product_id": "2019000100030423"},"pos_of_reco": 1},"_journey_metadata": {"audience_id": "1","page_id": "2132","experience_id": "1719","journey_id": "855"}}}");Request request = new Request.Builder().url("{{base_url}}/events/track").method("POST", body).addHeader("content-Type", "application/json").build();Response response = client.newCall(request).execute();
var client = new RestClient("{{base_url}}/events/track");client.Timeout = -1;var request = new RestRequest(Method.POST);request.AddHeader("content-Type", "application/json")request.AddParameter("text/plain", '{"data": {"api_key": "9ed6bd6a23db7dd422893e167","mad_uuid": "2921651f-8ed9-4480-8c40-1021ddb38c90","user_id": "user_abc","url": "https://example-site.com/product/beige-fanny-pack-33941","referrer": "","medium": "vue_x","source": "client_name","platform": "desktop","name": "recommendedProductView","action": "click","non_interaction": "false","metadata": {"account_id": "c17c8af3-e92f-42e7-ba3a-5b316bc14589","region": "us-east-1","env": "prod","currency": "USD","page_type": "pdp","product_list": [{"product_id": "2018000100019623","price": 39}],"module_id": "1645","module_name": "Similar Module","template_type": "simple-carousel","module_behaviour": "inline","strategy_id": "1578","referrer_product": {"product_id": "2019000100030423"},"pos_of_reco": 1},"_journey_metadata": {"audience_id": "1","page_id": "2132","experience_id": "1719","journey_id": "855"}}}', ParameterType.RequestBody);IRestResponse response = client.Execute(request);Console.WriteLine(response.Content);
#
Example 7 - Swipe Event from a Carousel on Product Description Page- JavaScript
- Python
- Ruby
- cURL
- PHP
- Java
- C#
var data = {"data": {"api_key": "9ed6bd6a23db7dd422893e167","mad_uuid": "2921651f-8ed9-4480-8c40-1021ddb38cb7","user_id": "user_abc","url": "https://example-site.com/product/blue-geometric-print-bohemian-a-line-dress-39848","referrer": "https://example-site.com/shop/dresses-12","medium": "vue_x","source": "client_name","platform": "desktop","name": "rightSwipe","action": "click","non_interaction": "false","metadata": {"account_id": "c17c8af3-e92f-42e7-ba3a-5b316bc14390","region": "us-east-1","env": "prod","currency": "USD","page_type": "pdp","product_list": [{"product_id": "2021000100037146","price": "39.00"}],"module_id": "1645","module_name": "Similar Module","template_type": "simple-carousel","module_behaviour": "inline"},"_journey_metadata": {"page_id": "2132","journey_id": "855","experience_id": "1719","audience_id": "1"}}};var xhr = new XMLHttpRequest();xhr.withCredentials = true;xhr.addEventListener("readystatechange", function() {if(this.readyState === 4) {console.log(this.responseText);}});xhr.open("POST", "{{base_url}}/events/track");xhr.setRequestHeader("content-Type", "application/json");xhr.send(data);
import requestsurl = "{{base_url}}/events/track"payload = {"data": {"api_key": "9ed6bd6a23db7dd422893e167","mad_uuid": "2921651f-8ed9-4480-8c40-1021ddb38cb7","user_id": "user_abc","url": "https://example-site.com/product/blue-geometric-print-bohemian-a-line-dress-39848","referrer": "https://example-site.com/shop/dresses-12","medium": "vue_x","source": "client_name","platform": "desktop","name": "rightSwipe","action": "click","non_interaction": "false","metadata": {"account_id": "c17c8af3-e92f-42e7-ba3a-5b316bc14390","region": "us-east-1","env": "prod","currency": "USD","page_type": "pdp","product_list": [{"product_id": "2021000100037146","price": "39.00"}],"module_id": "1645","module_name": "Similar Module","template_type": "simple-carousel","module_behaviour": "inline"},"_journey_metadata": {"page_id": "2132","journey_id": "855","experience_id": "1719","audience_id": "1"}}}headers = {"content-Type": "application/json"}response = requests.request("POST", url, headers=headers, data=payload)print(response.text)
require "uri"require "net/http"url = URI("{{base_url}}/events/track")http = Net::HTTP.new(url.host, url.port);request = Net::HTTP::Post.new(url)request["content-Type"] = "application/json"request.body = '{"data": {"api_key": "9ed6bd6a23db7dd422893e167","mad_uuid": "2921651f-8ed9-4480-8c40-1021ddb38cb7","user_id": "user_abc","url": "https://example-site.com/product/blue-geometric-print-bohemian-a-line-dress-39848","referrer": "https://example-site.com/shop/dresses-12","medium": "vue_x","source": "client_name","platform": "desktop","name": "rightSwipe","action": "click","non_interaction": "false","metadata": {"account_id": "c17c8af3-e92f-42e7-ba3a-5b316bc14390","region": "us-east-1","env": "prod","currency": "USD","page_type": "pdp","product_list": [{"product_id": "2021000100037146","price": "39.00"}],"module_id": "1645","module_name": "Similar Module","template_type": "simple-carousel","module_behaviour": "inline"},"_journey_metadata": {"page_id": "2132","journey_id": "855","experience_id": "1719","audience_id": "1"}}}'response = http.request(request)puts response.read_body
curl --location -g --request POST '{{base_url}}/events/track'--header 'content-Type: application/json'--data-raw '{"data": {"api_key": "9ed6bd6a23db7dd422893e167","mad_uuid": "2921651f-8ed9-4480-8c40-1021ddb38cb7","user_id": "user_abc","url": "https://example-site.com/product/blue-geometric-print-bohemian-a-line-dress-39848","referrer": "https://example-site.com/shop/dresses-12","medium": "vue_x","source": "client_name","platform": "desktop","name": "rightSwipe","action": "click","non_interaction": "false","metadata": {"account_id": "c17c8af3-e92f-42e7-ba3a-5b316bc14390","region": "us-east-1","env": "prod","currency": "USD","page_type": "pdp","product_list": [{"product_id": "2021000100037146","price": "39.00"}],"module_id": "1645","module_name": "Similar Module","template_type": "simple-carousel","module_behaviour": "inline"},"_journey_metadata": {"page_id": "2132","journey_id": "855","experience_id": "1719","audience_id": "1"}}}'
<?phprequire_once 'HTTP/Request2.php';$request = new HTTP_Request2();$request->setUrl('{{base_url}}/events/track');$request->setMethod(HTTP_Request2::METHOD_POST);$request->setConfig(array('follow_redirects' => TRUE));$request->setHeader(array('content-Type' => 'application/json'));$request->setBody('{"data": {"api_key": "9ed6bd6a23db7dd422893e167","mad_uuid": "2921651f-8ed9-4480-8c40-1021ddb38cb7","user_id": "user_abc","url": "https://example-site.com/product/blue-geometric-print-bohemian-a-line-dress-39848","referrer": "https://example-site.com/shop/dresses-12","medium": "vue_x","source": "client_name","platform": "desktop","name": "rightSwipe","action": "click","non_interaction": "false","metadata": {"account_id": "c17c8af3-e92f-42e7-ba3a-5b316bc14390","region": "us-east-1","env": "prod","currency": "USD","page_type": "pdp","product_list": [{"product_id": "2021000100037146","price": "39.00"}],"module_id": "1645","module_name": "Similar Module","template_type": "simple-carousel","module_behaviour": "inline"},"_journey_metadata": {"page_id": "2132","journey_id": "855","experience_id": "1719","audience_id": "1"}}}');try {$response = $request->send();if ($response->getStatus() == 200) {echo $response->getBody();}else {echo 'Unexpected HTTP status: ' . $response->getStatus() . ' ' .$response->getReasonPhrase();}}catch(HTTP_Request2_Exception $e) {echo 'Error: ' . $e->getMessage();}
OkHttpClient client = new OkHttpClient().newBuilder().build();MediaType mediaType = MediaType.parse("text/plain");RequestBody body = RequestBody.create(mediaType, "{"data": {"api_key": "9ed6bd6a23db7dd422893e167","mad_uuid": "2921651f-8ed9-4480-8c40-1021ddb38cb7","user_id": "user_abc","url": "https://example-site.com/product/blue-geometric-print-bohemian-a-line-dress-39848","referrer": "https://example-site.com/shop/dresses-12","medium": "vue_x","source": "client_name","platform": "desktop","name": "rightSwipe","action": "click","non_interaction": "false","metadata": {"account_id": "c17c8af3-e92f-42e7-ba3a-5b316bc14390","region": "us-east-1","env": "prod","currency": "USD","page_type": "pdp","product_list": [{"product_id": "2021000100037146","price": "39.00"}],"module_id": "1645","module_name": "Similar Module","template_type": "simple-carousel","module_behaviour": "inline"},"_journey_metadata": {"page_id": "2132","journey_id": "855","experience_id": "1719","audience_id": "1"}}}");Request request = new Request.Builder().url("{{base_url}}/events/track").method("POST", body).addHeader("content-Type", "application/json").build();Response response = client.newCall(request).execute();
var client = new RestClient("{{base_url}}/events/track");client.Timeout = -1;var request = new RestRequest(Method.POST);request.AddHeader("content-Type", "application/json")request.AddParameter("text/plain", '{"data": {"api_key": "9ed6bd6a23db7dd422893e167","mad_uuid": "2921651f-8ed9-4480-8c40-1021ddb38cb7","user_id": "user_abc","url": "https://example-site.com/product/blue-geometric-print-bohemian-a-line-dress-39848","referrer": "https://example-site.com/shop/dresses-12","medium": "vue_x","source": "client_name","platform": "desktop","name": "rightSwipe","action": "click","non_interaction": "false","metadata": {"account_id": "c17c8af3-e92f-42e7-ba3a-5b316bc14390","region": "us-east-1","env": "prod","currency": "USD","page_type": "pdp","product_list": [{"product_id": "2021000100037146","price": "39.00"}],"module_id": "1645","module_name": "Similar Module","template_type": "simple-carousel","module_behaviour": "inline"},"_journey_metadata": {"page_id": "2132","journey_id": "855","experience_id": "1719","audience_id": "1"}}}', ParameterType.RequestBody);IRestResponse response = client.Execute(request);Console.WriteLine(response.Content);
#
Example 8 - Page View Event from a Personalized Search/Listing Page- JavaScript
- Python
- Ruby
- cURL
- PHP
- Java
- C#
var data = {"data": {"api_key": "9ed6bd6a23db7dd422893e156","mad_uuid": "2921651f-8ed9-4480-8c40-1021ddb38fc6","user_id": "user_abc","url": "https://example-site.com/collections/shoes","referrer": "https://example-site.com","medium": "vue_x","source": "client_name","platform": "desktop","name": "pageView","action": "pageView","non_interaction": "true","metadata": {"account_id": "c17c8af3-e92f-42e7-ba3a-5b316bc14679","region": "us-east-1","env": "prod","currency": "USD","category": "Dresses","order_by": {"field": "relevance","order": "desc"},"filters": [{"field": "available","type": "exact","value": "true"}],"page_type": "cat"},"_journey_metadata": {"audience_id": "1","page_id": "2132","experience_id": "1719","journey_id": "855"}}};var xhr = new XMLHttpRequest();xhr.withCredentials = true;xhr.addEventListener("readystatechange", function() {if(this.readyState === 4) {console.log(this.responseText);}});xhr.open("POST", "{{base_url}}/events/track");xhr.setRequestHeader("content-Type", "application/json");xhr.send(data);
import requestsurl = "{{base_url}}/events/track"payload = {"data": {"api_key": "9ed6bd6a23db7dd422893e156","mad_uuid": "2921651f-8ed9-4480-8c40-1021ddb38fc6","user_id": "user_abc","url": "https://example-site.com/collections/shoes","referrer": "https://example-site.com","medium": "vue_x","source": "client_name","platform": "desktop","name": "pageView","action": "pageView","non_interaction": "true","metadata": {"account_id": "c17c8af3-e92f-42e7-ba3a-5b316bc14679","region": "us-east-1","env": "prod","currency": "USD","category": "Dresses","order_by": {"field": "relevance","order": "desc"},"filters": [{"field": "available","type": "exact","value": "true"}],"page_type": "cat"},"_journey_metadata": {"audience_id": "1","page_id": "2132","experience_id": "1719","journey_id": "855"}}}headers = {"content-Type": "application/json"}response = requests.request("POST", url, headers=headers, data=payload)print(response.text)
require "uri"require "net/http"url = URI("{{base_url}}/events/track")http = Net::HTTP.new(url.host, url.port);request = Net::HTTP::Post.new(url)request["content-Type"] = "application/json"request.body = '{"data": {"api_key": "9ed6bd6a23db7dd422893e156","mad_uuid": "2921651f-8ed9-4480-8c40-1021ddb38fc6","user_id": "user_abc","url": "https://example-site.com/collections/shoes","referrer": "https://example-site.com","medium": "vue_x","source": "client_name","platform": "desktop","name": "pageView","action": "pageView","non_interaction": "true","metadata": {"account_id": "c17c8af3-e92f-42e7-ba3a-5b316bc14679","region": "us-east-1","env": "prod","currency": "USD","category": "Dresses","order_by": {"field": "relevance","order": "desc"},"filters": [{"field": "available","type": "exact","value": "true"}],"page_type": "cat"},"_journey_metadata": {"audience_id": "1","page_id": "2132","experience_id": "1719","journey_id": "855"}}}'response = http.request(request)puts response.read_body
curl --location -g --request POST '{{base_url}}/events/track'--header 'content-Type: application/json'--data-raw '{"data": {"api_key": "9ed6bd6a23db7dd422893e156","mad_uuid": "2921651f-8ed9-4480-8c40-1021ddb38fc6","user_id": "user_abc","url": "https://example-site.com/collections/shoes","referrer": "https://example-site.com","medium": "vue_x","source": "client_name","platform": "desktop","name": "pageView","action": "pageView","non_interaction": "true","metadata": {"account_id": "c17c8af3-e92f-42e7-ba3a-5b316bc14679","region": "us-east-1","env": "prod","currency": "USD","category": "Dresses","order_by": {"field": "relevance","order": "desc"},"filters": [{"field": "available","type": "exact","value": "true"}],"page_type": "cat"},"_journey_metadata": {"audience_id": "1","page_id": "2132","experience_id": "1719","journey_id": "855"}}}'
<?phprequire_once 'HTTP/Request2.php';$request = new HTTP_Request2();$request->setUrl('{{base_url}}/events/track');$request->setMethod(HTTP_Request2::METHOD_POST);$request->setConfig(array('follow_redirects' => TRUE));$request->setHeader(array('content-Type' => 'application/json'));$request->setBody('{"data": {"api_key": "9ed6bd6a23db7dd422893e156","mad_uuid": "2921651f-8ed9-4480-8c40-1021ddb38fc6","user_id": "user_abc","url": "https://example-site.com/collections/shoes","referrer": "https://example-site.com","medium": "vue_x","source": "client_name","platform": "desktop","name": "pageView","action": "pageView","non_interaction": "true","metadata": {"account_id": "c17c8af3-e92f-42e7-ba3a-5b316bc14679","region": "us-east-1","env": "prod","currency": "USD","category": "Dresses","order_by": {"field": "relevance","order": "desc"},"filters": [{"field": "available","type": "exact","value": "true"}],"page_type": "cat"},"_journey_metadata": {"audience_id": "1","page_id": "2132","experience_id": "1719","journey_id": "855"}}}');try {$response = $request->send();if ($response->getStatus() == 200) {echo $response->getBody();}else {echo 'Unexpected HTTP status: ' . $response->getStatus() . ' ' .$response->getReasonPhrase();}}catch(HTTP_Request2_Exception $e) {echo 'Error: ' . $e->getMessage();}
OkHttpClient client = new OkHttpClient().newBuilder().build();MediaType mediaType = MediaType.parse("text/plain");RequestBody body = RequestBody.create(mediaType, "{"data": {"api_key": "9ed6bd6a23db7dd422893e156","mad_uuid": "2921651f-8ed9-4480-8c40-1021ddb38fc6","user_id": "user_abc","url": "https://example-site.com/collections/shoes","referrer": "https://example-site.com","medium": "vue_x","source": "client_name","platform": "desktop","name": "pageView","action": "pageView","non_interaction": "true","metadata": {"account_id": "c17c8af3-e92f-42e7-ba3a-5b316bc14679","region": "us-east-1","env": "prod","currency": "USD","category": "Dresses","order_by": {"field": "relevance","order": "desc"},"filters": [{"field": "available","type": "exact","value": "true"}],"page_type": "cat"},"_journey_metadata": {"audience_id": "1","page_id": "2132","experience_id": "1719","journey_id": "855"}}}");Request request = new Request.Builder().url("{{base_url}}/events/track").method("POST", body).addHeader("content-Type", "application/json").build();Response response = client.newCall(request).execute();
var client = new RestClient("{{base_url}}/events/track");client.Timeout = -1;var request = new RestRequest(Method.POST);request.AddHeader("content-Type", "application/json")request.AddParameter("text/plain", '{"data": {"api_key": "9ed6bd6a23db7dd422893e156","mad_uuid": "2921651f-8ed9-4480-8c40-1021ddb38fc6","user_id": "user_abc","url": "https://example-site.com/collections/shoes","referrer": "https://example-site.com","medium": "vue_x","source": "client_name","platform": "desktop","name": "pageView","action": "pageView","non_interaction": "true","metadata": {"account_id": "c17c8af3-e92f-42e7-ba3a-5b316bc14679","region": "us-east-1","env": "prod","currency": "USD","category": "Dresses","order_by": {"field": "relevance","order": "desc"},"filters": [{"field": "available","type": "exact","value": "true"}],"page_type": "cat"},"_journey_metadata": {"audience_id": "1","page_id": "2132","experience_id": "1719","journey_id": "855"}}}', ParameterType.RequestBody);IRestResponse response = client.Execute(request);Console.WriteLine(response.Content);
#
Example 9 - Recommendation View Event from a Personalized Search/Listing Page- JavaScript
- Python
- Ruby
- cURL
- PHP
- Java
- C#
var data = {"data": {"api_key": "9ed6bd6a23db7dd422893e156","mad_uuid": "2921651f-8ed9-4480-8c40-1021ddb38fc6","user_id": "user_abc","url": "https://example-site.com/collections/shoes","referrer": "https://example-site.com","medium": "vue_x","source": "client_name","platform": "desktop","name": "recommendationView","action": "pageView","non_interaction": "true","metadata": {"account_id": "c17c8af3-e92f-42e7-ba3a-5b316bc14679","region": "us-east-1","env": "prod","currency": "USD","category": "Dresses","order_by": {"field": "relevance","order": "desc"},"filters": [{"field": "available","type": "exact","value": "true"}],"page_type": "cat","module_id": "1645","module_name": "Personalized Listing","module_behaviour": "inline","template_type": "simple-grid","recos_served": 50},"_journey_metadata": {"audience_id": "1","page_id": "2132","experience_id": "1719","journey_id": "855"}}};var xhr = new XMLHttpRequest();xhr.withCredentials = true;xhr.addEventListener("readystatechange", function() {if(this.readyState === 4) {console.log(this.responseText);}});xhr.open("POST", "{{base_url}}/events/track");xhr.setRequestHeader("content-Type", "application/json");xhr.send(data);
import requestsurl = "{{base_url}}/events/track"payload = {"data": {"api_key": "9ed6bd6a23db7dd422893e156","mad_uuid": "2921651f-8ed9-4480-8c40-1021ddb38fc6","user_id": "user_abc","url": "https://example-site.com/collections/shoes","referrer": "https://example-site.com","medium": "vue_x","source": "client_name","platform": "desktop","name": "recommendationView","action": "pageView","non_interaction": "true","metadata": {"account_id": "c17c8af3-e92f-42e7-ba3a-5b316bc14679","region": "us-east-1","env": "prod","currency": "USD","category": "Dresses","order_by": {"field": "relevance","order": "desc"},"filters": [{"field": "available","type": "exact","value": "true"}],"page_type": "cat","module_id": "1645","module_name": "Personalized Listing","module_behaviour": "inline","template_type": "simple-grid","recos_served": 50},"_journey_metadata": {"audience_id": "1","page_id": "2132","experience_id": "1719","journey_id": "855"}}}headers = {"content-Type": "application/json"}response = requests.request("POST", url, headers=headers, data=payload)print(response.text)
require "uri"require "net/http"url = URI("{{base_url}}/events/track")http = Net::HTTP.new(url.host, url.port);request = Net::HTTP::Post.new(url)request["content-Type"] = "application/json"request.body = '{"data": {"api_key": "9ed6bd6a23db7dd422893e156","mad_uuid"<