Send User Events for Buy with Prime
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 user events such as clicks and page loads by using the sendUserEvents
mutation.
To get the user event data that you generate, reach out to your Buy with Prime solutions 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 user event for the pre-order checkout page
Send the page-load
user event when the shopper views the order review page before they check out, but after they successfully sign in using their Amazon credentials.
Request
// GraphQL mutation
mutation sendEvents {
sendUserEvents(
input: {
events: [
{
eventType: "page-load",
eventId: "example-event-id",
eventTime: "2024-05-31T13:15:30Z",
clientType: WEBSITE_CLIENT,
clientVersion: "1.0",
schemaName: "sfcc-schema",
schemaVersion: "1",
additionalProperties: {
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: "product_sku",
value: "example-sku"
},
{
property: "prime_promise_timestamp",
value: "1709882221"
},
{
property: "page_type",
value: "checkout"
}
]
}
}
]
}
) {
status
}
}
Response
{
"data": {
"sendUserEvents": {
"status": "successful"
}
}
}
Send a page load user event for the post-order confirmation page
You can also send the page-load
user event when the shopper views the order confirmation page after they place their order.
Request
// GraphQL mutation
mutation sendEvents {
sendUserEvents(
input: {
events: [
{
eventType: "page-load",
eventId: "example-event-id",
eventTime: "2024-05-31T13:15:30Z",
clientType: WEBSITE_CLIENT,
clientVersion: "1.0",
schemaName: "sfcc-schema",
schemaVersion: "1",
additionalProperties: {
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: "product_sku",
value: "example-sku"
},
{
property: "page_type",
value: "checkout"
},
{
property: "example-order-id",
value: "234454545"
}
]
}
}
]
}
) {
status
}
}
Response
{
"data": {
"sendUserEvents": {
"status": "successful"
}
}
}
Send a click user event
Send the click
user 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 sendEvents {
sendUserEvents(
input: {
events: [
{
eventType: "click",
eventId: "example-event-id",
eventTime: "2024-05-31T13:15:30Z",
clientType: WEBSITE_CLIENT,
clientVersion: "1.0",
schemaName: "sfcc-schema",
schemaVersion: "1",
additionalProperties: {
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: "product_sku",
value: "example-sku"
},
{
property: "page_type",
value: "cart"
},
{
property: "prime_promise_timestamp",
value: "1709882221"
},
{
property: "page_action",
value: "add-to-cart"
}
]
}
}
]
}
) {
status
}
}
Response
{
"data": {
"sendUserEvents": {
"status": "successful"
}
}
}
Send a buyability user event
Buyability is a determination of whether a product is eligible for Buy with Prime. Buyability depends on multiple factors, such as whether you correctly configured the product for Buy with Prime. Send the widget-viewed
user event when the product is buyable, meaning the Prime badge is rendered on a page.
Request
// GraphQL mutation
mutation sendEvents {
sendUserEvents(
input: {
events: [
{
eventType: "widget-viewed",
eventId: "example-event-id",
eventTime: "2024-05-31T13:15:30Z",
clientType: WEBSITE_CLIENT,
clientVersion: "1.0",
schemaName: "sfcc-schema",
schemaVersion: "1",
additionalProperties: {
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: "product_sku",
value: "example-sku"
}
]
}
}
]
}
) {
status
}
}
Response
{
"data": {
"sendUserEvents": {
"status": "successful"
}
}
}
Send a delivery estimate user event
Send the bwp-widget-promise-loaded
user event when the Buy with Prime delivery estimate is rendered or the shopper switches to a different variant within the same product detail page.
Request
// GraphQL mutation
mutation sendEvents {
sendUserEvents(
input: {
events: [
{
eventType: "bwp-widget-promise-loaded",
eventId: "example-event-id",
eventTime: "2024-05-31T13:15:30Z",
clientType: WEBSITE_CLIENT,
clientVersion: "1.0",
schemaName: "sfcc-schema",
schemaVersion: "1",
additionalProperties: {
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: "product_sku",
value: "example-sku"
},
{
property: "prime_promise_timestamp",
value: "1709882221"
}
]
}
}
]
}
) {
status
}
}
Response
{
"data": {
"sendUserEvents": {
"status": "successful"
}
}
}
Related topics
Updated about 1 hour ago