Socket
Book a DemoInstallSign in
Socket

microanalytics

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

microanalytics

Capture analytics events in the browser

latest
Source
npmnpm
Version
1.0.1
Version published
Maintainers
1
Created
Source

microanalytics stability

npm version build status downloads js-standard-style

Capture analytics events in the browser. Uses window.navigator.sendBeacon() to send data down with the least priority.

Friendly reminder not to ever store people's IP addresses. Only store the minimum amount of data needed to inform decisions. Be kind, don't give analytics a bad name.

Usage

var microanalytics = require('microanalytics')
var analytics = microanalytics('https://analytics.my-app.com')

analytics.append({
  type: 'navigation'
  route: '/my-route'
})

analytics.append({
  type: 'navigation'
  route: '/my-other-route'
})

var tx = analytics.batch()
tx.append({
  type: 'video',
  data: {
    offset: 1225,
    buf: 20
  }
})

tx.append({
  type: 'video',
  data: {
    offset: 15,
    buf: 26
  }
})

tx.flush()

analytics = microanalytics(url, [defaultArgs])

Create a new analytics instance. Takes a url and optional default options which are always sent down.

analytics.append(data)

Send new data down to the analytics API.

transaction = analytics.batch

Create a new transaction. Transaction data will be sent as an array of data once it's flushed.

transaction.append(data)

Append new data to the transaction.

transaction.flush()

End the transaction.

See Also

License

MIT

Keywords

timing

FAQs

Package last updated on 31 Aug 2017

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts