app-usage-stats
A convention for tracking javascript application usage.
Example
const UsageStats = require('app-usage-stats')
const stats = new UsageStats('UA-987654321', 'app-name')
AppUsageStats ⏏
Kind: Exported class
new AppUsageStats(tid, [options])
Param | Type | Description |
---|
tid | string | Google Analytics tracking ID |
[options] | object | |
[options.dimensionMap] | object | A custom dimension name to ID Map. |
[options.metricMap] | object | A custom metric name to ID Map. |
[options.sendInterval] | object | If specified, stats will be sent no more frequently than this period. |
stats.unsent : Array.<object>
Current totals not yet sent
Kind: instance property of AppUsageStats
stats.sent : Array.<object>
Current totals not yet sent
Kind: instance property of AppUsageStats
stats.queuePath : string
Queued stats path
Kind: instance property of AppUsageStats
stats.hit(dimension, metric, [options])
Track a hit. The magic dimension name
will be mapped to a GA screenView.
Kind: instance method of AppUsageStats
Param | Type | Description |
---|
dimension | Array.<object> | dimension-value maps |
metric | Array.<object> | metric-value maps |
[options] | object | |
[options.timeout] | number | A maxium wait period in ms, after which any pending requests will be aborted. |
stats.save()
Save stats
Kind: instance method of AppUsageStats
stats.saveSync()
Save stats sync.
Kind: instance method of AppUsageStats
stats.load()
Load stats
Kind: instance method of AppUsageStats
stats.loadSync()
Loads stats sync.
Kind: instance method of AppUsageStats
stats.send([options])
Send and reset stats.
Kind: instance method of AppUsageStats
Param | Type | Description |
---|
[options] | object | |
[options.timeout] | number | A maxium wait period in ms, after which any pending requests will be aborted. |
© 2016 Lloyd Brookes <75pound@gmail.com>. Documented by jsdoc-to-markdown.