Skip to content

Instantly share code, notes, and snippets.



Last active Mar 23, 2020
What would you like to do?
Ninja Forms Google Tag Manager Trigger
jQuery( document ).on( 'nfFormReady', function() {'forms').on('submit:response', function(form) {
window.dataLayer = window.dataLayer||[];
event: 'ninjaFormSubmission',
} )

This comment has been minimized.

Copy link

@lonegoat lonegoat commented Feb 6, 2018

I found this works best if you're using a DOM Ready trigger in GTM, rather than a Page View one, as GTM may load before jQuery and it simply won't fire the event.


This comment has been minimized.

Copy link

@nakitadog nakitadog commented Mar 5, 2018

Correct me if I am wrong but doesn't this fire for each form element?


This comment has been minimized.

Copy link

@ivanli ivanli commented Jul 27, 2018

With multiple forms on a single page, the current implementation would fire 2x data pushes. It's better to use

jQuery( document ).one( 'nfFormReady', function() {

Then the data push only happens once on any form submit on the page.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.