Ninja Forms
Track Ninja Forms form submissions from your website
Some Ninja Forms versions are compatible with Ruler's automatic form trackerIf you have an issue with the automatic tracker or you want greater control over what data is sent to Ruler Analytics, this guide will help you track Ninja Forms responses
The below enables form tracking for Ninja Forms form submissions from your website. It listens for Ninja Forms submission events, extracts data from the submission and sends the data to Ruler.
This implementation will not affect the submission of forms to Ninja Forms or other places like your CRM.
Implementing with Google Tag Manager
One of the easiest ways to implement this code is through Google Tag Manager. To add this code to Google Tag Manager, follow these steps:
- Create a new tag in Google Tag Manager
- Select type 'Custom HTML'
- Paste in the code below
- Set a page view or DOM Ready trigger
- Save and publish the new tag
The code
<script>
jQuery(document).ready(function() {
jQuery(document).on('nfFormSubmitResponse', function(event, response, id) {
var raPayload = {
"NinjaFormsFormId": response.id
};
var fields = response.response.data.fields;
for (var field in fields) {
if (fields.hasOwnProperty(field)) {
var label = fields[field].label;
var value = fields[field].value;
raPayload[label] = value;
}
}
RulerAnalytics.trackConversionAsync(raPayload, "", "", 500);
});
});
</script>
Got a question?Speak to a member of the Ruler support team. Email: [email protected]
Updated 17 days ago