Skip to content

Commit 9ab94bd

Browse files
committed
updated metrics
1 parent 1c31d62 commit 9ab94bd

4 files changed

Lines changed: 38 additions & 43 deletions

File tree

sql/2025/privacy/bounce_domains_top.sql

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -17,19 +17,19 @@ WITH redirect_requests AS (
1717
url,
1818
index,
1919
NET.REG_DOMAIN(header.value) AS location_domain,
20-
page
20+
root_page
2121
),
2222

2323
-- Find the first navigation redirect
2424
navigation_redirect AS (
2525
FROM redirect_requests
2626
|> WHERE
2727
index = 1 AND
28-
NET.REG_DOMAIN(page) = NET.REG_DOMAIN(url) AND
28+
NET.REG_DOMAIN(root_page) = NET.REG_DOMAIN(url) AND
2929
NET.REG_DOMAIN(url) != location_domain
3030
|> SELECT
3131
client,
32-
page,
32+
root_page,
3333
location_domain AS bounce_domain
3434
),
3535

@@ -38,12 +38,12 @@ bounce_redirect AS (
3838
FROM redirect_requests
3939
|> WHERE
4040
index = 2 AND
41-
NET.REG_DOMAIN(page) != NET.REG_DOMAIN(url) AND
41+
NET.REG_DOMAIN(root_page) != NET.REG_DOMAIN(url) AND
4242
NET.REG_DOMAIN(url) != location_domain
4343
|> SELECT
4444
client,
4545
url,
46-
page,
46+
root_page,
4747
location_domain AS bounce_redirect_location_domain
4848
),
4949

@@ -53,26 +53,26 @@ bounce_sequences AS (
5353
|> JOIN bounce_redirect AS bounce
5454
ON
5555
nav.client = bounce.client AND
56-
nav.page = bounce.page
57-
|> AGGREGATE COUNT(DISTINCT nav.page) AS pages_count
56+
nav.root_page = bounce.root_page
57+
|> AGGREGATE COUNT(DISTINCT nav.root_page) AS websites_count
5858
GROUP BY nav.client, bounce_domain
5959
),
6060

61-
pages_total AS (
61+
websites_total AS (
6262
FROM `httparchive.crawl.pages`
6363
|> WHERE date = '2025-07-01' --AND rank = 1000
64-
|> AGGREGATE COUNT(DISTINCT page) AS total_pages GROUP BY client
64+
|> AGGREGATE COUNT(DISTINCT root_page) AS total_websites GROUP BY client
6565
)
6666

6767
FROM bounce_sequences
68-
|> JOIN pages_total USING (client)
69-
|> EXTEND pages_count / total_pages AS pages_pct
70-
|> DROP total_pages
68+
|> JOIN websites_total USING (client)
69+
|> EXTEND websites_count / total_websites AS websites_pct
70+
|> DROP total_websites
7171
|> PIVOT(
72-
ANY_VALUE(pages_count) AS cnt,
73-
ANY_VALUE(pages_pct) AS pages_pct
72+
ANY_VALUE(websites_count) AS cnt,
73+
ANY_VALUE(websites_pct) AS pct
7474
FOR client IN ('desktop', 'mobile')
7575
)
76-
|> RENAME cnt_mobile AS mobile, cnt_desktop AS desktop
77-
|> ORDER BY mobile + desktop DESC
76+
|> RENAME pct_mobile AS mobile, pct_desktop AS desktop, cnt_mobile AS mobile_count, cnt_desktop AS desktop_count
77+
|> ORDER BY mobile_count + desktop_count DESC
7878
|> LIMIT 100

sql/2025/privacy/client_hints_top.sql

Lines changed: 10 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ headers AS (
1212
|> JOIN UNNEST(response_headers) AS header
1313
|> WHERE LOWER(header.name) = 'accept-ch'
1414
|> LEFT JOIN UNNEST(SPLIT(LOWER(header.value), ',')) AS header_value
15-
|> SELECT client, page, header_value
15+
|> SELECT client, root_page, header_value
1616

1717
),
1818

@@ -21,28 +21,24 @@ meta_tags AS (
2121
FROM `httparchive.crawl.pages`
2222
|> WHERE date = '2025-07-01' AND is_root_page --AND rank = 1000
2323
|> JOIN UNNEST(JSON_QUERY_ARRAY(custom_metrics.other.almanac.`meta-nodes`.nodes)) AS meta_node
24-
|> EXTEND
25-
LOWER(SAFE.STRING(meta_node.`http-equiv`)) AS tag_name,
24+
|> EXTEND LOWER(SAFE.STRING(meta_node.`http-equiv`)) AS tag_name
2625
|> WHERE tag_name = 'accept-ch'
2726
|> LEFT JOIN UNNEST(SPLIT(LOWER(SAFE.STRING(meta_node.content)), ',')) AS tag_value
28-
|> SELECT client, page, tag_value
27+
|> SELECT client, root_page, tag_value
2928
)
3029

3130
FROM headers
32-
|> FULL OUTER JOIN meta_tags USING (client, page)
31+
|> FULL OUTER JOIN meta_tags USING (client, root_page)
3332
|> JOIN totals USING (client)
3433
|> EXTEND TRIM(COALESCE(header_value, tag_value)) AS value
3534
|> AGGREGATE
36-
COUNT(DISTINCT page) AS number_of_pages,
37-
COUNT(DISTINCT page) / ANY_VALUE(total_websites) AS pct_pages
35+
COUNT(DISTINCT root_page) AS number_of_websites,
36+
COUNT(DISTINCT root_page) / ANY_VALUE(total_websites) AS pct_websites
3837
GROUP BY client, value
3938
|> PIVOT(
40-
ANY_VALUE(number_of_pages) AS pages_count,
41-
ANY_VALUE(pct_pages) AS pct
39+
ANY_VALUE(number_of_websites) AS websites_count,
40+
ANY_VALUE(pct_websites) AS pct
4241
FOR client IN ('desktop', 'mobile')
4342
)
44-
|> RENAME
45-
pct_mobile AS mobile,
46-
pct_desktop AS desktop
47-
|> ORDER BY pages_count_mobile + pages_count_desktop DESC
48-
|> LIMIT 200
43+
|> RENAME pct_mobile AS mobile, pct_desktop AS desktop
44+
|> ORDER BY websites_count_desktop + websites_count_mobile DESC
Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
-- noqa: disable=PRS
12
-- Counts of CMPs using IAB Transparency & Consent Framework
23
-- cf. https://github.com/InteractiveAdvertisingBureau/GDPR-Transparency-and-Consent-Framework/blob/master/TCFv2/IAB%20Tech%20Lab%20-%20CMP%20API%20v2.md--tcdata
34
-- CMP vendor list: https://iabeurope.eu/cmp-list/
@@ -6,15 +7,15 @@ FROM `httparchive.crawl.pages`
67
|> WHERE date = '2025-07-01' --AND rank = 1000
78
|> EXTEND
89
SAFE.INT64(custom_metrics.privacy.iab_tcf_v2.data.cmpId) AS cmpId,
9-
COUNT(DISTINCT page) OVER (PARTITION BY client) AS total_pages
10+
COUNT(DISTINCT root_page) OVER (PARTITION BY client) AS total_websites
1011
|> AGGREGATE
11-
COUNT(0) AS number_of_pages,
12-
COUNT(0) / ANY_VALUE(total_pages) AS pct_pages
12+
COUNT(DISTINCT root_page) AS number_of_websites,
13+
COUNT(DISTINCT root_page) / ANY_VALUE(total_websites) AS pct_websites
1314
GROUP BY client, cmpId
1415
|> PIVOT (
15-
ANY_VALUE(number_of_pages) AS pages_count,
16-
ANY_VALUE(pct_pages) AS pct
16+
ANY_VALUE(number_of_websites) AS websites_count,
17+
ANY_VALUE(pct_websites) AS pct
1718
FOR client IN ('desktop', 'mobile')
1819
)
1920
|> RENAME pct_mobile AS mobile, pct_desktop AS desktop
20-
|> ORDER BY pages_count_mobile + pages_count_desktop DESC
21+
|> ORDER BY websites_count_desktop + websites_count_mobile DESC

sql/2025/privacy/iab_tcf_v2_countries_top.sql

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -26,16 +26,14 @@ base_data AS (
2626
)
2727

2828
FROM base_data
29-
|> AGGREGATE
30-
COUNT(DISTINCT root_page) AS number_of_pages
31-
GROUP BY client, publisherCC
29+
|> AGGREGATE COUNT(DISTINCT root_page) AS number_of_websites GROUP BY client, publisherCC
3230
|> JOIN base_totals USING (client)
33-
|> EXTEND number_of_pages / total_websites AS pct_of_pages
31+
|> EXTEND number_of_websites / total_websites AS pct_of_websites
3432
|> DROP total_websites
3533
|> PIVOT(
36-
ANY_VALUE(number_of_pages) AS pages_count,
37-
ANY_VALUE(pct_of_pages) AS pct
34+
ANY_VALUE(number_of_websites) AS websites_count,
35+
ANY_VALUE(pct_of_websites) AS pct
3836
FOR client IN ('desktop', 'mobile')
3937
)
4038
|> RENAME pct_mobile AS mobile, pct_desktop AS desktop
41-
|> ORDER BY pages_count_mobile + pages_count_desktop DESC
39+
|> ORDER BY websites_count_desktop + websites_count_mobile DESC

0 commit comments

Comments
 (0)