Segment & Mixpanel Analytics Stack

The analytics stack every startup should implement on day one

As a business consultant I get to meet many startups. Some are just starting out while others are mature businesses with dozens of employees. More often than not these startups have poorly implemented data infrastructure, if they have infrastructure at all.

I get it… analytics is not top of mind for most startups. Getting to product-market fit, driving enough traffic to your site and hiring your founding team are pressing matters. The reason I’m so bullish on starting early with building a professional data infrastructure is for the simple fact that the more data you have, the more answers you have. The more answers you have the faster you can move. Early business intelligence becomes a force multiplier that will result in massive savings in both time and money in the long run.

In this post I’ll guide you through setting up a professional analytics stack that is not only much simpler to setup than you think, but that costs nothing more than a day or two of dev resources.

What are our goals on day one?

Before we can discuss the actual tools and implementation we need to decide together on our analytics goals on day one. This is tough without painting a picture of an early stage startup so lets do that.

Let’s call the startup Travel Ninja and assume it’s a service that helps travelers plan their trips. The magic moment is when the user views his or her itinerary within the site.

I’m going to assume you just launched an alpha version of your web app. This is a super basic version that you are exposing to friends, family and your “early access” email list.

Since the startups main goal is to get to product-market fit we need to define certain criteria that will help us determine if we are onto something.

Just off the top of my head we’ll want to be able to answer the following questions:

  • How many people are visiting our site? – This helps us understand if we are managing to get enough potential users to the site.
  • How are they finding us? – Helps identify which marketing channels are bringing us these potential users.
  • Of those that visited the site, how many signed up? – Are we able to signup potential visitors to our site?
  • Of those that signed up, how many finished the onboarding process? – Is our signup flow clear and bug free?
  • Of those that finished the onboarding process, how many experienced our “magic moment”? – Is the user-experience clear and attractive? Are we able to get users to that magic moment?
  • How many of our users are engaging with our service over and over again? – What does our retention look like? Did we provide enough value to bring users back to the service?

Notice that the order of the questions above make a nice funnel:

Does your signup flow look something like this?

The trick is being able to fill in the question marks with conversion rates. If at any point in the funnel we see a major drop then we know where to focus. Once the startup sees high re-engagement rates then it’s a sign that the service provides enough value for users to come back and use the service again.

If we can answer all the questions above we have enough information to determine if a) we have enough data to actually make proper decisions, and b) if we are moving towards product-market fit, or have issues with our funnel.

The Segment + Mixpanel stack

Our hypothetical startup is going to implement the Segment + Mixpanel analytics stack. Both of these services have free tiers so the only costs involved are R&D hours. Setting up this stack will take anywhere from 2 – 10 hours of R&D time (depending on your backend setup and the quality of your developers). This is a small price to pay to be able to answer mission critical questions.

Our plan is to write up a set of events which we will send to Segment and then pass to Mixpanel. We can then run reports in Mixpanel to answer the questions that we listed above.

What is Segment?

Segment is one of my favorite analytics tools. It is an incredible product with two main goals; to simplify the collecting of event-based data, and to move the dependency from R&D to product and marketing. Segment acts as a hub where you send your event data. Segment then passes that data to different tools automatically. Sending your events to a new service is as simple as flipping a switch.

I’m planning a dedicated post on the benefits of Segment but for now I recommend you visit Segment.com and browse around their site before opening up your account.

What is Mixpanel?

Mixpanel is a service which provides reporting on event data. Mixpanel is one of the more popular services in the web and app analytics space and provides a ton of value from funnel analysis, to more sophisticated retention reporting along with machine learning.

I’m also planning a dedicated post on Mixpanel but until then visit Mixpanel.com and see for yourself what the service has to offer.

Why do we need Segment, can’t we just push the events straight to Mixpanel?

This is a great and valid question. The reason I recommend implementing Segment as early as possible is because you don’t want to go down the route of having to implement numerous APIs into your backend. Once Segment is in place you can connect it to hundreds of different services which you’d otherwise have to implement into your backend separately.

Implementing Segment will allow your marketing and product teams to adopt new and better tools in minutes instead of needing R&D to write a ton of code to implement new APIs.

