docs: track demo app usage analytics#4427
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 07dcecaba1
ℹ️ 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".
| dl: pageLocation, | ||
| dt: document.title || ('ModuleFederationExamples ' + ${escapeJs(demoPath)}) | ||
| }); | ||
| new Image().src = 'https://www.google-analytics.com/g/collect?' + params.toString(); |
There was a problem hiding this comment.
Avoid unconditional GA beacons in test pages
This browser snippet is injected into every demo page and always starts an external google-analytics.com image request, but many repo e2e helpers wait for Playwright networkidle on page load/reload (for example playwright-e2e/common/base.ts:150 and :168). In CI or other network-restricted environments where GA is slow or blocked, those page loads can now wait on an unrelated third-party request until timeout, and there is no browser-side equivalent of the CI/MF_EXAMPLES_ANALYTICS opt-out used by the package-run helper.
Useful? React with 👍 / 👎.
| function getDemoPath(file) { | ||
| return file.split('/').slice(0, -1).join('/') || 'root'; | ||
| } |
There was a problem hiding this comment.
Normalize demo_path to the app package root
Using the entrypoint's containing directory makes browser demo_app_view events report paths such as basic-host-remote/app1/public or nextjs-csr/home/pages, while the package-run tracker records demoPath from process.cwd() (for example basic-host-remote/app1) in scripts/track-demo-run.js:18. For entrypoints under public, src, or pages, this splits one demo app across different demo_path values and breaks aggregation/correlation between view and run analytics.
Useful? React with 👍 / 👎.
Summary
GA setup
Validation