How to use reCaptcha with Weglot?
In this article, you'll learn more about troubleshooting potential errors in your reCaptcha system, even when translated into different languages.
1. What is reCaptcha, and how does it work?
reCaptcha is a security measure that aims to protect your website from bot attacks.
It has evolved over time from reCaptchav1 to reCaptchav3. This section provides more information about this evolution.
The current iteration is reCaptchav3. reCaptcha analyzes users' interactions and assigns them a score. If the user's score is lower than a certain value, the user is considered to be a bot and will then be blocked.
This score is stored in a reCaptcha session token that protects the user's session on its domain, temporarily enabling security once it's active.
The reCaptcha key is linked to a range of domains or subdomains. If used with these domains, the reCaptcha key will work successfully. On the other hand, if the reCaptcha key is used on a domain that is not linked to it, it won't work, and you will be blocked.
2. I am having issues with Weglot and reCaptcha
a. reCaptcha and Weglot integrations
reCaptcha is compatible with all Weglot integrations. In some cases, you may experience an issue while using the subdomain integration. That is because when you use subdomains, the domain of your translated version changes, which is not the case with WordPress, JavaScript, and the Weglot subdirectory integrations.
In some cases, when reCaptcha receives a request from a domain different from your original one, it blocks it, which causes the undesired behavior you may be experiencing.
Below are possible solutions to ensure that reCaptcha works on your translated websites.
b. I am using Shopify
With Shopify, you can connect your Weglot subdomain(s) to your store.
First, log into your Shopify Admin and go to the "Settings" section.
Then, you go to "Domains" > "Connect an existing domain" and add the Weglot subdomain(s), which will be [language_code].mywebsite.com
(for example, es.mywebsite.com
for the translated Spanish version of your website).
You can then go back to your website and test reCaptcha. It should be working now.
If it still isn't working, please follow the guidelines in the next section ("I am using another CMS").
c. I am using another CMS
If you use a CMS other than Shopify, here are some guidelines for making reCaptcha work on your translated versions.
Please note that these solutions also work for Shopify. However, using the guide in the above section should also do the job.
- Whitelist all your domains and subdomains in the Settings section of your reCaptcha account/manager (see this article from reCaptcha help pages for more information). This will indicate to reCaptcha that your subdomain is authorized, and the request won't be blocked.
- Change your Weglot integration. As mentioned earlier, the problem is caused by the use of subdomains. If you use another integration, everything should work as expected.
Switch to the subdirectory-based integration. This is the recommended change, as it will not affect your SEO. With this integration, your URLs will have the following structure:
mywebsite.com/[language_code]
instead of[language_code].mywebsite.com
.Weglot will automatically create redirections from your old subdomains to your new subdirectories.
You can find more information about this integration in this article: How do I set up my DNS?
Switch to the JavaScript integration.
⚠️ This is not recommended, as it will negatively impact your multilingual SEO.
To do so, head to the Settings > Setup page of your Weglot Dashboard and click the "Subdirectories/subdomains" toggle button.
3. I cannot translate my reCaptcha
Weglot translates all the elements that are in your source code and that are not in an iframe.
These specific elements prevent any application on your website from accessing this content, which is why Weglot cannot access and translate it.
Iframes are not really on your website. They are content generated in another domain and then displayed on your website.
Weglot generally does not translate iframes by default, but we can find some solutions to translate them.
However, as reCaptchas are generated in a specific way, Weglot cannot translate them.
Note that the reCaptcha default language is the visitor's browser language. That means it should still appear in the correct language, even if Weglot does not translate the reCaptcha.