Feat/wts v3#5197
Open
SvenAlHamad wants to merge 4 commits into
Open
Conversation
…ndoff
Replaces the legacy `wts-client@^2` proxy with `@webiny/wts-client@^3.0.1`
across the @webiny/telemetry package. The v3 client owns identity
internally (reads ~/.webiny/config user.id on Node, manages cookies on
web), so sendEvent.js no longer needs to pass a `user` argument and the
WTS instance is constructed once with the right `source`.
The admin (`react.js`) now resolves identity in priority order:
1. URL params on first load: ?wts_did=<machine_id>&iid=<project_id>
(printed by the CLI at deploy-end — wiring is a follow-up). The
values are persisted to localStorage so refreshes keep working.
2. localStorage from a prior load.
3. process.env.REACT_APP_WEBINY_TELEMETRY_USER_ID (build-time fallback).
When `iid` is present, it's attached as a `project_id` super-property on
every admin event for per-install funnel grouping.
A new `getMachineId()` export lets UI code (notably the FinishSetup CTA)
read the resolved machine id without instantiating the client directly.
The "Start using Webiny" CTA in FinishSetup.tsx now routes through
https://www.webiny.com/install/finish?machine_id=<id>&return_to=<admin>
when the admin is hosted on a *.cloudfront.net domain and telemetry is
enabled. The marketing site reads the .webiny.com first-party cookie and
fires a $create_alias event to PostHog, retroactively merging the
website visitor's anonymous id with the deployer's machine id. Falls
back to the original `finishInstallation` flow when telemetry is
disabled, when running on localhost, or when no machine id is available
— never blocks onboarding on telemetry. An optional
REACT_APP_WEBINY_INSTALL_FINISH_URL env var exists for testing against a
non-production marketing site.
Privacy fix: install-wizard-end no longer sends `projectName` or
`organizationName` (free-text user input that risks identifying the
user's company). Only the categorical `referralSource` is forwarded for
funnel attribution. This brings Webiny's anonymous telemetry posture in
line with Next.js, Gatsby, Astro, Strapi, etc.
Deferred to a follow-up: project_id generation at create-webiny-project
time, and the CLI deploy command appending wts_did/iid params to the
printed CloudFront URL. Until those land, admin uses the existing
build-time env var for identity, same as today.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
…n build
Adds an anonymous per-project installation id used by telemetry to
group CLI/admin events at the install level (separate from machine_id,
which identifies the developer's machine across multiple installs).
`create-webiny-project` now generates a UUID at scaffold time and
writes it to `<project>/webiny.installation.json`. The file is tracked
in git (not under .webiny/) so the id is stable across machines that
collaborate on the same project.
`SetAdminAppEnvVarsBefore{Build,Watch}` reads the file from process.cwd()
and exposes `REACT_APP_WEBINY_INSTALLATION_ID` to the admin bundle.
`@webiny/telemetry/react.js` picks it up as the project_id super-property
fallback when neither URL params nor localStorage have a value, so admin
events get installation_id without anything appearing in the user's
terminal — no UUIDs printed at deploy-end, no manual handoff.
`@webiny/telemetry/cli.js` reads the same file from cwd and adds
`installation_id` as a super-property on all CLI telemetry events.
Falls through gracefully (no property emitted, no env var set) when the
file is missing — projects scaffolded before this change keep working
without changes.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Changes
Re-implemented Webiny Telemetry System (WTS).
The new system connects sessions that happen across the web, cli and the admin-app.
Implementation details: https://github.com/webiny/wts/blob/v3/OVERVIEW.md
How Has This Been Tested?
Manual build and deploy, verified events across the posthog dashboard.
Tested with both telemetry enabled and telemetry disabled options.
Documentation
Implementation details: https://github.com/webiny/wts/blob/v3/OVERVIEW.md