How can I add a Google Analytics tracking code to a Formidable Form?

Caleb Szydlo

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.

Last updated by on .

One thought on "How can I add a Google Analytics tracking code to a Formidable Form?"

  1. Maurichino says:

    We can’t get this to work. We have placed this code in the “On submit” field of the form settings, beneath the success message. AJAX is enabled. Can you explain what you mean with the ” tags?

What Are Your Thoughts?

Your email address will not be published. Required fields are marked *