0.5.1 • Published 7 years ago

app-usage-stats v0.5.1

Weekly downloads
1,679
License
MIT
Repository
github
Last release
7 years ago

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
optionsobject
options.dimensionMapobjectA custom dimension name to ID Map.
options.metricMapobjectA custom metric name to ID Map.
options.sendIntervalobjectIf 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
optionsobject
options.timeoutnumberA maxium wait period in ms, after which any pending requests will be aborted.
options.sendnumberEach 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
optionsobject
options.timeoutnumberA 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.

0.5.1

7 years ago

0.5.0

7 years ago

0.4.1

7 years ago

0.4.0

7 years ago

0.3.6

8 years ago

0.3.5

8 years ago

0.3.4

8 years ago

0.3.3

8 years ago

0.3.2

8 years ago

0.3.1

8 years ago

0.3.0

8 years ago

0.2.1

8 years ago

0.2.0

8 years ago

0.1.0

8 years ago

0.0.1

8 years ago

0.0.0

8 years ago