rmixpanel

R клиент для работы с API Mixpanel (Загрузка данных из Mixpanel в R)


Project maintained by selesnow Hosted on GitHub Pages — Theme by mattgraham

Menu:


Search:


Выберите язык описания пакета | Chose language of package description

English
Русский

Contents of rmixpanel read me.

Description of rmixpanel

rmixpanel is the R client for Mixpanel API, use this tool if you need load data from Mixpanel API into R.

For convenience of searching functions of rmixpanel, each function have prefix “MP.”.

You can get detailed help about each of package function by help command, for example if you need help about MP.getRawData function you can run help("MP.getRawData").

In order to get list of all available rmixpanel fuction use help(package = "rmixpanel").

Install rmixpanel

You can instal rmixpanel from GitHub repository, for this run next code in R console.

if(!"rmixpanel" %in% installed.packages()[,1]){install.packages("devtools")}
devtools::install_github("selesnow/rmixpanel")

How get api_secret для работы с API mixpanel

You can be found your api secret by clicking on your name in the upper righthand corner under Project Settings.

API Secret is a require argument of each rmixpanel functions.

  1. Sing in mixpanel using your login and password.
  2. Chose “Accounts” in main menu.
  3. Go to tab “Projects”, and copy API Secret of your project.

rmixpanel functions

NameDescription
MP.getEventsGet unique, total, or average data for a set of events over N days, weeks, or months.
MP.getEventsPropertyGet unique, total, or average data for of a single event and property over days, weeks, or months.
MP.getRetentionGet cohort analysis.
MP.getRawDataGet a "raw dump" of tracked events over a time period.

MP.getEvents - Get unique, total, or average data for a set of events over N days, weeks, or months.

Arguments

Example

Get total number of event “posting_success”,”emu”,”session_start”,”$custom_event:585946” from 1 june of 2017 till 25 july of 2017, with group by day.

MP_events_day <- MP.getEvents(api_secret = "hgf7fi437nhdsad7863y98ryn988h8",
                              event = c("posting_success","emu","session_start","$custom_event:585946"),
                              type = "general",
                              unit = "day",
                              from_date = "2017-07-01",
                              to_date = "2017-07-25")

Get average events number of event “session_start” and “$custom_event:585946” in the last two weeks, with group by month.

MP_events_month <- MP.getEvents(api_secret = "hgf7fi437nhdsad7863y98ryn988h8",
                                event = c("session_start","$custom_event:585946"),
                                interval = 2,
                                type = "average",
                                unit = "month")

MP.getEventsProperty - Get unique, total, or average data for of a single event and property over days, weeks, or months.

Arguments

Example

Get total umber of event “$custom_event:585946” from 1 june of 2017 till 25 july of 2017, with group by day and property mp_country_code.

MP_event_prop <- MP.getEventsProperty(api_secret = "hgf7fi437nhdsad7863y98ryn988h8",
                                      event = c("$custom_event:585946"),
                                      property = "mp_country_code",
                                      type = "general",
                                      unit = "day",
                                      from_date = "2017-07-01",
                                      to_date = "2017-07-25")

Get total umber of event “$custom_event:585946” in current and previous month, with group by month and property mp_country_code.

MP_event_prop_month <- MP.getEventsProperty(api_secret = "hgf7fi437nhdsad7863y98ryn988h8",
                                            event = c("$custom_event:585946"),
                                            property = "mp_country_code",
                                            type = "general",
                                            interval = 2,
                                            unit = "month")

MP.getRetention - Get cohort analysis.

Arguments

Example

Get cohort analisys by event “$custom_event:585946” from 1 june of 2017 till 25 july of 2017, with week steps

retension <- MP.getRetention(api_secret = "hgf7fi437nhdsad7863y98ryn988h8",
                             event = "emu",
                             retention_type = "birth",
                             unit = "week",
                             born_event = "session_start",
                             where = 'properties["utm_source"]=="AdWords" and "Brand" in properties["utm_campaign"]',
                             interval_count = 4,
                             from_date = "2017-08-01",
                             to_date = "2017-09-25")

Get cohort analisys by week, in last four weeks from 1 august of 2017, and segmentation cohort by propery utm_source.

retension_property <- MP.getRetention(api_secret = "hgf7fi437nhdsad7863y98ryn988h8",
                                      event = "emu",
                                      retention_type = "birth",
                                      unit = "week",
                                      born_event = "session_start",
                                      on = 'properties["utm_source"]',
                                      interval_count = 4,
                                      from_date = "2017-08-01",
                                      to_date = "2017-09-25")

MP.getRawData - Get a “raw dump” of tracked events over a time period..

Work duration of this function is too long and use him only if you can’t get data using another functions.

Example usage cases

Arguments

Example

Get all events emu with all his properties from 10 july 2017 года, only by utm_source is AdWords, and campaign name constain “Brand”.

MixPanel.RawData <- MP.getRawData(api_secret = "hgf7fi437nhdsad7863y98ryn988h8",
                                  event = "emu",
                                  where = 'properties["utm_source"]=="AdWords" and "Brand" in properties["utm_campaign"]',
                                  from_date = "2017-07-10",
                                  to_date = "2017-07-10")

Get all events with all properties from 1 september 2017 till 10 september 2017.

MixPanel.RawData <- MP.getRawData(api_secret = "hgf7fi437nhdsad7863y98ryn988h8",
                                  from_date = "2017-09-01",
                                  to_date = "2017-09-10")

Автор пакета: Алексей Селезнёв, Head of Analytics Dept. at Netpeak

Контакты
email: selesnow@gmail.com
skype: selesnow
telegram: @AlexeySeleznev
Facebook Vkontakte Linkedin Blog GitHub Stepic