Track Buy with Prime Traffic Events
Buy with Prime API is now available for early access
Sign up for early access to the Buy with Prime API using the 'Sign Up' button below. The API may change as Amazon receives feedback and iterates on it.
This topic contains examples of how to track Buy with Prime traffic events such as clicks and page loads by using the sendUserEvents
mutation.
To get the data that you generate when you Analyze Your Buy with Prime Metrics, reach out to your Buy with Prime solution architect.
We recommend that you call the sendUserEvents
mutation asynchronously so that you can track events in a non-blocking way.
Send a page load event for the pre-order checkout page
Send the page-load
event when the shopper views the order review page before they check out, but after they successfully log in to their Amazon account.
Request
// GraphQL mutation
mutation {
trackEvent(events: [
{
"eventName": "page-load",
"eventId": "11c7e59a-d462-4254-bc7e-3e44528ef6d0",
"timestamp": 2023-12-03T10:15:30Z,
"clientType": ClientType.WEB_CLIENT,
"clientVersion": "1.0",
"applicationId": "SFCC_STOREFRONT",
"schemaName": "example-schema",
"schemaVersion": "1",
"additionalProperties":[
{
"property":"example-ubid",
"value": "620e4ba7-4866-48db-8a26-9d51b8e71519"
},
{
"property" : "userAgent",
"value": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/110.0.0.0 Safari/537.36"
},
{
"property": "currentUrl",
"value": "https://example.com/products/example-product?referrer_domain=www.google.com",
},
{
"property": "referrer",
"value": "https://example.com/"
},
{
"property": "productSku",
"value": "example-sku"
},
{
"property": "primePromiseDate",
"value": "1709882221"
},
{
"property": "pageType",
"value": "checkout"
}
]
}
])
{
"completed"
}
}
Response
{
"data": {
"trackEvent": {
"completed": 1 // Request was accepted successfully
}
}
}
Send a page load event for the post-order confirmation page
You can also send the page-load
event when the shopper views the order confirmation page after they place their order.
Request
// GraphQL mutation
mutation {
trackEvent(events: [
{
"eventName": "page-load",
"eventId": "11c7e59a-d462-4254-bc7e-3e44528ef6d0",
"timestamp": 2023-12-03T10:15:30Z,
"clientType": ClientType.WEB_CLIENT,
"clientVersion": "1.0",
"applicationId": "SFCC_STOREFRONT",
"schemaName": "example-schema",
"schemaVersion": "1",
"additionalProperties":[
{
"property":"ubid",
"value": "example-ubid"
},
{
"property" : "userAgent",
"value": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/110.0.0.0 Safari/537.36"
},
{
"property": "currentUrl",
"value": "https://example.com/products/example-product?referrer_domain=www.google.com",
},
{
"property": "referrer",
"value": "https://example.com/"
},
{
"property": "productSku",
"value": "example-sku"
},
{
"property": "pageType",
"value": "example-order-details"
},
{
"property": "example-order-id",
"value": "234454545"
}
]
}
])
{
"completed"
}
}
Response
{
"data": {
"trackEvent": {
"completed": 1 // Request was accepted successfully
}
}
}
Send a click event
Send the click
event when the shopper adds a Buy with Prime product to their cart or they click the Buy with Prime button to start checkout.
Request
// GraphQL mutation
mutation {
trackEvent(events: [
{
"eventName": "click",
"eventId": "example-event-id",
"timestamp": 2023-12-03T10:15:30Z,
"clientType": ClientType.WEB_CLIENT,
"clientVersion": "1.0",
"applicationId": "SFCC_STOREFRONT",
"schemaName": "example-schema-name",
"schemaVersion": "1",
"additionalProperties":[
{
"property":"ubid",
"value": "example-ubid"
},
{
"property" : "userAgent",
"value": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/110.0.0.0 Safari/537.36"
},
{
"property": "currentUrl",
"value": "https://example.com/products/example-product?referrer_domain=www.google.com",
},
{
"property": "referrer",
"value": "https://example.com/"
},
{
"property": "productSku",
"value": "example-sku"
},
{
"property": "primePromiseDate",
"value": "1709882221"
},
{
"property": "pageType",
"value": "cart"
},
{
"property": "pageAction",
"value": "add-to-cart"
}
]
},
{
"eventName": "click",
"eventId": "11c7e59a-d462-4254-bc7e-3e44528ef6z2",
"timestamp": 2023-12-03T10:15:30Z,
"clientType": ClientType.WEB_CLIENT,
"clientVersion": "1.0",
"applicationId": "SFCC_STOREFRONT",
"schemaName": "sfcc-schema",
"schemaVersion": "1",
"additionalProperties":[
{
"property":"ubid",
"value": "example-ubid"
},
{
"property" : "userAgent",
"value": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/110.0.0.0 Safari/537.36"
},
{
"property": "currentUrl",
"value": "https://example.com/products/example-product?referrer_domain=www.google.com",
},
{
"property": "referrer",
"value": "https://envoyleather.com/"
},
{
"property": "productSku",
"value": "example-sku"
},
{
"property": "primePromiseDate",
"value": "1709882221"
},
{
"property": "pageType",
"value": "cart"
},
{
"property": "pageAction",
"value": "bwp-button"
}
]
}
])
{
"completed"
}
}
Response
{
"data": {
"trackEvent": {
"completed": 1 // Request was accepted successfully
}
}
}
Send a buyability event
Buyability is a determination of whether a product is purchasable by eligible shoppers through Buy with Prime. Buyability depends on multiple factors, such as whether you correctly configured the product for Buy with Prime. Send the widget-viewed
event when the product is buyable, meaning the Prime badge is loaded and rendered on a page.
Request
// GraphQL mutation
mutation {
trackEvent(events: [
{
"eventName": "widget-viewed",
"eventId": "example-event-id",
"timestamp": 2023-12-03T10:15:30Z,
"clientType": ClientType.WEB_CLIENT,
"clientVersion": "1.0",
"applicationId": "SFCC_STOREFRONT",
"schemaName": "example-schema-name",
"schemaVersion": "1",
"additionalProperties":[
{
"property":"ubid",
"value": "example-ubid"
},
{
"property" : "userAgent",
"value": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/110.0.0.0 Safari/537.36"
},
{
"property": "currentUrl",
"value": "https://example.com/products/example-product?referrer_domain=www.google.com",
},
{
"property": "referrer",
"value": "https://example.com/"
},
{
"property": "productSku",
"value": "example-sku"
}
]
}
])
{
"completed"
}
}
Response
{
"data": {
"trackEvent": {
"completed": 1 // Request was accepted successfully
}
}
}
Send a delivery estimate event
Send the bwp-widget-promise-loaded
event when the Buy with Prime delivery estimate is loaded or the shopper switches to a different variant within the same product detail page.
Request
// GraphQL mutation
mutation {
trackEvent(events: [
{
"eventName": "bwp-widget-promise-loaded",
"eventId": "example-event-id",
"timestamp": 2023-12-03T10:15:30Z,
"clientType": ClientType.WEB_CLIENT,
"clientVersion": "1.0",
"applicationId": "SFCC_STOREFRONT",
"schemaName": "example-schema-name",
"schemaVersion": "1",
"additionalProperties":[
{
"property":"ubid",
"value": "example-ubid"
},
{
"property" : "userAgent",
"value": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/110.0.0.0 Safari/537.36"
},
{
"property": "currentUrl",
"value": "https://example.com/products/example-product?referrer_domain=www.google.com",
},
{
"property": "referrer",
"value": "https://example.com/"
},
{
"property": "productSku",
"value": "example-sku"
},
{
"property": "primePromiseDate",
"value": "1709882221"
}
]
}
])
{
"completed"
}
}
Response
{
"data": {
"trackEvent": {
"completed": 1 // Request was accepted successfully
}
}
}
Related topics
Updated 3 days ago