Skip to content

Commit 8c4e816

Browse files
committed
3p cookie domains
1 parent c14742b commit 8c4e816

2 files changed

Lines changed: 100 additions & 58 deletions

File tree

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
FROM `httparchive.crawl.pages`
2+
|> WHERE date = '2025-07-01' -- AND rank = 1000
3+
|> EXTEND COUNT(DISTINCT NET.HOST(root_page)) OVER (PARTITION BY client) AS total_domains
4+
|> JOIN UNNEST(JSON_QUERY_ARRAY(custom_metrics.cookies)) AS cookie
5+
|> EXTEND
6+
NET.HOST(root_page) AS firstparty_domain,
7+
NET.HOST(SAFE.STRING(cookie.domain)) AS cookie_domain
8+
|> WHERE NOT ENDS_WITH('.' || firstparty_domain, '.' || cookie_domain)
9+
|> AGGREGATE
10+
COUNT(DISTINCT firstparty_domain) AS domain_count,
11+
COUNT(DISTINCT firstparty_domain) / ANY_VALUE(total_domains) AS pct_domains
12+
GROUP BY client, cookie_domain
13+
|> PIVOT (
14+
ANY_VALUE(domain_count) AS domain_count,
15+
ANY_VALUE(pct_domains) AS pct_domains
16+
FOR client IN ('desktop', 'mobile')
17+
)
18+
|> RENAME
19+
pct_domains_mobile AS mobile,
20+
pct_domains_desktop AS desktop
21+
|> ORDER BY domain_count_mobile + domain_count_desktop DESC
22+
|> LIMIT 1000

sql/util/bq_to_sheets.ipynb

Lines changed: 78 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@
8282
},
8383
{
8484
"cell_type": "code",
85-
"execution_count": 5,
85+
"execution_count": 2,
8686
"metadata": {
8787
"cellView": "form",
8888
"id": "45dBifFPJAtO"
@@ -92,7 +92,7 @@
9292
"name": "stdout",
9393
"output_type": "stream",
9494
"text": [
95-
"✓ Connected to spreadsheet with 25 existing sheets\n"
95+
"✓ Connected to spreadsheet with 20 existing sheets\n"
9696
]
9797
}
9898
],
@@ -137,61 +137,63 @@
137137
"name": "stdout",
138138
"output_type": "stream",
139139
"text": [
140-
"+----------------------------------------------------------------------------+-------------+--------------------------+--------------------------+\n",
141-
"| Query | TB Billed | Sheet | Status/Skip Reason |\n",
142-
"+============================================================================+=============+==========================+==========================+\n",
143-
"| _cname_domains_top.sql | | | Filename filter mismatch |\n",
144-
"+----------------------------------------------------------------------------+-------------+--------------------------+--------------------------+\n",
145-
"| _number_of_ara_destinations_registered_by_third_parties_and_publishers.sql | | | Filename filter mismatch |\n",
146-
"+----------------------------------------------------------------------------+-------------+--------------------------+--------------------------+\n",
147-
"| _number_of_privacy_sandbox_attested_domains.sql | | | Filename filter mismatch |\n",
148-
"+----------------------------------------------------------------------------+-------------+--------------------------+--------------------------+\n",
149-
"| _privacy-sandbox-adoption-by-third-parties-by-publishers.sql | | | Filename filter mismatch |\n",
150-
"+----------------------------------------------------------------------------+-------------+--------------------------+--------------------------+\n",
151-
"| _top_ara_destinations_registered_by_most_publishers.sql | | | Filename filter mismatch |\n",
152-
"+----------------------------------------------------------------------------+-------------+--------------------------+--------------------------+\n",
153-
"| _top_ara_destinations_registered_by_most_third_parties.sql | | | Filename filter mismatch |\n",
154-
"+----------------------------------------------------------------------------+-------------+--------------------------+--------------------------+\n",
155-
"| bounce_domains_top.sql | 5.131 | Bounce Domains Top | ✓ Uploaded |\n",
156-
"+----------------------------------------------------------------------------+-------------+--------------------------+--------------------------+\n",
157-
"| client_hints_top.sql | 1.338 | Client Hints Top | ✓ Uploaded |\n",
158-
"+----------------------------------------------------------------------------+-------------+--------------------------+--------------------------+\n",
159-
"| client_hints_usage.sql | | | Filename filter mismatch |\n",
160-
"+----------------------------------------------------------------------------+-------------+--------------------------+--------------------------+\n",
161-
"| cookies_first_party_top.sql | | | Filename filter mismatch |\n",
162-
"+----------------------------------------------------------------------------+-------------+--------------------------+--------------------------+\n",
163-
"| cookies_third_party_top.sql | | | Filename filter mismatch |\n",
164-
"+----------------------------------------------------------------------------+-------------+--------------------------+--------------------------+\n",
165-
"| dnt_usage.sql | | | Filename filter mismatch |\n",
166-
"+----------------------------------------------------------------------------+-------------+--------------------------+--------------------------+\n",
167-
"| fingerprinting_top.sql | | | Filename filter mismatch |\n",
168-
"+----------------------------------------------------------------------------+-------------+--------------------------+--------------------------+\n",
169-
"| iab_tcf_v2_cmps_top.sql | 0.02 | Iab Tcf V2 Cmps Top | ✓ Uploaded |\n",
170-
"+----------------------------------------------------------------------------+-------------+--------------------------+--------------------------+\n",
171-
"| iab_tcf_v2_countries_top.sql | 0.02 | Iab Tcf V2 Countries Top | ✓ Uploaded |\n",
172-
"+----------------------------------------------------------------------------+-------------+--------------------------+--------------------------+\n",
173-
"| iab_usage.sql | | | Filename filter mismatch |\n",
174-
"+----------------------------------------------------------------------------+-------------+--------------------------+--------------------------+\n",
175-
"| iab_usp_strings_top.sql | | | Filename filter mismatch |\n",
176-
"+----------------------------------------------------------------------------+-------------+--------------------------+--------------------------+\n",
177-
"| referrer_policy_top.sql | | | Filename filter mismatch |\n",
178-
"+----------------------------------------------------------------------------+-------------+--------------------------+--------------------------+\n",
179-
"| referrer_policy_usage.sql | | | Filename filter mismatch |\n",
180-
"+----------------------------------------------------------------------------+-------------+--------------------------+--------------------------+\n",
181-
"| related_origin_trials_top.sql | | | Filename filter mismatch |\n",
182-
"+----------------------------------------------------------------------------+-------------+--------------------------+--------------------------+\n",
183-
"| tracker_categories_top.sql | | | Filename filter mismatch |\n",
184-
"+----------------------------------------------------------------------------+-------------+--------------------------+--------------------------+\n",
185-
"| tracker_distribution.sql | | | Filename filter mismatch |\n",
186-
"+----------------------------------------------------------------------------+-------------+--------------------------+--------------------------+\n",
187-
"| tracker_technologies_top.sql | | | Filename filter mismatch |\n",
188-
"+----------------------------------------------------------------------------+-------------+--------------------------+--------------------------+\n",
189-
"| whotracksme_categories_top.sql | | | Filename filter mismatch |\n",
190-
"+----------------------------------------------------------------------------+-------------+--------------------------+--------------------------+\n",
191-
"| whotracksme_trackers_top.sql | | | Filename filter mismatch |\n",
192-
"+----------------------------------------------------------------------------+-------------+--------------------------+--------------------------+\n",
140+
"+----------------------------------------------------------------------------+-------------+--------------------------------+--------------------------+\n",
141+
"| Query | TB Billed | Sheet | Status/Skip Reason |\n",
142+
"+============================================================================+=============+================================+==========================+\n",
143+
"| _cname_domains_top.sql | | | Filename filter mismatch |\n",
144+
"+----------------------------------------------------------------------------+-------------+--------------------------------+--------------------------+\n",
145+
"| _number_of_ara_destinations_registered_by_third_parties_and_publishers.sql | | | Filename filter mismatch |\n",
146+
"+----------------------------------------------------------------------------+-------------+--------------------------------+--------------------------+\n",
147+
"| _number_of_privacy_sandbox_attested_domains.sql | | | Filename filter mismatch |\n",
148+
"+----------------------------------------------------------------------------+-------------+--------------------------------+--------------------------+\n",
149+
"| _privacy-sandbox-adoption-by-third-parties-by-publishers.sql | | | Filename filter mismatch |\n",
150+
"+----------------------------------------------------------------------------+-------------+--------------------------------+--------------------------+\n",
151+
"| _top_ara_destinations_registered_by_most_publishers.sql | | | Filename filter mismatch |\n",
152+
"+----------------------------------------------------------------------------+-------------+--------------------------------+--------------------------+\n",
153+
"| _top_ara_destinations_registered_by_most_third_parties.sql | | | Filename filter mismatch |\n",
154+
"+----------------------------------------------------------------------------+-------------+--------------------------------+--------------------------+\n",
155+
"| bounce_domains_top.sql | | | Filename filter mismatch |\n",
156+
"+----------------------------------------------------------------------------+-------------+--------------------------------+--------------------------+\n",
157+
"| client_hints_top.sql | | | Filename filter mismatch |\n",
158+
"+----------------------------------------------------------------------------+-------------+--------------------------------+--------------------------+\n",
159+
"| client_hints_usage.sql | | | Filename filter mismatch |\n",
160+
"+----------------------------------------------------------------------------+-------------+--------------------------------+--------------------------+\n",
161+
"| cookie_domains_third_party_top.sql | 0.081 | Cookie Domains Third Party Top | ✓ Uploaded |\n",
162+
"+----------------------------------------------------------------------------+-------------+--------------------------------+--------------------------+\n",
163+
"| cookies_first_party_top.sql | | | Filename filter mismatch |\n",
164+
"+----------------------------------------------------------------------------+-------------+--------------------------------+--------------------------+\n",
165+
"| cookies_third_party_top.sql | | | Filename filter mismatch |\n",
166+
"+----------------------------------------------------------------------------+-------------+--------------------------------+--------------------------+\n",
167+
"| dnt_usage.sql | | | Filename filter mismatch |\n",
168+
"+----------------------------------------------------------------------------+-------------+--------------------------------+--------------------------+\n",
169+
"| fingerprinting_top.sql | | | Filename filter mismatch |\n",
170+
"+----------------------------------------------------------------------------+-------------+--------------------------------+--------------------------+\n",
171+
"| iab_tcf_v2_cmps_top.sql | | | Filename filter mismatch |\n",
172+
"+----------------------------------------------------------------------------+-------------+--------------------------------+--------------------------+\n",
173+
"| iab_tcf_v2_countries_top.sql | | | Filename filter mismatch |\n",
174+
"+----------------------------------------------------------------------------+-------------+--------------------------------+--------------------------+\n",
175+
"| iab_usage.sql | | | Filename filter mismatch |\n",
176+
"+----------------------------------------------------------------------------+-------------+--------------------------------+--------------------------+\n",
177+
"| iab_usp_strings_top.sql | | | Filename filter mismatch |\n",
178+
"+----------------------------------------------------------------------------+-------------+--------------------------------+--------------------------+\n",
179+
"| referrer_policy_top.sql | | | Filename filter mismatch |\n",
180+
"+----------------------------------------------------------------------------+-------------+--------------------------------+--------------------------+\n",
181+
"| referrer_policy_usage.sql | | | Filename filter mismatch |\n",
182+
"+----------------------------------------------------------------------------+-------------+--------------------------------+--------------------------+\n",
183+
"| related_origin_trials_top.sql | | | Filename filter mismatch |\n",
184+
"+----------------------------------------------------------------------------+-------------+--------------------------------+--------------------------+\n",
185+
"| tracker_categories_top.sql | | | Filename filter mismatch |\n",
186+
"+----------------------------------------------------------------------------+-------------+--------------------------------+--------------------------+\n",
187+
"| tracker_distribution.sql | | | Filename filter mismatch |\n",
188+
"+----------------------------------------------------------------------------+-------------+--------------------------------+--------------------------+\n",
189+
"| tracker_technologies_top.sql | | | Filename filter mismatch |\n",
190+
"+----------------------------------------------------------------------------+-------------+--------------------------------+--------------------------+\n",
191+
"| whotracksme_categories_top.sql | | | Filename filter mismatch |\n",
192+
"+----------------------------------------------------------------------------+-------------+--------------------------------+--------------------------+\n",
193+
"| whotracksme_trackers_top.sql | | | Filename filter mismatch |\n",
194+
"+----------------------------------------------------------------------------+-------------+--------------------------------+--------------------------+\n",
193195
"\n",
194-
"✓ Processed 25 queries\n"
196+
"✓ Processed 26 queries\n"
195197
]
196198
}
197199
],
@@ -205,7 +207,7 @@
205207
"\n",
206208
"\n",
207209
"# Query filters and options\n",
208-
"filename_match = '(iab_tcf_v2_cmps_top|iab_tcf_v2_countries_top|client_hints_top|bounce_domains_top).sql' # @param {type: \"raw\", placeholder: \"Enter regexp wrapped in quotes\"}\n",
210+
"filename_match = '(cookie_domains_third_party_top).sql' # @param {type: \"raw\", placeholder: \"Enter regexp wrapped in quotes\"}\n",
209211
"filename_match_exclude = '' # @param {type: \"raw\", placeholder: \"Enter regexp wrapped in quotes\"}\n",
210212
"dry_run = False # @param {type: \"boolean\"}\n",
211213
"overwrite_sheets = True # @param {type: \"boolean\"}\n",
@@ -305,14 +307,32 @@
305307
"\n",
306308
" print(f\"\\n✓ Processed {len(queries_processed_log)} queries\")"
307309
]
310+
},
311+
{
312+
"cell_type": "code",
313+
"execution_count": null,
314+
"metadata": {},
315+
"outputs": [
316+
{
317+
"data": {
318+
"text/plain": [
319+
"QueryJob<project=httparchive, location=US, id=None>"
320+
]
321+
},
322+
"execution_count": 7,
323+
"metadata": {},
324+
"output_type": "execute_result"
325+
}
326+
],
327+
"source": []
308328
}
309329
],
310330
"metadata": {
311331
"colab": {
312332
"provenance": []
313333
},
314334
"kernelspec": {
315-
"display_name": ".venv (3.14.2)",
335+
"display_name": ".venv",
316336
"language": "python",
317337
"name": "python3"
318338
},

0 commit comments

Comments
 (0)