adding a google analytics goal

SEO Hero Tips: Event Tracking in Contact Form 7


What I enjoy about the SEO universe is that it is a busy place that is full of hundreds of problem-solving challenges. There are dozens of different CMS styles out there, all with their own quirks. As you bounce back and forth from problem to problem, over time you tend to forget your solutions. As such, this blog category is meant as a reference to problems that tend to come up more than once.

If you want to be an SEO Hero and don’t know a single thing about Event Tracking, do a little research on it. Event Tracking provides you with the tools to provide your clients with valuable information! Normally with a typical html website, it’s easy to implement with Google Analytics, however, with WordPress, it can be a challenging endeavor.

If you wish to put event tracking on a page or post, any code you put on will get stripped out, unless it’s manually put on a template file such as your footer.php. Fortunately, there are several great plugins that let you implement event tracking, with Gravitate Event Tracking being my favourite.

In a lot of cases, especially if you are a local business offering a service, the only event you may care about is your form conversions. A lot of WordPress sites use Contact Form 7, and they offer an easy way of adding event tracking to their forms.

On their official page, Contact Form 7 states to go to the Additional Settings tab and insert:

on_sent_ok: “ga(‘send’, ‘event’, ‘Contact Form’, ‘submit’);”

into the field.

This will work, however, if you have more than one form, you won’t be able to differentiate them. What is missing is the event label.

Fortunately, this is an easy fix, all you need to do is tack on the label field at the very end.

For example:
on_sent_ok: “ga(‘send’, ‘event’, ‘Contact Form’, ‘submit’, ‘Carpet Cleaning Request Form’);”

vs

on_sent_ok: “ga(‘send’, ‘event’, ‘Contact Form’, ‘submit’, ‘Upholstery Cleaning Request Form’);”

will help you differentiate between these two service forms.

Deciphering Event Tracking Code

If you manually created your event tracking code for a form (or used a wonderful event tracking code builder, such as the one offered by raventools.com, you may have had come up with something like this:

onClick=”ga(‘send’, ‘event’, { eventCategory: ‘Contact Form’, eventAction: ‘submit’, eventLabel: ‘Carpet Cleaning Request From’});”

If you were to compare this to our code above for Contact form 7, you can see how the fields match up.
on_sent_ok: “ga(‘send’, ‘event’, ‘Contact Form’, ‘submit’, ‘Carpet Cleaning Request Form’);”

Event Category = “Contact Form”
Event Action = “Sent”
Event Label = “Carpet Cleaning Request Form”

SEO Hero Bonus Tip – Turning an Event into a Goal

There’s a lot of information on goals and e-commerce sites, but there is very little information out there on goals for small local business sites that offer services, such as plumbers, dentists, or landscapers. Often, for them, the main point of contact will be a simple and clean form that asks for some basic information.

If your contact forms play an important part of your website’s conversions, why not turn them into a goal in analytics.

Simply go to Admin –> Goals, and create a new goal that is derived from an event. From there, you just match up the three fields.

adding a google analytics goal

This lets you easily see the conversion rate of your goals, as well as the steps people may have taken to get to your form and fill it out. Furthermore, you can play around with the Attribution feature in Google Analytics, and discover what channels, such as Direct, Organic Search, Referral, Paid or Social are contributing to your form.

To learn more about Attribution, I suggest you read more about it on Avinash Kaushik’s blog, particularly the digital attribution ladder of awesomeness article. Powerful stuff to learn on your journey in becoming an SEO hero.

Related Post

No votes yet.
Please wait...

Leave a comment

Your email address will not be published. Required fields are marked *