WiscWeb - 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. These instructions assume that you already have a Google Cloud Platform account setup for your group and that your website is already launched. Note: reCAPTCHA is a type of CAPTCHA, developed by Google.

Important

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 web 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.

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

reCAPTCHA screen example

Creating a reCAPTCHA account

Note: 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.

  1. Open a new incognito or private browsing window in your browser

  2. Navigate to https://www.google.com/recaptcha/admin

  3. Type in your NetID email (netID@wisc.edu) into the "Email or Phone" field and click the blue Next button (reminder: you'll eventually be logging into a service account)

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

    Shibboleth login screen

  5. 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. 

  6. If asked what type of CAPTCHA account you want, choose reCAPTCHA enterprise. 

  7. You should now be logged in to Google's reCAPTCHA tool with your service account. If not already brought to the "Register a new site" page, click on the plus icon in the top right corner of the screen.

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

    Label field in Google's reCAPTCHA tool
  9. Choose the first option, Challenge (v2), from the reCAPTCHA type list and select the "I'm not a robot" option

    Radio buttons with the options "challenge" and "I'm not a robot" selected
  10. Click the plus sign (+) in the Domains list to add a new URL for your reCAPTCHA account (no need to add the https://).You may add more than one domain, if desired.

    Type in the domain for your reCAPTCHA account

  11. Note: If you have not yet launched your WiscWeb site, you will have to add your production domain to this list when you launch.

  12. In the Google Cloud Platform section, add a project name and choose an organization this should fall under. If you have not yet created a Google Cloud Platform (GCP), you will need to request one from the Cloud Services Team (i.e. don't use the default wisc.edu account). Once setup, your new GCP account should show up as an option in this list.
    Note: For UW-Madison websites, it is highly recommended that you get an official, supported GCP project, provisioned by the DoIT Cloud Services team. A UW Cloud Team provisioned GCP account/project will have a Google group as its primary Owner/principal, making it easy and simple to provide appropriate team access to the GCP project. Owners will have the ability to manage the users in the group.

    Google Cloud Platform settings within the reCAPTCHA setup

  13. Click the blue Submit button

  14. 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 (instructions below)

    reCAPTCHA keys in Google account

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.

  1. Copy the Site Key from your recently created reCAPTCHA account

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

  3. Click on Forms from the left navigation menu

  4. Choose Settings

  5. Choose reCAPTCHA

  6. Locate the reCAPTCHA Settings fields

    reCAPTCHA fields in the Gravity Forms settings

  7. Paste in site key into the Site Key field

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

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

  10. 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.

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

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

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

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

    Advanced field options in Gravity Forms

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

    CAPTCHA button in Gravity Forms

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

    reCAPTCHA screen example

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

Troubleshooting

  • 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.