Socket
Socket
Sign inDemoInstall

usage-stats

Package Overview
Dependencies
Maintainers
1
Versions
35
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

usage-stats

usage-stats


Version published
Weekly downloads
1.7K
increased by53.65%
Maintainers
1
Weekly downloads
 
Created
Source

view on npm npm module downloads Build Status Dependency Status js-standard-style

usage-stats

A minimal Google Analytics Measurement Protocol client for tracking usage statistics in node.js apps.

const UsageStats = require('usage-stats')
const usageStats = new UsageStats({
  appName: 'sick app',
  version: '1.0.0',
  tid: 'UA-98765432-1'
})

// start a new session
usageStats.start()

// user set an option..
usageStats.event('option', 'verbose-level', 'infinite')

// app is running in 'encoding' mode..
usageStats.screenView('encoding')

// finished, send stats and mark the session as complete
usageStats.send().end()

usage-stats

Example

const UsageStats = require('usage-stats')

UsageStats ⏏

Kind: Exported class

new UsageStats([options])
ParamTypeDescription
[options]object
[options.appName]stringApp name
[options.version]stringApp version

usageStats.start() ↩︎

Starts the session.

Kind: instance method of UsageStats
Chainable

usageStats.end() ↩︎

Ends the session.

Kind: instance method of UsageStats
Chainable

usageStats.disable() ↩︎

Disable the module. While disabled, all operations are no-ops.

Kind: instance method of UsageStats
Chainable

usageStats.enable() ↩︎

Re-enable the module.

Kind: instance method of UsageStats
Chainable

usageStats.event(category, action, [label], [value]) ↩︎

Track an event. All event hits are queued until .send() is called.

Kind: instance method of UsageStats
Chainable

ParamTypeDescription
categorystringEvent category
actionstringEvent action
[label]stringEvent label
[value]stringEvent value

usageStats.screenView(name) ↩︎

Track a screenview. All screenview hits are queued until .send() is called.

Kind: instance method of UsageStats
Chainable

ParamTypeDescription
namestringScreen name

usageStats.send() ↩︎

Send queued hits. If offline, the hits will be stored and re-tried on next invocation.

Kind: instance method of UsageStats
Chainable


© 2016 Lloyd Brookes <75pound@gmail.com>. Documented by jsdoc-to-markdown.

FAQs

Package last updated on 08 Aug 2016

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc