Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The enabled_features user property is prone to getting truncated in events #1204

Open
andrewkolos opened this issue Dec 3, 2024 · 0 comments

Comments

@andrewkolos
Copy link
Contributor

andrewkolos commented Dec 3, 2024

Origin issue in flutter/flutter: flutter/flutter#147327

Currently, the Analytics constructor accepts an enabledFeatures argument1. Whenever an event is sent, this string will get included in the event as a user property23. Typically, enabledFeatures is a comma-delimited list of features that are enabled during a tool's invocation. For example, an event sent by the Flutter CLI tool (e.g. Event.flutterBuildInfo) could include an enabled_features user property of enable-native-assets,enable-swift-package-manager,explicit-package-dependencies.

The problem is that user property values are limited to 36 characters by GA44. In our example, the value would get truncated to enable-native-assets,enable-swift-p. A few solutions were considered in flutter/flutter#147327 (comment). Namely, to completely avoid truncation issues (for all intents and purposes), I propose one event be submitted per enabled feature. Considering the prior example again, the Flutter tool would send the following events:

event name event parameters
enabled_feature
name value
labelenable-native-assets
valuetrue
enabled_feature
name value
labelenable-swift-package-manager
valuetrue
enabled_feature
name value
labelexplicit-package-dependencies
valuetrue

Event parameter values have a length limit of 100, which should be plenty.

During or after this change is made, the enabledFeatures parameter should be removed from the Analytics constructor, which would be a breaking change. Additionally, Analytics should support sending multiple events within a single HTTP request to avoid needing N HTTP roundtrips to send N of these events.

Footnotes

  1. https://github.com/dart-lang/tools/blob/0b41bd203917157aa4f8f015c42c4f4c2e23c6b2/pkgs/unified_analytics/lib/src/analytics.dart#L49

  2. https://github.com/dart-lang/tools/blob/0b41bd203917157aa4f8f015c42c4f4c2e23c6b2/pkgs/unified_analytics/lib/src/analytics.dart#L409

  3. https://github.com/dart-lang/tools/blob/0b41bd203917157aa4f8f015c42c4f4c2e23c6b2/pkgs/unified_analytics/lib/src/utils.dart#L88

  4. https://support.google.com/analytics/answer/9267744?hl=en

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant