How to add an age gate or block visitors from some countries (Age gate & geo block)
In TeleportHQ, the Age gate & geo block plugin does two things on your published site. It asks visitors to confirm their age before they see the site, or only the pages you choose. And it keeps out visitors from the countries you list: they get your Unavailable page instead. To set it up, click Plugins in the left sidebar, click Age gate & geo block, turn on Age gate & geo block enabled, then choose the age and the country rule in the same drawer. Changes reach visitors when you publish.
Before you start
- Every plan has it. Age gate & geo block works on websites and web apps, doesn't turn a website into a web app, and adds nothing to your database.
- Role. You need a role that can change project settings: Owner, Admin or Designer.
- The country rule needs TeleportHQ hosting or your own Vercel account. See Where the country rule works.
- The age gate is a confirmation, not an ID check. Visitors confirm their age themselves. A date of birth is checked in the visitor's browser and never stored.
Turn on Age gate & geo block
- In the TeleportHQ editor, in the left sidebar, click Plugins.
Under Site & platform, click Age gate & geo block. Its settings open in a drawer next to the list.
- Under Feature, click the Age gate & geo block enabled switch. The Turn on Age gate & geo block window opens.
- Read its three steps (For visitors, Added for you and Settings) with Next, or click Skip.
- Click Turn on Age gate & geo block.
The Age Gate Ready window then says "Age gate & geo block is on. Visitors confirm their age in the Age Gate component, and blocked countries see the Unavailable page." Click Show the Age Gate to open the gate on the canvas, or Keep Editing. The drawer's Start tutorial plays a short tour of the plugin.
Turning the plugin on adds two things of your own, each in a folder named Age gate & geo block:
- The Age Gate component, in Pages, Components & Tree View under Components: the window that asks for the visitor's age. With the default settings, your published site shows it on every page until the visitor confirms.
- The Unavailable page, under Pages, at the address
/unavailable: what a visitor from a blocked country sees. It has your navigation and footer around the heading "Not available in your region", the line "This site is not available in your country." and "If you think this is a mistake, please get in touch with us."
The country rule starts off: no country is blocked until you choose one.
If your pages already have an age question, for example an "Are you over 18?" box, the Turn on window lists it under Use what your pages already have. Keep its switch on and the Age Gate component takes over its words and its age. An element is then removed; a page stays until you delete it.
Set up the age gate
The Age gate section of the TeleportHQ Age gate & geo block drawer holds the age rules. Its settings are greyed out until the plugin is on, and each change saves at once.
| Setting | What it does | Default |
|---|---|---|
| Ask visitors to confirm their age | Off shows no gate and keeps the country rule. The Age Gate component stays for later. | On |
| Minimum age | The age a visitor confirms, from 13 to 25. | 18 |
| How visitors confirm | A button, or Date of birth, which the visitor types and which is never stored. | A button |
| Where the gate shows | Whole site, or Chosen pages. | Whole site |
| Gated pages | Shown with Chosen pages only. Click No pages chosen and tick the pages the gate covers. A page with variable addresses, such as your product page, covers every one of them. | None |
| Remember for | How many days a confirmation lasts in that browser, from 1 to 365. | 30 |
| Let search engines index gated pages | Off adds a noindex tag to the gated pages. See Search engines. | On |
For example, to ask for a date of birth, 21 or older, on your shop pages only:
- Set Minimum age to
21. - In How visitors confirm, choose Date of birth.
- In Where the gate shows, choose Chosen pages.
- Click No pages chosen and tick your shop pages, for example Shop and your product page.
- Publish your site.
When you change Minimum age or How visitors confirm, TeleportHQ builds the gate's buttons again and says "The gate’s controls were built again for the new setting; its title, message, button words and Leave link stayed as you left them." The message the plugin wrote names the age, "You must be 18 or older to enter this site.", so change that number on the component yourself.
Change what the age gate says and how it looks
The TeleportHQ Age Gate component is yours: change its words, colors and layout like any other component.
- In the left sidebar, click Pages, Components & Tree View.
- Under Components, open the Age gate & geo block folder and click Age Gate. The gate opens on the canvas.
- Select the part you want to change and edit it in the right panel:
- the title, "Please confirm your age";
- the message, "You must be 18 or older to enter this site.";
- the button, "Yes, I'm 18 or older" (with Date of birth: the "Your date of birth" field and a Continue button);
- the Leave link. It goes to Google until you change its link to the address you want.
Above the canvas, a note reads "Your age gate: visitors confirm their age here before the site opens." Its Plugin settings button opens the Age gate & geo block drawer, and How it works plays the tour. See How to edit a component and update every copy.
Block or allow countries
The Countries section of the TeleportHQ Age gate & geo block drawer decides who may open your site, by the visitor's country, before a page is served.
- In Country rule, choose Block the listed countries, or Allow only the listed countries. No country rule turns it off.
- In Countries, type a two-letter country code, for example
RU, and press Enter. It shows as a chip; click its × to remove it. Add as many as you need. - In When the country is unknown, choose what happens to a visitor whose country can't be told: Let the visitor through (the default) or Treat as blocked.
- Publish your site.
Country codes are the standard two-letter ones: US for the United States, DE for Germany, FR for France. The United Kingdom is GB. A code that isn't two letters shows an error such as "USA" is not a valid country code.
Edit the Unavailable page
A visitor from a blocked country gets your TeleportHQ Unavailable page at the address they asked for, so the address in their browser stays the same. Edit it like any page:
- In the left sidebar, click Pages, Components & Tree View.
- Under Pages, open the Age gate & geo block folder and click Unavailable.
Above the canvas, a note reads "Your Unavailable page: visitors from blocked countries see it instead." The age gate never shows on this page. If you delete it, blocked visitors get a plain page that says "This site is not available in your country.", and the drawer offers to add the page again.
What visitors see
On your published TeleportHQ site, the age gate works like this:
- A visitor opens a page the gate covers. The gate shows on top of the page, and the page behind it doesn't scroll.
- With A button, they click "Yes, I'm 18 or older". With Date of birth, they type their date of birth and click Continue. If they're too young, the gate says "Sorry, you must be 18 or older to enter." and stays.
- The gate closes, and that browser isn't asked again for the Remember for days, on any page.
Visitors are asked again when they use another browser, clear their cookies, or when you change Minimum age. The Leave link takes them away from your site.
With a country rule, a blocked visitor never sees the gate or your pages: only the Unavailable page. Your site's pictures and files still load, so the Unavailable page looks right.
Search engines
- The age gate is a layer over the page, so search engines read the page itself. With Let search engines index gated pages off, the gated pages carry a noindex tag, which asks search engines not to list them.
- The country rule treats a search engine like any visitor. One that visits from a blocked country gets the Unavailable page, which asks not to be listed. Keep that in mind before you block, or leave out of Allow only the listed countries, the countries search engines visit from.
See How to hide a page from Google, set a canonical URL or redirect a page.
Where the country rule works
The TeleportHQ country rule runs before a page is served, using the visitor's country as the hosting reports it:
- On TeleportHQ hosting, your TeleportHQ address, your staging address and your custom domain all apply it.
- On your own Vercel account, it works the same way. See How to publish with your own Vercel account.
- On other hosting, for example downloaded Next.js code you host yourself, the site may not learn the visitor's country. Then every visitor counts as unknown, and When the country is unknown decides: everyone gets in, or everyone is blocked.
The age gate runs in the visitor's browser, so it works wherever your Next.js site runs.
Turn Age gate & geo block off
To pause one part, keep the plugin on: turn off Ask visitors to confirm their age to drop the gate, or set Country rule to No country rule to let every country in. Then publish.
To remove the plugin:
- In the left sidebar, click Plugins, then Age gate & geo block.
- Click Age gate & geo block enabled. The Disable Age gate & geo block window says: "This removes the Age Gate component, the Unavailable page and the country rules from the project. Your other pages are untouched."
- Click Disable Age gate & geo block.
Your changes to the Age Gate component and the Unavailable page go with them. Publish to take the gate and the country rule off your live site.
Troubleshooting
The TeleportHQ Age gate & geo block drawer lists problems under Needs attention, each with a button:
"The gate shows nowhere" Where the gate shows is Chosen pages, and no page is chosen. Click Show setting, then pick the pages in Gated pages, or choose Whole site.
"No countries listed" A country rule is on with no countries, so it does nothing yet. Click Show setting and add the two-letter codes.
"The age gate is missing" The Age Gate component was deleted, so the published site asks no one their age. Click Add the gate.
"No Unavailable page" The Unavailable page was deleted, so blocked visitors get a plain notice. Click Add page.
I changed a setting, but my live site hasn't Settings reach your live site when you publish. Publish again.
The gate shows a different age than my setting Changing Minimum age rebuilds the gate's buttons but keeps your title and message. Open the Age Gate component and change the age in the message.
Good to know
- The gate covers the languages of your site. A page you gate is gated in every language.
- Password protection is a different feature. It asks every visitor for a password. See How to password-protect your site.
- Other plugins. To turn other features on or off, see How to turn features on or off (Plugins).