diff --git a/material/base.html b/material/base.html
index 75b7e0e180a..50e7f4c7cf1 100644
--- a/material/base.html
+++ b/material/base.html
@@ -71,9 +71,7 @@
{% endfor %}
{% block analytics %}
- {% if config.google_analytics %}
- {% include "partials/integrations/analytics.html" %}
- {% endif %}
+ {% include "partials/integrations/analytics.html" %}
{% endblock %}
{% block extrahead %}{% endblock %}
diff --git a/material/partials/integrations/analytics.html b/material/partials/integrations/analytics.html
index 5328ce4361c..13f7608ef04 100644
--- a/material/partials/integrations/analytics.html
+++ b/material/partials/integrations/analytics.html
@@ -1,6 +1,10 @@
{#-
This file was automatically generated - do not edit
-#}
-{% set analytics = config.google_analytics %}
-
-
+{% if config.google_analytics %}
+ {% set provider = "google" %}
+{% endif %}
+{% if config.extra.analytics %}
+ {% set provider = config.extra.analytics.provider %}
+{% endif %}
+{% include "partials/integrations/analytics/" ~ provider ~ ".html" %}
diff --git a/material/partials/integrations/analytics/google.html b/material/partials/integrations/analytics/google.html
new file mode 100644
index 00000000000..ed5e6bcfdbf
--- /dev/null
+++ b/material/partials/integrations/analytics/google.html
@@ -0,0 +1,16 @@
+{#-
+ This file was automatically generated - do not edit
+-#}
+{% if config.google_analytics %}
+ {% set property = config.google_analytics[0] %}
+{% endif %}
+{% if config.extra.analytics %}
+ {% set property = config.extra.analytics.property | d("", true) %}
+{% endif %}
+{% if property.startswith("G-") %}
+
+
+{% elif property.startswith("UA-") %}
+
+
+{% endif %}
diff --git a/mkdocs.yml b/mkdocs.yml
index 934e1aaa4e4..0cae97d879a 100755
--- a/mkdocs.yml
+++ b/mkdocs.yml
@@ -98,6 +98,9 @@ plugins:
# Customization
extra:
+ analytics:
+ provider: google
+ property: !!python/object/apply:os.getenv ["GOOGLE_ANALYTICS_KEY"]
social:
- icon: fontawesome/brands/github
link: https://github.com/squidfunk
@@ -202,8 +205,3 @@ nav:
- Getting started:
- Installation: insiders/getting-started.md
- Changelog: insiders/changelog.md
-
-# Google Analytics
-google_analytics:
- - !!python/object/apply:os.getenv ["GOOGLE_ANALYTICS_KEY"]
- - auto
diff --git a/src/base.html b/src/base.html
index 90399dc81e8..6ed01ce9022 100644
--- a/src/base.html
+++ b/src/base.html
@@ -143,9 +143,7 @@
{% block analytics %}
- {% if config.google_analytics %}
- {% include "partials/integrations/analytics.html" %}
- {% endif %}
+ {% include "partials/integrations/analytics.html" %}
{% endblock %}
diff --git a/src/partials/integrations/analytics.html b/src/partials/integrations/analytics.html
index f81d59cfe54..b4c3d0bf048 100644
--- a/src/partials/integrations/analytics.html
+++ b/src/partials/integrations/analytics.html
@@ -20,36 +20,15 @@
IN THE SOFTWARE.
-->
-
-{% set analytics = config.google_analytics %}
-
-
+
+{% include "partials/integrations/analytics/" ~ provider ~ ".html" %}
diff --git a/src/partials/integrations/analytics/google.html b/src/partials/integrations/analytics/google.html
new file mode 100644
index 00000000000..632558e4be0
--- /dev/null
+++ b/src/partials/integrations/analytics/google.html
@@ -0,0 +1,93 @@
+
+
+
+{% if config.google_analytics %}
+ {% set property = config.google_analytics[0] %}
+{% endif %}
+
+
+{% if config.extra.analytics %}
+ {% set property = config.extra.analytics.property | d("", true) %}
+{% endif %}
+
+
+{% if property.startswith("G-") %}
+
+
+
+
+{% elif property.startswith("UA-") %}
+
+
+{% endif %}
+
+