Tracking Form Conversions in Google Analytics Using Contact Form 7
Today we’re talking about how to track successful form submissions as Events and Goals in Google Analytics. Tracking form conversions in Google Analytics enables you to calculate the performance of your conversion pages and optimize accordingly. For this example, we’ll be using a free trial form that we made using the Contact Form 7 WordPress plugin.
At a high level, the process looks like this:
- Create the Event in CF7 in WP
- Validate the Event in GA’s Real-Time Reporting
- Create the Goal in Google Analytics
- Validate the Goal in GA’s Real-Time Reporting
- Calculate Conversion Rate
- Conclusion
Create the Event in CF7
The first step is to create the Event. To do this, we’ll go to:
WordPress Admin>Contact Form 7>Free trial form>Additional Settings
We want to track in GA every time our free trial form is submitted. To do this, enter the following line of code in the text box in the Additional Settings tab of CF7 and click Save:
on_sent_ok: "__gaTracker('send', 'event', 'free trial', 'submit', 'success');"
OR
on_sent_ok: "ga('send', 'event', 'free trial', 'submit', 'success');"
Read more about Events in Google Analytics.
Validate the Event in GA
In Google Analytics, go to Unfiltered View>Reporting>Real-Time>Events>Events. In a separate tab, go to your free trial form page and submit a form to test our Event. Go back to your Google Analytics tab—you should see a value of “1” for “freeTrial.”
If your Event didn’t come through in GA, try one of these troubleshooting tips:
- Be patient—it can take a minute or two
- Refresh the page
- Make sure you’re not in a View with filters that exclude your IP address
- Double-check your code in CF7
- Save the code in CF7>Additional Message
- Create the Goal in Google Analytics
Configure the Goal in GA
In Google Analytics, make sure you’re in the same View (I’m using my Testing View) and navigate to Admin>Views>Goals>+NEW GOAL. Enter the following settings when prompted:
- Goal setup => Custom
- Goal description =>
- Name: free trial
- Goal type: Event
- Goal details =>
- Event conditions
- Category: free trial
- Action: submit
- Label: success
- Save
- Event conditions
Validate the Goal in GA
Repeat the same process that we followed earlier to validate our Event with one exception—under Real-Time Reporting, click Conversions (instead of Events). Open a new tab and once again navigate to your free trial form page to test our Goal. Submit another test free trial form and return to your Google Analytics tab to validate your Goal configuration.
If the Goal doesn’t come through, double check the Event conditions that you entered when creating the Goal. You want to compare the values in the Category, Action and Label fields with the last three values of your Event code in CF7—they should be identical.
If for example, you have “free trial” in your Event snippet, but “freeTrial” in the Category field of your Goal in GA, your Goal won’t fire because its values differ from the Event values. In other words, your Event values must be identical to your Goal’s Event conditions in Google Analytics.
Create the Goal in Master View
If you’ve been following along with me, you created your Goal in your Testing View in Google Analytics. Goals are unique to a View in GA—if you create a Goal in a Test View, you also have to create them in your Master View. You may only have one View for your Google Analytics account, and that’s fine, but I’d encourage you to create at least one additional “Test” View for these kinds of exercises.
Why? Because Event and Goal tracking doesn’t always work right away. Unless you’re an experienced developer, you’ll have to tinker with some of your code in either WordPress, Google Analytics or both before you’ve validated your Events and Goals.
The only thing to be careful with in using Test Views is that once you’ve validated your Event and then your Goal, it’s natural to be excited that you’ve got everything working which makes it easy to forget that you need to recreate your Goal(s) in your other Views. Otherwise, you’ll return a week later to your Master/Filtered View and see zero Events/Goal Conversions.
Your first reaction will be one of bewilderment…”I know I’ve had at least two forms come through? Why don’t I see them in Google Analytics?” Sooner or later you’ll remember that you only created your Goal in your Test View…
Calculate Conversion Rate
Conclusion
Tracking form submissions in Google Analytics provides clear insight into how well your forms are performing. Instant access to form performance metrics enables you to optimize your lead pages and forms for maximum conversion rate. With Conversion Tracking—Events and Goals—implemented and configured in GA, you have instant access not only to your current conversion rates but also your historical rates enabling you to measure how your optimizations have impacted conversion rates over time.
ga('create', 'UA-XXXXX-Y', 'auto');
ga('send', 'pageview');
I’ve used both codes and although I can get it to show up in Real Time Conversions, it doesn’t show up in Real Time Events or in Conversion Goals. I do not use any Yoast or other Analytics Plugins. I have tried setting up tags and triggers in Tag Manager as well as have the Analytics Universal JS code installed. I’ve tried over a dozen different ways from as many articles and I still cannot get it to work! I even made sure to double check the quotes from copy and pasting just in case, everything seems to straight forward, but it just won’t work. What might I be doing wrong?
Hi Bev, Are you trying to track the form in the sidebar of this page? http://www.advancedwaterrestoration.com/. If not, send me the link to the form you’re trying to track and I’ll see if I can troubleshoot for you.