Since Segment has a free tier which supports 1,000 MTUs (monthly tracked users) it can be implemented on day one for free.

The tracking plan

The next step is to write up our tracking plan so that we can forward our requirements to R&D. I’m going to assume that the website has one big signup button on the homepage and then a 2-step signup process. The first step is to collect basic information like name, email, password while the second screen is to capture more specific information like gender, status of next trip, and how they found the service.

Below is a list of the events we will need to track in order to build our funnel and cohort reports in Mixpanel. I purposefully added all the events and properties I personally would want to see but you can start with a simpler list. The more properties you add the more time it will take for R&D to implement.

  • Visited the site
    • Event type = page
    • Event name = Travel Ninja
    • Event properties
      • url (Segment provides this out of the box)
      • path (Segment provides this out of the box)
      • referrer (Segment provides this out of the box)
      • title (Segment provides this out of the box)
      • pageCategory = Home / Signup / Support / Product Overview / etc
    • Trigger = Whenever a page loads on the public site
  • Clicked on the signup button
    • Event type = track
    • Event name = Clicked Element
    • Event properties
      • elementCategory = CTA
      • elementText = Sign Up Now
      • elementType = Button
      • elementLocation = Header
    • Trigger = Whenever the signup button on the homepage is clicked
  • Signed Up
    • Event type = track
    • Event name = Signed Up
    • Event properties
      • userId = 123
      • firstName = John
      • lastName = Doe
      • email = john@doe.com
    • Trigger = Sent once a user successfully completes step 1 in the signup process.
  • Onboarding Completed
    • Event type = track
    • Event name = Onboarding Completed
    • Event properties
      • userId = 123
      • firstName = John
      • lastName = Doe
      • email = john@doe.com
      • gender = M
      • signupTripStatus = Destination Chosen
      • discoveredTravelNinjaVia = Friend
    • Trigger = Sent once per userId. Sent once the user has successfully submitted all the required information for the user to get past the second signup screen.
  • Visited the user admin (the site behind the login)
    • Event type = page
    • Event name = Admin
    • Event properties
      • url (Segment provides this out of the box)
      • path (Segment provides this out of the box)
      • referrer (Segment provides this out of the box)
      • title (Segment provides this out of the box)
      • userId = 123
      • firstName = John
      • lastName = Doe
      • email = john@doe.com
      • gender = M
      • signupTripStatus = Destination Chosen
      • discoveredServiceVia = Friend
      • pageCategory = Dashboard / Trip Planning / Trip Editing / Settings / Billing / etc
    • Trigger = Whenever a page loads on within the user admin (the actual tool behind a login)
  • Trip Created
    • Event type = track
    • Event name = Trip Created
    • Event properties
      • userId = 123
      • firstName = John
      • lastName = Doe
      • email = john@doe.com
      • gender = M
      • signupTripStatus = Destination Chosen
      • discoveredServiceVia = Friend
      • tripId = 323
      • tripCount = 1 (indicates the number of itineraries the user has created)
      • tripDestinationCity = Bangkok
      • tripDestinationCountry = Thailand
      • tripLengthInDays = 14
    • Trigger = Sent every time a user successfully creates a trip within the service.
  • Item Added To Trip
    • Event type = track
    • Event name = Item Added To Trip
    • Event properties
      • userId = 123
      • firstName = John
      • lastName = Doe
      • email = john@doe.com
      • gender = M
      • signupTripStatus = Destination Chosen
      • discoveredServiceVia = Friend
      • tripId = 323
      • tripCount = 1 (indicates the number of trips the user has created)
      • tripDestinationCity = Bangkok
      • tripDestinationCountry = Thailand
      • tripLengthInDays = 14
      • itemId = 545
      • itemCategory = Flight
      • itemType = Long-distance Flight
      • itemName = Flight To Bangkok
      • itemCount = 5 (indicates the number of items the user has created)
      • itemTripCount = 1 (indicates the number of items the user has created in the specific trip)
    • Trigger = Sent every time a user adds a new item to a trip.

Bringing it all together

Once R&D are done implementing Segment, and our events are being passed to Mixpanel we can build a funnel report similar to the one shown below.

