### [Setting Up Cloudflare Turnstile](https://wpforms.com/docs/setting-up-cloudflare-turnstile/)

**Published:** November 23, 2023
**Author:** David Ozokoye

**Excerpt:** Learn how to set up Cloudflare Turnstile CAPTCHA-like solution to prevent spam submission.

**Content:**

Would you like to use Cloudflare Turnstile to help prevent spam submissions in your WordPress forms? Cloudflare Turnstile is a free, CAPTCHA-like alternative that offers a user-friendly experience by confirming visitors are real humans without showing them any puzzles.

This tutorial will show you how to set up and use Cloudflare Turnstile with WPForms.

- [Generating Cloudflare Turnstile API Keys](#generating-api-keys)
- [Adding Cloudflare Turnstile to a Form](#adding-turnstile-to-form)
- [Testing Cloudflare Turnstile](#testing-turnstile)
- [Viewing Spam Entries](#view-spam-entries)
- [Frequently Asked Questions](#faq)

---

Before you get started, ensure WPForms is [installed and activated](https://wpforms.com/docs/install-wpforms-plugin/) on your WordPress site.

## Generating Cloudflare Turnstile API Keys

To start, log in to your WordPress admin area and go to **WPForms » Settings**. Then click on the **CAPTCHA** tab.

![WPForms CAPTCHA settings](https://wpforms.com/wp-content/uploads/2023/10/wpforms-captcha-settings.png "WPForms CAPTCHA Settings")To configure Cloudflare Turnstile, select the **Turnstile** option.

![Select Turnstile option](https://wpforms.com/wp-content/uploads/2023/10/select-cloudflare-turnstile.png "Select Turnstile Option")Once selected, additional settings will appear. You’ll need to generate a set of API keys from your Cloudflare account to connect it with WPForms. Leave this browser tab open and proceed to the next step.

### Adding Your Site in Cloudflare

To begin, you’ll need to [log in to your Cloudflare account](https://dash.cloudflare.com/login). Once you’ve logged in, select the **Turnstile** menu and click on **Add widget**.

![Click add site button](https://wpforms.com/wp-content/uploads/2023/11/cloudflare-add-new-widget-1024x474.png "Click Add Site Button")Next, you’ll see an option to enter your site name in the **Widget name** field. This name is for internal use only to help you identify widgets on your Cloudflare account.

![](https://wpforms.com/wp-content/uploads/2023/11/enter-widget-name-cloudflare-1024x507.png "Enter Your Site Name")Next, under **Hostname Management**, click the **+ Add Hostnames** button.

![](https://wpforms.com/wp-content/uploads/2023/11/add-hostnames-1024x592.png)A sidebar will appear where you can add your site. In the **Add a custom hostname** field, type your domain name (for example, `example.com`) and click the **Add** button next to it.

![](https://wpforms.com/wp-content/uploads/2023/11/add-hostname-cloudflare-1024x699.png)Once it appears in the list, click the **Add** button at the bottom of the panel to confirm.

![](https://wpforms.com/wp-content/uploads/2023/11/add-hostname-cloudflare-2-1-1024x654.png)You can add multiple websites in the **Hostname Management** section. This allows you to use one set of API keys on multiple websites.

After that, scroll down to the **Widget Mode** section. We recommend keeping this set to Managed, which is the default option.

![Select widget type](https://wpforms.com/wp-content/uploads/2023/02/select-widget-type.png "Select Widget Type")- **Managed:** This option allows Cloudflare to decide whether to show an interactive challenge or automatically verify the user based on their browser data and interaction.
- **Non-interactive:** This option will show the CAPTCHA widget on your website’s frontend. However, it doesn’t require user interaction. Cloudflare will automatically run the challenge and verify the user.
- **Invisible:** This option runs in the background and requires no interaction from the user.

After choosing your widget type, click the **Create** button to add your site.

![Click the create button](https://wpforms.com/wp-content/uploads/2023/02/create-site.png "Click the Create Button")This would generate a unique set of API keys for your website.

![](https://wpforms.com/wp-content/uploads/2023/11/cloudflare-secret-keys-1024x771.png "Cloudflare Site Key and Secret Key")You’ll need to copy the **Site Key** and **Secret Key** from Cloudflare. Then head back to your WPForms settings page, and paste each key into its corresponding field.

![Paste site key and secret key values in WPForms settings](https://wpforms.com/wp-content/uploads/2023/02/enter-site-key-and-secret-key.png "Paste Site Key and Secret Key Values in WPForms Settings")Once you’ve added both keys, proceed to configure additional settings for the Cloudflare Turnstile CAPTCHA.

### Configuring Additional Settings

Below the Secret Key, you’ll find the option to update the **Fail Message**. This is the message displayed when a user attempts to submit a form without completing the Cloudflare Turnstile verification challenge.

![Configure fail message](https://wpforms.com/wp-content/uploads/2023/02/configure-fail-message.png "Configure Fail Message")Next, choose the style you’d like the widget to use from the **Type** dropdown. Available options are: Auto, Light, and Dark.

![Select Captcha type](https://wpforms.com/wp-content/uploads/2023/02/select-captcha-type.png "Select Captcha Type")Using the default **Auto** mode for your widget will toggle between Light and Dark mode depending on the user’s device settings.

After choosing the CAPTCHA type, you’ll find the **No-Conflict Mode** settings. If Cloudflare Turnstile is being loaded more than once on your site (for example, by both WPForms and your WordPress theme), this can prevent the Turnstile CAPTCHA from working properly.

![Preview and no-conflict mode](https://wpforms.com/wp-content/uploads/2023/10/no-conflict-turnstile.png "Preview and No-Conflict Mode")No-Conflict Mode will remove any Cloudflare Turnstile code that’s not loaded by WPForms. However, we highly recommend [getting in touch with our support team](https://wpforms.com/contact/ "Contact WPForms support") if you’re at all unsure whether to use this option.

Next, you’ll see the **Preview** section. This shows how the CAPTCHA widget will look on your website’s frontend.

**Note:** You’ll need to save your settings before you can see a preview of the widget.

When you’re ready, go ahead and click the **Save Settings** button.

![Click save settings button](https://wpforms.com/wp-content/uploads/2023/10/save-settings.png "Click Save Settings Button")After saving your settings, you should see a preview of the Cloudflare Turnstile widget.

![Cloudflare Captcha preview](https://wpforms.com/wp-content/uploads/2023/02/preview-cloudflare-turnstile.png "Cloudflare Captcha Preview")## Adding Cloudflare Turnstile to a Form

Now that you’ve set up your keys, you’ll be able to enable Cloudflare Turnstile on any of your forms.

For this, go ahead and [create a new form](https://wpforms.com/docs/creating-first-form/) or edit an existing one to access the form builder. Next, look under **Standard Fields** and select the **Turnstile** field.

![Adding Turnstile to a form](https://wpforms.com/wp-content/uploads/2023/02/add-turnstile-field.png "Adding Turnstile to a Form")Alternatively, you can always enable or disable Cloudflare Turnstile for a form by going to **Settings » Spam Protection and Security** in the form builder.

![Spam protection and security settings](https://wpforms.com/wp-content/uploads/2022/10/spam-protection-settings.png "Spam Protection and Security Settings")Under the **Protection** section, you can enable the **Store spam entries in the database** option if you’d like to review spam entries before deleting them from the entries page.

![Store spam entries in the database option](https://wpforms.com/wp-content/uploads/2023/07/store-spam-entries-in-database.png "Store Spam Entries in the Database Option")Enabling this option allows all submissions, including those flagged as spam by Cloudflare Turnstile.

The **Enable minimum time to submit** option helps prevent bot submissions by setting a minimum time before submissions are allowed on the form. See our [spam prevention](https://wpforms.com/docs/how-to-prevent-spam-in-wpforms/#minimum-time) guide for more details.

Next, scroll down to the **CAPTCHA** section and toggle the **Enable Cloudflare Turnstile** option to the on position.

![Enabling Cloudflare Turnstile in the spam protection settings](https://wpforms.com/wp-content/uploads/2023/02/enable-cloudflare-turnstile.png "Enabling Cloudflare Turnstile in the Spam Protection Settings")To confirm that Cloudflare Turnstile is enabled, look for the **Turnstile** badge in the upper right corner of the form builder.

![Turnstile badge in the form builder](https://wpforms.com/wp-content/uploads/2023/02/turnstile-enabled-badge.png "Turnstile Badge in the Form Builder")**Note:** If no badge appears in your form builder, ensure you’ve correctly [set up your Cloudflare Turnstile API keys](#generate-api-keys).

## Testing Cloudflare Turnstile

The last step is to run a quick test to ensure that Cloudflare Turnstile looks and works how you expect.

To test it out, you’ll simply need to submit an entry to your form. For more details on how to test out your forms, please check our [full form testing checklist](https://wpforms.com/docs/how-to-properly-test-your-wordpress-forms-before-launching-checklist/).

## Viewing Spam Entries

If you enabled the spam entry storage option, you’ll be able to view entries identified as spam from the Entries page.

There is also an option to recover entries that may have been mistakenly flagged as spam by Cloudflare Turnstile.

![Spam detected by Cloudflare Turnstile](https://wpforms.com/wp-content/uploads/2023/08/spam-detected-by-cloudflare-turnstile-1.png "Spam Detected by Cloudflare Turnstile")For a detailed guide, please see our tutorial on [viewing and managing spam entries](https://wpforms.com/docs/viewing-and-managing-spam-entries/).

## Frequently Asked Questions

These are answers to some top questions about setting up Cloudflare Turnstile with WPForms.

#### Can I see Turnstile CAPTCHA analytics data from my Cloudflare account?

Cloudflare includes an analytics dashboard that shows an overview of Turnstile CAPTCHA challenges for each form you’ve added Turnstile to.

To view Turnstile analytics for your WordPress forms, log in to your [Cloudflare account](https://dash.cloudflare.com/login) and select the **Turnstile** sidebar menu. Next, select your site name to open the analytics dashboard.

![Select site name](https://wpforms.com/wp-content/uploads/2023/02/select-site.png "Select Site Name")This will show reports containing all the forms you’ve added Cloudflare Turnstile to. You can filter the data to show reports for a specific form.

To use the filter option, click on the **Add filter** button.

![Click add filter button](https://wpforms.com/wp-content/uploads/2023/02/add-filter.png "Click Add Filter Button")Next, you’ll need to enter the form ID in the **New filter** conditional using the syntax `FormID-XX`. Where `XX` is the ID of the form you wish to see its Cloudflare Turnstile data.

You can always find your form ID from your WordPress dashboard by going to **WPForms » All Forms** and checking under the **Shortcode** column.

![WPForms ID](https://wpforms.com/wp-content/uploads/2023/02/wpforms-id.png "WPForms ID")For our example, we’ve set the filter to say: **Action equals FormID-43**. Click the **Apply** button to add the filter.

![Apply filter](https://wpforms.com/wp-content/uploads/2023/02/configure-filter-settings.png "Apply Filter")Once you apply the filter, it’ll show analytics data for the specific form you selected.

![Form captcha analytics](https://wpforms.com/wp-content/uploads/2023/02/cf-turnstile-analytics.png "Form CAPTCHA Analytics")That’s it! Now you know how to set up and use Cloudflare Turnstile with WPForms.

Next, would you like to learn more ways to prevent spam in WPForms? Be sure to check our complete tutorial on [preventing spam submissions](https://wpforms.com/docs/how-to-prevent-spam-in-wpforms/) to learn more.

**Categories:** Functionality, Spam Prevention and Security

---

