GithubHelp home page GithubHelp logo

ploner / rmixpanel Goto Github PK

View Code? Open in Web Editor NEW

This project forked from kfayzullin/rmixpanel

18.0 18.0 6.0 92 KB

RMixpanel - Mixpanel API client package for R

License: Other

R 100.00%
analytics cran mixpanel mixpanel-api r tracking

rmixpanel's People

Contributors

ploner avatar serenthia avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

rmixpanel's Issues

Issues with auth for https://mixpanel.com/

Hello,

I can't seem to authenticate with any https://mixpanel.com/ endpoints. This includes segmentation and funnels. Based on the simple funnel example I tried the following:

This doesn't work - "object 'res' not found"

mixpanelGetData(account, method="funnels/list/", args=list(), data=TRUE)

This doesn't work either - "Unknown SSL protocol error in connection to mixpanel.com:443"

headers = c(Authorization = paste("Basic ", base64enc::base64encode(charToRaw(paste(account$apiSecret,
":", account$apiSecret, sep = ""))), sep = ""))
url <- "https://mixpanel.com/api/2.0/funnels/list/?"
RCurl::getURL(url, httpheader = headers)

Also doesn't work - "AuthenticationRequiredAuthentication required."

url <- "https://data.mixpanel.com/api/2.0/funnels/list/?"
RCurl::getURL(url, httpheader = headers)

However the following does work:

url <- "https://data.mixpanel.com/api/2.0/export/?event=%5B%22Purchase3%22%5D&from_date=2018-10-01&to_date=2018-10-02&"
RCurl::getURL(url, httpheader = headers)

myArgs <- list()
myArgs$event <- "["Purchase3"]"
myArgs$from_date <- "2018-10-01"
myArgs$to_date <- "2018-10-02"
mixpanelGetData(account, method="export/", args=myArgs, data=TRUE)

Any idea what is going on? Thanks in advance.

I am unable to pull event data for each profile

Hi,
Thanks for developing this, its actually pretty useful!
I am trying to pull event data for each profile in my Mixpanel project, however I keep getting an error message.

I am able to authenticate correctly into Mixpanel, and pull profile information with mixpanelGetProfiles(account)

Now, I am trying to pull event data for each profile (for this example, just for the first profile) by using the following command:
profileIDs = profiles[, "distinct_id"] events_profile = mixpanelGetEventsForProfiles(account, profileIDs[1], from_date=2018-11-01, to_date=2018-12-01)

but I get the following text in return:
## Download https://mixpanXXXXXXXXXXX2.0/stream/query?from_date=2010-01-01&to_date=2020-01-01&distinct_ids=%5B%22165790f3f08375-0f3c30b4faed45-772b1906-5b524-165790f3f09c0%22%5D&... parse data... $request [1] "/api/2.0/stream/query?from_date=2010-01-01&to_date=2020-01-01&distinct_ids=%5B%22165790f3f08375-0f3c30b4faed45-772b1906-5b524-165790f3f09c0%22%5D&" $error [1] "Date range exceeds 365 days into the past"

I also tried running the same command but without the from and to date, and still get the same return

Would you be able to let me know what the issue is, or if there is something I am doing wrong!

Thanks,
F.A.Calvo

Error: lexical error: invalid character inside string.

Seems to be an issue supporting non ASCII chars or escape strings inside of results from Mixpanel. Error probably originates from RCURL or jsonlite. Source has around 64,000 results with a mix of English and extended characters from Asian languages.

Auth doesn't work with data.mixpanel.com

As of this past week, I'm not able to authenticate data.mixpanel.com endpoints (ie. "export") with the secret in the URL. Instead, it needs to be added as a Basic Auth header in the username. I've verified this via curl.

endpoint = paste('https://', account$apiSecret, '@mixpanel.com/api/2.0', sep='')

Issue with function mixpanelJQLQuery

Hi,

I am having an issue when I call mixpanelJQLQuery() - I get an error as follows
image

this is the code snippet:

jql_que <- "
function main() {
  return Events({
    from_date: '2021-06-01',
    to_date:   '2021-06-01',
    event_selectors: [
        {event : 'appOpened'}
      ]
  })
}" 

appOpened <- mixpanelJQLQuery(account, jqlString = jql_que)

The credentials for "account" are set up correctly as I am able to run mixpanelGetEvents() with no issue. I can also run the JQL code in Mixpanel and it returns results. Please let me know if there is something I am missing with this function call - I am running R version 4.1.1

Thanks very much!

Curl not found

res <- mixpanelJQLQuery(account, jqlQuery)
is resulting in the following error on PC only:

Error in system(curlCall, intern = TRUE, ignore.stderr = TRUE) : 'curl' not found

Tested and tried on multiple PCs and the full code stops there. Weirdly enough, the code works flawlessly on a Mac.

Error: lexical error: invalid character inside string

Hi,
When running:

tmp = mixpanelGetEvents(account, from = date, to = date, daysPerBlock = 10,
                          select = vars, verbose = TRUE, df = TRUE, encoding="UTF-8")

I was getting the error:

Error: lexical error: invalid character inside string.
          amsung","$carrier":"DAIS-Virgi ",
                    (right here) ------^

Apparently, Mixpanel was putting some invalid json character on the data we were getting and that was causing the error.

I managed to fix it by going into the function eventsJson2RMatrix and adding at the start:

jsonData = gsub('\x06','',jsonData)

I hope this helps improve the package. Thanks!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.