Skip to main content
Category

Analytics

Gravity Forms Event Tracking with Google Tag Manager

By Analytics 10 Comments

You’re here because you want to use Google Tag Manager and Google Analytics to track form submissions using the Gravity Forms plugin. This tutorial, like my others for Contact Form 7 and Ninja Forms, will show you how to configure these platforms to track successful submissions, and use different form IDs to setup different goal conversions in GA. These are the steps we’ll be following:

Step 1: Configure Gravity Forms to use AJAX to submit the form.
Step 2: Create a GTM Tag that pushes a Data Layer event when the form is submitted successfully.
Step 3: Create a GTM Trigger that looks for the Data Layer event when the form is submitted, and triggers a second GTM Tag.
Step 4: Create a second GTM Tag that looks for the Data Layer push and creates Google Analytics Events.
Step 5: Create a form ID Data Layer Variable so that we can capture form ID.
Step 6: Set up a Goal Conversion in GA based on the GA Event from Step 3.

Step 1: Enable AJAX Submissions

If you use Gravity Forms’ default settings, the page will reload when the form is submitted, and none of these steps will work. Instead you need to enable AJAX submissions, which is done in the form’s shortcode.

Your normal shortcode looks like this:  gravityform id=”1″ title=”true” description=”true”

Your edited shortcode will look like this: gravityform id=”1″ title=”true” description=”true” ajax=”true”

 

Step 2: Create GTM Tag #1

The first tag is a few lines of Javascript that listens for a form submission. Technically it listens for the gform_confirmation_loaded event…which occurs when the confirmation message is loaded…which occurs when the form has been submitted. This is important because it differentiates between actual form submissions and false submissions (like when one of the required form fields is incomplete). The plugin fires a submit event WHENEVER the submit button is clicked (whether actually submitted or not) so the submit event is not reliable (and button clicks aren’t reliable with any plugin).

Here’s the tag you need to setup. I named it gravityFormsSubmission. 

 

Tag Type: Custom HTML

Add the following code:

<script>
jQuery(document).ready( function() {
jQuery(document).bind('gform_confirmation_loaded', function(event, formId){
	window.dataLayer.push({
            'event' : 'gravityFormSubmission',
            'gfformID' : formId		
	});
});
	})
</script>

Triggering: All Pages

This listens for the gform_confirmation_loaded event and fires an event into the Data Layer called “gravityFormSubmission.” It also grabs the form ID in the Gravity Forms shortcode and pushes it into the Data Layer too, you can see the different form IDs in the screenshot here.  You can use different forms with different IDs to create different Goal Conversions later in this tutorial.

 

 Step 3: Create a GTM Trigger

Next, create a Trigger for the Tag you’ve just created. Mine is Gravity Forms Trigger.

 

Trigger Type: Pick Other – Custom Event from the default list. We’ll use the event we created in Tag #1 as the trigger event.

Event Name: gravityFormSubmission

This Trigger Fires On: All Custom Events

This uses the custom Data Layer event from Step 1 to trigger a Google Analytics event tag that we will setup in Step 3.

 

Step 4: Create Tag #2

Create another tag and name it Gravity Form SubmissionFill out the following fields as such:

Tag Type: Universal Analytics

Track Type: Event

Category: You can set this as whatever you want and that’s what it’s going to show up as in Google Analytics when you go to the Events report. I named mine contact-form.

Action: I picked gfsuccessful-form-submission.

Label: If you want to track different forms separately, you need to set this as form-id-{{GFformID}} and follow the rest of these instructions closely.

Value: I did not add a value.

Non-Interaction Hit: I recommend selecting False – this will prevent the session from be counted as a bounce if the visitor only looks at one page, but completes a form submission before leaving.

Tracking ID: Your Google Analytics UA-XXXXXXXX tracking ID. I have mine set up as a custom, constant variable, which explains why it says {{GA Tracking Code}}

More Settings & Advanced Settings: If you’re an analytics wiz, there are advanced settings in here that you may want to configure. However, I did not change any of them.

When you’re done, you’ll end up with this:

 

Step 5: Create a Form ID Data Layer Variable

In Step 2 we pushed the form ID into the Data Layer when the form is submitted. Now we need to capture the form ID and get it into GTM and into our Google Analytics Events.

 

 

Add a new User-Defined Variable called GFformID.

Variable Type: Data Layer Variable

Data Layer Variable Name: gfformID (case sensitive).

 

Submit (publish) your updated GTM workspace and then we’ll move on to Google Analytics Goal configuration!

 

Step 5: Setting up the Goal Conversion(s)

In Google Analytics and navigate to Admin > View > Goals. Click +New Goal and set it up as such:

Goal setup: Select Custom

Goal description:

Name: Call it whatever you want. I’ve called mine Gravity Form Submission.

Type: Select Event.

Goal details:

Category: Equals to > contact-form

Action: Equals to > gfsuccessful-form-submission

Label: Select the form ID of the form you want to track. If you don’t want to track different forms separately, you can leave this blank. Mine was form-id-2.

Value: You can add a monetary value here if you’d like.

Use the Event Value as the Goal Value: If you set up a Value in ad a value attached to each event, you could set that up here. Since I did not, I will not.

Save the Goal Conversion and you’re done. If you want to set up other goals for different form IDs, just repeat the process but change the Label in the Goal Conversion.

Lastly, test the implementation by doing a couple test submissions on the site. You can use GA’s real time reporting to look for events firing. If you’re not seeing them, make sure you’re not excluding traffic with filters or opt-out extensions in your browser. For a mostly foolproof solution, submit the form on a mobile device using a data connection (no wifi), and use a completely unfiltered GA view to watch for the event.

Ninja Forms Event Tracking with Google Tag Manager

By Analytics 40 Comments

Tracking Ninja Form submissions as Google Analytics goal conversions is a bit complex when using Google Tag Manager. This post will show you how to set up tracking, log the form ID on submission, AND only track conversions when the form is actually submitted.

Step 1: Create a GTM Tag that pushes a Data Layer event when the form is submitted successfully.
Step 2: Create a GTM Trigger that looks for the Data Layer event when the form is submitted, and triggers a second GTM Tag.
Step 3: Create a second GTM Tag that looks for the Data Layer push and creates Google Analytics Events.
Step 4: Create a form ID Data Layer Variable so that we can capture form ID.
Step 5: Set up a Goal Conversion in GA based on the GA Event from Step 3.

