Geolocation
This guide explains how to detect a user’s country and decide when AgeGO should be triggered based on geographic and regulatory requirements.
The solution supports:
One country
Multiple countries
A clear fallback logic when detection fails
Overview
AgeGO can be triggered only for users coming from specific countries, while users from other countries can access the content directly.
This setup allows you to:
Enforce age verification only where legally required
Reduce friction in countries where age verification is not mandatory
Use a single implementation for multiple geographies
You define:
Which country or countries require AgeGO
Which AgeGO
asishould be used for your domain
Prerequisites
Before implementing this logic, make sure you have:
An active AgeGO account
Your AgeGO
asi(alpha-numeric)A country detection method, such as:
Server-side geolocation
Client-side IP-based country detection
A CMP or analytics tool providing country code
Country codes must follow ISO 3166-1 alpha-2 format, for example:
IT (Italy)
FR (France)
ES (Spain)
DE (Germany)
Hide content of the web page:
Implementation / SetUp
HTML Structure
Wrap all content that should be gated by logic inside #general and keep it hidden initially.
Javascript Disable Fallback
Redirect users with disabled JavaScript.
Country Detection and Conditional Logic
Recommended Geolocation Priority
If you do not already have a country detection solution, we recommend using the following priority:
IP-based geolocation via geojs.io (primary)
IP-based geolocation via ipapi.co (fallback)
Browser language (last fallback only)
The first valid country code detected should be used.
Note: Browser language is less reliable and should only be used when IP-based methods are not available.
Important Notes About asi
The asi is an alpha-numeric identifier provided by AgeGO
It identifies your domain and configuration
It is not related to the country
Testing the Integration
You can simulate different countries during testing in Google Chrome DevTools - Console.
Simulate an enforced country
Simulate a non-enforced country
Reset the browser's memory
Key Notes & Best Practices
Always use ISO country codes
Keep country enforcement configurable, not hardcoded
Use comma-separated values for scalability
Make sure the same site ID is used consistently per domain
Country detection should happen before loading AgeGO
Summary
AgeGO can be conditionally enforced by country
One or multiple countries are supported
Configuration is simple and scalable
The same logic works for all markets
This approach allows you to remain compliant while maintaining the best possible user experience.
Last updated
Was this helpful?