Ecommerce

Ecommerce reporting provides insight into the shopping behavior of your users, enabling you to quantify your most popular products and see the influence of promotions and product placement on revenue. By instrumenting events correctly, you can measure common conversion paths and curate better customer experiences.

This article explains how to implement the recommended online sales events and report on the event data. You can see ecommerce event data using the following resources:

For details on implementing ecommerce mobile apps through Firebase, see Measure Ecommerce.

Before you begin

Recommendations

  • Enable debug mode so you can see events in realtime and more easily 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

Associate products with an event by including an array of items. The items array can include up to 200 elements.

items: [
    {
      item_id: "SKU_12345",
      item_name: "Stan and Friends Tee",
      affiliation: "Google Merchandise Store",
      coupon: "SUMMER_FUN",
      currency: "USD",
      discount: 2.22,
      index: 0,
      item_brand: "Google",
      item_category: "Apparel",
      item_category2: "Adult",
      item_category3: "Shirts",
      item_category4: "Crew",
      item_category5: "Short sleeve",
      item_list_id: "related_products",
      item_list_name: "Related Products",
      item_variant: "green",
      location_id: "L_12345",
      price: 9.99,
      quantity: 1
    },
    {
      item_id: "SKU_12346",
      item_name: "Google Grey Women's Tee",
      affiliation: "Google Merchandise Store",
      coupon: "SUMMER_FUN",
      currency: "USD",
      discount: 3.33,
      index: 1,
      item_brand: "Google",
      item_category: "Apparel",
      item_category2: "Adult",
      item_category3: "Shirts",
      item_category4: "Crew",
      item_category5: "Short sleeve",
      item_list_id: "related_products",
      item_list_name: "Related Products",
      item_variant: "gray",
      location_id: "L_12345",
      price: 20.99,
      quantity: 1
    }
] 

The parameters above will populate the following dimensions in Google Analytics:

Dimension Value
Item ID SKU_12345
Item name Stan and Friends Tee
Item list position 0
Item brand Google Merchandise Store
Item category Apparel
Item category 2 Adult
Item category 3 Shirts
Item category 4 Crew
Item category 5 Short sleeve
Item list ID related_products
Item list name Related Products
Item location ID L_12345

Product views and interactions

Measuring product views and interactions provides insight into how often products are shown, viewed, and selected by users. Combined with promotion data, these events can help you measure the effectiveness of campaigns.

View item list

Example

A user is shown a small collection of shirts on a Related products list. On the page where a user is shown the shirts, you can add the following snippet to your JavaScript that triggers when a user visits the page.

Analytics increments the Item list views metric by 1 each time the event triggers.

View item

Example

A user visits a page for a Stan and Friends Tee from the Google Merchandise Store. On the page where a user is shown the shirt, you can add the following snippet to your JavaScript that triggers when a user opens the page.

Analytics increments the Item views metric by 1 each time the event triggers.

Select item

Send the select_item event when a user selects an item from a list, along with an items array parameter that includes the selected item.

Example

A user clicks a link from a Related products list that goes to a page for a Stan and Friends Tee. On the page where a user selects the product, you can add the following snippet to an event listener in your JavaScript that triggers when a user clicks to open the product page.

Internal promotions

Internal promotions are a way of advertising one part of your site from another part of your site. For example, you can place a banner on your home page that advertises a 5% discount on shirts. You can use promotion views and clicks to attribute credit to purchases that started with a promotion.

View promotion

Example

A user views a banner that advertises a promotion for Stan and Friends Tee from the Google Merchandise Store. On the page where a user sees the promotion, you can add the following snippet to your JavaScript that triggers when a user visits the page.

Analytics increments the Item promotion views metric by 1 each time the event triggers.

Select promotion

Example

A user clicks a promotion for a Stan and Friends Tee from the Google Merchandise Store. On the page where a user is shown the promotion, you can add the following snippet to an event listener in your JavaScript that triggers when a user clicks the promotion.

Analytics increments the Item promotion clicks metric by 1 each time the event triggers.

Shopping cart interactions

These events enable you to measure how often users show an interest in purchasing the products you sell.

Add to cart

Example

A user clicks an "Add to cart" button for a Stan and Friends Tee from the Google Merchandise Store. On the product page, you can add the following snippet to an event listener in your JavaScript that triggers when a user clicks the button.

Analytics updates the following metrics each time the event triggers:

  • The Add-to-carts metric increments by 1
  • The numerator of the Cart-to-view rate metric increments by 1

Add to wishlist

Example

A user clicks an "Add to wishlist" button for a Stan and Friends Tee from the Google Merchandise Store. On the product page, you can add the following snippet to an event listener to your JavaScript that triggers when users click the button:

Remove from cart

Example

A user clicks a "Remove from cart" button for a Stan and Friends Tee from the Google Merchandise Store. On the shopping cart page, you can add the following snippet to an event listener in your JavaScript that triggers when a user clicks the button.

View cart

Example

A user views their shopping cart, where their cart includes a Stan and Friends Tee. On the shopping cart page, you can add the following snippet to your JavaScript that triggers when a user lands on the page.

Analytics increments the denominator of the Cart-to-view rate metric by 1 each time the event triggers.

Checkout funnel

The checkout funnel includes the steps from beginning the checkout process to purchasing products. You can visualize each step in the checkout funnel and the number of users who complete each step by creating a funnel exploration.

Begin checkout

Example

A user starts the checkout process (such as clicking a "Checkout" button) to purchase a Stan and Friends Tee from the Google Merchandise Store. On the page where a user begins checkout (for example, on the shopping cart page), you can add the following snippet to an event listener in your JavaScript that triggers when a user clicks a button to begin checkout.

Analytics increments the Checkouts metric by 1 each time the event triggers.

Add payment information

Example

A user adds their credit card information to purchase a Stan and Friends Tee from the Google Merchandise Store. On the page where a user adds their payment information, you can add the following snippet to an event listener in your JavaScript that triggers when a user clicks a button to add their payment information.

Add shipping information

Example

A user adds their shipping information to purchase a Stan and Friends Tee from the Google Merchandise Store. On the page where a user adds their shipping information, you can add the following snippet to an event listener in your JavaScript that triggers when a user clicks a button to add their shipping information.

You need to create a custom dimension using the shipping_tier event parameter to see Ground.

Purchase

Example

A user purchases a Stan and Friends Tee from the Google Merchandise Store. On the page where a user clicks to purchase, you can add the following snippet to an event listener in your JavaScript that triggers when a user clicks the button.

Analytics updates the following metrics each time the event triggers:

  • The Purchase revenue and Total revenue metrics increase by $48 USD
  • The numerator of the Purchase-to-view rate metric increases by 1
  • The Quantity and Ecommerce purchases metrics increase by 1

Refund