I'm working with a custom AEM component that includes the Core Image component (core/wcm/components/image/v3/image) inside it. The component renders correctly and includes the data-cmp-data-layer attribute for anchor tag (for Adobe Data Layer) in some sites, but not in others, even though the component and content were cloned from a working site.
For example:
In /content/mysite, the image renders inside an <a> tag and includes the data-cmp-data-layer attribute.
In /content/clonedsite, the exact same component and authored image show no data-cmp-data-layer attribute in the DOM.
The cq:dataLayer = true property is present in the template policies for both sites.
The image component has the correct sling:resourceType = core/wcm/components/image/v3/image
The <a> tag wraps the image in both places, but data-cmp-data-layer is missing only in the broken ones.
No JS errors in the browser console, and the core component clientlibs are loading.
Both sites use editable templates, and the page component extends core/wcm/components/page/v2/page
What else could cause the data-cmp-data-layer to be missing, specifically on cloned sites?
Does the node name (e.g., image) or path affect how the data layer renders?
Are there hidden dependencies between the template policy and the rendering of data-cmp-data-layer?
Thanks in advance.
Solved! Go to Solution.
Views
Replies
Total Likes
Hi @TejashreeNH
YOu need to enable data layer from CA config
please check the CA config (com.adobe.cq.wcm.core.components.internal.DataLayerConfig
) for mysite at /conf/mysite/sling:configs/
and create same for /content/clonedsite at /conf/clonedsite/sling:configs/
https://github.com/adobe/aem-core-wcm-components/blob/main/DATA_LAYER_INTEGRATION.md
@TejashreeNH ,In your use case ,we may need to compare node structure, are both site roots cq:Page
nodes and do all ancestor nodes have correct properties?
Also validate template policy mapping,
/conf/.../settings/wcm/policies/...
for cloned site/template?cq:dataLayer=true
and is correctly referenced.
Hi @TejashreeNH
YOu need to enable data layer from CA config
please check the CA config (com.adobe.cq.wcm.core.components.internal.DataLayerConfig
) for mysite at /conf/mysite/sling:configs/
and create same for /content/clonedsite at /conf/clonedsite/sling:configs/
https://github.com/adobe/aem-core-wcm-components/blob/main/DATA_LAYER_INTEGRATION.md
Views
Likes
Replies