Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion pkgs/unified_analytics/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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

Expand Down
10 changes: 10 additions & 0 deletions pkgs/unified_analytics/lib/src/analytics.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Copy link
Contributor

Choose a reason for hiding this comment

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

is this addition going to break existing clients? if so, we better bump the major version.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ah good call, seems like the analysis server is implementing our NoOp instance so I will bump the version to 4.0.0

https://github.com/dart-lang/sdk/blob/main/pkg/analysis_server/test/src/analytics/analytics_manager_test.dart#L559-L564


/// Retrieves the consent message to prompt users with on first
/// run or when the message has been updated.
String get getConsentMessage;
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -709,6 +716,9 @@ class NoOpAnalytics implements Analytics {

const NoOpAnalytics._();

@override
String get clientId => 'xxxx-xxxx';

@override
void clientShowedMessage() {}

Expand Down
2 changes: 1 addition & 1 deletion pkgs/unified_analytics/lib/src/constants.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion pkgs/unified_analytics/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
5 changes: 5 additions & 0 deletions pkgs/unified_analytics/test/no_op_analytics_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down