Change custom domain javascript filename to index.js

This commit is contained in:
Uku Taht 2020-03-02 10:44:36 +02:00
parent 36c08b989d
commit 7fae8b9606

View File

@ -14,10 +14,14 @@ defmodule PlausibleWeb.SiteView do
end
def snippet(site) do
tracker_domain = if site.custom_domain, do: site.custom_domain.domain, else: "plausible.io"
tracker = if site.custom_domain do
"https://" <> site.custom_domain.domain <> "/js/index.js"
else
"https://plausible.io/js/plausible.js"
end
"""
<script async defer data-domain="#{site.domain}" src="https://#{tracker_domain}/js/plausible.js"></script>
<script async defer data-domain="#{site.domain}" src="#{tracker}"></script>
"""
end
end