diff --git a/lemarche/utils/tracker.py b/lemarche/utils/tracker.py index d29883c1b..94381be31 100644 --- a/lemarche/utils/tracker.py +++ b/lemarche/utils/tracker.py @@ -17,6 +17,7 @@ from django.urls import reverse from django.utils import timezone +from lemarche.siaes.models import Siae from lemarche.stats.models import Tracker from lemarche.users.models import User @@ -152,6 +153,8 @@ def track_page(self, page, request: HttpRequest, response: HttpResponse): def extract_user_info(self, request: HttpRequest, context_data: dict): user: User = request.user siae = context_data.get("siae") + if not siae and context_data.get("object") and type(context_data.get("object")) is Siae: + siae = context_data.get("object") return { "user_id": user.id if user.is_authenticated else None, "user_kind": user.kind if user.is_authenticated else "",