softinio.com/templates/partials/analytics.html
Salar Rahmanian f22a91be08
Some checks failed
ci/woodpecker/pr/woodpecker Pipeline was successful
ci/woodpecker/push/woodpecker Pipeline failed
correction
2024-10-27 14:19:38 -07:00

26 lines
1.3 KiB
HTML

{% 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://analytics.eu.umami.is/script.js" {% endif %} data-do-not-track="true">
</script>
{% elif analytics_service == "plausible" %}
<script defer data-domain="{{ analytics_id }}"
src="{{ self_hosted_url ~ '/5ad86f40-1589-48c0-820b-9643ad0080b2.js' }}"></script>
{% endif %}