Measure Ecommerce
Notice
This page is archived and might not reflect the latest version of the FlutterFire plugins. You can find the latest information on firebase.google.com:
https://firebase.google.com/docs/analytics/measure-ecommerce
Ecommerce allows measurement of user interactions with products across your users' shopping experiences, including interactions such as product (item) list views, product list clicks, viewing product details, adding a product to a shopping cart, initiating the checkout process, purchases, and refunds.
For details on implementing ecommerce web apps, see Google Analytics Ecommerce.
#
Before you beginMake sure that you’ve set up your project and can access Analytics as described in Get Started with Analytics. Ecommerce measurement requires you to link your Firebase project to an Analytics account and to have the Android SDK v17.3.0 or iOS v6.20.0 and up in your app.
#
ImplementationA typical ecommerce implementation measures any of the following actions:
- Select a product from a list
- View product details
- Add/remove a product from a shopping cart
- Initiate the checkout process
- Make purchases or refunds
- Apply promotions
At the heart of these actions are products. Products can be instrumented as an array of items that can be added to prescribed ecommerce events. The following example demonstrates how to create a collection of items that are referenced throughout this guide.
#
Select a product from a listWhen a user is presented with a list of results, log a view_item_list
event
including an items
array parameter containing the displayed products.
Once a user selects a particular product from the list, log a select_item
event with the chosen product in an items
array parameter.
#
View product detailsTo measure how many times product details are viewed, log a view_item
event
whenever a user views a product's details screen.
#
Add or remove a product from a shopping cartMeasure a product being added to a wishlist or cart by logging an
add_to_wishlist
or add_to_cart
event, respectively, with the relevant
products in an items
array parameter.
When a user subsequently views the cart, log the view_cart
event with all
items
in the cart.
To measure when a user removes a product from a cart, log the
remove_from_cart
event.
#
Initiate the checkout processMeasure the first step in a checkout process by logging 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.
When a user proceeds to the next step in the checkout process and adds shipping
information, log an add_shipping_info
event. Use the parameter shipping_tier
to specify the user's delivery option, such as "Ground", "Air", or "Next-day".
Log add_payment_info
when a user submits their payment information. If
applicable, include payment_type
with this event for the chosen method of
payment.
#
Make a purchase or issue a refundMeasure a purchase by logging a purchase
event with one or more items
defined with the relevant fields.
note
The purchase event replaces ecommerce_purchase
and is different from the
in_app_purchase
event, which is reported automatically.
Measure refunds by logging a refund
event with the relevant transaction_id
specified and optionally (for partial refunds) one or more items
defined with
item_id
and quantity
.
note
The refund
event replaces ecommerce_refund
.
#
Apply promotionsEcommerce 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
logging the view_promotion
event with an items
parameter to specify the
promoted product. To indicate a user clicked on a promotion, log a
select_promotion
event with that product as an item
parameter.