• Tryolabs
Read time: 6 minutes

How to track user actions and make sense of them: Segment + MixPanel

Here at Tryolabs we’re used to work in different kinds of projects, generally involving Python backends, and Javascript frontends. Some of the projects are applications for private or internal usage, and others are for public usage (i.e for the everyday person). What all of those projects’ applications have in common is that they all have a user base. Therefore, it’s natural for our clients to want to know as much as possible about that user base, whether for improving their business, or just out of curiosity.

The problem at hand

Once having noticed this common need/requirement we can better define the problem at hand in a more concrete way.

Given an application, we want to:

  • Know who its users are.
  • Know what those users are doing.
  • Improve the application based on available information.

Hence, we, as developers (and/or maintainers) of these applications need to (in an agile manner and according to our work methodology) be able to track “user actions” quickly and in a way that adapts our projects’ spectrum.

Regarding this, we also need to allow our clients to visualize or somehow interpret these actions, and to get the insight or value they need from them.

After discussing with fellow co-workers and some online researching, and so as not to reinvent the wheel, we came to the conclusion that Segment was the tool for the job.

Custom reports: Segment + Mixpanel

Segment

What it is

Segment is a platform that allows developers to track fully customizable actions (on server and client side), automatically associating relevant information for each one, such as timestamps, IP address, identification of the (possibly anonymous) user who triggered the event, device of origin and user defined information.

Segment then gathers this information into a hub, and allows you to send the data virtually anywhere, literally with the flip of a switch.

In the Segment terminology, the actions are called Events, and the relevant information are called Properties.

→ Key aspects

Easy to integrate

Segment’s library has three main methods which help us tackle two of the three parts of our problem. The Identify method allows us to determine if a customer is new or not, as

  1. Putting the Segment snippet into the site or app.
  2. Tracking customer data, such “click on submit button” or “focus out form” events using one of the Segment libraries.
  3. Turn on integrations to forward data to any of all the third party tools available (there’re A LOT of them).

Customer data

With segment we can attack two of the tree parts of our problem. The Segment library’s Identify method allows us to tell if a customer is new or not, and to tie him/her to the actions they make. That is, we can know who our users are.

The Track and Page methods allow us to send to “the hub” our super customized events, and to know what page of our site they were in when they triggered those events. That is, we can know what those users are doing.

We’ll discuss the third part of our problem down below.

Multiple libraries (server side and client side browser and mobile)

Segment provides libraries for a wide variety of languages, allowing to record events on the server side, the front end, and on mobile applications

What differentiates it from Google Analytics?

As Peter Reindhart’s CEO has stated, Segment’s mission is to make it easy for the user (us in this case) to have control over his data. Segment does so by allowing the user the flexibility to define the (already mentioned) extremely customized events and gather them all in their “hub”.

Also, Segment allows to send these events to a wide variety of external services, Google Analytics included, which is focused (as its name indicates) on analytics, doing an excellent job at it.

What’s left is the third part of our problem, that is improve the application based on available information, and that’s where MixPanel comes in.

MixPanel

MixPanel is one of the many many integrations available of Segment, and although it’s a very powerful tool and can be used standalone, we’ve found they work really well together.

It takes care of interpreting the raw data captured by segment, interprets it and and allows us, and most importantly non-technical users, to visualize and query the data.

If we register at MixPanel, set up a Project, and input the Project’s API KEY and TOKEN into Segment, we’ve already hooked them together. That way, all the Segment events we’ve defined will be forwarded automatically to MixPanel.

→ Key aspects

Engagement

The MixPanel interface has different ways to visualize the received Events. The main one is the Segmentation panel, where you can see the volume of Events (top 12 by default) per unit of time (hour/day/week). Of course, you can filter the graph and see only the volume of the Events you’re interested in.

Another way to visualize Events is the Live View panel, which consists of a live feed of the incoming events, showing for each one the city and country the user who triggered the event is in (this is an example of how MixPanel interprets the raw data (IP Address) captured originally by Segment), browser, and referring domain, among others.

In both these panels, and others available, you can also and in a very easy way, query the data. That is basically, filtering results by imposing restrictions to the desired Event’s properties, in a really approachable way for non-technical users.

Funnels

Funnels are a great MixPanel feature for measuring engagement. A funnel is an ordered list of Events, which need to be chosen carefully in order for the funnel to make sense. For example, if you have a form where the user needs to fill personal data, and then click a submit button, you can set up the following funnel:

Filled Field A, Filled Field B, …, Filled Field N, Click on Submit Button.

Having done that, you can see what percentage of the users, reach every step of the “life cycle” of the form.

This is, in my opinion, one of the most valuable features MixPanel provides, since it directly tackles the third part of the problem at hand: Improve the application based on available information.

Funnel’s example in Mixpanel

People

On MixPanel you can keep track of your users and the Events they trigger. You can also query users by their activity, and by their Events’ properties. For example, “Show all the female users older than 35 years that triggered a certain event at least a certain amount of times”.

Then you can for example send a customized email or notification automatically, based on a predefined query.

Wrapping up (TL;DR)

Segment is a great tool for developers/maintainers (us) of applications to integrate to projects since it provides libraries in multiple programming languages for backend, frontend and mobile. It is as easily integrable as it can be, fitting perfectly with companies working in an agile manner, and it provides al incredible wide spectrum of destinations where to send your data (virtually assuring that one of them will work for our clients).

MixPanel can receive all the data from segment, interpret it and help non-technical users visualize it, gain insight on their product and user base, and ultimately improve their product.

In our experience, both tools are awesome and altogether solve the problem of tracking user actions and making sense of them.

They both offer a whole of a lot more than what I exposed here, so check out their documentations and try them for yourselves!


Comments powered by Disqus

Deep Learning, Computer Vision, NLP, Python, Infrastructure & more.

Signup to our newsletter.

No spam, ever. We'll never share your email address and you can opt out at any time.

Contact us

Have a project for us?
Let's talk!

Subscribe to receive news and blog updates.