Practical Ecommerce

Google Analytics: 5 Custom Ecommerce Events to Track

A friend recently asked me about event tracking on his new ecommerce site. He wondered if I had a comprehensive list of events to track.

Well, in answer to my friend, this article is my list of five favorite event tracking customizations, using Google Analytics, for ecommerce sites.

Click-throughs on Home Page Promotions

For most sites, the home page is the most popular landing page. That makes it valuable real estate, and it means that it deserves a little extra data collection. Home pages tend to have at least one “feature” area, and many have both primary and secondary promotional areas — promoting individual products and special offers or campaigns. There are two things to track about these features.

  • Which ones drive the most or least clicks?
  • Which ones drive the most or least conversions?

Adding a Google Analytics custom event as an onClick event for each promotion makes both metrics readily available, using this tracking code.

_gaq.push(['_trackEvent', 'Home Page', 'Main Promo Clickthrough', '[Promo descriptor]']);

With this tracking in place, the report at “Content > Events > Top Events” provides detail on individual click-throughs and subsequent conversions. Drill down on the “Home Page” category and then on “Promo Clickthrough,” and then click the “Ecommerce” link above the chart at the top of the page. The resulting report lists the number of visits where the visitor clicked on each promo link, as well as the revenue, transactions, and conversion rate for each of those visits:

Zoom Enlarge This Image

"Promotional Clickthrough" analytics example.

"Promotional Clickthrough" analytics example.

During a single visit, a visitor may click on multiple promotions. If that happens, the visit will be included in each of the individual rows in the report.

Add-to-cart Clicks

Many ecommerce sites have “add to cart” buttons that are not automatically tracked by Google Analytics. If your add-to-cart functionality simply launches an overlay or shows an on-screen message that the product has been added to the cart, then you may not be tracking these actions in a way that is easily accessible.

You may also have “add to cart” buttons on different types of pages: product details pages, “Quick View” overlay pages, and category and shelf pages. If so, event tracking that is well crafted enables you to analyze these actions both by page type and across page types. Use this tracking code to do this.

_gaq.push(['_trackEvent', '[Page Type]', 'Add to Cart', '[Product Name]']);

The standard event tracking report provides detail on how often this functionality is used, which products are added to the cart, and the resulting conversion rate by product. Here’s a sample report.

Zoom Enlarge This Image

"Add to Cart" analytics example.

"Add to Cart" analytics example.

This tagging also enables you to set up a Google Analytics “conversion goal” of “Add to Cart” — setting up a goal of “Event Action = ‘Add to Cart’” — to determine what percentage of traffic to your site, as well as what percentage of specific segments of traffic to your site, add at least one product to their cart.

Unsuccessful ‘Add to Cart’

If you have products on your site that require shoppers to select an option like size, color, or quantity before they can successfully add the product to their carts, then use event tracking to capture how often visitors try to add a product to their cart before selecting a requisite option. Trigger this event at the same time that you display an error message to the visitors letting them know that they need to take additional action. Here’s the tracking code.

_gaq.push(['_trackEvent', 'Product Page', 'Unsuccessful Add to Cart', '[Error descriptor]',1,true]);

The “Error descriptor” can be the exact text that is displayed to the user. Standard event reporting in Google Analytics then displays what errors are being presented, as well as the number of orders that occurred on visits when those errors were displayed. If an error message has a low conversion rate, then it is possible that visitors are actually getting “stuck” and are not, ultimately, able to complete a purchase.

Zoom Enlarge This Image

Unsuccessful "Add to Cart" analytics example.

Unsuccessful "Add to Cart" analytics example.

You can also look at the ratio of “Events” to “Unique Events” by clicking the Event view under the Explorer tab. A high ratio indicates that visitors are triggering the error multiple times during the visit, which means there is possibly something either broken or confusing about the page design.

To find out which pages these errors are occurring on, choose “Page” from the secondary dimension dropdown.

Unsuccessful Checkouts, Registrations, and Logins

“Add to Cart” is only one of the “user submit” actions on your site. Visitors also click a button to complete their orders, to register with the site, and to log in to the site. If you have form validation built into these features — and you should — then you also need to track how often the form validation events are occurring. Adding event tracking to form validation enables you to monitor if these occur on your site. Here’s a sample tracking code for an unsuccessful “Place Order” click:

