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

safebanner

v0.2.1

Published

Lightweight cookie consent banner with Google Consent Mode v2. One script tag, under 10kb gzipped, zero dependencies.

Readme

safebanner

SafeBanner is a tiny cookie consent banner for developers. Free works with one script tag. Pro adds marked script blocking, consent expiry, and production customization for SaaS and client sites.

MIT License Bundle Size

This package ships a pre-built browser script, not an importable module. Use it via CDN or copy dist/safebanner.js to your own host.

Network requests: After the script loads, the free tier makes no additional network requests. Pro license validation and 40+ language support require a data-project-key attribute — only then does the script contact safebanner.com to verify the key and load translations. This applies regardless of where the script is hosted (jsDelivr, self-hosted, etc.). No end-user consent data is sent.

Free vs Pro

Free includes:

  • Cookie consent banner
  • Local browser storage (no hosted data)
  • Google Consent Mode v2
  • English, French, and German
  • SafeBanner branding

Pro adds:

  • Script blocking for Analytics and Marketing tags
  • Consent expiry and re-prompting
  • Remove "Powered by SafeBanner"
  • Logo, layouts, custom copy, and button labels
  • Auto theme and advanced styling
  • 40+ languages
  • License key for production and client projects

Upgrade: https://safebanner.com/upgrade?ref=npm_readme

Usage

CDN (recommended)

<script src="https://cdn.jsdelivr.net/npm/safebanner/dist/safebanner.js"></script>

Self-hosted

npm install safebanner

Then copy node_modules/safebanner/dist/safebanner.js to your public folder and serve it yourself.

Google Consent Mode v2 — load order matters

If you use Google tags, SafeBanner must load before them. Place it in <head> above your Google tag scripts:

<head>
  <!-- 1. SafeBanner FIRST -->
  <script src="https://cdn.jsdelivr.net/npm/safebanner/dist/safebanner.js"></script>

  <!-- 2. Google tag AFTER -->
  <script async src="https://www.googletagmanager.com/gtag/js?id=G-XXXXXXXX"></script>
</head>

Configuration

<script
  src="https://cdn.jsdelivr.net/npm/safebanner/dist/safebanner.js"
  data-position="bottom-right"
  data-theme="dark"
  data-color="#8b5cf6"
  data-company="Acme Inc"
  data-privacy="https://acme.com/privacy"
  data-lang="en"
  data-google-consent="advanced"
></script>

| Attribute | Values | Default | Notes | |-----------|--------|---------|-------| | data-position | bottom, top, bottom-left, bottom-right | bottom | | | data-theme | light, dark, auto | light | auto requires Pro | | data-color | Any hex color | #2563eb | | | data-company | Your company name | — | | | data-privacy | URL to privacy policy | — | | | data-lang | en, fr, de (free) · 40+ with Pro | en | | | data-google-consent | advanced, basic, off | advanced | | | data-project-key | Pro license key | — | Unlocks Pro enforcement and customization | | data-layout | bar, card | — | Pro only | | data-logo | Image URL | — | Pro only | | data-button-style | rounded, square, pill | — | Pro only | | data-banner-title | string | — | Pro only | | data-banner-description | string | — | Pro only | | data-consent-expiry-days | number | — | Pro only |

Pro script blocking

Mark Analytics or Marketing scripts with type="text/safebanner" and a consent category. SafeBanner Pro activates them only after matching consent is granted.

<script
  type="text/safebanner"
  data-consent="analytics"
  data-src="https://www.googletagmanager.com/gtag/js?id=G-XXXXXXXX"
  data-async
></script>

Use data-type="module" for module scripts. SafeBanner also preserves common script attributes such as id, nonce, integrity, crossorigin, and referrerpolicy when it activates a marked script.

JavaScript API

window.safeBanner.hasConsentFor('analytics') // true/false
window.safeBanner.getConsent()               // { necessary, analytics, marketing, timestamp }
window.safeBanner.updateConsent({ analytics: false })
window.safeBanner.onConsentChange((consent) => { ... }) // returns unsubscribe fn
window.safeBanner.reset()                    // clears consent, shows banner again
window.safeBanner.show()
window.safeBanner.hide()

License

MIT