Adobe Client Data Layer with AEM Core Components - Expose dataLayer using JSON Exporter | Community
Skip to main content
Level 4
January 16, 2024
Solved

Adobe Client Data Layer with AEM Core Components - Expose dataLayer using JSON Exporter

  • January 16, 2024
  • 3 replies
  • 1805 views

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.

https://experienceleague.adobe.com/docs/experience-manager-65/content/implementing/developing/components/json-exporter.html?lang=en

 

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 

 

 

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by Rohan_Garg

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-data-layer/data-layer-customize.html?lang=en# 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-

  1. Override getData() returning Component Data object.
  2. Use custom method name

Hope this helps!

3 replies

arunpatidar
Community Advisor
Community Advisor
January 16, 2024
aem_noobAuthor
Level 4
January 16, 2024

@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.

Rohan_Garg
Community Advisor
Community Advisor
January 18, 2024

@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-implementation-9dc357c8068e

https://experienceleague.adobe.com/docs/experience-manager-learn/sites/integrations/adobe-client-data-layer/data-layer-customize.html?lang=en

aem_noobAuthor
Level 4
January 18, 2024

@raja_reddymy  issue is that the component exporter is not exposing the data layer object while the adobe data layer is correctly capturing it

kautuk_sahni
Community Manager
Community Manager
January 18, 2024

@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.

Kautuk Sahni
aem_noobAuthor
Level 4
January 18, 2024

the discussion is still ongoing, i will mark the correct answer as soon as we get the fix