Learn business growth with Google Analytics 4 › Forums › Google Analytics 4 › Integrating Google Analytics 4 with Inertia React in Laravel 10 › Reply To: Integrating Google Analytics 4 with Inertia React in Laravel 10
-
Sure thing, mate! This is pretty straightforward. Just import the react-ga4 package at the top of your file:
`javascript
import ReactGA from ‘react-ga4’;
`
Then, inside the
setup
function ofcreateInertiaApp
, you can initialize it with your Google Analytics measurement ID:`javascript
ReactGA.initialize(“your GA measurement ID”);
`
So, you’ll actually give Google Analytics a heads up when your app starts up. Pretty neat, huh? It’s alright if you didn’t catch it at first, it’s just a matter of seeing it once and you’ll know for next time. Cheers!