/**
* All config. options available here:
* https://cookieconsent.orestbida.com/reference/configuration-reference.html
*/
CookieConsent.run({
cookie: {
name: c_h_cookies,
sameSite: 'Strict',
secure: true
},
categories: {
necessary: {
enabled: true, // this category is enabled by default
readOnly: true // this category cannot be disabled
},
analytics: {
services: {
ga: {
label: 'Google Analytics',
onAccept: () => {
// enable ga
},
onReject: () => {
// disable ga
},
cookies: [
{
name: /^(_ga|_gid)/
}
]
},
new_service: {
label: 'Another Service',
onAccept: () => {
// enable new_service
},
onReject: () => {
// disable new_service
}
}
}
}
},
language: {
default: 'en',
translations: {
en: {
consentModal: {
title: 'We use cookies',
description: 'Cookie modal description',
acceptAllBtn: 'Accept all',
acceptNecessaryBtn: 'Reject all',
showPreferencesBtn: 'Manage Individual preferences',
footer: 'Privacy Policy'
},
preferencesModal: {
title: 'Manage cookie preferences',
acceptAllBtn: 'Accept all',
acceptNecessaryBtn: 'Reject all',
savePreferencesBtn: 'Accept current selection',
closeIconLabel: 'Close modal',
sections: [
{
title: 'We use cookies',
description: 'This helps us to serve you better!'
},
{
title: 'Strictly Necessary cookies',
description: 'These cookies are essential for the proper functioning of the website and cannot be disabled.',
//this field will generate a toggle linked to the 'necessary' category
linkedCategory: 'necessary'
},
{
title: 'Performance and Analytics',
description: 'These cookies collect information about how you use our website. All of the data is anonymized and cannot be used to identify you.',
linkedCategory: 'analytics'
},
{
title: 'More information',
description: 'To learn more, please read our privacy policy'
}
]
}
}
}
},
onFirstConsent: ({cookie}) => {
// do something
},
onChange: ({cookie, changedCategories, changedPreferences}) => {
if(changedCategories.includes('analytics')){
if(CookieConsent.acceptedCategory('analytics')){
// the analytics category was just enabled
}else{
// the analytics category was just disabled
}
if(changedServices['analytics'].includes('Google Analytics')){
if(CookieConsent.acceptedService('Google Analytics', 'analytics')){
// Google Analytics was just enabled
}else{
// Google Analytics was just disabled
}
}
}
}
});