Skip to content

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

Add user to Sentry context

Uku Tahtbfb7620120d6
diff --git a/lib/plausible_web/auth_plug.ex b/lib/plausible_web/auth_plug.ex
index 9261ea9990..608993d36b 100644
--- a/lib/plausible_web/auth_plug.ex
+++ b/lib/plausible_web/auth_plug.ex
@@ -13,6 +13,7 @@ defmodule PlausibleWeb.AuthPlug do
user = Repo.get_by(Plausible.Auth.User, id: id)
|> Repo.preload(:subscription)
if user do
+ Sentry.Context.set_user_context(%{id: user.id, name: user.name})
assign(conn, :current_user, user)
else
conn