Analytics Interface
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.
The Analytics interface enables you to track e-commerce user events, including page views, clicks, and so on. By integrating this interface into your application, you can gain insight into shopper behavior and optimize your e-commerce platform to offer Buy with Prime.
You can track both server-side and client-side user events by using the Buy with Prime Analytics interface. User events are processed and stored in your Buy with Prime account within fifteen minutes of receiving the event.
The Analytics interface can capture up to 50 user events in a single call.
You can use the resulting user events to calculate metrics such as click-through rate, checkout-abandonment rate, and conversion for Buy with Prime products on your site to include in business reports or dashboards.
For examples, see Analytics Interface Examples.
To get the data that you generate by using this interface, reach out to your Buy with Prime solutions architect.
Terminology
The following sections describe terminology related to Buy with Prime analytics.
User event
In the context of Buy with Prime analytics, a user event is a specific action or occurrence within your e-commerce platform. User events can include various shopper interactions such as page views, clicks, and so on. Every user event has a name (such as page-load
), an associated schema, and a unique event ID.
There are two ways to track user events, as shown in the following figure.
- Server-side: This is the tracking method we recommend. In this method, your server sends user events to your Buy with Prime account by using the Buy with Prime API. This approach is the most reliable and the easiest to maintain, because the server is an environment that you control. As such, you can add tracking in one place (your servers) rather than in diverse places (web, iOS, Android). However, server-side tracking has limitations with respect to capturing certain shopper interactions. A server-side user event can be captured when a page loads, but it might not be able to determine if the page was actually rendered. Similarly, not every click, hover, or scrolling action leads to a back-end service call, and therefore can’t be captured with server-side tracking alone.
- Client-side: In this method, user events are generated on the shopper's desktop or mobile device and sent to your Buy with Prime account by using the Buy with Prime API. It can capture granular interactions like clicks, hovers, and scrolling. Client-side tracking is less reliable than server-side because it might be obstructed by ad blockers, browser settings, and network issues. It's also harder to maintain across multiple platforms, because it might involve redeploying your app to web and mobile clients. We therefore recommend that you track everything you can by using your servers, and only supplement that with client-side tracking when necessary.
Regardless of whether you send server-side or client-side user events, we recommend that you call the sendUserEvents
mutation asynchronously so that you can track user events in a non-blocking way. The following example shows a non-blocking API call.
// Async client
sendUserEventsMutation = async(mutation) => {
const res = await fetch(buyWithPrimeUrl, {
method: "POST",
headers: buyWithPrimeHeaders,
mutation
});
return res.json();
}
Schema
A schema defines the fields of the user event. Every user event has its own schema, which contains a list of fields that the user event can capture based on the user event type. Because schemas can evolve, each schema has a name and a version. If you don't specify a schema name and a schema version, the event is validated against the latest default schema, which contains all possible fields.
For the schema of user events, see User Event Schema. Some fields are provided by default. You can emit additional optional properties in the additionalProperties
list within the event.
Event time
The event time of a user event is a date-time field that captures the UTC time when the user event was generated.
API operations
The Buy with Prime Analytics interface supports the following mutations, queries, and events.
Mutations
Name | Description |
---|---|
sendUserEvents | Send user events to analytics. |
Queries
None.
Events
None.
Related topics
Updated 23 days ago