curl --request POST \
--url https://api.topsort.com/v2/events \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"impressions": [
{
"occurredAt": "2023-11-07T05:31:56Z",
"opaqueUserId": "<string>",
"id": "<string>",
"resolvedBidId": "<string>",
"entity": {
"id": "<string>",
"type": "product"
},
"placement": {
"path": "<string>",
"position": 2,
"page": 2,
"pageSize": 2,
"productId": "<string>",
"categoryIds": [
"<string>"
],
"searchQuery": "<string>"
},
"additionalAttribution": {
"id": "<string>",
"type": "product"
},
"page": {
"type": "home",
"pageId": "<string>",
"value": "electronics"
},
"object": {
"type": "listing",
"assetId": "<string>",
"clickType": "product"
},
"externalCampaignId": "<string>",
"externalVendorId": "<string>",
"deviceType": "desktop",
"channel": "onsite"
}
],
"clicks": [
{
"occurredAt": "2023-11-07T05:31:56Z",
"opaqueUserId": "<string>",
"id": "<string>",
"resolvedBidId": "<string>",
"entity": {
"id": "<string>",
"type": "product"
},
"placement": {
"path": "<string>",
"position": 2,
"page": 2,
"pageSize": 2,
"productId": "<string>",
"categoryIds": [
"<string>"
],
"searchQuery": "<string>"
},
"additionalAttribution": {
"id": "<string>",
"type": "product"
},
"page": {
"type": "home",
"pageId": "<string>",
"value": "electronics"
},
"object": {
"type": "listing",
"assetId": "<string>",
"clickType": "product"
},
"clickType": "product",
"externalCampaignId": "<string>",
"externalVendorId": "<string>",
"deviceType": "desktop",
"channel": "onsite"
}
],
"purchases": [
{
"occurredAt": "2023-11-07T05:31:56Z",
"opaqueUserId": "<string>",
"items": [
{
"productId": "<string>",
"unitPrice": 123,
"quantity": 1,
"vendorId": "<string>"
}
],
"id": "<string>",
"deviceType": "desktop",
"channel": "onsite"
}
],
"pageviews": [
{
"page": {
"type": "home",
"pageId": "<string>",
"value": "electronics"
},
"occurredAt": "2023-11-07T05:31:56Z",
"opaqueUserId": "<string>",
"id": "<string>",
"deviceType": "desktop",
"channel": "onsite"
}
]
}
'{
"errCode": "bad_request",
"docUrl": "<string>",
"message": "<string>"
}Use the /events endpoint to report user interactions and activity in on a marketplace:
Interactions require either a resolvedBidId, for sponsored events coming from the /v2/auctions response,
or an entity that describes the entity that was interacted with, in the case of organic or non-sponsored events.
For analytics purposes, you can use the placement field to differentiate different listings or banners.
For example, on a product page with a carousel of products, you can track impressions and clicks related to the carousel
by including /carousel at the end of the path field in the placement object. This allows you to monitor
the performance of carousel products in the Data Room.
curl --request POST \
--url https://api.topsort.com/v2/events \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"impressions": [
{
"occurredAt": "2023-11-07T05:31:56Z",
"opaqueUserId": "<string>",
"id": "<string>",
"resolvedBidId": "<string>",
"entity": {
"id": "<string>",
"type": "product"
},
"placement": {
"path": "<string>",
"position": 2,
"page": 2,
"pageSize": 2,
"productId": "<string>",
"categoryIds": [
"<string>"
],
"searchQuery": "<string>"
},
"additionalAttribution": {
"id": "<string>",
"type": "product"
},
"page": {
"type": "home",
"pageId": "<string>",
"value": "electronics"
},
"object": {
"type": "listing",
"assetId": "<string>",
"clickType": "product"
},
"externalCampaignId": "<string>",
"externalVendorId": "<string>",
"deviceType": "desktop",
"channel": "onsite"
}
],
"clicks": [
{
"occurredAt": "2023-11-07T05:31:56Z",
"opaqueUserId": "<string>",
"id": "<string>",
"resolvedBidId": "<string>",
"entity": {
"id": "<string>",
"type": "product"
},
"placement": {
"path": "<string>",
"position": 2,
"page": 2,
"pageSize": 2,
"productId": "<string>",
"categoryIds": [
"<string>"
],
"searchQuery": "<string>"
},
"additionalAttribution": {
"id": "<string>",
"type": "product"
},
"page": {
"type": "home",
"pageId": "<string>",
"value": "electronics"
},
"object": {
"type": "listing",
"assetId": "<string>",
"clickType": "product"
},
"clickType": "product",
"externalCampaignId": "<string>",
"externalVendorId": "<string>",
"deviceType": "desktop",
"channel": "onsite"
}
],
"purchases": [
{
"occurredAt": "2023-11-07T05:31:56Z",
"opaqueUserId": "<string>",
"items": [
{
"productId": "<string>",
"unitPrice": 123,
"quantity": 1,
"vendorId": "<string>"
}
],
"id": "<string>",
"deviceType": "desktop",
"channel": "onsite"
}
],
"pageviews": [
{
"page": {
"type": "home",
"pageId": "<string>",
"value": "electronics"
},
"occurredAt": "2023-11-07T05:31:56Z",
"opaqueUserId": "<string>",
"id": "<string>",
"deviceType": "desktop",
"channel": "onsite"
}
]
}
'{
"errCode": "bad_request",
"docUrl": "<string>",
"message": "<string>"
}A valid API key generated in Topsort's UI.
Event data including impressions, clicks, purchases, and page views.
A batch request containing multiple events to be reported to Topsort.
An array of impression events
50Show child attributes
A RFC3339 formatted timestamp including UTC offset.
The opaque user ID is an anonymized unique identifier that maps to the original user ID without revealing the original value. This identifier allows Topsort to correlate user activity between auctions and user interactions, independent of the user's logged-in status. For apps or sites where users might interact while logged out, we recommend generating a random identifier (UUIDv7) on the first load, storing it on local storage (cookie, local storage, etc), and letting it live for at least a year. Otherwise, if your users are always logged in for interactions, you may use a hash of your customer ID. Correct purchase attribution requires long-lived opaque user IDs consistent between auction and event requests.
A unique identifier for the request. This field ensures the event reporting is idempotent in case there is a network issue and the request is retried. If there is no impression model on the marketplace side, generate a unique string that does not change if the event is resent.
1If the impression is over an ad promotion, this is the resolvedBidId field received from the /auctions request. In most situations, especially when reporting a sponsored interaction, you'll want to fill in this field.
Entity is meant for reporting organic events, not sponsored or promoted products. It refers to the object involved in the organic interaction. But, in most cases, you won't need to fill in this object. Be aware that if resolvedBidId has any value, entity will be disregarded.
Information about where an ad or product is placed on a page.
Show child attributes
URL path of the page triggering the event. For web apps, this can be obtained in JS using window.location.pathname. For mobile apps, use the deep link for the current view, if available. Otherwise, encode the view from which the event occurred in your app as a path-like string (e.g. /root/categories/:categoryId).
1For components with multiple items (i.e. search results, similar products, etc), this should indicate the index of a given item within that list.
x >= 1For paginated pages, this should indicate which page number triggered the event.
x >= 1For paginated pages this should indicate how many items are in each result page.
x >= 1The ID of the product associated to the page in which this event occurred, if applicable. This ID must match the ID provided through the catalog service.
1An array of IDs of the categories associated to the page in which this event occurred, if applicable. These IDs must match the IDs provided through the catalog service.
1A category ID.
1The search string provided by the user in the page where this event occurred, if applicable. This search string must match the searchQuery field that was provided in the auction request (if provided).
1Entity is meant for reporting organic events, not sponsored or promoted products. It refers to the object involved in the organic interaction. But, in most cases, you won't need to fill in this object. Be aware that if resolvedBidId has any value, entity will be disregarded.
Show child attributes
Information about the page where an auction or event occurs.
Information regarding an organic or non-sponsored event.
Show child attributes
The type of object that is being reported on the interaction.
listing, banner When type is banner, signals the ID of the asset of the banner
When type is listing, signals the specific interaction flavor with the listing.
product, like, add-to-cart Marketplace provided ID for a campaign
Marketplace provided ID for a vendor
The device the user is on.
desktop, mobile Optional. The channel where the event occurred.
onsite, offsite, instore An array of click events
50Show child attributes
A RFC3339 formatted timestamp including UTC offset.
The opaque user ID is an anonymized unique identifier that maps to the original user ID without revealing the original value. This identifier allows Topsort to correlate user activity between auctions and user interactions, independent of the user's logged-in status. For apps or sites where users might interact while logged out, we recommend generating a random identifier (UUIDv7) on the first load, storing it on local storage (cookie, local storage, etc), and letting it live for at least a year. Otherwise, if your users are always logged in for interactions, you may use a hash of your customer ID. Correct purchase attribution requires long-lived opaque user IDs consistent between auction and event requests.
A unique identifier for the request. This field ensures the event reporting is idempotent in case there is a network issue and the request is retried. If there is no impression model on the marketplace side, generate a unique string that does not change if the event is resent.
1If the click is over an ad promotion, this is the resolvedBidId field received from the /auctions request. In most situations, especially when reporting a sponsored interaction, you'll want to fill in this field.
Entity is meant for reporting organic events, not sponsored or promoted products. It refers to the object involved in the organic interaction. But, in most cases, you won't need to fill in this object. Be aware that if resolvedBidId has any value, entity will be disregarded.
Information about where an ad or product is placed on a page.
Show child attributes
URL path of the page triggering the event. For web apps, this can be obtained in JS using window.location.pathname. For mobile apps, use the deep link for the current view, if available. Otherwise, encode the view from which the event occurred in your app as a path-like string (e.g. /root/categories/:categoryId).
1For components with multiple items (i.e. search results, similar products, etc), this should indicate the index of a given item within that list.
x >= 1For paginated pages, this should indicate which page number triggered the event.
x >= 1For paginated pages this should indicate how many items are in each result page.
x >= 1The ID of the product associated to the page in which this event occurred, if applicable. This ID must match the ID provided through the catalog service.
1An array of IDs of the categories associated to the page in which this event occurred, if applicable. These IDs must match the IDs provided through the catalog service.
1A category ID.
1The search string provided by the user in the page where this event occurred, if applicable. This search string must match the searchQuery field that was provided in the auction request (if provided).
1Entity is meant for reporting organic events, not sponsored or promoted products. It refers to the object involved in the organic interaction. But, in most cases, you won't need to fill in this object. Be aware that if resolvedBidId has any value, entity will be disregarded.
Information about the page where an auction or event occurs.
Information regarding an organic or non-sponsored event.
Show child attributes
The type of object that is being reported on the interaction.
listing, banner When type is banner, signals the ID of the asset of the banner
When type is listing, signals the specific interaction flavor with the listing.
product, like, add-to-cart For sponsored events only, signals the specific interaction flavor with the listing.
product, like, add-to-cart Marketplace provided ID for a campaign
Marketplace provided ID for a vendor
The device the user is on.
desktop, mobile Optional. The channel where the event occurred.
onsite, offsite, instore An array of purchase events
50Show child attributes
RFC3339 formatted timestamp, including UTC offset, of the instant in which the order was placed. Please note that purchases will NOT be attributed to an auction that happened after.
The opaque user ID is an anonymized unique identifier that maps to the original user ID without revealing the original value. This identifier allows Topsort to correlate user activity between auctions and user interactions, independent of the user's logged-in status. For apps or sites where users might interact while logged out, we recommend generating a random identifier (UUIDv7) on the first load, storing it on local storage (cookie, local storage, etc), and letting it live for at least a year. Otherwise, if your users are always logged in for interactions, you may use a hash of your customer ID. Correct purchase attribution requires long-lived opaque user IDs consistent between auction and event requests.
Items purchased.
1Show child attributes
The marketplace ID of the product being purchased.
1The price of a single item in the marketplace currency.
Amount of products purchased.
x >= 1The vendor ID of the product being purchased. This field is optional and should be filled in if 1. a product is sold by multiple vendors, or 2. you want to use it for halo attribution
1A unique identifier for the request. This field ensures the event reporting is idempotent in case there is a network issue and the request is retried. If there is no impression model on the marketplace side, generate a unique string that does not change if the event is resent.
1The device the user is on.
desktop, mobile Optional. The channel where the event occurred.
onsite, offsite, instore An array of page views
50Show child attributes
Information about the page where an auction or event occurs.
A RFC3339 formatted timestamp including UTC offset.
The opaque user ID is an anonymized unique identifier that maps to the original user ID without revealing the original value. This identifier allows Topsort to correlate user activity between auctions and user interactions, independent of the user's logged-in status. For apps or sites where users might interact while logged out, we recommend generating a random identifier (UUIDv7) on the first load, storing it on local storage (cookie, local storage, etc), and letting it live for at least a year. Otherwise, if your users are always logged in for interactions, you may use a hash of your customer ID. Correct purchase attribution requires long-lived opaque user IDs consistent between auction and event requests.
The marketplace's unique ID for the event. This field ensures the event reporting is idempotent in case there is a network issue and the request is retried. If there is no pageview model on the marketplace side, generate a unique string that does not change if the event is resent.
1The device the user is on.
desktop, mobile Optional. The channel where the event occurred.
onsite, offsite, instore All events were reported successfully.
Was this page helpful?