# Custom reCAPTCHA Page Guide

## Prerequisites

{% hint style="warning" %}
Please ensure that Netacea has configured and enabled CAPTCHA for your account. Also, ensure that the standard CAPTCHA page has been tested and can be served before implementing a custom CAPTCHA page.
{% endhint %}

Provided that the above prerequisites have been completed, a custom CAPTCHA page can be created by doing the following:

## HTML Page

To create an HTML page that will be used for serving CAPTCHA it may be beneficial to start with the Netacea Template HTML before adding the custom HTML code. The [templated page](#netacea-captcha-template) can be seen at the bottom of this document.\
\
Your custom HTML page can be designed per your specific requirements and/or company branding, however, the page must include the following code.\
\
**The following scripts should be within the document head element (`<head>...</head>`):**

```html
<link rel="stylesheet" href="https://assets.ntcacdn.net/Mitigations/captcha-1.0.0.css">
<script src="https://www.recaptcha.net/recaptcha/api.js" async defer></script>
```

**In addition, include the following code somewhere within the body (`<body>...</body>`):**

```html
<form id="frmCaptcha" action="" method="POST">
    <div class="g-recaptcha" data-sitekey="{{CAPTCHA_SITE_KEY}}" data-callback="showButton"></div>
    <br />
    <input type="submit" value="Submit" class="btn btnHidden">
    <input type="hidden" maxlength="40" id="hitid" name="hitid" value="{{TRACKING_ID}}">
</form>
```

**The below scripts must also be added at the end of, but still within the body (`<body>...</body>`):**

```html
<script src="https://assets.ntcacdn.net/Mitigations/fetch-polyfill-3.6.2.js"></script>
<script src="https://assets.ntcacdn.net/Mitigations/submit-captcha-2.0.2.js"></script>
```

{% hint style="warning" %}
Please note that certain links within the CAPTCHA page may not work if they are hosted behind the site that is being protected by Netacea.
{% endhint %}

### Netacea CAPTCHA Template

```html
<!DOCTYPE html>
<html lang="en">
<head runat="server">
    <meta name="viewport" content="initial-scale=1.0, width=device-width, maximum-scale=1.0" />
    <meta http-equiv="Cache-Control" content="no-cache, no-store, must-revalidate" />
    <meta http-equiv="Pragma" content="no-cache" />
    <meta http-equiv="Expires" content="0" />
    <title>Captcha Page</title>
    <link rel="stylesheet" href="https://assets.ntcacdn.net/Mitigations/captcha-1.1.1.css">
    <script src="https://www.recaptcha.net/recaptcha/api.js" async defer></script>
</head>
<body>
    <div class="wrapper">
        <header>
            <!-- header content -->
            <h1>Help us verify real visitors</h1>
            <!-- End of header  content -->
        </header>
        
        <!-- statement content -->
        <p>Please complete to continue</p>
        <!-- End of statement content -->

        <!-- Captcha Form, Do not change-->
            <form id="frmCaptcha" action="" method="POST">
                <div class="g-recaptcha" data-sitekey="{{CAPTCHA_SITE_KEY}}" data-callback="showButton"></div>
                <br />
                <input type="submit" value="Submit" class="btn btnHidden">
                <input type="hidden" maxlength="40" id="hitid" name="hitid" value="{{TRACKING_ID}}">
            </form>
        <!-- End of captcha form -->

        <div class="wrapper-values"></div>
    </div>
    <!-- The following two scripts MUST be at the end of the body -->
    <script src="https://assets.ntcacdn.net/Mitigations/fetch-polyfill-3.6.2.js"></script>
    <script src="https://assets.ntcacdn.net/Mitigations/submit-captcha-2.3.0.js"></script>
    <!-- End of scripts at the end of body -->
</body>
</html>
```

*Once the custom CAPTCHA page has been completed, please provide the completed CAPTCHA HTML page to Netacea. This will be uploaded to our servers and the new page will be used for any CAPTCHA pages served by the Netacea Bot Management solution.*

### Auto Completion of Captcha

Netacea also offer a reCAPTCHA page template where the captcha challenge is auto completed once the challenge has been completed by the user. If you wish to use this solution, please use the template below

```html
<!DOCTYPE html>
<html lang="en">
<head runat="server">
    <meta name="viewport" content="initial-scale=1.0, width=device-width, maximum-scale=1.0" />
    <meta http-equiv="Cache-Control" content="no-cache, no-store, must-revalidate" />
    <meta http-equiv="Pragma" content="no-cache" />
    <meta http-equiv="Expires" content="0" />
    <title>Auto-submit reCaptcha Custom Page</title>
    <link rel="stylesheet" href="https://assets.ntcacdn-uat.net/Mitigations/captcha-1.1.1.css">
    <script src="https://assets.ntcacdn-uat.net/Mitigations/fetch-polyfill-3.6.2.js"></script>
    <script src="https://www.recaptcha.net/recaptcha/api.js" async defer></script>
    <script src="https://assets.ntcacdn-uat.net/Mitigations/submit-captcha-2.3.0.js" async defer></script>
</head>
<body>
    <div class="wrapper">
        <header>
            <!-- header content -->
            <h1>Help us verify real visitors</h1>
            <!-- End of header  content -->
        </header>
        
        <!-- statement content -->
        <p>Please complete to continue</p>
        <!-- End of statement content -->

        <!-- Captcha Form, Do not change-->
        <form id="frmCaptcha" action="" method="POST" data-auto-submit>
            <div class="g-recaptcha" data-sitekey="{{CAPTCHA_SITE_KEY}}" data-callback="frmCaptchaCallback"></div><br /><input
                type="submit" value="Submit" class="btn btnHidden"><input type="hidden" maxlength="40" id="hitid"
                name="hitid" value="{{TRACKING_ID}}">
        </form>
    </div>
</body>
</html>
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.netacea.com/captcha/custom-recaptcha-page-guide.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
