/reshuffle-mixpanel-connector

Reshuffle MixPanel Connector

Primary LanguageTypeScriptMIT LicenseMIT

Reshuffle Mixpanel Connector

Code | npm |

npm install reshuffle-mixpanel-connector

ES6 import: import { MixpanelConnector } from 'reshuffle-mixpanel-connectors'

This is a Reshuffle connector that provides an Interface to the Mixpanel Platform.

This connector uses Mixpanel node package.

Example

const { Reshuffle } = require('reshuffle')
const { MixpanelConnector } = require('reshuffle-mixpanel-connector')

const app = new Reshuffle()
const mixpanelConnector = new MixpanelConnector(app, {
    token: '<mixpanel-token>',
    secret: '<mixpanel-secret>',
})

mixpanelConnector.track('test', { key1: 'value1', key2: 'value2' })

Table of Contents

Setup Mixpanel

Configuration Options

Connector Events

N/A

Connector Actions

Track

Import

SDK - Get a Mixpanel client

Setup Mixpanel

Follow the instructions here

Configuration Options

export interface MixpanelConnectorConfigOptions {
    token: string
    secret: string
}

Example:

const { Reshuffle } = require('reshuffle')
const { MixpanelConnector } = require('reshuffle-mixpanel-connector')

const app = new Reshuffle()
const mixpanelConnector = new MixpanelConnector(app, {
    token: '<mixpanel-token>',
    secret: '<mixpanel-secret>',
})

Connector events

N/A

Track

For tracking events

track(eventName: string, properties?: Record<string, any>): void

Import

For importing events

import(eventName: string, time: Date | number, properties?: Record<string, any>): void

SDK

Returns a Mixpanel client (See details on npm)

 sdk() : Mixpanel.Mixpanel

See Mixpanel.Mixpanel class in Mixpanel Node type

Example using the sdk:

const { Reshuffle } = require('reshuffle')
const { MixpanelConnector } = require('reshuffle-mixpanel-connector')

const app = new Reshuffle()
const mixpanelConnector = new MixpanelConnector(app, {
    token: '<mixpanel-token>',
    secret: '<mixpanel-secret>',
})
mixpanelConnector.sdk().import('action', Date.now())