Skip to content

Commit cd42e2f

Browse files
tunethewebamandeepsinghvirdigithub-actions[bot]
authored
Ecommerce 2025 chapter (#4350)
* chore(config): enable ecommerce chapter * chore(contributors): add Amandeep Singh * chore(config): update ecommerce publish date * feat(ecommerce): refresh 2025 chapter content * chore(ecommerce): align 2025 metadata * Initial edit * Take images * Optimised images with calibre/image-actions * More edits * Update ecommerce adoption and platform share stats * Refresh ecommerce CWV and Lighthouse data * Update payment provider figures and tables * Ecommerce 2025 SQL queries (#4354) * Add 2025 ecommerce SQL queries * Update to July --------- Co-authored-by: Amandeep Singh <amandeepsinghvirdi@gmail.com> * Fix queries for 2025 * More queries * Update more numbers to July * More table updates * docs: clarify Lighthouse comparison limitations in ecommerce guide * docs: update ecommerce stats to display as percentages instead of absolute numbers * Update date * Add doi * Final edits * Retake images * Add one more query * Optimised images with calibre/image-actions * Update featured stats * Optimised images with calibre/image-actions --------- Co-authored-by: Amandeep Singh <amandeepsinghvirdi@gmail.com> Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
1 parent 06ca94e commit cd42e2f

20 files changed

+2032
-17
lines changed
Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
#standardSQL
2+
# CrUX Core Web Vitals performance of Ecommerce vendors by device (fid was upated to inp, and is non optinal now)
3+
CREATE TEMP FUNCTION IS_GOOD(good FLOAT64, needs_improvement FLOAT64, poor FLOAT64) RETURNS BOOL AS (
4+
good / (good + needs_improvement + poor) >= 0.75
5+
);
6+
7+
CREATE TEMP FUNCTION IS_NON_ZERO(good FLOAT64, needs_improvement FLOAT64, poor FLOAT64) RETURNS BOOL AS (
8+
good + needs_improvement + poor > 0
9+
);
10+
11+
12+
SELECT
13+
date,
14+
client,
15+
ecomm,
16+
COUNT(DISTINCT origin) AS origins,
17+
# Origins with good LCP divided by origins with any LCP.
18+
SAFE_DIVIDE(
19+
COUNT(DISTINCT IF(IS_GOOD(fast_lcp, avg_lcp, slow_lcp), origin, NULL)),
20+
COUNT(DISTINCT IF(IS_NON_ZERO(fast_lcp, avg_lcp, slow_lcp), origin, NULL))
21+
) AS pct_good_lcp,
22+
23+
# Origins with good INP divided by origins with any inp.
24+
SAFE_DIVIDE(
25+
COUNT(DISTINCT IF(IS_GOOD(fast_inp, avg_inp, slow_inp), origin, NULL)),
26+
COUNT(DISTINCT IF(IS_NON_ZERO(fast_inp, avg_inp, slow_inp), origin, NULL))
27+
) AS pct_good_inp,
28+
29+
# Origins with good CLS divided by origins with any CLS.
30+
SAFE_DIVIDE(
31+
COUNT(DISTINCT IF(IS_GOOD(small_cls, medium_cls, large_cls), origin, NULL)),
32+
COUNT(DISTINCT IF(IS_NON_ZERO(small_cls, medium_cls, large_cls), origin, NULL))
33+
) AS pct_good_cls,
34+
35+
# Origins with good LCP, inp, and CLS divided by origins with any LCP, inp, and CLS.
36+
SAFE_DIVIDE(
37+
COUNT(DISTINCT IF(
38+
IS_GOOD(fast_lcp, avg_lcp, slow_lcp) AND
39+
IS_GOOD(fast_inp, avg_inp, slow_inp) AND
40+
IS_GOOD(small_cls, medium_cls, large_cls), origin, NULL
41+
)),
42+
COUNT(DISTINCT IF(
43+
IS_NON_ZERO(fast_lcp, avg_lcp, slow_lcp) AND
44+
IS_NON_ZERO(fast_inp, avg_inp, slow_inp) AND
45+
IS_NON_ZERO(small_cls, medium_cls, large_cls), origin, NULL
46+
))
47+
) AS pct_good_cwv
48+
FROM
49+
`chrome-ux-report.materialized.device_summary`
50+
JOIN (
51+
SELECT DISTINCT
52+
date,
53+
client,
54+
root_page,
55+
tech.technology AS ecomm
56+
FROM
57+
`httparchive.crawl.pages`,
58+
UNNEST(technologies) AS tech,
59+
UNNEST(tech.categories) AS category
60+
WHERE
61+
date = '2025-07-01' AND
62+
category = 'Ecommerce' AND
63+
(
64+
tech.technology != 'Cart Functionality' AND
65+
tech.technology != 'Google Analytics Enhanced eCommerce'
66+
)
67+
)
68+
ON
69+
CONCAT(origin, '/') = root_page AND
70+
IF(device = 'desktop', 'desktop', 'mobile') = client AND
71+
date
72+
WHERE
73+
date = '2025-07-01'
74+
GROUP BY
75+
client,
76+
ecomm
77+
ORDER BY
78+
origins DESC
Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
#standardSQL
2+
# CrUX Core Web Vitals performance of Ecommerce vendors by device (fid was upated to inp, and is non optinal now)
3+
CREATE TEMP FUNCTION IS_GOOD(good FLOAT64, needs_improvement FLOAT64, poor FLOAT64) RETURNS BOOL AS (
4+
good / (good + needs_improvement + poor) >= 0.75
5+
);
6+
7+
CREATE TEMP FUNCTION IS_NON_ZERO(good FLOAT64, needs_improvement FLOAT64, poor FLOAT64) RETURNS BOOL AS (
8+
good + needs_improvement + poor > 0
9+
);
10+
11+
12+
SELECT
13+
client,
14+
ecomm,
15+
COUNT(DISTINCT origin) AS origins,
16+
# Origins with good LCP divided by origins with any LCP.
17+
SAFE_DIVIDE(
18+
COUNT(DISTINCT IF(IS_GOOD(fast_lcp, avg_lcp, slow_lcp), origin, NULL)),
19+
COUNT(DISTINCT IF(IS_NON_ZERO(fast_lcp, avg_lcp, slow_lcp), origin, NULL))
20+
) AS pct_good_lcp,
21+
22+
# Origins with good INP divided by origins with any inp.
23+
SAFE_DIVIDE(
24+
COUNT(DISTINCT IF(IS_GOOD(fast_inp, avg_inp, slow_inp), origin, NULL)),
25+
COUNT(DISTINCT IF(IS_NON_ZERO(fast_inp, avg_inp, slow_inp), origin, NULL))
26+
) AS pct_good_inp,
27+
28+
# Origins with good CLS divided by origins with any CLS.
29+
SAFE_DIVIDE(
30+
COUNT(DISTINCT IF(IS_GOOD(small_cls, medium_cls, large_cls), origin, NULL)),
31+
COUNT(DISTINCT IF(IS_NON_ZERO(small_cls, medium_cls, large_cls), origin, NULL))
32+
) AS pct_good_cls,
33+
34+
# Origins with good LCP, inp, and CLS divided by origins with any LCP, inp, and CLS.
35+
SAFE_DIVIDE(
36+
COUNT(DISTINCT IF(
37+
IS_GOOD(fast_lcp, avg_lcp, slow_lcp) AND
38+
IS_GOOD(fast_inp, avg_inp, slow_inp) AND
39+
IS_GOOD(small_cls, medium_cls, large_cls), origin, NULL
40+
)),
41+
COUNT(DISTINCT IF(
42+
IS_NON_ZERO(fast_lcp, avg_lcp, slow_lcp) AND
43+
IS_NON_ZERO(fast_inp, avg_inp, slow_inp) AND
44+
IS_NON_ZERO(small_cls, medium_cls, large_cls), origin, NULL
45+
))
46+
) AS pct_good_cwv
47+
FROM
48+
`chrome-ux-report.materialized.device_summary`
49+
JOIN (
50+
SELECT DISTINCT
51+
client,
52+
root_page,
53+
tech.technology AS ecomm
54+
FROM
55+
`httparchive.crawl.pages`,
56+
UNNEST(technologies) AS tech,
57+
UNNEST(tech.categories) AS category
58+
WHERE
59+
date = '2025-07-01' AND
60+
category = 'Ecommerce' AND
61+
(
62+
tech.technology != 'Cart Functionality' AND
63+
tech.technology != 'Google Analytics Enhanced eCommerce'
64+
)
65+
)
66+
ON
67+
CONCAT(origin, '/') = root_page AND
68+
IF(device = 'desktop', 'desktop', 'mobile') = client
69+
WHERE
70+
date = '2025-07-01'
71+
GROUP BY
72+
client,
73+
ecomm
74+
ORDER BY
75+
origins DESC
Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
#standardSQL
2+
# CrUX Core Web Vitals performance of Ecommerce vendors by device (fid was upated to inp, and is non optinal now)
3+
CREATE TEMP FUNCTION IS_GOOD(good FLOAT64, needs_improvement FLOAT64, poor FLOAT64) RETURNS BOOL AS (
4+
good / (good + needs_improvement + poor) >= 0.75
5+
);
6+
7+
CREATE TEMP FUNCTION IS_NON_ZERO(good FLOAT64, needs_improvement FLOAT64, poor FLOAT64) RETURNS BOOL AS (
8+
good + needs_improvement + poor > 0
9+
);
10+
11+
12+
SELECT
13+
client,
14+
ecomm,
15+
COUNT(DISTINCT origin) AS origins,
16+
# Origins with good LCP divided by origins with any LCP.
17+
SAFE_DIVIDE(
18+
COUNT(DISTINCT IF(IS_GOOD(fast_lcp, avg_lcp, slow_lcp), origin, NULL)),
19+
COUNT(DISTINCT IF(IS_NON_ZERO(fast_lcp, avg_lcp, slow_lcp), origin, NULL))
20+
) AS pct_good_lcp,
21+
22+
# Origins with good INP divided by origins with any inp.
23+
SAFE_DIVIDE(
24+
COUNT(DISTINCT IF(IS_GOOD(fast_inp, avg_inp, slow_inp), origin, NULL)),
25+
COUNT(DISTINCT IF(IS_NON_ZERO(fast_inp, avg_inp, slow_inp), origin, NULL))
26+
) AS pct_good_inp,
27+
28+
# Origins with good CLS divided by origins with any CLS.
29+
SAFE_DIVIDE(
30+
COUNT(DISTINCT IF(IS_GOOD(small_cls, medium_cls, large_cls), origin, NULL)),
31+
COUNT(DISTINCT IF(IS_NON_ZERO(small_cls, medium_cls, large_cls), origin, NULL))
32+
) AS pct_good_cls,
33+
34+
# Origins with good LCP, inp, and CLS divided by origins with any LCP, inp, and CLS.
35+
SAFE_DIVIDE(
36+
COUNT(DISTINCT IF(
37+
IS_GOOD(fast_lcp, avg_lcp, slow_lcp) AND
38+
IS_GOOD(fast_inp, avg_inp, slow_inp) AND
39+
IS_GOOD(small_cls, medium_cls, large_cls), origin, NULL
40+
)),
41+
COUNT(DISTINCT IF(
42+
IS_NON_ZERO(fast_lcp, avg_lcp, slow_lcp) AND
43+
IS_NON_ZERO(fast_inp, avg_inp, slow_inp) AND
44+
IS_NON_ZERO(small_cls, medium_cls, large_cls), origin, NULL
45+
))
46+
) AS pct_good_cwv
47+
FROM
48+
`chrome-ux-report.materialized.device_summary`
49+
JOIN (
50+
SELECT DISTINCT
51+
client,
52+
root_page,
53+
app AS ecomm
54+
FROM
55+
`httparchive.crawl.pages`,
56+
UNNEST(technologies) AS tech,
57+
UNNEST(categories) AS category
58+
WHERE
59+
date = '2025-07-01' AND
60+
category = 'Ecommerce' AND
61+
(
62+
technology != 'Cart Functionality' AND
63+
technology != 'Google Analytics Enhanced eCommerce'
64+
)
65+
)
66+
ON
67+
CONCAT(origin, '/') = root_page AND
68+
IF(device = 'desktop', 'desktop', 'mobile') = client
69+
WHERE
70+
date = '2025-07-01'
71+
GROUP BY
72+
client,
73+
ecomm
74+
ORDER BY
75+
origins DESC

sql/2025/ecommerce/counts.sql

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
SELECT
2+
client,
3+
date,
4+
EXTRACT(YEAR FROM date) AS year,
5+
rank_grouping,
6+
CASE
7+
WHEN rank_grouping = 100000000 THEN 'all'
8+
ELSE FORMAT("%'d", rank_grouping)
9+
END AS ranking,
10+
COUNT(DISTINCT root_page) AS ecommerce_sites,
11+
total,
12+
COUNT(DISTINCT root_page) / total AS pct_ecommerce
13+
FROM
14+
`httparchive.crawl.pages`,
15+
UNNEST(technologies) AS technologies,
16+
UNNEST(technologies.categories) AS cats,
17+
UNNEST([1000, 10000, 100000, 1000000, 10000000, 100000000]) AS rank_grouping
18+
JOIN (
19+
SELECT
20+
date,
21+
client,
22+
rank_grouping,
23+
COUNT(DISTINCT root_page) AS total
24+
FROM
25+
`httparchive.crawl.pages`,
26+
UNNEST([1000, 10000, 100000, 1000000, 10000000, 100000000]) AS rank_grouping
27+
WHERE
28+
date IN ('2025-07-01', '2024-06-01', '2023-07-01', '2022-06-01', '2025-07-01') AND
29+
rank <= rank_grouping
30+
GROUP BY
31+
date,
32+
client,
33+
rank_grouping
34+
)
35+
USING (date, client, rank_grouping)
36+
WHERE
37+
date IN ('2025-07-01', '2024-06-01', '2023-07-01', '2022-06-01', '2025-07-01') AND
38+
rank <= rank_grouping AND
39+
cats = 'Ecommerce' AND
40+
technologies.technology NOT IN ('Cart Functionality', 'Google Analytics Enhanced eCommerce')
41+
GROUP BY
42+
date,
43+
client,
44+
rank_grouping,
45+
total
46+
ORDER BY
47+
date DESC,
48+
client,
49+
rank_grouping
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
WITH totals AS (
2+
SELECT
3+
client,
4+
COUNT(DISTINCT page) AS total_webpages,
5+
COUNT(DISTINCT root_page) AS total_websites
6+
FROM
7+
`httparchive.crawl.pages`
8+
WHERE
9+
date = '2025-07-01'
10+
GROUP BY
11+
client
12+
)
13+
14+
SELECT
15+
client,
16+
technology,
17+
ARRAY_AGG(DISTINCT category) AS categories,
18+
APPROX_QUANTILES(CAST(JSON_VALUE(lighthouse.categories.performance.score) AS NUMERIC) * 100, 1000)[OFFSET(500)] AS median_performance,
19+
APPROX_QUANTILES(CAST(JSON_VALUE(lighthouse.categories.accessibility.score) AS NUMERIC) * 100, 1000)[OFFSET(500)] AS median_accessibility,
20+
APPROX_QUANTILES(CAST(JSON_VALUE(lighthouse.categories.seo.score) AS NUMERIC) * 100, 1000)[OFFSET(500)] AS median_seo,
21+
APPROX_QUANTILES(CAST(JSON_VALUE(lighthouse.categories.`best-practices`.score) AS NUMERIC) * 100, 1000)[OFFSET(500)] AS median_best_practices,
22+
ANY_VALUE(total_websites) AS total_websites,
23+
COUNT(DISTINCT root_page) AS number_of_websites,
24+
COUNT(DISTINCT root_page) / ANY_VALUE(total_websites) AS percent_of_websites
25+
FROM
26+
`httparchive.crawl.pages`,
27+
UNNEST(technologies) AS tech,
28+
UNNEST(categories) AS category
29+
INNER JOIN
30+
totals
31+
USING (client)
32+
WHERE
33+
date = '2025-07-01' AND
34+
category = 'Ecommerce' AND
35+
(
36+
technology != 'Cart Functionality' AND
37+
technology != 'Google Analytics Enhanced eCommerce'
38+
)
39+
GROUP BY
40+
client,
41+
technology
42+
ORDER BY
43+
client,
44+
number_of_websites DESC

0 commit comments

Comments
 (0)