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>",
"externalCampaignId": "<string>",
"externalVendorId": "<string>"
}
],
"clicks": [
{
"occurredAt": "2023-11-07T05:31:56Z",
"opaqueUserId": "<string>",
"id": "<string>",
"resolvedBidId": "<string>",
"externalCampaignId": "<string>",
"externalVendorId": "<string>"
}
],
"purchases": [
{
"occurredAt": "2023-11-07T05:31:56Z",
"opaqueUserId": "<string>",
"items": [
{
"productId": "<string>",
"unitPrice": 123,
"quantity": 1,
"vendorId": "<string>"
}
],
"id": "<string>"
}
],
"pageviews": [
{
"page": {
"pageId": "<string>",
"value": "electronics"
},
"occurredAt": "2023-11-07T05:31:56Z",
"opaqueUserId": "<string>",
"id": "<string>"
}
]
}
'import requests
url = "https://api.topsort.com/v2/events"
payload = {
"impressions": [
{
"occurredAt": "2023-11-07T05:31:56Z",
"opaqueUserId": "<string>",
"id": "<string>",
"resolvedBidId": "<string>",
"externalCampaignId": "<string>",
"externalVendorId": "<string>"
}
],
"clicks": [
{
"occurredAt": "2023-11-07T05:31:56Z",
"opaqueUserId": "<string>",
"id": "<string>",
"resolvedBidId": "<string>",
"externalCampaignId": "<string>",
"externalVendorId": "<string>"
}
],
"purchases": [
{
"occurredAt": "2023-11-07T05:31:56Z",
"opaqueUserId": "<string>",
"items": [
{
"productId": "<string>",
"unitPrice": 123,
"quantity": 1,
"vendorId": "<string>"
}
],
"id": "<string>"
}
],
"pageviews": [
{
"page": {
"pageId": "<string>",
"value": "electronics"
},
"occurredAt": "2023-11-07T05:31:56Z",
"opaqueUserId": "<string>",
"id": "<string>"
}
]
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
impressions: [
{
occurredAt: '2023-11-07T05:31:56Z',
opaqueUserId: '<string>',
id: '<string>',
resolvedBidId: '<string>',
externalCampaignId: '<string>',
externalVendorId: '<string>'
}
],
clicks: [
{
occurredAt: '2023-11-07T05:31:56Z',
opaqueUserId: '<string>',
id: '<string>',
resolvedBidId: '<string>',
externalCampaignId: '<string>',
externalVendorId: '<string>'
}
],
purchases: [
{
occurredAt: '2023-11-07T05:31:56Z',
opaqueUserId: '<string>',
items: [{productId: '<string>', unitPrice: 123, quantity: 1, vendorId: '<string>'}],
id: '<string>'
}
],
pageviews: [
{
page: {pageId: '<string>', value: 'electronics'},
occurredAt: '2023-11-07T05:31:56Z',
opaqueUserId: '<string>',
id: '<string>'
}
]
})
};
fetch('https://api.topsort.com/v2/events', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.topsort.com/v2/events",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'impressions' => [
[
'occurredAt' => '2023-11-07T05:31:56Z',
'opaqueUserId' => '<string>',
'id' => '<string>',
'resolvedBidId' => '<string>',
'externalCampaignId' => '<string>',
'externalVendorId' => '<string>'
]
],
'clicks' => [
[
'occurredAt' => '2023-11-07T05:31:56Z',
'opaqueUserId' => '<string>',
'id' => '<string>',
'resolvedBidId' => '<string>',
'externalCampaignId' => '<string>',
'externalVendorId' => '<string>'
]
],
'purchases' => [
[
'occurredAt' => '2023-11-07T05:31:56Z',
'opaqueUserId' => '<string>',
'items' => [
[
'productId' => '<string>',
'unitPrice' => 123,
'quantity' => 1,
'vendorId' => '<string>'
]
],
'id' => '<string>'
]
],
'pageviews' => [
[
'page' => [
'pageId' => '<string>',
'value' => 'electronics'
],
'occurredAt' => '2023-11-07T05:31:56Z',
'opaqueUserId' => '<string>',
'id' => '<string>'
]
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.topsort.com/v2/events"
payload := strings.NewReader("{\n \"impressions\": [\n {\n \"occurredAt\": \"2023-11-07T05:31:56Z\",\n \"opaqueUserId\": \"<string>\",\n \"id\": \"<string>\",\n \"resolvedBidId\": \"<string>\",\n \"externalCampaignId\": \"<string>\",\n \"externalVendorId\": \"<string>\"\n }\n ],\n \"clicks\": [\n {\n \"occurredAt\": \"2023-11-07T05:31:56Z\",\n \"opaqueUserId\": \"<string>\",\n \"id\": \"<string>\",\n \"resolvedBidId\": \"<string>\",\n \"externalCampaignId\": \"<string>\",\n \"externalVendorId\": \"<string>\"\n }\n ],\n \"purchases\": [\n {\n \"occurredAt\": \"2023-11-07T05:31:56Z\",\n \"opaqueUserId\": \"<string>\",\n \"items\": [\n {\n \"productId\": \"<string>\",\n \"unitPrice\": 123,\n \"quantity\": 1,\n \"vendorId\": \"<string>\"\n }\n ],\n \"id\": \"<string>\"\n }\n ],\n \"pageviews\": [\n {\n \"page\": {\n \"pageId\": \"<string>\",\n \"value\": \"electronics\"\n },\n \"occurredAt\": \"2023-11-07T05:31:56Z\",\n \"opaqueUserId\": \"<string>\",\n \"id\": \"<string>\"\n }\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.topsort.com/v2/events")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"impressions\": [\n {\n \"occurredAt\": \"2023-11-07T05:31:56Z\",\n \"opaqueUserId\": \"<string>\",\n \"id\": \"<string>\",\n \"resolvedBidId\": \"<string>\",\n \"externalCampaignId\": \"<string>\",\n \"externalVendorId\": \"<string>\"\n }\n ],\n \"clicks\": [\n {\n \"occurredAt\": \"2023-11-07T05:31:56Z\",\n \"opaqueUserId\": \"<string>\",\n \"id\": \"<string>\",\n \"resolvedBidId\": \"<string>\",\n \"externalCampaignId\": \"<string>\",\n \"externalVendorId\": \"<string>\"\n }\n ],\n \"purchases\": [\n {\n \"occurredAt\": \"2023-11-07T05:31:56Z\",\n \"opaqueUserId\": \"<string>\",\n \"items\": [\n {\n \"productId\": \"<string>\",\n \"unitPrice\": 123,\n \"quantity\": 1,\n \"vendorId\": \"<string>\"\n }\n ],\n \"id\": \"<string>\"\n }\n ],\n \"pageviews\": [\n {\n \"page\": {\n \"pageId\": \"<string>\",\n \"value\": \"electronics\"\n },\n \"occurredAt\": \"2023-11-07T05:31:56Z\",\n \"opaqueUserId\": \"<string>\",\n \"id\": \"<string>\"\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.topsort.com/v2/events")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"impressions\": [\n {\n \"occurredAt\": \"2023-11-07T05:31:56Z\",\n \"opaqueUserId\": \"<string>\",\n \"id\": \"<string>\",\n \"resolvedBidId\": \"<string>\",\n \"externalCampaignId\": \"<string>\",\n \"externalVendorId\": \"<string>\"\n }\n ],\n \"clicks\": [\n {\n \"occurredAt\": \"2023-11-07T05:31:56Z\",\n \"opaqueUserId\": \"<string>\",\n \"id\": \"<string>\",\n \"resolvedBidId\": \"<string>\",\n \"externalCampaignId\": \"<string>\",\n \"externalVendorId\": \"<string>\"\n }\n ],\n \"purchases\": [\n {\n \"occurredAt\": \"2023-11-07T05:31:56Z\",\n \"opaqueUserId\": \"<string>\",\n \"items\": [\n {\n \"productId\": \"<string>\",\n \"unitPrice\": 123,\n \"quantity\": 1,\n \"vendorId\": \"<string>\"\n }\n ],\n \"id\": \"<string>\"\n }\n ],\n \"pageviews\": [\n {\n \"page\": {\n \"pageId\": \"<string>\",\n \"value\": \"electronics\"\n },\n \"occurredAt\": \"2023-11-07T05:31:56Z\",\n \"opaqueUserId\": \"<string>\",\n \"id\": \"<string>\"\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"docUrl": "<string>",
"message": "<string>"
}Report events
Use the /events endpoint to report user interactions and activity in on a marketplace:
- Impressions — a user viewed an asset.
- Clicks — a user clicked on an asset.
- Purchases — a user created an order.
- Page views — a user visited a page.
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>",
"externalCampaignId": "<string>",
"externalVendorId": "<string>"
}
],
"clicks": [
{
"occurredAt": "2023-11-07T05:31:56Z",
"opaqueUserId": "<string>",
"id": "<string>",
"resolvedBidId": "<string>",
"externalCampaignId": "<string>",
"externalVendorId": "<string>"
}
],
"purchases": [
{
"occurredAt": "2023-11-07T05:31:56Z",
"opaqueUserId": "<string>",
"items": [
{
"productId": "<string>",
"unitPrice": 123,
"quantity": 1,
"vendorId": "<string>"
}
],
"id": "<string>"
}
],
"pageviews": [
{
"page": {
"pageId": "<string>",
"value": "electronics"
},
"occurredAt": "2023-11-07T05:31:56Z",
"opaqueUserId": "<string>",
"id": "<string>"
}
]
}
'import requests
url = "https://api.topsort.com/v2/events"
payload = {
"impressions": [
{
"occurredAt": "2023-11-07T05:31:56Z",
"opaqueUserId": "<string>",
"id": "<string>",
"resolvedBidId": "<string>",
"externalCampaignId": "<string>",
"externalVendorId": "<string>"
}
],
"clicks": [
{
"occurredAt": "2023-11-07T05:31:56Z",
"opaqueUserId": "<string>",
"id": "<string>",
"resolvedBidId": "<string>",
"externalCampaignId": "<string>",
"externalVendorId": "<string>"
}
],
"purchases": [
{
"occurredAt": "2023-11-07T05:31:56Z",
"opaqueUserId": "<string>",
"items": [
{
"productId": "<string>",
"unitPrice": 123,
"quantity": 1,
"vendorId": "<string>"
}
],
"id": "<string>"
}
],
"pageviews": [
{
"page": {
"pageId": "<string>",
"value": "electronics"
},
"occurredAt": "2023-11-07T05:31:56Z",
"opaqueUserId": "<string>",
"id": "<string>"
}
]
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
impressions: [
{
occurredAt: '2023-11-07T05:31:56Z',
opaqueUserId: '<string>',
id: '<string>',
resolvedBidId: '<string>',
externalCampaignId: '<string>',
externalVendorId: '<string>'
}
],
clicks: [
{
occurredAt: '2023-11-07T05:31:56Z',
opaqueUserId: '<string>',
id: '<string>',
resolvedBidId: '<string>',
externalCampaignId: '<string>',
externalVendorId: '<string>'
}
],
purchases: [
{
occurredAt: '2023-11-07T05:31:56Z',
opaqueUserId: '<string>',
items: [{productId: '<string>', unitPrice: 123, quantity: 1, vendorId: '<string>'}],
id: '<string>'
}
],
pageviews: [
{
page: {pageId: '<string>', value: 'electronics'},
occurredAt: '2023-11-07T05:31:56Z',
opaqueUserId: '<string>',
id: '<string>'
}
]
})
};
fetch('https://api.topsort.com/v2/events', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.topsort.com/v2/events",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'impressions' => [
[
'occurredAt' => '2023-11-07T05:31:56Z',
'opaqueUserId' => '<string>',
'id' => '<string>',
'resolvedBidId' => '<string>',
'externalCampaignId' => '<string>',
'externalVendorId' => '<string>'
]
],
'clicks' => [
[
'occurredAt' => '2023-11-07T05:31:56Z',
'opaqueUserId' => '<string>',
'id' => '<string>',
'resolvedBidId' => '<string>',
'externalCampaignId' => '<string>',
'externalVendorId' => '<string>'
]
],
'purchases' => [
[
'occurredAt' => '2023-11-07T05:31:56Z',
'opaqueUserId' => '<string>',
'items' => [
[
'productId' => '<string>',
'unitPrice' => 123,
'quantity' => 1,
'vendorId' => '<string>'
]
],
'id' => '<string>'
]
],
'pageviews' => [
[
'page' => [
'pageId' => '<string>',
'value' => 'electronics'
],
'occurredAt' => '2023-11-07T05:31:56Z',
'opaqueUserId' => '<string>',
'id' => '<string>'
]
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.topsort.com/v2/events"
payload := strings.NewReader("{\n \"impressions\": [\n {\n \"occurredAt\": \"2023-11-07T05:31:56Z\",\n \"opaqueUserId\": \"<string>\",\n \"id\": \"<string>\",\n \"resolvedBidId\": \"<string>\",\n \"externalCampaignId\": \"<string>\",\n \"externalVendorId\": \"<string>\"\n }\n ],\n \"clicks\": [\n {\n \"occurredAt\": \"2023-11-07T05:31:56Z\",\n \"opaqueUserId\": \"<string>\",\n \"id\": \"<string>\",\n \"resolvedBidId\": \"<string>\",\n \"externalCampaignId\": \"<string>\",\n \"externalVendorId\": \"<string>\"\n }\n ],\n \"purchases\": [\n {\n \"occurredAt\": \"2023-11-07T05:31:56Z\",\n \"opaqueUserId\": \"<string>\",\n \"items\": [\n {\n \"productId\": \"<string>\",\n \"unitPrice\": 123,\n \"quantity\": 1,\n \"vendorId\": \"<string>\"\n }\n ],\n \"id\": \"<string>\"\n }\n ],\n \"pageviews\": [\n {\n \"page\": {\n \"pageId\": \"<string>\",\n \"value\": \"electronics\"\n },\n \"occurredAt\": \"2023-11-07T05:31:56Z\",\n \"opaqueUserId\": \"<string>\",\n \"id\": \"<string>\"\n }\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.topsort.com/v2/events")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"impressions\": [\n {\n \"occurredAt\": \"2023-11-07T05:31:56Z\",\n \"opaqueUserId\": \"<string>\",\n \"id\": \"<string>\",\n \"resolvedBidId\": \"<string>\",\n \"externalCampaignId\": \"<string>\",\n \"externalVendorId\": \"<string>\"\n }\n ],\n \"clicks\": [\n {\n \"occurredAt\": \"2023-11-07T05:31:56Z\",\n \"opaqueUserId\": \"<string>\",\n \"id\": \"<string>\",\n \"resolvedBidId\": \"<string>\",\n \"externalCampaignId\": \"<string>\",\n \"externalVendorId\": \"<string>\"\n }\n ],\n \"purchases\": [\n {\n \"occurredAt\": \"2023-11-07T05:31:56Z\",\n \"opaqueUserId\": \"<string>\",\n \"items\": [\n {\n \"productId\": \"<string>\",\n \"unitPrice\": 123,\n \"quantity\": 1,\n \"vendorId\": \"<string>\"\n }\n ],\n \"id\": \"<string>\"\n }\n ],\n \"pageviews\": [\n {\n \"page\": {\n \"pageId\": \"<string>\",\n \"value\": \"electronics\"\n },\n \"occurredAt\": \"2023-11-07T05:31:56Z\",\n \"opaqueUserId\": \"<string>\",\n \"id\": \"<string>\"\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.topsort.com/v2/events")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"impressions\": [\n {\n \"occurredAt\": \"2023-11-07T05:31:56Z\",\n \"opaqueUserId\": \"<string>\",\n \"id\": \"<string>\",\n \"resolvedBidId\": \"<string>\",\n \"externalCampaignId\": \"<string>\",\n \"externalVendorId\": \"<string>\"\n }\n ],\n \"clicks\": [\n {\n \"occurredAt\": \"2023-11-07T05:31:56Z\",\n \"opaqueUserId\": \"<string>\",\n \"id\": \"<string>\",\n \"resolvedBidId\": \"<string>\",\n \"externalCampaignId\": \"<string>\",\n \"externalVendorId\": \"<string>\"\n }\n ],\n \"purchases\": [\n {\n \"occurredAt\": \"2023-11-07T05:31:56Z\",\n \"opaqueUserId\": \"<string>\",\n \"items\": [\n {\n \"productId\": \"<string>\",\n \"unitPrice\": 123,\n \"quantity\": 1,\n \"vendorId\": \"<string>\"\n }\n ],\n \"id\": \"<string>\"\n }\n ],\n \"pageviews\": [\n {\n \"page\": {\n \"pageId\": \"<string>\",\n \"value\": \"electronics\"\n },\n \"occurredAt\": \"2023-11-07T05:31:56Z\",\n \"opaqueUserId\": \"<string>\",\n \"id\": \"<string>\"\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"docUrl": "<string>",
"message": "<string>"
}Authorizations
A valid API key generated in Topsort's UI. Use a TSE API key for calls to Auctions or Events API.
Body
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
Show child attributes
An array of click events
50Show child attributes
Show child attributes
An array of purchase events
50Show child attributes
Show child attributes
An array of page views
50Show child attributes
Show child attributes
Response
All events were reported successfully.
Was this page helpful?