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

gaconsent

v1.0.19

Published

Easy handle cookies consent on homepage

Downloads

41

Readme

Easy google tags cookie accept/deny

Get the script

  • Using npm: npm install gaconsent --save

In your main start script (main.ts, index.js etc...)

new GAConsent('UA-XXXXXXXX-Y').init()

  • Replace with your own UA id.
  • Thats it! If you only use Google gtag on your page.
  • If you have other cookies, you can handle thoose too. Se options.

How it works

  • inject needed html, css and scripts to handle Google Analytics (gtag). Only UA are requiered
  • save user consent in localStorage
  • automatic delete Google Analytics cookies if consent changed
  • if options changed (eg. more cookies types or less) consent dialog are shown again
  • afterConsent function can be provided in options to handle other analytics, functional, commercial cookies
  • technical cookies are always shown as needed and can not be deselected
  • some texts, and styles (background, colors, font sizes etc.) can be changed (see options)

Options

Defaults

 options = {
  styles: {    
    dialogShowed: "bottom", // (bottom | center)
    pageColor: "rgba(155,155,155,.5)",
    dialogShadow: "3px 25px 27px -29px rgba(0,0,0,0.4)",
    dialogColor: "rgb(255,255,255)",
    fontSize: "16px",
    buttonFontSize: "18px",
    acceptBackgroundColor: "white",
    acceptColor: "black",
    showPreferencesBackgroundColor: "white",
    showPreferencesColor: "black",
    savePreferencesBackgroundColor: "white",
    savePreferencesColor: "black",
    cookieBackgroundColor: "rgb(250,250,250)",
    cookieTypeFontSize: "12px",
    cookieInfoFontSize: "12px",
    cookiePanelHeight: "60px",
    cookieCheckboxPadding: "8px",
  },
  texts : {
    textConsent: `This page use cookies. You can change which cookies you want to accept`,
    textPreferences: `Select cookies you want to accept`,
    textAnalytics: `Analytics cookies (__analytics__)`, // eg (1)
    textTechnical: `Technical cookies: (__technical__)`,
    textFunctional: `Functional cookies: (__functional__)`,
    textCommercial: `Commercial cookies: (__commercial__)`,
    textAnalyticsInfo: `The Website uses cookies that are used to provide with statistics.`,
    textTechnicalInfo: `The Website uses cookies that are solely for technical reasons.`,
    textFunctionalInfo: `The website uses cookies that are used solely to make the site more  ser-friendly.`,
    textCommercialInfo: `The website uses third-party cookies that are used to provide the user with relevant advertisements.`,
    showPreferencesButtonText: 'Preferences...',
    savePreferencesButtonText: 'Save',
    acceptButtonText: 'OK'
  },
  cookies: {
    analytics: {
      used: [
        {
          name: 'Google Universal Analytics',
          purpose: 'Collect statistical data for service improvement.',
          functions: 'Number of pageviews, link clicked etc. ',
          privacyLink: 'https://policies.google.com/privacy?hl=en'
        },
      ]
    },
    technical: {
      used: [
      ]
    },
    functional: {
      used: [
      ]
    },
    commercial: {
      used: [
      ]
    },
   }
  }

How to use own options:

new GAConsent('UA-XXXXXXXX-Y', {
    styles: {
        pageColor: "white",
        dialogColor: "gray"
    },
    actions: {
        afterConsent: (consent: IConsent) => {
            console.log(consent, "handle other (not gtag) cookies")
        },
    },
    texts: {
        text: "Example text",
        acceptButtonText: 'ExamleBotton'
    },
    cookies: {
        functional: {
            used: [
                {
                    name: 'xxxx xxxxxx xxxxxxx',
                    purpose: 'xxxx xxxx xxxx xxxx xxx xxxx.',
                    functions: 'xxxxx xxx xxxx, xxxx xxxx xxxx. ',
                    privacyLink: 'https://example.com'
                }
            ]
        }
    }
}).init()