By Rudderstack Team

How to load data from Mixpanel to SQL Data Warehouse

Let’s suppose you decide you want to analyze the data you have on Mixpanel and do that on SQL Data Warehouse. This guide helps you define a pipeline for getting your data from Mixpanel and load it into SQL Data Warehouse for further analysis. Alternatively, you can use products like RudderStack that can handle this kind of problem automatically for you.

Information will be given on how to access and extract your data from Mixpanel through its API and how to load it into SQL Data Warehouse. This process requires you to write the code to get the data and make sure that this process will run every time new data is generated.

About Microsoft Azure SQL Data Warehouse

SQL Data Warehouse is the data warehousing solution you can use if you are a Microsoft Azure user. It’s an elastic data warehousing as a service solution, emphasizing its enterprise focus. It also speaks SQL like the previous two solutions, and it supports querying both relational and non-relational data. It offers a number of enterprise-class features like support for hybrid cloud installations and strong security. It’s probably the less mature solution than the two others though, it’s still in Preview mode although accessible to existing Azure subscribers.

About Mixpanel

Mixpanel helps businesses grow by understanding how their users behave and use their products by tracking actions people take rather than page views. Mixpanel’s mission is to help the world learn from its data. It helps you to make your product better by measuring actions instead of page views. Mixpanel allows you to easily measure what people are doing in your app on iOS, Android, and the web.

Extract data from Mixpanel

Mixpanel is an analytics-as-a-service application, so it requires data to offer its analytics features. Mixpanel collects huge amounts of data related to how your customers use your product, and in the case where you would like to do anything that also involves data from other sources you really have two choices. The first one is to enrich the data of Mixpanel with data coming from other sources and the second one is to extract the data Mixpanel holds for you and load it on a data warehousing repository for further analysis. This post will consider the second case.

Along with the analytics services, Mixpanel also enables you to build applications integrated with it. In this post, we will work only with the Export API to export our data from Mixpanel.

As a web API, you can access it using tools like CURL or Postman or your favorite HTTP client for the language or framework of your choice. You can choose from the options given below:

You can also use the libraries/SDKs that Mixpanel offers for the following languages:

As a RESTful API, it offers the following resources that you can interact with:

Annotations

  • annotations– list the annotations for a specified date range.
  • create– create an annotation
  • update– update an annotation
  • delete– delete an annotation

Export

  • export– get a “raw dump” of tracked events over a time period

Events

  • events– get total, unique, or average data for a set of events over a time period
  • top– get the top events from the last day
  • names– get the top event names for a time period

Event Properties

  • properties– get total, unique, or average data from a single event property
  • top– get the top properties for an event
  • values– get the top values for a single event property

Funnels

  • funnels– get data for a set of funnels over a time period
  • list– get a list of the names of all the funnels

Segmentation

  • segmentation– get data for an event, segmented and filtered by properties over a time period
  • numeric– get numeric data, divided up into buckets for an event segmented and filtered by properties over a period of time
  • sum– get the sum of a segment’s values per time unit
  • average– get the average of a segment’s values per time unit
  • Segmentation Expressions– a detailed overview of what a segmentation expression consists of

Retention

  • retention– get data about how often people are coming back (cohort analysis)
  • addiction– get data about how frequently people are performing events

People Analytics

  • engage– get data from People Analytics

Let’s assume we want to export our raw data from Mixpanel. To do so, we’ll need to execute requests to the export endpoint. An example request to get raw events from Mixpanel is as follows: