Fix dogfooding (#3377)

* Track funnels and custom props settings

* Send dogfood script events to ingest.plausible.io

* Mix format
pull/3383/head
Uku Taht 3 years ago committed by GitHub
parent b7b7cbc0a3
commit aee6f105c2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -230,7 +230,6 @@ defmodule PlausibleWeb.SiteController do
site = conn.assigns[:site] |> Repo.preload(:custom_domain)
conn
|> assign(:skip_plausible_tracking, true)
|> render("settings_funnels.html",
site: site,
dogfood_page_path: "/:dashboard/settings/funnels",
@ -243,7 +242,6 @@ defmodule PlausibleWeb.SiteController do
site = conn.assigns[:site] |> Repo.preload(:custom_domain)
conn
|> assign(:skip_plausible_tracking, true)
|> render("settings_props.html",
site: site,
dogfood_page_path: "/:dashboard/settings/properties",

@ -1,5 +1,10 @@
<%= if !Application.get_env(:plausible, :is_selfhost) && !@conn.assigns[:skip_plausible_tracking] do %>
<script defer data-domain={dogfood_domain(@conn)} src={dogfood_script_url()}>
<script
defer
data-api={dogfood_api_destination()}
data-domain={dogfood_domain(@conn)}
src={dogfood_script_url()}
>
</script>
<script>
window.plausible = window.plausible || function() { (window.plausible.q = window.plausible.q || []).push(arguments) }

@ -29,6 +29,16 @@ defmodule PlausibleWeb.LayoutView do
end
end
@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 dogfood_api_destination() do
if Application.get_env(:plausible, :environment) == "prod" do
"https://ingest.plausible.io/api/event"
end
end
def home_dest(conn) do
if conn.assigns[:current_user] do
"/sites"

Loading…
Cancel
Save