Skip to content

feat: Add anonymous usage tracking#15

Merged
Soner (shyim) merged 4 commits into
mainfrom
feat/usage-tracking
Mar 9, 2026
Merged

feat: Add anonymous usage tracking#15
Soner (shyim) merged 4 commits into
mainfrom
feat/usage-tracking

Conversation

@shyim

Copy link
Copy Markdown
Member

Summary

Adds anonymous usage tracking via UDP (same approach as deployment-helper) to understand how the web installer is used.

Tracked events

All events are sent as UDP JSON payloads to udp.usage.shopware.io:9000 with a random per-session user ID.

Event Tags When
web_installer.visit source (admin or direct), language, php_version, os First page load per session
web_installer.install.started shopware_version User starts a fresh install
web_installer.install.completed shopware_version Composer install succeeds
web_installer.install.failed shopware_version Composer install fails
web_installer.update.started shopware_version_from, shopware_version_to, is_flex_project User starts an update
web_installer.update.completed shopware_version_from, shopware_version_to Composer update succeeds
web_installer.update.failed shopware_version_from, shopware_version_to Composer update fails

Referer normalization

On the initial visit, the HTTP Referer header is normalized:

  • Path contains /admin → source is admin (triggered from Shopware admin)
  • Otherwise → source is direct (user accessed the installer directly)

Opt-out

Tracking is disabled when the DO_NOT_TRACK environment variable is set. The tracking endpoint can be overridden via SHOPWARE_TRACKING_DOMAIN.

Changes

  • Services/TrackingService.php — Lightweight UDP tracking service (fire-and-forget, non-blocking)
  • Listener/TrackingListener.php — Request listener that generates a session-scoped tracking ID and fires the visit event once
  • Controller/InstallController.php — Tracks install started/completed/failed
  • Controller/UpdateController.php — Tracks update started/completed/failed
  • Tests updated to pass the new TrackingService dependency

Test plan

  • All 83 existing tests pass
  • PHPStan reports no errors
  • PHP CS Fixer reports no issues

🤖 Generated with Claude Code

Soner (shyim) and others added 3 commits March 9, 2026 07:16
Tracks installer/updater usage to help understand adoption and diagnose issues.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Comment thread Services/TrackingService.php Outdated
/**
* @param array<string, string|int|float|bool> $tags
*/
public function track(string $eventName, string $userId, array $tags = []): void

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe enum for the event names?

@shyim Soner (shyim) merged commit 150bacb into main Mar 9, 2026
11 checks passed
@shyim Soner (shyim) deleted the feat/usage-tracking branch March 9, 2026 10:24
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.

2 participants