Installation
banners.js runs the auction and displays the banner. Load analytics.js with it, so that renders, impressions and clicks on the banner are reported. Install both with npm:@topsort/banners after setting up analytics.js as described on its page, with window.TS set before either library loads.
Or load them with <script> tags, setting window.TS first:
Usage
This example shows a minimal setup required to do it. The integration works with standard HTML and Javascript, making it compatible with most frontend stacks. To test it, you just need to add your Marketplace API Key and the banner slot id, configured in the campaign.Banner Attributes
These are the attributes available for the<topsort-banner> component. They serve as input to the auction request, to fetch the right winners for that context.
Set only one of
category-id, category-ids and category-disjunctions. If more than one is set, only the first in that order is used.
Banner Behaviors
These functions onwindow.TS_BANNERS customize how banners are displayed. All of them are optional.