Documentation / Collect Chrome User Experience Report (CrUx)

Collect Chrome User Experience Report

Get CrUx data

sitespeed.io has a CrUx plugin that can collect data from the Chrome User Experience Report API. To do that you need a CrUx API key that you can get from Google (click on the Get a Key button). Once you have the key, you can get CrUx data using sitespeed.io.

sitespeed.io --crux.key $CRUX_API_KEY https://www.sitespeed.io

If you send the data to Graphite you want to push the data to its own namespace --graphite.namespace sitespeedio.crux, and you probably want to separate the data from your sitespeed.io data, so you can disable Browsertime and do one run just to get the CrUx data. CrUx data doesn't change that often, so you can just run it once per day.

The plugin collects data for the specific URL that you test AND for the origin (domain).

Here's a full example of getting CrUx data, disabling Browsertime for that run, and sending the data to the namespace sitespeedio.crux:

sitespeed.io --crux.key $CRUX_API_KEY --plugins.remove browsertime --graphite.namespace sitespeedio.crux https://www.sitespeed.io

You will get a new tab in your result HTML with the CrUx data.

Form factor

The CrUx data has four different buckets depending on device: DESKTOP, PHONE, TABLET and ALL. You can choose which data to get with --crux.formFactor. Getting only phone data: --crux.formFactor PHONE. If you want to collect data for multiple form factors, add --crux.formFactor multiple times.

sitespeed.io --crux.key $CRUX_API_KEY --crux.formFactor PHONE --crux.formFactor ALL https://www.sitespeed.io

Collect URL or origin data or both

You can choose to collect data only for a specific URL, for the origin (domain), or for both (using ALL). Use the switch --crux.collect. By default both URL and origin data are collected.

Let's collect only origin data:

sitespeed.io --crux.key $CRUX_API_KEY --crux.collect ORIGIN https://www.sitespeed.io

Limitations

You can not get CrUx data if you use scripting.