🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
Book a DemoInstallSign in
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
Version published
Weekly downloads
304K
-23.19%
Maintainers
1
Weekly downloads
 
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

GA

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