diff --git a/doc/conf.py b/doc/conf.py
index 2e370b2d7b4ed..17cdb814d230f 100644
--- a/doc/conf.py
+++ b/doc/conf.py
@@ -171,7 +171,8 @@
# further. For a list of options available for each theme, see the
# documentation.
html_theme_options = {
- "google_analytics": True,
+ "legacy_google_analytics": True,
+ "analytics": True,
"mathjax_path": mathjax_path,
"link_to_live_contributing_page": not parsed_version.is_devrelease,
}
diff --git a/doc/themes/scikit-learn-modern/javascript.html b/doc/themes/scikit-learn-modern/javascript.html
index fc0dca1040e03..31bd5d00adefc 100644
--- a/doc/themes/scikit-learn-modern/javascript.html
+++ b/doc/themes/scikit-learn-modern/javascript.html
@@ -1,4 +1,4 @@
-{% if theme_google_analytics|tobool %}
+{% if theme_legacy_google_analytics|tobool %}
{% endif %}
+{% if theme_analytics|tobool %}
+
+{% endif %}
+