For AI agents: a documentation index is available at the root level at /llms.txt and /llms-full.txt. Append /llms.txt to any URL for a page-level index, or .md for the markdown version of any page.
Book a demoLog inStart for free
  • Getting started
    • Overview
    • How it works
    • Quickstart
    • Project structure
    • Customer showcase
    • Changelog
  • Configuration
    • Overview
    • Site-level settings
    • Page-level settings
  • Writing content
    • Markdown basics
    • Rich media in Markdown
    • Fern Editor
    • Reusable snippets
  • AI features
    • Overview
    • Fern Writer
    • AI-generated examples
    • Markdown access
      • Overview
      • Customize LLM output
      • Agent directives
      • Analytics and integration
    • MCP server
    • API catalog discovery
      • Overview
      • PostHog
      • Google
      • Segment
      • Mixpanel
      • Analytics events reference
      • Fullstory
      • Intercom
      • Postman
      • Context7
  • Public API
    • GETJWT from Fern API key
    • GETAlgolia search credentials
    • GETCurrent user information
  • Fern Writer API
    • GETGet Fern Writer Install Link
Checking status...
SOC2Soc 2 Type II
© 2026 Fern • Birch Solutions, Inc., a Postman company

Documentation

SDKsDocsAsk FernCLI Reference

API Definitions

OpenAPIAsyncAPIOpenRPCgRPC

Resources

BlogSupportPricing

Company

Brand KitPrivacy PolicyTerms of Service
LogoLogo
Book a demoLog inStart for free
On this page
  • Google Analytics 4
  • Google Tag Manager
Analytics & integrations

Google Analytics

Integrate Google Analytics 4 and Google Tag Manager with Fern Docs. Complete setup instructions for tracking website traffic and insights.
||View as Markdown|
Was this page helpful?
Edit this page
Previous

PostHog

Next

Segment

Fern supports integrating with both Google Analytics 4 and Google Tag Manager.

Google Analytics 4

Before you begin, ensure you have a Google Analytics 4 property ID. This ID is typically in the format G-XXXXXXXXXX.

1

Add GA4 to docs.yml

Open your docs.yml file and add your Google Analytics 4 property ID under the measurement-id key:

docs.yml
1analytics:
2 ga4:
3 measurement-id: G-12345678

You can optionally add the ID as an environment variable:

docs.yml
1analytics:
2 ga4:
3 measurement-id: ${GA4_MEASUREMENT_ID} # scans for GA4_MEASUREMENT_ID environment variable
2

Verify your integration

Check your browser’s developer tools or the network tab to confirm that the analytics script is loading correctly. Note that it may take 24–48 hours for website traffic data to start appearing in Google Analytics.

Google Tag Manager

Before you begin, obtain a container ID from your Google Tag Manager account. This ID follows the format GTM-XXXXXX.

1

Add GTM to docs.yml

Open your docs.yml file and add your Google Tag Manager container ID under the container-id key:

docs.yml
1analytics:
2 gtm:
3 container-id: GTM-NS32L7KR

You can optionally add the ID as an environment variable:

docs.yml
1analytics:
2 gtm:
3 container-id: ${GTM_CONTAINER_ID} # scans for GTM_CONTAINER_ID environment variable
2

Verify your integration

Check your browser’s developer tools or the network tab to confirm that the analytics script is loading correctly. Note that it may take 24–48 hours for website traffic data to start appearing in Google Analytics.