Show a cookie policy message/banner on your site
npm install --save tmw-cookiepolicy
// ES2015/ES6
import CookiePolicy from 'tmw-cookiepolicy';
// ES5
var CookiePolicy = require('tmw-cookiepolicy');
If you need a UMD/ES5 version, it has been provided. Use the CDN version at https://unpkg.com/[email protected]/umd/cookie-policy-umd.js or require it with an explicit path:
var CookiePolicy = require('tmw-cookiepolicy/umd/cookie-policy-umd');
var policyElement = document.querySelector('.cookiePolicy');
new CookiePolicy(policyElement, {
// options, defaults listed
policyName: 'policy-agreed',
// cookie name to check
policySeen: 'policy-seen',
// cookie name to check
expire: 30,
// in days
});
Use the template at https://github.com/tmwagency/cookie-policy/blob/master/template.html
Some basic styles for the banner can be found at https://github.com/tmwagency/cookie-policy/blob/master/cookiePolicy.css