“Enterprise” Google Analytics

August 26, 2008 by Justin Cutroni

Is Google Analytics an “enterprise” class analytics solution? That’s debatable, and in fact, it has already been debated.

In my opinion, it depends. It depends on your analytics needs.

We’ve worked with plenty of “enterprise” class organizations that were new to web analytics. They had very simple needs and GA met most of them easily. We’ve also told companies that GA is not right for them because it did not fit their core needs.

Your organization may be different. You may need a tool that integrates with ODBC data sources, something that GA doesn’t do very well. If that’s the case then you might need to go with a different tool. But again, it all depends.

Google Analytics Enterprise-ness

But the point of this post is not to debate GA’s “enterpise-y-ness”, but to address some of the common issues that we usually see during an enterprise installation.

Issue #1. Tracking All Sites Logically

Major League Baseball

Large organizations tend to have more sites, and more sites mean more data. Collecting the data in an organized fashion, that allows room for growth and appropriate access for users, takes time and planing.

During an enterprise implementation we usually create a series of accounts and profiles that segments the data based on business logic and access needs. We create a data hierarchy that provides high level aggregate tracking across the entire online experience (i.e. roll-up reporting) and detailed tracking for each individual property.

Let’s consider the websites for Major League Baseball. Each team has their own site located on a subdomain. There is also an MLB store and different micro sites dedicated to things like the All Star Game and the World Series.

Lots of content on many different sites. While the exact implementation solution will depend on their specific needs, it probably involves collecting all the data in a single profile for roll-up reporting and then creating profiles for each team and micros site for detailed reporting.

Issue #2. Unique Visitors

Tracking lots of domains usually leads to an issue with unique visitor tracking. GA uses a first party cookie to identify each visitor. This means that if a visitor visits 3 different domains they will receive 3 different cookies and appear as three different unique visitors.

Now, I know GA has a cross domain tracking feature. But what happens if an enterprise wants to know the unique visitor count across 50 web properties? Installing cross domain tracking on that scale is a huge task. In fact, it’s a pain in the ass.

Many of the clients that I’ve worked with have compromised and ignored unique visitor tracking.

You may be different. Unique visitors may the one critical metric that you can’t live without. Could you use GA? Maybe, but you should carefully weigh the implementation needs vs. your analysis needs.

Unique Visitors are Unique!

Issue #3: Page Tagging

When I first started working with GA I never thought that tagging pages would be an issue, but it is. It’s not so much a technical issue as it is an organizational issue. Big companies can have so many sites with some many nooks and crannies. It can take a lot of work to identify every site, find an owner and then get the tags placed in the appropriate place.

And let’s not forget non-HTML pages. Tracking non-HTML content with Google Analytics can be a huge challenge. You can’t slap a JavaScript Tag on a PDF. When we work with large organizations we usually help then develop an automated click tracking script. This takes more time and more effort and doesn’t always work (usually due to page rendering delays).

Issue #4. URL Structure

URL Structures can be manually created using Google Analytics.

This is probably one of the most difficult challenges we face when working with large sites that have hundreds of thousands of pages. GA will only track 50,000 unique URLs per day. While this is completely adequate for most sites “enterprise” sites can exceed this limit, especially if the site is content based (think about a some of today’s largest community sites, they have forums, blogs, and tons of user generated content).

What happens when you fill GA with 50k unique URLs in a day? You start to see ‘(other)’ in your content reports and you can no longer identify which pages visitors are viewing on your site.

To resolve this issue we usually need to create some type of bucketing strategy to ‘roll up’ pageview data into different content categories. This is normally done by matching requested URL patterns at the server level, and then generating a ‘virtual’ pageview in GA.

Sometimes we segment the data into different profiles, thus giving us more ‘buckets’ to store the data.

Again, the exact solution depends on many different factors, but this issue can be mitigated with some effort.

Issue #5. Campaign Tracking

This is a problem for everyone! I find very few clients whoa are diligent about tracking their marketing campaigns using link tagging. A general rule of thumb, the bigger the client the more challenging it is to track all online campaigns. Why?

Big organizations have different people running different campaigns. Many times they’re using one or more agencies to help run their campaigns. Getting everyone to use a cohesive link tagging strategy is a lot of work due to the sheer number of people that are involved. This is more of a training/process issue rather than a technical issue.

Wrapping Up

If you’re an enterprise organization, or consider yourself an enterprise organization, don’t discount GA without taking a hard look at your real analytics experience and your needs. GA might just work for you.

If you do decide to use GA don’t expect to slap the tags on your site and finish the configuration in a week. Like every tool out there, it takes time and planning to get things right.

Do you have experience with GA in a large, “enterprise” environment? Leave a comment and share your thoughts.

Subscribe:

Tracking YouTube Videos with Google Analytics

July 29, 2008 by Justin Cutroni

A while back, Google Analytics and YouTube introduced YouTube Insight, a tool to provide more information about the people viewing your videos on www.youtube.com. It’s pretty cool stuff and if you’re posting videos to YouTube it provides a lot of great information.

YouTube Insight: Information about those viewing your videos on www.youtube.com.

But what about YouTube videos that are embedded in a site? What’s the best way to measure interactions with these videos? You could use some basic metrics like Avg. Time on Page and Avg. Time on Site, but they’re averages and, well, averages suck. Fear not, there is a better way.

We can track almost every aspect of an embedded YouTube video using Event Tracking, a Google Analytics beta feature.

CHROME

There is one catch. In order to track an embedded YouTube video you must use the ‘chromeless’ YouTube player. A chromeless video player has no controls which means you must create all of the controls yourself. This results in a fair amount of coding.

Why do we have to use the chromeless player? The chromeless player let’s us add JavaScript code (i.e. GA Event tracking code) to user actions, thus giving us the ability to capture visitor actions as events. I’ll do my best to walk you through all of the code.

You can read more about the chromeless YouTube player on the YouTube developer site.

Let’s get started.

Event Data Model

Before we look at any code let’s talk about data and analysis. One of the keys to any successful event tracking implementation is a clear definition of the data we want to collect. Remember, event tracking is really a flexible data collection tool. We need to explicitly define the data we want to collect.

I want to track three primary things related to the embedded video:

1. Which video does the visitor choose to watch?
2. How do they interact with the video player (i.e how do they use the controls)?
3. How much time do they spend watching each video?

Now let’s translate these needs into the Google Analytics Event model which consists of Objects, Actions, Labels and Values.

Objects

The object is the part of the page that we want to track. Defining the object in this case is pretty simple: we want to track the YouTube video player, so we’ll create one object and call it “YouTube Video Player”. The object will literally be created in the code and I’ll explain how later.

Actions

Actions are the interactions that the visitor exerts on the object. What we want to track, and what we can track, really depend on what interactions we can capture. In this example, the actions we can capture are directly related to the chromeless YouTube player and what it ‘bubbles up’ for visitor interactions.

Based on the chromeless player, and the data needs we have defined, here are the actions that we are going to track:

  • Player Loaded: Indicates the YouTube player has loaded. No video has been loaded into the player, but the player is ready for a video.
  • Video Started: Indicates the user has chosen a video and it has started playing in the player.
  • Play: User has restart the video after it has been paused.
  • Pause: Video has been paused.
  • Mute: Video has been muted.
  • Unmute: Video has been unmuted.
  • Error: An error has occurred.
  • Ended: Selected video has ended, either intentionally or on purpose by the visitor.
  • Get Embed Code: Request HTML code to embed the video in a site.
  • Get Video URL: Request YouTube URL for the current video.

Like the object, actions are actually created in the code and we’ll see how later.

There are other things that we can track, but I’ve decided to limit it to the above list. Why? I don’t think there is a lot of insight that can be gained from some of the other information that is available to us. Plus the above actions will cover the data needs we’ve defined.

Google Analytics Event Labels.

Labels

Labels are the content of the object. In the case of most video player object, the label will be the name of the video playing. In this example you can choose three potential videos from a drop down box. The name of the video will become the label that is tracked in Google Analytics.

  • Apollo 11 Launch
  • About the YouTube API
  • Phish - Weekapaug Groove
  • Authors@Google: Avinash Kaushik

Values

This is where things can get a bit unique. The value collected by GA’s Event tracking is just a plain integer. All values associated with actions are summed and averaged. So we can’t mix different types of data, like monetary values (which may be in dollars) and time (which may be in seconds). For this example, we’re going to track time, so the values will be in seconds and will represent the total time that each video played.

I’m only going to associate a value with a single actions: Ended. When a video ends we’re going to record the total number of seconds played for that video.

The Example

Now that we’ve created the data model for tracking a YouTube player, we need to create a YouTube player to track. :) Remember we can only access visitor actions when we use the chromeless YouTube player.

Here’s a simple page that I created using the chromeless player and Google Analytics Event Tracking.

If the above iFrame is not visible, you can view the entire code here.

For those interested, this test page is actually a modification of the YouTube API example.

To start the tracking, select a video from the drop down and it will start playing. Then experiment with some of the controls. All actions that we defined in our event model will be tracked.

If you want to change videos just choose a new video from the drop down box.

I don’t want to go over too much of the code, but here’s the JavaScript behind the tracking.

If the above iFrame is not visible, you can view the entire code here.

A majority of the code is not Google Analytics code, but rather YouTube player code. What I’ve done is added the Event Tracking code in the appropriate places to capture the visitor interactions. Setting up the event tracking code is really pretty simple.

The first thing I did was create the Object, which is called ‘YouTube Video Player’. I created the object in the main GA page tag.


<script type='text/javascript'>
var pageTracker = _gat._getTracker("UA-XXXXXXX-X");
pageTracker._initData();
pageTracker._trackPageview();
  
// Create the event tracking object
var ytpEventTracker = 
pageTracker._createEventTracker("YouTube Video Player");
var eventLabel;
</script>

After creating the object I added the _trackEvent() method wherever I want to capture a visitor action, like Play or Pause. Here’s how I capture the Play action:


function play() {
  if (ytplayer) {
    ytplayer.playVideo();
    ytpEventTracker._trackEvent("Play",eventLabel);
  }
}

Most of the Play code is actually YouTube code. The only GA specific code is ytpEventTracker._trackEvent("Play",eventLabel);.

We pass three values to _trackEvent(). The first is the name of the action and this value will appear in the GA Actions report. The second value is the lable value which will appear in the Labels report. I should note that eventLabel is the name of the video (per the data model) that is currently playing when the visitor clicks on Play.

The final value, which is not shown above, is the value value. In this example, the value is the total number of seconds played. This is only recorded for the Ended action.

