0.0.8 • Published 4 years ago

cookieless-analytics-consent v0.0.8

Weekly downloads
3
License
MIT
Repository
github
Last release
4 years ago

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.

0.0.8

4 years ago

0.0.7

4 years ago

0.0.6

4 years ago

0.0.5

4 years ago

0.0.4

4 years ago

0.0.3

4 years ago

0.0.2

4 years ago

0.0.1

4 years ago