C3.CAPTCHA is quick and straightforward to integrate into your website. Follow the steps below to get started:
1. Register Your Website
Begin by registering your site to obtain your site key and secret key. These keys are required to link the CAPTCHA service to your application.
2. Add the SDK to Your Page
Include the C3.CAPTCHA script in your HTML page, preferably before the closing </body> tag:
<script type="text/javascript" src="https://captcha.camilord.com/api/sdk.min.js" async defer></script>
3. Add CAPTCHA to Your Form
Insert the following <div> inside the form you want to protect:
<div
class="c3-captcha"
data-sitekey="{REPLACE_WITH_YOUR_SITE_KEY}"
</div>
Replace {REPLACE_WITH_YOUR_SITE_KEY} with the site key generated when you added your website entry.
4. (Optional) Handle Success with a Callback
If you need to run custom logic after a successful verification (e.g. enable a submit button or trigger an API call), you can define a callback function:
<div
class="c3-captcha"
data-sitekey="{REPLACE_WITH_YOUR_SITE_KEY}"
data-callback="onCaptchaSuccess">
</div>
Then define the callback function in your JavaScript:
<script>
function onCaptchaSuccess(result) {
console.log("Verified:", result);
}
</script>
5. You're Done
Once added, C3.CAPTCHA will automatically handle verification and help protect your form from bots and abuseāno complex configuration required.
Additional functionality
If you want to reset the CAPTCHA tickbox programmatically, simply call:
<script>
c3_captcha_reset();
</script>