-
-
Notifications
You must be signed in to change notification settings - Fork 209
Expand file tree
/
Copy pathmost_common_client_hints.sql
More file actions
53 lines (50 loc) · 1.28 KB
/
most_common_client_hints.sql
File metadata and controls
53 lines (50 loc) · 1.28 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
-- Pages that use Client Hints
WITH response_headers AS (
SELECT
client,
page,
LOWER(response_header.name) AS header_name,
LOWER(response_header.value) AS header_value,
COUNT(DISTINCT page) OVER (PARTITION BY client) AS total_websites
FROM `httparchive.crawl.requests`,
UNNEST(response_headers) AS response_header
WHERE
date = '2025-07-01' AND
is_root_page = TRUE AND
is_main_document = TRUE
),
meta_tags AS (
SELECT
client,
page,
LOWER(SAFE.STRING(meta_node.`http-equiv`)) AS tag_name,
LOWER(SAFE.STRING(meta_node.content)) AS tag_value
FROM (
SELECT
client,
page,
custom_metrics.other.almanac AS metrics
FROM `httparchive.crawl.pages`
WHERE
date = '2025-07-01' AND
is_root_page = TRUE
),
UNNEST(JSON_QUERY_ARRAY(metrics.`meta-nodes`.nodes)) AS meta_node
WHERE SAFE.STRING(meta_node.`http-equiv`) IS NOT NULL
)
SELECT
client,
IF(header_name = 'accept-ch', header_value, tag_value) AS value,
COUNT(DISTINCT page) / ANY_VALUE(total_websites) AS pct_pages,
COUNT(DISTINCT page) AS number_of_pages
FROM response_headers
FULL OUTER JOIN meta_tags
USING (client, page)
WHERE
header_name = 'accept-ch' OR
tag_name = 'accept-ch'
GROUP BY
client,
value
ORDER BY pct_pages DESC
LIMIT 200