mixpanel-jql-js
v0.0.2
Published
mixpanel-jql-js ===
Downloads
1,871
Readme
mixpanel-jql-js
Installation
npm install mixpanel-jql-js --save
How to use it:
Initialization
let mixpanel = require('mixpanel-jql-js')
mixpanel.init('sfh78hsfsdfh030h5i3398fh9f8') //MixPanel key
Complete example
let mixpanel = require('mixpanel-jql-js')
mixpanel.init('sfh78hsfsdfh030h5i3398fh9f8')
let queries = mixpanel.queries
let moment = require('moment')
let queryMap = {
"'userId'": queries.getUserProperty('userId'),
"'eventId'": queries.getEventProperty("eventId"),
"'createdAt'": queries.getEventProperty('createdAt')
}
var query = queries.Query()
query.setPeriod(queries.periods.custom(moment().subtract(1, 'days'), moment()))
query.setEvent("Event Name")
query.setMap(queryMap)
query.setFilter(queries.getUserProperty('userId') + "== '9FDH893H989A913D3F143927'")
mixpanel.executeQuery(query).then(function (result) {
console.log(result.data)
}).catch(function (err) {
console.log(err)
})