Yandex Cloud
Search
Contact UsGet started
  • Blog
  • Pricing
  • Documentation
  • All Services
  • System Status
    • Featured
    • Infrastructure & Network
    • Data Platform
    • Containers
    • Developer tools
    • Serverless
    • Security
    • Monitoring & Resources
    • ML & AI
    • Business tools
  • All Solutions
    • By industry
    • By use case
    • Economics and Pricing
    • Security
    • Technical Support
    • Customer Stories
    • Cloud credits to scale your IT product
    • Gateway to Russia
    • Cloud for Startups
    • Education and Science
    • Yandex Cloud Partner program
  • Blog
  • Pricing
  • Documentation
© 2025 Direct Cursus Technology L.L.C.
Yandex SmartCaptcha
  • Getting started
    • CAPTCHA availability
    • User validation
    • Domain validation
    • Challenge types
    • Challenge options
    • Widget connection methods
    • CAPTCHA keys
    • Invisible CAPTCHA
    • CAPTCHA in React
    • JavaScript Interface object
    • Restricted mode
    • Public IP addresses
    • Quotas and limits
  • Access management
  • Pricing policy
  • Terraform reference
  • Monitoring metrics
  • Audit Trails events
  • Release notes

In this article:

  • Connection algorithm
  • Data processing notice
  • Things to consider
  1. Concepts
  2. Invisible CAPTCHA

Invisible CAPTCHA

Written by
Yandex Cloud
Updated at September 19, 2024
  • Connection algorithm
  • Data processing notice
  • Things to consider

Invisible CAPTCHA is a way of connecting the SmartCaptcha widget without the "I’m not a robot" button on the page. Only users whose requests are considered suspicious by SmartCaptcha will see the challenge pop-up window.

The developer chooses when the service will check the user, for example, when clicking the submit button.

Invisible CAPTCHA is only connected using the advanced method.

Connection algorithmConnection algorithm

  1. Load the CAPTCHA using the advanced method.

    <script
      src="https://smartcaptcha.yandexcloud.net/captcha.js?render=onload&onload=onloadFunction"
      defer
    ></script>
    
  2. Render the CAPTCHA widget in invisible mode.

    <form id="form">
      <div id="captcha-container"></div>
      <input type="submit" />
    </form>
    
    <script>
    const form = document.getElementById('form');
    
    function onloadFunction() {
      if (!window.smartCaptcha) {
        return;
      }
    
      window.smartCaptcha.render('captcha-container', {
        sitekey: '<client_part_key>',
        invisible: true, // Making captcha invisible
        callback: callback,
      });
    }
    
    function callback(token) {
      form.submit();
    }
    </script>
    
  3. Call window.smartCaptcha.execute() when SmartCaptcha is to start validating the user. For example, when clicking the submit button.

    <form id="form">
      <div id="captcha-container"></div>
      <input type="submit" onsubmit="handleSubmit()" />
    </form>
    
    <script>
    const form = document.getElementById('form');
    
    function onloadFunction() {
      if (!window.smartCaptcha) {
        return;
      }
    
      window.smartCaptcha.render('captcha-container', {
        sitekey: '<client_part_key>',
        invisible: true, // Making captcha invisible
        callback: callback,
      });
    }
    
    function callback(token) {
      form.submit();
    }
    
    function handleSubmit(event) {
      event.preventDefault();
    
      if (!window.smartCaptcha) {
        return;
      }
    
      window.smartCaptcha.execute();
    }
    </script>
    

Data processing noticeData processing notice

By default, a page with an invisible CAPTCHA renders a shield with a link to the document: Notice on the terms of data processing by the service.

The shield is positioned in the bottom-right corner. To move the shield, use the shieldPosition parameter of the render method. For example:

window.smartCaptcha.render('captcha-container', {
  sitekey: '<client_part_key>',
  invisible: true,
  shieldPosition: 'top-left',
  callback: callback,
});

You can hide the shield by using the hideShield parameter of the render method.

Warning

You must notify users that their data is processed by SmartCaptcha. If you hide the notice shield, find another way to tell users that SmartCaptcha processes their data.

Things to considerThings to consider

  • Invisible CAPTCHA requires less memory than normal CAPTCHA because it doesn't load the code that renders the "I’m not a robot" button.

    However, the widget loading time may vary for users. This is why we recommend warning users about the CAPTCHA to avoid any confusion while they are waiting.

  • If a page has more than one widget, you need to provide widget ID to the execute method.

    Example
    <script
      src="https://smartcaptcha.yandexcloud.net/captcha.js?render=onload&onload=onloadFunction"
      defer
    ></script>
    
    <script>
      let widgetId;
    
      function onloadFunction() {
        if (!window.smartCaptcha) {
          return;
        }
    
        widgetId = window.smartCaptcha.render('captcha-container', {
          sitekey: '<client_part_key>',
          invisible: true, // Making captcha invisible
          callback: callback,
        });
      }
    
      function callback(token) {
        if (typeof token === "string" && token.length > 0) {
            // Send form to backend
            console.log(token);
            document.querySelector('form').submit()
        }
      }
    
      function handleSubmit(event) {
        if (!window.smartCaptcha) {
          return;
        }
    
        window.smartCaptcha.execute(widgetId);
      }
    </script>
    
    <form id="form">
      <div id="captcha-container"></div>
      <button type="button" onclick="handleSubmit()">Submit</button>
    </form>
    

Was the article helpful?

Previous
CAPTCHA keys
Next
CAPTCHA in React
© 2025 Direct Cursus Technology L.L.C.