This is where things do get complicated!
As you rightly say, essential cookies are permissible under GDPR. If there is a requirement to check a users age, then you would have to say the age gate cookie is essential.
But let’s look at it in detail should you want to block stuff and what the workflow would be.
From an Age Gate perspective, it’s impractical to bake that stuff in to the plugin (though a bit more on that in a minute as there are workarounds in the pipeline)
The way I have done consent (and example over on https://agegate.io) is to defer and JS loading until I have consent. That way if the agree everything is fired then, otherwise not. Not sure if the one you mention here would need a page refresh before the cookies kick in.
Now, to do these things with age gate there’s going to need to be two things happen, as we want to show it, but tell them they need the cookie. In this case my deferring method wouldn’t work as the JS wouldn’t trigger the age gate. (I said this would be complicated!)
So firstly we need to show a message if the cookie is not allowed, that’s easy enough with a nit of JavaScript:
// This should sit outside a document ready call
jQuery(document).on('agegateshown', function(){
if ( ! is_allowed_cookie( 'age_gate' ) ) {
jQuery('.age-gate-form').prepend('<div class="age-gate-error" style="display: block;"><p class="age-gate-error-message">You must allow the age verification cookies to verify your age</p></div>');
}
});
The next thing that’s required is to stop Age Gate setting a cookie if it’s not allowed. A big caveat is that this is currently not possible. However, I’m going to work on that today if I can.
Again, this is a little complicated, but age gate will support a similar hook system to WordPress in the javascript. This example is in no way going to be 100% final, but I’ll update it when it is (if it’s different).
There will be two things we need, the global ageGateHooks
and a filter called age_gate_set_cookie
.
The code for this will look a little bit like this:
function cookieAllowed(){
return is_allowed_cookie( 'age_gate' );
}
if(typeof ageGateHooks !== 'undefined'){
ageGateHooks.addFilter('age_gate_set_cookie', 'testApp', cookieAllowed);
}
Like I say some of this I need to build, but I have started it, just got to get it finished, and make sure it’s available in both versions. And make sure it’s the correct route (as I write this my brain has thought of potentially simpler ways!)
A final note on this is that in JavaScript mode, the ability to set the cookie won’t actually stop someone from passing the age gate a seeing the content. It’ll just reshow on every page.
Let me go away and look into the cookie prevention scripts. It’s definitely something that should be in there really so I’ll look to get it out as soon as possible.
Cheers
Phil