Topsort
Datafly Signal delivers events to Topsort server-to-server using the Events API (/v2/events). Topsort is a retail-media platform: marketplaces report shopper interactions so vendors can measure the effectiveness of their sponsored-product campaigns.
This integration focuses on purchase attribution — Signal forwards completed orders to Topsort so purchases can be matched back to the ads a shopper saw or clicked. Delivery is server-side, so it is unaffected by ad blockers or browser tracking prevention, and no personally identifiable information leaves your infrastructure: Topsort matches purchases using a pseudonymous opaque user ID only.
Prerequisites
Before configuring Topsort in Signal you need a Topsort marketplace account and a Marketplace API key.
Step 1: Generate a Marketplace API Key
- Sign in to the Topsort Auction Manager dashboard.
- Go to Settings > API Integration.
- Click Generate API key.
- Choose the Marketplace key type. The Marketplace key is the one that grants access to the
/auctionsand/eventsendpoints. (The Advanced key is for catalog and campaign management and will not work here.) - Copy the key immediately and store it securely.
The Marketplace API key is a server-side secret. Never expose it in frontend code or share it with clients. Signal keeps it on your own infrastructure and attaches it only to outbound requests to Topsort.
Step 2: Confirm the Opaque User ID Strategy
Topsort correlates the auction a shopper saw with the purchase they later made using an opaque user ID — a long-lived, anonymised identifier that is consistent across both requests. Signal sends its own pseudonymous anonymous_id (a first-party identifier stored as a cookie that lives for at least a year) as the opaqueUserId.
For purchase attribution to work, the same identifier must be used when your storefront runs the Topsort auction (client-side /v2/auctions call). If you already run Topsort listings via their JavaScript SDK, ensure it is configured to use the same persistent identifier that Datafly.js uses, or pass Datafly’s anonymous_id into the SDK.
Configure in Signal
Configuration Fields
| Field | Required | Description |
|---|---|---|
api_key | Yes | Your Topsort Marketplace API key. Generated in Auction Manager under Settings > API Integration. |
Management UI Setup
Add the integration
Go to Integrations > Add Integration > Topsort.
Choose the preset
Select the Default preset — purchase attribution.
Enter your key
Paste your Marketplace API key into api_key.
Save
Click Save. Signal will begin forwarding completed orders to Topsort.
API Endpoint
POST https://api.topsort.com/v2/events
Authorization: Bearer {api_key}
Content-Type: application/jsonEvents are grouped into named arrays by type. Signal sends completed orders in the purchases array. A successful request returns 204 No Content.
{
"purchases": [ { "...": "..." } ]
}Identity Signals
Topsort does not accept hashed email, phone, or other PII. Matching relies on a single pseudonymous identifier plus a stable, idempotent event ID.
| Signal | Topsort field | Description |
|---|---|---|
anonymous_id | opaqueUserId | Datafly’s first-party pseudonymous identifier. Must match the identifier used in the client-side Topsort auction for the purchase to be attributed. |
order_id | id | A stable, unique event identifier. Topsort uses it for idempotency, so retried deliveries are de-duplicated. Signal uses the order ID. |
Because Topsort matches on the pseudonymous opaqueUserId only, there is no email/phone hashing and no separate consent field on this API. Apply consent gating at the Signal pipeline level if your deployment requires advertising consent before forwarding purchases.
Event Mapping
Default preset
| Signal event | Topsort array | Notes |
|---|---|---|
Order Completed | purchases[] | One purchase object per order, with an items[] array built from the order’s products. |
Why purchases only? Topsort impression and click events require a resolvedBidId returned by the client-side /v2/auctions call (or an organic entity), which a server-side tag manager does not have. Purchases need no auction context — only the order items and the opaque user ID — so they are the event type Signal can deliver reliably server-side. Report impressions and clicks from your storefront using Topsort’s JavaScript SDK alongside this integration.
Purchase item fields
Each product in the order maps to one element of the Topsort items array:
| Datafly product field | Topsort item field | Required |
|---|---|---|
product_id | productId | Yes |
price | unitPrice | Yes (must be greater than 0) |
quantity | quantity | No (defaults to 1) |
vendor_id | vendorId | No (set when a product is sold by multiple vendors, or for halo attribution) |
Example: Purchase Event
Datafly.js call:
datafly.track("Order Completed", {
order_id: "ORD-001",
total: 26.39,
currency: "USD",
products: [
{ product_id: "p_SA0238", name: "Whole Milk", quantity: 2, price: 12.95 },
{ product_id: "p_oajf2D", name: "Cookies", quantity: 1, price: 1.49 }
]
});Topsort Events API payload sent by Signal:
{
"purchases": [
{
"id": "ORD-001",
"occurredAt": "2026-06-06T12:59:59Z",
"opaqueUserId": "71303ce0-de89-496d-8270-6434589615e8",
"items": [
{ "productId": "p_SA0238", "quantity": 2, "unitPrice": 12.95 },
{ "productId": "p_oajf2D", "quantity": 1, "unitPrice": 1.49 }
]
}
]
}occurredAt is an RFC 3339 timestamp including a UTC offset, derived from the event time. opaqueUserId is Datafly’s anonymous_id.
Testing Your Integration
Trigger a test order
Complete a checkout on your storefront, or replay an Order Completed event from Signal’s event debugger.
Confirm a 204 response
In Signal’s event debugger, confirm the delivery to Topsort returned 204 No Content. A 204 means Topsort accepted the purchase.
Verify attribution in Topsort
In the Topsort Auction Manager dashboard, check that purchases are appearing and being attributed to campaigns. Attribution depends on the same opaqueUserId having been used in a prior auction, so allow time for the auction-to-purchase journey to complete.
Troubleshooting
| Problem | Solution |
|---|---|
401 Unauthorized | The API key is missing or invalid, or you used the Advanced key instead of the Marketplace key. Regenerate a Marketplace key under Settings > API Integration. |
400 Bad Request | A required field is missing. Every purchase needs id, occurredAt, opaqueUserId, and a non-empty items array; each item needs productId and a unitPrice greater than 0. Inspect the payload in Signal’s event debugger. |
| Purchases accepted (204) but not attributed | Attribution requires the same opaqueUserId to have appeared in a prior Topsort auction. Confirm your storefront’s auction calls use the same persistent identifier as Datafly.js. |
| Duplicate purchases | Topsort de-duplicates on the event id. Ensure each order has a stable, unique order_id that does not change if the event is resent. |
Rate Limits
Topsort accepts up to 50 events per array per request. Signal batches purchases automatically up to this limit; for most deployments the default settings are sufficient.