we are extending core components and have added custom attributes in the data layer.
however, we want to export the data layer object for the component as part of JSON (.model.json)
currently the .model.json is not exposing the data layer object.
how can we expose the data layer object as part of JSON exporter for core/custom components?
@aanchal-sikka, @arunpatidar, @Saravanan_Dharmaraj, @EstebanBustamante, @Rohan_Garg
Solved! Go to Solution.
Views
Replies
Total Likes
@aem_noob - I am not sure why getDataLayer() method is not being exposed in the sling model but as discussed if use any custom method name such as getCustomData() that is working. For extending getData() you must necessarily return Component Data and not String.
I will try to find the reason for getDataLayer() but meanwhile you can use the below approaches-
Hope this helps!
Hi @aem_noob
Please check https://experienceleague.adobe.com/docs/experience-manager-core-components/using/developing/data-lay...
@arunpatidar- the data layer is correctly showing the custom attributes which are added by extended the core components, the query was with respect to the component exporter JSON.
@aem_noob - Can you share the code for the sling model?
To extend the adobe client data layer, your custom sling model might have a getData
method that returns an object that extends ComponentData
to return more fields.
Please refer Extending the Adobe Client Data Layer
Other Reference Links-
https://medium.com/@abhaymishra12/customizing-adobe-client-data-layer-during-adobe-analytics-impleme...
we're not using overlay of getData as that should return ComponentData. As https://experienceleague.adobe.com/docs/experience-manager-learn/sites/integrations/adobe-client-dat... states we used below snip-
can you please check inbox for the code?
@aem_noob - I am not sure why getDataLayer() method is not being exposed in the sling model but as discussed if use any custom method name such as getCustomData() that is working. For extending getData() you must necessarily return Component Data and not String.
I will try to find the reason for getDataLayer() but meanwhile you can use the below approaches-
Hope this helps!
update on getDataLayer() please - this should not be causing the issue
@Raja_Reddymy issue is that the component exporter is not exposing the data layer object while the adobe data layer is correctly capturing it
@aem_noob Did you find the suggestions from users helpful? Please let us know if more information is required. Otherwise, please mark the answer as correct for posterity. If you have found out solution yourself, please share it with the community.
Views
Replies
Total Likes
the discussion is still ongoing, i will mark the correct answer as soon as we get the fix