The Community forums are being phased out in favor of a new Slack group.
Add your email address below to get an invitation to join the community slack group
How to set up analytics code
Where do I put 'onsubmit' code to track conversions? I can only use put 'onclick' code into the button code but it will track every click as a conversion even if the form is empty.
Here is an example:
<form action="" method="post" onsubmit="ym(XXXXXX, 'reachGoal', 'TARGET_NAME'); return true;">
...
</form>
where can I find the code <form>...</ form>?
February 4, 2019 at 12:09 pm
You can add the code to the submit button on the forms's Settings -> Customize HTML page. Scroll down to the bottom of the HTML and look for the submit button code. You can add it to the button HTML.
February 4, 2019 at 1:01 pm
Event "onsubmit" applies to tag <form>, it doesn't work on button
February 4, 2019 at 1:15 pm
Sorry, I misread your post. Formidable doesn’t have an user interface for this. You have to do this through code. I’m mobile right now without access to a computer. I’ll explain how to do this when I’m back in my office.
February 4, 2019 at 1:28 pm
It would be great, thank you so much
February 4, 2019 at 1:56 pm
This will add your code to the form. Add it to your theme's functions.php.
add_filter( 'frm_form_attributes', 'add_custom_form_attributes', 10, 2 );
function add_custom_form_attributes( $attributes, $form ){
if ( $form->id == 123 ) {
$attributes .= 'onsubmit="ym(XXXXXX, ' . "'reachGoal', 'TARGET_NAME'" . '); return true;"';
}
return $attributes;
}
Make sure you change the $form->id to match your form's id.
February 4, 2019 at 2:05 pm
Thank you so much, you helped me a lot!
Discussion closed.