Google Analytics Not Tracking in Lovable App
Google Analytics (GA4) shows zero or very low traffic for your Lovable app, even though you know users are visiting. Page views aren't being recorded, events aren't firing, or the Real-Time report shows no active users when you're actively browsing the site.
Without analytics, you're flying blind — you can't see how many users visit your app, which pages they use, where they drop off, or whether your marketing efforts are working. Accurate analytics are essential for making data-driven decisions about your app.
The problem may be total (no data at all) or partial (some pages tracked, others not; page views work but events don't).
Error Messages You Might See
Common Causes
- Tracking code not installed — The GA4 measurement ID or gtag.js script is missing from your pages
- Wrong measurement ID — Using the old UA- format instead of the G- format required by GA4
- SPA navigation not tracked — React's client-side routing doesn't trigger page views automatically in GA4
- Ad blockers blocking tracking — Many users have ad blockers that prevent Google Analytics from loading
- Content Security Policy blocking — CSP headers prevent the analytics script from loading or sending data
How to Fix It
- Verify the tracking code — Check that the gtag.js script is in your HTML <head> with the correct G-XXXXXXXXX measurement ID
- Check Real-Time report — Open your app in a browser, then check GA4 Real-Time report to see if your visit registers
- Track SPA page views — For React apps, use gtag('config', 'G-XXXXXXXXX', { page_path: window.location.pathname }) on route changes
- Use GA4 Debug mode — Install the GA Debugger Chrome extension to see events being sent in real-time
- Check for script blockers — Open DevTools Network tab, filter by 'google', and see if analytics requests are being blocked
Real developers can help you.
You don't need to be technical. Just describe what's wrong and a verified developer will handle the rest.
Get HelpFrequently Asked Questions
Why does GA4 show fewer visitors than I expect?
Ad blockers and privacy-focused browsers (Safari, Brave) block Google Analytics for many users. Typically 20-40% of traffic is invisible to GA4. Consider server-side analytics as a supplement.
How do I track page views in a React SPA?
React's client-side routing doesn't trigger traditional page loads. You need to manually send page_view events on route changes using gtag or a React-specific library like react-ga4.