@robinpath/mixpanel
0.1.2Node.jsPublicMixpanel module for RobinPath.
Mixpanel
Mixpanel module for RobinPath.
Package: @robinpath/mixpanel | Category: Analytics | Type: Integration
Authentication
mixpanel.setCredentials "your-credentials"
Call this once at the start of your script before using any other function. Credentials persist for the duration of the script execution.
Use Cases
Use the mixpanel module when you need to:
- trackEvent -- Use
mixpanel.trackEventto perform this operation - trackBatch -- Use
mixpanel.trackBatchto perform this operation - identifyUser -- Use
mixpanel.identifyUserto perform this operation - deleteUserProfile -- Use
mixpanel.deleteUserProfileto perform this operation - exportEvents -- Use
mixpanel.exportEventsto perform this operation
Quick Reference
| Function | Description | Returns |
|---|---|---|
setCredentials | Configure mixpanel credentials. | object |
trackEvent | trackEvent | object |
trackBatch | trackBatch | object |
identifyUser | identifyUser | object |
setUserProfile | setUserProfile | object |
deleteUserProfile | deleteUserProfile | object |
exportEvents | exportEvents | object |
getTopEvents | getTopEvents | object |
getEventStats | getEventStats | object |
getFunnelReport | getFunnelReport | object |
getRetention | getRetention | object |
getSegmentation | getSegmentation | object |
listCohorts | listCohorts | object |
getInsights | getInsights | object |
queryJql | queryJql | object |
Functions
setCredentials
Configure mixpanel credentials.
Module: mixpanel | Returns: object -- API response.
mixpanel.setCredentials
| Parameter | Type | Required | Description |
|---|---|---|---|
projectToken | string | Yes | projectToken |
apiSecret | string | Yes | apiSecret |
trackEvent
trackEvent
Module: mixpanel | Returns: object -- API response.
mixpanel.trackEvent
| Parameter | Type | Required | Description |
|---|---|---|---|
input | string | No | Input parameter |
trackBatch
trackBatch
Module: mixpanel | Returns: object -- API response.
mixpanel.trackBatch
| Parameter | Type | Required | Description |
|---|---|---|---|
input | string | No | Input parameter |
identifyUser
identifyUser
Module: mixpanel | Returns: object -- API response.
mixpanel.identifyUser
| Parameter | Type | Required | Description |
|---|---|---|---|
input | string | No | Input parameter |
setUserProfile
setUserProfile
Module: mixpanel | Returns: object -- API response.
mixpanel.setUserProfile
| Parameter | Type | Required | Description |
|---|---|---|---|
input | string | No | Input parameter |
deleteUserProfile
deleteUserProfile
Module: mixpanel | Returns: object -- API response.
mixpanel.deleteUserProfile
| Parameter | Type | Required | Description |
|---|---|---|---|
input | string | No | Input parameter |
exportEvents
exportEvents
Module: mixpanel | Returns: object -- API response.
mixpanel.exportEvents
| Parameter | Type | Required | Description |
|---|---|---|---|
input | string | No | Input parameter |
getTopEvents
getTopEvents
Module: mixpanel | Returns: object -- API response.
mixpanel.getTopEvents
| Parameter | Type | Required | Description |
|---|---|---|---|
input | string | No | Input parameter |
getEventStats
getEventStats
Module: mixpanel | Returns: object -- API response.
mixpanel.getEventStats
| Parameter | Type | Required | Description |
|---|---|---|---|
input | string | No | Input parameter |
getFunnelReport
getFunnelReport
Module: mixpanel | Returns: object -- API response.
mixpanel.getFunnelReport
| Parameter | Type | Required | Description |
|---|---|---|---|
input | string | No | Input parameter |
getRetention
getRetention
Module: mixpanel | Returns: object -- API response.
mixpanel.getRetention
| Parameter | Type | Required | Description |
|---|---|---|---|
input | string | No | Input parameter |
getSegmentation
getSegmentation
Module: mixpanel | Returns: object -- API response.
mixpanel.getSegmentation
| Parameter | Type | Required | Description |
|---|---|---|---|
input | string | No | Input parameter |
listCohorts
listCohorts
Module: mixpanel | Returns: object -- API response.
mixpanel.listCohorts
| Parameter | Type | Required | Description |
|---|---|---|---|
input | string | No | Input parameter |
getInsights
getInsights
Module: mixpanel | Returns: object -- API response.
mixpanel.getInsights
| Parameter | Type | Required | Description |
|---|---|---|---|
input | string | No | Input parameter |
queryJql
queryJql
Module: mixpanel | Returns: object -- API response.
mixpanel.queryJql
| Parameter | Type | Required | Description |
|---|---|---|---|
input | string | No | Input parameter |
Error Handling
All functions throw on failure. Common errors:
| Error | Cause |
|---|---|
Mixpanel API error (${res.status}): ${t} | Check the error message for details |
mixpanel.setCredentials requires projectToken, apiSecret. | Check the error message for details |
mixpanel.deleteUserProfile requires an ID. | Check the error message for details |
Mixpanel: "..." not configured. Call mixpanel.setCredentials first. | Check the error message for details |
@desc "Track event and validate result"
do
set $result as mixpanel.trackEvent
if $result != null
print "Success"
else
print "No result"
end
enddo
Recipes
1. List and iterate TopEvents
Retrieve all items and loop through them.
@desc "Setup authentication"
do
mixpanel.setCredentials $token
enddo
@desc "Get top events and iterate results"
do
set $result as mixpanel.getTopEvents
each $item in $result
print $item
end
enddo
2. Multi-step Mixpanel workflow
Chain multiple mixpanel operations together.
@desc "Setup authentication"
do
mixpanel.setCredentials $token
enddo
@desc "Track event, track batch, and more"
do
set $r_trackEvent as mixpanel.trackEvent
set $r_trackBatch as mixpanel.trackBatch
set $r_identifyUser as mixpanel.identifyUser
print "All operations complete"
enddo
3. Safe trackEvent with validation
Check results before proceeding.
@desc "Setup authentication"
do
mixpanel.setCredentials $token
enddo
@desc "Track event and validate result"
do
set $result as mixpanel.trackEvent
if $result != null
print "Success: " + $result
else
print "Operation returned no data"
end
enddo
Related Modules
- json -- JSON module for complementary functionality
Versions (1)
| Version | Tag | Published |
|---|---|---|
| 0.1.2 | latest | 1 months ago |
Related Modules
chart
JS@robinpathv0.1.2
Generate chart images (PNG/JPEG) using Chart.js. Supports bar, line, pie, doughnut, scatter, radar, polarArea, and bubble charts with auto-coloring and customizable titles, legends, and dimensions.
firebase
JS@robinpathv0.1.1
Firebase module for RobinPath.
graph
JS@robinpathv0.1.1
Graph data structures with BFS, DFS, Dijkstra's shortest path, topological sort, cycle detection, and connectivity
hotjar
JS@robinpathv0.1.1
Hotjar module for RobinPath.
$ robinpath add @robinpath/mixpanel
