diff --git a/pkgs/unified_analytics/CHANGELOG.md b/pkgs/unified_analytics/CHANGELOG.md index 54f8183e1..c6d361cfa 100644 --- a/pkgs/unified_analytics/CHANGELOG.md +++ b/pkgs/unified_analytics/CHANGELOG.md @@ -1,10 +1,11 @@ -## 3.1.0 +## 4.0.0 - Enhanced `LogFileStats` data to include information about flutter channel counts and tool counts - Added new method to suppress telemetry collection temporarily for current invocation via `analytics.suppressTelemetry()` - Added `SurveyHandler` feature to `Analytics` instance to fetch available surveys from remote endpoint to display to users along with functionality to dismiss them - Surveys will be disabled for any users that have been opted out - Shipping `FakeAnalytics` for clients of this tool that need to ensure workflows are sending events in tests +- Adding getter to `Analytics` instance to fetch the client ID being sent to GA4 ## 3.0.0 diff --git a/pkgs/unified_analytics/lib/src/analytics.dart b/pkgs/unified_analytics/lib/src/analytics.dart index cb3842dc2..3fe23efcf 100644 --- a/pkgs/unified_analytics/lib/src/analytics.dart +++ b/pkgs/unified_analytics/lib/src/analytics.dart @@ -187,6 +187,10 @@ abstract class Analytics { enableAsserts: true, ); + /// The shared identifier for Flutter and Dart related tooling using + /// package:unified_analytics. + String get clientId; + /// Retrieves the consent message to prompt users with on first /// run or when the message has been updated. String get getConsentMessage; @@ -401,6 +405,9 @@ class AnalyticsImpl implements Analytics { _logHandler = LogHandler(fs: fs, homeDirectory: homeDirectory); } + @override + String get clientId => _clientId; + @override String get getConsentMessage { // The command to swap in the consent message @@ -709,6 +716,9 @@ class NoOpAnalytics implements Analytics { const NoOpAnalytics._(); + @override + String get clientId => 'xxxx-xxxx'; + @override void clientShowedMessage() {} diff --git a/pkgs/unified_analytics/lib/src/constants.dart b/pkgs/unified_analytics/lib/src/constants.dart index cf19b13c7..92bfe2cbc 100644 --- a/pkgs/unified_analytics/lib/src/constants.dart +++ b/pkgs/unified_analytics/lib/src/constants.dart @@ -78,7 +78,7 @@ const int kLogFileLength = 2500; const String kLogFileName = 'dart-flutter-telemetry.log'; /// The current version of the package, should be in line with pubspec version. -const String kPackageVersion = '3.1.0'; +const String kPackageVersion = '4.0.0'; /// The minimum length for a session. const int kSessionDurationMinutes = 30; diff --git a/pkgs/unified_analytics/pubspec.yaml b/pkgs/unified_analytics/pubspec.yaml index fa914cd54..86dbc686b 100644 --- a/pkgs/unified_analytics/pubspec.yaml +++ b/pkgs/unified_analytics/pubspec.yaml @@ -4,7 +4,7 @@ description: >- to Google Analytics. # When updating this, keep the version consistent with the changelog and the # value in lib/src/constants.dart. -version: 3.1.0 +version: 4.0.0 repository: https://github.com/dart-lang/tools/tree/main/pkgs/unified_analytics environment: diff --git a/pkgs/unified_analytics/test/no_op_analytics_test.dart b/pkgs/unified_analytics/test/no_op_analytics_test.dart index 8f86b25c4..121704a54 100644 --- a/pkgs/unified_analytics/test/no_op_analytics_test.dart +++ b/pkgs/unified_analytics/test/no_op_analytics_test.dart @@ -62,6 +62,11 @@ void main() { expect(checkDirectoryForWritePermissions(home), true); }); + + test('Fetching the client id', () { + final analytics = NoOpAnalytics(); + expect(analytics.clientId, 'xxxx-xxxx'); + }); } class FakeDirectory extends Fake implements Directory {