Instrumenting web pages

This page explains how to enable and customize reCAPTCHA Enterprise API on your webpage. For more information about reCAPTCHA Enterprise, see the reCAPTCHA Enterprise overview

The reCAPTCHA Enterprise API returns a score for each request without user friction. The score is based on interactions with your site and enables you to take an appropriate action for your site.

Before you begin

Complete the steps in the Quickstart to gain access to the API.

Frontend integration

  <script src="https://www.google.com/recaptcha/enterprise.js?render=reCAPTCHA_site_key"></script>
  <script>
  grecaptcha.enterprise.ready(function() {
      grecaptcha.enterprise.execute('reCAPTCHA_site_key', {action: 'homepage'}).then(function(token) {
         ...
      });
  });
  </script>
  1. Load the JavaScript api with your sitekey.
  2. Call grecaptcha.enterprise.execute on an action or when the page loads.
  3. Send the token immediately to your backend with the request to assess.

Placement on your website

reCAPTCHA Enterprise will never interrupt your users, so you can run it whenever you like without affecting conversion. reCAPTCHA Enterprise works best when it has the most context about interactions with your site, which comes from seeing both legitimate and abusive behavior. For this reason, we recommend including reCAPTCHA verification on forms or actions as well as in the background of pages for analytics.

You can execute reCAPTCHA on as many actions as you want on the same page.

Actions

Read about the concept of Actions.

Create an Assessment

Make the request to create an assessment.