Hiding or showing content based on consent
Cookiebot can automatically hide or show content based on the given consent by the website visitor. The visibility of elements is defined by a series of CSS-class names which you can use by each element:
.cookieconsent-optin | Visible when the visitor has given consent for 1 or more categories, otherwise hidden. |
.cookieconsent-optout | Visible when a visitor has not yet given consent or consent is given for necessary cookies, otherwise hidden. |
.cookieconsent-optout-preferences | Visible when a visitor has given consent for “preferences”, otherwise hidden. |
.cookieconsent-optout-statistics | Visible when a visitor has not given consent for “statistics”, otherwise hidden. |
.cookieconsent-optout-marketing | Visible when a visitor has not given consent for “marketing”, otherwise hidden. |
.cookieconsent-optin-preferences | Visible when a visitor has given consent for “preferences”, otherwise hidden. |
.cookieconsent-optin-statistics | Visible when a visitor has given consent for “statistics”, otherwise hidden. |
.cookieconsent-optin-marketing | Visible when a visitor has given consent for “marketing”, otherwise hidden. |
Example:
<div class="cookieconsent-optin-marketing">
This content is only visible if the visitor has given consent for marketing cookies.
</div>
<div class="cookieconsent-optout-marketing">To view this content, you should<a href="javascript: CookieConsent.renew()">accept marketing cookies.</a>.
</div>