brainsum / cookieconsent

A Javascript based solution for blocking/allowing even 3rd party cookies to comply with GDPR
https://brainsum.github.io/cookieconsent/
ISC License
409 stars 89 forks source link

cconsent cookie expires after 7 days - can it be longer? #126

Open paulburgess opened 7 months ago

paulburgess commented 7 months ago

Hi, currenlty the preferences stored in the 'cconsent' cookie expire after 7 days so the user has to set them again. Is there a GDPR reason for that? I looked but couldn't see any option to alter that date via the options.

Is there a way to extend this to a year?

Many thanks!

MontiMarco92 commented 4 months ago

I don't see anything indicating the cconsent cookie to expire after 7 days. In fact, it's set to expire after a year.

setCookie(cookie, callback) {
    const expires_in = new Date(Date.now() + 365 * 24 * 60 * 60 * 1000).toUTCString();

    document.cookie = `cconsent=${JSON.stringify(cookie)}; expires=${expires_in}; path=/;`;
    window.CookieConsent.config.cookieExists = true
    if (callback) callback();
  }

image

But maybe I'm missing something. What do you think @l-besenyei ?