Skip to main content

Duration of CookieConsent 2020



  • Hi ombline gilliot,

    By default the cookie that remembers a user's consent (CookieConsent) has a lifespan of 12 months.
    But, you could reduce or increase the duration of the CookieConsent cookie by adding this script to the page:

    <script type="text/javascript">
    window.addEventListener("CookiebotOnLoad", function() {
        var cookies = document.cookie.split(";"),
    d = new Date(),
          days = 365, // Define number of days after which the cookie should expire here
         utc = 0;

    d.setTime(d.getTime() + (days * 24 * 60 * 60 * 1000));
    var expires = "expires=" + d.toUTCString();

    for(i of cookies) {
    if (i.indexOf("CookieConsent") != -1) {
          utc = i.match(/(?:utc:)(\d{13})/)[1];
    utc && 2500 > utc - && (document.cookie = i + ";" + expires + ";path=/")

    However, you could also renew user consents manually from your CookieBot account. Just go to the menu point 'User consents', then choose the domain group and at the bottom of the page, you will find instructions and a button saying 'Renew now'.

    You could find more information about this topic at the following links:



  • Michael Kelly


    In Ireland the GDPR states that Cookie Consent should be no longer than 6 months. I See there is a script above to change the duration of the Cookie Consent. Can you please tell me, where to put this script? Should it be in the <head> with the Cookiebot script? and if so, is it put before or after the Cookiebot script?




  • Hi Michael Kelly,

    You could add the above mentioned script for reducing the duration of the CookieConsent cookie into the head tag of your site after the Cookiebot script (Cookiebot main script must be the first element to load in the head tag). 



  • Brian Mørkeberg Lundkvist

    As I understand from our product team this will soon make it into our solution as a built in feature. We expect to have this in place within the next month or two.

  • ombline gilliot


    I reduced the duration of the CookieConsent-Cookie to 6 months in the script, shouldn't the duration of the necessary cookie be "6 months" and not one year as shown on the attached screenshot ? "Expiration: 1 année"


Please sign in to leave a comment.