University of Wisconsin KnowledgeBase

WiscWeb - WordPress UW Theme - Adding CAPTCHA to Gravity Forms

This document will walk you through the process of creating a reCAPTCHA account for your site and adding the reCAPTCHA keys to Gravity Forms in your WiscWeb project. Note: reCAPTCHA is a type of CAPTCHA, developed by Google.

What is CAPTCHA?

CAPTCHA is a simple test that allows the browser to distinguish between a human user of your form and machine input by a bot. Adding it to your site forms will allow you to restrict submissions by bots, which will cut down on the amount of spam emails that come in to your department.

A lot of web forms offer CAPTCHA and the design of each can range from checking a box, identifying images, adding up numbers, or just retyping letters. Essentially, it is a test that is nearly impossible for a bot to successfully answer but simple for a human user to complete.

Here's an example of reCAPTCHA, the form we encourage you to use with your WiscWeb forms:

Creating a reCAPTCHA Account

Please note that we highly encourage you to set up your CAPTCHA account using a service account rather than a personal account. That way, if you were to leave your position, your team can still access and modify the information in the account. These steps will assume you are using a service account for this process.

Type your NetID email (netID@wisc.edu) into the "Email or Phone" field and click the blue Next button

You should be redirected to the Shibboleth login screen. Login with NetID credentials

You will be asked which account you'd like to sign into. The various options will appear in a bulleted list. Select the service account you'd like to set up the CAPTCHA account with.

You should now be logged in to Google's reCAPTCHA tool with your service account. (reCAPTCHA is a form of CAPTCHA, developed by Google). At the top of the page will be a list of the sites for which you've already setup reCAPTCHA. Scroll down and locate the section that says Register a New Site

In the Label field, type in the name of the website you'd like to add CAPTCHA for

Choose the first option, reCAPTCHA v2, from the reCAPTCHA options list

Type in the WiscWeb domain of the website you'd like to add CAPTCHA to. (Example: yoursitename.wiscweb.wisc.edu) You do not need to include the https://

You should also add your production domain to the list (Example: yoursitename.wisc.edu)

Check the box to accept the reCAPTCHA Terms of Service

Uncheck the box that says "Send alerts to owners"

Click the blue Register button

You will be brought to a new page which should show the new reCAPTCHA keys that you will need to copy and paste into your WiscWeb project

Adding reCAPTCHA Keys to Your WiscWeb Project

In order to be able to add CAPTCHA to your WiscWeb forms, you will have to first adding the reCAPTCHA Site and Secret Keys to your Gravity Forms settings.

Copy the Site Key from your recently created reCAPTCHA account

Navigate to your WiscWeb Dashboardfrom a different browser session. In this window, make sure you are logging in with your personal account credentials.

Click on Forms from the left navigation menu

Choose Settings

Scroll to the bottom of the page and locate the reCAPTCHA Settings area

Paste in site key into the Site Keyfield

Go back to your other browser window and copy the Secret Key from your new reCAPTCHA account

Navigate to your WiscWeb browser window and paste the secret key into the Secret Key field in the reCAPTCHA Settings

Click the blue Save Settings button

Including CAPTCHA in a Form

In order to include CAPTCHA in one of your forms, you will simply need to add this field to the form in your editing environment.

In WiscWeb, navigate to Forms by selecting it from the left navigation menu in the Dashboard

Choose the form to which you'd like to add CAPTCHA functionality

From the Editing environment, scroll down to where you'd like to add the CAPTCHA element (usually at the very bottom of the form).

From the menus on the right, open the accordion for Advanced Fields

Click and drag the CAPTCHA button and place it where you want in the form

If everything is set up correctly, your CAPTCHA field will show up as expected:

Make sure to click the blue Update button to save your changes to the form

Troubleshooting

If you try setting up your reCAPTCHA account with only your production domain and do not include your WiscWeb domain, you will receive an error when you try pasting the code into the Form Settings in WiscWeb. Make sure to include your WiscWeb domain (yoursitename.wiscweb.wisc.edu) when setting up the account.

If you do not copy and paste the entire site or secret key into the Forms Settings, you will see an error. Make sure you are copying and pasting the entire key before you continue.

If you do not save your changes in WiscWeb, the process will not work. Make sure to select the Save Settings button after pasting in your keys and make sure to select Update after adding the CAPTCHA button to your form.