-
-
Notifications
You must be signed in to change notification settings - Fork 209
Expand file tree
/
Copy pathwhotracksme_trackers_top.sql
More file actions
37 lines (34 loc) · 1.11 KB
/
whotracksme_trackers_top.sql
File metadata and controls
37 lines (34 loc) · 1.11 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
-- noqa: disable=PRS
WITH base_totals AS (
SELECT
client,
COUNT(DISTINCT root_page) AS total_websites
FROM `httparchive.crawl.pages`
WHERE date = '2025-07-01'
GROUP BY client
),
whotracksme AS (
SELECT
NET.HOST(domain) AS domain,
category || ' / ' || tracker AS tracker
FROM `httparchive.almanac.whotracksme`
WHERE date = '2025-07-01'
)
FROM `httparchive.crawl.requests`
|> JOIN whotracksme
ON NET.HOST(url) = domain OR
ENDS_WITH(NET.HOST(url), '.' || domain)
|> WHERE
date = '2025-07-01'
AND url NOT IN ('https://android.clients.google.com/checkin', 'https://android.clients.google.com/c2dm/register3')
|> AGGREGATE COUNT(DISTINCT root_page) AS number_of_websites GROUP BY client, tracker
|> JOIN base_totals USING (client)
|> EXTEND number_of_websites / total_websites AS pct_websites
|> DROP total_websites
|> PIVOT(
ANY_VALUE(number_of_websites) AS websites_count,
ANY_VALUE(pct_websites) AS pct
FOR client IN ('desktop', 'mobile')
)
|> RENAME pct_mobile AS Mobile, pct_desktop AS Desktop
|> ORDER BY COALESCE(websites_count_desktop, 0) + COALESCE(websites_count_mobile, 0) DESC