Google Analytics Integration
Add Google Analytics 4 to your documentation site with a measurement ID to track visitors and see which content they read.
Add Google Analytics 4 to your documentation site to see how readers use your content.
The integration takes GA4 (Google Analytics 4) measurement IDs that start with G-.
Getting Your Measurement ID
- Go to Google Analytics
- Select your property (or create one)
- Go to Admin → Data Streams
- Select your web stream (or create one)
- Copy the Measurement ID (starts with
G-)
Adding GA4 to Your Docs
Add the measurement ID to your docs.json:
{
"name": "My Docs",
"integrations": {
"ga4": {
"measurementId": "G-XXXXXXXXXX"
}
}
}Replace G-XXXXXXXXXX with your measurement ID.
Viewing Your Data
Check that data arrives:
- Trigger a rebuild of your docs
- Visit your live documentation site
- In Google Analytics, go to Reports → Real-time
- Your visit appears within 30 seconds
It can take 24-48 hours for data to appear in standard reports. Use Real-time reports for immediate verification.
Using with Google Tag Manager
If you already use Google Tag Manager, configure GA4 through GTM instead of adding it directly. See Google Tag Manager Integration for details.
Set up cookie consent banners yourself for any tags you load through Google Tag Manager. Jamdesk loads your GTM container for all visitors without a consent gate. See Cookie Consent to gate analytics until visitors opt in.
Don't add the same GA4 property directly in docs.json and through Google Tag Manager. That causes duplicate tracking.
Privacy Considerations
Google Analytics collects visitor data. Consider:
- Adding a cookie consent banner if GDPR/CCPA applies. Jamdesk loads GA4 for every visitor by default. Cookie Consent gates it until they opt in.
- Updating your privacy policy to mention analytics
- Using IP anonymization if needed
Troubleshooting
- Verify your measurement ID: it must start with
G- - Check for ad blockers: they may block analytics scripts
- Wait for rebuild: changes require a new build to take effect
- Use Real-time reports: standard reports have a 24-48 hour delay
The ID must:
- Start with
G- - Contain only letters and numbers after
G- - Be copied exactly from Google Analytics (no extra spaces)
