Open source, privacy-first web analytics. Lightweight, cookie-free Google Analytics alternative. Self-hosted or cloud.
TypeScript analyticsanalytics-dashboardclickhouseelixirgoogle-analyticsmarketingopen-source-analyticsphoenixplausible-analyticspostgresqlprivacyprivacy-friendlyself-hostedsimple-analyticsstatisticstailwindcssweb-analyticswebsite-analyticswebsite-statswebsite-tracking
Show sentry error page to capture user feedback
Uku Taht70b0184a37c5
diff --git a/lib/plausible_web/views/error_view.ex b/lib/plausible_web/views/error_view.exindex 441a1129dc..d6a190a36a 100644--- a/lib/plausible_web/views/error_view.ex+++ b/lib/plausible_web/views/error_view.ex@@ -23,17 +23,39 @@ defmodule PlausibleWeb.ErrorView doenddef render("500.html", assigns) do- render(- "error.html",- Map.merge(- %{- layout: false,- status: 500,- message: "Oops! Looks like we're having server issues"- },- assigns- )- )+ case Sentry.get_last_event_id_and_source() do+ {event_id, :plug} when is_binary(event_id) ->+ current_user = assigns[:current_user]++ opts =+ %{+ eventId: event_id,+ "user.email": current_user && current_user.email,+ "user.name": current_user && current_user.name+ }+ |> Jason.encode!()++ ~E"""+ <script src="https://browser.sentry-cdn.com/5.9.1/bundle.min.js" integrity="sha384-/x1aHz0nKRd6zVUazsV6CbQvjJvr6zQL2CHbQZf3yoLkezyEtZUpqUNnOLW9Nt3v" crossorigin="anonymous"></script>+ <script>+ Sentry.init({ dsn: '<%= Sentry.Config.dsn() %>' });+ Sentry.showReportDialog(<%= raw opts %>)+ </script>+ """++ _ ->+ render(+ "error.html",+ Map.merge(+ %{+ layout: false,+ status: 500,+ message: "Oops! Looks like we're having server issues"+ },+ assigns+ )+ )+ endenddef template_not_found(template, assigns) do