_gaq.push(['_trackEvent', 'Checkout', 'Unsuccessful Place Order', '[Error descriptor]',1,true]);

And here is sample tracking code for an unsuccessful registration form submission:

_gaq.push(['_trackEvent', 'Registration Form', 'Unsuccessful Registration', '[Error descriptor]',1,true]);

Here’s the code for an unsuccessful login:

_gaq.push(['_trackEvent', 'Login Form', 'Unsuccessful Login', '[Error descriptor]',1,true]);

Accessing the data for each of these errors is similar to what was described in the previous section for unsuccessful add-to-cart clicks.

Site Searches with No Results

Your site search engine provides reports on searches that return “No Results” to the user. But, you may not monitor those reports closely. Moreover, those reports do not tell you whether visitors who unsuccessfully searched went on to find a product and convert to a sale. Google Analytics provides several ways to capture this information. But, once again, this is not information that is captured automatically, and event tracking is often the easiest approach to implement. Simply add the following code to your “No Results” site search page:

_gaq.push(['_trackEvent', 'Search Results', 'No Results', '[Searched phrase]',1,true]);

With this code implemented, event-tracking reporting shows a list of search terms resulting in no results, which represent an opportunity to add the terms to your search engine’s thesaurus.

Zoom Enlarge This Image

"No Results" analytics example.

"No Results" analytics example.

You can also set up a custom alert and receive an email if there is a jump in events where “Event Action = No Results,” which will alert you to dig into this report.

Custom Variables

This article has described five ways to use Google Analytics custom event tracking to capture actionable information about your ecommerce site. Google Analytics also supports “custom variables,” which can also be used to capture useful information. See “5 Google Analytics Custom Variables for Ecommerce, “ an article by Justin Cutroni, an analytics consultant, for more.

Customization: No Single Answer

When it comes to data collection and analysis, there is no single right approach. Every site is different. The recommendations in this article may not apply to you; they may not be the highest priority for your site. Hopefully, though, they have illustrated how you can supercharge your Google Analytics implementation to capture data that can directly improve the business results delivered by your site.

Tim Wilson

Tim Wilson

Bio   •   RSS Feed


Sign up for our email newsletter

  1. Ydeveloper September 22, 2013 Reply

    Once an ecommerce site reaches a certain level or a website contain large number of inventories, it’s better to track the events similar to explain above. This tracking works like you are auditing your website for improving certain area to make sure visitors find what they exactly looking for.

  2. Leigh October 8, 2013 Reply

    Hi Tim, apologies for an elementary question but where should one place all these tracking codes? My site runs on OpenCart and there isn’t a “head” per se to paste this in. Many thanks in advance!

  3. Tim October 11, 2013 Reply

    Hi Leigh,

    The core Google Analytics tag — not discussed in this post — is what needs to go in the . If you already have that working and are capturing base page data, then you are all set on that front.

    When it comes to adding these codes, they need to be implemented as JavaScript calls when the user takes the relevant action. Google has pretty good documentation on the specific syntax as these would show up in the HTML of the page at But, the specifics for making this happen is going to vary based on platform. The information in this post — — may give you what you need.

    Best of luck!

  4. Graeme October 27, 2013 Reply

    Some nice ideas here. It is also possible to check if people are viewing larger images if you use an overlay. For long pages, you can set an event to trigger if the user scrolls down past a certain point to check how much below the fold text is being read.

  5. ryan March 19, 2014 Reply

    for Site Searches with No Results what would be the Google universal analytics code?

  6. Greg April 17, 2014 Reply

    Hi Tim,

    Thanks for the article. Very helpful. I was wondering if you are aware of a way to track the value of an event beyond the session that it occurs in? If someone engages in chat on our site that triggers a Google Analytics event and we are able to see if during that session they convert to a sale. But, is there a way to see in the next 30 days or so how many of the visitors we chatted with converted into sales and the value of those sales?



  7. Tim Wilson April 18, 2014 Reply

    Hi Greg,

    There are a couple of ways to do this. A quick way that partially does this is to use a “User” segment. Create a new segment, go to the “Conditions” area, and change the dropdown from “Session” to “User” and add your event criteria. This will now include all users (cross-session visitors) who triggered the event during any individual visit.

    To get a bit more detailed, you can use a visitor-scope custom variable. You may want to set it with a key of “Most recent chat” and a value of the date of the chat. You can then make a custom report that shows orders and revenue for that custom variable.