We've created a set of resources to help you ensure your site remains available and accessible to all during the COVID-19 situation.

Method: records.queryRecord

Queries the Chrome User Experience for a single record for a given site.

Returns a record that contains one or more metrics corresponding to performance data about the requested site.

HTTP request

POST https://chromeuxreport.googleapis.com/v1/records:queryRecord

The URL uses gRPC Transcoding syntax.

Request body

The request body contains data with the following structure:

JSON representation
{
  "effectiveConnectionType": string,
  "formFactor": enum (FormFactor),
  "metrics": [
    string
  ],

  // Union field url_pattern can be only one of the following:
  "origin": string,
  "url": string
  // End of list of possible types for union field url_pattern.
}
Fields
effectiveConnectionType

string

The effective connection type is a query dimension that specifies the effective network class that the record's data should belong to. This field uses the values ["offline", "slow-2G", "2G", "3G", "4G"] as specified in: https://wicg.github.io/netinfo/#effective-connection-types

Note: If no effective connection type is specified, then a special record with aggregated data over all effective connection types will be returned.

formFactor

enum (FormFactor)

The form factor is a query dimension that specifies the device class that the record's data should belong to.

Note: If no form factor is specified, then a special record with aggregated data over all form factors will be returned.

metrics[]

string

The metrics that should be included in the response. If none are specified then any metrics found will be returned.

Allowed values: ["first_contentful_paint", "first_input_delay", "largest_contentful_paint", "cumulative_layout_shift"]

Union field url_pattern. The url pattern is the main identifier for a record lookup. It can be one of multiple types of values. url_pattern can be only one of the following:
origin

string

The url pattern "origin" refers to a url pattern that is the origin of a website.

Examples: "https://example.com", "https://cloud.google.com"

url

string

The url pattern "url" refers to a url pattern that is any arbitrary url.

Examples: "https://example.com/", "https://cloud.google.com/why-google-cloud/"

Response body

If successful, the response body contains data with the following structure:

Response payload sent back to a physical web client.

This response contains the record found based on the identiers present in a QueryRequest. The returned response will have a record, and sometimes details on normalization actions taken on the request that were necessary to make the request successful.

JSON representation
{
  "record": {
    object (Record)
  },
  "urlNormalizationDetails": {
    object (UrlNormalization)
  }
}
Fields
record

object (Record)

The record that was found.

urlNormalizationDetails

object (UrlNormalization)

These are details about automated normalization actions that were taken in order to make the requested url_pattern valid.

FormFactor

FormFactor enumerates the possible device-classes that a record can be aggregated on. This is a general classification of what type of device a user viewed a site on.

Enums
ALL_FORM_FACTORS The default value, representing all device classes.
PHONE The device class representing a "mobile"/"phone" sized client.
DESKTOP The device class representing a "desktop"/"laptop" type full size client.
TABLET The device class representing a "tablet" type client.

Record

Record is a single Chrome UX report data record. It contains use experience statistics for a single url pattern and set of dimensions.

JSON representation
{
  "key": {
    object (Key)
  },
  "metrics": {
    string: {
      object(Metric)
    },
    ...
  }
}
Fields
key

object (Key)

Key defines all of the unique querying parameters needed to look up a user experience record.

metrics

map (key: string, value: object (Metric))

Metrics is the map of user experience data available for the record defined in the key field. Metrics are keyed on the metric name.

Allowed key values: ["first_contentful_paint", "first_input_delay", "largest_contentful_paint", "cumulative_layout_shift"]

An object containing a list of "key": value pairs. Example: { "name": "wrench", "mass": "1.3kg", "count": "3" }.

Key

Key defines all the dimensions that identify this record as unique.

JSON representation
{
  "formFactor": enum (FormFactor),
  "effectiveConnectionType": string,

  // Union field url_pattern can be only one of the following:
  "origin": string,
  "url": string
  // End of list of possible types for union field url_pattern.
}
Fields
formFactor

enum (FormFactor)

The form factor is the device class that all users used to access the site for this record.

If the form factor is unspecified, then aggregated data over all form factors will be returned.

effectiveConnectionType

string

The effective connection type is the general connection class that all users experienced for this record. This field uses the values ["offline", "slow-2G", "2G", "3G", "4G"] as specified in: https://wicg.github.io/netinfo/#effective-connection-types

If the effective connection type is unspecified, then aggregated data over all effective connection types will be returned.

Union field url_pattern. The url pattern is the url that the record applies to. url_pattern can be only one of the following:
origin

string

Origin specifies the origin that this record is for.

Note: When specifying an origin, data for loads under this origin over all pages are aggregated into origin level user experience data.

url

string

Url specifies a specific url that this record is for.

Note: When specifying a "url" only data for that specific url will be aggregated.

UrlNormalization

Object representing the normalization actions taken to normalize a url to achieve a higher chance of successful lookup. These are simple automated changes that are taken when looking up the provided url_patten would be known to fail. Complex actions like following redirects are not handled.

JSON representation
{
  "originalUrl": string,
  "normalizedUrl": string
}
Fields
originalUrl

string

The original requested URL prior to any normalization actions.

normalizedUrl

string

The URL after any normalization actions. This is a valid user experience URL that could reasonably be looked up.