skip to Main Content

I have a Flutter app. Normally, we can track events with one data. I want to track 2 data.

Normally with firebase we can track different events like:

  • screen_view
  • session_start
  • first_open
  • a
  • b

What do I want?

  • x | y together

How can I achieve this for my Flutter app in Firebase?

Must I use FireStore database? Is there way to do this with Firebase Analytics Events?

2

Answers


  1. Have you checked this documentation?

    All you got to do is set userId (using email or anything else you use) at your analytics implementation.

    await FirebaseAnalytics.instance.setUserId(id: 'YOUR_ID');
    

    As the documentation says:

    "After setting a user ID, all future events will be automatically
    tagged with this value, and you can access it by querying for the
    user_id value in BigQuery. Adding a user ID will not affect any events
    previously recorded by Google Analytics."

    Login or Signup to reply.
  2. You can track events with multiple data or parameter by doing:

    await FirebaseAnalytics.instance.logEvent(
        name: "screen_view",
        parameters: {
            "x": "value_of_x",
            "y": "vallue_of_y",
        },
    );
    

    I used screen_view as sample event name. You can check the docs here for more.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search