How do you check Google Analytics is working on a Lovable site?

To check Google Analytics on a Lovable site, confirm the GA4 tag is in the page head, open GA4's Realtime report while you browse the published site, and check page views fire on every route, not just the first. Then visit with UTM parameters and confirm GA4 attributes the session to your test campaign.

  1. Add the GA4 tag to the site's HTML head.
  2. Publish and open GA4 Realtime.
  3. Navigate between routes and watch page views.
  4. Visit with ?utm_source=test and check acquisition.
  5. Run an attribution audit.

Your Lovable site needs the GA4 tag in the head, page views on every route, and UTMs kept through navigation, so leads arrive with their source.

Step 1: add the GA4 tag

Lovable builds React single-page apps. The simplest install is the Google tag snippet in index.html, inside the head. You can ask Lovable to add it with a prompt such as "Add this Google Analytics 4 tag to the head of index.html" and paste your measurement ID snippet from GA4's Admin, Data streams. Google's tag setup docs have the current snippet.

Step 2: check it fires

Open the published site (not the editor preview) and GA4's Realtime report side by side. You should see yourself within a minute. Google's Tag Assistant shows each hit.

Step 3: check every route

Single-page apps change routes without reloading. GA4's enhanced measurement can record history changes as page views, but check it does:

TestPass
Load home page1 page_view
Click to /pricingAnother page_view
Click backAnother page_view

If only the first fires, enable "Page changes based on browser history events" in enhanced measurement, or send page views on route change.

Step 4: check UTMs survive

Visit /?utm_source=test&utm_medium=check&utm_campaign=lovable-ga, browse, then look in Realtime under traffic source. GA4 handles the session. Your forms are a separate question: GA4 doesn't put the source on the lead. For that, see adding lead attribution to vibe-coded forms.

Step 5: run the audit

The attribution audit scans the site for the tag, consent, redirects and form capture.

That's the manual check. To skip the form side, pre-register for Trakt and every lead arrives with its source attached.

Why Lovable analytics quietly breaks (and how Trakt helps)

A regeneration rewrites index.html and drops the tag. Consent banners block it. Forms post to an endpoint that knows nothing about the visit.

How Trakt closes the gap

Trakt works with all AI-built sites, including Lovable. It adds auto-injected hidden UTM fields to your forms, keeps the source in a first-party cookie, and shows leads by source, with email and Slack alerts for new leads.

GA4 alone vs. Trakt, by requirement

RequirementGA4 aloneTrakt
Page views and sessionsYesNot its job
Source on each leadNoAuto-injected hidden UTM fields
Leads by sourceNoLeads-by-source overview
A tag that's installedSame either waySame either way

FAQ

Does Lovable support Google Analytics?

You can add the GA4 tag to a Lovable site's HTML head, either by editing the code or by prompting Lovable to add it. Check Lovable's current docs for any built-in option.

How do I connect Lovable to Google Analytics?

Copy the Google tag snippet from GA4's data stream settings and add it to the head of index.html. Publish, then confirm in GA4 Realtime.

Why does GA4 only record the first page on my Lovable site?

Single-page apps don't reload between routes. Enable history-change page views in enhanced measurement, or send page views on route change.

Why is GA4 showing no data for my Lovable site?

The tag may be missing from the published build, blocked by consent, or using the wrong measurement ID. Check the page source and Tag Assistant.

Does Google Analytics show where my Lovable leads came from?

Not per lead. GA4 reports sessions and events. To see the source on each lead, the form submission has to carry it.

Is there a free way to check tracking on a Lovable site?

Yes, the free attribution audit scans the site's tracking setup.

What to do first

Open your published Lovable site next to GA4 Realtime, click through three routes, and count page views. Fewer than three means fix route tracking first.