Mobile app version of vmapp.org
Login or Join
Speyer207

: Fixed position age verify using cookies without user agent sniffing I have built a simple age verification jQuery script for a particular brand of alcohol. It asks the user if they are of legal

@Speyer207

Posted in: #AgeVerification #Bing #Cookie #Google #Seo

I have built a simple age verification jQuery script for a particular brand of alcohol. It asks the user if they are of legal drinking age with a yes or no button. On yes the website stores a cookie and they no longer get that age verification for one month, simple stuff.

The age verification script fills the screen covering all elements behind it, using something like this:

.verify {
position: fixed;
top:0;
left: 0;
width: 100%;
height: 100%;
}


Obviously, this works superbly for users but for search engines, not so much. I'd like to be able to tell Google/Bing to click the yes button, but sadly, I know it's not that easy.

Without knives, daggers and hidden cloaks, how do I tackle this issue?

Please note that I'm aware of a similar question and what makes this question different is the specific setup in mind, not recommendations in general.

10.01% popularity Vote Up Vote Down


Login to follow query

More posts by @Speyer207

1 Comments

Sorted by latest first Latest Oldest Best

 

@Ogunnowo487

Google will likely see the overlay even if you delay it using a multi-second timer. When Googlebot processes JavaScript it seems to be able to skip over (or speed up) timeouts. In the past, I've tried generating output after a 30 second timer and checking what the "Fetch and Render" tool in GSC "sees". The Fetch and Render tool often returns "immediately" with the "timed" JS generated content already rendered.

But even if Googlebot "clicked yes", it won't store the cookie, so the overlay will be forever present. However, Googlebot can still potentially "see" what's underneath the overlay - but if the "user" can't then Google may choose to ignore it (these days)?

A couple of possibilities:


Block this particular JS file with robots.txt. Googlebot (or any "nice" bot) won't fetch and run this JS file so the overlay never appears.
Only display the overlay to user-agents that support cookies. Googlebot and most search engine bots don't support cookies. Since you are using a cookie as the trigger to hide (or "not show") the overlay, this would be a sensible check anyway.

Only display the overlay after you have confirmed the presence of a "test" cookie that is set unconditionally on the initial request. (You could perhaps issue an AJAX call to check for the "test" cookie, rather than waiting for the second request - if you want this overlay to appear as soon as? Although the second request might be soon enough.) Googlebot (and most search engine bots) won't set (or strictly speaking "return") the "test" cookie, so your check is never successful and the overlay never appears. This would also stop the overlay from repeatedly appearing for "power users" who have disabled cookies in their browser.

10% popularity Vote Up Vote Down


Back to top | Use Dark Theme