So I’m building a site for a client in the UK and am working with the CC module for the first time. Here’s what I’m trying to do:
1. display a notification for first-time visitors alerting them about cookies and giving them the options to allow or disallow.
2. After the user has made their initial selection, the alert will not display again and their cookie preferences will be shown in the site footer.
What I can’t figure out is how to use the CC module to detect whether a user is a first-time visitor or not. I thought I could do something like this:
{exp:cookie_consent:message}
<div id="cookie-consent" {if cookies_allowed == ''}class="first-time"{/if}>
<!-- Cookie Notification Content -->
</div><!--/#cookie-consent-->
{/exp:cookie_consent_message}Then set the #cookie-consent div to “display:none;” via CSS and “display:block;” if the class of “first-time” exists. My logic was that since the user had not yet made a selection, the variables of “yes” or “no” for the “cookies_allowed” tag would not exist yet.
Unfortunately that conditional doesn’t output any code at all.
I’m confused about how this is supposed to work in general, as you don’t want to display the message to a user every time they visit the site if they’ve already made their choice. Any suggestions for this? Thanks.