Lazy-loaded LCP images by WordPress Version

Of the LCP elements in the September 2022 crawl that were IMG elements with native lazy loading (loading=lazy), How many were from WordPress and what was the WordPress version breakdown?

WP Version Count
“6.0.2” 92901
“” 87627
“5.8.5” 16865
“5.9.4” 15232
“6.0.1” 13911
“5.7.7” 8807
“5.5.10” 5421
“5.6.9” 5054
“5.9.3” 3806
“6.0” 2691

It looks like WordPress is over half of all of the lazy-loaded LCP image elements and of those, the vast majority are on the latest version (6.0.2 as of September).

Query:

#standardSQL

CREATE TEMP FUNCTION getLoadingAttr(attributes STRING) RETURNS STRING LANGUAGE js AS '''
  try {
    const data = JSON.parse(attributes);
    const loadingAttr = data.find(attr => attr["name"] === "loading")
    return loadingAttr.value
  } catch (e) {
    return "";
  }
''';


WITH
lcp_stats AS (
  SELECT
    url,
    JSON_EXTRACT_SCALAR(payload, '$._performance.lcp_elem_stats.nodeName') AS nodeName,
    JSON_EXTRACT_SCALAR(payload, '$._performance.lcp_elem_stats.url') AS elementUrl,
    JSON_EXTRACT(payload, '$._performance.lcp_elem_stats.attributes') AS attributes,
    JSON_EXTRACT(payload, '$._detected_apps.WordPress') as wpVersion,
    getLoadingAttr(JSON_EXTRACT(payload, '$._performance.lcp_elem_stats.attributes')) AS loading,
  FROM
    `httparchive.pages.2022_09_01_desktop`
)

SELECT
  wpVersion,
  COUNT(wpVersion)
FROM
  lcp_stats
WHERE
  nodeName = 'IMG' AND
  loading = 'lazy'
GROUP BY
  wpVersion
ORDER BY
  COUNT(wpVersion) desc

Sorry Pat, but I think the query is incorrect. Specifically the COUNT(wpVersion) bit which won’t count the distinct nulls (i.e. when WordPress is not used by the site) and instead just give a 1 for all of them.

If you change that to COUNT(0) (and also the ORDER BY clause similarly) you get different figures:

wpVersion num_pages pct_pages
(null) 106,071 28.26%
6.0.2 92,901 24.76%
87,627 23.35%
5.8.5 16,865 4.49%
5.9.4 15,232 4.06%
6.0.1 13,911 3.71%
5.7.7 8,807 2.35%
5.5.10 5,421 1.44%
5.6.9 5,054 1.35%
5.9.3 3,806 1.01%
6.0 2,691 0.72%

It’s still a lot for the latest version (a quarter of all lazy loaded LCP images!), but not as high as you thought.

Latest SQL (with pct):

CREATE TEMP FUNCTION getLoadingAttr(attributes STRING) RETURNS STRING LANGUAGE js AS '''
  try {
    const data = JSON.parse(attributes);
    const loadingAttr = data.find(attr => attr["name"] === "loading")
    return loadingAttr.value
  } catch (e) {
    return "";
  }
''';


WITH
lcp_stats AS (
  SELECT
    url,
    JSON_EXTRACT_SCALAR(payload, '$._performance.lcp_elem_stats.nodeName') AS nodeName,
    JSON_EXTRACT_SCALAR(payload, '$._performance.lcp_elem_stats.url') AS elementUrl,
    JSON_EXTRACT(payload, '$._performance.lcp_elem_stats.attributes') AS attributes,
    JSON_EXTRACT(payload, '$._detected_apps.WordPress') as wpVersion,
    getLoadingAttr(JSON_EXTRACT(payload, '$._performance.lcp_elem_stats.attributes')) AS loading,
  FROM
    `httparchive.pages.2022_09_01_desktop`
)

SELECT
  wpVersion,
  COUNT(0) AS num_pages,
  COUNT(0) / SUM(COUNT(0)) OVER () AS pct_pages
FROM
  lcp_stats
WHERE
  nodeName = 'IMG' AND
  loading = 'lazy'
GROUP BY
  wpVersion
ORDER BY
  COUNT(0) desc
1 Like

Thanks @tunetheweb - I should know better than to try.

Somewhere between 25% and 50% depending on how many of the “WordPress but version is unknown” are also on the latest.