Google Analytics Integration

Add Google Analytics 4 (GA4) to your documentation site. Requires a measurement ID starting with G-.

Add Google Analytics 4 to your documentation site to understand how users interact with your content.

Google Analytics integration works with GA4 (Google Analytics 4) measurement IDs that start with G-.

Getting Your Measurement ID

  1. Go to Google Analytics
  2. Select your property (or create one)
  3. Go to AdminData Streams
  4. Select your web stream (or create one)
  5. 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 actual measurement ID.

Viewing Your Data

After adding the integration:

  1. Trigger a rebuild of your docs
  2. Visit your live documentation site
  3. In Google Analytics, go to ReportsReal-time
  4. You should see your visit appear 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're already using Google Tag Manager, you can configure GA4 through GTM instead of adding it directly. See Google Tag Manager Integration for details.

Don't add the same GA4 property both directly in docs.json and through Google Tag Manager—this will cause duplicate tracking.

Privacy Considerations

Google Analytics collects visitor data. Consider:

  • Adding a cookie consent banner if required by GDPR/CCPA
  • Updating your privacy policy to mention analytics
  • Using IP anonymization if needed

Troubleshooting

  1. Verify your measurement ID - It must start with G-
  2. Check for ad blockers - They may block analytics scripts
  3. Wait for rebuild - Changes require a new build to take effect
  4. 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)
Google Tag Manager

Use GTM for advanced tag management

Project Analytics

View built-in Jamdesk analytics