If you use Google Analytics to analyze web traffic on your site, I imagine you would like to track submissions through your contact forms as well. Contact Form 7 allows you to set up this type of tracking very simply. In this post, I’ll show you how to do it.
If you’ve set everything up correctly, Contact Form 7′s contact form behaves as an Ajax application and its form submission is an Ajax event. Google Analytics’
For example, let’s say that the name of your page tracker object is
Note that the /mysite/thank-you.html is not necessary for it to be a real URL. It can be any value, which will then be displayed as a page filename in your Analytics reports.
on_sent_ok action hook
It is quite a straightforward process for you to specify the aforementioned
_trackPageview() with the
on_sent_ok hook. You will find the Additional Settings field at the bottom of the contact form management page; now simply insert the following line into it:
Note that you need to quote the codes properly and the code must be in one line.
Now, if you have set everything up correctly, when someone makes a submission via your contact form, Google Analytics will track it as an access to /mysite/thank-you.html.
To verify that this is working correctly, you can check your Top Content report 24-48 hours after a submission. At that point, you should be able to see the assigned page name (/mysite/thank-you.html) in your report.
- Facebook conversion tracking with Contact Form 7 — Explains how to track facebook ads on your WordPress site using Contact Form 7.