How can I add a Google Analytics tracking code to a Formidable Form?
November 1, 2016
Adding a Google Analytics tracking event to a Formidable Form is a fairly quick fix that can be handled through the CMS, without having to mess with any theme files. Inside of the Formidable settings in WordPress add your Google Analytics tracking event to the ‘on submit’ message inside ” tags.
function frmThemeOverride_frmAfterSubmit(formReturned, pageOrder, errObj, object){
if(typeof(formReturned) == 'undefined' )
ga('send','event','form name', 'sent');
}
Here’s a more in depth article, courtesy of the Formidable help desk itself.
One note though, the form must be set to submit via AJAX, otherwise the tracking function won’t work.