Modules@robinpath/mixpanel
mixpanel

@robinpath/mixpanel

0.1.2Node.jsPublic

Mixpanel 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.trackEvent to perform this operation
  • trackBatch -- Use mixpanel.trackBatch to perform this operation
  • identifyUser -- Use mixpanel.identifyUser to perform this operation
  • deleteUserProfile -- Use mixpanel.deleteUserProfile to perform this operation
  • exportEvents -- Use mixpanel.exportEvents to perform this operation

Quick Reference

FunctionDescriptionReturns
setCredentialsConfigure mixpanel credentials.object
trackEventtrackEventobject
trackBatchtrackBatchobject
identifyUseridentifyUserobject
setUserProfilesetUserProfileobject
deleteUserProfiledeleteUserProfileobject
exportEventsexportEventsobject
getTopEventsgetTopEventsobject
getEventStatsgetEventStatsobject
getFunnelReportgetFunnelReportobject
getRetentiongetRetentionobject
getSegmentationgetSegmentationobject
listCohortslistCohortsobject
getInsightsgetInsightsobject
queryJqlqueryJqlobject

Functions

setCredentials

Configure mixpanel credentials.

Module: mixpanel | Returns: object -- API response.

mixpanel.setCredentials
ParameterTypeRequiredDescription
projectTokenstringYesprojectToken
apiSecretstringYesapiSecret

trackEvent

trackEvent

Module: mixpanel | Returns: object -- API response.

mixpanel.trackEvent
ParameterTypeRequiredDescription
inputstringNoInput parameter

trackBatch

trackBatch

Module: mixpanel | Returns: object -- API response.

mixpanel.trackBatch
ParameterTypeRequiredDescription
inputstringNoInput parameter

identifyUser

identifyUser

Module: mixpanel | Returns: object -- API response.

mixpanel.identifyUser
ParameterTypeRequiredDescription
inputstringNoInput parameter

setUserProfile

setUserProfile

Module: mixpanel | Returns: object -- API response.

mixpanel.setUserProfile
ParameterTypeRequiredDescription
inputstringNoInput parameter

deleteUserProfile

deleteUserProfile

Module: mixpanel | Returns: object -- API response.

mixpanel.deleteUserProfile
ParameterTypeRequiredDescription
inputstringNoInput parameter

exportEvents

exportEvents

Module: mixpanel | Returns: object -- API response.

mixpanel.exportEvents
ParameterTypeRequiredDescription
inputstringNoInput parameter

getTopEvents

getTopEvents

Module: mixpanel | Returns: object -- API response.

mixpanel.getTopEvents
ParameterTypeRequiredDescription
inputstringNoInput parameter

getEventStats

getEventStats

Module: mixpanel | Returns: object -- API response.

mixpanel.getEventStats
ParameterTypeRequiredDescription
inputstringNoInput parameter

getFunnelReport

getFunnelReport

Module: mixpanel | Returns: object -- API response.

mixpanel.getFunnelReport
ParameterTypeRequiredDescription
inputstringNoInput parameter

getRetention

getRetention

Module: mixpanel | Returns: object -- API response.

mixpanel.getRetention
ParameterTypeRequiredDescription
inputstringNoInput parameter

getSegmentation

getSegmentation

Module: mixpanel | Returns: object -- API response.

mixpanel.getSegmentation
ParameterTypeRequiredDescription
inputstringNoInput parameter

listCohorts

listCohorts

Module: mixpanel | Returns: object -- API response.

mixpanel.listCohorts
ParameterTypeRequiredDescription
inputstringNoInput parameter

getInsights

getInsights

Module: mixpanel | Returns: object -- API response.

mixpanel.getInsights
ParameterTypeRequiredDescription
inputstringNoInput parameter

queryJql

queryJql

Module: mixpanel | Returns: object -- API response.

mixpanel.queryJql
ParameterTypeRequiredDescription
inputstringNoInput parameter

Error Handling

All functions throw on failure. Common errors:

ErrorCause
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)

VersionTagPublished
0.1.2latest1 months ago
Install
$ robinpath add @robinpath/mixpanel

Collaborators

Dumitru Balaban
Dumitru Balaban
@dumitru
View all @robinpath modules
Version0.1.2
LicenseMIT
Unpacked Size4.3 KB
Versions1
Weekly Downloads21
Total Downloads21
Stars0
Last Publish1 months ago
Created1 months ago

Category

data