[ Web Proxy ]
URL:
Viewing: https://firebase.google.com/docs/analytics/flutter/get-started [Back]  [Original]

Get started with Google Analytics for Flutter  |  Google Analytics for Firebase Skip to main content
Overview Fundamentals AI Build Run Reference Samples
Firebase [Firebase]
Send feedback

Get started with Google Analytics for Flutter Stay organized with collections Save and categorize content based on your preferences.

Select platform: iOS+ Android Web Flutter Unity C++


This quickstart shows you how to add Google Analytics to your app and begin logging events.

Google Analytics collects usage and behavior data for your app. The SDK logs two primary types of information:

Analytics automatically logs some events and user properties; you don't need to add any code to enable them.

Before you begin

  1. Install firebase_core and add the initialization code to your app if you haven't already.

  2. Register your app in your Firebase project using the Firebase console.

  3. (Recommended) Add the AdSupport framework to your project to enable additional features such as audiences and campaign attribution.

Add the Analytics SDK to your app

  1. From the root of your Flutter project, run the following command to install the plugin:

    flutter pub add firebase_analytics
    
  2. Once complete, rebuild your Flutter application:

    flutter run
    
  3. Once installed, you can access the firebase_analytics plugin by importing it in your Dart code:

    import 'package:firebase_analytics/firebase_analytics.dart';
    
  4. Create a new Firebase Analytics instance by accessing the instance property on FirebaseAnalytics:

    FirebaseAnalytics analytics = FirebaseAnalytics.instance;
    

Start logging events

After you have created a FirebaseAnalytics instance, you can begin to log events with the library's log- methods.

Certain events are recommended for all apps; others are recommended for specific business types or verticals. You should send recommended events along with their prescribed parameters, to ensure maximum available detail in your reports and to benefit from future features and integrations as they become available. This section demonstrates logging a predefined event, for more information on logging events, see Log events.

The following code logs a checkout event:

await FirebaseAnalytics.instance
  .logBeginCheckout(
    value: 10.0,
    currency: 'USD',
    items: [
      AnalyticsEventItem(
        itemName: 'Socks',
        itemId: 'xjw73ndnw',
        price: '10.0'
      ),
    ],
    coupon: '10PERCENTOFF'
  );

Next steps

Send feedback

Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.

Last updated 2026-08-19 UTC.

Need to tell us more? [[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2026-08-19 UTC."],[],[]]

Web Proxy Viewer  |  New URL  |  Original Page