Blog

Ninja Form Tracking: Google Ads Conversions and GA4 Leads with Google Tag Manager

Ninja Form Tracking: Google Ads Conversions and GA4 Leads with Google Tag Manager

Are you struggling to track form submissions accurately in Google Ads and Google Analytics 4 (GA4)? Ninja Forms is a popular WordPress plugin that makes form creation easy, but tracking submissions for your marketing efforts can be challenging without the right setup.

In this guide, I’ll show you how to set up Ninja Forms tracking for both Google Ads Conversion Tracking and GA4 Lead Tracking using Google Tag Manager (GTM). By the end, you’ll have a clear pathway to measure leads and optimize campaigns effectively.


Why Track Ninja Form Submissions?

Tracking form submissions provides:

  1. Accurate conversion data for Google Ads campaigns.
  2. Insights into your audience’s behavior through GA4.
  3. The ability to refine marketing strategies and improve ROI.

Step-by-Step Setup Guide

Step 1: Install the Ninja Forms Event Listener Script in GTM

To capture Ninja Forms submissions, you’ll use a Custom HTML Tag in GTM that listens for the Ninja Forms nfFormSubmitResponse event and pushes the data into the GTM dataLayer.

Add this code snippet to your website:

Steps to Add the Custom HTML Tag

  1. Go to your GTM account.
  2. Click Tags > New > Custom HTML.
  3. Add the following code:
<script>
jQuery(function($) {
  $(document).on('nfFormSubmitResponse', function(e, r) {
    var formData = r.response.data,
      formId = formData.form_id,
      formName = formData.settings.title,
      submissionId = formData.actions.save.sub_id;

    dataLayer.push({
      event: 'ninja_form_submission',
      form_id: formId,
      form_name: formName,
      form_submission_id: submissionId
    });
  });
});
</script>

What This Code Does

Listens for the Ninja Form’s nfFormSubmitResponse event after submission.

Captures key data like form_id, form_name, and submission_id.

Pushes this data to the dataLayer for GTM to process.

Name your tag (e.g., “Ninja Form Listener”).

Trigger: Set the trigger to All Pages.

Step 2: Set Up Data Layer Variables

Create variables in GTM to extract the data pushed by the Custom HTML tag.

Steps

  1. Go to Variables > Configure in GTM.
  2. Create the following Data Layer Variables:Variable Name: form_id
  3. Data Layer Variable Name: form_id.Variable Name: form_name
  4. Data Layer Variable Name: form_name.Variable Name: form_submission_id
  5. Data Layer Variable Name: form_submission_id.

Step 3: Create Tags for GA4 and Google Ads

Tag 1: GA4 Lead Event Tag

  1. Go to Tags > New > GA4 Event Tag.
  2. Configure the tag as follows:Configuration Tag: Select your GA4 Configuration Tag.Event Name: lead.Event Parameters:form_id: {{form_id}}form_name: {{form_name}}form_submission_id: {{form_submission_id}}
  3. Trigger: Use a Custom Event Trigger for ninja_form_submission.

Tag 2: Google Ads Conversion Tag

  1. Go to Tags > New > Google Ads Conversion Tracking Tag.
  2. Add your Conversion ID and Conversion Label.
  3. Trigger: Use the same Custom Event Trigger for ninja_form_submission.

Step 4: Create a Custom Trigger for the Form Event

  1. Go to Triggers > New.
  2. Select Custom Event as the trigger type.
  3. Event Name: ninja_form_submission.
  4. Add optional filters if you want to track specific forms:e.g., form_name equals Contact Form.

Step 5: Publish and Test

Test in GTM Preview Mode

  1. Enable Preview Mode in GTM.
  2. Submit a Ninja Form on your website.
  3. Check the GTM Debug Console to verify:The ninja_form_submission event fires in the dataLayer.The GA4 and Google Ads tags are triggered.

Verify in GA4 DebugView

  1. Open GA4 and go to Admin > DebugView.
  2. Look for the lead event.
  3. Check that the event parameters (form_id, form_name, form_submission_id) are recorded.

Check Google Ads Tag

  1. Use Google Tag Assistant to ensure the conversion tag fires properly.

Why This Approach Works

  • No Backend Access Needed: The entire setup is managed through GTM.
  • Highly Flexible: You can track multiple forms and add filters to segment leads.
  • Powerful Insights: Data flows seamlessly into GA4 and Google Ads for deeper analysis and remarketing.

Need Help?

If you have questions or need expert support for tracking Ninja Forms or other platforms, feel free to connect. Let’s make your analytics seamless and actionable.

Direct Implementation White-Label for Agencies

Need this implemented, audited, or white-labeled?

Whether you are an eCommerce brand owner fixing signal loss or a digital marketing agency needing a senior analytics engineer under strict NDA, I deliver 24–48h SLA turnaround with 8.5+ EMQ match rates.

✓ 24–48h Emergency SLA ✓ Strict Non-Solicitation & NDA ✓ 8.5+ Event Match Quality
Jobair Mahmud

Jobair Mahmud

AI-Driven Performance Marketing & Web Analytics Consultant

Helping eCommerce brands and marketing agencies trust their ads data, scale Smart Bidding, and eliminate wasted ad spend through bulletproof server-side tracking and PPC management.