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 button Get a Key). When 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 changes doesn’t change so often so you can just run it once per day.
The plugin collect data for the specific URL that you test AND the origin (domain).
Here’s a full example of getting CrUx data, disable browsertime for that run and send 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 specific only for a URL, for the origin (domain) or for both of them (using ALL). Use the switch --crux.collect
. By default both URL and origin data is collected.
Lets 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.