If you look at the example code, all I really did was add ytpEventTracker._trackEvent() to all the actions that I wanted to track.

The Results

Enough with all the techno-mumbo-jumbo. Let’s look at some of the data starting at the top of our hierarchy: the Object report.

Google Analytics Object report.

Noting too exciting here. We’re only tracking a single object here, hence the one line of data. The data can be a little confusing. The total number of events is really the total number of actions that occurred. The number of unique events is the number of visits that included an event.

But let’s dig a bit deeper. Let’s see which video was most popular by viewing the labels associated with the YouTube Video Player object. All I need to do is click on the Object name to view the associate labels and actions, and then choose ‘Labels’ using the Detail Level link above the table tabs.

Google Analytics Label report.

Here we can see that ‘Phish-Weekapaug Groove’ was the most popular video, when based on time. It had a higher total value than the other videos. Sorry Avinash. :)

One thing to notice is that measuring the popularity of each video based on Events is not correct. Just because a label has the most actions does not mean that it is the most popular.

Remember, an action can occur ever time a visitor interacts with the player. In this example it would be more accurate to judge popularity based on time.

Now let’s see how people interacted with the most popular video. What actions did visitors perform when ‘Phish-Weekapaug Groove’ was playing?

All I need to do is click on the label name to see the actions associated with the label.

Google Analytis Action report.

Cool, here we can see that the video was started 32 times, but only completed 12 times. It was viewed a total of 1775 seconds but only an average of 143 seconds.

What does it all mean? I know that the Phish video is 179 seconds long. So, on average, visitors viewed 80% of it. I can also tell, by the number of unique events, that the Phish video was viewed multiple times in the same visit. It must be pretty popular.

I also want to point out that we can view the data in other ways. We can navigate directly to the Actions report to see a list of all the actions, regardless of the object or label they are associated with. This is a great way to get a feel for the most commonly used features of our YouTube player.

Google Analytics Actions report.

Conclusion

So was this really worth it? Sure, I think so. I wanted to create a real life example that demonstrates some of the ways to use Event Tracking. I also wanted to use YouTube as an example because so may people use it as a platform to distribute video.

While it may seem like a lot of work to track video and other web 2.0 technologies it is vital. If you’re spending money producing videos, or if you’re selling video ad space, you need to know how people interact with your player and content. It’s the perfect use for Event Tracking.

Subscribe:

Tying clicks & content to conversion in GA

July 20, 2008 by Justin Cutroni

Many site owners spend a lot of time creating content that is supposed to drive conversions. But what’s the best way to measure the performance of this content with Google Analytics? How can we measure a specific piece of content, be it a page or a piece of creative, and it effect on conversions?

Google Analytics has a metric called $Index to help measure the “value” of site pages. But the problem with $Index is that it is an average, and averages can be skewed very easily. $Index is about the performance of a page, not the content on a page. Also, many people want to know how many times a piece of content directly led to a conversion. We just can’t get that with $Index.

We could view this type of analysis as a navigation analysis. Google Analytics has the All Navigation report and the Initial Navigation report, but these reports track things that happen in under 3 clicks and not everyone converts in 3 clicks.

Rather than tackle this problem using navigational analysis, let’s consider it a content challenge. What we want to do is see if a specific piece of content ultimately lead to conversion.

Google Analytics site overlay report.

Given this approach we could use the Site Overlay report, which is supposed to show the performance of each link on a page. But, in my experience, the Site Overlay report is buggy at best (and I’m being nice).

We need is a way to link a piece of content, i.e. a pageview, to a conversion. There’s a very simple way to do this using the Funnel Visualization report.

The Concept

Each funnel has a ‘required step’ setting. When enabled, this setting requires that the visitor views the first step in the funnel prior to conversion. If the visitor does not see the first step then the Funnel Visualization report will not count a conversion. The conversion will still be recorded in all other reports, but not the Funnel Visualization report.

What few people know is that it does not matter when the ‘required step’ is viewed, as long as it is viewed prior to the conversion.

We’re going to use this setting to associate a conversion with the content we want to evaluate.

Example

Let’s say I want to track how many people view the About Me page on this blog before subscribing to my RSS feed. I can create a goal and funnel that links the About Me pageview to the RSS subscription goal.

Step 1: Set up the goal

The first step is to create the goal. Just set up the goal like any other normal goal. Identify the goal URL, give the goal a name and a value (if you so desire).

Google Analytics goal settings

Step 2: Identify the “required step”

Now let’s turn to the funnel. Remember, step 1 in the funnel, the ‘required step’, is really the piece of content (i.e. the pageview) we want to evaluate in terms of conversions. Simply add the page URL to the Step 1 URL field, give the step a name, and check the “required step” checkbox.

Google Analytics funnel settings.

That’s it! There’s nothing else to do. The funnel visualization report, for this specific funnel, will only show a conversion if the visitor views the About Me page at some point prior to conversion. GA doesn’t care when the visitor sees the page, as long as they see the page prior to conversion.

The Data

Here’s a sample Funnel report. We can see that 4 conversions occurred after viewing the about me page. Remember, it does not matter when the About Me page was viewed, as long as it was viewed prior to conversion.

Google Analytics funnel visualization report.

Now, if we compare the number of conversions in the Funnel Visualization report, to the overall number of conversions for this goal, we notice there is a difference.

Google Analytics goal conversions.

The difference is the number of visits that did not include the About Me page prior to subscribing to the RSS feed. There were 8 total RSS Subscription conversions, but only 4 of those conversions viewed the About Me page prior to converting. Now we know how effective the About Me page was at driving RSS subscriptions.

Taking it Further

What about associating a set of pages with a conversion activity? No problem, just use a regular expression to define your required step. Here’s the same example, but I’ve tweaked to to track visits that include the About Me page or the All Posts page.

GA funnel to associate multiple pages with a goal.

And remember, the pageview you specify for your required step does not need to be a real “pageview.” It can be a virtual pageview, generated with the pageTracker._trackPageview() method. In fact, that’s what I’m doing on the blog. I generate a virtual pageview every time someone clicks on the RSS icon.

This technique is very useful if you want to measure how well a specific piece of content on a page is performing. Generate a pageview when a visitor clicks on the content and use it as step 1 in the funnel.

Think this is a good idea? Got one that’s better? Leave a comment!

Subscribe:

Do we really “get” Google Analytics?

July 17, 2008 by Justin Cutroni

It’s been just over a year since Google redesigned and relaunched Google Analytics. In that time GA has become an innovative product that seems to improve every day.

But I believe that many of us, myself included, are really missing the point when it comes to Google Analytics. I don’t think that we fully embrace the paradigm shift that Google is pushing with GA. Let me explain…

By releasing Google Analytics for free, Google has thrust web analytics into the mainstream. This is great for our industry, but it places a heavy burden on Google. They must provide a product that makes analytics easy.

But is web analytics easy? That’s debatable, but the simple truth is that there are millions of people out there getting into web analytics via GA and Google needs to help them understand their data.

Paradigm Shift #1: use GA to do more analysis.

picture-9_200x112shkl.jpg

Google Analytics is designed to facilitate the understanding of click stream data. How? By providing an interface that helps people explore their data by providing lots of context. All of the time spent redesigning GA was for one reason: to create a product that makes analysis easy for everyone. That’s a rather lofty goal but it is analysis most critical part of being a web analyst. If GA can help us understand what’s happening with our website then we can take action.

Have people embraced this idea? To some extent, yes. Many users I talk to like the features in GA and feel that it is an effective tool for analysis. But there is a huge number of users that still do not understand or know about many of the features in GA. Believe it or not, people still don’t know that you can track different types of online advertising, not just AdWords. A large segment of people use GA to track “hits” to their site.

Let me caveat this by saying that there are some analysis tasks that are just not possible in GA. However, these tasks are usually more advanced analysis techniques, like applying a control limit or doing a long tail analysis. Perhaps the GA team will ad advanced features as the product matures with the market.

picture-7.png

Paradigm shift #2: less formal reporting, more pestering!

Just as important as understanding the data is the distribution and access to the data. Google has tried to facilitate this need in two ways.

First, access to Google Analytics is pretty easy. Anyone with a Google Account can get access to a GA account. Three fields and two clicks and you can add someone to your analytics account. It’s that easy. And, to the best of my knowledge, there is no limit to the number of users. Now Joe in IT can access the data along with Kathy in marketing.

Second, the new GA redesign included email reports. While this does not seem like a revolutionary feature, the ability to distribute actionable data, to anyone, at any time, helps drive change. Why export data, create a report and then email it when you can email it right from GA? You can pester your co-workers and contractors (who are the ones that usually need to take action on the data) with the information they need to make change.

sharing.gif

I don’t think that many people have really embraced GA’s email reports feature. Multiple people a week ask me how to get data out of GA so they can create elaborate dashboards or other reports. They try to force GA into their current reporting framework rather than trying to change. I’m not saying this is wrong, but I think we need to give GA’s features a chance.

Parting Thoughts

While Google Analytics is not the end-all be-all web analytics application, it is a solid foundation that will continue to evolve and meet the needs of a growing and maturing user base. The big question is, will we embrace the change that many of GA’s features support, or will we continue with analytics as usual?

Think I’m off the mark? Have I consumed too much of the Google Analytics Kool-Aid? Leave a comment below!

Subscribe:

Google Analytics E-Commerce Tracking Pt. 4: Tracking Lead Gen Forms

July 2, 2008 by Justin Cutroni

One thing that I try to stress in my client work and training is that Google Analytics is a platform. If you understand the framework you can use it to track many different things. E-commerce tracking is one part of Google Analytics that is particularly flexible and can be used many different ways.

There’s a lot you can do with e-commerce tracking even if you’re a non-commerce site. You can use the e-commerce reporting to monetize lead gen forms and measure visitor interactions with a form.

The Need

Let’s say we have a lead gen site that sells books, cars and jets (a completely unlikely combination). The site has a very simple lead generation form that let’s the user choose the item they are interested in and their time frame for purchase.

We want to measure which fields visitors fill out, the values they choose, and the overall value of the form.

The Implementation

To measure the above I created a simple form using HTML and JavaScript. Here’s what the form looks like:

And here is the source of the above form:

When the visitor submits the form the JavaScript code assigns a value to both the item that the visitor chose and their time frame for purchase. It then calculates a total value for the form by summing both values.

In this example a form that includes a high priced item (like a jet) and a short time frame (buy now!) is worth more than a low priced item with an unknown time frame. I chose arbitrary values for each item and each time frame, but you could derive these values from business data.

After manipulating the data the code places both pieces of information in the GA e-commerce format where they are happily whisked away to Google.

