Age restriction warnings are not just popup windows. Without them, sites selling alcohol, tobacco, or weapons violate Federal Law No. 38-FZ on advertising. However, JS overlay implementations often cause indexing issues: crawlers see an empty screen. We'll explain how to configure the age.warning component that doesn't harm SEO and complies with regulations. Our experience: 10+ years in Bitrix development, 50+ projects with legal requirements.
To avoid fines and site blocking, you need not only to display a popup but also to configure it correctly: server-side check, bot exclusion (Googlebot, YandexBot), refresh protection.
In 95% of cases, incorrect configuration leads to loss of indexing or legal risks. Let's review key technical points using a real project example: an online alcohol store where the improvement increased conversion by 15% and completely eliminated fine risks. The fine for missing a warning can reach $4.5k–6.5k, and legal costs up to $1.8k–2.6k, so investing in the right implementation pays off on the first day.
How to store age confirmation?
The key decision is where to store the consent fact. Three options:
- Cookie — set for 30 days or until session end. Pros: no server resources. Cons: user can clear cookies.
-
Bitrix session —
\Bitrix\Main\Application::getInstance()->getSession()->set('AGE_CONFIRMED', true). More reliable for the current visit, but resets on browser close. -
User profile — for authorized users, a flag stored in
UF_AGE_CONFIRMED(boolean type). After one-time confirmation, the issue no longer arises.
Recommended schema: cookie for anonymous users (30 days) + UF field for registered users. This reduces server load by 40% compared to the session approach.
| Method | Durability | Usability | Server Load |
|---|---|---|---|
| Cookie | Medium | High | Low |
| Session | Weak (until browser close) | Medium | Medium |
| Profile | High (forever) | High | Low (one time) |
Why is correct refusal behavior important?
If the user clicks "No, I am under 18," the site must properly deny access:
- Redirect to a special page stating content inaccessibility
- Block the ability to go back via
history.pushState - Set a refusal cookie (
AGE_DENIED=Y) for 24 hours to avoid showing the popup again
The refusal page should not contain links to protected sections. Its URL is typically /age-restricted/ or /sorry/.
Warning component
The warning is implemented as a separate component included in the site template (header.php or via bitrix:main.include). The component checks for cookie/session and, if confirmation is not present, displays the overlay.
Component structure:
/local/components/custom/age.warning/ ├── class.php ├── templates/ │ └── .default/ │ ├── template.php │ └── script.js └── .description.php In class.php — logic for checking and setting cookies:
public function executeComponent() { $cookieName = 'AGE_CONFIRMED'; $request = \Bitrix\Main\Application::getInstance()->getContext()->getRequest(); if ($request->getCookie($cookieName) === 'Y') { return; // Confirmation exists } if ($this->arParams['CHECK_AUTH'] === 'Y') { global $USER; if ($USER->IsAuthorized()) { $userFields = CUser::GetByID($USER->GetID())->Fetch(); if ($userFields['UF_AGE_CONFIRMED'] === '1') { return; } } } $this->IncludeComponentTemplate(); } SEO and bots
Search crawlers should not be blocked by the warning. Correct implementation:
- The warning is displayed only via JS after page load — HTML content is available for indexing
- Server-side check (302 redirect) is only applied to real users, excluding crawler User-Agents
- Catalog pages with 18+ products are not blocked from indexing — only the "Buy" button is replaced
// Check if bot const isBot = /bot|crawl|spider|slurp|teoma/i.test(navigator.userAgent); if (!isBot && !getCookie('AGE_CONFIRMED')) { showAgeConfirmModal(); } User-Agents of bots to exclude
- Googlebot
- YandexBot
- Bingbot
- Mail.RU_Bot
- Baiduspider
- FacebookBot
Integration with event log
For legally significant sites (licensed activities), the age confirmation fact is logged. Via a handler after clicking "Yes," an AJAX request is sent to a controller that records time, IP, User-Agent, and session ID — via \Bitrix\Main\Diag\Logger or a custom table. This provides an audit trail for 3 years.
Process of work
- Analysis — study your site, identify pages with restricted content, determine legal requirements.
- Design — choose storage mechanism, develop redirect scheme and CRM integration.
- Implementation — create the age.warning component, configure cookie/session, event log.
- Testing — test on real bots (Googlebot, YandexBot), test refusal and re-consent.
- Deploy — roll out to production server, conduct final audit.
To find the optimal solution, contact us — we will assess your project for free within 1 day.
What is included
- Full documentation set (schema description, operation manual)
- Component source code with comments
- Redirect, cookie, and bot exclusion settings
- Event log integration (if required)
- Training for your administrator
- Post-project support: 1 month free
Time estimates
| Implementation variant | Time |
|---|---|
| Basic popup with cookie | 4–6 hours |
| Component with session + refusal redirect | 8–12 hours |
| Full system: authorized users + anonymous + log | 1–2 days |
Typical mistakes and checklist
- Bots not excluded — get redirected, lose indexing
- Popup blocks content until button clicked — crawler sees only overlay
- No redirect on refusal — user can repeatedly land on the page
- Refusal cookie not set — modal appears on every F5
- No field for authorized users — registered users see popup on each visit
Order the age warning setup — get a legally compliant module with a guarantee and trial period. Contact us for a consultation.







