You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardexpand all lines: README.md
+4-39
Original file line number
Diff line number
Diff line change
@@ -1,5 +1,5 @@
1
-
Mixpanel Data Export (v 1.8.2)
2
-
==============================
1
+
Mixpanel Data Export
2
+
====================
3
3
4
4
Simply put, this is a JavaScript library that makes [Mixpanel's data export API](https://mixpanel.com/docs/api-documentation/data-export-api#libs-js) easy to use. Simply instantiate the class with your API secret and key and then make calls to api methods and get correctly formatted data back via a promise, callback or stream.
5
5
@@ -25,10 +25,10 @@ Every method detailed on [mixpanel's data export api page](https://mixpanel.com/
@@ -91,42 +91,7 @@ A full list of available API methods is detailed on [mixpanel's data export api
91
91
## Undocumented Endpoints
92
92
For any other requests (e.g. undocumented API endpoints), you can make raw requests to the API using `get`. The library will still handle all of param ordering and md5 signature stuff that the API requires, so you'll just need to supply a request type & parameters:
93
93
94
-
-`panel.get(requestType, parameters)`
94
+
-`panel.get(requestType, parameters)`
95
95
96
96
`requestType` expects an array forming a path to the endpoint. Taking the "top events" endpoint as an example - it's available at `http://mixpanel.com/api/2.0/events/top/`, so to request it you'd call `panel.get(['events', 'top'], parameters)`.
97
97
98
-
99
-
## Streaming Exports
100
-
101
-
Due to the large size of an export response, it's often appropriate to stream the data instead of waiting for it all:
102
-
103
-
```javascript
104
-
// Create a stream object
105
-
var exportStream =panel.exportStream({
106
-
from_date:"2015-03-01",
107
-
to_date:"2015-03-02"
108
-
});
109
-
110
-
// Listen on stream data
111
-
exportStream.on('data', function(data) {
112
-
// do something with it
113
-
});
114
-
115
-
// Listen for a stream error
116
-
exportStream.on('error', function(err) {
117
-
// handle error
118
-
});
119
-
120
-
// Listen for the end of the stream
121
-
exportStream.on('end', function() {
122
-
// move on to do other stuff
123
-
});
124
-
125
-
// Pause the stream
126
-
exportStream.pause()
127
-
128
-
// Resume the stream
129
-
exportStream.resume()
130
-
```
131
-
132
-
Please note this option is only available in node environments, it's not supported in browser.
0 commit comments