Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/chiiya/haven
🛡️ Fully-featured, GDPR-ready cookie consent manager
https://github.com/chiiya/haven
cookie-consent cookie-notification cookies eprivacy gdpr
Last synced: 6 days ago
JSON representation
🛡️ Fully-featured, GDPR-ready cookie consent manager
- Host: GitHub
- URL: https://github.com/chiiya/haven
- Owner: chiiya
- License: mit
- Created: 2019-09-04T14:21:50.000Z (about 5 years ago)
- Default Branch: master
- Last Pushed: 2022-08-16T12:14:56.000Z (about 2 years ago)
- Last Synced: 2024-10-23T06:53:09.998Z (15 days ago)
- Topics: cookie-consent, cookie-notification, cookies, eprivacy, gdpr
- Language: TypeScript
- Homepage: https://chiiya.github.io/haven/
- Size: 506 KB
- Stars: 75
- Watchers: 5
- Forks: 5
- Open Issues: 8
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
GDPR-ready cookie consent manager with zero dependencies.
# Overview
Haven is a simple-to-use cookie consent manager enabling GDPR and ePrivacy compliance with just a few lines of code. Haven comes with the following features included out of the box:| | Feature |
| ---- | ------------------------------------------------------------ |
| 📣 | **Cookie notification** for opt-in and opt-out strategies. |
| 🔧 | **Cookie preferences** enabling users to revoke or change their consent at any time. |
| 📥 | **Automatic injection of services** (google-analytics, google-tag-manager, facebook-pixel or any custom solution) at runtime, after the user has given their consent. |
| 🗑️ | **Removal of all tracking cookies** after a user has revoked their consent. |
| 📙 | **Translations** for multiple languages with easy customization. |
| 🤖 | Written in TS, and as such compatible with **ES5, ES6+ and TS** projects out of the box. |# Quickstart
## Installation
```bash
npm i @chiiya/haven -S
```## Usage
To use Haven in your project, either load the library via a `script` tag in your
HTML, or import it as a module in your Javascript.Script Tag
```html
Haven.create({
services: [
{
name: 'google-analytics',
options: {
id: 'UA-XXXXXXXX-1',
},
purposes: ['analytics'],
inject: true,
}
]
});```
ES5 Import
```javascript
var { Haven } = require('haven');Haven.create({
services: [
{
name: 'google-analytics',
options: {
id: 'UA-XXXXXXXX-1',
},
purposes: ['analytics'],
inject: true,
}
]
});
```ES6+ Import
```javascript
import Haven from '@chiiya/haven';Haven.create({
services: [
{
name: 'google-analytics',
options: {
id: 'UA-XXXXXXXX-1',
},
purposes: ['analytics'],
inject: true,
}
]
});
```With that, users will get a cookie notification asking for their consent. Google
Analytics will only be loaded once this consent has been given. Users may revoke
their consent at any time by using the settings injected into your privacy policy
page. Upon consent revoke, all tracking cookies set by Google Analytics will be
removed.For further information and configuration details, check out the
[documentation](https://chiiya.github.io/haven/).## Polyfills
Haven is compiled using [Babel](https://babeljs.io/) targeting browsers [with more than 1% of global usage](https://github.com/jshjohnson/Choices/blob/master/.browserslistrc) and expecting that all features listed below are available or polyfilled in browser:
```
Object.keys()
Object.values()
Object.assign()
String.startsWith()
Array.flat()
Array.forEach()
Set
```If you need to support a browser that does not have one of the features listed above, I suggest including a polyfill from [polyfill.io](https://polyfill.io/v3/):
``` html
```