2.1K members online now
2.1K members online now
Learn how to set up goals and Ecommerce tracking, verify accuracy of attribution traffic sources, and discuss funnel visualization, Multi-Channel Funnels, the Goal Flow Report, and Enhanced Ecommerce
Guide Me

Contact Form 7 + GTM = goals?

Visitor ✭ ✭ ✭
# 1
Visitor ✭ ✭ ✭

This post is coming at the end of an afternoon of trying everything I could find to get what should theoretically be a simple way of logging Contact Form 7 submits in a Wordpress installation as goals in Google Analytics.  I realise this isn't a Wordpress forum, but I'm sure the problem I'm having is more related to something obvious I'm missing in my Analytics set up.


I chose the Duracell Tomi's Google Tag Manager plugin to integrate Tags into my Wordpress site because it has a specific Contact Form 7 Integration.  This integration pushes an event into the datalayer called tm4wp.contactForm7Submitted (according to this guide).


Tag manager setup

In tag manager I have a standard Google Analytics tag that is tracking pageviews and fires on all pages.


I have added a second Google Analytics tag (same account as first tag) to track an event, with the action set as tm4wp.contactForm7Submitted


I have also added a Trigger in Tag Manager.  Event = Form Submission.  Configured to wait for tags for 2000 miliseconds, but not set to check validation.  Set to Enable when 'event' equals tm4wp.contactForm7Submitted Set to fire on All Forms.


Google Analytics set up

In Analytics I have created a custom goal, Type is set to Event.  Action Equal to tm4wp.contactForm7Submitted


When I look at the real time events report in Analytics I can see the event is being triggered, although the event label is showing as 'not set'.  But when I look at the goals section of the conversions report Goal conversions is showing as zero.


What am I missing?


Should I have two tags set up for Analytics in Tag Manager?


Do I really need the Trigger I have set up?


Help Smiley Happy



Re: Contact Form 7 + GTM = goals?

[ Edited ]
Follower ✭ ✭ ☆
# 2
Follower ✭ ✭ ☆

Hi Andrew,


This is kind of tough one without getting into direct code debugging. In my experience with WP and CF7 and DT's GTM plugin (which is a good one), CF7 is hard to track. The GTM form submit listener is not so accurate at picking up for submits. The events you're seeing may be from some other form. Many form submits aren't actually forms submitting but rather handled by JavaScript, so a form listener often won't be what you need.


What I would recommend is customizing the "thank you" message for CF7 to include a dataLayer push to trigger an event for GTM that you can then use to trigger your form submit event. Something like this:


dataLayer.push({'formStatus': 'submitted','formName':'someForm','event':'cf7FormSubmit'});


Then, trigger your tag based on the "event" of cf7FormSubmit and flow the formStatus and formName variables through to your Action and Labels.  Use the same approach for different forms to handle many forms with one tag by simply varying the "formName" field in the dataLayer push.


Hope this helps!


-Caleb Whitmore

<edited by a Community Manager as noted below>

This post has been edited by a Community Manager, per Community Posting Guidelines.

Contact Form 7 + GTM = goals?

Visitor ✭ ✭ ✭
# 3
Visitor ✭ ✭ ✭

Contact Form 7 + GTM = goals?

Visitor ✭ ✭ ✭
# 4
Visitor ✭ ✭ ✭

I used to follow the D Carlbom article but now on_sent_ok events are no longer supported in CF7. To help I've created a GTM template you can import which will track CF7 form submissions fairly easily without needing on_sent_ok here