Sitemap
Code & Wild

Thoughts on technology and culture at Bloom & Wild as we build the world’s leading and most loved flowers, plants & gifting platform. See more at https://github.com/BloomAndWild

Heap Events on Android

--

One of the most important things in E-Commerce businesses is analytics.

It provides insights into how the customers interact with our product.
This helps us to uncover opportunities for improvement and innovation.

Heap is one of the tools that we use to do that in the Android Bloom & Wild and Bloomon apps.

Heap is a tool that helps us understand how and why customers engage with our product

Why Heap?

By default, Heap tracks events like clicking on buttons and entering on screens.
On each event, there is also some information about the device, like:

  • brand
  • device operating system version
  • country

This information by itself is already great to understand the user flow through the app.

But… This is not enough.

With Heap, we can create custom events.
Events that we can trigger anywhere, whenever we want and with any kind of information!

Custom Events

What we have done here, was to bring our own custom events to the table, using properties about the current user session.

Some examples of events we track are:

  • startCheckout — the moment the user presses on “Send” on a product
  • carousel— the moment the user sees the products list
  • purchase — the moment the user starts a purchase
  • errorMessageThrown — when an error message appears on the screen

We can define specific scenarios to be analysed:

  • the percentage of users the starts checkout in a session
  • the percentage of users that goes from the carousel to starting a checkout in a session
  • the percentage of users who complete a purchase after starting checkout

By having a well structured set of custom events, we can use them to identify areas that we need to focus on our app, which brings us to the business advantages.

Business Advantages

Heap helps us to identify opportunities for improving our App for our customers, by helping us to understand the current experience of our users.

As an example, these are two scenarios that are analysed:

  • “Session”“Start Checkout” — this tells us whether we are helping/inspiring people to find a product that meets their needs
  • “Start Checkout”“Order Confirmed” — this tells us whether we have a smooth and easy checkout process that helps people buy without friction

With these events, we can start to identify trends that help us spot where customers may be facing friction within our App. We can then look for opportunities to remove or reduce that friction, for example during checkout.

By removing friction and making the App easier to use, we make our customers happier. This means they are more likely to purchase from us and come back and use the App again in future.

However, us developers also get some advantages with all of this!

Debugging

When there are issues in our app on the Playstore, custom events can help developers debugging.

By knowing the triggered events, we can understand some of the steps taken in customers sessions, which makes it easier to replicate and solve the issues.

It’s worth to notice that we value users privacy, and that no private/personal information is stored along with custom events.
For more information, please see our policy information.

Now… Let’s get into tech aspects.

Implementation

By dividing each piece of code by their responsibilities, we managed to get a loosely coupled structure on our Heap Events implementation.

HeapEvent

Every event that we create, will have an is-a relation with HeapEvent.
This means every event needs to implement:

  • getEventName()
  • getParams()
  • canBeTracked()

and will have its own state.

HeapStateManager

There are some properties that are supposed to be sent on every event.
HeapStateManager has the responsibility of storing those and make them accessible to whoever needs them.

HeapTracker

HeapTracker is solely responsible for tracking the events.
It takes an event as a parameter, joins the event parameters with global parameters from HeapStateManager , and sends it to Heap.

After this, the usage is simple.
We need a HeapTracker to track the events, we create our own HeapEvent and then we just send the event to the tracker. It will join the event parameters with HeapStateManager global parameters, and it will handle everything.

--

--

Code & Wild
Code & Wild

Published in Code & Wild

Thoughts on technology and culture at Bloom & Wild as we build the world’s leading and most loved flowers, plants & gifting platform. See more at https://github.com/BloomAndWild

Paulo Pereira
Paulo Pereira

Written by Paulo Pereira

Hello! I am Paulo and I’m 27 years old. | Senior Android Engineer @Bloom & Wild

No responses yet