Developer docs

Put TheAd Vantage ads on your site with a script tag or the React library, and read your platform's impressions over the API.

Script tag

Works on any site: WordPress, Squarespace, static HTML or a custom app. No build step.

Add a slot and the script

Put a slot where the ad should appear, then load the script once per page. Your platform ID and API key are on your platform's page under My platforms.

<div
  data-thead-vantage
  data-platform-id="YOUR_PLATFORM_ID"
  data-api-key="YOUR_API_KEY"
  data-size="medium-rectangle"
></div>

<script async src="https://www.thead-vantage.com/embed.js"></script>

Slot attributes

AttributeValueRequiredDescription
data-thead-vantage—YesMarks the element as an ad slot.
data-platform-idstringYesYour platform ID.
data-api-keystringYesYour platform API key.
data-sizesee belowNoThe slot size. Defaults to medium-rectangle.

A slot missing data-platform-id or data-api-key is skipped and a warning is written to the browser console.

Sizes

  • medium-rectangle

    300×250

  • leaderboard

    728×90

  • wide-skyscraper

    160×600

  • banner

    468×60

Ads scale down to fit narrower containers and keep their proportions.

Slots added after the page loads

The script fills every slot on the page when it loads. If you add slots later, for example in a single-page app or infinite scroll, call refresh() after inserting them. Slots that already have an ad are left alone.

window.TheAdVantage.refresh()

How impressions and clicks are counted

  • An impression is recorded once at least 50% of the ad is visible in the viewport, and only once per ad shown.
  • Clicks are recorded when a visitor follows the ad's link, which opens in a new tab.
  • When no paid campaign is booked on your platform, the slot shows a TheAd Vantage house ad. House ads are never tracked or billed, so they don't count toward anyone's impressions or earnings.