Ninja Forms

Step 1: Create Tag #1

The first tag is just a bit of Javascript that listens for a form submission. When the form is submitted, it sends a DOM event called nfFormSubmitResponse – this event is only triggered when the form is actually submittedLog into GTM and create a new Tag (I’ve called mine nfFormSubmission) with the following configuration:

Tag Type: Custom HTML

Add the following code:

<script>
jQuery(document).ready( function() {
  jQuery(document).on('nfFormSubmitResponse', function(event, response, id) {         
      dataLayer.push ({
        'event' : 'ninjaFormSubmission',
        'NFformID' : response.id           
            });
         });
    });
</script>

Triggering: All Pages

This listens for the nfFormSubmitResponse DOM event and fires an event into the Data Layer called “ninjaFormSubmission.” It also captures the form ID in the Ninja Forms shortcode and pushes it into the Data Layer too (in the screenshot below, that ID is “2”). The form ID is what will allow you to create different Goal Conversions for different forms – we’ll revisit that in later steps.

Step 2: Create a GTM Trigger

Next, create a Trigger for the Tag you’ve just created. I named mine Ninja Forms Trigger.

Trigger Type: Pick Other – Custom Event from the default list. We’ll use the event we created in Tag #1 as the trigger event.

Event Name: ninjaFormSubmission

This Trigger Fires On: All Custom Events

This uses the custom Data Layer event from Step 1 to trigger a Google Analytics event tag that we will setup in Step 3.

Step 3: Create Tag #2

Create another tag and name it whatever you want (I used “Ninja Form Submission”). Fill out the following fields as such:

Tag Type: Universal Analytics

Track Type: Event

Category: You can set this as whatever you want and that’s what it’s going to show up as in Google Analytics when you go to the Events report. I named mine contact-form.

Action: I picked ninja-successful-form-submission.

Label: If you want to track different forms separately, you need to set this as form-id-{{NFformID}} and follow the rest of these instructions closely.

Value: I did not add a value.

Non-Interaction Hit: I recommend selecting False – this will prevent the session from be counted as a bounce if the visitor only looks at one page, but completes a form submission before leaving.

Tracking ID: Your tracking ID. I have mine set up as a variable, which explains why it says {{GA Tracking Code}}

More Settings & Advanced Settings: If you’re an analytics wiz, there are advanced settings in here that you may want to configure. However, I did not change any of them.

When you’re done, you’ll end up with this:

Step 4: Create a Form ID Data Layer Variable

In Step 2 we pushed the form ID into the Data Layer when the form is submitted. Now we need to capture the form ID and get it into GTM and into our Google Analytics Events. 

Add a new User-Defined Variable called NFformID.

Variable Type: Data Layer Variable

Data Layer Variable Name: NFformID (case sensitive).

Submit (publish) your updated GTM workspace and then we’ll move on to Google Analytics Goal configuration!

Step 5: Setting up the Goal Conversion(s)

In Google Analytics and navigate to Admin > View > Goals. Click +New Goal and set it up as such:

Goal setup: Select Custom

Goal description:

Name: Call it whatever you want. I’ve called mine Ninja Form Submission.

Type: Select Event.

Goal details:

Category: Equals to > contact-form

Action: Equals to > ninja-successful-form-submission

Label: Select the form ID of the form you want to track. If you don’t want to track different forms separately, you can leave this blank. Mine was form-id-2.

Value: You can add a monetary value here if you’d like.

Use the Event Value as the Goal Value: If you set up a Value in ad a value attached to each event, you could set that up here. Since I did not, I will not.

Save the Goal Conversion and you’re done. If you want to set up other goals for different form IDs, just repeat the process but change the Label in the Goal Conversion.

Lastly, test the implementation by doing a couple test submissions on the site. You can use GA’s real time reporting to look for events firing. If you’re not seeing them, make sure you’re not excluding traffic with filters or opt-out extensions in your browser. For a mostly foolproof solution, submit the form on a mobile device using a data connection (no wifi), and use a completely unfiltered GA view to watch for the event.

Get Ninja Forms!

Ninja Forms

Using Contact Form 7 instead? See how to track CF7 form submissions with GTM and GA.

Troubleshooting Contact Form Tracking With GTM

By Analytics

This post is to help folks that are having issues setting up Contact Form 7 tracking with Google Tag Manager after following my walk-through. Before you begin, consider the following, which can all affect your ability to track form submissions:

  • Google Analytics filters for IP addresses can exclude traffic and conversions from your home/office before it even gets into Google Analytics.
  • Google Analytics opt-out plugins for Chrome, Firefox, etc. have the same effect as IP filters.
  • If a single person fills the same form three times during their session, that will be recorded as three Events. However, it will only be recorded as one Goal Conversion. This is just how Google Analytics works.
  • If you have your site setup to redirect to a thank you page after the form is submitted, this tutorial will not work for you – you need to set up Goal Conversions differently.
  • If you are not using GTM to track submissions, this tutorial will not work for you. Similarly, if you have a mix of GA and GTM, I can’t guarantee how functional this will be for you.

Troubleshooting GTM Setup

Assuming you’ve double checked your setup and followed the directions carefully, with no typos, let’s start with Google Tag Manager and find out if the tags are firing. Log into GTM, navigate to the top right corner and click Preview.

You should then see this box:

We’re going to use GTM’s Debug mode to see if the event is firing, and make sure information is being sent to the Data Layer. Go to a page on your site with the Contact Form that you’ve setup tracking for, then do a hard refresh (Shift + F5 in Chrome) to ignore cached content and get a fresh page load.

You should see the Debug window at the bottom of the screen. The left pane shows events that have transpired during your time on the page. You will see two tags fired: Universal Analytics (basic page view tracking) and also the wpcf7mailsent tag with the custom Javascript that fires when mail is actually sent.

If you don’t see either of these, there’s an issue with one of those tags, and you should go back and make sure they’re set to fire correctly.

Next, fill out and submit the form. At left you should see a new event, wpcf7successfulsubmit. Clicking on it will reveal details about what tags were fired on this event. You should see the Contact Form Submission tag listed (see below).

