Cookie-Free Analytics for React
React apps built with Vite, Create React App, or similar tooling can add GhostlyX through the HTML entry point. The script tracks route changes automatically with React Router.
Installation guide
Add the script to public/index.html
For Vite and Create React App projects, open public/index.html and add the GhostlyX script inside the <head> tag.
<!-- public/index.html -->
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>My App</title>
<script defer src="https://cdn.ghostlyx.com/gx.js" data-site-id="YOUR_SITE_ID"><\/script>
</head>
Tracking React Router navigations
GhostlyX automatically detects URL changes in the browser, which includes React Router's history-based navigation. No additional integration code is needed.
Why React users choose GhostlyX
React SPAs often have complex routing that traditional analytics tools handle poorly. GhostlyX tracks every route change as a distinct pageview without any router integration code. For cookie compliance, this is especially useful for React apps that serve EU users from within a regulated product.
Cookie-free tracking
No consent banner required under GDPR or PECR
Under 1.5 kB script
Negligible impact on page speed and Core Web Vitals
Real-time dashboard
See visitors as they arrive, updated every few seconds
Free plan available
Start tracking without a credit card
Replacing Google Analytics on React?
See how GhostlyX compares feature by feature, including script size, GDPR compliance, and pricing.
Related integrations
Ready to add GhostlyX to React?
Free plan available. Setup takes 3 minutes. No cookie consent banner required.
Get started free