Skip to content

Feat/wts v3#5197

Open
SvenAlHamad wants to merge 4 commits into
nextfrom
feat/wts-v3
Open

Feat/wts v3#5197
SvenAlHamad wants to merge 4 commits into
nextfrom
feat/wts-v3

Conversation

@SvenAlHamad
Copy link
Copy Markdown
Contributor

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

SvenAlHamad and others added 2 commits May 9, 2026 11:52
…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>
@SvenAlHamad SvenAlHamad requested a review from adrians5j May 11, 2026 09:56
@Pavel910 Pavel910 added this to the 6.4.0 milestone May 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants