
Security News
rv Is a New Rust-Powered Ruby Version Manager Inspired by Python's uv
Ruby maintainers from Bundler and rbenv teams are building rv to bring Python uv's speed and unified tooling approach to Ruby development.
react-ga-spa-helmet
Advanced tools
Reusable React GAProvider for SPAs with React Router and React Helmet. Tracks GA4 pageviews on route changes, dynamic titles, meta tags, and canonical links.
GAProvider
is a reusable React component that integrates Google Analytics 4 with React SPAs using React Router and React Helmet. It automatically tracks:
<Helmet>
)Perfect for SPAs where the document head updates dynamically and you want accurate GA pageviews.
# Using npm
npm install react-ga-spa-helmet
# Using yarn
yarn add react-ga-spa-helmet
Wrap your app with GAProvider
in main.tsx
:
import { StrictMode } from 'react';
import { createRoot } from 'react-dom/client';
import { BrowserRouter } from 'react-router-dom';
import { HelmetProvider } from 'react-helmet-async';
import App from './App';
import { GAProvider } from 'react-ga-spa-helmet';
createRoot(document.getElementById('root')!).render(
<StrictMode>
<HelmetProvider>
<BrowserRouter>
<GAProvider
measurementId="YOUR_GA_MEASUREMENT_ID"
trackMetaTags={['description', 'keywords', 'author', 'robots']}
>
<App />
</GAProvider>
</BrowserRouter>
</HelmetProvider>
</StrictMode>
);
Prop | Type | Required | Description |
---|---|---|---|
measurementId | string | ✅ | Your GA4 measurement ID (e.g., G-XXXXXXXXXX) |
children | ReactNode | ✅ | Your app component tree |
trackMetaTags | string[] | ❌ | Array of meta tag names to track (default: ['description','keywords','author','robots'] ) |
trackMetaTags
to monitor additional SEO tags.<GAProvider
measurementId="G-XXXXXXXXXX"
trackMetaTags={['description', 'keywords', 'author', 'robots', 'og:title', 'og:description']}
>
<App />
</GAProvider>
MIT License – free to use and modify.
FAQs
Reusable React GAProvider for SPAs with React Router and React Helmet. Tracks GA4 pageviews on route changes, dynamic titles, meta tags, and canonical links.
The npm package react-ga-spa-helmet receives a total of 4 weekly downloads. As such, react-ga-spa-helmet popularity was classified as not popular.
We found that react-ga-spa-helmet demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
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.
Security News
Ruby maintainers from Bundler and rbenv teams are building rv to bring Python uv's speed and unified tooling approach to Ruby development.
Security News
Following last week’s supply chain attack, Nx published findings on the GitHub Actions exploit and moved npm publishing to Trusted Publishers.
Security News
AGENTS.md is a fast-growing open format giving AI coding agents a shared, predictable way to understand project setup, style, and workflows.