Skip to content
This repository was archived by the owner on Feb 14, 2025. It is now read-only.

[Help] ReactGA.Send command doesn't work #48

Open
felipe-ff opened this issue Jul 28, 2022 · 3 comments
Open

[Help] ReactGA.Send command doesn't work #48

felipe-ff opened this issue Jul 28, 2022 · 3 comments

Comments

@felipe-ff
Copy link

felipe-ff commented Jul 28, 2022

I have the following code in my React app:

import { useEffect} from "react";
import { useLocation } from "react-router-dom";
import ReactGA from "react-ga4";

const usePageTracking = () => {
  const location = useLocation();

  useEffect(() => {
    ReactGA.initialize("G-XXXXXXXXX");
    const path = location.pathname + location.search;
    console.log(path);
    ReactGA.send({ hitType: "pageview", page: path});
  }, [location]);
};

export default usePageTracking;

The console.log prints correctly (/home) but nothing logs on firebase events panel, the only events I see are: first_visit and session_start.

The Live users in the last 30 minutes works fine.

Am I missing something?

@Amethystafyy282
Copy link

Have u found any solution or other packages for this?

@martinspenkevics
Copy link

Try to use the param legacyDimensionMetric: false.
Got the solution from here: #27 (comment)

@lithika-damnod
Copy link

I got the issue fixed by adding hitType property ..

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants