This section explains how to configure the consent expiration in your cookie banner so that it automatically reappears after a specific time to request consent again.
In this example, the expiration is set to 6 months.
After this period, the banner will show again to collect updated consent.
Example Implementation
<script>
// === CONFIGURATION: set consent expiration time ===
// 6 months = 1000 ms * 60 s * 60 m * 24 h * 30 days * 6 months
var wait = 15552000000; // milliseconds for six months
function reopenWidget() {
if (!window.bigidcmp) return;
var consent = window.bigidcmp.getConsent();
if (consent.updatedAt < (Date.now() - wait)) {
window.bigidcmp.deleteConsent();
window.bigidcmp.showWidget();
}
}
if (window.bigidcmp && window.bigidcmp.getConsent && window.bigidcmp.showWidget) {
reopenWidget();
} else {
window.addEventListener('bigidcmp:widget_ready', reopenWidget);
}
</script>
How to Change the Expiration Period
You can easily customize how long consent remains valid by modifying the wait value.
This variable defines the duration in milliseconds before the banner reappears.
Duration | Formula Example |
|
|---|---|---|
1 week (default example) |
|
|
6 months (current example) |
|
|
12 months (1 year) |
|
|
Result
Once the defined expiration period passes, the stored consent is considered expired.
When users return to your website after that time, the cookie banner will automatically reappear to request their consent again.
