2.1.1 • Published 1 year ago

@houseninja/capacitor-mixpanel v2.1.1

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago

Maintainers

MaintainerGitHubSocial
Miles Zimmermanmileszim@mileszim
House Ninjahouseninjadojo

Install

npm install @houseninja/capacitor-mixpanel

Add the following plugin configuration:

{
  ...
  "Mixpanel": {
    "token": "token-abcdefg1234",
    "trackAutomaticEvents": true, // optional, default: true
    "optOutTrackingByDefault": false, // optional, default: false
    "disableIosIpCollection": true, // optional, default: false
    "serverURL": "https://api-eu.mixpanel.com/", // optional, default: "https://api.mixpanel.com/"
  },
  ...
}

Sync capacitor configuration

npx cap sync

API

initialize(...)

initialize(options: InitializeOptions) => Promise<void>

Initialize the plugin (web only)

ParamType
optionsInitializeOptions

distinctId()

distinctId() => Promise<{ value: string; }>

Returns the current distinct id of the user. This is either the id automatically generated by the library or the id that has been passed by a call to identify().

Returns: Promise<{ value: string; }>


track(...)

track(options: TrackOptions) => Promise<void>

Tracks an event with properties. Properties are optional and can be added only if needed.

ParamType
optionsTrackOptions

identify(...)

identify(options: IdentifyOptions) => Promise<void>

Identify a user with a unique ID to track user activity across devices, tie a user to their events, and create a user profile. If you never call this method, unique visitors are tracked using a UUID generated the first time they visit the site.

ParamType
optionsIdentifyOptions

alias(...)

alias(options: AliasOptions) => Promise<void>

The alias method creates an alias which Mixpanel will use to remap one id to another. Multiple aliases can point to the same identifier.

ParamType
optionsAliasOptions

reset()

reset() => Promise<void>

Clears super properties and generates a new random distinct_id for this instance. Useful for clearing data when a user logs out.


clearSuperProperties()

clearSuperProperties() => Promise<void>

Clears all currently set super properties.


currentSuperProperties()

currentSuperProperties() => Promise<{ properties: any; }>

Returns the currently set super properties.

Returns: Promise<{ properties: any; }>


registerSuperProperties(...)

registerSuperProperties(options: SuperPropertyOptions) => Promise<void>

Register super properties that will be sent with every event.

ParamType
optionsSuperPropertyOptions

setProfile(...)

setProfile(options: ProfileProperties) => Promise<void>

Set properties on the current user in Mixpanel People.

ParamType
optionsProfileProperties

setProfileUnion(...)

setProfileUnion(options: ProfileProperties) => Promise<void>

Union list properties.

ParamType
optionsProfileProperties

deleteProfile()

deleteProfile() => Promise<void>

Permanently deletes the current people analytics profile from Mixpanel (using the current distinctId).


trackCharge(...)

trackCharge(options: ChargeOptions) => Promise<void>

Track money spent by the current user for revenue analytics and associate properties with the charge. Properties is optional.

ParamType
optionsChargeOptions

flush()

flush() => Promise<void>

Uploads queued data to the Mixpanel server. (only ios, android)


optInTracking(...)

optInTracking(options: OptInOptions) => Promise<void>

Opt in tracking.

Use this method to opt in an already opted out user from tracking. People updates and track calls will be sent to Mixpanel after using this method.

ParamType
optionsOptInOptions

optOutTracking()

optOutTracking() => Promise<void>

Opt out tracking.

This method is used to opt out tracking. This causes all events and people request no longer to be sent back to the Mixpanel server.


hasOptedOutTracking()

hasOptedOutTracking() => Promise<{ value: boolean; }>

Returns the current opt-out status.

Returns: Promise<{ value: boolean; }>


Interfaces

InitializeOptions

PropTypeDescriptionDefault
tokenstringYour Mixpanel API token
autotrackbooleanEnable or disable autotrackingtrue
optOutByDefaultbooleanOpting users out of tracking by this Mixpanel instance by defaultfalse
debugbooleanEnable or disable debug modefalse

TrackOptions

PropTypeDescriptionDefault
eventstringThe name of the event. This can be anything the user does - 'Button Click', 'Sign Up', 'Item Purchased', etc.
propertiesTrackPropertiesA set of properties to include with the event you're sending. These describe the user who did the event or details about the event itself.{}

TrackProperties

IdentifyOptions

PropTypeDescription
distinctIdstringA string that uniquely identifies a user. If not provided, the distinct_id currently in the persistent store (cookie or localStorage) will be used.

AliasOptions

PropTypeDescription
aliasstringA unique identifier that you want to use for this user in the future.
distinctIdstringThe current identifier being used for this user.

SuperPropertyOptions

PropTypeDescription
propertiesanyAn associative array of properties to store about the user

ProfileProperties

PropTypeDescription
propertiesanyAn associative array of properties to store about the user

ChargeOptions

PropTypeDescriptionDefault
amountnumberThe amount of the transaction
propertiesanyAn associative array of properties to store about the transaction{}

OptInOptions

PropTypeDescription
distinctIdstringString that uniquely identifies the current user.
propertiesanyAn associative array of properties to store about the user

Contributors

Thanks goes to these wonderful people (emoji key):

This project follows the all-contributors specification. Contributions of any kind welcome!

2.1.1

1 year ago

1.1.0

1 year ago

1.0.1

1 year ago

1.0.0

1 year ago

2.1.0

1 year ago

2.0.0

1 year ago

1.0.0-beta.2

2 years ago

1.0.0-beta.1

2 years ago

0.2.0

2 years ago

0.1.0

2 years ago

0.0.14

2 years ago

0.0.15

2 years ago

0.0.16

2 years ago

0.0.12

2 years ago

0.0.11

2 years ago

0.0.10

2 years ago

0.0.9

2 years ago

0.0.8

2 years ago

0.0.7

2 years ago

0.0.6

2 years ago

0.0.5

2 years ago

0.0.4

2 years ago

0.0.3

2 years ago

0.0.2

2 years ago

0.0.1

2 years ago