Google Analytics documentation suggests putting the analytics code in the head of the page, rather than at the very end.
This change is due to the script now loading asynchronously. My understanding is that if you keep it at the end, the script will not load until the entire page has loaded. For large VIVO pages may be a long time, which will mess up the analytics.
For reference, here's the current include path... page.ftl > scripts.ftl > googleAnalytics.ftl
Benjamin Gross (Migrated from VIVO-1673) said:
Google Analytics documentation suggests putting the analytics code in the head of the page, rather than at the very end.
This change is due to the script now loading asynchronously. My understanding is that if you keep it at the end, the script will not load until the entire page has loaded. For large VIVO pages may be a long time, which will mess up the analytics.
For reference, here's the current include path... page.ftl > scripts.ftl > googleAnalytics.ftl
[https://github.com/vivo-project/VIVO/blob/develop/webapp/src/main/webapp/themes/wilma/templates/googleAnalytics.ftl]
[https://github.com/vivo-project/Vitro/blob/1570f529571b924029b401fd918f43144e35afdf/webapp/src/main/webapp/templates/freemarker/page/partials/scripts.ftl]
[https://github.com/vivo-project/Vitro/blob/d2c34ddf46cb781a788f71736e67ffd649b56d00/webapp/src/main/webapp/templates/freemarker/page/page.ftl]