Now go to the rightmost option in the row at the top of the pane – click on Data Layer. You should see CF7formID listed in the Data Layer, and it should have an actual form ID in it (in this case, 1192). This information was pushed into the Data Layer using the wpcf7mailsent tag. If you don’t see it, or it says undefined, go back and look at your wpcf7mailsent tag – it’s possible your tag has an issue.

Next, clicking on the Variables tab will show you what Variables were captured, and you should see a Data Layer Variable named CF7-formID. If you see the form ID listed in the Data Layer tab, but not the Variables tab, then it’s likely your custom CF7-formID Variable has an issue and you should take a second look.

If you run through all this troubleshooting and everything checks out, then we need to move into Google Analytics to keep evaluating the different parts of the process. It doesn’t mean your GTM setup is 100% working, but does start to narrow down the number of areas in which things went wrong.

Google Analytics Troubleshooting

Log into GA and go to the Real-Time > Events report. Fill out and submit your form again, then wait a few seconds. The GA event should be logged with the Category & Action you included in the Contact Form Submission GTM tag (see below).

If it isn’t, then first look at your Contact Form 7 Trigger and make sure it’s set to fire on wpcf7successfulsubmit. 

By clicking on the Event Category, GA will also show you the Event Label, which we set up to be the form ID. If you don’t see this, make sure your Contact Form Submission GTM tag has the Event Label defined correctly as the CF7-formID GTM Variable. Missing an Event Label will affect Goal conversion tracking if you have it set up to track a specific form.

If that all checks out, go look at the Real Time > Goal Conversion report. You should see your Goal Conversion appear there also. If it doesn’t, examine your Goal Conversion setup in Google Analytics to make sure you’re tracking the correct Event Category, Action and Label.

Assuming you have your Goal Conversion setup correctly, there are still a few possibilities which I’m reiterating from the beginning of this page:

  • Google Analytics filters for IP addresses can exclude traffic and conversions from your home/office before it even gets into Google Analytics.
  • Google Analytics opt-out plugins for Chrome, Firefox, etc. have the same effect as IP filters.
  • If a single person fills the same form three times during their session, that will be recorded as three Events. However, it will only be recorded as one Goal Conversion. This is just how Google Analytics works.
  • If you have your site setup to redirect to a thank you page after the form is submitted, this tutorial will not work for you – you need to set up Goal Conversions differently.
  • If you are not using GTM to track submissions, this tutorial will not work for you. Similarly, if you have a mix of GA and GTM, I can’t guarantee how functional this will be for you.

Webinar: Using Google Analytics to Build Content Strategy

By Analytics

 

In October, I’m excited to announce I’ll be co-hosting a webinar about Using Google Analytics to Build Content Strategy. In my role as Sr. Account Manager at Seer Interactive, and as an independent consultant, I use Google Analytics daily to gain insights about the performance of existing content, then take those learnings and apply them to future content to drive similar results.

The good folks at WP Engine invited me to host this webinar based on my knowledge of Google Analytics, and also my experience working with WordPress, on client sites and also on my own. WP Engine offers managed WordPress hosting and we’ll be discussing their newly released Content Performance tool, which is a built-in reporting dashboard with WordPress-specific functionality.

Webinar Details

Length: It’s a 30 minute webinar designed to be as actionable as possible.

Date/Time: October 4th, 2017 at 12pm EDT

Topics:

  • Definition of common Google Analytics metrics
  • What the metrics mean, why they matter and how to use them
  • How to effectively use categories and tags for WordPress posts
  • How to integrate Google Analytics reporting into existing workflows
  • How to apply the data to improve your content strategy?
  • How to operationalize Google Analytics data for WordPress

You can sign up for free on the WP Engine site!

Bounce Rates: Are They Bad?

By Analytics, SEO One Comment

Let’s talk about bounce rates. The reason we’re talking about them is because they’re largely misunderstood and less scrupulous (less informed?) marketers than myself routinely make claims about lowering bounce rate…as if that’s universally a positive thing. It may be. Or it might not matter. Read on and I’ll explain why.

What Is Bounce Rate?

Before we really get into it, let’s recap what bounce rate is. Bounce rate is the percentage of visitors who have one single Google Analytics hit during their site session, before leaving. Very often, it is incorrectly stated that bounce rate is the percentage of people who view one page before leaving, but that’s not necessarily true. A pageview is a type of hit, but not all hits are pageviews (I’ll explain why in a few paragraphs).

Bounce rate is one of the metrics in the Google Analytics default report (the first screen you see when you login). I absolutely revile this report. I know its intentions are good, but I’ve seen far too many reports recapping these numbers and nothing else (to be fair, there was a time when a less-worldly version of myself created said reports).

The default report is especially worthless because it looks at bounce rate across the entire site and that’s an utterly stupid way to use that metric. Different types of pages or marketing channels will have vastly different bounce rates and you shouldn’t roll them into one site-wide number.

The red/green colored text leads you to believe that a lower bounce rate is good and a higher bounce rate is bad, but consider this: What if someone lands on a location page where they get directions or a phone number? In that scenario, they might be considered a bounce, but in reality, they completed an action that takes them one step closer to being a customer.

Or, what if the page is lead-gen oriented, contains a form and gives visitors all the information they came for, without the need to click on another page? That may also be considered a bounce, but if the visitor converts into a lead, who cares?

What if the page has a baking recipe on it, and visitors spend 20+ minutes with the page open while they use that recipe, then close the browser when they’re done? Possibly still a bounce.

I could go on, but I won’t because I’ve made my point – there are plenty of scenarios where bounces are not something to be concerned about.

When Is Bounce Rate Bad?

If your site makes money from ad revenue, bounce rate could certainly be an issue. Most ad-based sites rely on multiple pageviews per session so they can cycle more ads and increase the likelihood one one of them is relevant and gets clicked. Ever wonder why “22 Photos of Cats in Boxes” takes 24 pages to finish reading? Ad revenue, that’s why.

Similarly, if you have a high bounce rate on gateway pages that are supposed to funnel traffic to other pages on the site, that could be an issue. Even then, it’s highly dependent on the site/design/business model/industry.

In other words, yes, a high bounce can be a problem, but should be evaluated on a case-by-case basis and with plenty of scrutiny. Looking at a site-wide bounce rate is a complete waste of time, and an exercise in futility.

