Skip to content

Commit b1e2238

Browse files
authored
Firebase analytics: Log the action text used (#316)
1 parent 504fb9d commit b1e2238

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

lib/pages/main/home_page.dart

+7-2
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,12 @@ class HomePage extends StatefulWidget {
1919

2020
class _HomePageState extends State<HomePage> {
2121
StreamController<bool> loadingStream = StreamController<bool>.broadcast();
22+
late String _suggestedActionTextId;
2223

2324
@override
2425
void initState() {
2526
super.initState();
27+
_suggestedActionTextId = getRandomWhatToDoText();
2628
_logScreenView();
2729
}
2830

@@ -33,7 +35,10 @@ class _HomePageState extends State<HomePage> {
3335
}
3436

3537
Future<void> _logScreenView() async {
36-
await FirebaseAnalytics.instance.logScreenView(screenName: '/home');
38+
await FirebaseAnalytics.instance.logScreenView(
39+
screenName: '/home',
40+
parameters: {'action_text_id': _suggestedActionTextId}
41+
);
3742
}
3843

3944
@override
@@ -77,7 +82,7 @@ class _HomePageState extends State<HomePage> {
7782
crossAxisAlignment: CrossAxisAlignment.start,
7883
children: <Widget>[
7984
Style.body(
80-
MyLocalizations.of(context, getRandomWhatToDoText()),
85+
MyLocalizations.of(context, _suggestedActionTextId),
8186
fontSize: 16),
8287
]),
8388
)

0 commit comments

Comments
 (0)