How to check for age ate the gate but always allow Google to crawl your website?

This title was kind of a big question we had to ask ourselves when building the website for a alcohol brand. Around the world, the Netherlands included, we try to discourage younger people to consume beverages with alcohol in them. So websites that sell things like that have to adjust their marketing campaigns accordingly. 

Google Crawlers

Stopping someone from entering your website is not that hard. Pop a message in place by throwing it in a hook that loads first and then create a cookie to confirm the user is eligible so the rest of the pages know that too.

In that message ask for some details, birthdate in this case. Calculate their age from that and compare it to the minimum age set for that website. This returns a yes or no. Pretty much the same thing a bouncer of a nightclub would do when checking ID’s of potential costumers.

Bam. Now you got yourself an age gate. But a Google crawler is not that smart that it has a fake ID in his pocket so how do you deal with that?

So the bouncer that works the nightclub door sees the crawler in the distance and nudges it to a separate door built for people with some sort of a vip access. Yes, when a crawler is looking at the website the age gate should not be visible to the crawler so it can go to work.

But what if the bouncer doesn’t see the crawler in time? Well, then there is the fact that the entire website is laced with schema and the age gate is loaded last zo it only covers the page so the things below are not visible instead of totally replacing it.

I’ve tested some other age gates and found them not to be that friendly to crawlers. That’s why I’ve decided to write my own Super Simple Age Gate.