From 89b0475539ac6763baa27f5fc334639ee3853ebf Mon Sep 17 00:00:00 2001 From: Cory Benfield Date: Fri, 4 Dec 2015 16:38:23 +0000 Subject: [PATCH] Make Google Analytics tracking optional. Some OpenStack contributors have expressed concern about having Google Analytics tracking codes embedded in all of the HTML documentation generated by the use of this theme. In addition to these concerns, which mostly focus on privacy, having the Google Analytics tracking code used widely runs the risk of creating misleading analytics data. This change adopts an approach used by the Alabaster theme, which enables Google Analytics tracking to be optional. Tracking is now controlled by the theme settings in conf.py using a new theme option, 'analytics_tracking_code'. If present, this causes the HTML to include the analytics tracking, with the provided code being used. If not present, the Google Analytics snippet is excluded from the documentation. To avoid breakage, this commit uses the current hard-coded Google Analytics tracking code as the default value of the option, which means that most users will not notice any change and may continue to be accidentally opted in to Google Analytics tracking. Change-Id: I156151c3f458931f13716b4a32087afe57483794 --- openstackdocstheme/theme/openstackdocs/layout.html | 4 +++- openstackdocstheme/theme/openstackdocs/theme.conf | 3 +++ releasenotes/notes/disable_analytics-45d98d6fab71d2b1.yaml | 5 +++++ 3 files changed, 11 insertions(+), 1 deletion(-) create mode 100644 releasenotes/notes/disable_analytics-45d98d6fab71d2b1.yaml diff --git a/openstackdocstheme/theme/openstackdocs/layout.html b/openstackdocstheme/theme/openstackdocs/layout.html index edec8907..b4c87cca 100644 --- a/openstackdocstheme/theme/openstackdocs/layout.html +++ b/openstackdocstheme/theme/openstackdocs/layout.html @@ -13,6 +13,7 @@ {% if favicon %} {% endif %} +{% if theme_analytics_tracking_code %} +{% endif %} {% include 'header.html' %} diff --git a/openstackdocstheme/theme/openstackdocs/theme.conf b/openstackdocstheme/theme/openstackdocs/theme.conf index e97a043c..5d6844af 100644 --- a/openstackdocstheme/theme/openstackdocs/theme.conf +++ b/openstackdocstheme/theme/openstackdocs/theme.conf @@ -2,3 +2,6 @@ inherit = basic stylesheet = css/basic.css pygments_style = native + +[options] +analytics_tracking_code = UA-17511903-1 diff --git a/releasenotes/notes/disable_analytics-45d98d6fab71d2b1.yaml b/releasenotes/notes/disable_analytics-45d98d6fab71d2b1.yaml new file mode 100644 index 00000000..393e67aa --- /dev/null +++ b/releasenotes/notes/disable_analytics-45d98d6fab71d2b1.yaml @@ -0,0 +1,5 @@ +--- +features: + - Google Analytics tracking may now be controlled by + setting the ``analytics_tracking_code`` option, or + removed entirely by leaving that option blank.