From 124c65b6a11dfa3c17ddc280255cb9d111474eab Mon Sep 17 00:00:00 2001 From: Romain Derie Date: Thu, 7 Apr 2022 16:16:12 +0000 Subject: [PATCH] [IMP] website: stop creating visitors and tracks for bots/crawlers Before this commit, every visit on the website would create a visitor and tracks, including visits from bots and crawlers (e.g. google bot). Now, we prevent that as it doesn't bring any value to track those bots. Note that it means there won't be any track created if you are using tools like `ab` for perf investigation or `curl` commands. task-2867045 Part-of: odoo/odoo#87857 --- addons/website/models/ir_http.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/addons/website/models/ir_http.py b/addons/website/models/ir_http.py index 61677ff338d..5d08d95812e 100644 --- a/addons/website/models/ir_http.py +++ b/addons/website/models/ir_http.py @@ -133,6 +133,8 @@ class Http(models.AbstractModel): @classmethod def _register_website_track(cls, response): + if request.env['ir.http'].is_a_bot(): + return False if getattr(response, 'status_code', 0) != 200 or request.httprequest.headers.get('X-Disable-Tracking') == '1': return False