How to Setup Ninja Forms Event Tracking with Google Tag Manager & GA4?

Sumit Kumar
8 Min Read

Ninja forms are one of the leading & known plugins for WordPress which has a wide user portfolio after Contact Form 7, Gravity Forms, Formidable & other leading best WordPress contact forms plugins.

With the help of Ninja Forms, you can create forms without coding knowledge with their drag & drop functionality. You can add it anywhere on your WordPress blog or website.

This form comes with both Freemium & Premium features.

Where the Freemium plan only offers the form creation & data collection, the premium plan offers a lot more than this.

Some of the premium features are:

  1. Accept Payments using PayPal, Stripe, Elavon etc
  2. Email Marketing Integrations with leading SAAS like MailChimp, AWeber, ConvertKit & ore
  3. Users management & analytics
  4. CRM Integrations like Salesforce, Zoho CRM, Zapier & more
  5. Notifications & Workflow Upgrades with ClickSend, Twilio, Zapier etc.
ninja forms wordpress

Apart from this, the crucial step to track the form which you add on various pages to collect leads, information, contacts. Survey etc.

This is always important to track your forms so that you can measure the performance how your forms are doing or are they worth to add on website etc.

In this blog, we will learn how we can easily set up Ninja Forms conversion tracking using Google Tag Manager & Google Analytics.

To do this, we need to create some tags, triggers and variables. Follow the steps as mentioned below:

Step 1: Create a tag to listen to the actually submitted forms.

This tag is a Javascript code that helps to listen to the variable generated when your form gets actually submitted.

To create this, go to Tags > New > select Custom HTML from the tag types & paste the JavaScript from below:

<script>
jQuery(document).ready( function() {
  jQuery(document).on(‘nfFormSubmitResponse’, function(event, response, id) {        
      dataLayer.push ({
        ‘event’ : ‘ninjaFormSubmission’,
        ‘NFformID’ : response.id          
            });
         });
    });
</script>

ninja forms

I’ve named mine “Ninja Form Submission”, you can name is at your convenience.

Step 2: Create a data layer variable which is added to data layer to pass values

To create the Ninja Form data layer go to Variables > New > Variable Type (Data Layer Variable) > Name it NFformID (or any name you want to have) & save it.

ninja forms conditional logic

Step 3: Create a trigger to fire on each form submission

This is very important to create a trigger carefully as this will be fired whenever your form gets submitted.

To create, go to Trigger > New>

Trigger Type: Click – All Elements

Event Name: Contact Us Form Submission or any other you want

This Trigger Fires On Trigger Type > Custom Event

Add ninjaFormSubmission in the Custom event field.

ninja forms trigger

Step 4: Create the tag for form submissions

Now, we need to create another tag which will be as follows:

Go to Tags > New

Tag Type: Google Analytics: GA4 Event

Configuration Tag: Choose Google Analytics 4 Configuration Tag

Event Name: Create an event name. Use underscore in place of space as Google Analytics 4 don’t allow spaces.

Label: Form Submit or anything you want

Non-Interaction Hit: False

Google Analytics Setting: Choose from existing or override to add new

ninja forms conversion tracking

Once you create this tag, fire this to the trigger we have created in Step #3.

Step 5: Setting up the Goal Conversion in Google Analytics 4

Once you have done the tag creation, you need to create the conversion in Google Analytics 4.

To create this, you need to log in to Google Analytics 4 & follow the steps below:

  1. Google Analytics > Admin > Conversion >
  2. Click New conversion event button.
  3. New Event Name: Enter the same Event Name we used in step #4.
ninja forms analytics

Once you are done with this setup, save this goal.

Always remember to do lots of tests before you move this to live.

If you think we have missed any important information in this blog, let us know if in the comment.

If you are using Contact Form 7, check the Contact Form 7 event setup guide.

If you need any assistance on your SEO campaign, you can hire us by contacting us here.

Need any help or assistance in Google Analytics 4?

Ninja Form Event Tracking FAQs

What is Ninja Forms in WordPress?

Ninja Form is a plugin for creating various kind of forms in WordPress. This plugin is completely user friendly & webmasters can create them by using various options & simple drag and drop functionality.

How to Track Ninja forms in WordPress?

Ninja Forms submissions can be tracked easily using Google Tag Manager & Google Analytics 4. Just follow the steps mentioned in this blog.

How to create a Ninja Form in WordPress?

Creating Ninja Forms in WordPress is easy. You need to simply install the plugin & choose the style, options you need to add to your form.

What is event tracking in Ninja forms?

Ninja Form event tracking setup means tracking the successful form submission activities. This can be done using Google Tag Manager & Google Analytics 4. Read this blog for more.

How to Setup Google Ads Conversion Tracking in BigCommerce (With Order Amount & Order ID)

How to Setup Enhanced Ecommerce Tracking to WooCommerce

The Use of Artificial Intelligence (AI) in SEO – All You Need To Know

How to Setup Contact Form 7 Event Tracking with Google Tag Manager

Best Website Traffic Monitoring Tools

How To Create Custom Reports In Google Analytics

Share This Article
15 Comments
      • Thank you for a well-made explanation , if in the debug mode the variable NFformID appears as undefined, that’s the value for the trigger configuration?

        • To answer this, I would like to tell you that in this case, we need to look out for any other variable or unique create a custom variable for that form so that we get the right tracking. We also need to be sure that the tracking is only done on actual form submissions, not for all the valid or invalid form submission. This would be a bit tricky task but I am sure you will do this.

  • Is there a way to track multi-step forms. In these instructions the tag fires upon submission. If we’re trying to gather data on which step in the multi-step form the user falls out on then it would be helpful to track the “Next” buttons. Although if there are multiple “Next” buttons then it may be difficult to get figure out which “Next” button was clicked.

    • Hi C,

      To answer this, I would like to tell you that in this case, we need to create multiple buttons tracking. This is called step tracking where we track buttons on each step. Just we need to add different click IDs or custom variable to each “Next” button.

      Let me know if you have any further query.

      Thanks

  • I reviewed your blog it’s really good. thanks a lot for the information about this blog. I want more information.

Leave a Reply

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