mirror of
https://github.com/welpo/tabi.git
synced 2025-11-23 02:00:25 +01:00
✨ feat(analytics): support new plausible script
This commit is contained in:
parent
ab4bcd5695
commit
6fb926b52a
4 changed files with 13 additions and 4 deletions
|
|
@ -28,11 +28,20 @@
|
|||
{% if config.extra.analytics.do_not_track %}data-do-not-track="true"{% endif %}>
|
||||
</script>
|
||||
|
||||
{% elif analytics_service == "plausible" %}
|
||||
{% elif analytics_service == "plausible" %}
|
||||
{% if analytics_id is matching("^pa-[^\.]+$") %}
|
||||
{# Use new script available in Plausible 3.1.0 or later #}
|
||||
<script async src="{% if self_hosted_url %}{{ self_hosted_url ~ '/js/' }}{% else %}https://plausible.io/js/{% endif %}{{ analytics_id }}.js"></script>
|
||||
<script>
|
||||
window.plausible=window.plausible||function(){(plausible.q=plausible.q||[]).push(arguments)},plausible.init=plausible.init||function(i){plausible.o=i||{}};
|
||||
plausible.init()
|
||||
</script>
|
||||
{% else %}
|
||||
<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 %}
|
||||
|
||||
{% endif %}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue