Calling the Engine API
Annotated Example Engine API Request
the following code is an example request to the monetate engine api each object is described separately afterward example engine api request { "deviceid" "imei 123456789", "monetateid" "2 309132816 1519728587304", "preview" "6 3 ejyrvkpmts4vzsujz0xrsj ", "customerid" "87654321", "channel" "a 76ca7dd3/p/example com", "events" \[ { "eventtype" "monetate\ decision\ decisionrequest", "requestid" "12345678", "filters" \[ "slot name" ], "manageimpressions" false, "includereporting" true }, { "eventtype" "monetate\ context\ ipaddress", "ipaddress" "79 173 135 170" }, { "eventtype" "monetate\ context\ coordinates", "latitude" "49 566667", "longitude" "10 883333" }, { "eventtype" "monetate\ context\ useragent", "useragent" "mozilla/5 0 (macintosh; u; intel mac os x; en) applewebkit/522 11 (khtml, like gecko) safari/3 0 2" }, { "eventtype" "monetate\ context\ screensize", "width" 1024, "height" 762 }, { "eventtype" "monetate\ context\ metadata", "metadata" { "language" "en gb" } }, { "eventtype" "monetate\ context\ customvariables", "customvariables" \[ { "variable" "variablename", "value" "variablevalue" } ] }, { "eventtype" "monetate\ context\ pageview", "url" "https //www example com/search", "pagetype" "search" }, { "eventtype" "monetate\ context\ referrer", "referrer" "http //www example com" }, { "eventtype" "monetate\ record\ pageevents", "pageevents" \[ "myevent" ] }, { "eventtype" "monetate\ context\ productthumbnailview", "products" \[ "product72", "product43", "product42" ] }, { "eventtype" "monetate\ context\ productdetailview", "products" \[ { "productid" "product72", "sku" "product72 large green" }, { "productid" "product43", "sku" "product43 medium striped" }, { "productid" "product57" } ] }, { "eventtype" "monetate\ context\ cart", "cartlines" \[ { "sku" "product72color2", "pid" "product72", "quantity" 2, "currency" "gbp", "value" "24 00" } ] }, { "eventtype" "monetate\ context\ purchase", "purchaseid" "123456789", "purchaselines" \[ { "sku" "product72color2", "pid" "product72", "quantity" 2, "currency" "gbp", "value" "24 00" } ] }, { "eventtype" "monetate\ record\ impressions", "impressionids" \[ "2 ms4xlje1mtq4mdg5mda" ] } ] } objects device id the device id can be sent with new visitors without mt v , but it's normally used for apps and similar situations in which cookie ids are not possible it's used for targeting and action conditions example deviceid "deviceid" "imei 123456789" mt v value if no customer identifier is passed in the request, then a monetateid value is returned and the session is considered as a new visitor for targeting and analytics see user identity persistence in requests for more information example monetateid "monetateid" "2 309132816 1519728587304" preview flag if the session is a preview an omnichannel experience , then include the token id for this object for experience and split preview example preview id "preview" "6 3 ejyrvkpmts4vzsujz0xrsj " unique customer id a unique customerid value is used for customer view and user identity persistence in requests example customerid "customerid" "87654321" channel the channel value is your monetate account information example channel "channel" "a 76ca7dd3/p/example com" events the following objects are data passed to monetate for experiences and analytics action type filters, managed impressions, and reporting the following code example is an engine api decision request event with filtering for certain action types, managed impressions, and whether to include reporting in the response the filters parameter can be used to filter certain action types example request event for filtering, managed impressions, & reporting { "eventtype" "monetate\ decision\ decisionrequest", "requestid" "12345678", "filters" \[ "slot name" ], "manageimpressions" false, "includereporting" true } ip address the following code example is an engine api decision request event for the ip address this information is used for targeting and analytics example request event for ip address { "eventtype" "monetate\ context\ ipaddress", "ipaddress" "79 173 135 170" } coordinates the following code example is an engine api decision request event for a customer device's physical coordinates expressed in longitude and latitude this information is used for targeting and analytics example request event for coordinates { "eventtype" "monetate\ context\ coordinates", "latitude" "49 566667", "longitude" "10 883333" } user agent the following code example is an engine api decision request event for the user agent header this information is used for targeting and analytics ensure that you include the end user’s useragent string so that sessions are registered properly as stealth or not if the value of useragent lacks specific browser or os details, then it's identified as automated and put into stealth mode example request event for user agent header { "eventtype" "monetate\ context\ useragent", "useragent" "mozilla/5 0 (macintosh; u; intel mac os x; en) applewebkit/522 11 (khtml, like gecko) safari/3 0 2" } screen size the following code example is an engine api decision request event for the screen size of the customer's device this information is used for targeting example request event for device screen size { "eventtype" "monetate\ context\ screensize", "width" 1024, "height" 762 } metadata the following code example is an engine api decision request event for customer specific metadata this information is used for targeting and action conditions example request event for metadata { "eventtype" "monetate\ context\ metadata", "metadata" { "language" "en gb" } } custom variables the following code example is an engine api decision request event for a custom variable and its value this information is used for targeting example request event for custom variable { "eventtype" "monetate\ context\ customvariables", "customvariables" \[ { "variable" "variablename", "value" "variablevalue" } ] } page view and type the following code example is an engine api decision request event for a page view and its page type this information is used for action conditions see target, event, & condition mapping for more details example request event for page view and page type { "eventtype" "monetate\ context\ pageview", "url" "https //www example com/search", "pagetype" "search" } referrer the following code example is an engine api decision request event for a referring url this information is used for targeting and action conditions example request for referrer { "eventtype" "monetate\ context\ referrer", "referrer" "http //www example com" } custom page events the following code example is an engine api decision request event for custom page events this information is used for analytics example request for custom page events { "eventtype" "monetate\ record\ pageevents", "pageevents" \[ "myevent" ] } search results or product list pages the following code example is an engine api decision request event captures product thumbnail views on search results pages or other product list pages this information is used for targeting and action conditions example request for product thumbnail views { "eventtype" "monetate\ context\ productthumbnailview", "products" \[ "product72", "product43", "product42" ] } product detail pages the following code example is an engine api decision request event captures product detail page views this information is used for targeting and action conditions example request for product detail page views { "eventtype" "monetate\ context\ productdetailview", "products" \[ { "productid" "product72", "sku" "product72 large green" }, { "productid" "product43", "sku" "product43 medium striped" }, { "productid" "product57" } ] } cart pages the following code example is an engine api decision request event captures information about products in a customer's cart this information is used for targeting, action conditions, and analytics example request for carted products { "eventtype" "monetate\ context\ cart", "cartlines" \[ { "sku" "product72colour2", "pid" "product72", "quantity" 2, "currency" "gbp", "value" "24 00" } ] } purchases pages the following code example is an engine api decision request event that captures information about products that a customer has finished buying that appear on a "purchase complete" or similar page this information is used for targeting and analytics example request for purchased products { "eventtype" "monetate\ context\ purchase", "purchaseid" "123456789", "purchaselines" \[ { "sku" "product72colour2", "pid" "product72", "quantity" 2, "currency" "gbp", "value" "24 00" } ] } impressions the following code example is an engine api decision request event that captures impressions when manageimpressions is set to true , this event tells monetate that the impression happened example request for impressions { "eventtype" "monetate\ record\ impressions", "impressionids" \[ "2 ms4xlje1mtq4mdg5mda" ] }