Hi Mautic Community,
I’m encountering a technical issue while integrating Mautic forms into my website. Here’s a breakdown of the problem:
Problem Details:
- I embedded a Mautic form using the JavaScript embed code, but the form intermittently fails to load. Instead, I see a blank space where the form should appear.
- When the form does load, submissions are sometimes not recorded in Mautic, even though users receive a “Form submitted successfully” confirmation on the website.
- I checked the browser console and noticed a
CORS policy
error and occasionally a timeout error when fetching form data from the Mautic server.
Troubleshooting Attempts:
- Verified that the Mautic server has a valid SSL certificate.
- Whitelisted my website’s domain in the Mautic configuration.
- Cleared the cache in Mautic and my website.
- Tested the form in multiple browsers and devices, but the issue persists sporadically.
Questions:
- How can I ensure consistent form loading and submission tracking?
- Is there a way to resolve the CORS policy error when embedding Mautic forms?
- Could this issue be related to the hosting environment or server timeout settings?
I’d appreciate any advice or suggestions to resolve this issue. Thank you!
I would use Gravity Forms and then push the submissions to Mautic. Much more reliable, plus you have a database of submissions in your website database as a backup. In addition, Gravity Forms has recaptcha and honeypot spam prevention that the Mautic form does not.
Thank you for your suggestion! Using Gravity Forms as a middle layer does seem like a robust alternative, especially with the added benefits of having a backup database directly on the website and advanced spam prevention features like reCAPTCHA and honeypot. However, I would still like to explore if there’s a way to directly resolve the issues with the native Mautic forms, as it simplifies the integration and avoids adding additional plugins to the website.
If you have any specific tips on resolving the CORS errors or ensuring the Mautic server settings are optimized for form loading and submission tracking, I’d greatly appreciate it. Thank you again for your input!
The CORS configuration need to be done on the website where the form lives.
It’s not a Mautic nor a web server feature. But rather a browser security policy that is done in effort to block malicious script injection.
You may find more on how to properly configure your website webserver there:
(ONLY FOR EDUCATIONAL PURPOSE)
Since you seem interested about this topic, how to disable that security feature in Chrome based browsers (VERY DANGEROUS):
To disable CORS checks in Google Chrome, you need to close the browser and start it with the --disable-web-security and --user-data-dir flags. By doing that, Google Chrome will not send CORS preflight requests and will not validate CORS headers.