mirror of
https://github.com/plausible/analytics.git
synced 2024-12-24 10:02:10 +03:00
74675f0cbc
* Move dogfooding to `extra/` * Remove unused view functions
32 lines
1.0 KiB
Elixir
32 lines
1.0 KiB
Elixir
defmodule PlausibleWeb.Dogfood do
|
|
@moduledoc """
|
|
Plausible tracking itself functions
|
|
"""
|
|
|
|
@doc """
|
|
Temporary override to do more testing of the new ingest.plausible.io endpoint for accepting events. In staging and locally
|
|
will fall back to staging.plausible.io/api/event and localhost:8000/api/event respectively.
|
|
"""
|
|
def api_destination() do
|
|
if Application.get_env(:plausible, :environment) == "prod" do
|
|
"https://ingest.plausible.io/api/event"
|
|
end
|
|
end
|
|
|
|
def script_url() do
|
|
if Application.get_env(:plausible, :environment) in ["prod", "staging"] do
|
|
"#{PlausibleWeb.Endpoint.url()}/js/script.manual.pageview-props.tagged-events.js"
|
|
else
|
|
"#{PlausibleWeb.Endpoint.url()}/js/script.local.manual.pageview-props.tagged-events.js"
|
|
end
|
|
end
|
|
|
|
def domain(conn) do
|
|
cond do
|
|
Application.get_env(:plausible, :is_selfhost) -> "ee.plausible.io"
|
|
conn.assigns[:embedded] -> "embed." <> PlausibleWeb.Endpoint.host()
|
|
true -> PlausibleWeb.Endpoint.host()
|
|
end
|
|
end
|
|
end
|