Hi all,
I need to add data-cmp-data-layer-enabled attribute to body element.
I follow the tutorial which creates /conf/<mySite>/sling:configs/com.adobe.cq.wcm.core.components.internal.DataLayerConfig.
And set the enabled property, added sling:configRef property under my site
However, I still couldn't see the attribute data-cmp-data-layer-enabled in body.
there's a thread with a reply suggested adding some javascript code on page.html, but I don't get what exactly should I do next.
Do you guys have any ideas about this?
I'm using aem 6.5.5 with com.adobe.granite.archetypes version 20
Thanks!
Solved! Go to Solution.
Views
Replies
Total Likes
Hi @YuSheng,
The root cause off the issue is connect with core components version. Please be aware that data-cmp-data-layer-enabled attribute appears in page.html renderer has been exposed in core components 2.9.0. OOTB archetype version 20 provide 2.5.0 core components version. Here is the difference in the code:
As you can see 2.9.0 not only adds data-cmp-data-layer-enabled attribute but also additional section with JS code.
Summarizing, what you have to do to get it work, you should upgrade core components version to 2.9.0 or higher. I do not think you should do any changes in page.html, as it will not be so simple, because changes in page.html will require some changes on Sling models level as well to provide proper information that can be consumed on the page.html.
As an alternative solution you can generate project once again using never archetype version (24+)
Hi @YuSheng,
The root cause off the issue is connect with core components version. Please be aware that data-cmp-data-layer-enabled attribute appears in page.html renderer has been exposed in core components 2.9.0. OOTB archetype version 20 provide 2.5.0 core components version. Here is the difference in the code:
As you can see 2.9.0 not only adds data-cmp-data-layer-enabled attribute but also additional section with JS code.
Summarizing, what you have to do to get it work, you should upgrade core components version to 2.9.0 or higher. I do not think you should do any changes in page.html, as it will not be so simple, because changes in page.html will require some changes on Sling models level as well to provide proper information that can be consumed on the page.html.
As an alternative solution you can generate project once again using never archetype version (24+)