Bibliographic Information

Your Google® Game Plan for Success: Increasing Your Web Presence with Google AdWords, Analytics, and Website Optimizer

Publisher: John Wiley & Sons
Pub. Date: September 22, 2010
Print ISBN: 978-0-470-64164-4
Web ISBN: 0-470641-64-9

A.4. Non-Google Resources

There are plenty of non-Google resources out there, from marketing platforms to tools to social-media measurement websites. Bookmark some of these great resources for future use.
4Q Online Survey:
Ask Sponsored Listings:
Bango Mobile Analytics:
BidRank: Ad Center:
ForeSee Results:
Free Online Surveys:
Keyword Spy:
Lyris (ClickTracks):
Microsoft AdCenter:
Omniture Test&Target:
Sales Force:
Trellian Keyword Discovery:
Web Analytics Solution Profiler (WASP):
Yahoo! Advertising:
Yahoo! Web Analytics:

7.4.5. Visitor Trending

The Visitor Trending subsection of reports has six reports that are identical, the only difference being the metric that is displayed. Figure 7-22 shows the most basic of reports that you'll be able to find here in Google Analytics, but with one neat addition, that's not available in any other type of report.

Each of the reports for the six visitor trending metrics (the "cornerstone" metrics from the Site Usage window on the dashboard) shows a histogram broken down by your selected date range. In Figure 7-22 I'm showing the visits per day, but I've selected the Graph by Hour trending graph view that's available only in these basic reports. Below the trending graph, the breakdown by the hour is shown.

The distribution of visits that you see in the trending graph is pretty consistent with that of most websites on the Internet. Most web activity happens during business hours and into the early evening, before midnight. Usually, there is a steady drop-off in traffic after seven o'clock at night, and sometimes the drop-off is later. In this example, there's a significant drop-off after midnight.

The Visitor Trending reports can be exported, downloaded, e-mailed, and segmented. They cannot be filtered because there is no standard table filter available here.

7.4.6. Visitor Loyalty

The Visitor Loyalty reports are an interesting group of reports in that they allow you to measure visitor retention and to some extent the awareness of your brand by your website visitors. Four reports in this subsection allow you to measure loyalty (how many times visitors visit your site in a given period), recency (how long ago visitors visited your site in a given period), length of visit (how long a visit lasted, on average), and depth of visit (how deep, in terms of page views, each visit went, on average).

Even though these reports are histograms like the Visitor Trending reports, they're an important group for several reasons. For one, this information is available only here, in this section. (The data from this report isn't available in the segmented format you see in Figures 7-23 unless you perform some Advanced Segments, which I'll talk about in Chapter 9.) Another reason is the sheer value of this information.

For most websites, Figures 7-23 will be a familiar representation of the site's data. It tells you the following:

  • Most visitors visit a site one time.

  • Most visitors are making their first visit to your site.

  • Most visitors spend between zero and 10 seconds on your site.

  • Most visitors make a one-page view per visit.

7.5.5. Keywords

Another of the most popular reports in Google Analytics (and the web-analytics industry, for that matter) is the Keywords report. All website owners want to know what keywords drove traffic to their websites, and with good reason. You can view more information about your organic keywords here, and you can see which pages visitors land on and lots of other information by segment. If you're a paid advertiser, this report is pure gold because it provides the missing information that you've been yearning for ever since Part II of this book, when I covered Google AdWords.

To really get an idea of how valuable your keywords are, you can click the Goal Set or E-commerce tab in this report, as you can in any standard report view. Click an individual keyword to isolate it from the other keywords, and use segmenting to backtrack and discover which search engine(s) drove traffic via this keyword, among many other segmenting possibilities.


7.8.6. Visits to Purchase

Figure 7-42 shows an example of what the final two reports of this section look like. The Visits to Purchase report essentially displays your sales cycle in the style of the Visitor Loyalty report from the Visitors section. The Days to Purchase report is very similar.

7.8.7. Days to Purchase

The Days to Purchase report looks and feels exactly like the Visits to Purchase report, except that it shows you how many days it takes visitors to purchase something from your website.

As you may have guessed, the highest percentage of visitors make a transaction within the same day that they visit your site (represented in this report by "0 days"). Keep in mind that while most visitors purchase on the same day, some visitors may make a few visits in the same day before purchasing. A solid idea of how many days it takes for your visitors to purchase, combined with the Visits to Purchase report, can help you gauge your e-commerce efforts.

8.1. How Google (Web) Analytics Works

Before the website loads, or even as it's loading, a piece of JavaScript tracking code that the website's owner installed on every page of the site instructs it to look for browser cookies. Browser cookies are very small text files that are set by almost every website on the Internet today — some websites won't even work properly if you don't have cookies enabled on your browser. These very small text files can contain sensitive data about the websites you visit, like the time of entry, time of departure, referring website, and saved login information.

If the site cannot find the appropriate cookies, then because of the JavaScript tracking code it will install at least four of these cookies on your machine (keep reading for what information Google Analytics collects). If the site does find cookies, meaning you've visited before, then it will simply update the cookies to indicate that you've visited the site one more time and to note whether or not you've used different referral information to access the site this time.

After this happens and as the site either is still loading or has just finished, data about your visit is sent to Google Analytics servers for processing. The same raw data that's stored in your browser's cookies are sent over the Internet in a neat, tiny package called a utm.gif hit, sometimes also referred to as a 1x1 pixel request, which is a small file that is sent to Google Analytics. This tiny image is captured by Google Analytics and its data is processed and recorded. As the visitor moves about the site, additional data is sent with each page view, which will be associated with the visitor's current visit.

When Google Analytics detects that there hasn't been any more activity by the user after roughly 30 minutes, the session will close. After a few hours (if that), Google begins the process of converting this raw utm.gif session data into the reports that I showcased in Chapter 7. The data is cleaned up, calculated, and run through any settings and filters that may be applied to your Google Analytics profile. It then is reported in your profile and is guaranteed by Google to remain there for two years. This data can then be segmented, exported, e-mailed, and everything else we just covered in the previous chapter.

8.1.1. What Information Does Google Analytics Collect?

Google Analytics collects information about your website visitors that pertains to their experiences on the website. This information includes:

  • Where a visitor came from (Google, Yahoo!, etc.)

  • The means by which the visitor accessed the site (CPC, CPM, etc.)

  • The website(s) visited

  • The entry page (landing page)

  • The exit page

  • The pages viewed

  • The time stamps of each page view

  • The number of visits to the site

  • Any search queries performed on the site

  • Any events performed on Flash- or AJAX-based applications (event tracking)

  • Geo-location information (continent, country, state, city)

  • Browser language options

  • The browser (Internet Explorer, Firefox, etc.)

  • The operating system (Windows, Macintosh, etc.)

  • Screen colors

  • Screen resolution

  • The version of Flash

  • Java (from Sun Microsystems)

  • Service provider (ISP)

  • Internet connection speeds

  • Mobile carrier and device (if applicable)

  • Custom variables (if applicable)

  • The visitor's IP address (not displayed in reports)

  • Activity pertaining to Google AdWords (if applicable)

  • Activity pertaining to Google AdSense (if applicable)

  • E-commerce transaction and product information (if applicable)

8.2.1. The Web-Analytics Association

This not-for-profit organization is the de facto governing body of the web analytics industry. It has published research documents and metric standards with the ultimate goal of influencing every web-analytics vendor to adopt consistent, standard naming conventions and metrics definitions across the board.

The group's 2008 Standards Definitions Volume I can be downloaded via this URL:

When you have some time, read up on how this body classifies metrics into four categories and how it defines every one of the standard metrics.

Metrics and Dimensions Metrics

  • Visit: A visit to your website

  • Page view: A single page view of any page on your website in a visit

  • Unique page view: A unique, unduplicated page view of a single page within a visit

  • Pages/visit: The average pages viewed in each visit

  • Visitor: An actual website visitor (person)

  • Unique visitor: A unique, unduplicated individual who visits your website

  • New visits: The count of first-time visitors to your website

  • % new visits: The percentage of new visits in comparison to all site visits

  • Time on page: The amount of time spent on a page by a visitor

  • Time on site: The amount of time spent on the entire site by a visitor

  • Entrances: The number of entries into a particular page of your site

  • Exits: The number of exits from a particular page of your site

  • Bounces: The number of single-page visits by your visitors

  • Bounce rate: The percentage of single-page visits by all visitors to your site

  • Goal starts: The number of times a goal is started but not necessarily completed

  • Goal completions: The number of unduplicated times a visitor reaches a goal page (converts)

  • Goal value: The value of an individual goal, based upon goal completions

  • Per-visit goal value: The average value of each visit to your website, based upon goal completions

  • $ index: The average value of each page on your site, based upon goal completions and e-commerce revenue Dimensions

  • Visitor type: The type of visitor (new or returning)

  • Hour of the day: The hours of each day (12:00, 1:00, etc.) at which a visitor visits your site

  • Page depth: The number of pages viewed in a single visit

  • Days since last visit: The number of days since a visitor's last visit to the site

  • Visit duration: The length of each visitor's visit

  • Language: The visitor's language browser preference

  • City: The visitor's originating city

  • Region: The visitor's originating region or state

  • Country/territory: The visitor's originating country

  • Sub-continent region: The visitor's sub-continent region (Western Europe, Central America, etc.)

  • Continent: The visitor's originating continent

  • Custom variable: The custom variable set on a visitor's computer

  • Mobile: The mobile device information for a visitor

  • Campaign: The advertising campaign that led a visitor to your site

  • Ad group: The advertising ad group that led a visitor to your site

  • Keyword: The advertising keyword that led a visitor to your site

  • Ad content: The advertising ad that led a visitor to your site

  • Ad slot position: The actual location of the ad on the search engine results page that led a visitor to your site

  • Source: The name of the website or marketing initiative that led a visitor to your site

  • Medium: The means by which a visitor accessed your site

  • Referring site: The site on which a link to your site appears that led a visitor to your site

  • Referral path: The specific page on the referring site that led a visitor to your site

  • Page: The page viewed on your site

  • Page title: The page's title meta-tag that was viewed on your site

  • Hostname: The URL(s) of the site(s) visited by your visitors

  • Landing page: The page used as the entry point into your site by a visitor

  • Exit page: The page used as the exiting point from your site by a visitor

Online data is like a jar of mayonnaise — it's perishable and it has a shelf life. Your data, after a certain period, is just not usable anymore. It could very well be rotten and ready to be thrown down the garbage disposal. On the Internet, things change really fast. In 2006 Twitter had just been born, and the topic of social media was new. Our offline and online worlds have completely changed in a relatively short time. Comparing web data from 2005 to web data from 2010 is like comparing Nielsen television ratings from 1950 and 2010. 

9.2.1. Default Advanced Segments

The team at Google Analytics has created some default Advanced Segments for your convenience. These default segments are:

  • All Visits: The default segment when you log in to Google Analytics.

  • New Visitors: When applied, this segment will show you only data on new visitors. Returning visitors are excluded.

  • Returning Visitors: This is the opposite of the New Visitors segment. When it is applied, only returning visitors are shown.

  • Paid Search Traffic: This segment will show you only traffic whose medium is CPC.

  • Non-Paid Search Traffic: This segment shows all traffic whose medium is organic.

  • Search Traffic: This segment shows both CPC and organic traffic. It's very important to know this because most folks are surprised to find non-organic traffic in this segment.

  • Direct Traffic: Any visitors who came to your site directly without using a search engine or clicking a referring link will be counted in this segment.

  • Referral Traffic: Traffic from visitors who have clicked links from other websites makes up this segment.

  • Visits with Conversions: Any visit that included a goal conversion is counted in this segment.

  • Visits with Transactions: Visits that include an e-commerce transaction are counted here (you must have e-commerce enabled in order to see this default segment).

  • Mobile Traffic: Traffic from a mobile device is counted in this segment.

  • Non-Bounce Visits: Visits that do not bounce (that view more than one page) make up this last default segment.

You can apply up to four segments — default or custom — at any time. When you apply more than one segment, the All Visits segment will automatically be applied to your reports. On certain reports, like the funnel visualization report, Advanced Segments are disabled and cannot be applied.

9.5 Site Search Reports

 This information — the searches that your visitors perform on your site — is a great listening device for you. By analyzing the search queries performed on your site, you can place your ear to the ground and learn what people are searching for, what people are having trouble with, and what people can't find on your site. How great would it be to be able to know what catalog numbers people need to find? How insightful is it to discover what part numbers your customers can't locate? And how useful is it to know what literature your students need to find on your site? With site search, not only is all this possible, but you can also use this information to improve how your site's search function operates. In the next chapter I'll talk about how you can enable Site Search to track data in your profile. 

10.1. The Google Analytics Tracking Code (GATC)

The Google Analytics Tracking Code (normally abbreviated GATC) is a piece of JavaScript code that is placed on every page of a website. When a visitor reaches a web page that has the GATC installed on it, the visitor will have a set of Google Analytics cookies added on his or her computer, or the visitor's existing Google Analytics cookies will be updated. As I mentioned in Chapter 8, visitor data is also sent to Google's servers for processing via an image named utm.gif which is one-pixel square.

The interesting thing about the GATC is that there are three active generations being used online. There's the urchin tracking code, which is the first generation of the GATC. About two years after the first-generation tracking code was released, Google developed the ga.js tracking code, which was more robust, faster, and better capable of handling the Web 2.0 Internet world. In the first half of 2010, Google released a third-generation tracking code called the async code, which is lighter, faster, and more accurate than the previous codes. The async code also loads into the browser before the web page loads, which is something that neither urchin nor ga.js can do.

Since all three tracking codes are prominent on the Web, and since all three tracking codes still allow you to collect data, let's take a look at each one separately, so you can see the progression and development of the GATC over time.

10.1.1. The urchin Tracking Code

Urchin is the first-ever tracking code released by Google Analytics to collect visitor data. It's currently not available within the Google Analytics interface; you can find it only within Google's help articles online or on a website that has not updated its tracking code for quite a few years. The name "urchin" is a derivative of the name of the company that Google acquired in 2005 that became Google Analytics.

There are some reasons that the urchin tracking code may still be on a website. A site's owner may have a contract with its web developer or content-management system whereby he or she is allotted a certain number of updates per month. Since the urchin tracking code still works, site owners don't see the value in upgrading. They are going to miss out on things like event tracking and custom variables, which cannot be used with urchin.

The base urchin tracking code looks like this:

The urchinTracker function that you see in the second-to-last line of code is the modern-day equivalent of the trackPageview function, which is what makes the data-collection process happen. Since urchin does not have auto-detection for secure and non-secure servers, site owners have to update the first line of the tracking code to call the urchin.js file from the secure Google server, as in this example:

The urchin tracking code should be found toward the bottom of the source code, somewhere in the vicinity of the closing tag. However, I have seen Google tracking codes in virtually every imaginable place.


There is often a mix-up between urchin (the first-generation tracking code) and Urchin Software from Google (which is a server-based web analytics platform sold exclusively by Google Analytics Certified Partners). If someone claims to "use urchin," make sure you know which urchin that person is refer-ring to.

10.1.2. The ga.js Tracking Code

The ga.js tracking code was released a few years after Google's acquisition of Urchin in late 2005. This tracking code is a vast improvement over urchin, as it has automatic secure/non-secure detection, is more Web 2.0—ready, and uses an object-oriented JavaScript file, which is more dynamic and fluid than the static urchin.js JavaScript file. Basically, it's a big improvement.

At the time of this writing, ga.js is the most prominent GATC on the Internet, because async has been out for only a few months. Again, people often take their time upgrading. It costs time and resources, and ga.js still works fine.

Following is the base ga.js tracking code that you'll find in your Google Analytics account or on many websites using Google Analytics:

Instead of using urchinTracker for collecting page view data, as the urchin tracking code does, ga.js uses the trackPageview function to do the same thing. The ga.js tracking code, like the urchin.js tracking code, should be placed somewhere near the bottom of the source code, preferably immediately before the closing tag. This is recommended by Google so that if Google ever experiences downtime, your website won't be affected as it would be if you had placed the tracking code in the of the document. However, it's safe to place the code in the of the document — I've been working with Google Analytics virtually since its inception, and I can recall only one unscheduled period of downtime, which was repaired within the hour.

10.1.3. The async Tracking Code

Released in early 2010, the async tracking code is the latest innovation by Google to track your website's data. The idea behind async is that it loads asynchronously with the web page — it does not wait for the web page to load in order to start executing. It's also faster, lighter, and more accurate in terms of data collection than previous Google tracking codes.

Google recommends (as do I) that you use this generation of the tracking code on all your site's pages. This chapter will show only examples using the async code, and over time this will become the default tracking code that you'll find in your profile's tracking wizard.

This is what the base async tracking code looks like:

Unlike urchin and ga.js, the async code isn't split into two separate

10.1.4. The JavaScript File

It may be confusing to see me refer to the ga.js tracking code and a ga.js file that is called from Google's servers. These are two separate things: the ga.js tracking code refers to the second-generation GATC, while the ga.js file is a JavaScript file hosted on Google's servers that makes the data collection and cookie creation possible.

For some website owners and IT managers, it may be helpful to host this ga.js JavaScript file locally instead of having the tracking code call it each time a visitor visits your site. To do this you'll need to modify the track-ing code (in the async code, you'll modify the ga.src command line and update it with the domain and placement that you choose), and you'll need to download the ga.js JavaScript file and upload it to your own web server. You may download the latest version of the ga.js JavaScript file from, but be sure to re-download it about once each month, as Google is constantly tweaking it and making minor improve-ments. You always want to have the latest version of the JavaScript file if you are hosting it locally.

10.1.6. What the GATC Can't Track

You may have been able to reach the following conclusion by now, but if a user is blocking JavaScript, he or she cannot be tracked by Google Analytics.

Users who block JavaScript, cookies, and even images cannot be tracked by Google Analytics. This includes most search engine spiders that you'll see pop up in server log files and log-based web-analytics packages like WebTrends. Users using mobile phones without browsers that can execute JavaScript or load images also cannot be tracked, even though you may again see them in log files. Any user who intentionally blocks cookies, tracking scripts, or Google cannot be tracked. Those same users blocking cookies and JavaScript are also missing out on a lot of functionality on the Internet that requires cookies and JavaScript in order to function, like Flash players, video players, and many other web applications.


10.2. Google Analytics Cookies

We talked about the fact that Google Analytics sets up to four, possibly five, first-party cookies on a user's computer when he or she visits a website for the first time. If a visitor has already been to your website and already has existing cookies, the JavaScript will work to update those cookies to reflect additional visits and page views. Just so that everyone is clear, a cookie is a small text file that contains data about a visitor's interaction with a website.
There are four first-party cookies that will be set automatically, assuming a user is accepting cookies. There could be a fifth first-party cookie, depending on whether or not a website is using custom segmentation. Let's look at the Google Analytics cookies, but first check out Figure 10-3, which shows a set of Google Analytics cookies on my Firefox browser for the Google Analytics blog site.

10.2.1. The __utma Cookie

The __utma cookie (that's a double underscore and the letters "utma") is the visitor identification cookie. This cookie is persistent (meaning it remains on your computer after your browsing session ends), and it has a default lifespan of two years.
 This cookie tells Google Analytics the domain and the time of the current and initial visit, and acts as the session counter to tell Google Analytics if you're a new visitor or a returning visitor (and, if you're a returning visitor, how many visits you have to your credit). 

10.2.2. The __utmb and __utmc Cookies

Both the __utmb and __utmc cookies are session identifiers. They serve the purpose of collecting page-view time stamps so that Google Analytics can record and calculate the average-time-on-site metric.
This brings up a new issue that is vital to understanding how Google Analytics works. The __utmb cookie is a persistent cookie, like the __utma cookie. The difference between the two is that the __utma cookie lasts by default for two years, while the __utmb cookie lasts only 30 minutes after the session expires. The __utmc cookie is a temporary cookie and expires as soon as you close your browser, thereby ending your browsing session.
What the __utmb and __utmc cookies do is take the time stamp of your first page view to the site in a given session. They then wait until you make a second page view to record the second time stamp, and subtract the value of the first time stamp from the value of the second time stamp. The remainder is the time you spent on the first page. Google Analytics will keep doing this for each sub-sequent page view, and at the end of your session all of your page view times will be added up, and the time you spent on the site (and on each individual page) will be recorded and sent to Google, along with your other cookie data.

10.2.3. The __utmz Cookie

The __utmz cookie is the referral cookie that stores all a visitor's referral information. It's also known as the campaign cookie, as campaign information is stored here.
Like the __utma and __utmb cookies, the __utmz cookie is a persistent one, with a default shelf life of six months. This can be edited, and I'll show you how to do that later in this chapter (the "Modifying Cookie Timeout Values" subsection). If you click an AdWords ad that is properly synced to a Google Analytics account, or for which campaign tracking URLs are being used (both of which will be discussed in later chapters), the __utmz cookie will store the source, medium, campaign, term, and content data, which Google Analytics will take and use in the Traffic Sources report section. For reasons that will become very clear toward the end of the chapter, maintaining the integrity of the __utmz cookie should be taken very seriously. The __utmz cookie can be compromised in a few precarious situations, like crossing between sub-domains or top-level domains.

10.2.4. The __utmv Cookie

The __utmv cookie is a special fifth cookie that can be dropped on a visitor's machine if you are using custom segmentation, which we will talk much more about later in this chapter. The __utmv cookie can hold up to five different labels for a unique visitor that can associate him or her with an important action or an important flag that allows advertisers to segment by these groups in Google Analytics reports.
The __utmv cookie has a shelf life of up to two years, making it a persistent cookie. It holds the domain hash like the other cookies, and holds up to five key/value pair combinations that identify certain unique visitors in a unique way. As we'll discuss later in the chapter, how you plan for custom variables is critical to their use.


10.3.2. The E-Commerce Tracking Snippet

Let's take a look at the e-commerce code snippet, and its location relative to the critical trackPageview function in the GATC:
_gaq.push(['_setAccount', 'UA-1234567-1']);
'1234', // order ID - required
'Mountain View', // affiliation or store name
'11.99', // total - required
'1.29', // tax
'5', // shipping
'San Jose', // city
'California', // state or province
'USA' // country
'1234', // order ID - required
'DD44', // SKU/code
'T-Shirt', // product name
'Green Medium', // category or variation
'11.99', // unit price - required
'1' // quantity - required
There are three main components of the e-commerce tracking snippet. The first is the addTrans function, which is in the third line of my example. The addTrans function collects the following transaction information:
  • Order ID: This is a required field, which means it must be filled out in order for e-commerce tracking to function. This is the order ID that your shopping cart or transaction system generates.
  • Affiliation: This is a store name, like Mountain View or San Francisco, or any other name you want to use.
  • Total: The transaction total, which is a required field.
  • Tax: The tax charged in the transaction.
  • Shipping: The shipping charged in the transaction.
  • City: The city in which the transaction originated.
  • State or Province: The state or province in which the transaction originated.
  • Country: The country in which the transaction originated.
You're required to fill in only the order ID and total fields in the addTrans function, but to get the most relevant data possible for your Google Analytics account, I recommend filling out all fields.
The second component of the e-commerce tracking code is the addItem func-tion, which will be in charge of collecting all product data. The fields collected by the addItem function are the following:
  • Order ID: Just like the addTrans function, the order ID in the addItem field is required, and, additionally, it must match the order ID in the addItem function exactly.
  • SKU/Code: This is reserved for a product number or SKU that you may find on the UPC label or on the back of an off-the-shelf product.
  • Product Name: The name of the product ordered.
  • Category or Variation: A category or a variation that the item ordered belongs to.
  • Unit Price: A required field, this is used to indicate the individual item price (not the combined price of multiple quantities of the same item).
  • Quantity: The quantity of each item purchased (a required field).
Again, while you're required only to fill in order ID, unit price, and quantity, it's a good idea to fill in as much product data as possible (preferably all fields).
For the addItem function, Google Analytics requires that for each additional unique item ordered, you create a second, third, or nth addItem entry in the e-commerce tracking module, so that Google Analytics can accurately collect transactions that contain multiple products. For example, let's say that not only did I purchase a T-shirt from the Google Store, I also purchased two large blue hats. The e-commerce coding would then appear as the following in the source code of the page:
Code View: Scroll / Show All
'1234', // order ID - required
'Mountain View', // affiliation or store name
'11.99', // total - required
'1.29', // tax
'5', // shipping
'San Jose', // city
'California', // state or province
'USA' // country
'1234', // order ID - required
'DD44', // SKU/code
'T-Shirt', // product name
'Green Medium', // category or variation
'11.99', // unit price - required
'1' // quantity - required
'1234', // order ID - required
'HT12', // SKU/code
'XLS-Hat', // product name
'Blue Hat- LG', // category or variation
'11.95', // unit price - required
'2' // quantity - required
Notice how the order ID field is the same for both products, but each individual product has its own SKU/code. Also notice that this particular transaction con-tains a quantityof 2, yet the unit price of 11.95 is the individual item price for each hat. Don't automatically multiply the quantity by the unit price — Google Analytics will do this for you on the report-processing end.
The third and final component of the e-commerce tracking code is the trackTrans method, which sends the addTrans and addItem data to Google Analytics servers for processing. Strangely, the trackTrans line is chopped off or simply forgotten about more often than seems logical. Without the trackTrans function, e-commerce data from Google Analytics will not be able to be collected.
You may be wondering how Google's e-commerce tracking script is able to collect this transaction data. This is where you, the developer/programmer, are going to come into the picture. With the e-commerce tracking snippet, you must write some application code or some piece of programming that will copy the values of the transaction and print them into the addTrans and addItem fields.
It's also your responsibility to ensure that each unique product is given its own addItem function. This can be done in PHP, .NET, ASP, ColdFusion, and any other non-HTML language that you can think of. It doesn't matter how your programming or application code is written — as long as it does the job of print-ing the transaction data for the e-commerce coding snippet, you're good to go.
Some off-the-shelf products like Miva Merchant and osCommerce offer Google Analytics plug-ins, where you'll only be required to provide the UA account number for your Google Analytics account. Check with your vendor to find out whether it offers a plug-in — you may be able to bypass having to hard-code everything.

10.3.3. Common E-Commerce Tracking Mistakes

Those of you who own Google Analytics, 3rd Edition (a book released in 2009 by Wiley Publishing that I had the pleasure of coauthoring) will recognize this subhead from that book's Chapter 8. There are several different types of mistakes you may make when programming your site for collecting e-commerce data, and these mistakes can affect the way your data ultimately appears in the reports. You need to be aware of all of the following common mistakes and pitfalls in order to collect the cleanest, most accurate data possible for your website. Your marketing department will thank you on bended knee for your diligent efforts.
  • Different Order IDs on addTrans and any addItem: The Order ID for each transaction must be exactly the same in both the addTrans function and every addItem function. If not, your data will be heavily distorted in Google Analytics.
  • SKU/Code inconsistency: If a visitor's order contains multiple items, making it necessary for multiple addItem functions to be called, each item must have a SKU/Code field filled out. This may sound like a no-brainer, but if for some reason you accidentally (or purposely) do not include a SKU/Code for any addItem, that item won't be recorded and you'll see wild inconsistencies in your e-commerce reports. Make sure that each addItem line contains a SKU/Code field.
  • Special characters: Currency symbols, quotations marks, asterisks, commas (especially commas), and any other characters like that in any e-commerce field will cause data distortion. You will probably need to check the source code of an order as it appears online to ensure that special characters aren't appearing in any field. If they are, write some additional code to replace these characters with letters, numbers, or dashes.
  • The number zero: The standalone number zero has also been known to cause some issues with reporting data in the past. Some accounts do not have any problems using zeroes for either the Tax or Shipping fields, while others do. My best advice is to not use zeroes and simply to skip the field entirely (leave it blank — no white space, no zero, no nothing — just two consecutive quotation marks).
  • Commas: Commas are just dangerous, and cause problems when used as thousands-place separators. We've all been taught in math classes to use commas to separate places by the thousands for large numbers. For Google Analytics e-commerce transaction data collection, you'll want to forget all about that advice.
  • Pre-multiplying the Unit Price field: I mentioned this earlier, but it definitely bears repeating, as it's very common. Do not pre-multiply the Unit Price field by the quantity; Google Analytics will do this for you during report processing.
  • Leaving out the trackTrans function: This last line of Google Analytics e-commerce coding is surprisingly left off the final product quite often. Don't forget that the actual call to Google Analytics servers happens via the trackTrans function, so it's required in order for e-commerce tracking to function.
  • Not using required fields: Just so that you're clear, the required fields in the addTrans function are Order ID and Total. The required fields in the addItem function are Order ID, Unit Price, and Quantity. You must use at least these five fields to record a successful transaction.
  • Not running addItem when necessary: Don't forget to run addItem for each unique item in a transaction. If your order contains one T-shirt, two hats, and three watches, there should be three addItem functions, as three unique items were ordered.


17.1. Programs for Analysis

Google Analytics and other traditional web-analytics programs are designed to tell you what has happened on your website. Anything that happens outside your website (e.g., any developing trends or fast-rising searches) isn't going to be reported by your web-analytics package of choice. You may be able to get by for a while by simply analyzing the data from your own website, but eventually, you'll have to evaluate developing trends in your industry and what other searches and websites your visitors are also using and visiting. Instead of being reactive by analyzing only your website's data, you'll become more proactive and spot outside trends and insights before they necessarily reach your website. Even an ostrich has to come up for air once in a while.

Two great, powerful programs within the Google ecosystem and available completely for free are Google Insights for Search ( and Google Trends (

17.3.2. Google Merchant Center

A far more affordable form of advertising than Google TV Ads is Google's Merchant Center, which allows you to upload product feeds that can appear on Google shopping and organic and paid search results. This Google product is designed specifically with the e-commerce merchant in mind. Visit and sign in to your Google account to find file specifications; then download a template of a product feed, insert your data into the template, and upload your product feed in a tab-separated text file (the instructions are very clear on the Google Merchant Center). Chances are pretty good that you already have a product feed or database file that you can export into a spreadsheet program like Microsoft Excel.

As you learned in Chapter 2, if you do have an active feed on Google's Merchant Center and are using product thumbnail images, those images can appear on your pay-per-click ads, as well as your organic search engine results. This can greatly enhance the strength of your brand for potential customers and make it more appealing for search engine users to click on your ads. In a recent search for the phrase "pencil sharpener" on Google, I saw an ad from that had product images, prices, and links within its pay-per-click ad, as shown in Figure 17-15. Other Google Merchant Center shopping results can be seen partially at the bottom of Figure 17-15, and a few national-brand conglomerates like Walmart and Staples are shown on the right-hand side.

A.5. Blogs to Subscribe To

There are a lot of great, influential, and intelligent people in our industry who have taken the time to share their thoughts to the world about all things concerning online marketing, web analytics, site optimization, and more. You should subscribe to as many of these blogs as you possibly can to expand your knowledge and learn all about what the leaders of our industry are doing.
Actionable Analytics:
AdWords API Blog:
Analytics Advice:
Analytics Talk:
BG Theory:
Blast Advanced Media:
ClickTale Blog:
Copy Blogger:
Duct Tape Marketing:
E-Nor Blog:
Google Analytics Blog:
Google Analytics Results:
Google Conversion Room Blog:
Google Website Optimizer Tricks:
Grok Dot Com (FutureNow):
I ♡ Split Testing:
Inside AdWords:
Juice Analytics:
Junk Charts:
Marketing Pilgrim:
Measuring Success:
Michael Whitaker's Web Analytics Blog:
Mobile Analytics Today:
Occam's Razor by Avinash Kaushik:
Omniture Industry Insights:
Pay Per Click Universe:
PPC Blog:
PPC Blog (UK):
Rich Page:
ROI Revolution:
Search Engine Guide:
Search Engine Land:
The Official Google Website Optimizer Blog:
Visual Revenue:
VKI Studios:
Web Analytics Demystified:
Web Analytics World:
Web Analytics, Behavioral Targeting and Optimization:
Yahoo! Web Analytics:

A.3. Google Resources

The following resources are all under the Google umbrella. In a way, they are "official" resources from the 800-pound gorilla that is Google. If it's on any of these resources, it's the official word.
AdWords Help Forum:
AdWords Online Classroom:
Google AdSense:
Google AdWords API:
Google AdWords:
Google Analytics Application Gallery:
Google Analytics Certified Partners (GACP):
Google Analytics Developer Docs (Google Code):
Google Analytics Help Center:
Google Analytics Help Forum:
Google Analytics IQ Lessons:
Google Analytics Setup Checklist:
Google Analytics Tool: URL Builder:
Google Analytics YouTube Channel:
Google Analytics:
Google DoubleClick Ad Planner:
Google FeedBurner:
Google for Advertisers:
Google Insights for Search:
Google Labs:
Google Partner Search:
Google Places:
Google Product Search:
Google Search-Based Keyword Tool:
Google Trends:
Google URL Shortener (
Google Webmaster Central Help Forum:
Google Webmaster Central Webmaster Guidelines:
Google Webmaster Central:
Google Webmaster Tools API:
Google Webmaster Tools:
Google Website Optimizer API:
Google Website Optimizer Articles on Website Optimization:
Google Website Optimizer Authorized Consultants:
Google Website Optimizer Help Forum:
Google Website Optimizer Help:
Google Website Optimizer Technology Partners:
Google Website Optimizer Tutorials & Videos:
Google Website Optimizer:
Google YouTube Business Channel:
Google YouTube Webmaster Central Channel:
Seminars for Success:

These are notes I made after reading this book. See more book notes

Just to let you know, this page was last updated Sunday, Jun 23 24