I know, I know, there is a FAQ: http://kriesi.at/documentation/enfold/add-onclick-event-to-the-contact-form-submit-button/
But the problem is – it doesn’t work. I put in child theme’s functions.php this code:
add_filter('avf_contact_form_submit_button_attr','avia_add_submit_attributes_to_cf', 10, 3);
function avia_add_submit_attributes_to_cf($att, $formID, $form_params){
$att = "onclick=\" dataLayer.push({'event': 'form-submission'}); \"";
return $att;
}
and it doesn’t push anything to data layer.
At the same time, I created a standalone html file in the root of my site, and put there this code
<a href="#" name="button1" onclick="dataLayer.push({'event': 'form-submission'});" >Button 1</a>
and it does work.
Hi Vermishelle!
I’m not sure if we will be able to help with your tracking but send us a link to your page and we’ll check your source code to see if the onclick attribute is being set properly.
Best regards,
Elliott
Sorry for disturbing, now it works.