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 🙏

© 2025 – Pkg Stats / Ryan Hefner

@barnardoswebteam/consent-banner

v0.5.0

Published

Barnardo's consent banner.

Readme

Barnardo's consent banner

Usage

Option 1: npm install / yarn add

Run npm install @barnardoswebteam/consent-banner or yarn add @barnardoswebteam/consent-banner.

In your code add the following:

const consentBanner = require('@barnardoswebteam/consent-banner');
consentBanner();

And add the GTM container ID in .env or as a config variable as GTM_CODE.

Optionally add URLs for your privacy policy and cookie policy in .env as PRIVACY_URL and COOKIE_URL. If no privacy URL is declared it defaults to https://www.barnardos.org.uk/privacy-notice, and if no cookie URL is declared it defaults to https://www.barnardos.org.uk/cookie-notice.

Option 2: ESM

In your HTML add the following:

<script type="module" src="main.js"></script>

and in main.js:

import consentBanner from './path/to/consent-banner.esm.js';
consentBanner();

And add the GTM container ID in .env or as a config variable as GTM_CODE.

Optionally add URLs for your privacy policy and cookie policy in .env as PRIVACY_URL and COOKIE_URL. If no privacy URL is declared it defaults to https://www.barnardos.org.uk/privacy-notice, and if no cookie URL is declared it defaults to https://www.barnardos.org.uk/cookie-notice.

Option 3: script element in HTML

Put the following near the end of the body element, replacing GTM-XXXXXX with the correct ID.

<script src="path/to/consent-banner.es5.js"></script>
<script>BarnardosConsent({'gtmCode':'GTM-XXXXXX'});</script>

Self hosting is recommended but if it's not possible you can use:

<script src="https://unpkg.com/@barnardoswebteam/consent-banner@latest/consent-banner.es5.js"></script>
<script>BarnardosConsent({'gtmCode':'GTM-XXXXXX'});</script>

Optionally add URLs for your privacy policy and cookie policy to the code like so:

<script>
BarnardosConsent(
  {
    'gtmCode': 'GTM-XXXXXX',
    'privacyURL': 'https://your-domain/privacy-policy',
    'cookieURL': 'https://your-domain/cookie-policy'
  }
);
</script>

Both are optional, and if either it missing they will default to https://www.barnardos.org.uk/privacy-notice and https://www.barnardos.org.uk/cookie-notice respectively.

Updating

Cloning this repo as a git submodule is recommended if not using NPM or Yarn. Watch this repository and run git pull from inside the submodule directory when there are changes. Otherwise watch this repository and perform manual updates.

Steps for creating a git submodule:

  1. cd to the directory the submodule will live.
  2. Type git submodule add -b main [email protected]:barnardos/consent-banner.git and press enter to add the submodule.
  3. Type git submodule init and press enter.
  4. cd out of the submodule into the parent repository.
  5. Add and commit the new files to the parent repository.

Safari and Firefox

Safari and Firefox now both delete scripted storage fairly quickly. In Safari's case it can be 24 hours. Therefore the consent banner is shown on repeat visits, which is making the banner even more annoying than it already is.

Therefore it's recommended re-setting the appropriate cookies with the server-side language of your choice, with a 1 year expiration. This has been cleared by the Barnardo's Head of Information Governance and Data Protection Officer.