Tag Managers

Google Tag Manager

Deploy UCAPTCHA through GTM without touching your site's code — and optionally limit it to fire only on specific pages, like your contact page.

â„šī¸ Before you start: You'll need Google Tag Manager already installed on your website, and a UCAPTCHA account with a site key. If you don't have a site key yet, create one here.

Part 1 — Create the UCAPTCHA tag

1

Open Google Tag Manager

Go to tagmanager.google.com and open the workspace for the website you want to protect.

2

Add a new tag

  1. In the left sidebar, click Tags
  2. Click New in the top right
  3. Click Tag Configuration to choose a tag type
  4. Scroll down and select Custom HTML
3

Paste the UCAPTCHA snippet

In the HTML field, paste the following. Replace YOUR_SITE_KEY with your actual UCAPTCHA site key.

<script>
window.UCAPTCHA_SITE_KEY = 'YOUR_SITE_KEY';
(function() {
  var s = document.createElement('script');
  s.src = 'https://www.ucaptcha.site/captcha-widget.js';
  document.head.appendChild(s);
})();
</script>
💡 GTM strips data-* attributes from custom HTML tags, which is why we use window.UCAPTCHA_SITE_KEY instead of a data-site-key attribute. UCAPTCHA automatically looks for this global variable as a fallback.
4

Name the tag

Click the pencil icon in the top left and give your tag a descriptive name, such as UCAPTCHA — All Forms or UCAPTCHA — Contact Page.

Part 2 — Set up a trigger

A trigger tells GTM when to fire your tag. You have two options: fire on every page, or fire only on specific pages like your contact page.

Option A — Fire on all pages

Use this if you have forms on multiple pages and want UCAPTCHA to protect all of them.

  1. In the tag editor, click Triggering
  2. Click the + button to add a trigger
  3. Select All Pages (this is a built-in trigger)
  4. Click Add

Option B — Fire only on your contact page

Use this if you only want UCAPTCHA on a specific page — for example, /contact. This is more efficient and avoids loading the widget on pages that don't have forms.

Step 1 — Create a new trigger

  1. Click Triggering in the tag editor
  2. Click the + button, then click + again in the top right to create a new trigger
  3. Click Trigger Configuration
  4. Select Page View as the trigger type

Step 2 — Configure the page condition

  1. Under This trigger fires on, select Some Page Views
  2. In the condition row, set the three fields as follows:
FieldOperatorValue
Page URLcontains/contact
💡 Examples of Page URL conditions:
â€ĸ contains /contact — matches example.com/contact and example.com/contact-us
â€ĸ equals https://example.com/contact — matches only that exact URL
â€ĸ matches RegEx /contact|get-in-touch — matches either page

Step 3 — Save the trigger

  1. Give the trigger a name like Contact Page
  2. Click Save
  3. You'll be taken back to the tag editor with the new trigger applied

Part 3 — Publish your changes

1

Save the tag

Click Save in the tag editor to save your tag and trigger configuration.

2

Preview and test

  1. Click Preview in the top right of GTM
  2. Enter your website URL and click Connect
  3. GTM will open your site in a new tab with the Tag Assistant panel
  4. Navigate to your contact page and confirm the UCAPTCHA tag appears under Tags Fired
  5. You should see the UCAPTCHA checkbox inside your contact form
3

Submit and publish

  1. Close the preview and click Submit in the top right of GTM
  2. Add a version name like Add UCAPTCHA and click Publish
💡 Your tag is not live until you click Publish. Always publish after making changes in GTM.

Protecting multiple specific pages

If you want UCAPTCHA on several pages but not all of them, you have two options:

Add multiple conditions to one trigger

In the trigger configuration, click + to add more conditions and set the logic to OR:

FieldOperatorValue
Page URLcontains/contact
Page URLcontains/get-a-quote
Page URLcontains/newsletter

Use a RegEx condition

For a cleaner setup, use a single RegEx condition:

FieldOperatorValue
Page URLmatches RegEx/contact|get-a-quote|newsletter