Here’s a quick tip to track form submissions in Contact Form 7 plugin with Google Tag Manager.
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.
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.
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:
P.S. Got a Google Analytics question? Send it to me and I’ll try to answer it on the blog.