Registry / observability / sphinxcontrib-googleanalytics

sphinxcontrib-googleanalytics

JSON →
library0.5pypypiunverified

sphinxcontrib-googleanalytics is a Sphinx extension that enables tracking of generated HTML documentation files using the Google Analytics web service. The current version is 0.5, and it maintains an infrequent release cadence, with the latest release 0.5 published approximately 11 months ago and 0.4 released in January 2023.

pip install sphinxcontrib-googleanalytics
INSTALL
IMPORT
SIG · SPHINXCONTRIB-GOOG
S
sphinxcontrib-googleanalytics
observabilitypythonv0.5
Install
5.1s avg
Import
Disk
94MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v0.5 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.910 runs
installs and imports cleanly · install 0.0s · import 0.000s · 92.1MB
glibc
py 3.103.910 runs
installs and imports cleanly · install 5.1s · import 0.000s · 93MB
94MB installed
● package 94MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

sphinxcontrib.googleanalytics
# In conf.py, add to extensions list: extensions = ['sphinxcontrib.googleanalytics']
import sphinxcontrib.googleanalytics
This is a Sphinx extension and is enabled by adding its module name to the 'extensions' list in Sphinx's conf.py, not by a direct Python import statement for runtime use.

To quickly integrate sphinxcontrib-googleanalytics, add `sphinxcontrib.googleanalytics` to your `extensions` list in `conf.py` and set the `googleanalytics_id` variable to your Google Analytics Tracking ID (e.g., `G-XXXXXXXXX` for GA4 or `UA-XXXXXXXXX` for Universal Analytics). It's common to conditionally enable this based on an environment variable for local builds vs. production deployments, preventing local tracking.

import os # conf.py example project = 'My Project' copyright = '2026, My Team' author = 'My Team' release = '0.1' extensions = [ 'sphinx.ext.autodoc', 'sphinx.ext.napoleon', # Enable the Google Analytics extension ] # Only enable Google Analytics if an ID is provided, useful for CI/CD environments googleanalytics_id = os.environ.get('GOOGLE_ANALYTICS_ID', '') if googleanalytics_id: extensions.append('sphinxcontrib.googleanalytics') # Optionally enable/disable tracking based on environment variable # googleanalytics_enabled = os.environ.get('GOOGLE_ANALYTICS_ENABLED', 'True').lower() == 'true'
Debug
Known issues
deprecatedThe `analytics_id` and `analytics_anonymize_ip` options in the `Read the Docs Sphinx Theme` are deprecated. Users of this theme should switch to using `sphinxcontrib-googleanalytics` for Google Analytics integration.
fix
Remove `analytics_id` and `analytics_anonymize_ip` from `html_theme_options` in `conf.py`. Instead, add `sphinxcontrib.googleanalytics` to your `extensions` list and set `googleanalytics_id` directly in `conf.py`.
affects: sphinx_rtd_theme >= 3.0.0
gotchaGoogle Analytics (and thus this extension) may not inherently be compliant with GDPR without additional infrastructure to manage user consent.
fix
Consult legal advice regarding GDPR compliance for your specific use case. Consider alternative, privacy-focused analytics solutions if GDPR compliance is a strict requirement without custom implementation.
affects: All versions
gotchaEnsure you use the correct Google Analytics ID format for your property: `G-XXXXXXXXX` for Google Analytics 4 (GA4) or `UA-XXXXXXXXX` for Universal Analytics.
fix
Verify your Google Analytics property type and use the corresponding tracking ID format in your `conf.py` file.
affects: All versions
Upgrade
Version history
0.5latest on PyPI · released May 26, 2025
Audit
Dependencies
SphinxrequiredThis is a Sphinx extension and requires Sphinx to function. Specific Python version requirements are inherited from the Sphinx version in use.
Agent activity
14 hits · last 30 days
node
12
OpenAI (training)
1
Resources
sphinxcontrib-googleanalytics — pip install sphinxcontrib-googleanalytics · libregistry