Signup Flow Using Segment Events

We can learn a ton of useful things from this funnel that will help guide the product and R&D teams moving forward. Instead of going with their gut, Trip Ninja now has visibility into its’ core product funnel and can identify where users are getting stuck.

Let’s have a look at how we would answer the questions we listed in the beginning of this post.

  • How many people are visiting our site?
    • Report Type: Segmentation Report
    • Event: Viewed Trip Ninja Page
    • By: pageCategory = Home
    • Is that it? = No, you will need to change from “Total” to “Unique” in the report to get the unique number of individuals that visited within the set period.
  • How are they finding us?
    • Report Type: Segmentation Report
    • Event: Viewed Trip Ninja Page
    • By: pageCategory = Home AND referrer
    • Is that it? = No, you will need to change from “Total” to “Unique” in the report to get the unique number of individuals that visited within the set period.
  • Of those that visited the site, how many signed up?
    • Report Type: Funnel Report
    • Event #1: Viewed Trip Ninja Page (with filter set, pageCategory = Home)
    • Event #2: Signed Up
    • Is that it? = Consider setting the time constraint between the two steps to 1 hour. This will improve the accuracy of the report.
  • Of those that signed up, how many finished the onboarding process?
    • Report Type: Funnel Report
    • Event #1: Signed Up
    • Event #2: Onboarding Completed
    • Is that it? = Consider setting the time constraint between the two steps to 1 hour. This will improve the accuracy of the report.
  • Of those that finished the onboarding process, how many experienced our “magic moment”?
    • Report Type: Funnel Report
    • Event #1: Onboarding Completed
    • Event #2: Viewed Admin (with filter set, url contains timeline)
    • Is that it? = Yes
  • How many of our users are engaging with our service over and over again?
    • Report Type: Retention Report
    • Retention Report Type: Depends on what you want to analyze, I’d recommend using the “Recurring” type to see % of users use the service for 2 or more of their trips.
    • Event: Trip Created
    • Is that it? = It really depends on what you want to analyze but the retention reports are quite straight forward in Mixpanel.

I hope you enjoyed this post and if you have any questions on getting the Segment + Mixpanel stack set up then please comment below.

  • Kishen Sreehari

    Great article Justin

  • Grigoriy Kogan

    What about identifying users?

    • Justin Butlion

      Hey Grigoriy, I'm not sure I understand what you mean exactly. Could you explain? Mixpanel and Segment use cookie based identification so you can track a specific user's journey and usage out of the box.

      • Grigoriy Kogan

        Both Segment and Mixpanel support user profiles. Once a visitor's identity is known (from a signup, then from subsequent logins), it's best to tie all their activities to that identity (user profile) instead of relying on cookies. See: https://segment.com/docs/guides/best-practices/what-are-best-practices-for-identifying-users/ And: https://segment.com/docs/destinations/mixpanel/#identify This is a very incomplete guide if it doesn't address identifying users.

        • Justin Butlion

          That's a good point Grigoriy, I'll update the post to include a section that explains what you mentioned. I guess my mistake was assuming readers would understand that Mixpanel and Segment work by automatically grouping activity by unique ids. Thanks for your comments.

  • Maic

    Hey Justin, great post indeed. However, I wonder what you think about Segment + Amplitude as alternative to Segment + Mixpanel. Thank you.

    • Justin Butlion

      I'm honestly not familiar with Amplitude. I've heard good things about it but never used it myself. I've got a few years of experience with Mixpanel and they have been around for awhile now. Do you use Amplitude? How does it compare to Mixpanel?

      • Maic

        I very much enjoy how much simpler Amplitude is it to use compared to Mixpanel. Also, apparently it is much cheaper at scale.

        • Justin Butlion

          I'll look into it and do a comparison post in the future. Thanks for your comments.

  • Pedro Silva

    It's helped me a lot, Justin. Thank you! Do you know if can we do the reverse path and see which channel brought us more engaged users?

    • Justin Butlion

      Hey Pedro, Yes, that is possible as long as "engaged" is defined within a user property. Feel free to email me at justin@projectbi.net if you need more help. Thanks for the comment.