Search Unity

using Firebase Analytics in Unity

Discussion in 'Formats & External Tools' started by dccoo, May 15, 2018.

  1. dccoo

    dccoo

    Joined:
    Oct 3, 2015
    Posts:
    161
    I made an app (for Android and iOS) with Unity and I'd like to use Firebase Analytics on it.

    What should I do in order to log events?

    What I already did:
    1. Downloaded Firebase SDK and imported FirebaseAnalytics.unitypackage into my project
    2. Created a new project in https://console.firebase.google.com/u/1/
    3. Downloaded google-services.json and imported into my project
    What I don't know:
    1. Do I need to make any other configuration or create a new project for iOS?
    2. What kind of C# code do I write in order to start Firebase and log events?
    3. I already used Firebase once in xcode and I remember the App ID was necessary, is it?
     
  2. Anthony_cts

    Anthony_cts

    Joined:
    Mar 11, 2017
    Posts:
    7
    Did you manage to make Firebase Analytics log any events? I tried the sample projects for Authentication and realtime database end they all work fine. Firebase analytics doesn't work at all for me. My dashboard doesn't show any activity after 48hours. Any clues?
     
  3. DavidZobrist

    DavidZobrist

    Joined:
    Sep 3, 2017
    Posts:
    234
    Same Auth tested succesfully, the analytics do not log anything..
     
  4. jediah_hutch

    jediah_hutch

    Joined:
    Dec 6, 2018
    Posts:
    5
    Hello,

    I think that events only get logged from actual devices, but I could be wrong. I'll post my findings, if anyone can confirm this suspicion?
     
  5. DavidZobrist

    DavidZobrist

    Joined:
    Sep 3, 2017
    Posts:
    234
    Analytics started working 1-2 days after implementing them together with crashlytics.
    Which has to be initialized on the game start with the script from their tutorial. All works correct now!
     
  6. mistergreen2016

    mistergreen2016

    Joined:
    Dec 4, 2016
    Posts:
    226
    Has anybody got Analytics to work? I test run it on a device and no analytic data. Not sure if I have wait days for it to work. Or do I need to upload this on the APP Store for this to work?
     
  7. mistergreen2016

    mistergreen2016

    Joined:
    Dec 4, 2016
    Posts:
    226
    Got Analytic to log events to Firebase.
    There's no documentation except in the sample on Github.
    You need to add code on your on startup.
    Code (CSharp):
    1.   FirebaseAnalytics.SetAnalyticsCollectionEnabled(true);
     
  8. UnNammed

    UnNammed

    Joined:
    Jun 29, 2018
    Posts:
    1
    Did it work for You?
     
  9. mistergreen2016

    mistergreen2016

    Joined:
    Dec 4, 2016
    Posts:
    226
    Of course I did. That's why I posted the code....
    This is what Firebase recommends
    Code (CSharp):
    1. FirebaseApp.CheckAndFixDependenciesAsync().ContinueWithOnMainThread(task => {
    2.             FirebaseAnalytics.SetAnalyticsCollectionEnabled(true);
    3. });
    4.  
    For further info
    https://github.com/firebase/quickstart-unity
     
    Last edited: Sep 20, 2019
  10. im_ahsankhan

    im_ahsankhan

    Joined:
    Oct 31, 2015
    Posts:
    1
    Hello i have implemented the Firebase Analytics, now i am getting the events but the in user count column i am getting user only 1 or 2 and events are in thousands count like event is 18000 and user is 2, any one know solution of this issue , Thanks...
     
  11. manuelgoellnitz

    manuelgoellnitz

    Joined:
    Feb 15, 2017
    Posts:
    397
    What did you do to get the events?
    • I configured firebase on their dashboard
    • I installed the SDK
    • added the config files
    • Installed the firebase analytics samples
    • debug.log the config of the firebase-object to ensure that it has the correct data
    The sample sends some events, and there is no error, but there are no events in the dashboard, even after 24h.

    And I checked the Firebase-Authentication sample as well and could create a new firebase account with that, so the SDK seems to work.