Publishing

How to add an age gate or block visitors from some countries (Age gate & geo block)

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

  1. In the TeleportHQ editor, in the left sidebar, click Plugins.
  2. Under Site & platform, click Age gate & geo block. Its settings open in a drawer next to the list.

    The TeleportHQ Age gate & geo block drawer opened from Plugins, with the Age gate & geo block enabled switch highlighted above the Age gate settings
  3. Under Feature, click the Age gate & geo block enabled switch. The Turn on Age gate & geo block window opens.
  4. Read its three steps (For visitors, Added for you and Settings) with Next, or click Skip.
  5. 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.

SettingWhat it doesDefault
Ask visitors to confirm their ageOff shows no gate and keeps the country rule. The Age Gate component stays for later.On
Minimum ageThe age a visitor confirms, from 13 to 25.18
How visitors confirmA button, or Date of birth, which the visitor types and which is never stored.A button
Where the gate showsWhole site, or Chosen pages.Whole site
Gated pagesShown 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 forHow many days a confirmation lasts in that browser, from 1 to 365.30
Let search engines index gated pagesOff 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:

  1. Set Minimum age to 21.
  2. In How visitors confirm, choose Date of birth.
  3. In Where the gate shows, choose Chosen pages.
  4. Click No pages chosen and tick your shop pages, for example Shop and your product page.
  5. 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.

  1. In the left sidebar, click Pages, Components & Tree View.
  2. Under Components, open the Age gate & geo block folder and click Age Gate. The gate opens on the canvas.
  3. 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.

  1. In Country rule, choose Block the listed countries, or Allow only the listed countries. No country rule turns it off.
  2. 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.
  3. 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.
  4. 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:

  1. In the left sidebar, click Pages, Components & Tree View.
  2. 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:

  1. A visitor opens a page the gate covers. The gate shows on top of the page, and the page behind it doesn't scroll.
  2. 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.
  3. 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:

  1. In the left sidebar, click Plugins, then Age gate & geo block.
  2. 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."
  3. 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

Share

Related Articles

How to turn features on or off (Plugins)

In the TeleportHQ editor, click Plugins in the left sidebar, click a plugin such as Blog, Bookings or Authentication, and flip its "enabled" switch in the drawer that opens; the same drawer starts its tutorial, opens its panel, shows or hides its left-sidebar button and lists what needs attention, and flipping the switch again and confirming turns it off.

How to password-protect your site

On a TeleportHQ trial, or in any workspace without a paid subscription, every publish puts your site behind a 6-character password that you copy from Publish → Production → Password Protection and that stays until the workspace subscribes; on Pro or Premium the password is your choice, with Enable to add it and Remove to take it off.

How to publish your site

In TeleportHQ, click Publish at the top right of the editor, keep Production selected, and click Publish to Production; a progress bar beside the button shows each step, and after a few minutes your site is live on a free TeleportHQ address that you can share.

How to edit a component and update every copy

In TeleportHQ, double-click a component instance (or click the component in the Components folder) to open the main component in its own tab; every change you make there updates all its copies on every page.

How to hide a page from Google, set a canonical URL or redirect a page

In TeleportHQ, open a page's Page SEO Settings and turn on No Index to keep it out of Google, Custom Canonical to point search engines to another address, or Custom Redirect to send visitors elsewhere; hide the whole site with Show this site in search engines, and manage every redirect under Custom Redirects in Project settings → SEO & social → Search engines.

How to test changes on a staging site before going live

In TeleportHQ, open Publish → Staging and click Publish to Staging to put your changes on a private test address; when you are happy, go back to Production and click Make it live to serve that exact build on your live site without rebuilding.