{"library":"sphinxcontrib-googleanalytics","title":"Sphinx Google Analytics Extension","type":"library","description":"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.","language":"python","status":"active","last_verified":"Thu Apr 16","install":{"commands":["pip install sphinxcontrib-googleanalytics"],"cli":null},"imports":["# In conf.py, add to extensions list:\nextensions = ['sphinxcontrib.googleanalytics']"],"auth":{"required":false,"env_vars":[]},"links":{"homepage":null,"github":"https://github.com/sphinx-contrib/googleanalytics","docs":null,"changelog":null,"pypi":"https://pypi.org/project/sphinxcontrib-googleanalytics/","npm":null,"openapi_spec":null,"status_page":null,"smithery":null},"quickstart":{"code":"import os\n\n# conf.py example\n\nproject = 'My Project'\ncopyright = '2026, My Team'\nauthor = 'My Team'\nrelease = '0.1'\n\nextensions = [\n    'sphinx.ext.autodoc',\n    'sphinx.ext.napoleon',\n    # Enable the Google Analytics extension\n]\n\n# Only enable Google Analytics if an ID is provided, useful for CI/CD environments\ngoogleanalytics_id = os.environ.get('GOOGLE_ANALYTICS_ID', '')\nif googleanalytics_id:\n    extensions.append('sphinxcontrib.googleanalytics')\n    # Optionally enable/disable tracking based on environment variable\n    # googleanalytics_enabled = os.environ.get('GOOGLE_ANALYTICS_ENABLED', 'True').lower() == 'true'","lang":"python","description":"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.","tag":null,"tag_description":null,"last_tested":null,"results":[]},"compatibility":null}