Skip to content

Commit 3259399

Browse files
jcmpagelchristianliebel
authored andcommitted
Create gradient-by-client.sql
1 parent 49ad032 commit 3259399

1 file changed

Lines changed: 31 additions & 0 deletions

File tree

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
#standardSQL
2+
-- Gradient adoption in CSS variables over time (by year + client, no rank)
3+
-- Detects any "gradient(" inside custom_metrics.css_variables
4+
SELECT
5+
EXTRACT(YEAR FROM date) AS year,
6+
client,
7+
COUNT(DISTINCT page) AS total_sites,
8+
COUNT(DISTINCT IF(
9+
REGEXP_CONTAINS(TO_JSON_STRING(custom_metrics.css_variables), r'(?i)gradient\('),
10+
page, NULL
11+
)) AS sites_using_gradient,
12+
SAFE_DIVIDE(
13+
COUNT(DISTINCT IF(
14+
REGEXP_CONTAINS(TO_JSON_STRING(custom_metrics.css_variables), r'(?i)gradient\('),
15+
page, NULL
16+
)),
17+
COUNT(DISTINCT page)
18+
) AS pct_sites_using_gradient
19+
FROM `httparchive.crawl.pages`
20+
WHERE
21+
is_root_page
22+
AND date IN (
23+
DATE '2019-07-01',
24+
DATE '2020-08-01',
25+
DATE '2021-07-01',
26+
DATE '2022-07-01', -- CSS parsed-data exception (July)
27+
DATE '2024-06-01',
28+
DATE '2025-07-01'
29+
)
30+
GROUP BY year, client
31+
ORDER BY year, client;

0 commit comments

Comments
 (0)