Interaction vs. Non-Interaction Hits

Earlier I said bounce rate is based on the number of hits and not pageviews. As noted, pageviews are a type of hit, but there are also many others including form submissions, click to call, click to get directions, video plays, etc – These actions can be set up as interaction hits or non-interaction hits.

An interaction hit will affect the bounce rate. A person who views one page and fills out a contact form will count as two hits – not a bounce.

A non-interaction hit does not affect the bounce rate. You might want to track video views, but if they’re less of a priority than form fills, you can track them as non-interaction hits. A person who views one page and watches a video that’s configured as a non-interaction hit, will still count as a bounce.

The choice between interaction and non-interaction hits gives you the flexibility to adjust the way bounce rate is calculated, for better data. But that’s not the end of it by any means.

Multi-Touch, Multi-Channel Conversion Funnels

So a single pageview is OK as long as there’s also an interaction hit, but still bad if there isn’t, right? Well…no. That bounce visit could still serve an important role in the customer’s path to conversion. It’s common for marketers to analyze and report on data using Google Analytics’ Last Non-Direct Click attribution model (guilty as charged) and when that happens, it’s easy to over-emphasize bounce rate.

Let me back up again. Google Analytics lets you apply several different attribution models in order to give attribution (credit) to different channels based on their position in the conversion path. You can read more about it here, but the default attribution model is last non-direct click, where the last channel before the conversion receives attribution, unless that channel is direct.

We know a prospective customer may visit a website multiple times before converting. We also know that customer may arrive at the site via a number of different digital channels. The diagram below shows a three touch conversion path (AdWords > SEO > Direct). While the initial touch was an Adwords ad click, organic will get attributed the conversion because it’s the last non-direct touchpoint.

But without careful analysis (and in part due to the last non-direct click attribution model), these three sessions are likely to be viewed from a siloed perspective, without making the connection they all played an important role.

Without looking at the full conversion path, this is going to look great for SEO and not so great for PPC efforts. An SEO-specific report is likely to ignore both the paid search and direct sessions that contributed to the conversion. A report specific to paid search may look at the ad spend as ineffective, since it didn’t convert in that session.

I realize including multiple channels may have you thoroughly confused, so let’s simplify it further and say all three visits were organic. This way there’s no question that organic should be attributed the conversion. Let’s also assign an arbitrary number of pageviews to each visit, as seen below.

There’s no question about which channel gets the conversion…but it doesn’t change the fact that if analysis is being done at the session-level, these three sessions will not be linked together.

The first visit will be considered a problem because it was a bounce, while the last visit will be celebrated because it resulted in the conversion. Realistically, the last visit may not have happened if it wasn’t preceded by the initial bounce. The middle visit is somewhere in between: not as good as a visit that converts, but at least it’s not a bounce.

It’s possible that all three of these visits played a critical role in the customer journey and discrediting any one of them could result in lost conversions. Similarly, spending time trying to lower bounce rates may be futile if those bounces play a bigger role in a longer path to conversion.

Takeaways

Bounce rate is incredibly complex and boiling it down to good or bad is very, very difficult. As an SEO consultant, I rarely ever focus on bounce rate because I understand this complexity. Bounce rate is not something I report on, and lowering it is never an objective of my campaigns.

SEO projects should be focused on driving relevant traffic that eventually converts into leads, sales and customers, not driving down bounce rates in order to achieve a perceived industry standard or arbitrary metric.

Questions? Comments? Tweet at me (@BerkleyBikes) or drop a comment here!

What Is Data Sampling in Google Analytics?

By Analytics, SEO

Google Analytics lets you segment and filter data in hundreds of different ways. When you think about what GA does and how much granular data it logs, it’s downright astonishing. It’s even more astonishing that this data is readily available and can be viewed within the Google Analytics interface without needing to request custom reports.

However, there is a limit to how much data can be processed. When you pull a large date range, or look at a busy month and try to segment by landing page, device, location, etc – you’re requesting Google Analytics to process hundreds of thousands of data points. When you consider that Google Analytics is deployed (for free) across millions of websites, it’s easy to see how the amount of processing power required could quickly spiral out of control.

So what happens?

Instead of saying “report unavailable” or “too much data to process,” Google Analytics uses data sampling. It takes looks at a much smaller cross-section of the data and assumes it is an accurate sample of the entire dataset.

Picture this: you want to know how much sleep you get in a year. Instead of tracking how much sleep you get every night for 365 days, you log how many hours you sleep in one week and multiply that by 52 weeks. The assumption is that the one week you track is a pretty typical week, representative of the way you sleep most of the time.

What’s the problem?

That one week may not be representative of the way you sleep all year. Maybe you sleep more in the winter and less in the summer. Maybe your work schedule varies and that affects how much you sleep on a week-by-week basis.

Sure, you could take a larger sample size – track 4 weeks and then multiple by 13 instead of 52. The larger the sample size, the more likely it is to be accurate. But it’s still not perfect because you’re making assumptions that those other 48 weeks follow the same pattern as the four you’re measuring.

How Does Data Sampling Apply to Google Analytics and SEO?

Tracking how much you sleep probably isn’t that critical, but when you’re making marketing decisions that cost tens or hundreds of thousands of dollars, you want to be sure you’re using accurate data. You can avoid data sampling, if you’re mindful of it and recognize when it’s happening. Google Analytics does let you know when the report you’re looking at is based on sampled data, but it’s very non-descript, located in the top right corner with nothing to draw your attention to it.

“This report is based on 100% of sessions” indicates the data is not sampled.

Anything lower than 100% is the percent of visits that the report is based on. The lower the number, the smaller sample size.

How Much Does Data Sampling Skew The Numbers?

Let’s look at some test cases. In both of them I used an Organic-only Google Analytics View, with a mobile traffic segment applied and a date range of 1 year (1/1/16 to 12/31/16). This is a very common setup, that allows you to report on metrics relevant to mobile device performance over a 1 year period.

In the two test cases below, the dataset was pulled in two ways:

  1. Monthly numbers were pulled in 1 data export for a 12 month date range.
  2. Monthly numbers were pulled in 12 data exports for 1 month date ranges.

