By Rudderstack Team

How to load data from Mixpanel to Snowflake

This post helps you with loading your data from Mixpanel to Snowflake. Suppose you are looking to get analytics-ready data without the manual hassle. In that case, you can integrate Mixpanel to Snowflake with RudderStack, so you can focus on what matters, getting value out of your data.

Extract Mixpanel Data

Mixpanel is an analytics-as-a-service application, so naturally, it requires data to offer its analytics features. We usually think of it as a consumer of data and not a place where we would get data to perform analysis. But Mixpanel collects a lot 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 coming from other sources, you have two choices.

The first one is to enrich data coming from Mixpanel with data coming from other sources. The second one is to extract any data Mixpanel holds for you and load it on a data warehousing repository for further analysis. This post will consider the second case.

Mixpanel is evolving into a platform where apart from the analytics services that it offers, you will also be able to build integrated applications. In this post, we will work only with the Export API to export our data stored in 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. Some options are the following:

  • Apache HttpClient for Java
  • Spray-client for Scala
  • Hyper for Rust
  • Ruby rest-client
  • Python http-client

Or you can use the libraries/SDKs that Mixpanel offers for the following languages:

  • Python
  • PHP
  • Ruby
  • Javascript

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 period of time

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 period of time

Event Properties

  • properties– get total, unique, or average data by 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 time period
  • 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 People Analytics data

Let’s assume that we want to export our raw data coming from Mixpanel. To do so we’ll need to execute requests to the export endpoint. An example of a request that would get us back raw events from Mixpanel looks like this:

https://data.mixpanel.com/api/2.0/export/?from_date=2012-02-14&expire