Skip to main content

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

ParamTypeDefaultDescription
eventTypeEVENT_TYPE | stringThe 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.
eventCategorystringThe kind of Event Category that needs to be logged- should be a js var compatible string
eventSubCategorystringThe kind of Event Sub Category that needs to be logged- should be a js var compatible string
[count]number1>=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

ParamTypeDescription
eventTypeEVENT_TYPE | stringThe 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.
eventCategorystringThe kind of Event Category that needs to be logged- should be a js var compatible string
eventSubCategorystringThe kind of Event Sub Category that needs to be logged- should be a js var compatible string
valuenumber

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

ParamTypeDescription
actionstringThe key representing the action being measured (e.g., 'startupTime').
durationMsnumberThe 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