Agregar Google Analytics

Mkdocs

Para el tema mkdocs

theme:
  name: mkdocs
  analytics:
    gtag: G-xxxxxxxxxx

ReadTheDocs

Para el tema readthedocs

theme:
  name: readthedocs
  analytics:
    gtag: G-xxxxxxxxxx

Material

Para el tema readthedocs

theme:
  name: material

extra:
  analytics:
    provider: google
    property: G-xxxxxxxxxx

Otros

En caso no se pueda configurar desde mkdocs.yml, se puede sobrescribir el archivo base.html

{% extends "base.html" %}

{% block extrahead %}
  {{ super() }}
  <!-- Google tag (gtag.js) -->
  <script async src="https://www.googletagmanager.com/gtag/js?id=G-xxxxxxxxxx"></script>
  <script>
    window.dataLayer = window.dataLayer || [];
    function gtag(){dataLayer.push(arguments);}
    gtag('js', new Date());

    gtag('config', 'G-xxxxxxxxxx');
  </script>
{% endblock %}