Skip to content

Commit 2d9ebda

Browse files
authored
Move credentials inside package (#13)
* Adding event for analyzer startup * Switching from hyphens to underscore; GA4 restriction * Making eventData nullable for events that don't need it * Update dash_analytics_example.dart * Added test to check for limitations below - Events can have a maximum of 25 user properties - User property names must be 24 characters or fewer - User property values must be 36 characters or fewer (only for `tool` name) - Event names must be 40 characters or fewer, may only contain alpha-numeric characters and underscores, and must start with an alphabetic character * Moved creds + edit to tool regex pattern * Update to match main branch regex * Clean up of constructor * Adding separator within event enums
1 parent e221a56 commit 2d9ebda

File tree

4 files changed

+14
-7
lines changed

4 files changed

+14
-7
lines changed

pkgs/dash_analytics/example/dash_analytics_example.dart

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,6 @@ final String apiSecret = '4yT8__oER3Cd84dtx6r-_A';
1111
// point of the tool
1212
final Analytics analytics = Analytics(
1313
tool: DashTool.flutterTools,
14-
measurementId: measurementId,
15-
apiSecret: apiSecret,
1614
flutterChannel: 'ey-test-channel',
1715
flutterVersion: 'Flutter 3.6.0-7.0.pre.47',
1816
dartVersion: 'Dart 2.19.0',

pkgs/dash_analytics/lib/src/analytics.dart

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,9 @@ abstract class Analytics {
2525
/// of the [Analytics] abstract class using the [LocalFileSystem]
2626
factory Analytics({
2727
required DashTool tool,
28-
required String measurementId,
29-
required String apiSecret,
28+
required String dartVersion,
3029
String? flutterChannel,
3130
String? flutterVersion,
32-
required String dartVersion,
3331
}) {
3432
// Create the instance of the file system so clients don't need
3533
// resolve on their own
@@ -48,8 +46,8 @@ abstract class Analytics {
4846
return AnalyticsImpl(
4947
tool: tool.label,
5048
homeDirectory: getHomeDirectory(fs),
51-
measurementId: measurementId,
52-
apiSecret: apiSecret,
49+
measurementId: kGoogleAnalyticsMeasurementId,
50+
apiSecret: kGoogleAnalyticsApiSecret,
5351
flutterChannel: flutterChannel,
5452
flutterVersion: flutterVersion,
5553
dartVersion: dartVersion,

pkgs/dash_analytics/lib/src/constants.dart

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,14 @@ reporting=1
5555
/// will be located
5656
const String kDartToolDirectoryName = '.dart';
5757

58+
/// The API secret associated with the GA4 instance's Measurement Protocol
59+
const kGoogleAnalyticsApiSecret = 'Ka1jc8tZSzWc_GXMWHfPHA';
60+
61+
/// The measurement ID related to the GA4 instance
62+
///
63+
/// Serves as an identifier for a web data stream
64+
const kGoogleAnalyticsMeasurementId = 'G-04BXPVBCWJ';
65+
5866
/// How many data records to store in the log file
5967
const int kLogFileLength = 2500;
6068

pkgs/dash_analytics/lib/src/enums.dart

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,14 @@
77
/// The [label] for each enum value is what will be logged, the [description]
88
/// is here for documentation purposes
99
enum DashEvent {
10+
// Events for flutter_tools
1011
hotReloadTime(
1112
label: 'hot_reload_time',
1213
description: 'Hot reload duration',
1314
toolOwner: DashTool.flutterTools,
1415
),
16+
17+
// Events for language_server
1518
lintUsageCounts(
1619
label: 'lint_usage_counts',
1720
description: 'Number of times each lint is enabled',

0 commit comments

Comments
 (0)