2

I am running a React web app on Firebase. Firebase automatically generates G-type measurement ID (G-XXXX). I'd like to get a UA-type measurement ID (UA-XXXX) and somehow integrate it into Firebase project.

Reason: I want to use React-GA package (https://github.com/react-ga/react-ga) but the package apparently does not support G type measurement IDs.

Is there any way to create and integrate the UA-type measurement ID somehow to Firebase project configuration? I'd love to see the data reflected into the Firebase console dashboard, not having to leave the console to see the data.

Any idea on how to do this? Thanks!

J.Ko
  • 6,561
  • 3
  • 12
  • 28

1 Answers1

1

I had done it before with the same package.

First; you need to add a "universal analytics property" manually on google analytics page. Because Firebase is only using latest version. Click admin icon at the bottom-left and then click + Create Property

You will see Show Advanced Options button. Enable this of an earlier version of Google Analytics. Once you finish you get your UA-xxxx code.

import ReactGA from 'react-ga';

class GAService {
    init() {
        ReactGA.initialize('UA-XXXXXXX-X');
        //ReactGA.pageview(window.location.pathname + window.location.search);
    }
}

const instance = new GAService();

export default instance;
Er.Se
  • 461
  • 3
  • 11