Mastering CF7 Conversions: A Step-by-Step Guide Using GTM and Custom Scripts

  • Post author:
  • Post published:December 30, 2025
  • Post category:Blog

If you’re running Google Ads, tracking form submissions is the “holy grail” of data. While Contact Form 7 (CF7) is the most popular WordPress form plugin, it doesn’t play nicely with Google Tag Manager (GTM) out of the box because it doesn’t trigger a page reload.

In this guide, we’ll show you how to use a simple JavaScript snippet to capture CF7 data and send it to Google Ads via GTM.


Why Use This Method?

Standard tracking often relies on “Thank You” pages. However, modern UX prefers AJAX submissions (where the form sends without refreshing). The script below listens for the specific CF7 event (wpcf7submit) and pushes that data into the dataLayer.


Step 1: Add the Custom Script to Your Site

First, we need your website to “talk” to GTM when a form is sent. Paste the following code into your website’s footer (or via a “Custom HTML” tag in GTM set to fire on All Pages).

HTML

<script>
(function() {
  document.addEventListener( 'wpcf7submit', function( event ) {
    var inputs = event.detail.inputs;
    var data = {};
    for (var i = 0; i < inputs.length; i++) {
        data[inputs[i].name] = inputs[i].value;
    }
    window.dataLayer = window.dataLayer || [];
    window.dataLayer.push({
      'event': 'cf7submission',
      'formId': event.detail.contactFormId,
      'formData': data
    });
  }, false );
})();
</script>

What this script does:

  • Listens for the successful submission of any CF7 form.
  • Gathers the input values (like name or email).
  • Pushes a custom event named cf7submission to GTM.

Step 2: Create a Custom Event Trigger in GTM

Now that the data is being sent, GTM needs to know to look for it.

  1. Log in to Google Tag Manager.
  2. Go to Triggers > New.
  3. Choose Trigger Type: Custom Event.
  4. Event Name: cf7submission (It must match the script exactly).
  5. Set it to fire on All Custom Events and click Save.

Step 3: Set Up Your Google Ads Conversion Tag

Now, let’s link that trigger to your Google Ads account.

  1. Go to Tags > New.
  2. Choose Tag Configuration > Google Ads Conversion Tracking.
  3. Enter your Conversion ID and Conversion Label (found in your Google Ads account under Conversions).
  4. In the Triggering section, select the cf7submission trigger you created in Step 2.
  5. Save and Publish.

Step 4: Verification (The Most Important Step)

Before you celebrate, ensure everything is working:

  • Open GTM Preview Mode and enter your website URL.
  • Fill out your Contact Form 7 on your site and click submit.
  • In the GTM Debug window, look for the cf7submission event in the left-hand sidebar.
  • Click the event and verify that your Google Ads Conversion Tag fired successfully.

Summary Table: Key Elements

ElementValue
GTM Event Namecf7submission
Trigger TypeCustom Event
Data CapturedForm ID and Input Data
CompatibilityAll CF7 forms using AJAX

Pro Tip:

If you have multiple forms and only want to track one as a conversion, you can use the formId variable pushed by the script to create a trigger that only fires when formId equals your specific ID.