mixpanelJQLQuery: Query the Mixpanel JQL API

Description Usage Arguments Value Author(s) References Examples

View source: R/mixpanelJQLQuery.R

Description

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.

Usage

1
mixpanelJQLQuery(account, jqlString, jqlScripts, paths=".", columnNames, toNumeric=c())

Arguments

account

A mixpanel account, as defined in mixpanelCreateAccount.

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.

Value

If data==TRUE, the method returns the response of the API request (raw character vector). Otherwise nothing is returned.

Author(s)

Meinhard Ploner

References

https://mixpanel.com/help/reference/jql

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
## 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)

RMixpanel documentation built on May 1, 2019, 10:46 p.m.