Skip to content

Commit

Permalink
Resource Hints queries - added imgLazy (#2451)
Browse files Browse the repository at this point in the history
* Added imgLazy

* Apply suggestions from code review

Co-authored-by: Rick Viscomi <[email protected]>
  • Loading branch information
kevinfarrugia and rviscomi authored Nov 8, 2021
1 parent 0416e8f commit d693117
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions sql/2021/resource-hints/imgLazy.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#standardSQL
SELECT
SUBSTR(_TABLE_SUFFIX, 0, 10) AS date,
IF(ENDS_WITH(_TABLE_SUFFIX, 'desktop'), 'desktop', 'mobile') AS client,
COUNT(DISTINCT IF(LOWER(attr) = '"lazy"', url, NULL)) / COUNT(DISTINCT url) AS percent
FROM
`httparchive.pages.*`
LEFT JOIN
UNNEST(JSON_EXTRACT_ARRAY(JSON_EXTRACT_SCALAR(payload, "$['_img-loading-attr']"), '$')) AS attr
GROUP BY
date,
client
ORDER BY
date DESC,
client

0 comments on commit d693117

Please sign in to comment.