Google Analytics
Learn how to add Google Analytics to your Fern Docs for tracking and insights.
Fern supports integrating with both Google Analytics 4 and Google Tag Manager. Follow the steps below to configure these services.
Google Analytics 4
Prerequisites
Before you begin, ensure you have a Google Analytics 4 property ID. This ID is typically in the format G-XXXXXXXXXX
.
Integration Steps
- Open your
docs.yml
file. - Add your Google Analytics 4 property ID under the
measurement-id
key. - Verify data in Google Analytics. Note that it may take 24–48 hours for website traffic data to start appearing. You can check your browser’s developer tools or the network tab to confirm that the analytics script is loading correctly.
Example configuration:
docs.yml
You can optionally add the ID as an environment variable:
docs.yml
Google Tag Manager
Prerequisites
To use Google Tag Manager, obtain a container ID from your Google Tag Manager account. This ID follows the format GTM-XXXXXX
.
Integration Steps
- Open your
docs.yml
file. - Add your Google Tag Manager container ID under the container-id key.
- Verify data in Google Analytics. Note that it may take 24–48 hours for website traffic data to start appearing. You can check your browser’s developer tools or the network tab to confirm that the analytics script is loading correctly.
Example configuration:
docs.yml
You can optionally add the ID as an environment variable:
docs.yml