adobe / adobe/adobe-client-data-layer
Datalayer init is blocking browser main thread for too long
- Dominant language
- JavaScript
- Stars
- 122
- Forks
- 28
- PR merge metrics
- No merged PRs in 30d
Description
### Expected Behaviour
Adding the datalayer to a website, only minimally impacts the loading performance of the page.
### Actual Behaviour
For a simple site like https://wknd.site/us/en.html - the datalayer blocks the main thread of the browser by ~120ms during the user critical HTML rendering.

In AEM the datalayer is loaded in the footer
https://github.com/adobe/aem-core-wcm-components/blob/master/content/src/content/jcr_root/apps/core/wcm/components/page/v2/page/footer.html#L23
without the recommended "async" and "defer" attributes - not sure if that would make a difference - hence it would need to get fixed in the Core Components to load the datalayer according to recommendations.
#### Platform and Version
https://wknd.site/etc.clientlibs/core/wcm/components/commons/datalayer/v1/clientlibs/core.wcm.components.commons.datalayer.v1.lc-5571dbb70dbe447668b2c28f8e3d0eaf-lc.min.js
Core Components 2.15.2 as part of CS 2021.4.5226.20210427T070726Z
Contributor guide
Assessment
This issue has not been assessed yet.