Title: | API for Mixpanel |
---|---|
Description: | Provides an interface to many endpoints of Mixpanel's Data Export, Engage and JQL API. The R functions allow for event and profile data export as well as for segmentation, retention, funnel and addiction analysis. Results are always parsed into convenient R objects. Furthermore it is possible to load and update profiles. |
Authors: | Meinhard Ploner [aut, cre, cph], ProSiebenSat.1 Digital GmbH [cph], BCG Digital Ventures GmbH [cph] |
Maintainer: | Meinhard Ploner <[email protected]> |
License: | MIT + file LICENSE |
Version: | 0.7-1 |
Built: | 2025-02-15 04:54:34 UTC |
Source: | https://github.com/ploner/rmixpanel |
Provides an interface to many endpoints of Mixpanel's Data Export, Engage and JQL API. The R functions allow for event and profile data export as well as for segmentation, retention, funnel and addiction analysis. Results are always parsed into convenient R objects. Furthermore it is possible to load and update profiles.
The DESCRIPTION file:
Package: | RMixpanel |
Version: | 0.7-1 |
Date: | 2018-10-23 |
Title: | API for Mixpanel |
Authors@R: | c( person("Meinhard", "Ploner", role=c("aut", "cre", "cph"), email="[email protected]"), person("ProSiebenSat.1 Digital GmbH", role="cph"), person("BCG Digital Ventures GmbH", role="cph") ) |
Depends: | R (>= 3.2.0) |
Description: | Provides an interface to many endpoints of Mixpanel's Data Export, Engage and JQL API. The R functions allow for event and profile data export as well as for segmentation, retention, funnel and addiction analysis. Results are always parsed into convenient R objects. Furthermore it is possible to load and update profiles. |
Imports: | jsonlite, uuid, RCurl, base64enc |
License: | MIT + file LICENSE |
URL: | https://github.com/ploner/RMixpanel, http://www.mixpanel.com |
Config/pak/sysreqs: | make |
Repository: | https://ploner.r-universe.dev |
RemoteUrl: | https://github.com/ploner/rmixpanel |
RemoteRef: | HEAD |
RemoteSha: | e10cdc6298a65e5eaea7783b603b9a0e13f9faab |
Author: | Meinhard Ploner [aut, cre, cph], ProSiebenSat.1 Digital GmbH [cph], BCG Digital Ventures GmbH [cph] |
Maintainer: | Meinhard Ploner <[email protected]> |
Index of help topics:
RMixpanel-package API for Mixpanel createDateSequence Generate And Normalize Sequence Of Dates. eventsJson2RMatrix Convert Events Exported From Mixpanel API To R Matrix merge.matrix Merge Two Matrices mixpanelCreateAccount Create Mixpanel Account mixpanelGetAddiction Addiction Report mixpanelGetData General Method For Mixpanel API Requests mixpanelGetEvents Get Events From Mixpanel API mixpanelGetEventsForProfiles Get Events For Specified Profiles mixpanelGetEventsFromFiles Get Events From Files mixpanelGetFunnel Funnel mixpanelGetFunnelList Funnel List mixpanelGetProfiles Get Profiles From Mixpanel API mixpanelGetProfilesCount Get Profiles Count From Mixpanel API mixpanelGetRetention Retention Report mixpanelGetSegmentation Segmentation Report mixpanelJQLQuery Query the Mixpanel JQL API mixpanelUpdateProfile Update Mixpanel Profile plot.retention Plot Retention Rates print.retention Print Retention Matrix profilesJson2RMatrix Convert Profiles Exported From Mixpanel API To R Matrix.
The package provides access to the Mixpanel API. It allows to read raw data as well as to retrieve retention, addiction and segmentation data. Furthermore it is possible to load and update profiles.
Meinhard Ploner [aut, cre, cph], ProSiebenSat.1 Digital GmbH [cph], BCG Digital Ventures GmbH [cph] Maintainer: Meinhard Ploner <[email protected]>
https://mixpanel.com/help/reference/data-export-api
Generate a range of dates and normalize it. Used by other methods of this package.
createDateSequence(from, to=from)
createDateSequence(from, to=from)
from |
Start date in either format <"yyyy-mm-dd"> or <yyyymmdd>. Inclusive. |
to |
End date in either format <"yyyy-mm-dd"> or <yyyymmdd>. Inclusive. |
Array of daily dates in format yyyy-mm-dd as needed for use in Mixpanel's API.'
Meinhard Ploner
https://mixpanel.com/help/reference/data-export-api
Convenience method to convert from pseudo json of Mixpanel's export API to R matrix holding events.
eventsJson2RMatrix(jsonData, select = TRUE)
eventsJson2RMatrix(jsonData, select = TRUE)
jsonData |
Result of request to Mixpanel's Export API. |
select |
If |
Ths helper function takes a json result as of the Mixpanel Export API and creates an R matrix holding the data. Array event properties are collapsed using a dash ('-') as separator.
A character matrix showing one event per line. The first column represents the name of the event, the other column the event properties.
Meinhard Ploner
Merge two matrices by common column names. Resulting matrix includes all data. Empty cells are filled with NA's.
## S3 method for class 'matrix' merge(x, y, ...)
## S3 method for class 'matrix' merge(x, y, ...)
x |
First matrix to be merged. |
y |
Second matrix to be merged. |
... |
Not used. |
A matrix resulting from a join of the 2 matrices.
Meinhard Ploner
Create object holding meta data of a Mixpanel project.
mixpanelCreateAccount(name, token, key, secret, customEvents, mongoDBname, dataPath, RDataPath)
mixpanelCreateAccount(name, token, key, secret, customEvents, mongoDBname, dataPath, RDataPath)
name |
Can be arbitrary. |
token |
API token of Mixpanel project. |
key |
API key of Mixpanel project. |
secret |
API secret of Mixpanel project. |
customEvents |
If you have custom events, add a |
mongoDBname |
Optional. Name of data base for usage in mongoDB. Used in future versions of the package. |
dataPath |
Optional. Path to store raw data of events and people. |
RDataPath |
Optional. Path to store R rda files. |
An object holding all the values specified as parameters.
Meinhard Ploner
mixpanelGetEvents
,
mixpanelGetProfiles
,
mixpanelGetSegmentation
,
mixpanelGetRetention
Get matrix of addiction data from Mixpanel API.
mixpanelGetAddiction(account, event, from, to, unit, percentages, addictionUnit, ...)
mixpanelGetAddiction(account, event, from, to, unit, percentages, addictionUnit, ...)
account |
A mixpanel account, as created by |
event |
Event name. If empty, all events are returned. |
from |
Start date in either format <"yyyy-mm-dd"> or <yyyymmdd>. Inclusive. |
to |
End date in either format <"yyyy-mm-dd"> or <yyyymmdd>. Inclusive. |
unit |
Defaults to 'day'. |
percentages |
Output as counts or percentages? |
addictionUnit |
Sub time unit for addiction calculation. |
... |
Additional arguments to Mixpanel API. |
Matrix consisting of one row for each cohort. The first column holds the cohort sizes, the following columns the number of profiles having tracked events within the specified time interval.
Meinhard Ploner
https://mixpanel.com/help/reference/data-export-api#retention
This method handles the authentication and download of data from the Mixpanel API as well as data persistance. The method is used by many of the more specialized methods of this package.
mixpanelGetData(account, method="export/", args, validitySeconds=60, verbose=TRUE, fileName="", data=FALSE, retryCount=0, encoding="UTF-8")
mixpanelGetData(account, method="export/", args, validitySeconds=60, verbose=TRUE, fileName="", data=FALSE, retryCount=0, encoding="UTF-8")
account |
A mixpanel account, as defined in |
method |
API method (route). |
args |
Arguments as described in https://mixpanel.com/help/reference/data-export-api. |
validitySeconds |
Expiration of API request. |
verbose |
If |
fileName |
File name to persist data (defaults to './temp.txt'). If supplied, account$dataPath is used as path. |
data |
If |
retryCount |
How many times a failed request should be retried? |
encoding |
JSON Encoding. Default is UTF8. |
If data==TRUE
, the method returns the response of the API request (raw character vector). Otherwise nothing is returned.
Meinhard Ploner
https://mixpanel.com/help/reference/data-export-api
## Not run: ## Fill in here the API token, key and secret as found on ## www.mixpanel.com - Account -> Projects. account = mixpanelCreateAccount("ProjectName", token="c12g3...", secret="168e7e...", key="543c55...") mixpanelGetData(account, method="funnels/list/", args=list(), data=TRUE) ## End(Not run)
## Not run: ## Fill in here the API token, key and secret as found on ## www.mixpanel.com - Account -> Projects. account = mixpanelCreateAccount("ProjectName", token="c12g3...", secret="168e7e...", key="543c55...") mixpanelGetData(account, method="funnels/list/", args=list(), data=TRUE) ## End(Not run)
Get a matrix filled with event data from the Mixpanel API.
mixpanelGetEvents(account, event, from, to = from, daysPerBlock = 10, select = TRUE, verbose = TRUE, df = FALSE, encoding="UTF-8", ...)
mixpanelGetEvents(account, event, from, to = from, daysPerBlock = 10, select = TRUE, verbose = TRUE, df = FALSE, encoding="UTF-8", ...)
account |
A mixpanel account, as defined in |
event |
Array of event names. If empty, all events are returned. |
from |
Start date in either format <"yyyy-mm-dd"> or <yyyymmdd>. Inclusive. |
to |
End date in either format <"yyyy-mm-dd"> or <yyyymmdd>. Inclusive. |
daysPerBlock |
Data is downloaded in blocks of fixed size. |
select |
If |
verbose |
If |
df |
Clean data and return |
encoding |
JSON Encoding. Default is UTF8. |
... |
Additional arguments to be included in the Mixpanel API request. E.g. where = "properties[\"$os\"]==\"iPhone OS\""). See also https://mixpanel.com/help/reference/data-export-api#events. |
A character matrix showing one event per line. The first column represents the name of the event, the other column the event properties.
Meinhard Ploner
mixpanelGetProfiles
,
mixpanelGetEventsForProfiles
Get a matrix filled with event data for specified people profiles.
mixpanelGetEventsForProfiles(account, distinctIDs, from, to, verbose, encoding="UTF-8", ...)
mixpanelGetEventsForProfiles(account, distinctIDs, from, to, verbose, encoding="UTF-8", ...)
account |
A mixpanel account, as defined in |
distinctIDs |
Array of profile IDs. |
from |
Date in format yyyy-mm-dd, where month number starts with 0. |
to |
Date in format yyyy-mm-dd, where month number starts with 0. |
verbose |
Parameter passed to |
encoding |
JSON Encoding. Default is UTF8. |
... |
List of additional arguments being included in the Mixpanel API request. E.g. limit=5, ... |
A character matrix showing one event per line. The first column represents the name of the event, the other column the event properties.
Meinhard Ploner
mixpanelGetProfiles
,
mixpanelGetEvents
Get an R matrix filled with event data using data saved into files.
mixpanelGetEventsFromFiles(account, from, to, eventNames=c(), select=TRUE, blocksize=500000, df = FALSE, verbose=TRUE)
mixpanelGetEventsFromFiles(account, from, to, eventNames=c(), select=TRUE, blocksize=500000, df = FALSE, verbose=TRUE)
account |
A mixpanel account, as defined in |
from |
Start date in either format <"yyyy-mm-dd"> or <yyyymmdd>. Inclusive. |
to |
End date in either format <"yyyy-mm-dd"> or <yyyymmdd>. Inclusive. |
eventNames |
If an array of event names, only these are returned by the method. |
select |
If |
blocksize |
Block size for reading files from disk. |
df |
Clean data and return |
verbose |
If |
A character matrix showing one event per line. The first column represents the name of the event, the other column the event properties.
Meinhard Ploner
Get funnel data from Mixpanel API. Custom events are names accordingly, if account
is set up correctly using mixpanelCreateAccount.
mixpanelGetFunnel(account, funnel, from, to=from, verbose=TRUE, ...)
mixpanelGetFunnel(account, funnel, from, to=from, verbose=TRUE, ...)
account |
A mixpanel account, as defined in |
funnel |
Either name or ID of the funnel. See also |
from |
Start date in either format <"yyyy-mm-dd"> or <yyyymmdd>. Inclusive. |
to |
End date in either format <"yyyy-mm-dd"> or <yyyymmdd>. Inclusive. |
verbose |
If |
... |
Additional arguments to Mixpanel API. E.g. |
Object of class funnel
including a list of data.frame
's representing the funnels for each time frame.
Meinhard Ploner
https://mixpanel.com/help/reference/data-export-api#funnels
## Not run: ## Fill in here the API token, key and secret as found on ## www.mixpanel.com - Account -> Projects. account = mixpanelCreateAccount("ProjectName", token="c12g3...", secret="168e7e...", key="543c55...") mixpanelGetFunnel(account, "Funnel001", from=20161001, to=20161101, unit="week") ## End(Not run)
## Not run: ## Fill in here the API token, key and secret as found on ## www.mixpanel.com - Account -> Projects. account = mixpanelCreateAccount("ProjectName", token="c12g3...", secret="168e7e...", key="543c55...") mixpanelGetFunnel(account, "Funnel001", from=20161001, to=20161101, unit="week") ## End(Not run)
Get list of all defined funnels from Mixpanel API.
mixpanelGetFunnelList(account, verbose=TRUE)
mixpanelGetFunnelList(account, verbose=TRUE)
account |
A mixpanel account, as defined in |
verbose |
If |
A data.frame with 1 row for each funnel. Columns include
funnel_id |
ID of the funnel. |
name |
Name of the funnel. |
Meinhard Ploner
https://mixpanel.com/help/reference/data-export-api#funnels
## Not run: ## Fill in here the API token, key and secret as found on ## www.mixpanel.com - Account -> Projects. account = mixpanelCreateAccount("ProjectName", token="c12g3...", secret="168e7e...", key="543c55...") mixpanelGetFunnelList(account) ## End(Not run)
## Not run: ## Fill in here the API token, key and secret as found on ## www.mixpanel.com - Account -> Projects. account = mixpanelCreateAccount("ProjectName", token="c12g3...", secret="168e7e...", key="543c55...") mixpanelGetFunnelList(account) ## End(Not run)
Get a matrix filled with profiles (also called 'users' or 'people') taken from the Mixpanel People API.
mixpanelGetProfiles(account, where="", select, maxPage=100000, verbose=TRUE)
mixpanelGetProfiles(account, where="", select, maxPage=100000, verbose=TRUE)
account |
A mixpanel account, as defined in |
where |
Expression, see https://mixpanel.com/help/reference/data-export-api#segmentation-expressions. |
select |
If |
maxPage |
The API delivers usually about 1000 users per page. Setting this parameter can limit the response for testing purposes. A value of 9 returns page 0 to page 9, i.e. 10000 profiles. |
verbose |
If |
A character matrix showing one profile per line. The first column represents the distinct ID of the profile, the other column the profile properties.
Meinhard Ploner
https://mixpanel.com/help/reference/data-export-api#people-analytics
## Not run: ## Fill in here the API token, key and secret as found on ## www.mixpanel.com - Account -> Projects. account = mixpanelCreateAccount("ProjectName", token="c12g3...", secret="168e7e...", key="543c55...") profiles = mixpanelGetProfiles(account, where='properties["KPI1"] > 1.32', select=c("KPI1", "KPI2")) print(profiles) ## End(Not run)
## Not run: ## Fill in here the API token, key and secret as found on ## www.mixpanel.com - Account -> Projects. account = mixpanelCreateAccount("ProjectName", token="c12g3...", secret="168e7e...", key="543c55...") profiles = mixpanelGetProfiles(account, where='properties["KPI1"] > 1.32', select=c("KPI1", "KPI2")) print(profiles) ## End(Not run)
Get the number of profiles (also called 'users' or 'people') conforming to the requested query from the Mixpanel People API.
mixpanelGetProfilesCount(account, where = "", verbose=TRUE)
mixpanelGetProfilesCount(account, where = "", verbose=TRUE)
account |
A mixpanel account, as defined in |
where |
Expression, see https://mixpanel.com/help/reference/data-export-api#segmentation-expressions. |
verbose |
If |
The number of profiles conforming to the query.
Meinhard Ploner
https://mixpanel.com/help/reference/data-export-api#people-analytics
## Not run: ## Fill in here the API token, key and secret as found on ## www.mixpanel.com - Account -> Projects. account = mixpanelCreateAccount("ProjectName", token="c12g3...", secret="168e7e...", key="543c55...") mixpanelGetProfilesCount(account, where='properties["KPI1"] > 1.32') ## End(Not run)
## Not run: ## Fill in here the API token, key and secret as found on ## www.mixpanel.com - Account -> Projects. account = mixpanelCreateAccount("ProjectName", token="c12g3...", secret="168e7e...", key="543c55...") mixpanelGetProfilesCount(account, where='properties["KPI1"] > 1.32') ## End(Not run)
Get retention data from Mixpanel API. The resulting object can be printed nicely using print.retention
.
mixpanelGetRetention(account, event, from, to, unit, retentionType, intervalCount, verbose=TRUE, ...)
mixpanelGetRetention(account, event, from, to, unit, retentionType, intervalCount, verbose=TRUE, ...)
account |
A mixpanel account, as defined in |
event |
Event name. If empty, all events are returned. |
from |
Start date in either format <"yyyy-mm-dd"> or <yyyymmdd>. Inclusive. |
to |
End date in either format <"yyyy-mm-dd"> or <yyyymmdd>. Inclusive. |
unit |
Defaults to 'day'. |
retentionType |
|
intervalCount |
Number of intervals per cohort to return. |
verbose |
If |
... |
Additional arguments to Mixpanel API. E.g. |
Object of class retention
including
dates |
Start dates of each cohort. |
cohortCount |
Size of cohorts (people count). |
retainCount |
Number of retained people. |
retainPerc |
Percentage of retained people. |
Meinhard Ploner
https://mixpanel.com/help/reference/data-export-api#retention
## Not run: ## Fill in here the API token, key and secret as found on ## www.mixpanel.com - Account -> Projects. account = mixpanelCreateAccount("ProjectName", token="c12g3...", secret="168e7e...", key="543c55...") mixpanelGetRetention(account, born_event="AppInstall", event="WatchedItem", from=20150701, to=20151101, unit="week") ## End(Not run)
## Not run: ## Fill in here the API token, key and secret as found on ## www.mixpanel.com - Account -> Projects. account = mixpanelCreateAccount("ProjectName", token="c12g3...", secret="168e7e...", key="543c55...") mixpanelGetRetention(account, born_event="AppInstall", event="WatchedItem", from=20150701, to=20151101, unit="week") ## End(Not run)
Get a matrix of events segmented by 1 or 2 properties. Event data is taken from the Mixpanel Segmentation API.
mixpanelGetSegmentation(account, event, from, to, unit, type, on, action, verbose, ...)
mixpanelGetSegmentation(account, event, from, to, unit, type, on, action, verbose, ...)
account |
A mixpanel account, as defined in |
event |
Event name. If empty, all events are returned. Custom events are supported, if |
from |
Start date in either format <"yyyy-mm-dd"> or <yyyymmdd>. Inclusive. |
to |
End date in either format <"yyyy-mm-dd"> or <yyyymmdd>. Inclusive. |
unit |
Defaults to 'day'. |
type |
This can be "general", "unique", or "average". |
on |
Array of up to 2 property names for segmentation. An empty array returns un-segmented counts. E.g. 'properties["$os"]' |
.
action |
Could be "sum" or "average". If given, 1st property listed in |
verbose |
If |
... |
Additional arguments to Mixpanel API. See also https://mixpanel.com/help/reference/data-export-api#segmentation. |
2 or 3-dimensional array showing event counts. The first dimension represents the time in the specified unit. The other dimension(s) are determined by the segmention properties. Usually the Mixpanel API does not return more than 60 or 100 slots per segmentation property. For more data, use the events API (mixpanelGetEvents
).
Meinhard Ploner
https://mixpanel.com/help/reference/data-export-api#segmentation
This method performs a JQL Query with some custom script as parameter. The query string can be given either as character vector or saved into a file and passed via file name.
mixpanelJQLQuery(account, jqlString, jqlScripts, paths=".", columnNames, toNumeric=c())
mixpanelJQLQuery(account, jqlString, jqlScripts, paths=".", columnNames, toNumeric=c())
account |
A mixpanel account, as defined in |
jqlString |
JQL script as string. |
jqlScripts |
List of JQL script file names. |
paths |
Paths to search JS files. |
columnNames |
Column names for the resulting data.frame. Optional. |
toNumeric |
Column indices which should be converted to numeric. Optional. |
If data==TRUE
, the method returns the response of the API request (raw character vector). Otherwise nothing is returned.
Meinhard Ploner
https://mixpanel.com/help/reference/jql
## Not run: ## Fill in here the API token, key and secret as found on ## www.mixpanel.com - Account -> Projects. account = mixpanelCreateAccount("ProjectName", token="c12g3...", secret="168e7e...", key="543c55...") ## Simple query: number of events for each 'distinct_id'. jqlQuery <- ' function main() { return Events({ from_date: "2016-01-01", to_date: "2016-12-31" }) .groupByUser(mixpanel.reducer.count()) }' res <- mixpanelJQLQuery(account, jqlQuery, columnNames=c("distinctID", "Count"), toNumeric=2) hist(res$Count) ## End(Not run)
## Not run: ## Fill in here the API token, key and secret as found on ## www.mixpanel.com - Account -> Projects. account = mixpanelCreateAccount("ProjectName", token="c12g3...", secret="168e7e...", key="543c55...") ## Simple query: number of events for each 'distinct_id'. jqlQuery <- ' function main() { return Events({ from_date: "2016-01-01", to_date: "2016-12-31" }) .groupByUser(mixpanel.reducer.count()) }' res <- mixpanelJQLQuery(account, jqlQuery, columnNames=c("distinctID", "Count"), toNumeric=2) hist(res$Count) ## End(Not run)
Update Mixpanel profiles (also called 'users' or 'people') using the Mixpanel Engage API.
mixpanelUpdateProfile(account, distinctID, data, updateLastSeen=FALSE, updateLocation=FALSE, retryCount=100)
mixpanelUpdateProfile(account, distinctID, data, updateLastSeen=FALSE, updateLocation=FALSE, retryCount=100)
account |
A mixpanel account, as defined in |
distinctID |
A distinct ID, identifying the profile. Could be extracted by calling |
data |
JSON dictionary with property names and values. See Mixpanel documentation or example below. |
updateLastSeen |
If |
updateLocation |
If |
retryCount |
Applied if the HTTP request fails. |
None.
Meinhard Ploner
https://mixpanel.com/help/reference/http#people-analytics-updates
## Not run: ## Fill in here the API token, key and secret as found on ## www.mixpanel.com - Account -> Projects. account = mixpanelCreateAccount("ProjectName", token="c12g3...", secret="168e7e...", key="543c55...") mixpanelUpdateProfile( account, "11b9c243-4ea3...", data=list( "$set"=list(day=jsonlite::unbox(12), month=jsonlite::unbox(3), "$name"=jsonlite::unbox("Dummy name")), "$setOnce"=list(installYear=2016), "$unset"=c("oldProp1", "oldProp2"), "$union"=list(month=10:12) ## "$delete": "" ## !!! Delete user. !!! ) ) ## End(Not run)
## Not run: ## Fill in here the API token, key and secret as found on ## www.mixpanel.com - Account -> Projects. account = mixpanelCreateAccount("ProjectName", token="c12g3...", secret="168e7e...", key="543c55...") mixpanelUpdateProfile( account, "11b9c243-4ea3...", data=list( "$set"=list(day=jsonlite::unbox(12), month=jsonlite::unbox(3), "$name"=jsonlite::unbox("Dummy name")), "$setOnce"=list(installYear=2016), "$unset"=c("oldProp1", "oldProp2"), "$union"=list(month=10:12) ## "$delete": "" ## !!! Delete user. !!! ) ) ## End(Not run)
Plot Retention Rates as a line chart. Multiple chart types are available.
## S3 method for class 'retention' plot(x, type="all", percentages=TRUE, omitLast=TRUE, colors, durations, y, ...)
## S3 method for class 'retention' plot(x, type="all", percentages=TRUE, omitLast=TRUE, colors, durations, y, ...)
x |
Object of class |
type |
Character vector. If "all", all chart types are plotted. Valid values are |
percentages |
Use retention counts or percentages? Default is |
omitLast |
Omit last value per series? Useful for Mixpanel data, because last value is usually based on partial data! |
colors |
Colors for lines. Optional. |
durations |
Selected Durations (index). Default is c(1, 2, 5, 10). |
y |
Not used. |
... |
Not used. |
Meinhard Ploner
https://mixpanel.com/help/reference/data-export-api#retention
## Not run: ## Fill in here the API token, key and secret as found on ## www.mixpanel.com - Account -> Projects. account = mixpanelCreateAccount("ProjectName", token="c12g3...", secret="168e7e...", key="543c55...") ret = mixpanelGetRetention(account, born_event="AppInstall", event="WatchedItem", from=20150701, to=20151101, unit="week") par(mfrow=c(2, 2)) plot(ret, type="all") par(mfrow=c(1, 1)) ## End(Not run)
## Not run: ## Fill in here the API token, key and secret as found on ## www.mixpanel.com - Account -> Projects. account = mixpanelCreateAccount("ProjectName", token="c12g3...", secret="168e7e...", key="543c55...") ret = mixpanelGetRetention(account, born_event="AppInstall", event="WatchedItem", from=20150701, to=20151101, unit="week") par(mfrow=c(2, 2)) plot(ret, type="all") par(mfrow=c(1, 1)) ## End(Not run)
Print Retention Matrix as counts or percentages.
## S3 method for class 'retention' print(x, percentages=TRUE, silent=FALSE, ...)
## S3 method for class 'retention' print(x, percentages=TRUE, silent=FALSE, ...)
x |
Object of class |
percentages |
Boolean. Indicates if retain counts should be shown as percentages or raw count. default is |
silent |
If |
... |
Not used. |
Matrix consisting of one row for each cohort. The first column holds the cohort sizes, the following columns the counts for subsequent periods. If percentages
is TRUE
, the counts are percentages (except first column).
Meinhard Ploner
https://mixpanel.com/help/reference/data-export-api#retention
## Not run: ## Fill in here the API token, key and secret as found on ## www.mixpanel.com - Account -> Projects. account = mixpanelCreateAccount("ProjectName", token="c12g3...", secret="168e7e...", key="543c55...") ret = mixpanelGetRetention(account, born_event="AppInstall", event="WatchedItem", from=20150701, to=20151101, unit="week") print(ret, percentages=FALSE) print(ret, percentages=TRUE) ## End(Not run)
## Not run: ## Fill in here the API token, key and secret as found on ## www.mixpanel.com - Account -> Projects. account = mixpanelCreateAccount("ProjectName", token="c12g3...", secret="168e7e...", key="543c55...") ret = mixpanelGetRetention(account, born_event="AppInstall", event="WatchedItem", from=20150701, to=20151101, unit="week") print(ret, percentages=FALSE) print(ret, percentages=TRUE) ## End(Not run)
Convenience function to convert json result of engage API to R matrix holding people data.
profilesJson2RMatrix(jsonData, select = TRUE)
profilesJson2RMatrix(jsonData, select = TRUE)
jsonData |
Result of request to Mixpanel's Engage API. |
select |
If |
Ths helper function takes a json result as of the Mixpanel Engage API and creates a R matrix holding the data. Array user properties are collapsed using a dash ('-') as separator.
A character matrix showing one profile per line. The first column represents the distinct ID of the profile, the other column the profile properties.
Meinhard Ploner