File tree Expand file tree Collapse file tree 1 file changed +59
-0
lines changed
Expand file tree Collapse file tree 1 file changed +59
-0
lines changed Original file line number Diff line number Diff line change 1+ # standardSQL
2+ # % of sites that use custom properties.
3+ # Same query as 2019, to compare trend
4+ CREATE TEMPORARY FUNCTION usesCustomProps(css JSON)
5+ RETURNS BOOLEAN LANGUAGE js AS ' ' '
6+ try {
7+ var reduceValues = (values, rule) => {
8+ if (' rules' in rule) {
9+ return rule.rules.reduce(reduceValues, values);
10+ }
11+ if (!(' declarations' in rule)) {
12+ return values;
13+ }
14+
15+ return values.concat(rule.declarations.filter(d => d.property.startsWith(`--`)));
16+ };
17+ return css.stylesheet.rules.reduce(reduceValues, []).length > 0;
18+ } catch (e) {
19+ return false;
20+ }
21+ ' ' ' ;
22+
23+ SELECT
24+ client,
25+ COUNTIF(num_stylesheets > 0 ) AS freq,
26+ total,
27+ COUNTIF(num_stylesheets > 0 ) / total AS pct
28+ FROM (
29+ SELECT
30+ client,
31+ page,
32+ COUNTIF(usesCustomProps(css)) AS num_stylesheets
33+ FROM
34+ ` httparchive.crawl.parsed_css`
35+ WHERE
36+ date = ' 2025-07-01' AND
37+ rank <= 1000000 AND
38+ is_root_page -- remove if wanna look at home pages AND inner pages. Old tables only had home pages.
39+ GROUP BY
40+ client,
41+ page
42+ )
43+ JOIN (
44+ SELECT
45+ client,
46+ COUNT (0 ) AS total
47+ FROM
48+ ` httparchive.crawl.pages`
49+ WHERE
50+ date = ' 2025-07-01' AND
51+ rank <= 1000000 AND
52+ is_root_page -- remove if wanna look at home pages AND inner pages. Old tables only had home pages.
53+ GROUP BY
54+ client
55+ )
56+ USING (client)
57+ GROUP BY
58+ client,
59+ total
You can’t perform that action at this time.
0 commit comments