Tracking WPForms Submissions with Google Analytics

WPForms is a great form builder plugin for WordPress which offers a host of benefits including integration with a number of 3rd parties such as Mailchimp, PayPal, Stripe, Zapier Integration and much more.

However, like many form builder plugins for WordPress, the ajax based WPForms lacks integration with Google Analytics. While the Plus and Pro versions of WPForms may offer further functionality, the Lite and Basic seemingly fail to offer Google Analytics integration as standard. There’s no way to redirect customers to a dedicated ‘Thank You’ page nor is there any way to trigger custom code (i.e. a Google Analytics Event) upon successful form completion, therefore making it very difficult to track the volume of form completions within Google Analytics.

jQuery Event tracking Solutions for WPForms

Luckily, when a customer has successfully submitted information via WPForms they are presented with a confirmation message such as this:

WPForms Confirmation

This confirmation message utilities a DIV with a unique ID relating to the ID of the form:

WPForms Confirmation Code

So we can use a quick jQuery script with the on document ready function to check for the existence of this ID and trigger an event within Google Analytics:

This code should be inserted into your footer.php file ahead of the closing tag.

Please note that the ‘XXXX’ above will relate the to unique ID of your form, therefore you’ll need to find your ID and modify the code above to suit.

WPForms Overview

Also note that the above code is configured to work with the new Global Site Tag for Google Analytics, but can easily be adapted to work with the legacy versions such as Universal Analytics (analytics.js), for example:

That’s it. A quick, easy and effective jQuery solution for tracking Google Analytics events with WPForms.

4 thoughts on “Tracking WPForms Submissions with Google Analytics

  • “This code should be inserted into your footer.php file ahead of the closing tag.”,I have done this,but i did not know how Google analytics works?
    can you explain more on this?
    Also how can see the conversion on google adwords?

    • Short answer, yes it would. Hopefully you’re utilising child themes to manage the customisation of your theme – if not, you should be 🙂

Leave a Reply

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