Customize DataLayer attributes for Custom Component Extending Accordion
Hi,
I have a custom component(Stepper) that extends the AEM Core Accordion Component.
In the HTL I'm using
data-cmp-data-layer="${accordion.data.json}" for Accordion and
Below is the output I see in the browser console when I use window.adobeDataLayer.getState();
stepper-994a14f431:
@type: "app/components/custom/stepper"
parentId: "page-aef00a07fb"
repo:modifyDate: "2023-04-24T20:04:30Z"
shownItems: []
stepper-994a14f431-item-03ec51c5d0:
@type: "app/components/custom/stepper/item"
dc:title: "Stepper Item Title"
parentId: "stepper-994a14f431"
Now the current requirement I have is to add custom attributes to the Item List like customId, and customTitle to track in the Adobe data layer which means I should update the "${item.data.json}"
However, how to handle the same for ${accordion. items} in the same class?
data-cmp-data-layer="${item.data.json}"
I have gone through this
but this is to update the getDataLayerShownItems(). But my main question is how to actually add custom attributes so I can have them accessed using ${item.data.json}"
I looked at this blog but haven't really understood how exactly these attributes can be added to the Item List.
Since this is an accepted solution can you guys help me understand better @arunpatidar @rohan_garg @kautuk_sahni
Any help is really appreciated.

