Google Analytics Event Tracking

In this tutorial, We will see how we can track fluent forms events with Google Analytics. Fluent Forms fire jQuery Events in different form state so it will be very easy to track events with google analytics.

In this documentation, We will use google analytics universal gtag. So make sure you are using gtag.js to your site.

Option 1: Track per form basis

You can track the events by per form basis. For this go to Fluent Forms -> Select your form -> Settings & Integrations -> Custom CSS / JS Tab and at the bottom you can see a editor to add custom Javascript. In that javascript box your $form and formId variable is available.

Add the following code in that form’s JS code:

You can change the event_category or event_label value based on your needs.

At first, It will send an event labeled as “View Form” when the form loaded on your page. When a user submits a form, it will send another event labeled as “Form Submitted”

Option 2: Track Events For All Forms

To track all your form events in Google Analytics you can use the following js code (Please note that you have to add this code universally in your site)

How to add this code via theme’s functions.php file

If you don’t use any snippet plugin or unable to add this code in your JS file then you can use the following code in your theme’s functions.php file or your custom plugin’s php file.

Was this article helpful to you?

6 7

How can we help?

Please submit a support ticket if you have any question or pre-sale questions. Our Customer support engineers will answer your query as soon as possible

Open a support ticket