analytics/lib/plausible_web/controllers/api/internal_controller.ex
Uku Taht 7dbbc8ba22
Configurable site id (#30)
* Use site id instead of hostname for events

* Use site id in domain status check

* Revert change to tracking module

* Catch more places where link generation needed updating

* Rename site_id to domain

* Drop hostname index from events
2020-02-04 15:44:13 +02:00

18 lines
367 B
Elixir

defmodule PlausibleWeb.Api.InternalController do
use PlausibleWeb, :controller
use Plausible.Repo
def domain_status(conn, %{"domain" => domain}) do
has_pageviews = Repo.exists?(
from e in Plausible.Event,
where: e.domain == ^domain
)
if has_pageviews do
json(conn, "READY")
else
json(conn, "WAITING")
end
end
end