Measure ecommerce

You can set up ecommerce events to collect information about the shopping behavior of your users. The events enable you to quantify your most popular products and see the influence of promotions and product placement on revenue.

This document describes each ecommerce event and when to set up the event. For a step-by-step example of how to set up an ecommerce event, see Set up a purchase event.

Before you begin

Recommendations

  • Enable debug mode so you can see events in realtime and troubleshoot issues.
  • Review the custom dimension and metric limits when sending custom parameters with ecommerce events.
  • Set currency when sending value (revenue) data to ensure revenue metrics are calculated correctly.
  • Set each ecommerce parameter you have data for, regardless of whether the parameter is optional.
  • Use the sample ecommerce website to see an example of how to tag your website.

Implementation

A typical ecommerce implementation measures any of the following actions:

At the heart of these actions are the products and services you sell. You can represent products and services as an array of items that can be added to ecommerce events. You can include up to 27 custom parameters in the items array, in addition to the prescribed parameters.

The following example demonstrates how to create the collection of items that are referenced throughout this guide. The items array can include up to 200 elements.

Select an item from a list

When a user is presented with a list of results, send a view_item_list event including an items array parameter containing the displayed items. For details on the parameters to send, see the Events reference.

Once a user selects an item from the list, send the select_item event with the selected item in an items array parameter. For details on the parameters to send, see the Events reference.

View item details

To measure how many times item details are viewed, send a view_item event whenever a user views an item's details screen. For details on the parameters to send, see the Events reference.

Add or remove an item from a shopping cart

Measure an item being added to a shopping cart by sending an add_to_cart event with the relevant items in an items array. For details on the parameters to send, see the Events reference.

You can also measure when an item is added to a wishlist by sending an add_to_wishlist event with the relevant items in an items array. For details on the parameters to send, see the Events reference.

When a user subsequently views the cart, send the view_cart event with all items in the cart. For details on the parameters to send, see the Events reference.

To measure when a user removes an item from a cart, send the remove_from_cart event. For details on the parameters to send, see the Events reference.

Initiate the checkout process

Measure the first step in a checkout process by sending a begin_checkout event with one or more items defined with the relevant fields. A coupon can also be added at this stage to the entire order by adding it to the event or applied to a particular item by adding it to specific elements in the items array. For details on the parameters to send, see the Events reference.

When a user proceeds to the next step in the checkout process and adds shipping information, send an add_shipping_info event. Use the parameter shipping_tier to specify the user's delivery option, such as "Ground", "Air", or "Next-day". For details on the parameters to send, see the Events reference.

Send the add_payment_info event when a user submits their payment information. If applicable, include payment_type with this event for the chosen method of payment. For details on the parameters to send, see the Events reference.

Make a purchase or issue a refund

Measure a purchase by sending a purchase event with one or more items defined with the relevant fields. For details on the parameters to send, see the Events reference.

Measure refunds by sending a refund event with the relevant transaction_id specified and one or more items defined with item_id and quantity. We recommend that you include item information in your refund event to see item-level refund metrics in Analytics.

For details on the parameters to send, see the Events reference.

Apply promotions

Ecommerce includes support for measuring impressions and clicks of internal promotions, such as banners displayed to promote a sale.

Promotion impressions are typically measured with the initial screen view by sending the view_promotion event with an items parameter to specify the promoted item. For details on the parameters to send, see the Events reference.

To indicate a user clicked on a promotion, send a select_promotion event with that item as an item parameter. For details on the parameters to send, see the Events reference.