Hello Everyone!
Is it possible to disable the data-layer at component level? I am aware of the configuration which disable the data-layer for entire project but we don't want that. We want to disable data-layer for only specific components. Especially core component as they all comes with data-layer functionality added to them. Our Analytics team is complaining saying that they are seeing lots of data getting pushed to data-layer that are not necessary, like text, title component etc.
Thank you!
Solved! Go to Solution.
Views
Replies
Total Likes
There is no OOTB method to disable datalayer at component level as
com.adobe.cq.wcm.core.components.internal.DataLayerConfig
would be applicable per project.
You can customize your component and add check enablement of datalayer at dialog level with default false and proide priority if component DL is false then disable otherwise project specific datalaterconfig value would be used.
The data layer can be disabled for specific components by modifying the component's implementation. Here's how you can disable the data layer for specific components:
Locate the component implementation in AEM's repository. This is typically stored in the /apps or /libs folder, depending on whether it is a custom or out-of-the-box component.
Edit the component's JavaScript file to disable the data layer. This can be done by commenting out or removing the code that sends data to the data layer.
If necessary, update the component's Sightly or JSP file to remove any references to the data layer. For example, you may need to remove data layer variables or data-attributes that are used to populate the data layer.
Save your changes and test the component to ensure that the data layer is no longer being used.
Here's an example of how you might disable the data layer for a specific component in AEM's TouchUI:
(function() {
var component = document.querySelector('.my-component');
if (component) {
// Comment out the code that sends data to the data layer
// window.adobeDataLayer.push({
// 'event': 'componentView',
// 'component': 'my-component',
// 'page': window.location.href
// });
// Remove any data layer variables or data-attributes
// component.dataset.adobeAnalytics = null;
}
})();
In this example, the data layer code has been commented out and the data layer attribute has been removed from the component.
Overall, disabling the data layer for specific components can help to reduce data volume and simplify data layer management. However, you should carefully consider the impact of disabling the data layer for each component and ensure that you are still able to collect the necessary data for your analytics and reporting needs.
Thanks for responding.
Do you know of any other method than customizing the core components code? Like
/conf/my-project/sling:configs/com.adobe.cq.wcm.core.components.internal.DataLayerConfig
this configuration which enables data-layer at the project level. Is there anything like this at component level?
There is no OOTB method to disable datalayer at component level as
com.adobe.cq.wcm.core.components.internal.DataLayerConfig
would be applicable per project.
You can customize your component and add check enablement of datalayer at dialog level with default false and proide priority if component DL is false then disable otherwise project specific datalaterconfig value would be used.
Views
Likes
Replies
Views
Likes
Replies
Views
Likes
Replies