What It Does
Enables GA4 event and page-view tracking through the @kit/google-analytics provider.
When To Use
- You selected
googleincreateAnalyticsManager([...]).
Prerequisites
- A GA4 property and Measurement ID.
How To Use
Find your GA_MEASUREMENT_ID first:
Create a GA4 property and open Admin.
Under Data collection and modification, open Data Streams.
Select your Web stream.
Copy the GA_MEASUREMENT_ID shown in the stream details.

Google Analytics Measurement ID location
Set client env vars:
NEXT_PUBLIC_GA_MEASUREMENT_ID=G-XXXXXXXXXX
NEXT_PUBLIC_GA_DISABLE_LOCALHOST_TRACKING=true
NEXT_PUBLIC_GA_DISABLE_PAGE_VIEWS_TRACKING=falseThese variables are validated in kit/analytics/google-analytics/envs.ts.
If setup fails, use the official GA4 developer docs to verify stream and measurement ID configuration.
MCP Context
capability: google_analytics_provider
entrypoints:
- kit/analytics/google-analytics/envs.ts
inputs:
- NEXT_PUBLIC_GA_MEASUREMENT_ID
outputs:
- ga_tracking_enabled
constraints:
- measurement id must match GA4 property
side_effects:
- client analytics traffic sent to Google AnalyticsAgent Recipe
- Add GA env vars.
- Ensure provider list includes
google. - Verify data in GA real-time view.
Troubleshooting
- No page views: check
NEXT_PUBLIC_GA_DISABLE_PAGE_VIEWS_TRACKING. - Local spam: set
NEXT_PUBLIC_GA_DISABLE_LOCALHOST_TRACKING=true.
Related
Analytics
Track page views and events with pluggable analytics providers.
Umami
Configure Umami analytics provider.
How is this guide?
Last updated on 3/23/2026