New analytics#27
Merged
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR updates the Sphinx docs site’s custom HTML layout to simplify analytics by removing environment-based analytics configuration from conf.py and hardcoding a single Google Tag Manager (GTM) container ID directly in the template.
Changes:
- Removed
_env_id()and all analytics-relatedhtml_contextvariables fromconf.py(no more env-var-driven analytics IDs). - Simplified
_templates/layout.htmlto always load GTM using a hardcoded container ID and added the GTM<noscript>fallback. - Made the cookie consent banner/backdrop always render by removing conditional checks around analytics configuration.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
conf.py |
Removes environment-based analytics context/config helpers. |
_templates/layout.html |
Hardcodes GTM loading and simplifies consent/banner rendering logic. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
6
to
10
| <script> | ||
| window.dataLayer = window.dataLayer || []; | ||
| function gtag(){dataLayer.push(arguments);} | ||
| gtag('consent', 'default', { | ||
| window.dataLayer.push({ | ||
| 'event': 'default_consent', | ||
| 'analytics_storage': 'denied', |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This pull request simplifies analytics integration in the custom Sphinx HTML layout by removing environment-based configuration and hardcoded analytics IDs directly into the template. It also streamlines the logic for loading Google Tag Manager (GTM) and displaying the cookie consent banner.
Analytics integration and configuration:
_env_idfunction and all related logic fromconf.py, eliminating the use of environment variables for analytics configuration. (conf.py[1] [2]GTM-PWRR783T) directly into the_templates/layout.htmltemplate, removing conditional logic for loading analytics scripts. (_templates/layout.html_templates/layout.htmlL4-R30)Template and cookie consent logic:
extraheadblock of_templates/layout.html, always loading GTM and removing support for GA4/gtag and conditional script inclusion. (_templates/layout.html_templates/layout.htmlL4-R30)_templates/layout.html[1] [2]extrabodyblock for improved tag coverage. (_templates/layout.html_templates/layout.htmlL4-R30)