Description
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 |
|
||||||
enabled_feature |
|
||||||
enabled_feature |
|
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
-
https://github.com/dart-lang/tools/blob/0b41bd203917157aa4f8f015c42c4f4c2e23c6b2/pkgs/unified_analytics/lib/src/analytics.dart#L49 ↩
-
https://github.com/dart-lang/tools/blob/0b41bd203917157aa4f8f015c42c4f4c2e23c6b2/pkgs/unified_analytics/lib/src/analytics.dart#L409 ↩
-
https://github.com/dart-lang/tools/blob/0b41bd203917157aa4f8f015c42c4f4c2e23c6b2/pkgs/unified_analytics/lib/src/utils.dart#L88 ↩