From aef2d2705309c0ddd09538c7c73a98ce3bda4346 Mon Sep 17 00:00:00 2001 From: Pierre-Yves Dufays Date: Wed, 27 Apr 2022 08:39:37 +0000 Subject: [PATCH] [IMP] website: add X-Disable-Tracking header to improve tracking In this commit we add a request header X-Disable-Tracking that enables the client to ask the server not to track a request. This is useful for example when the client prefetches pages to be able to work offline. In that case, the prefetched pages must not be considered as viewed by the user. In such scenario and without such header, it is not possible to get an accurate page tracking. Task-2476513 Part-of: odoo/odoo#86031 --- addons/website/models/ir_http.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/website/models/ir_http.py b/addons/website/models/ir_http.py index 187d416e157..157108214f6 100644 --- a/addons/website/models/ir_http.py +++ b/addons/website/models/ir_http.py @@ -133,7 +133,7 @@ class Http(models.AbstractModel): @classmethod def _register_website_track(cls, response): - if getattr(response, 'status_code', 0) != 200: + if getattr(response, 'status_code', 0) != 200 or request.httprequest.headers.get('X-Disable-Tracking') == '1': return False template = False