npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@luisbytes/capacitor-mixpanel

v6.0.0

Published

Capacitor plugin for Mixpanel

Downloads

72

Readme

Install

npm install @luisbytes/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)

| Param | Type | | ------------- | --------------------------------------------------------------- | | options | InitializeOptions |


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.

| Param | Type | | ------------- | ----------------------------------------------------- | | options | TrackOptions |


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.

| Param | Type | | ------------- | ----------------------------------------------------------- | | options | IdentifyOptions |


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.

| Param | Type | | ------------- | ----------------------------------------------------- | | options | AliasOptions |


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.

| Param | Type | | ------------- | --------------------------------------------------------------------- | | options | SuperPropertyOptions |


setProfile(...)

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

Set properties on the current user in Mixpanel People.

| Param | Type | | ------------- | --------------------------------------------------------------- | | options | ProfileProperties |


setProfileUnion(...)

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

Union list properties.

| Param | Type | | ------------- | --------------------------------------------------------------- | | options | ProfileProperties |


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.

| Param | Type | | ------------- | ------------------------------------------------------- | | options | ChargeOptions |


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.

| Param | Type | | ------------- | ----------------------------------------------------- | | options | OptInOptions |


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

| Prop | Type | Description | Default | | --------------------- | -------------------- | ----------------------------------------------------------------- | ------------------ | | token | string | Your Mixpanel API token | | | autotrack | boolean | Enable or disable autotracking | true | | optOutByDefault | boolean | Opting users out of tracking by this Mixpanel instance by default | false | | debug | boolean | Enable or disable debug mode | false | | serverURL | string | Enable or disable debug mode | null |

TrackOptions

| Prop | Type | Description | Default | | ---------------- | ----------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------ | --------------- | | event | string | The name of the event. This can be anything the user does - 'Button Click', 'Sign Up', 'Item Purchased', etc. | | | properties | TrackProperties | A 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

| Prop | Type | Description | | ---------------- | ------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------- | | distinctId | string | A string that uniquely identifies a user. If not provided, the distinct_id currently in the persistent store (cookie or localStorage) will be used. |

AliasOptions

| Prop | Type | Description | | ---------------- | ------------------- | --------------------------------------------------------------------- | | alias | string | A unique identifier that you want to use for this user in the future. | | distinctId | string | The current identifier being used for this user. |

SuperPropertyOptions

| Prop | Type | Description | | ---------------- | ---------------- | ---------------------------------------------------------- | | properties | any | An associative array of properties to store about the user |

ProfileProperties

| Prop | Type | Description | | ---------------- | ---------------- | ---------------------------------------------------------- | | properties | any | An associative array of properties to store about the user |

ChargeOptions

| Prop | Type | Description | Default | | ---------------- | ------------------- | ----------------------------------------------------------------- | --------------- | | amount | number | The amount of the transaction | | | properties | any | An associative array of properties to store about the transaction | {} |

OptInOptions

| Prop | Type | Description | | ---------------- | ------------------- | ---------------------------------------------------------- | | distinctId | string | String that uniquely identifies the current user. | | properties | any | An associative array of properties to store about the user |