Socket
Book a DemoInstallSign in
Socket

cookieless-analytics-consent

Package Overview
Dependencies
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

cookieless-analytics-consent

A simple solution to request consent from a user to use analytics for pageviews only (without using cookies).

0.0.8
latest
Source
npmnpm
Version published
Weekly downloads
8
700%
Maintainers
1
Weekly downloads
 
Created
Source

Intro

This library tries to provide general purpose components to include an analytics consent in your website. If the user accepts this consent, eg. google analytics will be included to track page-views. The structure of the components is designed for exchangeability.

Actually there are only three components available:

  • NextJsGaPageviews - Google Analytics integration for NextJs with storage none and ip anonymisation to track pageviews.
  • CookieGuard - Cookie guard to remember whether a user has accepted or rejected a consent.
  • SimpleConsent - A simple small ui component with a title, text and a reject and accept button. Its displayed by default on the bottom right.

Getting Started

npm i --save cookieless-analytics-consent

Documentation

Have a look at the example!

<NextJsGaPageviews analyticsId="YOUR_ID">
    {(includeAnalytics) => (
        <CookieGuard onIncludeAnalytics={includeAnalytics}>
            {(onAccept, onReject) => (
                <SimpleConsent onAccept={onAccept} onReject={onReject} content={{
                    title: 'Web analysis',
                    text: <Text />,
                    buttonRejectText: 'No thanks',
                    buttonAcceptText: 'Accept',
                }} />
            )}
        </CookieGuard>
    )}
</NextJsGaPageviews>

If you want your own ui component, then just replace SimpleConsent with another one.

Keywords

cookies

FAQs

Package last updated on 07 Jun 2020

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.