Skip to content

Cannot track screen name in React SPA #4228

Open
@florianmonfort

Description

@florianmonfort

Creating an issue here for tracking purposes and in case someone else has found a solution to this problem.

[REQUIRED] Describe your environment

  • Operating System version: NA
  • Browser version: Chrome, Edge
  • Firebase SDK version: 7.21.0
  • Firebase Product: Analytics (auth, database, storage, etc)

Steps to reproduce:

Events --> screen_view --> Filter by Stream = Web --> User engagement table --> Select screen name

What happens is, Firebase is always only registering in the Dashboard the screen_name as the page title in browser, instead of using the screen_name set in the code:

In DebugView:

image

In Dashboard:

image

image

-->

Relevant Code:

Our JS implementation to import:

    <script>
      // Your web app's Firebase configuration
      var firebaseConfig = {
        apiKey: "XXXXXX",
        authDomain: "XXXXXX",
        databaseURL: "XXXXXX",
        projectId: "XXXXXX",
        storageBucket: "XXXXXX",
        messagingSenderId: "XXXXXX",
        appId: "XXXXXX",
        measurementId: "XXXXXX",
      };
      // Initialize Firebase
      firebase.initializeApp(firebaseConfig);
      window.firebaseAnalytics = firebase.analytics();
    </script>

Our JS implementation to track each screen:

      function firebaseTrack(data, event = "screen_view") {
        if (window.firebaseAnalytics) {
          firebaseAnalytics.logEvent(event, data);
        }
      }
      firebaseTrack({ screen_name: "My bookings" });

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions