Skip to content

feat(unified_analytics): support target package and version tracking in Event.dartCliCommandExecuted #2561

Description

@kevmoo

Feature Proposal: Add Target Package & Version Parameters to Event.dartCliCommandExecuted

Problem

Currently, when a developer runs standalone CLI distribution commands such as dart install <package> or dart run <package>@<version>, package:unified_analytics records name: 'install' or name: 'run', but does not capture which specific package or version was resolved.

Tracking which public packages are installed and run dynamically is critical for understanding Dart CLI tool ecosystem adoption, identifying high-traffic tools migrating away from legacy pub global activate, and monitoring compiler/runtime compatibility.

Proposal

Add optional scalar parameters to Event.dartCliCommandExecuted:

Event.dartCliCommandExecuted({
  required String name,
  required String enabledExperiments,
  int? exitCode,
  bool? pubspecHasFlutterSdk,
  Set<String>? pubspecDependencies,
  String? pubspecEnvironmentSdk,

  // New fields for standalone tool installation and execution:
  String? targetPackage,            // e.g. "dhttpd"
  String? targetPackageVersion,     // e.g. "4.1.0" (resolved version from lockfile)
  String? targetPackageConstraint,  // e.g. "^4.0.0" (SemVer constraint from @ or null)
})

Parameter Budget & GA4 Limits

  • GA4 enforces a maximum of 25 custom parameters per event.
  • In standard project commands (dart build, dart test), targetPackage* fields are null and omitted from the payload, preserving all slots for pubspec_dep_0..19.
  • In dart install and dart run <pkg>@, pubspecDependencies is null, and targetPackage* adds 3 parameters. Total payload size remains $\le 8$ parameters (well under 25).

Privacy Data Directive (PDD) Compliance

  • Callers (e.g. pkg/dartdev) MUST only populate these fields after successful resolution (exitCode == 0) from a public hosted registry (source == 'hosted' and host is https://pub.dev).
  • Private packages, git repositories, path dependencies, and failed resolutions (e.g. 404s) must strictly omit these fields.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions