Repository navigation
修复 GA4 初始化前的隐私配置并补真实 SDK 契约 - #123
Conversation
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 5f53087b71
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| page.on('framenavigated', (frame) => { | ||
| if (frame === page.mainFrame()) phase = 'after-withdrawal-reload'; | ||
| }); |
There was a problem hiding this comment.
Start withdrawal monitoring before clicking deny
If the loaded SDK sends a collection request during withdrawal or the ensuing unload, before the replacement document commits, it is still labeled after-explicit-consent. The later assertion filters only after-withdrawal-reload, so this diagnostic can report withdrawal: PASS despite transmitting after consent was withdrawn. Replaying the registered handlers with a collection request followed by main-frame navigation confirms that the assertion passes. Set the withdrawal phase immediately before clicking deny and check all Google requests from that point onward, including the reload transition.
Useful? React with 👍 / 👎.
Deploying frees-ling-github-io with
|
| Latest commit: |
cd40424
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://b6d620f8.frees-ling-github-io.pages.dev |
| Branch Preview URL: | https://gemini-blog-consent-ads-hard.frees-ling-github-io.pages.dev |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 198f5faed2
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| assert.ok( | ||
| (await context.cookies()).some((cookie) => | ||
| cookie.name.startsWith('fl_blog_ga'), | ||
| ), | ||
| ); |
There was a problem hiding this comment.
Save collection evidence before asserting cookie presence
When the SDK acknowledges a page view but creates no fl_blog_ga cookie—the production failure already recorded in docs/execution/STATE.md—this assertion throws before collectionHttpStatus and sanitizedPageView are saved. Consequently, evidence.json loses the actual network page-location value needed to investigate the queue/network discrepancy, and withdrawal is never exercised. Replaying that response with an empty cookie list confirms both evidence fields are absent. Persist the receipt and observed page view immediately, then defer the cookie assertion until after gathering withdrawal evidence while retaining the overall failure.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 702b5471bf
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| Object.keys(configuration).forEach(function (key) { | ||
| gtag('set', key, configuration[key]); | ||
| }); |
There was a problem hiding this comment.
Update the consent test for the new set-command shape
Changing gtag('set', {...}) to individual three-argument calls breaks the existing consent regression test: src/utils/blog-analytics.test.mjs:430–437 selects the first set entry and still reads setCall[1].page_location and .page_referrer, but setCall[1] is now the string send_page_view. Running node --test src/utils/blog-analytics.test.mjs reproduces the failure (12 pass, 1 fail). Since .github/workflows/quality.yml runs this test through npm test, the required quality job cannot pass. Update the assertions to inspect the individual parameter calls while preserving the URL-sanitization checks.
Useful? React with 👍 / 👎.
真实 Google SDK 在读者同意后发出的 page_view 仍含查询参数,并使用了通用 _ga Cookie;原先的 SDK 夹具没有发现这项初始化顺序问题。本 PR 将完整隐私参数提前到 SDK 初始化前,保留显式同意、广告拒绝与单次手动浏览事件,并补清理本衡量 ID 的旧专用 Cookie,保留其他站点的通用 Cookie。
新增手动隔离真实 SDK 检查:所有收集请求在发送前拦截,不写入正式统计;核验干净地址、来源域、Cookie 主机/期限及撤回。默认完整 Visual 和 Quality 门禁保留,调查模式单独标记,不能当作生产验收。
验证:最终精确提交 cd40424 的完整 Quality 42752697364、完整 Visual 42752713276、精确隔离 SDK 契约 42752717274 全部通过。四张 390/1280 明暗主题中文截图已实际查看,文字正常、按钮完整、未见溢出。历史真实生产诊断 42749020765 / 42749812594 的失败保留,GA4 后台入库和 AdSense 审核没有通过证据。
生产仍是此前单独批准的 PR122。此 PR 已包含生产脚本变更,必须等待所有者对最终精确提交的独立发布批准;不发布 Hub,不启用广告或付费推广,不提交 AdSense 复审。