analytics/lib/plausible_web/views/site_view.ex
Adrian Gruntkowski fede2f0a8a
Make final touches to Imports & Exports (#4025)
* Make final touches to Imports & Exports

* Change import content copy depending on CSV imports and exports flag state

* Remove unused aliases
2024-04-19 11:40:13 +02:00

29 lines
577 B
Elixir

defmodule PlausibleWeb.SiteView do
use PlausibleWeb, :view
use Plausible
def plausible_url do
PlausibleWeb.Endpoint.url()
end
def shared_link_dest(site, link) do
Plausible.Sites.shared_link_url(site, link)
end
def render_snippet(site) do
tracker = "#{plausible_url()}/js/script.js"
"""
<script defer data-domain="#{site.domain}" src="#{tracker}"></script>
"""
end
def with_indefinite_article(word) do
if String.starts_with?(word, ["a", "e", "i", "o", "u"]) do
"an " <> word
else
"a " <> word
end
end
end