How To Configure Google Analytics Conversions Track Events Contact Form 7
Tracking conversions in Google Analytics using Contact Form 7 requires setup on Google Analytics Conversion Goals control and in the Contact Form 7 contact form Additional Settings.
The Additional Settings tab requires you to customize your button event to send Google Analytics the expected values.
This setup was quite a challenge for me to overcome because their were several factors preventing success that I had to work through. Apparently, this is a common need for many WordPress administrators but an even more common problem getting to work. I will explain in three steps:
- Obtaining your Google Analytics tracking code
- Preparing your Google Analytics account to track incoming data
- Configuring your Contact Form 7 “send” button to send Google Analytics the data
In your Google Analytics account, click Admin, Goals, +New Goal. Now Custom, enter a name for the Goal, Event for type,
- Category (Equals to) “contact form”
- Action (Equals to) “submission”
- Label (Equals to) “my contact form”
- Create Goal to save
Edit your contact form, click the Additional Settings tab, and add this code:
on_sent_ok: "__gaTracker('send', 'event', 'contact form', 'submission', 'my contact form');"
Now here is where many admins seem to be having trouble and I did as well. The issue is determining what your Google Analytics function is then making sure it is used here. In this case, __gaTracker is the function.
gaq.push is a little different:
on_sent_ok: "_gaq.push(['_trackEvent', 'contact form', 'submission', 'my contact form']);"
In Google Analytics, at the top, click Reporting, expand Real Time, and click Conversions. This interface is displaying real-time data that GA is receiving from your website. So in another window, goto your Contact Form, fill it out, and hit send. Switch back to your GA, Real Time tab and you should see a hit!
If you see a hit then you’ve properly configured your form! Congrats! If not, please re-read the steps to verify you did everything and check that you didn’t overwrite a ( or ‘ in the button tracker code.
__gaTracker('create', 'UA-34343434-34', 'auto');
__gaTracker('set', 'forceSSL', true);
__gaTracker('require', 'linkid', 'linkid.js');
<a href="/c.html" target="_blank" onClick="__gaTracker('send', 'event', 'contact form', 'submission', 'my contact form');">Test</a>
The idea is to have a test link that I could use to verify that my tracking code and function were even working because I had the suspicion (I was correct) that the Contact Form 7 code needed tweaking. If you use this example, you MUST change the UA-343434′ line with your Tracker ID, check your View Source for this or you can find it in Google Analytics, Admin, Tracking Info, Tracking Code.
Finally, you should be aware that it takes a day or two for GA to start displaying your conversions in the normal area where you can run reports and analysis (not the Real-Time area).
Thanks for reading How To Configure Google Analytics Conversions Track Events Contact Form 7