Socket
Socket
Sign inDemoInstall

app-usage-stats

Package Overview
Dependencies
Maintainers
1
Versions
16
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

app-usage-stats

A convention for tracking javascript application usage


Version published
Weekly downloads
798
increased by38.3%
Maintainers
1
Weekly downloads
 
Created

Readme

Source

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

app-usage-stats

A convention for tracking javascript application usage, making full use of custom dimensions and metrics.

Example

const UsageStats = require('app-usage-stats')
const stats = new UsageStats('UA-987654321')

AppUsageStats ⇐ UsageStats

Kind: Exported class
Extends: UsageStats

new AppUsageStats(tid, [options])
ParamTypeDescription
tidstringGoogle Analytics tracking ID
[options]object
[options.dimensionMap]objectA custom dimension name to ID Map.
[options.metricMap]objectA custom metric name to ID Map.
[options.sendInterval]objectIf specified, stats will be sent no more frequently than this period.

usage.unsent : Array.<object>

Stats not yet sent.

Kind: instance property of AppUsageStats

usage.sent : Array.<object>

Stats sent.

Kind: instance property of AppUsageStats

usage.queuePath : string

Queued stats path. Defaults to ~/.usage-stats/${trackingId}-unsent.json.

Kind: instance property of AppUsageStats

usage.hit(dimension, metric, [options])

Track a hit. The magic dimension name will be mapped to a GA screenView.

Kind: instance method of AppUsageStats

ParamTypeDescription
dimensionArray.<object>dimension-value maps
metricArray.<object>metric-value maps
[options]object
[options.timeout]numberA maxium wait period in ms, after which any pending requests will be aborted.
[options.send]numberEach hit will be sent.

usage.save()

Save stats

Kind: instance method of AppUsageStats

usage.saveSync()

Save stats sync.

Kind: instance method of AppUsageStats

usage.load()

Load stats

Kind: instance method of AppUsageStats

usage.loadSync()

Loads stats sync.

Kind: instance method of AppUsageStats

usage.send([options])

Send and reset stats.

Kind: instance method of AppUsageStats

ParamTypeDescription
[options]object
[options.timeout]numberA maxium wait period in ms, after which any pending requests will be aborted.

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

FAQs

Package last updated on 10 Feb 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

SocketSocket SOC 2 Logo

Product

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

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc