Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

react-ga4

Package Overview
Dependencies
Maintainers
1
Versions
16
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-ga4

React Google Analytics 4

  • 2.1.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created

What is react-ga4?

The react-ga4 npm package is a React library for integrating Google Analytics 4 (GA4) into your React applications. It provides a simple and efficient way to track page views, events, and other user interactions within your app.

What are react-ga4's main functionalities?

Initialize GA4

This feature allows you to initialize Google Analytics 4 with your tracking ID. This is the first step to start tracking user interactions.

import ReactGA from 'react-ga4';

ReactGA.initialize('G-XXXXXXXXXX');

Track Page Views

This feature allows you to track page views in your application. It sends a pageview hit to Google Analytics whenever a user navigates to a new page.

import ReactGA from 'react-ga4';

ReactGA.send({ hitType: 'pageview', page: window.location.pathname });

Track Events

This feature allows you to track specific events within your application. You can categorize events and specify actions to get detailed insights into user interactions.

import ReactGA from 'react-ga4';

ReactGA.event({ category: 'User', action: 'Created an Account' });

Track User Timings

This feature allows you to track user timings, such as how long it takes for a particular resource to load. This can help you measure and optimize performance.

import ReactGA from 'react-ga4';

ReactGA.timing({ category: 'JS Libraries', variable: 'load', value: 20 });

Other packages similar to react-ga4

Keywords

FAQs

Package last updated on 06 Mar 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc