AEM ContextHub and dynamic dataLayer | Community
Skip to main content
Level 2
March 26, 2018
Solved

AEM ContextHub and dynamic dataLayer

  • March 26, 2018
  • 1 reply
  • 2337 views

Hello,

I'm using AEM ContextHub within DTM for the first time, and facing the following issue:

  • AEM ContextHub tool contains a full dataLayer schema
  • However, the dataLayer itself is dynamic, and certain objects do not populate right away
  • This causes multiple "SATELLITE: TypeError - Cannot read property 'xxx' of undefined" errors in the console.

Is there a way to prevent these errors and to, somehow, indicate in the AEM ContextHub tool that dataLayer loads dynamically?

Thank you!  

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 aseelund

use defensive coding in your data elements when referencing data layer object properties, to see if the data object properties exist before you try to reference them.

Also, dispatch a browser event when the object is added to the array and pass the data in an object with the event. Listen for this new event with DTM

1 reply

aseelund
aseelundAccepted solution
Level 3
April 2, 2018

use defensive coding in your data elements when referencing data layer object properties, to see if the data object properties exist before you try to reference them.

Also, dispatch a browser event when the object is added to the array and pass the data in an object with the event. Listen for this new event with DTM