Metrics
Import :
brackets.getModule("utils/Metrics")
utils/Metrics
The Metrics API can be used to send analytics data to track feature usage in accordance with users privacy settings.
Status: Internal - Not to be used by third party extensions.
Import
Example
// usage within core:
const Metrics = require("utils/Metrics");
// usage within default extensions:
const Metrics = brackets.getModule("utils/Metrics");
utils/Metrics.API
This section outlines the properties and methods available in this module
Kind: inner property of utils/Metrics
utils/Metrics.countEvent(eventType, eventCategory, eventSubCategory, [count]) : function
log a numeric count >=0 To log that user clicked searchButton 5 times: Metrics.countEvent(Metrics.EVENT_TYPE.UI, "searchButton", "click"); Metrics.countEvent(Metrics.EVENT_TYPE.UI, "searchButton", "click", 5);
Kind: inner method of utils/Metrics
Param | Type | Default | Description |
---|---|---|---|
eventType | EVENT_TYPE | string | The kind of Event Type that needs to be logged- should be a js var compatible string. Some standard event types are available as EVENT_TYPE . | |
eventCategory | string | The kind of Event Category that needs to be logged- should be a js var compatible string | |
eventSubCategory | string | The kind of Event Sub Category that needs to be logged- should be a js var compatible string | |
[count] | number | 1 | >=0 , optional, if not set defaults to 1 |
utils/Metrics.valueEvent(eventType, eventCategory, eventSubCategory, value) : function
log a numeric value (number). To log that startup time is 200ms: Metrics.valueEvent(Metrics.EVENT_TYPE.PERFORMANCE, "startupTime", "ms", 200);
Kind: inner method of utils/Metrics
Param | Type | Description |
---|---|---|
eventType | EVENT_TYPE | string | The kind of Event Type that needs to be logged- should be a js var compatible string. some standard event types are available as EVENT_TYPE . |
eventCategory | string | The kind of Event Category that needs to be logged- should be a js var compatible string |
eventSubCategory | string | The kind of Event Sub Category that needs to be logged- should be a js var compatible string |
value | number |
utils/Metrics.flushMetrics()
Send all pending metrics, useful before app quit. Will never throw Error.
Kind: inner method of utils/Metrics
utils/Metrics.logPerformanceTime(action, durationMs)
Logs the performance time taken for a specific action.
Kind: inner method of utils/Metrics
Param | Type | Description |
---|---|---|
action | string | The key representing the action being measured (e.g., 'startupTime'). |
durationMs | number | The duration of the action in milliseconds. |
utils/Metrics.EVENT_TYPE : Object
The Type of events that can be specified as an eventType
in the API calls.
Properties
PLATFORM
, PROJECT
, THEMES
, EXTENSIONS
, EXTENSIONS
, UI
, UI_DIALOG
, UI_BOTTOM_PANEL
,
UI_SIDE_PANEL
, LIVE_PREVIEW
, CODE_HINTS
, EDITOR
, SEARCH
, SHARING
, PERFORMANCE
, NEW_PROJECT
Kind: inner typedef of utils/Metrics