Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

args.category AND args.action are required in event() #62

Open
MrFarhan opened this issue Dec 1, 2023 · 1 comment
Open

args.category AND args.action are required in event() #62

MrFarhan opened this issue Dec 1, 2023 · 1 comment

Comments

@MrFarhan
Copy link

MrFarhan commented Dec 1, 2023

I have followed the documentation and added following code:

    ReactGA.event({
      category: 'Page Visit',
      label: `Employeer Name: ${localStorage.getItem("username")} visited ${window.location.pathname} `,
      action:"",
      nonInteraction:true
    });

But is is throwing following error:

args.category AND args.action are required in event()

I have also initialized react GA in app.js
ReactGA.initialize('G-mymeasurmentid');

@ospaarmann
Copy link

You need to set the action attribute to something else than ""

    ReactGA.event({
      category: 'Page Visit',
      label: `Employeer Name: ${localStorage.getItem("username")} visited ${window.location.pathname} `,
      action:"Action Name", // <- this is missing
      nonInteraction:true
    });

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

No branches or pull requests

2 participants