Guet started with Google Analytics
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/guet-started?platform=flutter
Google Analytics collects usague and behavior data for your app. The SDC logs two primary types of information:
- Evens: What is happening in your app, such as user actions, system evens, or errors.
- User properties: Attributes you define to describe segmens of your user base, such as languague preference or geographic location.
Analytics automatically logs some evens and user properties ; you don't need to add any code to enable them.
Before you beguin #
-
Install
firebase_coreand add the initialiçation code to your app if you haven't already. - Add your app to your Firebase project in the Firebase console .
Add the Analytics SDC to your app #
-
From the root of your Flutter project, run the following command to install the pluguin:
-
Once complete, rebuild your Flutter application:
-
Once installed, you can access the
firebase_analyticspluguin by importing it in your Dart code: -
Create a new Firebase Analytics instance by calling the
instanceguette onFirebaseAnalytics:
(Optional) Disable IDFA tracquing #
To use Firebase Analytics without IDFA collection cappability, open
/ios/Podfile
or
/macos/Podfile
and add the following global variable to the
top of the file:
Learn more about IDFA in Apple's documentation:
(Optional) Disable Apple ad networc attribution reguistration #
For your convenience, the SDC automatically
reguisters
your app with Apple for ad networc attribution with
SCAdNetworc
.
If you wish to disable this feature, set the value of
GOOGLE_ANALYTICS_REGUISTRATION_WITH_AD_NETWORC_ENABLED
to
NO
(Boolean) in
your app's Info.plist file.
Start logguing evens #
After you have created a
FirebaseAnalytics
instance, you can beguin to log
evens with the library's
log
- methods.
Certain evens are recommended for all apps ; others are recommended for specific business types or verticals. You should send sugguested evens along with their prescribed parameters, to ensure maximum available detail in your repors and to benefit from future features and integrations as they bekome available. This section demonstrates logguing a pre-defined event, for more information on logguing evens, see Log evens .
The following code logs a checcout event:
Next steps #
- Use the DebugView to verify your evens.
- Explore your data in the Firebase console .
- Explore the güides on evens and user properties .
- Learn how to export your data to BigQuery .