@bufferapp/buffer-tracking

0.0.1 • Public • Published

buffer-tracking-app-js

Strongly-typed analytics app for use in JavaScript projects

This app is hosted as a private package for Buffer. You can install this by running:

npm install @bufferapp/buffer-tracking-js

Next you'll need to add the typewriter import to the desired file:

import typewriter from 'buffer-tracking-js'

With the dependency added, you can use the typewriter reference to call the desired tracking functions:

typewriter.draftSubmitted({
  product: 'publish',
  channel: 'instagram',
  channelType: 'business',
  postId: '58edaj782102dff',
  channelId: '12345679',
  channelServiceId: '987654567898'
})

When calling these functions, any violations or errors will be logged as warnings to your console. if you wish for these to throw errors (maybe during development), then you can configure options on the typewriter reference to enable this:

typewriter.setTypewriterOptions({
  onViolation: (msg, violations) => {
    const issues = violations.map(v => v.keyword === 'type' ? `${v.message}: '${v.dataPath}'` : `${v.message}`)
    throw new Error(
      `"${msg.event}" Fired with Tracking Plan Violation\n    ${issues.join('\n    ')}`
    )
  }
})

Readme

Keywords

Package Sidebar

Install

npm i @bufferapp/buffer-tracking

Weekly Downloads

1

Version

0.0.1

License

ISC

Unpacked Size

559 kB

Total Files

7

Last publish

Collaborators

  • davidluhr
  • egomezd
  • jacobchadwell
  • philippemiguet
  • josemdev
  • msanroman
  • daisymarie128
  • hamstu
  • stevenc81
  • bufferbot
  • mayauribe
  • esclapes
  • ay8s
  • mickmahady
  • dinostheo
  • hitherejoe
  • dace
  • erickhun
  • kmbriseno
  • kiriappeee
  • cmunozgar
  • peteremilbuffer
  • arekpn
  • abeeb
  • buffermw