Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.topsort.com/llms.txt

Use this file to discover all available pages before exploring further.

What is GAM Demand Mediation?

Earn incremental revenue from banner impressions that would otherwise go unfilled - without changing your existing Topsort setup.
When Topsort has no demand for a banner slot, we automatically return a Google Ad Manager (GAM) ad instead. You simply render it.
GAM mediation flow diagram showing the auction returning a GAM tag when no Topsort demand exists

Benefits

  • Monetize unsold inventory: Marketplaces can earn revenue from banner ad slots even when there is no Topsort demand
  • Flexible demand sources: Topsort can configure GAM placements to pull in demand from either open auction (non-endemic advertisers linking to other websites) or direct deals

Who is it For?

Any Topsort marketplace worldwide with banner ad slots.

Onboarding Process

If your marketplace is interested in GAM demand mediation, reach out to your Topsort account team.
A typical integration takes only a few hours of a marketplace engineer’s time to set up and can be done live on a single call with a Topsort integration engineer. The process follows these steps:
1

Align on pilot scope

Select 2-3 banner ad slots and agree on content moderation policies.
2

Set up GAM MCM connection

Link Topsort and retailer accounts, and update ads.txt and sellers.json. Topsort uses GAM’s Multiple Customer Management (MCM), which allows the Topsort GAM account to control other accounts (e.g., retailer accounts).
3

Implement passback flow

Simply add a very small code snippet to each ad slot to render either a Topsort ad or a GAM ad.
4

Testing

Topsort will validate the integration.

Example Response

When no Topsort demand is available for a banner slot enabled for GAM demand mediation, the auction endpoint returns a GAM snippet in the winner’s asset field. The retailer renders this snippet to display a GAM banner ad.
{
  "results": [
    {
      "resultType": "banners",
      "winners": [
        {
          "asset": [
            {
              "content": "{\"type\": \"gam_snippet\", \"content\": \"<div id=\\\"gam-ad\\\"><script>googletag.cmd.push(function() { googletag.display(\\\"div-gpt-ad-12345\\\"); });</script></div>\"}"
            }
          ],
          "type": "url",
          "id": "https://www.example.com",
          "resolvedBidId": "PHRSCwoQBpvFL1sveOSZBCyVii_LCRIQAAAAAAAAAAAAAAAAAAAAABoQAAAAAAAAAAAAAAAAAAAAACIbChdodHRwczovL3d3dy5leGFtcGxlLmNvbRAFUIDQzO7O7_H__wFyEAAAAAAAAAAAAAAAAAAAAAA",
          "rank": 1
        }
      ],
      "error": false
    }
  ]
}
Each entry in the asset array contains a content field with a JSON string of type gam_snippet. The retailer should parse this content and render the embedded HTML/JavaScript to display the GAM banner.

Passback flow

The only development required by the marketplace is to add a small code snippet to each ad slot they want to enable for GAM demand, so the page renders a GAM tag if one is returned; otherwise, it renders the Topsort ad.
// response is response from Topsort auction endpoint
const { results } = await response.json();
const passback = results?.[0]?.winners?.[0]?.metadata?.passbacktag;

if (passback) {
  const iframe = document.createElement("iframe");
  document.getElementById("banner-slot-3")?.appendChild(iframe);
  iframe.contentDocument.write(passback);
  iframe.contentDocument.close();
} else {
  // render normal Topsort ad
}