It can be really useful to know more about visitors to your site who fill out the contact forms. Tracking the forms as a Google Analytics event allows you to see data about where visitors who filled out the form came from, what pages they landed on, how much time they spent on the site, the browser they used, and more. This information can then be used to optimize the site, leading to an increased number of visitors filling out the forms.
First you must have Google Analytics (universal tracking) and Contact Form 7 Installed on your WordPress site. If you don’t have universal tracking – the current Analytics standard, or a recent version of Contact Form 7 installed, you might want to upgrade.
- Go to the WordPress Admin area > Contact > Contact Forms, and click on the contact form you want to integrate with Analytics Events.
- Scroll down to the bottom of the page where it says: Additional Settings and paste the following code there:
on_sent_ok: "ga('send', 'event', 'Contact Form', 'sent');"
If you have two or more forms you can set them up as separate events. On my site I have a contact form and quote request form. I setup the quote request form similarly, but replaced part of the code: ‘Contact Form’, with: ‘Quote Request’, so my quote request form looks like this:
on_sent_ok: "ga('send', 'event', 'Quote Request', 'sent');"
Tracking Data in Analytics
Now that everything is setup it should start showing the events in Google Analytics. To see the events login to Google Analytics and go to Behavior > Events > Overview. From there you can see the information about users who fill out the forms or perform other events.
If you have any questions about Google Analytics, Contact Form 7, or need help with your WordPress site you can leave a comment or send me a message.