-
-
Notifications
You must be signed in to change notification settings - Fork 376
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Bug]: Since 3.0.0-rc.17, CookieConsent.acceptService() does not work #602
Comments
|
I'my sorry, I forgot to add parameters In my case it was This is my config : const config = {
"disablePageInteraction": false,
"cookie": {
"name": "cookies_consent"
},
"guiOptions": {
"consentModal": {
"layout": "box wide",
"position": "bottom right",
"flipButtons": false
},
"preferencesModal": {
"layout": "box",
"position": "left",
"equalWeightButtons": false,
"flipButtons": false
}
},
onFirstConsent() {},
onConsent({ cookie }) {
if (cookie.categories.includes('ads')) {
if (window.gtag) window.gtag('consent', 'update', { ads_storage: 'granted' });
}
if (cookie.categories.includes('analytics')) {
if (window.gtag) {
window.gtag('consent', 'update', { analytics_storage: 'granted' });
window.gtag('send', 'pageview');
}
}
},
onChange: ({ changedCategories, changedServices, cookie }) => {
const { categories, services } = cookie;
for (const category in changedServices) {
if (changedCategories.includes(category)) !categories.includes(category) && location.reload();
for (const service of changedServices[category]) !services[category].includes(service) && location.reload();
}
},
onModalShow: ({ modalName }) => {
if (modalName !== 'preferencesModal') return;
const modal = document.querySelector('#cc-main .pm.pm--box');
modal.dataset.lenisPrevent = true;
},
"categories": {
"necessary": {
"readOnly": true,
"enabled": true,
"services": {
"wordpress": {
"label": "Wordpress",
"Se": false
},
"recaptcha": {
"label": "reCAPTCHA",
"Se": false
}
}
},
"features": [],
"analytics": {
"autoClear": {
"cookies": [
{
"name": {}
}
]
}
},
"ads": []
},
"language": {
"default": "en",
"autoDetect": "document",
"translations": {
"fr-FR": {
"consentModal": {
"title": "It's cookie time ! 🍪",
"description": "Notre site utilises des cookies pour mieux comprendre comment vous interagissez avec. Ce tracking ne sera activé que si vous l'acceptez explicitement. <a href=\"#privacy-policy\" data-cc=\"show-preferencesModal\" class=\"cc__link\">Gérer les préférences</a>",
"acceptAllBtn": "Accepter tout",
"acceptNecessaryBtn": "Accepter les cookies nécessaires",
"showPreferencesBtn": "Voir les préférences",
"closeIconLabel": "Fermer"
},
"preferencesModal": {
"title": "Préférences des cookies",
"acceptAllBtn": "Accepter tout",
"acceptNecessaryBtn": "Accepter les cookies nécessaires",
"savePreferencesBtn": "Enregistrer les préférences",
"closeIconLabel": "Fermer",
"sections": [
{
"description": "Notre site utilises des cookies pour mieux comprendre comment vous interagissez avec. Ce tracking ne sera activé que si vous l'acceptez explicitement."
},
{
"title": "Cookies strictement nécessaires",
"description": "Ces cookies sont essentiels au fonctionnement du site.",
"linkedCategory": "necessary",
"cookieTable": {
"headers": {
"name": "Service",
"description": "Description"
},
"body": [
{
"name": "Wordpress",
"description": "Wordpress dépose des cookies de navigation essentiels au fonctionnement du site."
},
{
"name": "reCAPTCHA",
"description": "reCAPTCHA collecte des informations des utilisateurs pour déterminer si ils sont humains ou non."
}
]
}
},
{
"title": "Cookies fonctionnels",
"description": "Ces cookies sont déposés par des services tierces intégrés au site.",
"linkedCategory": "features",
"cookieTable": {
"headers": {
"name": "Service",
"description": "Description"
},
"body": [
{
"name": "Google Maps",
"description": "Google Maps est utilisé pour afficher des cartes interactives."
},
{
"name": "Youtube",
"description": "Youtube est utilisé pour afficher des vidéos sur le site."
}
]
}
},
{
"title": "Mesure d'audience",
"description": "Analyser l’audience d’un site ou une application, mesurer la performance des contenus, tester des versions différentes en vue d’optimiser les choix éditoriaux.",
"linkedCategory": "analytics",
"cookieTable": {
"headers": {
"name": "Service",
"description": "Description"
},
"body": [
{
"name": "Google Analytics",
"description": "Nous collectons des données d'utilisation du site pour déterminer comment améliorer votre navigation et celle des autres utilisateurs."
}
]
}
},
{
"title": "Publicité",
"description": "Ces cookies permettent d’afficher des publicités adaptées aux intérêts et à la navigation des utilisateurs, pour qu’elles soient plus pertinentes et ainsi éviter la diffusion d'annonces que vous avez déjà vues.",
"linkedCategory": "ads",
"cookieTable": {
"headers": {
"name": "Service",
"description": "Description"
},
"body": [
{
"name": "Google Ads",
"description": "Nous collectons des données d'utilisation du site pour déterminer comment améliorer votre navigation et celle des autres utilisateurs."
}
]
}
}
]
}
},
"en": {
"consentModal": {
"title": "It's cookie time ! 🍪",
"description": "Our site uses cookies to better understand how you interact with it. This tracking will only be activated if you explicitly agree to it.<a href=\"#privacy-policy\" data-cc=\"show-preferencesModal\" class=\"cc__link\">Edit preferences</a>",
"acceptAllBtn": "Accept all",
"acceptNecessaryBtn": "Aceppt only necessary cookies",
"showPreferencesBtn": "See preferences",
"closeIconLabel": "Close"
},
"preferencesModal": {
"title": "Edit cookies",
"acceptAllBtn": "Accept all",
"acceptNecessaryBtn": "Aceppt only necessary cookies",
"savePreferencesBtn": "Accept preferences",
"closeIconLabel": "Close",
"sections": [
{
"description": "Our site uses cookies to better understand how you interact with it. This tracking will only be activated if you explicitly agree to it."
},
{
"title": "Necessary cookies",
"description": "These cookies are essential to the operation of the site.",
"linkedCategory": "necessary",
"cookieTable": {
"headers": {
"name": "Service",
"description": "Description"
},
"body": [
{
"name": "Wordpress",
"description": "Wordpress add navigation cookies necessary to navigate the site."
},
{
"name": "reCAPTCHA",
"description": "reCAPTCHA collects personal information from users to make this determination of whether they're human and not a bot."
}
]
}
},
{
"title": "Functional cookies",
"description": "These cookies are deposited by third party services integrated into the site.",
"linkedCategory": "features",
"cookieTable": {
"headers": {
"name": "Service",
"description": "Description"
},
"body": [
{
"name": "Google Maps",
"description": "Google Maps is used for displaying interactive maps."
},
{
"name": "Youtube",
"description": "Youtube is used for displaying videos."
}
]
}
},
{
"title": "Audience measurement",
"description": "Analyze the audience of a site or an application, measure the performance of content, test different versions in order to optimize editorial choices.",
"linkedCategory": "analytics",
"cookieTable": {
"headers": {
"name": "Service",
"description": "Description"
},
"body": [
{
"name": "Google Analytics",
"description": "We collect data on how you use our website so we can understand how to make it better for you, and our other visitors."
}
]
}
},
{
"title": "Ads",
"description": "These cookies allow us to display ads that are tailored to the interests and browsing habits of our users, so that they are more relevant and avoid showing ads that you have already seen.",
"linkedCategory": "ads",
"cookieTable": {
"headers": {
"name": "Service",
"description": "Description"
},
"body": [
{
"name": "Google Ads",
"description": "We collect data on how you use our website so we can understand how to make it better for you, and our other visitors."
}
]
}
}
]
}
}
}
}
} |
Happens to me as well. The problem is in this new batch of code: if(!categories){
enabledCategories = _acceptedCategories;
//{{START: GUI}}
enabledCategories = _preferencesModalExists && retrieveCategoriesFromModal();
//{{END: GUI}}
} else{
.
.
.
}
// Remove invalid and excluded categories
enabledCategories = enabledCategories.filter(category =>
!elContains(_allCategoryNames, category) ||
!elContains(excludedCategories, category)
); When |
@fmarencic you're spot on! |
So is this the reason I randomly get the following error: cookieconsent.js:7 Uncaught TypeError: i.filter is not a function Iframes still load, category toggles are still set in the consent modal, but the service toggle does not change. im_cookie is set, cc_cookie is not updated. I thought my setup was wrong, but it does not fail consistently. I can confirm the promblem is not present in CookieConsent 3.0.0-rc.15. I can provide my code but it works fine besides this. I love the cookieconsent/iframemanager plugins you are building, thanks a lot! Do these plugins have to be integrated separately or could the iframemanager and cookieconsent files be combined, since they interact and basically make up one great tool? I would prefer running one script file, one configuration file and one css file. Thanks |
@ifConditionTrue your are correct, this bug is happening to you as well. My solution for now was to downgrade to rc.16 version. I'm installing both CookieConsent and iframemanager through package manager and I'm loading them in one JS file (CSS and JS) where they're connected and integrated. So from my perspective, they are indeed one script file. |
fixed in baf6380 |
Expected Behavior
CookieConsent.acceptService()
, service must be accepted.Current Behavior
Steps to reproduce
CookieConsent.acceptService()
(with parameters, eg. :CookieConsent.acceptService('youtube', 'features')
)Proposed fix or additional info.
No response
Version
3.0.0-rc.17
On which browser do you see the issue?
Chrome
The text was updated successfully, but these errors were encountered: