summaryrefslogtreecommitdiff
path: root/themes/tabi-lean/templates/partials/analytics.html
diff options
context:
space:
mode:
authorAlejandro Soto <alejandro@34project.org>2025-09-13 14:55:15 -0600
committerAlejandro Soto <alejandro@34project.org>2025-09-13 14:55:15 -0600
commit87f85704af1fa866be83077b2b351c1fdad7c3ce (patch)
treeb49c8d49ef717e539bff6578992e692eea55d380 /themes/tabi-lean/templates/partials/analytics.html
parent1a4c3216f027d6a6f36104547377b7b21faa5015 (diff)
parenta2ea06d513a5802964f8f0ef5795cec7e548ed7b (diff)
Merge commit 'a2ea06d513a5802964f8f0ef5795cec7e548ed7b' as 'themes/tabi-lean'
Diffstat (limited to 'themes/tabi-lean/templates/partials/analytics.html')
-rw-r--r--themes/tabi-lean/templates/partials/analytics.html38
1 files changed, 38 insertions, 0 deletions
diff --git a/themes/tabi-lean/templates/partials/analytics.html b/themes/tabi-lean/templates/partials/analytics.html
new file mode 100644
index 0000000..6a5d30e
--- /dev/null
+++ b/themes/tabi-lean/templates/partials/analytics.html
@@ -0,0 +1,38 @@
+{% set analytics_service = config.extra.analytics.service %}
+{% set analytics_id = config.extra.analytics.id | default(value="") %}
+{% set self_hosted_url = config.extra.analytics.self_hosted_url | default(value="") %}
+
+{% if analytics_service == "goatcounter" %}
+ {# Prevent non-demo sites from using the demo analytics account #}
+ {% if self_hosted_url == "https://tabi-stats.osc.garden" and config.base_url == "https://welpo.github.io/tabi" or self_hosted_url != "https://tabi-stats.osc.garden" %}
+ <script async
+ {% if self_hosted_url %}
+ data-goatcounter="{{ self_hosted_url ~ '/count' }}"
+ src="{{ self_hosted_url ~ '/count.js' }}"
+ {% else %}
+ data-goatcounter="https://{{ analytics_id }}.goatcounter.com/count"
+ src="https://gc.zgo.at/count.js"
+ {% endif %}
+ ></script>
+ {% endif %}
+
+{% elif analytics_service == "umami" %}
+ <script async defer
+ {% if self_hosted_url %}
+ data-website-id="{{ analytics_id }}"
+ src="{{ self_hosted_url ~ '/script.js' }}"
+ {% else %}
+ data-website-id="{{ analytics_id }}"
+ src="https://cloud.umami.is/script.js"
+ {% endif %}
+ {% if config.extra.analytics.do_not_track %}data-do-not-track="true"{% endif %}>
+ </script>
+
+ {% elif analytics_service == "plausible" %}
+ <script
+ defer
+ data-domain="{{ analytics_id }}"
+ src="{% if self_hosted_url %}{{ self_hosted_url ~ '/js/plausible.js' }}{% else %}https://plausible.io/js/script.js{% endif %}"
+ ></script>
+
+{% endif %}