Contact Form 7 Integration

Contact Form 7 is one of the most popular and simplest form plugins for WordPress. It hasn’t got a lot of features, but it is free and easy to use.

As you can see in the screenshot below it is easy to setup and all you must do is click the activation switch and click save.

Activate Contact Form 7

When you submit a CF7 form a browser event will be fired which GTM Kit detects and use to generate to GTM event and Data Layer. In the screenshot below you can see the Data Lauer content after a form has been submitted:

Contact Form 7 data layer

The event is gtmkit.CF7MailSent and you can use this event in a trigger to register a lead. The contents of the submitted form i stored in the response object, which can be used to create vairables in Google Tag Manager.

Steps

1. Confirm CF7 is active

The CF7 integration only appears when Contact Form 7 is active.

2. Open Integrations

Go to GTM Kit, Integrations. Find the Contact Form 7 section.

3. Enable the integration

Toggle Contact Form 7 integration on.

4. Optional: load the helper script

GTM Kit ships a small JS file (contact-form-7.js) that listens for CF7’s submission events and pushes them to the data layer. This is enabled by default.

If your theme already wires up form-submission events itself (some heavily customized themes do), you can disable GTM Kit’s helper to avoid double-firing. Toggle Load CF7 JS off.

Use the data in GTM

In GTM, create a Data Layer Variable for form_id and one for form_name. Then create a trigger:

Trigger type: Custom Event. Event name: form_submit (or whatever GTM Kit fires; verify in DevTools first).

Use the variables in tags to send a generate_lead conversion to GA4 or Google Ads.

Verify it worked

Open a page with a CF7 form. In DevTools console, run a watcher to log every push:

window.dataLayer.push = (function (orig) {
  return function (data) {
    console.log('dataLayer push:', data);
    return orig.apply(this, arguments);
  };
})(window.dataLayer.push);

Submit the form. You should see one or more entries logged: at minimum on submit, and one for the success or failure state.

Loading the script

By default, the integration loads a JavaScript on any page where the Contact Form 7 script is registered. You can force GTM Kit to load the script on all pages but this is normally bot necessary or recommended.

Contact Form 7 script implentation

Common issues

No event fires on submission. Either the integration toggle is off, or the Load CF7 JS toggle is off and your theme does not provide its own bridge.

Events fire twice. Two sources are listening: GTM Kit’s helper script and your theme. Disable one, usually GTM Kit’s Load CF7 JS toggle.

Validation errors fire as if successful. GTM Kit listens to CF7’s wpcf7submit event family, which includes invalid submissions. Filter on the submission status field (mail_sent, validation_failed, spam, aborted) inside your GTM trigger if you only care about successful sends.

Forms loaded via AJAX in popups or sliders do not fire. CF7 normally bootstraps on document-ready. If the form is injected after page load by a popup plugin, it may bypass that initialization. Check the popup plugin’s documentation for “trigger CF7 init” hooks.

Related articles