mirror of
https://github.com/readthedocs/sphinx_rtd_theme.git
synced 2025-02-25 18:55:21 -06:00
Add analytics_anonymize_ip option to theme (#889)
* Add analytics_anonymize_ip option to theme * Fix typo and use tobool filter Co-Authored-By: Jesse Tan <jessetan@users.noreply.github.com> * Simplify analytics_anonymize_ip description * Update changelog.rst Co-authored-by: Jesse Tan <jessetan@users.noreply.github.com> Co-authored-by: Aaron Carlisle <carlisle.b3d@gmail.com>
This commit is contained in:
parent
4366e9e3f8
commit
e2b60d7e7b
@ -5,6 +5,11 @@ Changelog
|
||||
master
|
||||
======
|
||||
|
||||
New Features
|
||||
------------
|
||||
|
||||
* New theme option to enable anonymous ip addresses when using Google Analytics (#889)
|
||||
|
||||
v0.5.0
|
||||
======
|
||||
|
||||
|
@ -15,6 +15,7 @@ For example:
|
||||
html_theme_options = {
|
||||
'canonical_url': '',
|
||||
'analytics_id': 'UA-XXXXXXX-1', # Provided by Google in your dashboard
|
||||
'analytics_anonymize_ip': False,
|
||||
'logo_only': False,
|
||||
'display_version': True,
|
||||
'prev_next_buttons_location': 'bottom',
|
||||
@ -101,6 +102,13 @@ Miscellaneous options
|
||||
If specified, Google Analytics' javascript is included in your pages.
|
||||
Set the value to the ID provided to you by google (like ``UA-XXXXXXX``).
|
||||
|
||||
.. confval:: analytics_anonymize_ip
|
||||
|
||||
:type: boolean
|
||||
:default: ``False``
|
||||
|
||||
Anonymize visitor IP addresses in Google Analytics.
|
||||
|
||||
.. confval:: canonical_url
|
||||
|
||||
:type: URL
|
||||
|
@ -229,6 +229,9 @@
|
||||
})(window,document,'script','https://www.google-analytics.com/analytics.js','ga');
|
||||
|
||||
ga('create', '{{ theme_analytics_id }}', 'auto');
|
||||
{% if theme_analytics_anonymize_ip|tobool %}
|
||||
ga('set', 'anonymizeIp', true);
|
||||
{% endif %}
|
||||
ga('send', 'pageview');
|
||||
</script>
|
||||
|
||||
|
@ -6,6 +6,7 @@ pygments_style = default
|
||||
[options]
|
||||
canonical_url =
|
||||
analytics_id =
|
||||
analytics_anonymize_ip = False
|
||||
collapse_navigation = True
|
||||
sticky_navigation = True
|
||||
navigation_depth = 4
|
||||
@ -15,4 +16,4 @@ logo_only =
|
||||
display_version = True
|
||||
prev_next_buttons_location = bottom
|
||||
style_external_links = False
|
||||
style_nav_header_background =
|
||||
style_nav_header_background =
|
||||
|
Loading…
Reference in New Issue
Block a user