Skip to main content
Topsort’s banners.js public library allows marketplaces to display banner ads through a low-code integration. By using a simple HTML tag, the marketplace can connect to Topsort’s ad server and render banners from active campaigns without complex integrations.

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:
Then import @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.
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. These functions on window.TS_BANNERS customize how banners are displayed. All of them are optional. The banner interface is the structure of a banner object. Each banner contains metadata about the campaign, and the resolvedBidId, the parameter needed for tracking user interactions (renders, impressions and clicks).