Track WordPress Contact Form 7 with Google Tag Manager

Here’s a quick tip to track form submissions in Contact Form 7 plugin with Google Tag Manager.

Note: If you’re using DuracellTomi plugin for GTM, here’s a great article to follow.

If you added GTM directly to your WordPress template and tried to track form submissions with the default settings, you may have noticed that there’s no gtm.formSubmit event in debug mode.

It’s quite easy to fix this. Let’s start with the trigger:

1. Name your trigger.
2. In the Configure step uncheck Check Validation.
3. In the Enable When section select the page your form is on using Page URL contains or equals /your-page-with-form/
4. For Fire On rule I’m using the CSS class of Contact Form 7 forms: wpcf7-form
5. Save your trigger.

trigger

Now let’s create the form tag:

1. Name your form tag.
2. Select Google Analytics and your analytics type.
3. In the Configure Tag section paste your GA ID (or use constant variable) and specify the event category and action.
4. Select the trigger from the previous step in the Fire On section.
5. Save your tag.

form-tag

At this point you should be ready to go. Click Publish – Preview to enter debug mode, open your website and do a test transaction. You should see the proper gtm.formSubmit event executed and your tag being fired:

formsubmit

Good luck!

P.S. Got a Google Analytics question? Send it to me and I’ll try to answer it on the blog.

is a Google Analytics fan, who also loves SEO, conversion optimization, online marketing and social media. You can follow her on Twitter and LinkedIn.

6 thoughts on “Track WordPress Contact Form 7 with Google Tag Manager

  1. Hey,

    Here’s an explanation what the ‘check validation’ option does: https://support.google.com/tagmanager/answer/3415369?hl=en#CheckValidation

    Contact form 7 is handled via Ajax and in this case the default action of the browser is prevented. You don’t want to load the target page of the form submission – just to send the data to your server.

    So you either need to leave ‘check validation’ disabled or you need to check with your web developers whether there is another way of telling Google Tag Manager that the form has been sent.

  2. Hi, I have the same problem and this was also my solution which I am not happy with. I would like to keep “check validation” checked as I do not want wrong submits appear in my GA. Any suggestion for solution? Thank you, Milan

Leave a Reply

Your email address will not be published. Required fields are marked *