Data Sampling Test Case #1: Sessions

In this report we’re just looking at sessions (visits) for a high level overview. This is a very straightforward report – finding out how many visitors came to the site on mobile devices and trying to establish a month-by-month trend.

The unsampled default report shows a total of 338,827 visits during this time period. After adding the mobile segment, the sampling rate was listed as 27.33% – meaning the sample size was only 27.33% of the total visits.

The graphs below show the variance between the single data pull and the 12 data pulls. In this example, the sampled data is over-reporting by 0.99%.

That may seem minor, but look at the individual months – the variation is much wider on a monthly-to-month basis – anywhere from -20.16% to +18.77%. More than half of the 12 months in the year were off by more than 10%.

Data Sampling Test Case #2: Goal Conversions

In this report we’re drilling down into goal conversions which are more important in many cases – these might represent actual customers or leads.

The unsampled default report shows a total of 6,341 goal conversions during this time period and the sampling rate is still 27.33% because we haven’t changed the segment we’re using. In this case, the overall numbers are only slightly worse – over-reporting by 2.44% instead of 0.99%.

However, the monthly variance is MUCH worse. Look at August: over-reporting by a whopping 39.04%! September and October aren’t much better, over-reporting by 28.97% and 25% respectively.

Both of these reports are completely inaccurate and worthless for establishing seasonal patterns, or year-over-year performance by month. The only way to get accurate data is to use unsampled data, either with smaller date ranges, or using the API.

When Does Sampling Occur?

Data sampling does not occur in default reports, but adding segments or filters will trigger sampling. It doesn’t necessarily matter what segments or filters are added – they could be based on landing pages, devices, mobile vs. desktop, etc. It also depends on how many sessions are within the date range. A site that gets 500,000 visits per month will encounter data sampling much sooner than a site that gets 50,000 hits a month.  

How To Avoid Data Sampling in Google Analytics

For one, use a smaller data range. Smaller date ranges reduce the number of visits, which reduces the likelihood of sampling. If you’re trying to look at a larger date range, exporting data in smaller batches is the way to go. This can be tedious if you’re trying to use the Google Analytics interface, which is why I recommend using the Google Analytics/Sheets API. The Google Analytics/Sheets API is incredibly easy to use and does actually reduce the sampling rate itself. It’s also much faster for exporting multiple datasets at once.

You can also set up Google Analytics Views specific to certain data sets. Views exclude data before it even gets into the interface. The session limit is still the same, but when you add filters/segments, you’re doing so with a smaller amount of data points, so sampling doesn’t occur as quickly. I always set up an Organic-specific View so that I can look at organic data by itself – that helps avoid the session limit when segmenting landing pages by URL structure, for example.

The last choice is to upgrade to Analytics 360. This is Google’s premium version of Standard Analytics, and lifts the sampling threshold from 500,000 sessions (at the property level) to 100 million sessions. It’s worth noting that Analytics 360 costs well over $100,000 – far outside the reach of many companies who aren’t big enough to afford it, but do get enough traffic for data sampling to be a common occurrence.

Summary

  • Sampled data is not accurate data.
  • Never use sampled data for reporting or analysis.
  • Sampled data can be eliminated by choosing smaller date ranges, the Google Analytics/Sheets API.

As always, tweet me @BerkleyBikes or comment here with questions.

How To Track Showcase IDX Conversions in Google Analytics

By Analytics

Real Estate clients using the Showcase IDX WordPress plugin are in luck – the plugin has exceptional functionality that’s great for SEO and website analytics too. In this post, I’ll show you how to setup conversion tracking for two things:

  1. When a site visitor creates a Showcase IDX account.
  2. When a site visitor contacts the client through the Showcase IDX interface.

Since these are both critical actions that a site visitor would take on the way to becoming a customer, we’re going to set up both of these as goal conversions in Google Analytics so that we can determine what channel they’re coming from and analyze the efficacy of different campaigns. Full disclosure: Showcase IDX has an excellent tutorial on how to do this, but I’ve added a few extra details that I found helpful.

New Registration (Account Signup) Conversion Tracking

When a site visitor creates an account within the Showcase IDX platform, Showcase IDX labels this as a “New Registration.” Out of the box, the platform sends an Event to Google Analytics, removing any need for custom event configuration. All you need to do is set up a goal conversion based on the Event.

First, go into Behavior > Events > Top Events and you should see “Showcase IDX” listed as an Event Category. If you don’t see it immediately, widen the date range that you’re analyzing – it’s possible that there weren’t any registrations during a smaller date window.

Click on “Showcase IDX” and you’ll see one or two Event Actions listed. These will either be “New Registration” or “New Message.”

Clicking into these will give you some additional details but for now we’re focusing on setting up Goal Conversions.

Now go into Admin and in the “View” column, click on “Goals. ” This is where we’ll set up new goals.

At the top, click the red “New Goal” button (you can see I already have Contact Form Submissions and Mobile Click to Call goals set up).

From here, Goal Conversions are configured in three parts: Goal setup, Goal description and Goal details. First, make sure “Template” is checked and then select “Create an account” as the goal template for New Registrations. Click the blue “Continue” button at the bottom.

By choosing the Create an account template, the goal will be named “Create an account” by default. I prefer to be more descriptive and have renamed it Account Creation (Showcase IDX). Make sure to next check the “Event” box under Type. Then click Continue.

This is the most important part. Remember the Event Category and Event Actions that we looked at before? Now we’re going to put them to use. Under the Category box, enter ShowcaseIDX exactly as it’s seen in the Top Events report.

Under the Action box, enter New Registration. This will ensure that only Events fitting this specific criteria are tracked as Conversions. 

Lastly, click Save. You’ve now setup Goal Conversion tracking for new Showcase IDX registrations.

New Message Conversion Tracking

I also recommend setting up a separate Goal Conversion for new messages that are sent through the Showcase IDX platform. This Goal Conversion is even lower in the funnel than New Registrations because prospective customers are going one step further and reaching out.

The process is mostly the same with some small differences. In the Goal setup phase, select “Contact us.”

In the Goal description phase, I’ve chosen to rename the Goal as New Message (Showcase IDX).

In the Goal details phase, you keep the same Category (“ShowcaseIDX”) but change the Action to “New Message.”

Once you’ve created and saved both of these goals, remember to verify they’re setup correctly by doing a few test submissions. Make sure you’re taking into account any filters for IP address, or Google Analytics opt out browser extensions that would eliminate any test submissions from appearing in the interface.

I often test submissions using my phone on data mode (not wifi) – this simultaneously bypasses any IP filters that I have setup in Google Analytics as well as browser extensions. Also keep in mind that while a user can trigger multiple Events within a single website session, Google Analytics will only record one Goal Conversion. If a single visitor sends several messages during a single site visit, GA will only register one Goal Conversion.

If you have any questions, tweet me @Berkleybikes, or comment below (Twitter is preferred for faster responses).

How To Verify Google Search Console (Webmaster Tools)

By Analytics, SEO, Technical SEO 2 Comments

 

Creating a Google Search Console profile is actually quite easy, with the possible exception of the pesky verification part. Nevertheless, it’s not that difficult, and I’ll show you how to do in record time. There are 5 ways to verify a Search Console profile. Your site configuration, tracking setup, user permissions, etc. will determine which one is best for you. I’ll explain them all here, starting with my preferred methods. If you’re doing this on WordPress, skip to the bottom of the post, I’ve got specific instructions just for you.

Google Analytics

Google Analytics is a fairly easy option, assuming three things:

  1. You’re using asynchronous (analytics.js) tracking code.
  2. Tracking code is placed in the <head> section.
  3. You have ‘edit’ user permissions.

If any of these three things raises a red flag, the GA verification option is not for you. If you pass the criteria, click the red Verify button and you’re off to the races. If you’re using Google Tag Manager, this method is a no-go, but you can use the GTM method in the paragraph after this.

Google Tag Manager

If you’re using Google Tag Manager, you can’t use the GA method, but there’s an option specifically for you. Needless to say, there are criteria for this also:

  1. You have to be using the container snippet.
  2. You must have ‘manage’ user permissions for that container.

If you don’t fit those criteria, keep moving. If you do, click ‘Verify’ and you’re done.

HTML Tag

The HTML tag is simply a meta tag (a single line of HTML code) that gets added to the homepage and voila, verifies the site/profile. Depending on the CMS, this may be very easy to do (in WordPress it’s a pinch). You can either do this yourself if you have CMS access, or ask a web developer or marketing manager to implement it. How you do this depends on what CMS you’re using. It’s likely you have a custom HTML field or something similar where the tag can be added. The tag needs to go in the <head> section of the homepage.

Once you’ve verified it has been added, go back into Search Console and click the big red ‘Verify’ button. Even after you’ve succeeded, leave the HTML tag on the home page, or the property will revert back to unverified status.

HTML File Upload

The HTML file upload is similar to the HTML tag, but instead of a line of code, you’re adding a small HTML file to the root domain. To do this, you’ll effectively need the ability to add files to the root folder on the hosting provider. FTP access is ideal, but if you’re a marketer, you probably don’t have that. If possible, ask the web developer to add it. Once you’ve done this, visit the URL created by the file to ensure it’s in the root folder and not a subfolder.

Domain Name Provider

This method is listed as Google’s recommended method – possibly because it’s the most secure? In any case, Google will prompt you to log into the provider where you bought your domain name (for example, GoDaddy or NameCheap).

If you have access to the domain name provider – that’s fine. However (and speaking from experience) it’s much more likely that you don’t have access to this, which makes it a moot point. I’ve only used this method to verify a Search Console profile once, and it was on my own site. On the hundreds of other GSC profiles I’ve created over the years, I’ve never had access to the domain name provider. With clients, getting access to that may involve going through a compliance department or IT team, which, as you can imagine, takes far more time than it’s worth. There are simply easier ways!

Search Console/Webmaster Tools Verification on WordPress

If you’re trying to verify Google Search Console or Bing Webmaster Tools on WordPress, you’re in luck, because it’s ridiculously easy. I’ll assume you already have one of two SEO plugins installed. Either A) Yoast’s WordPress SEO plugin or B) All In One SEO Pack. Both are really freaking good plugins and you’re doing yourself a disservice if you don’t have one of them installed on your WordPress site.

Verifying Search Console with Yoast’s WordPress SEO Plugin

In the WordPress backend, go to SEO > Dashboard > Webmaster Tools. Yes there is also a Search Console menu item. No, that’s not where you actually verify Search Console.

Here you’ll see three different form fields Go back and look at the HTML tag I mentioned earlier in this post, copy the value and enter it here. You can also enter your Bing Webmaster Tools Verification (you have that too, right?)

Once you’ve done that, click ‘Save Changes’ then go back into Search Console and click verify (using the HTML tag method).

Verifying Search Console with All In One SEO Pack

For those using All in One SEO Pack, the process is not much different. Go to All In One SEO > General Settings and scroll all the way down to the ‘Webmaster Verification’ section, where you will see the same two fields for Google and Bing Webmaster Tools.

 

Once you’ve done this, KEEP SCROLLING DOWN. With so many features on one page, it’s easy to miss the ‘Update Options’ button, which is critical to make sure your settings get saved.

That’s essentially it. With 5 different options to verify GSC, you’re sure to find at least one option that works for you, and verifying by more than one option is always a nice failsafe if you have the option available to you. Questions? Comment here or hit me up on Twitter (@BerkleyBikes)

Additionally, don’t forget to setup Bing Webmaster Tools so that you can get the same insights from Bing.

Contact Form 7 Event Tracking with Google Tag Manager

By Analytics 143 Comments

If you fit the following criteria, this article is right for you:

  1. You use the Contact Form 7 plugin on your WordPress site.
  2. You want to set up contact form submissions as a Goal in Google Analytics (or even just as an Event).
  3. You have Google Analytics deployed on your site using Google Tag Manager.

If you’re not using Google Tag Manager, the tutorial on Contact Form 7’s site is really quite good. However, if you’re using Tag Manager, I haven’t found a resource that will help you much, so I created one here. It’s really quite easy, there are several simple steps:

Step 1: Create a GTM Tag that pushes a Data Layer event when mail is actually sent (and includes the form ID).

Step 2: Create a GTM Trigger that looks for the Data Layer event when mail is sent, and triggers a second tag.

Step 3: Create a GTM Tag that sends events to Google Analytics based on the Data Layer event.

Step 4: Create a form ID Data Layer Variable.

Step 5: Set up a Goal Conversion in Google Analytics based on the Event.

Ninja Forms

Step 1: Log into GTM and Create Tag #1

When the click the “Submit” button on a Contact 7 Form, it fires a form submission event. Unfortunately, it fires this event regardless of whether the required fields have been filled out – the form may not have actually sent, but the event is still triggered.

Fortunately, the plugin does fire DOM events for several different scenarios and these DOM events distinguish between successful form submissions and unsuccessful form submissions. What does that mean? These are the DOM events as described on the Contact Form 7 website:

  • wpcf7invalid — Fires when an Ajax form submission has completed successfully, but mail hasn’t been sent because there are fields with invalid input.
  • wpcf7spam — Fires when an Ajax form submission has completed successfully, but mail hasn’t been sent because a possible spam activity has been detected.
  • wpcf7mailsent — Fires when an Ajax form submission has completed successfully, and mail has been sent.
  • wpcf7mailfailed — Fires when an Ajax form submission has completed successfully, but it has failed in sending mail.
  • wpcf7submit — Fires when an Ajax form submission has completed successfully, regardless of other incidents.

The middle one is key: wpcf7mailsent. As described, this trigger fires when the form has actually been submitted and mail has actually been sent. We’re going to use Javascript to create a Data Layer event. Log into GTM and either select the “New Tag” box or navigate over to the “Tags” section and create one there. Create a new GTM tag (I’ve called mine wpcf7mailsent) with the following configuration:

Tag Type: Custom HTML

Add the following code:

<script>
document.addEventListener( 'wpcf7mailsent', function( event ) {
        dataLayer.push({
          'event' : 'wpcf7successfulsubmit',
          'CF7formID' : event.detail.contactFormId
        });
    	}, false );
</script>

Triggering: All Pages

What this does is listens for the wpcf7mailsent DOM event and fires an event into the Data Layer called “wpcf7successfulsubmit.” It also captures the form ID in the Contact Form 7 shortcode and pushes it into the Data Layer too (in the screenshot below, that ID is “1192”).

Next we’ll set up a Trigger that uses this Data Layer event to trigger the Google Analytics Events that the Goal Conversion will be based on.

Step 2: Create a GTM Trigger

Next, create a Trigger for the Tag you’ve just created. I named mine Contact Form 7 Trigger.

Trigger Type: Pick Other – Custom Event from the default list. We’re going to use the event we created in Tag #1 as the trigger event.

Event Name: wpcf7successfulsubmit

This Trigger Fires On: All Custom Events

This uses the custom Data Layer event we created in Step 1 to trigger a Google Analytics event tag which we’ll setup in Step 3.

Step 3: Create Tag #2

Log into GTM and either select the “New Tag” box or navigate over to the “Tags” section and create one there. Name the new tag whatever you want (I’ve chosen the oh-so-descriptive “Contact Form Submission”).

Fill out the following fields as such:

Tag Type: Universal Analytics

Tracking ID: Your tracking ID. I have mine set up as a variable, which explains why it says {{GA Tracking Code}}

Track Type: Event

Next you’re going to set the Category, Action, Label and Value for the Event we’re creating. If you’re not familiar with these, there’s more information in Google’s Analytics Help page for Events.

Category: You can set this as whatever you want and that’s what it’s going to show up as in Google Analytics when you go to the Events report. I named mine contact-form.

Action: Again, the choice is yours. I’ve selected successful-form-submission-mailsent.

Label: If you want to track different forms separately, you need to set this as {{CF7-formID}} and follow the rest of these instructions closely.

Value: I did not add a value.

Non-Interaction Hit: This is also your decision and the True/False answer will effectively change your bounce rates when the hit is fired. In essence, if someone lands on a page and completes a form submission then leaves without viewing other pages, that would be considered a bounce unless you choose False. I think someone who completes a form submission then leaves should not be considered a bounce, but that’s different for everyone. (Read more about bounce rates.)

More Settings & Advanced Settings: If you’re an analytics whiz, there are advanced settings in here that you may want to configure. However, I did not change any of them.

When you’re done, you’ll end up with something like this:

 

 

Step 4: Create a Form ID Data Layer Variable

In Step 2 we pushed the shortcode’s ID into the Data Layer. When the form is submitted, the form IDs are pushed into the Data Layer (see below) and we need to capture them and get them into GTM and into our Google Analytics Events.

 

Add a new user-defined Variable called CF7-formID. Set the Data Layer Variable Name as CF7formID (case sensitive).

 

Step 5: Setting up the Goal Conversion(s)

Next, go into Google Analytics and navigate to Admin > View > Goals. Click +New Goal and set it up as such:

Goal setup: Select Custom

Goal description:

Name: Call it whatever you want. Consistent with the spirit of this how-to, I’ve called mine Contact Form. 

Type: Select Event.

Goal details: 

Category: Equals to > contact-form (or whatever YOU named it in GTM)

Action: Equals to > successful-form-submission-mailsent (or whatever YOU named it in GTM)

Label: Select the form ID of the form you want to track. If you don’t want to track different forms separately, you can leave this blank. Mine was 1192.

Value: You can add another variable here if you want, like page URL, etc.

Use the Event Value as the Goal Value: If you had a value attached to each event, you could set that up here. Since I did not, I will not.

Now click ‘Save’ and you’ve set up the Goal Conversion and appropriate tracking. If you want to set up other goals for different form IDs, just repeat the process but change the Label in the Goal Conversion.

If you’re having issues making this work, please see my troubleshooting guide first, and if you’re still not successful, contact me and I may be able to take a look.

Ninja Forms Conversion Tracking

See how to set up similar tracking for Ninja Forms using GTM and GA.

How to: Learn the Google Analytics API with G Sheets

By Analytics, SEO No Comments

Listen, I get it. You’re not a developer and neither am I. The letters A-P-I probably give you palpitations. BUT, if you’re using the Google Sheets add-on, the Google Analytics API is really simple. Seriously.

What follows here is a beginner’s introduction that shows how to start using the API. This is for non-technical types and will start at square one. Full documentation is available at Google’s Implementation Guide.

Step 1: Getting Google Sheets Set Up

First, log into a Google account that has access to the Google Analytics account you normally use. Go to Drive and open a new Google Sheet, then go to the menu bar and select Add-ons > Get add-ons.

Next, search for Google Analytics and you’ll find this add-on:

Go ahead and click the +Free button to add it to your Google Sheet. When the authorization prompt pops up, click Allow at the bottom right.

Step 2: Getting Your Report Configuration Set Up

When you create a report the first time, the add-on does offer a user-friendly interface with drop down menus, etc, to help you set up your first report. You can access this by going to Add-Ons > Google AnalyticsCreate new report. I’m not going to use that, because ultimately, you’ll be making changes in the Sheet itself and it’s more valuable to understand what each of these fields does.

Now that you’ve got the add-on installed, go to Add-Ons > Google Analytics > Run reports. You’ll see this pop-up indicating the report failed, which is expected – we haven’t configured anything yet.

The point of doing this is: the add-on has now populated all the configuration fields that we’ll be working with to get it set up properly.

All those fields probably look confusing, but we’ll start breaking them down one by one and you’ll see it’s not that complex to pull basic data.

Step 3: Configuring Individual Fields

Report Name

When you run the report, the add-on is going to create a new tab in your Google Sheet with the information you’ve selected. Report Name simply tells the add-on what to name that tab. You can call it whatever you want, I’m calling it JAN.

Important Note: When you re-run the report multiple times, it will replace the data in the tab you’ve created. If you change the Report Name, it will create a new tab, preserving the old one. If you run the report and then delete the Report Name, it will keep the existing tab and preserve the data without creating another tab.

Type

Enter core.

core

View (Profile) ID / ids

Go into the Google Analytics view you want to pull data from. Click over to Admin and select View Settings under View.

Copy the View ID number.

Paste this into the Google Sheet with ga: in front of it.

ga:55555555

Start Date

This is no different than setting the data range in Google Analytics. Add the start date in a normal date format.

1/1/17

End Date

Same as the start date, just pick your end date. Make sure it’s a date in the past, and a day with complete data. For example, if it’s March 5th, don’t pick a date range of 3/1/17 – 3/31/17. Also, don’t pick a date range of 3/1/17 – 3/5/17 because that day isn’t over yet and you’ll have incomplete, sampled data (Learn more about data sampling).

Last N Days

You can also pick a fixed number of days prior to the current day. I don’t use this field, but if you did, you’d simply enter an integer for the number of days you wanted to report on. For clarity, I suggest removing the start/end date, but the add-on does appear to override those dates if the Last N Days field is populated.

Metrics

This is the important stuff you really want to measure and you can have multiple metrics in here. You can use the Dimensions & Metrics Explorer to find Metrics to use. Since this is a basic guide, we’ll stick to simple ones.

  • ga:sessions – Pulls the number of sessions.
  • ga:goal1Completions – Pulls the number of Goal 1 Completions.
  • ga:goal2Completions – Pulls the number of Goal 2 Completions.

These will all get entered into the same cell.

ga:sessions
ga:goal1Completions
ga:goal2Completions

Dimensions

Using the GA interface, you have the option to define the primary dimension, and you can do that here too. Popular choices might be:

  • ga:landingPagePath – Find landing pages responsible for sessions and goal completions.
  • ga:medium – Find the number of sessions and goal completions by channel (Organic vs. Referral vs. Paid, etc.)
  • ga:sourceMedium – Find sessions and goal completions by source & medium (Google Organic vs. Bing Organic vs. Google CPC, etc.)

We’ll keep it simple and go with landing pages. If you want to measure those by a specific medium, we’ll add that in a few paragraphs below this.

ga:landingPagePath

Sort

Really simple. How do you want the data sorted? Obviously, you can only sort by one dimension, so pick the dimension of your choice from above and enter it in this cell. GA’s default is to sort by sessions from high to low, and if you want to do that, enter a minus sign before the metric.

-ga:sessions

Filters

You can start to get really complex here, and if you use filters when you normally look at data in GA, you’ll need to add those here. For now, we’ll use a basic filter to look at organic traffic only.

ga:medium==organic

This ensures we’re only pulling sessions, goal completions and landing pages from the organic medium.

Segment

Segments are arguably the most complex field of this report. There are multiple ways you can create segments, and the criteria for building them can be found in Google’s core reporting documentation.

In short, they can follow a syntax similar to this, where you’d have a segment for sessions from Canada:

sessions::condition::ga:country==Canada

For simplicity, I won’t use a segment in this walk-through.

Sampling Level

I never pull sampled data because it doesn’t paint the whole picture. Because of that, I opt for the higher precision setting and I suggest you do too.

HIGHER_PRECISION

Start Index

This option allows you to only show results from a specific starting point. For example, if you were pulling landing pages and wanted to ignore the top traffic-driving page (like the homepage) you can set this to ‘2’ and it will ignore that top result. I don’t use this much.

Max Results

The maximum value is 10,000, so no real reason to set it lower than that.

Spreadsheet URL

If you want to export the results into a separate sheet, you can enter the URL here.

Final Review

Once you’ve filled out all the fields, your configuration will look something like this:

Step 4: Run the Report

Once you’ve filled out all the fields, go back to Add-Ons > Google Analytics > Run reports. The sheet will render a new tab with the name you entered in the first field.

The resultant tab will look like this:

Check cell B6 and make sure it says ‘No’ – this will indicate whether you have sampled data or not. If you do, pick a smaller date range or narrow your area of focus to ensure your data is not sampled.

Step 5: Create Additional Reports

One of the benefits of using this is that you can run multiple reports simultaneously and pull data faster than you ever could using the web interface.

If you want to create another report, simply add data in the columns to the right of your first report. This is a super easy way to pull the same data over multiple months.

Step 6: Analyzing the Data and Building Reports

What’s next is up to you. The API is simply a faster way to get a lot of data out of GA and into a spreadsheet. From there, you can elect to build reports directly in Google Sheets, Google Slides or Google Docs. You can also export the data into Excel or build a PowerPoint.

I tend to prefer building reports in Docs or Slides using data that lives in a Google Sheet. That way it can be easily updated and is accessible to multiple editors who might be compiling the report.

Questions

As always, comment here or tweet at me if you have any questions.