ExpressionEngine CMS
Open, Free, Amazing

Thread

This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.

The active forums are here.

Cookie Consent Module & First-Time Visitors

June 27, 2012 12:58pm

Subscribe [3]
  • #1 / Jun 27, 2012 12:58pm

    KMGDEV

    121 posts

    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.

  • #2 / Jun 27, 2012 2:57pm

    Andrew Fairlie

    126 posts

    Hi Kristen,

    You raise an interesting question.

    It’s worth noting that to recognise if this is their first time visiting or not, we need to set a cookie - it’s catch-22.

    However, at least in the UK the ICO (Information Commissioners Office) have outlined that implied consent is fine for most sites.

    The method we have been using is the cookie consent module plus our own just jQuery plugin. It’s really quite neat and can be seen (in an early beta state) on our site at http://redcarrot.co.uk

    If you can wait a few more days, I’ll be posting the source code for that and instructions on how to install over at our blog. I’ll try to post here once it’s up, else following us on Twitter would be a good avenue.

    We also wrote about the cookie law on .net Magazine’s site, which might help you out a wee bit: http://www.netmagazine.com/tutorials/master-cookie-law-expressionengine

  • #3 / Jun 27, 2012 4:39pm

    KMGDEV

    121 posts

    It’s worth noting that to recognise if this is their first time visiting or not, we need to set a cookie - it’s catch-22.

    Indeed. Although how does the CC Module remember if a user has chosen to disable cookies if not with a cookie?

    I would be very interested in your plugin, it sounds much more robust than the CC Module. I read your .net article, it was very informative! Sounds like you folks really know your stuff.

    Thanks for the reply, I look forward to trying your plugin.

    P.S. Your site is lovely 😊

  • #4 / Jun 27, 2012 5:41pm

    DanL

    56 posts

    You simply cannot remember the preference without setting a cookie, so catch 22 is correct 😊

    I recently used a combination of the CC module and a modified version of Silktide’s CC script (http://silktide.com/cookieconsent) on a website (http://www.strata-partners.com).

    I basically chose to show the Cookie “nag” with each page load.  There is no option to confirm and hide the message; if you want it to go, you have to accept all cookies for the site.

    The excellent CC module also made it easy to implement the system to revoke access & delete the cookies, which I was quite please with.

    I built this before ICO decided that implied consent was ok - so this is probably a more comprehensive example - most of the other sites I build have (or will have) a simple pop-up warning message, with a link to the policy.  Better than nothing 😉

    Feel free to grab & dissect the cookie script I used if it’s any help.  It’s quite good as it denies access to Google Analytics until access is granted, then triggers it to work immediately, so those stats are not lost.

    Good luck 😊

  • #5 / Jun 27, 2012 7:07pm

    KMGDEV

    121 posts

    Another helpful reply, DanL, thanks 😊

    There is no option to confirm and hide the message; if you want it to go, you have to accept all cookies for the site.

    That’s really the only option that makes any sense, plus it encourages users to accept cookies who may otherwise be disinclined.

    I built this before ICO decided that implied consent was ok - so this is probably a more comprehensive example - most of the other sites I build have (or will have) a simple pop-up warning message, with a link to the policy.

    Do you have a link to an article or something that confirms that? I’m tempted to do it that way, but want to make sure it’s actually allowed rather than saying “I heard it from a guy on the forums” on the witness stand after I’m brought to court :lol:.

    I don’t know how the EU governmental process works, but I would be shocked if this crazy law didn’t get revoked eventually.

  • #6 / Jun 28, 2012 1:30am

    KMGDEV

    121 posts

    Another aspect of this is conditionally displaying the alert based on what country the user is visiting from. People in the US shouldn’t have to be “nagged” by a cookie consent option that doesn’t apply to them.

  • #7 / Jun 28, 2012 4:47am

    DanL

    56 posts

    I think the key thing here is that they won’t just drop on you like a tonne of lead; warnings will be issued first advising you on non-compliance - they won’t just drop a massive fine on site owners.

    My attitude is do *something* (show a message and have a policy) so it doesn’t look like you’re totally ignorant, and see what happens - if you get advised it’s not sufficient, then spend a bit more time on a more complex solution.

    The whole thing is pretty ridiculous to be honest, I’m hoping it will go away but I’m not so sure it will.

    Also CC based on locality is also a good idea.  Let me know if you find a good way to do this, it’s not something I’ve investigated yet 😊

  • #8 / Jun 28, 2012 4:56am

    Andrew Fairlie

    126 posts

    I’ll find some time tomorrow and write up a blog post and release that plugin. It’s kind of built towards our needs (but you could adapt it to your own easily enough). It has a really simple JavaScript config script with a couple of boolean variables such as “cartthrob”, “membership” etc. so it automatically generates a cookie list and policy for that site’s spec.

    I think that plays quite nicely into DanL’s point (that I 100% agree with) that you should show a message and have a policy.

  • #9 / Jun 28, 2012 5:17am

    DanL

    56 posts

    I’ll find some time tomorrow and write up a blog post and release that plugin.

    Awesome, I look forward to seeing that.

  • #10 / Jun 28, 2012 12:11pm

    Dan Decker

    7338 posts

    Hi Kristen,

    I see you’ve had a nice discussion with Andrew and Dan here.

    At this point, is there anything I can do to help?

    Cheers,

  • #11 / Jun 28, 2012 1:34pm

    KMGDEV

    121 posts

    Hi Dan,

    I think I’m good. Andrew and Dan have shown me that I’m not the only one confused by this silly law, and that I probably don’t need to sweat it too much 😊

  • #12 / Jun 29, 2012 5:48pm

    Dan Decker

    7338 posts

    Kristen,

    Awesome!

    I’ll move this into Community Help for posterity.

    If you need anything else, just let me know!

    Cheers,

.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases