Tried add this code to functions.php in ‘child theme’, but it breaks the site. Am I doing this wrong? Thought latest GA didn’t require the funny codes at the end there from the Enfold example: https://kriesi.at/documentation/enfold/add-onclick-event-to-the-contact-form-submit-button/
If those “XXX/XXX” codes are required, how do I find / generate them in GA?
Thanks!
// ADD GA TRACKING TO EMAIL FORM
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=\"_gaq.push(['_trackEvent','Contact Form Send','Click/Touch','Footer']);"";
return $att;
}
Hey jomtones,
You need to escape the next to last double quote too:
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=\"_gaq.push(['_trackEvent','Contact Form Send','Click/Touch','Footer']);\"";
return $att;
}
If you need further assistance please let us know.
Best regards,
Victoria
Thanks Victoria! Amazing how brittle programming still is in 2018.
Hi,
You are welcome!
Best regards,
John Torvik