Skip to content

Commit

Permalink
add ninja forms snippet
Browse files Browse the repository at this point in the history
  • Loading branch information
dannyvankooten committed Jan 8, 2025
1 parent 4a047cb commit ba782c9
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions code-snippets/event-snippets/track-ninja-forms-submit.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
// This code snippet is to track submit events coming from a Ninja Forms form
// Modified from https://developer.ninjaforms.com/codex/listening-to-submit-response/

var mySubmitController = Marionette.Object.extend( {
initialize: function() {
this.listenTo( Backbone.Radio.channel( 'forms' ), 'submit:response', this.actionSubmit );
},
actionSubmit: function( response ) {
koko_analytics.trackEvent('Form submit', 'Page: ' + location.pathname + '; Form: ' + response.data.settings.title);
},
});

jQuery( document ).ready(function() {
new mySubmitController();
});

0 comments on commit ba782c9

Please sign in to comment.