npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@topsort/banners-avolta

v0.1.0

Published

A web component for displaying Topsort banner ads.

Readme

Topsort Banners - Avolta Fork

This is a custom fork of @topsort/banners with additional fallback banner backfill support for Avolta's multi-store setup.

For general usage, configuration, attributes, and API reference, see the upstream documentation.

Usage

<script
  async
  type="module"
  src="https://unpkg.com/@topsort/banners-avolta/dist/banners.mjs"
></script>
<script async type="module" src="https://unpkg.com/@topsort/analytics.js"></script>
<script>
  window.TS = {
    token: "<your topsort api key>",
    storeCode: "<your store code>",
  };
</script>

For legacy systems that don't support ES modules:

<script src="https://unpkg.com/@topsort/banners-avolta/dist/banners.iife.js"></script>

Fallback Banner Backfill

When an auction returns fewer winners than available slots, the remaining slots can be backfilled with store-specific fallback banners. This is designed for setups where multiple websites share a single slot ID (e.g., "carousel") and each website has a unique store code.

How it works

  1. The auction API returns a special meta-winner with isFallback: true whose asset URL points to a JSON manifest
  2. The library fetches the manifest and looks up fallback entries by the configured storeCode
  3. Remaining slots are filled with banners from the manifest

If all slots are filled by real auction winners, no fallback fetch occurs.

Configuration

Add storeCode to your window.TS configuration:

window.TS = {
  token: "<your topsort api key>",
  storeCode: "133",
};

Fallback JSON manifest format

The manifest is a JSON object keyed by store code. Each store maps to an array of fallback banner entries:

{
  "133": [
    {
      "assetURL": "https://cdn.example.com/banner-clinique.jpg",
      "assetHref": "https://example.com/brands/clinique",
      "description": "Activate Your Glow with Clinique",
      "brandName": "Clinique"
    },
    {
      "assetURL": "https://cdn.example.com/banner-la-mer.jpg",
      "assetHref": "https://example.com/brands/la-mer",
      "description": "Refresh Your Regime with La Mer",
      "brandName": "La Mer"
    }
  ],
  "52": [
    {
      "assetURL": "https://cdn.example.com/banner-offers.jpg",
      "assetHref": "https://example.com/offers",
      "description": "Special offers"
    }
  ]
}

| Field | Type | Description | |-------|------|-------------| | assetURL | string | URL of the fallback banner image | | assetHref | string | Destination link for the banner | | description | string (optional) | Used as the <img> alt text | | brandName | string (optional) | Brand name for reference |

Rendering behavior

  • Fallback banners do not have a data-ts-resolved-bid attribute (no attribution tracking)
  • The description field from the manifest is used as the image alt text
  • Fallback banners use type: "url" with assetHref as the link destination

Graceful degradation

The fallback pipeline degrades gracefully in all failure scenarios:

  • All slots filled by real winners: no manifest fetch
  • No isFallback meta-winner in the response: remaining slots render nothing
  • storeCode not configured: remaining slots render nothing
  • Store code not found in the manifest: remaining slots render nothing
  • Fetch failure or malformed JSON: remaining slots render nothing
  • Fewer fallback entries than needed: fills what's available

Syncing with upstream

This fork tracks the original banners.js as upstream:

git fetch upstream
git merge upstream/main