[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
This commit is contained in:
@@ -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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user