Skip to content

npm package

Terminal window
npm install @plaintrace/browser
import { init, track } from '@plaintrace/browser'
init({ site: '<site id>', endpoint: 'https://collect.plaintrace.dev' })
track('signup', { plan: 'pro' })
  • init() returns undefined during server-side rendering, so it is safe to call in shared code.
  • It is safe to call more than once, and returns the tracker the script tag started if there is one.
  • Every option of the script tag is available as a field: requireConsent, respectGpc, respectDnt, storage, excludePaths, debug and pageUrl.

The package is MIT-licensed; the source is on GitHub.