Metrics API
phoenixide edited this page Feb 3, 2024
·
4 revisions
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.
// usage within core:
const Metrics = require("utils/Metrics");
// usage within default extensions:
const Metrics = brackets.getModule("utils/Metrics");
This section outlines the properties and methods available in this module
The Type of events that can be specified as an eventType
in the API calls.
PLATFORM
, PROJECT
, THEMES
, EXTENSIONS
, EXTENSIONS
, UI
, UI_DIALOG
, UI_BOTTOM_PANEL
,
UI_SIDE_PANEL
, LIVE_PREVIEW
, CODE_HINTS
, EDITOR
, SEARCH
, SHARING
, PERFORMANCE
, NEW_PROJECT
Type: Object
log a numeric count >=0
Type: function
-
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 asEVENT_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 > =0 , optional, if not set defaults to 1 (optional, default1
)
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);
log a numeric value (number).
Type: function
-
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 asEVENT_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
To log that startup time is 200ms:
Metrics.valueEvent(Metrics.EVENT_TYPE.PERFORMANCE, "startupTime", "ms", 200);
Send all pending metrics, useful before app quit. Will never throw Error.