1.0.9 • Published 10 months ago

analytics-plugin-planhat v1.0.9

Weekly downloads
-
License
MIT
Repository
github
Last release
10 months ago

Analytics plugin Planhat

This adds support for Planhat for the Analytics package.

Installation

npm install analytics analytics-plugin-planhat --save

Usage

Browser (Vue, React, Angular)

import { Analytics } from "analytics"
import planhatPlugin from "analytics-plugin-planhat"

const analytics = Analytics({
  app: "[your app name]",
  plugins: [
    planhatPlugin({
      tenantUUID: "[your tenantUUID]",
    }),
  ],
})

Example

Node

CommonJS

const { Analytics } = require('analytics')
// or const Analytics = require('analytics').default
const planhatPlugin  = require('analytics-plugin-planhat')

const analytics = Analytics({
  app: "[your app name]",
  plugins: [
    planhatPlugin({
      tenantUUID: "[your tenantUUID]",
    }),
  ],
})

Example

ES6 Modules

import { Analytics } from 'analytics'
import planhatPlugin  from 'analytics-plugin-planhat'

const analytics = Analytics({
  app: "[your app name]",
  plugins: [
    planhatPlugin({
      tenantUUID: "[your tenantUUID]",
    }),
  ],
})

Example

Methods

analytics.identify

Identify an user for which activities will be tracked.

analytics.identify([userId], {
  firstName: "[firstName]"",
  lastName: "[lastName]"",
  email: "[email]",
  companyExternalId:"[companyId]"
})
ArgumentDescription
userIdId for the Planhat user. If you want to identify users by mail pass null
emailEmail of the user. Either userId or email is required to identify the user. Provide an email if the userId is null.
firstNameFirstname of the Planhat user
lastNameLastname of the Planhat user
companyExternalIdExternalId of a company in Planhat, the company must exist in Planhat. Is required for the auto-creation of users.

analytics.track

Track an user activity for the identified user.

analytics.track([activity name], {
  [extraAttribute]: [value],
  ...
})
ArgumentDescription
activity nameName of the tracked user activity
extraAttributeAdd additional information about the user activity

If you only want to use this plugin:

analytics.track([activity name], 
  {
    [extraAttribute]:[value]
  },
  {
    plugins: {
      all: false,
      planhat: true
    }
  }
);

More

More information about the usage of the methods and additional options can be found at the original analytics package:

Powered By

1.0.9

10 months ago

1.0.8

11 months ago

1.0.7

11 months ago

1.0.6

11 months ago

1.0.5

11 months ago

1.0.4

11 months ago

1.0.3

11 months ago

1.0.2

11 months ago

1.0.1

11 months ago

1.0.0

11 months ago