Firebase Purchase Analytics
As part of our effort to improve tracking of user behavior and funnel efficiency in the purchasing process, we’ve built a Firebase Purchase Analytics Funnel. The funnel consists of several key analytics events that track the user’s journey from viewing an item to completing a purchase.
Overview
The following events are tracked in the purchase funnel:
- View Item: When a user views an item.
- Add to Cart: When a user adds an item to the shopping cart.
- Begin Checkout: When a user initiates the checkout process.
- Add Payment Info: When a user adds payment information.
- Purchase Event: When a purchase is completed.
Events and Sample Usage
View Item Event
This event tracks when a user views an item in the app. It captures details about the item, such as name, ID, price, and quantity, as well as the section of the app where the item was viewed.
Usage Example:
ViewItemEvent(
itemName: 'itemName',
itemId: 'item-001',
itemPrice: 10,
quantity: 1,
locationId: 'HB-001-001',
section: HubtelLibraryAnalyticsUtils.instance.getSection(),
)
Parameters:
- itemName: The name of the item.
- itemId: The unique identifier of the item.
- itemPrice: The price of the item.
- quantity: The quantity being viewed.
- locationId: The location ID, which is randomly assigned.
- section: The section of the app where the event occurred.
Add to Cart Event
This event tracks when a user adds an item to their shopping cart. It includes information about the order and items being added.
Usage Example:
AddToCartEvent(
amount: 10,
section: HubtelLibraryAnalyticsUtils.instance.getSection(),
orderId: 'ee1-001-332',
purchaseOrderItems: List<PuchaseOrderItemEvent>,
)
Parameters:
- amount: The total amount for the items added to the cart.
- section: The section of the app where the item was added to the cart.
- orderId: The unique order ID.
- purchaseOrderItems: A list of items being added to the cart.
Begin Checkout Event
This event tracks when a user begins the checkout process. It includes details about the order, the amount, and the section of the app where the checkout process began.
Usage Example:
BeginCheckoutEvent(
orderId: '001-001',
amount: 20,
section: CheckoutRequirements.analyticsData?.section ?? AppAnalyticsUtils.getSection(),
checkoutSection: AppSection.home,
purchaseOrderItems: List<PuchaseOrderItemEvent>,
)
Parameters:
- orderId: The unique order ID.
- amount: The total amount of the order.
- section: The section of the app where the checkout began.
- checkoutSection: The specific checkout section within the app.
- purchaseOrderItems: A list of items being purchased.
Add Payment Info Event
This event tracks when a user adds their payment information. It includes details about the payment method, order ID, and the items being purchased.
Usage Example:
AddPaymentInfoEvent(
amount: widget.checkoutPurchase.amount,
section: CheckoutRequirements.analyticsData?.section ?? AppAnalyticsUtils.getSection(),
orderId: widget.checkoutPurchase.clientReference,
paymentType: walletType?.optionValue.toLowerCase() ?? "",
purchaseOrderItems: List<PuchaseOrderItemEvent>,
)
Parameters:
- amount: The total amount of the purchase.
- section: The section of the app where the payment info was added.
- orderId: The unique order ID.
- paymentType: The type of payment method (e.g., “wallet”, “credit card”).
- purchaseOrderItems: A list of items being purchased.
Purchase Event
This event tracks when a user successfully completes a purchase. It includes details about the order, payment method, and the final state of the transaction.
Usage Example:
- amount: The total amount of the purchase.
- section: The section of the app where the purchase was made.
- checkoutSection: The section of the checkout process.
- paymentChannel: The payment channel used for the purchase (e.g., wallet, bank transfer).
- paymentType: The type of payment method used.
- orderId: The unique order ID.
- purchaseOrderItems: A list of items being purchased.
PurchaseOrderItemEvent
The PurchaseOrderItemEvent is an object passed the the items property of the various events. Parameters:
- itemId : The unique identifier for the item being added to the cart.
- name : The name of the item being added to the cart.
- quantity: The number of units of the item being added to the cart.
- amount : The price of the item.
- provider: The provider or supplier of the item (if applicable).
- locationId: A location identifier that indicates where the item is being added to the cart from (e.g., a physical store or a particular region).
Best Practices
- Ensure that you capture all the required fields in each event to provide comprehensive analytics on user interactions with the purchase flow.
- Use the section field to track where in the app users are engaging with the purchase funnel to optimize and improve the UX in those areas.
- Monitor the success rate of the funnel by looking at how many users complete each step, and use this information to reduce friction and drop-off points.
Conclusion
By integrating these Firebase Analytics events into your app, you can track the entire purchase journey—from viewing an item to completing the purchase. This will help you gain insights into user behavior and optimize the buying experience for better engagement and higher conversion rates.
CHAT SAMMIAT