Search code examples
firebase-analytics

Firebase Analytics - accumulated value in Javascript client


I am trying to setup Firebase Analytics for my web app, which is written in JavaScript.

I see in the dashboard and in the doc that it is possible to have some field "accumulating" over the events (adding up), how do I set it up? How do I increment such field?


Solution

  • I found the answer myself using the documentation for the Android client: the parameter should simply be called value

    firebase.analytics.logEvent("your_event", {...options, value: 12345);
    

    A context-specific numeric value which is accumulated automatically for each event type.

    https://firebase.google.com/docs/reference/android/com/google/firebase/analytics/FirebaseAnalytics.Param