-
-
Notifications
You must be signed in to change notification settings - Fork 209
Expand file tree
/
Copy pathlcp_host.sql
More file actions
28 lines (27 loc) · 623 Bytes
/
lcp_host.sql
File metadata and controls
28 lines (27 loc) · 623 Bytes
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
WITH lcp AS (
SELECT
client,
page,
JSON_VALUE(custom_metrics, '$.performance.lcp_elem_stats.url') AS url
FROM
`httparchive.all.pages`
WHERE
date = '2024-06-01' AND
is_root_page
)
SELECT
client,
CASE
WHEN NET.HOST(url) = 'data' THEN 'other content'
WHEN NET.HOST(url) IS NULL THEN 'other content'
WHEN NET.HOST(page) = NET.HOST(url) THEN 'same host'
ELSE 'cross host'
END AS lcp_same_host,
COUNT(0) AS pages,
SUM(COUNT(0)) OVER (PARTITION BY client) AS total,
COUNT(0) / SUM(COUNT(0)) OVER (PARTITION BY client) AS pct
FROM
lcp
GROUP BY
client,
lcp_same_host