Search code examples
google-apicore-web-vitals

How to get list of page URLs with bad metrics Core Web Vitals from Google Search Console via API or other Google API?


How to get list of page URLs with bad metrics Core Web Vitals from Google Search Console via API or other Google API ?

There is a report https://search.google.com/search-console/core-web-vitals/drilldown which contains only some sample pages with problematic CLS (not a complete list of pages is displayed). How can I get a complete list of problem pages via API?

I tried to use https://developers.google.com/webmaster-tools/v1/searchanalytics/query?apix_params=%7B%22siteUrl%22%3A%22https%3A%2F%2Fwww.example.com%22%2C%22resource%22%3A%7B%22startDate%22%3A%222022-03-09%22%2C%22endDate%22%3A%222022-03-14%22%2C%22dimensions%22%3A%5B%22PAGE%22%5D%7D%7D , but that API not returns Core Web Vitals metrics


Solution

  • As you noted, Search Console only provides a limited list of sample URLs and the API doesn't include Core Web Vitals data.

    There are a couple of ways to figure out which pages have poor CWV:

    1. Measure CWV on your website directly (see web-vitals.js) and use an analytics service to aggregate the data by page.

    2. Get a list of every URL on the website and query each one using the CrUX API. A tool like this can automatically crawl your sitemap and write the CWV results to a spreadsheet.