odoo / odoo

Odoo. Open Source Apps To Grow Your Business.
https://www.odoo.com
Other
37.16k stars 24.17k forks source link

[16.0][Website] Move Google Analytics and Plausible Scripts to `head` #145820

Open fl0pedro opened 8 months ago

fl0pedro commented 8 months ago

As the title explains, I suggest the Google Analytics and Plausible scripts to be moved from body to head as that is standard. Bellow is the line that would need to be changed:

https://github.com/odoo/odoo/blob/97ccef050664bc8da6ac60ca94e126e8d9271739/addons/website/views/website_templates.xml#L203C17-L203C17

<xpath expr="//div[@id='wrapwrap']" position="after"> -> <xpath expr="//head" position="inside">

@JKE-be @qsm-odoo

qsm-odoo commented 8 months ago

Hello @fl0pedro

Probably a good suggestion since it rarely (never?) make sense to put a script in the body anymore. We'd have to check what those libs recommend to be sure but I am guessing the <head> section is what they'll recommend. I have created a task about this, someone will have a look although probably not as a huge priority. It would more than probably be for the next version though (not done as a fix in stable).

Note: dig around a little to know if we moved that in the body for any good reason: it was actually in the <head> section before this change 9 years ago: https://github.com/odoo/odoo/commit/4e47f917dff837a5c1a5f04eb57cf57278284ccb ... another age where no justification was needed :grimacing: We'll look into it.

cc @rdeodoo

rdeodoo commented 8 months ago

Note that we already had an internal task to do that: 3181095

We will keep you inform about possible change we would make :+1: