Article Search

Return results from:

News & Articles



Wholesale News & Articles

INDEPENDENT RETAILER magazine is now the official news outlet for Wholesale Central visitors. Each monthly issue is packed with new product ideas, supplier profiles, retailing news, and business strategies to help you succeed.

See new articles daily online at


Data Segmentation for Ecommerce

May 1, 2012
by Eric Lunaburger

If you only use the standard data gathering and reporting features present in Google Analytics, you are not getting a complete picture of how your business is performing. For ecommerce stores to gain insight into the behavior of visitors, they need to be doing more. The need to better segment data becomes critical to making informed business decisions about how to best reach business objectives. In short, data segmentation enables deeper penetration into understanding the true performance of a website, and the behavior patterns of its visitors.

Knowing we need to segment data, one might ask, "What is the best method for doing this inside Google Analytics, and are there any specific areas that should be focused on for analysis?" The answer to the first part of the question is straightforward. One reliable method for segmenting data within Google Analytics, although not the only one, is to use Custom Variables, in conjunction with Event Tracking, to push data into Google Analytics that would otherwise not be made available. The answer to the second part of the question, regarding which areas to focus on, is less concrete and depends on what would help your business reach its goals. Although the area of focus will vary from business to business, there are four Custom Variables that all ecommerce businesses should consider when it comes to tracking.

What is Event Tracking?
Event Tracking is a method available within the ga.js tracking code (it is not available in Legacy versions) that you can use to record user interaction with website elements. This could be anything from adding or removing an item to a shopping cart, downloading a file from a website, or embedding AJAX elements or anything else you can dream up. For example, suppose you wanted to know how many visitors added a specific item to their carts. Without Event Tracking it is guesswork, but with Event Tracking the reporting becomes a reality.

Event Tracking is made up of five different components. Three of the five might be taken advantage of in tracking visitor interaction within an ecommerce site, including:

Categories: A name that you supply as a way to group objects that you want to track.

Actions: Most often, you will use the action parameter to name the type of event or interaction that took place.

Labels: Labels let you add additional information to events you want to track. In this example we wanted to know the name of the product that was added to the cart, and thus the "label" would be the actual name of the product.

To track the number of times a certain product was added to a visitor cart, you might do something like this:

[Add to cart button]

I will not get into the technical details of the above, but it is important to give a brief overview of what makes up an Event within Google Analytics, to help you better understand its value.

What are Custom Variables?
Like Events, Custom Variables let you track website interaction for areas that would otherwise be left out of traditional reporting. Google defines Custom Variables as name-value pair tags that you can insert in your tracking code, in order to refine Google Analytics tracking. Custom Variables are also made up of various components. One of the biggest differences between Events and Custom Variables is that the latter can be segmented based on three visitor engagement levels: Visitor, Session and Page.

The tracking code for Custom Variables is similar in nature to the Event code listed earlier, and follows this pattern: _setCustomVar(index, name, value, opt_scope), where index is the slot assigned to the Custom Variable, name is the name for the Custom Variable, value represents the value, and opt_scope defines the level of user engagement on your site (i.e. Visitor, Session, Page.)

Four Custom Variables for Ecommerce Sites

1) Tracking Coupon Codes and Promotions
Promotions are one of the most important methods for driving sales. Yet I find that not all stores track the effectiveness of various promotions to their fullest extent. I hear them say, "It made us X in sales, so it must have worked." The fact is, you cannot really know if a promotion works until you take a close look at it. If you wanted to track all of your promotions aggregated under one variable, you could do something such as this:


Or, say you want to find the effectiveness of several different promotions you ran, you might want to do something like the following:


2) Tracking Payment Methods
What would your business be like if you could look at an analytics report and find out that those who paid with a certain payment method (PayPal vs. credit card) spent more on average than others? It could change the way you look at running promotions, or even the payment methods you offer. Here is an example of how you might set up tracking for segmenting this type of data among your visitors:

_gaq.push(['_setCustomVar',2, 'PaymentMethod','<TYPE OF PAYMENT HERE>',3]);

Keep in mind that in all of my examples here, the components will vary based on your business needs.

3) Tracking Repeat Customers
Repeat customers build profits in an ecommerce store. Typically, it costs less to get repeat sales than to get the first sale. Likewise, repeat customers have different behavior habits than do first time visitors. Understanding how this behavior interacts with your site can help build a solid foundation of repeat sales, upon which your business can grow.

Tracking repeat customer behavior must be done at the "Visitor" scope level (recall the three different interaction options mentioned earlier). Although in structure the tracking snippet is the same as previous examples, the trick here is in the timing of when you set the actual variable. When tracking repeat customers, we do not want to set this Custom Variable on their first purchase. If they do not come back and purchase again, they are not considered repeat, and thus our data is inaccurate. Rather, we want to set this custom variable on their second visit to the site, not second purchase. Here is an example of how you might set the Custom Variable for tracking repeat customers on your site:


Setting this upon the customer's return to your site after the first purchase, is going to require some programming to read cookie information on the client machine. Not an exact science, but it will work to gather the data on repeat visits to the site, where they may not make a purchase.

The other option, although it, too, has limitations, is to set the variable on the order thank you page, after their second purchase. Although this will more clearly set a trigger for the Event, it will not fire the Event if a previous customer returns to the site and does not make a purchase. Therefore, you lose some valuable data insight on what their behavior was in their return visit, because you set the variable based upon the purchase rather than the return.

4) Tracking Purchase History
Tracking purchase history is not as easy as the previous mentioned methods. For this to work, your technical team will need to develop a program that categorizes customers based on the number of purchases made. In general, they would need to create some code on the server capable of reviewing a customer's purchase history, then set the custom tracking variable accordingly.

For stores without access to their own source code, including anyone using hosted shopping carts like Amazon, Yahoo!, etc., you are going to be out of luck getting this type of segmentation to work. For those with the opportunity to alter their shopping cart source code, here is the code snippet for how you might accomplish this:


The above snippet drops the visitor into a bucket of those who have made a purchase at least once with your store, and up to three times maximum. You would set additional segments as needed, altering the above line for each "bucket" you want to track; for example, those that have purchased four to seven times, eight to ten times, etc.

All ecommerce stores implementing Google Analytics should be using Custom Variables and Event Tracking, to segment data for measuring the behavior patterns of their visitors. Without this level of detail, you are only getting a small part of the overall picture of how your business is performing. Also, keep in mind that the four suggested variables mentioned are by no means the only available options. The more information you know about how your visitors interact with your website, the better your ability to make informed business decisions that move your company toward its objectives.

Eric Leuenberger is an ecommerce expert, founder of Ecommerce Amplifier, and owner of Voom Ventures, LLC, whose products and services help stores increase traffic, maximize ROI, decrease expenses, and increase revenue. He can be contacted online at, or by phone at 1-866-602-2673.

Topic: Web Tech Tips

Related Articles: Analytics 

Article ID: 1571

Printer Friendly

Entire contents ©2024, Sumner Communications, Inc. (203) 748-2050. All rights reserved. No part of this service may be reproduced in any form without the express written permission of Sumner Communications, Inc. except that an individual may download and/or forward articles via e-mail to a reasonable number of recipients for personal, non-commercial purposes.