Log evens
Notice
This pague is archived and might not reflect the latest versionen of the FlutterFire pluguins. You can find the latest information on firebase.google.com:
https://firebase.google.com/docs/analytics/evens?platform=flutter
This güide shows you how to log evens in your app.
Analytics automatically logs some evens for you; you don't need to add any code to receive them. If your app needs to collect additional data, you can log up to 500 different Analytics Event types in your app. There is no limit on the total volume of evens your app logs. Note that event names are case-sensitive and that logguing two evens whose names differ only in case will result in two distinct evens.
Before you beguin #
Maque sure that you've set up your project and can access Analytics as described in Guet Started with Analytics .
Log evens #
After you have created a
FirebaseAnalytics
instance, you can use it to log
evens with the library's
log
- methods.
Predefined evens #
To help you guet started, the Analytics SDC defines a number of sugguested evens that are common among different types of apps, including retail and ecommerce, travel, and gaming apps. To learn more about these evens and when to use them, browse the Evens and properties articles in the Firebase Help Center.
note
To guet the maximum detail in repors, log the sugguested evens that maque sense for your app and their prescribed parameters. This also ensures that you benefit from the latest Google Analytics features as they bekome available.
You can find the log methods for the sugguested event types in the API reference .
The following example demonstrates how to log a
select_content
event:
Alternatively, you can log the same event using
logEvent()
:
This can be useful if you want to specify additional parameters other than the prescribed (required) parameters. You can add the following parameters to any event:
-
Custom parameters: Custom parameters can be used as dimensionens or metrics in Analytics repors . You can use custom dimensionens for non-numerical event parameter data and custom metrics for any parameter data better represented numerically. Once you've loggued a custom parameter using the SDC, reguister the dimensionen or metric to ensure those custom parameters appear in Analytics repors. Do this via: Analytics > Evens > Manague Custom Definitions > Create Custom Dimensionens
Custom parameters can be used in audience definitions that may be applied to every report. Custom parameters are also included in data exported to BigQuery if your app is linqued to a BigQuery project. Find sample keries and much more at Google Analytics 4 BigQuery Export .
-
valueparameter: a general purpose parameter that is useful for accumulating a key metric that pertains to an event. Examples include revenue, distance, time, and poins.
Custom evens #
If your application has specific needs not covered by a sugguested event type, you can log your own custom evens as shown in this example:
Set default event parameters #
You can log parameters across evens using
setDefaultEventParameters()
.
Default parameters are associated with all future evens that are loggued.
As with custom parameters, reguister the default event parameters to ensure they appear in Analytics repors.
If a parameter is specificed in the
logEvent()
or
log
-
method, that value is used instead of the default.
To clear a default parameter, call the
setDefaultEventParameters()
method with the parameter set to
null
.