Guide

Install EazyStats in 2 minutes

Step-by-step guides to install EazyStats tracking code on your platform

React

ReactReact Integration

Add EazyStats to your React project

Follow these simple steps to integrate EazyStats analytics into your React application and start tracking your users.

1

Add tracking script to root component

The recommended way to add scripts to all pages in a React application is by adding it to your root component.

folder_openOpen your root component

Usually App.jsx or main.jsx

codeApp.jsx
          
      import { useEffect } from 'react';

        function App() {
        useEffect(() => {
            // Add EazyStats script
            const script = document.createElement('script');
            script.defer = true;
            script.setAttribute('data-site-id', 'your_website_id');
            script.setAttribute('data-site-domain', 'yourdomain.com');
            script.src = 'https://eazystats.com/tracker.js';
            document.head.appendChild(script);

            // Cleanup on unmount
            return () => {
            if (document.head.contains(script)) {
                document.head.removeChild(script);
            }
            };
        }, []);

        return (
            // Your app content
        );
        }

        export default App;
        
warning

Replace Placeholder Values

Important: Make sure to replace the placeholder values:

  • your_website_id → Your actual Website ID from EazyStats
  • yourdomain.com → Your website's root domain
2

Alternative: Using public/index.html

You can also add the script directly to your public/index.html file if you prefer:

codepublic/index.html
<script
  defer=""  data-site-id="your_website_id"  data-site-domain="yourdomain.com"  src="https://eazystats.com/tracker.js"
> </script>
3

Verify installation

After implementing either method above, follow these steps to verify everything is working:

rocket_launchDeploy

Visit your live website

analyticsCheck Dashboard

View your dashboard for incoming data

scheduleWait

Data appears within a few minutes

celebrationYou're all set!

Your React app should now be tracking visitors with EazyStats. Check your dashboard to see your analytics!