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

@thisisfever/cookies

v1.0.1

Published

A simple, lightweight cookie consent system.

Downloads

12

Readme

Features

  • Only loads cookies after the user gives consent
  • Allows user preferences to be changed at any time via settings
  • Splits cookies into categories

Getting Started

CDN

To start using Fever Cookies right away, you can use the CDN to serve the files as close, and fast as possible to users.

Simply add the CSS & JS in your <head>:

<link rel="stylesheet" type="text/css" media="screen" href="//cdn.jsdelivr.net/npm/@thisisfever/cookies@1/dist/fever-cookies.min.css" />
<script src="//cdn.jsdelivr.net/npm/@thisisfever/cookies@1/dist/fever-cookies.min.js" defer></script>

NPM Package

Note: If you intend to use Fever Cookies with the CDN, you can skip this

  1. Install package via the following command:
    $ npm install @thisisfever/cookies
  2. Import core script to your JS using:
    import '@thisisfever/cookies/src/fever-cookies';
  3. Import core styling to your SCSS using:
    import "~@thisisfever/cookies/src/fever-cookies";

Usage

First you need to initilise Fever Cookies.

  1. Add the following in your <head>, below the CSS & JS:

    <script>
        window.addEventListener('load', function() {
            window.FeverCookies({
                settings_toggle: '.cookie-settings-btn',
                policy: {
                    link: '/cookies-policy/',
                    name: 'Cookies Policy',
                },
                optional_cookies: {
                    analytics: {
                        cookies: [],
                        onAccept: function() {
                           
                        },
                        onRevoke: function() {
                           
                        }
                    },
                    marketing: {
                        cookies: [],
                        onAccept: function() {
    
                        },
                        onRevoke: function() {
                               
                        }
                    }
                }
            });
        });
    </script>
  2. To start adding scripts, you can integrate in two ways, or a combination of both:

    1. Modify each script tag
    2. Add JS directly into Fever Cookies

    Modify Scripts

    To prevent a script from loading (unless the relevent category has been chosen by the user), you need to modify the script.

    We need to add data-cookie="[category] and type="text/plain" to the script tag.

    For example, Google Analytics would look like this:

    <script type="text/plain" data-cookie="analytics" async src="https://www.googletagmanager.com/gtag/js?id=UA-XXXXXXXX-X"></script>

    Important: For each category, you must fill in the the cookies: [] array with the names of the cookies used within that category.

    Add JS to Fever Cookies

    When you initialse the package, there is a optional_cookies object.

    optional_cookies: {
        analytics: {
            cookies: [],
            onAccept: function() {
               
            },
            onRevoke: function() {
               
            }
        },
        marketing: {
            cookies: [],
            onAccept: function() {
    
            },
            onRevoke: function() {
                   
            }
        }
    }

    For each category, you must fill in the the cookies: [] array with the names of the cookies used within that category.

    For example, Google Analytics would be:

    cookies: ['_ga', '_gid', '_gat', '_gat_gtag_UA_XXXXXXXX_X'],

    For any JS you wish to run when a category is accepted, add it directly to the category's onAccept.

    onAccept: function() {
        // This category has been accepted, run JS here
    },

    Likewise, you can add any JS you wish to run when a category has been revoked using onRevoke

    onRevoke: function() {
        // This category has been revoked, run JS here
    },

Options

window.FeverCookies accepts options to help tailor to each site.

| Option | Type | Required | Description | |---|---|---|---| | settings_toggle | string | Yes | Element selector. Can be either .class or #id | | optional_cookies | object | Yes | Triggers for each cookie category | | policy | object | No | Override default policy name & link. Accepts two keys; name link | | message | string | No | Override the default notice message |

Examples

See below for a full example:

<!-- Google Analytics Example - Remove unless needed -->
<script type="text/plain" data-cookie="analytics" async src="https://www.googletagmanager.com/gtag/js?id=UA-XXXXXXXX-X"></script>

<script>
    window.addEventListener('load', function() {
        window.FeverCookies({
            settings_toggle: '.cookie-button',
            policy: {
                link: '/cookies-policy/',
                name: 'Cookies Policy',
            },
            optional_cookies: {
                analytics: {
                    cookies: ['_ga', '_gid', '_gat', '_gat_gtag_UA_XXXXXXXX_X'],
                    onAccept: function() {
                        // Google Tag Manager Example - Remove unless needed
                        (function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':
                        new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],
                        j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src=
                        'https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);
                        })(window,document,'script','dataLayer','GTM-XXXXXXX');

                        // Google Analytics Example - Remove unless needed
                        window.dataLayer = window.dataLayer || [];
                        function gtag(){dataLayer.push(arguments);}
                        gtag('js', new Date());
                        gtag('config', 'UA-XXXXXXXX-X', { 'anonymize_ip': true });
                    },
                    onRevoke: function() {
                        // Disable Google Analytics
                        window['ga-disable-UA-XXXXXXXX-X'] = true;
                    }
                },
                marketing: {
                    cookies: ['_fbp', 'fr'], // Facebook Pixel Cookies - Remove unless needed
                    onAccept: function() {
                        // Facebook Pixel Example - Remove unless needed
                        !function(f,b,e,v,n,t,s)
                        {if(f.fbq)return;n=f.fbq=function(){n.callMethod?
                        n.callMethod.apply(n,arguments):n.queue.push(arguments)};
                        if(!f._fbq)f._fbq=n;n.push=n;n.loaded=!0;n.version='2.0';
                        n.queue=[];t=b.createElement(e);t.async=!0;
                        t.src=v;s=b.getElementsByTagName(e)[0];
                        s.parentNode.insertBefore(t,s)}(window, document,'script',
                        'https://connect.facebook.net/en_US/fbevents.js');
                        fbq('init', 'FACEBOOK_PIXEL_TRACKING_ID');
                        fbq('track', 'PageView');
                    },
                    onRevoke: function() {
                        // Facebook Pixel Example - Remove unless needed
                        fbq('consent', 'revoke');
                    }
                }
            }
        });
    });
</script>

Licence

ISC License

Copyright (c) 2021 This is Fever

Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted, provided that the above copyright notice and this permission notice appear in all copies.

THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.