Ninja Form Event Listener

Ninja Forms is used to build beautiful WordPress forms without being a developer or web designer.

With this simple Google Tag Manager Event Listener, you can track interactions like form submission on Ninja form. Simply copy the code into your Google Tag Manager with the necessary configuration and you are ready to begin collecting those events when they trigger.

How to track Ninja form submission with Google Tag Manager

Tracking Ninja form submissions as conversion in your analytics platform can be achieved using Google Tag Manager and this event listener.

You’ll need Google Tag Manager and the Ninja form submission event listener javascript code.

The code

    				
    					<script>
    jQuery(document).ready( function() {
    jQuery(document).on('nfFormSubmitResponse', function(event, response, id) { 
    dataLayer.push ({
    'event' : 'ninjaFormSubmission',
    'NFformID' : response.id 
    });
    });
    });
    </script>
    				
    			
    • Start by creating a custom HTML tag where you’ll paste the event listener code and fire it on pageview or DOM ready.
    • Create a custom event with the event name [ninjaFormSubmission]
    • The event happens only on successful submission of Ninja forms
    • To capture the form ID, create a dataLayer variable with a key [NFformID]
    • Connect your marketing tag(s) to this trigger to send events to your analytics platform like GA4.
    • Trust But Verify (TBV). Test, test and debug
    • Publish once everything is okay.

     

    Credit: The code creator is Chris Berkley

    Share the Post: