Set Up Google Analytics
Add a GA4 measurement ID to see visits to your website
Enable Google Analytics if you want to track visits. Add your measurement ID, redeploy, then check that a visit appears.
1. Get Your Measurement ID
- Open Google Analytics and create or choose a GA4 property.
- Under Admin → Data streams, create a web stream for your website.
- Copy the measurement ID starting with
G-.
2. Add It to the Project
Set your ID in .env.production:
VITE_GA_MEASUREMENT_ID=G-XXXXXXXXXXRebuild and deploy using the Cloudflare guide. For automated builds, you can set this variable in the build environment instead.
To test locally, add the ID to .env and restart pnpm dev. This is a public analytics ID, not a server secret.
3. Check a Visit
Open your live website, then open GA4's Realtime report. Wait briefly and confirm that your visit appears.
If it does not, check that the ID belongs to the selected property, that you rebuilt the website, and that the browser's ad blocker is not blocking analytics requests.
What Is Tracked
The project includes the base Google tag. Custom conversion events for signup, payment, and AI generation need to be added separately; setting the ID does not create those reports.
To turn analytics off, clear the variable, rebuild, and deploy. Update your privacy policy to reflect the analytics service you use.