I decided to do all of the calculations in JavaSript because it was easy. You could create a “form calculator” on the server side, but you would still need to format the data like a transaction in order to send it to Google Analytics.

The Data & Analysis

Remember, we’re using the e-commerce framework to equate products to form choices. So any report that displays product information will really show form elements and their values.

The best example of this is the E-Commerce > Product Performance > Product Overview report. This report simply lists all of the products that were purchased in all of the transactions.

Based on the way I created the code, each “product” in the report will be a combination of the item that he visitor is interested in and their time frame for purchase.

Google Analytics Prodcut Performance Report.

How is this data actionable? This information is the direct voice of the visitor. The visitor is literally telling us what they want and when they want it.

From the report above we can see that everyone wants a jet. Most visitors did not specify a time frame for purchase but one visitor wanted a jet today. I’d call that a hot lead!

Another report that is very useful is the E-commerce > Transactions report. In our configuration this report lists all of the forms that have been submitted and the value of each.

Google Analytics Transaction Report for Lead Gen Site.

The great thing about this report is we can drill into each transaction and review the specific form details. If I click on the first transaction in the report above I get the details of the form (see image below).

Individual Google Analytics Transaction Detail

I know this example is not that exciting, but image a form with many, many fields. You would be able to see all of the visitor’s choices and better understand what made a specific form valuable.

The effect of using e-commerce tracking for a lead gen form goes far beyond the e-commerce reports. Remember many reports in Google Analytics have an e-commerce tab that displays monetary metrics related to the data in a report.

For example, the Traffic Source > All Traffic Sources report will show metrics like average order value, transactions and revenue for each traffic source. If you use standard goal tracking you will only get conversion rate. I think this is far more valuable.

Google Analytics Traffic Sources report for Lead Gen.

A Reminder

You’ve probably figured out that you can use e-commerce to collect many different types of data. Please be mindful of your site’s visitors and the Google Analytics privacy policy. It is not permitted to collect personally identifiable information using Google Analytics.

This is part 4 in a multi-part series on e-commerce tracking. You may be interested in parts 1, 2 and 3:

Google Analytics E-Commerce Tracking Pt. 1: How It Works
Google Analytics E-Commerce Tracking Pt. 2: Installation & Setup
Google Analytics E-Commerce Tracking Pt. 3: Why EVERYONE Should Use It

Subscribe:

Google Analytics E-Commerce Tracking Pt. 3: Why EVERYONE Should Use It

June 25, 2008 by Justin Cutroni

Google Analytics Visits to Purchase and Time to Purchase reportsThe Google Analytics e-commerce reports contain two specific reports that I believe are critical to understanding the behavior of site visitors: Days to Purchase and Visits to Purchase. These reports are the only way to measure the online sales cycle using Google Analytics.

But, as their names imply, these reports are focused on commerce. But not all websites are commerce based. What if we have a lead gen website? We want to measure how long it takes to get a lead, not make a purchase.

Herein lies the problem: there is no “time to conversion” or “visits to conversion” report in Google Analytics.

To get around this little issue EVERYONE should use GA e-commerce tracking to measure conversions, regardless of site purpose.

The Reports

Before I talk about how to set up e-commerce tracking for a non-commerce site let’s discuss the Visits to Purchase and Time to Purchase reports and how they can be used. Remember, in this application of e-commerce tracking “purchases” are really just conversions.

Here’s the first report we want to use, the Visits to Purchase report.

Google Analytics Visits to Purchase Report

The Visits to Purchase report shows how many visits a visitor generated before they converted. The chart above shows that most visitors convert on the first visit. This is good. It means that visitors come to the site, find what they need and convert. This can also be very bad, it means that we have one chance to get someone to convert. If they do not convert on the first visit then we may not get another chance.

Let’s pair this data with the Time to Purchase report to better understand how much time passes between a visitor’s initial visit and their “conversion” visit.

Google Analytics Days to Purchase report

The data indicates that everyone converts on Day 0, or the current day. This makes sense since most everyone converts on their first visit.

But what if most conversion occurred on the second visit? If conversions happen on the second visit, but still on Day 0, it means that visitors are probably doing some research prior to conversion and are checking another site on the same day before returning to our site to convert.

Knowing how many visits to a site it takes to convert a visitor is very actionable. What if the data indicates that visitors convert after the third visit? This means that we need to get a visitor back the site a third time to have any chance for a conversion. We may change our keyword bidding strategy to target visitors that are further along in the conversion cycle or we might try to collect an email address to send them additional information via email.

The key concept is that this data explains how many times we need to get the visitor to return to the site in order to generate a conversion.

If we do not using the e-commerce code to track “conversions” then we do not have access to this information.

One More Reason to use E-Commerce

There is one other reason why I like to use e-commerce tracking to track conversions. Google Analytics will only track one conversion per visit. If a visitor converts multiple time at the same goal Google Analytics will only count one conversion.

However, GA will track multiple purchases per visit. Is this a big deal? Not really. But if you want to make the data as accurate as possible, and have a goal that can be achieved multiple times per visit, then try using a transaction to track it.

Plus, using e-commerce to track conversions adds an extra “goal” to each profile, bringing the total to 5. Woo hoo!

Installation & Setup

There are three basic steps necessary to use the e-commerce tracking code on a non e-commerce site. While the steps are similar to those described in my previous post on installation there is one big difference. Let’s walk through each step.

Step 1: Activate the Reports

The first step in setting up GA e-commerce tracking is enabling the e-commerce reports. Log into GA and edit the profile settings. Specify that your site is an e-commerce site. This enables the e-commerce reports.

Google Analytics E-Commerce Reports

Remember, the e-commerce reports is a profile setting that is “off” by default. You’ll need to activate the reports for each new profile you create.

Step 2: Tag your Receipt Page

I know this seems like a silly step, but make sure you add the GA tracking code you your receipt page. You must have the standard GA tracking code on your receipt page in order to track purchases.

Step 3: Install the Code

This is where the installation differs from the standard installation. To measure purchases with Google Analytics you need to add the following code to your thank you page. The code does not need to be modified in any way.


<script type="text/javascript"> 
   var gaJsHost = (("https:" == document.location.protocol) ? 
"https://ssl." : "http://www."); 
   document.write("<script src='" + gaJsHost + 
"google-analytics.com/ga.js' type='text/javascript'>" + 
"</sc" + "ript>"); 
</script>

<script type='text/javascript'>
var pageTracker = _gat._getTracker("UA-30208-1");
pageTracker._setLocalRemoteServerMode();
pageTracker._initData();
pageTracker._trackPageview();

// Some simple code to create a fake order ID
var timeObj        = new Date;
var unixTimeMs   = timeObj.getTime();
var unixTime      = parseInt(unixTimeMs / 1000);
var orderID        = pageTracker._visitCode() + '-' + unixTime;

pageTracker._addTrans(
      orderID, // required
      "",
      "",
      "",
      "",
      "",
      "",
      ""
); 

pageTracker._addItem(
      orderID, // required
      "",
      "",
      "",
      "1",  // required
      "1"   //required
); 

pageTracker._trackTrans();

You’ll notice that I added the e-commerce code to the regular GA page tag, but you can add it anywhere on the page. I just like keeping things together, it seems more organized to me.

You’ll also notice there is a lot of missing information in the above code. I’ve added the bare minimum for the tracking to still work. Don’t worry about the missing data, GA will still track a transaction, i.e. a conversion, and we will be able to use the Visits to Purchase and Time to Purchase reports.

That’s it. Once the code has been added you’ll start to see some data in your Visits to Purchase and Days to Purchase reports.

Got an interesting story to share about your e-commerce implementation? I would love to hear about it below in a comment.

Remember, this is part 3 in a multi-part series on e-commerce tracking. You may be interested in parts 1, 2 and 4:

Google Analytics E-Commerce Tracking Pt. 1: How It Works
Google Analytics E-Commerce Tracking Pt. 2: Installation & Setup
Google Analytics E-Commerce Tracking Pt. 4: Tacking Lead Gen Forms

Subscribe:

Google Analytics E-Commerce Tracking Pt. 2: Installation & Setup

January 22, 2008 by Justin Cutroni

This is part 2 in my series on Google Analytics e-commerce tracking. In part 1 I described, at a conceptual level, how GA e-commerce tracking works. In this post I’ll get into the specifics of the code and how to install it.

This isn’t the most exciting stuff (that will be part 3), but a correct setup leads to correct data. :)

Step 1: Activate the Reports

The first step in setting up GA e-commerce tracking is enabling the e-commerce reports. Log into GA and edit the profile settings. Specify that your site is an e-commerce site. This activates the e-commerce reports.

Google Analytics E-Commerce Reports

There are other e-commerce settings that don’t get much use (unless you’re an international site). You can specify one of 25 different currencies (wow!) and the number of decimal places you would like displayed (1,2 or 3). Even if you use USD you can specify 3 decimal places. Go ahead and try it, it’s interesting.

Remember, e-commerce reports is a profile setting that is “off” by default. You’ll need to activate the reports for each new profile you create.

Step 2: Tag your Receipt Page

I know this seems like a silly step, but make sure you add the GA tracking code you your receipt page. You must have the standard GA tracking code on your receipt page in order to track transactions. The reason is that the e-commerce tracking code is stored in the ga.js. If this file is not included on the receipt page then you can’t track transactions.

Step 3: Install the Code

This is the hard part: code construction. As we learned in part 1, GA uses a JavaScript collection technique to track e-commerce transactions. Your server code must inject transaction information into the GA JavaScript before sending the receipt page back to the browser. When the receipt page renders in the visitor’s browser the JavaScipt executes and sends the transaction info to GA.

Get ready for some construction.

Let’s take a look at the code:


<script type="text/javascript">
pageTracker._addTrans(
      "order-id", // required
      "affiliate or store name",
      "total",
      "tax",
      "shipping",
      "city",
      "state",
      "country"
); 

pageTracker._addItem(
      "order-id", // required
      "SKU",
      "product name",
      "product category",
      "unit price",  // required
      "quantity"  //required
); 

pageTracker._trackTrans();
</script>

The three parts of GA e-commerce trackingThe first thing that you’ll notice is that there are three distinct parts to the JavaScript. Each is a different method. The first section, identified by the _addTrans() method, creates the transaction and stores all the information about the transaction.

The second section, identified by the _addItem() method, is used to add an item to the transaction. You need to create an _addItem() section for each different item, or SKU, in the transaction. The order ID in the _addItem() method must be the same order ID used in the _addTrans() method. That’s how GA ties an item to a transactions.

The final section is the _trackTrans() method. This method actually sends the data to GA by requesting the __utm.gif file once for the transaction and once for each item in the transaction. So if you have 3 different SKUs in a transaction there will be 4 requests fot the __utm.gif.

The above JavaScript can appear anywhere on your receipt page. Just make sure that it appears after the main GA page tag. The reason is that the e-commerce code is part of the pageTracker object. If the pageTracker object has not been created then you can’t call the e-commerce methods.

Just to reiterate a point: you must create server side code that outputs the transaction data in the format above. If you do not have access to your shopping cart code, and your cart provider does not provide e-commerce tracking, then you may be out of luck.

Once the code has been installed you should begin to see e-commerce data in your reports.

Notes and Suggestions

Like many things in Google Analytics, there are some things that can trip you up:

  • If you do not wish to pass a certain piece of data to GA then do not add anything between the quotation marks. The only required fields are the order ID, the unit price of each item and the quantity of each item. Everything else is optional.
  • Do not use currency identifiers or commas (to separate thousands) in any of the numeric fields (i.e. total, tax, shipping). These characters have caused problems in the past.
  • Each piece of transaction data that you send to Google Analytics becomes a data element in GA, just like any other piece of data in GA (geo data, campaign data, browser data, etc.). You can do all sorts of neat things with filters and e-commerce data. More on this later.
  • The affiliate or store name field is no longer used in the GA reports. However, the data is still collected by GA so you can use it in a filter.
  • The transaction geographic data collected by GA is no longer used BUT it is collected. Google Analytics determines the location of the user, and thus their transaction, based on their IP address. The old version of the GA tracking code used the data specified in the transaction. Like the affiliate field, the data can be used in a filter.

Up Next

In the next post I’m going to talk about some creative ways to use e-commerce tracking. Specifically, why I believe that everyone should use e-commerce tracking on their website.

This is part 1 in a multi-part series on e-commerce tracking:

Google Analytics E-Commerce Tracking Pt. 1: How It Works
Google Analytics E-Commerce Tracking Pt. 3: Why EVERYONE Should Use It
Google Analytics E-Commerce Tracking Pt. 4: Tacking Lead Gen Forms

Subscribe:

Google Analytics E-Commerce Tracking Pt. 1: How It Works

January 13, 2008 by Justin Cutroni

This post is the first in a series of e-commerce transaction tracking with Google Analytics. Why is e-commerce tracking important? Well, transaction data is a vital piece of information when analyzing online business performance.

Sure, it’s great to measure things like conversion rate, but revenue is much more tangible to many business owners. Having the e-commerce data in your web analytics application makes it easier to perform analysis. Do you need to set up e-commerce tracking? No, but it sure helps. :)

The Big Pictures

E-commerce tracking is based on the same principal as standard pageview tracking. JavaScript code sends the data to a Google Analytic servers by requesting an invisible gif file. The big difference is that e-commerce data is sent rather than pageview data.

But how does Google Analytics get the e-commerce data? That’s the tricky part. You, the site owner, must create some type of code that inserts the transaction data into the GA JavaScript. Sounds tricky, huh? Well, its not that bad.

Step by Step: How it Works

Let’s break it down and walk through what actually happens.

1. The visitor submits their transaction to your server.

2. Your server receives the transaction data and processes the transaction. This may include a number of steps at the server level, such as sending a confirmation email, checking a credit card number, etc.

3. After processing the transaction the server prepares to send the receipt page back to the visitor. While preparing the receipt page your server must extract some the transaction data and insert it into the Google Analytics JavaScript. This is the code that you must create.

4. The receipt page is sent to the visitor’s browser.

5. While the receipt page renders in the visitor’s browser the e-commerce data is sent to Google Analytics via special GA JavaScript.

Here’s a basic diagram of the process. Again, the biggest challenge during implementation is adding code to your web server that inserts the transaction data, in the appropriate format, into the receipt page. I’ll cover the setup in part 2 of this series.

What Data can be Tracked?

Google Analytics collect two types of e-commerce data: transaction data and item data. Transaction data describes the overall transaction (transaction ID, total sale, tax, shipping, etc.) while item data describes the items purchased in the transaction (sku, description, category, etc.). All of this data eventually ends up in GA reports. Here’s a complete list of the data:

Transaction Data

  • Transaction ID: your internal transaction ID [required]
  • Affiliate or store name
  • Total
  • Tax
  • Shipping
  • City
  • State or region
  • Country

Item Data

  • Transaction ID: same as in transaction data [required]
  • SKU
  • Product name
  • Product category or product variation
  • Unit price [required]
  • Quantity [required]

A few notes about the data. First, the geo-location data is no longer used by Google Analytics. The new version of GA tries to identify where the buyer is located using an IP address lookup.

Also, you should avoid using any non-alpha numeric characters in the data. Especially in the numeric fields. Do not add a currency identifier (i.e. dollar sign) in the total, tax or shipping fields. this can cause problems with the data.

Like this post? Check out the rest of the series:

Google Analytics E-Commerce Tracking Pt. 2: Installation & Setup
Google Analytics E-Commerce Tracking Pt. 3: Why EVERYONE Should Use It
Google Analytics E-Commerce Tracking Pt. 4: Tacking Lead Gen Forms

Subscribe:

2008 Google Analytics Resolutions

January 8, 2008 by Justin Cutroni

Happy new year! I can’t believe 2007 is over. Continuing with a tradition I began last year, I give you my 2008 GA resolutions.

Before I get into the list, I want to thank everyone who reads and contributes to Analytics Talk. 2007 was an incredible year for me, and I really owe a lot to you guys. Thank you for reading, posting questions and helping me learn so much.

1. I will migrate to the new GA.JS tracking code.

Google announced a new version of the tracking code, ga.js, in October 2007 and launched the new code in December. After some minor launch problems things seem to be running smoothly. While you don’t need to migrate to ga.js, you should start to think about it because Google will no longer add features to urchin.js. In my opinion, you should tackle this problem sooner rather than later.

2. I will contemplate Event Tracking and how I can use it.

The reason Google introduced a new version of the tracking code was to enable a powerful new feature called Event Tracking. While most folks might think of event tracking as a ‘web 2.0′ tracking tool geared towards video players and Ajax, it’s really a flexible framework for data collection. I was skeptical at first, but now I’m a convert. All of us can take advantage of this new feature.

I’ll be writing more about Event Tracking and its uses when Google pushes the feature to everyone. In the mean time, check out this series of posts to learn more:

Event Tracking Pt. 1: Overview & Data Model
Event Tracking Pt. 2: Implementation
Event Tracking Pt. 3: Reporting & Analysis

3. I will get creative with profiles.

This is something I’ve been talking about for a while. Profiles are so much more than website data. They’re a collection of data and business rules. Last year, as part of my 2007 resolutions, I mentioned setting up test profiles as a way to insure your configuration settings are correct.

For 2008 I suggest setting up profiles for all major marketing campaigns and mediums. Why? So you can segment reports that normally can not be segmented. Check out Segmenting Visitor Loyalty Reports in GA for more information.

4. I will try some type of ‘advanced’ Google Analytics configuration.

Most of us have a fairly basic implementation of GA. We don’t need to do much more than add the tracking code to our site, set up goals, and configure on site search reporting.

Why not try something new this year? How about using an ‘advanced’ feature like custom segmentation, event tracking or even e-commerce tracking? All of these features can help you learn more about your visitors and what they do. That’s why we use these features and try these hacks: to gain insight and knowledge.

5. I will keep track of website changes and Google Analytics changes.

This is something that I wrote about a long time ago, but it’s still really important. It’s a good idea to keep track of your GA configuration changes so you can better understand the data. Any modifications, like a change to a goal, funnel or filter, should be recorded.

It’s also a good idea to keep track of website changes and online marketing changes. Knowing what’s going to happen with your online business helps drive analysis and you’ll be able to deliver data that will make people happy.

You don’t need anything elaborate, a simple Google Spreadsheet, like this one, will work just fine.

There you have it, a few ideas to spice up your 2008 Google Analytics plans. Got a better idea or think that I missed something? Leave a comment below. And happy new year!

Subscribe:

Surprise! New Google Analytics Features

December 13, 2007 by Justin Cutroni

It looks like the team at Google Analytics has surprised us all with some new features. What a great way to celebrate the holiday season. Many of these new changes were actually announced by Brett Crosby at Emetrics and are just now getting rolled out to all of us.

New Multi-Line Graph

Google has added a new features to help with analysis. It’s called multi-line graphing. We now have the ability to graph multiple lines of data in the data-over-time graph that appears at the top of each page. There are two ways to use this feature.

Google Analytics Multi-Line Graphing

First, you can compare two metrics in the graph. This is a great way to determine if there is a correlation between the two numbers. For example, let’s say you want to see if conversion rate stays the same if visits increase. Now you can do that.

Google Analytics: Graph two metrics

The second way to use the multi-line graph is to compare a specific segment of data to the overall site data. This helps you analyze how much the segment of data affected the larger set of data.

The graph below shows AdWords visits (blue) and the total site visits (gray). We can clearly see that there was a big bump in traffic but it was not caused by AdWords.

Google Analytics: Compare Data to Site Average

I’ll have a more in-depth post on this tomorrow.

New ga.js Tracking Code

The new ga.js tracking code is now live. For those of you that don’t know, Google created a new version of the tracking code that supports many new features, primarily event tracking.

The new tracking code is very different. Many of the functions that exist in urchin.js do not exist in ga.js. Things like urchinTracker() and __utmSetVar() are gone. Don’t worry, they’ve been replaced with new methods like _trackPageview() and _setVar().

You don’t need to migrate to the new ga.js, you can continue to use the old urchin.js. However, Google will not update urchin.js in the future. If you want to take advantage of new features you must upgrade.

Check out GA.JS: New Google Analytics Tracking Code for more information about why the basic page tag has changed, how it has changed and if you should upgrade to the new tracking code.

To help facilitate the transition, Google has published a migration guide to help you transition from urchin.js to ga.js. It’s a great resource that does a good job of mapping old tracking code settings to new tracking code settings.

How do you get the new tracking code for your site? For existing websites, there is a new tabbed interface that provides the urchin.js tracking code or the ga.js tracking code. Just click on the “Check Status” link for a profile and you’ll see the tabs. Google will automatically supply the new ga.js tracking code when you create a new profile.

Google Analytics Tracking Code Tabs

Caution: do not use the new tracking code and old tracking code on the same page. However, you can use the new tracking code on some parts of your site and the old tracking code on other parts of the site.

Subscribe: