Skip to content

Open source, privacy-first web analytics. Lightweight, cookie-free Google Analytics alternative. Self-hosted or cloud.

Create 404 goal always in onboarding (#5618)

Uku Tahte52bbb5bb99a
diff --git a/lib/plausible_web/live/installationv2.ex b/lib/plausible_web/live/installationv2.ex
index bc8805866b..d542127653 100644
--- a/lib/plausible_web/live/installationv2.ex
+++ b/lib/plausible_web/live/installationv2.ex
@@ -210,6 +210,7 @@ defmodule PlausibleWeb.Live.InstallationV2 do
outbound_links: true,
form_submissions: true,
file_downloads: true,
+ track_404_pages: true,
installation_type: recommended_installation_type
})
diff --git a/test/plausible_web/live/installationv2_test.exs b/test/plausible_web/live/installationv2_test.exs
index ed29274e86..e2429e0bb6 100644
--- a/test/plausible_web/live/installationv2_test.exs
+++ b/test/plausible_web/live/installationv2_test.exs
@@ -186,6 +186,32 @@ defmodule PlausibleWeb.Live.InstallationV2Test do
)
end
+ test "404 goal gets created regardless of user options", %{conn: conn, site: site} do
+ stub_detection_manual()
+ {lv, _html} = get_lv(conn, site, "?type=manual")
+
+ assert eventually(fn ->
+ html = render(lv)
+ {html =~ "Verify Script installation", html}
+ end)
+
+ # Test with all options disabled
+ lv
+ |> element("form[phx-submit='submit']")
+ |> render_submit(%{
+ "tracker_script_configuration" => %{
+ "installation_type" => "manual",
+ "outbound_links" => "false",
+ "file_downloads" => "false",
+ "form_submissions" => "false"
+ }
+ })
+
+ # 404 goal should still be created
+ goals = Plausible.Goals.for_site(site)
+ assert Enum.any?(goals, &(&1.event_name == "404"))
+ end
+
test "submitting form with review flow redirects to verification with flow param", %{
conn: conn,
site: site