I have a custom form on the product page and this form is same as Contact Us form. I have already implemented Google invisible reCaptcha code on this page.
Google invisible reCaptcha is implemented along with the Google conversion code. While when we are submitting the form it is not throwing any errors and Form is submitted successfully Issue is we are getting spam emails and it seems user bypass reCaptcha.
Also when we are generating an analytic report then getting an error.
"We detected that your site is verifying reCAPTCHA passed solutions less than 50% of the time. This could indicate a problem with your integration with reCAPTCHA. Please see our developer site for more information."
Google invisible reCaptcha code is implemented with below code
<button id='recaptcha' class="g-recaptcha" data-sitekey="site-key here" data-callback="doRecaptcha" data-size="invisible"><?php echo $this->__('Submit Form') ;?></button>
var formId = 'customform';
var myForm = new VarienForm(formId, true);
var postUrl = '<?php echo $this->getUrl("submit url") ?>';
new Event.observe(formId, 'submit', function(e){
e.stop();
validateFunction();
});
function validateFunction(){
if (myForm.validator.validate()) {
grecaptcha.execute();
}
}
function doRecaptcha(token) {
conversionCode();
}
function conversionCode(){
gtag('event', 'conversion', {
'send_to': 'hdasdhasdasdklkada',
'event_callback': ajaxCall()
});
}
function ajaxCall() {
custom code here
}
is anybody implemented this before? Please share your ideas so that I can implement it properly.