Integrate Contact Form 7 and Google Analytics Event Tracking

Integrate Contact Form 7 and Google Analytics Event Tracking

contact-form-7-wordpressIt 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.

Requirements

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.

Setupadditional-setting

  1. Go to the WordPress Admin area > Contact > Contact Forms, and click on the contact form you want to integrate with Analytics Events.
  2. 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 Analyticsform

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.

I started Chico Designs in 2009 while I was a student at CSUC. Chico Designs has since become one of Chico's top web design companies, offering website design, graphic design, SEO, hosting, and social media management. I graduated from CSUC with a M.A. in psychology science, writing my thesis paper on how personality types use social networks differently. My background in psychology research allows me to apply many psychological principles to our website designs, such as color theory, branding principles, using the golden ratio to build attractive layouts, & utilizing social trust markers.