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

react-ga

Package Overview
Dependencies
Maintainers
3
Versions
53
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-ga

React Google Analytics Module

  • 3.3.1
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
294K
increased by1.41%
Maintainers
3
Weekly downloads
 
Created

What is react-ga?

react-ga is a JavaScript library for integrating Google Analytics with React applications. It provides a simple API to track page views, events, and other interactions within a React app.

What are react-ga's main functionalities?

Initialize Google Analytics

This feature allows you to initialize Google Analytics with your tracking ID. It sets up the necessary configurations to start tracking user interactions.

const ReactGA = require('react-ga');
ReactGA.initialize('UA-000000-01');

Track Page Views

This feature allows you to track page views. It sends the current page path and query string to Google Analytics.

ReactGA.pageview(window.location.pathname + window.location.search);

Track Events

This feature allows you to track specific events, such as user actions. You can categorize events and specify the action taken.

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 resource to load. You can categorize the timing, specify the variable, and provide a value in milliseconds.

ReactGA.timing({
  category: 'JS Libraries',
  variable: 'load',
  value: 20, // in milliseconds
  label: 'CDN'
});

Other packages similar to react-ga

Keywords

FAQs

Package last updated on 16 Jun 2022

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