As of the June 1 mobile crawl, Lighthouse reports are now available in the HAR dataset on BigQuery.
As an example, let's find out how many sites are still using
document.write in their JS.
We'll start writing our query to use the
httparchive:har.latest_lighthouse_mobile table, which automatically matches the most recent results as new crawls complete. Since the data is in JSON format, we'll use
JSON_EXTRACT_SCALAR to pluck out a piece of data using its address in the JSON object. So for this particular audit score, the address is:
$ represents the root of the JSON object and each dot-notation property is a deeper level in the object.
So here's the full query to get a breakdown of scores for this particular audit:
JSON_EXTRACT_SCALAR(report, "$.audits.no-document-write.score") AS score,
COUNT(0) AS volume
report IS NOT NULL
score IS NOT NULL
Run it on BigQuery
The results are split pretty evenly:
So about half of the pages crawled by HTTP Archive are still using
document.write. The best part of it all is that we get to watch these metrics update every couple of weeks and monitor how the web is changing.
Feel free to comment in this thread if you've got any other interesting findings from the Lighthouse data.