Metrics
Extends:
Metrics Class - Provides access to the Mux Data Metrics API
Example:
const muxClient = new Mux(accessToken, secret);
const { Data } = muxClient;
// List all of the values across every breakdown for a specific metric grouped by operating system
Data.Metrics.breakdown('aggregate_startup_time', { group_by: 'operating_system' });
Method Summary
Public Methods | ||
public |
List the breakdown values for a specific metric |
|
public |
comparison(params: Object): Promise List all of the values across every breakdown for a specific metric |
|
public |
Returns a list of insights for a metric. |
|
public |
Returns the overall value for a specific metric, as well as the total view count, watch time, and the Mux Global metric value for the metric. |
|
public |
timeseries(metricId: string, params: Object): Promise Returns timeseries data for a specific metric |
Public Methods
public breakdown(metricId: string, params: Object): Promise source
List the breakdown values for a specific metric
Params:
Name | Type | Attribute | Description |
metricId | string | The metric name/id for see https://api-docs.mux.com/#breakdown-get for a list of all metric ids |
|
params | Object | example: {group_by: 'browser'} NOTE: the group_by query parameter is required |
Example:
const muxClient = new Mux(accessToken, secret);
const { Data } = muxClient;
// List all of the values across every breakdown for a specific metric grouped by browser
Data.Metrics.breakdown('aggregate_startup_time', { group_by: 'browser' });
public comparison(params: Object): Promise source
List all of the values across every breakdown for a specific metric
Params:
Name | Type | Attribute | Description |
params | Object | example { value: 'safari', timeframe: '24:hours', dimension: 'cdn' } |
Example:
const muxClient = new Mux(accessToken, secret);
const { Data } = muxClient;
// List the breakdown values for a specific metric within the last 24 hours
Data.Metrics.comparison({ value: 'safari', timeframe: '24:hours', dimension: 'cdn' });
Note: the value query parameter is required
Test:
public insights(metricId: string, params: Object): Promise source
Returns a list of insights for a metric. These are the worst performing values across all breakdowns sorted by how much they negatively impact a specific metric.
Params:
Name | Type | Attribute | Description |
metricId | string | The metric name/id for see https://api-docs.mux.com/#breakdown-get for a list of all metric ids |
|
params | Object |
|
example { measurement: 'median', order_direction: 'desc' } |
Example:
const muxClient = new Mux(accessToken, secret);
const { Data } = muxClient;
// Get a list of insights for a metric measured by median and ordered descending
Data.Metrics.insights('aggregate_startup_time', { measurement: 'median', order_direction: 'desc' });
Test:
public overall(metricId: string, params: Object): Promise source
Returns the overall value for a specific metric, as well as the total view count, watch time, and the Mux Global metric value for the metric.
Params:
Name | Type | Attribute | Description |
metricId | string | The metric name/id for see https://api-docs.mux.com/#overall-get for a list of all metric ids |
|
params | Object |
|
example { timeframe: ['7:days'], filters: ['operating_system:windows'] } |
Example:
const muxClient = new Mux(accessToken, secret);
const { Data } = muxClient;
// Get the overall value for a specific metric within the past 7 days
Data.Metrics.overall('aggregate_startup_time', { timeframe: ['7:days'] });
Test:
public timeseries(metricId: string, params: Object): Promise source
Returns timeseries data for a specific metric
Params:
Name | Type | Attribute | Description |
metricId | string | The metric name/id for see https://api-docs.mux.com/#timeseries for a list of all metric ids |
|
params | Object |
|
example { timeframe: ['7:days'], filters: ['operating_system:windows'] } |
Example:
const muxClient = new Mux(accessToken, secret);
const { Data } = muxClient;
// Get timeseries data for a specific metric within the past 7 days
Data.Metrics.timeseries('aggregate_startup_time', { timeframe: ['7:days'] });