Cloudflare Turnstile is a captcha (a test that tells human visitors apart from automated bots) that protects your Joomla forms, including registration, contact, and J2Commerce checkout, from spam and abusive bot traffic. It plugs into Joomla's built-in captcha system, so once it is set up, it works anywhere Joomla asks for a captcha.
Most visitors never see a challenge. Turnstile runs a quiet, automatic check in the background and only shows a puzzle to suspicious traffic.
Requirements
- Joomla! 6.x. This plugin installs into Joomla's Captcha plugin group, alongside any other captcha plugins on your site.
- A free Cloudflare account, used to generate the Site Key and Secret Key the plugin needs.
Get Your Cloudflare Keys
Before you can configure the plugin, you need two keys from Cloudflare: a Site Key and a Secret Key.
- Go to cloudflare.com and sign up for a free account, or sign in if you already have one.
- Once you're in the Cloudflare dashboard, find the Turnstile section (it lists any widgets you've already created).
- Add a new widget for your site. You will be asked to give the widget a name and enter your site's domain. Use the same domain your Joomla store runs on.
- After the widget is created, Cloudflare shows you the Site Key and Secret Key together on the same screen.
Keep these two keys handy. You'll paste them into the plugin's settings.
What's the difference between the two keys?
- The Site Key is public. It's embedded in your page's HTML so the visitor's browser can load the Turnstile widget. It's safe for anyone to see.
- The Secret Key is private. Your Joomla site uses it, behind the scenes, to confirm with Cloudflare that a visitor's response is genuine. Never share it or paste it anywhere public.
Install the Plugin
Buy and download it from Turnstile (Captcha) on the J2Commerce Extensions Store.
You can install this plugin using the Joomla installer.
- In the Joomla admin, go to System -> Install -> Extensions.
- Upload the plugin ZIP file, or use the Install from URL option.
Enable the Plugin
- Go to System -> Manage -> Plugins.
- Search for
turnstile. - Open Captcha - Cloudflare Turnstile.
- Set Status to Enabled, then click Save & Close.
Turn It On for Your Site
Enabling the plugin is not enough on its own. Joomla only uses a captcha once you tell it which captcha plugin is your default.
- Go to System -> Global Configuration.
- Open the Site tab.
- Find the Default Captcha field.
- Choose Captcha - Cloudflare Turnstile from the list.
- Click Save & Close.
Some individual forms have their own captcha setting that can override the site-wide default. For example, the Users component's registration form (System -> Manage -> Options -> Users -> Integration tab) has its own Captcha field. When a setting like this is left on Use Global, it follows the Default Captcha. If it's set to a specific captcha plugin, it uses that plugin regardless of the site-wide default.
Configure the Plugin
Open System -> Manage -> Plugins -> Captcha - Cloudflare Turnstile to reach the settings below.
Tip
Click the Toggle Inline Help button in the toolbar and the plugin will show a description below each field as you configure it.
Basic Settings tab
Site Key: The site key for your Cloudflare Turnstile widget, shown to visitors. Paste in the Site Key you copied from Cloudflare.
Secret Key: The secret key for your Cloudflare Turnstile widget, used to verify the response server-side. Paste in the Secret Key you copied from Cloudflare. Keep this private.
Theme: Controls the color scheme of the widget. Choose Auto to match the visitor's device settings, or force Light or Dark.
Size: Controls the size of the widget. Choose Normal, Compact, or Flexible (which stretches to fill the width of its container).
Appearance: Controls when the widget is visible. Always shows the widget as soon as the page loads. Execute and Interaction Only delay showing anything until the form is being used. Most stores can leave this on Always unless a developer has asked for one of the other modes.
Retry Interval: Time, in milliseconds, before the widget automatically retries after a network error. Enter a value between 1000 (one second) and 899999 (roughly 15 minutes). If you're not sure, leave the default in place.
Localhost Testing
This fieldset is for developers and designers testing the site on their own computer. It has no effect on your live, public site.
Use Test Keys on Localhost: (Default: Yes.) When enabled, Cloudflare's published test site key and secret are used instead of your own, so the widget works without a live Turnstile account during development. This applies only while Debug Site is set to Yes in Global Configuration and the request comes from a local or private address, such as localhost, 127.0.0.1, or a private network address.
Test Outcome: Choose the outcome Cloudflare's test credentials should produce while testing on localhost. Only shown when Use Test Keys on Localhost is set to Yes. Options:
- Always passes: the widget always succeeds, useful for testing the rest of the form.
- Always fails: the widget always fails, useful for testing your error handling.
- Timeout or duplicate: simulates an expired or already-used response.
- Force interactive challenge: forces the widget to show a visible challenge instead of passing silently.
Advanced tab
Strict Mode: (Default: No.) When enabled, any error contacting Cloudflare's verification service fails the check. When disabled, such errors are treated as a pass so a temporary Cloudflare or network outage does not block your visitors.
For most stores, leave this set to No. If Cloudflare has an outage while Strict Mode is on, every visitor is blocked from submitting any protected form, including checkout.
JavaScript Callbacks tab
This tab is for developers customizing the widget's behavior with JavaScript. Otherwise, leave every field blank.
Each field takes the name of a JavaScript function already defined on your page:
- Success Callback: runs when the challenge is completed successfully.
- Error Callback: runs when there's an error, such as a network problem.
- Expired Callback: runs when the visitor's token expires without resetting the widget.
- Before Interactive Callback: runs right before a visible challenge is shown.
- After Interactive Callback: runs after a visible challenge finishes.
- Unsupported Browser Callback: runs if the visitor's browser isn't supported by Turnstile.
- Timeout Callback: runs when the challenge times out and the widget needs to be reset.
How It Works
- When a protected form loads, the plugin renders the Turnstile widget and loads Cloudflare's script.
- Turnstile checks signals from the visitor's browser. Most real visitors pass with no interaction.
- If Turnstile can't be confident automatically, it shows a brief interactive challenge.
- Once the check completes, the widget submits a response token along with the form.
- On submit, your site sends the token and your Secret Key to Cloudflare's verification service.
- On a pass, the submission continues. On a fail, the visitor sees an error message and must try again.
Tips
- Test your live keys on your real domain. A Site Key created for the wrong domain won't work.
- Test keys only work while Debug Site is on and you browse from a local or private address.
- If a form still isn't showing the widget after you've set the site-wide default, check that form's own captcha setting.
- Make sure your Secret Key was pasted in full and without extra spaces. A partial key is the most common cause of verification failures.
Troubleshooting
The widget does not appear on any form
Cause: The plugin isn't enabled, isn't set as the site's default captcha, or the affected form has its own captcha setting pointing elsewhere.
Solution:
- Go to System -> Manage -> Plugins and confirm Captcha - Cloudflare Turnstile is enabled.
- Go to System -> Global Configuration -> Site tab and confirm Default Captcha is set to Captcha - Cloudflare Turnstile.
- Check the form's own captcha setting and set it to Use Global or directly to Captcha - Cloudflare Turnstile.
"Please complete the captcha challenge" appears on every submission
Cause: The form was submitted before the widget finished its check, or without a response token. The plugin shows: "Please complete the captcha challenge."
Solution:
- Ask the visitor to wait for the widget to finish loading before submitting the form.
- If this happens for every visitor, confirm JavaScript isn't being blocked or stripped by a caching or minification plugin.
- Confirm your Site Key is correct and belongs to the domain the form is running on.
Errors mentioning the secret key
Cause: The Secret Key field is missing or incorrect. The plugin shows "The Turnstile secret key is missing. Please check your captcha plugin settings." or "The Turnstile secret key is invalid. Please check your captcha plugin settings."
Solution:
- Go to System -> Manage -> Plugins -> Captcha - Cloudflare Turnstile.
- Re-copy the Secret Key from your Cloudflare Turnstile widget and paste it into the field without extra spaces.
- Save the plugin and submit the form again.
"The captcha response has expired or has already been used"
Cause: The visitor took too long to submit after completing the challenge, or the same response was submitted twice. Turnstile tokens are single-use. The plugin shows: "The captcha response has expired or has already been used. Please try again."
Solution:
- Ask the visitor to reload the page and submit the form promptly after completing it.
The site is behind a proxy or CDN and Turnstile seems less accurate than expected
Cause: The plugin sends Cloudflare the visitor's IP address. If Joomla isn't told about a proxy or CDN in front of it, it may report the proxy's IP. This doesn't cause verification to fail, but it can affect how confidently Cloudflare vouches for the request.
Solution:
- Go to System -> Global Configuration -> Server tab and make sure the proxy setting reflects your hosting setup, including trusted proxy IP ranges if your host requires them.
- If you're unsure whether your host uses a proxy or CDN, ask your hosting provider.
Visitors with JavaScript disabled cannot get past the form
Cause: Turnstile needs JavaScript. When it is disabled or blocked, the widget cannot render or run its check.
Solution:
- These visitors see "Please enable JavaScript to complete the captcha challenge." and must enable JavaScript to submit the protected form.
- If you expect meaningful traffic without JavaScript, consider this before making Turnstile your default captcha.