Expand my Community achievements bar.

Console error - Failed to execute data element module

Avatar

Level 4

The data elements are being populated. correctly "_satellite.getVar('Page: Hierarchy Level 1') = index" and error are triggering in console related to data elements why?

 

I got this error message:

Failed to execute data element module gcoe-adobe-client-data-layer/src/lib/dataElements/datalayerComputedState.js for data element Page: Hierarchy Level 1. t.getState is not a function
TypeError: t.getState is not a function

Please refer below screenshot.

 

reddy_y11_0-1715741752631.png

 

 

 

 

Topics

Topics help categorize Community content and increase your ability to discover relevant content.

4 Replies

Avatar

Community Advisor and Adobe Champion

When you say that the Data Element is populating correctly

 

The data elements are being populated. correctly "_satellite.getVar('Page: Hierarchy Level 1') = index"


Is that when you manually run them in the console?

 

Are those errors happening during the loading of your site... is it possible there is a timing issue, where you are trying to get your hierarchy too soon and it errors out, but by the time you manually run your Satellite getVar code, everything is ready and it works?

 

Have you tried enabling the Satellite Debug Mode?

// Turn on Debugging:
_satellite.setDebug(true);

// Turn off Debugging:
_satellite.setDebug(false);

 

To try and see what rules are firing when and in what order... you could also try adding some additional debugging code in your implementation to try and see what is failing where.

 

 

Avatar

Level 4

Hi @Jennifer_Dungan , Thanks for the reply 

 

_satellite.setDebug('true')  --> error are populated.

_satellite.setDebug('false')  --> No errors

 

If error are populated for data elements but data is collecting into eVars. How?

 

I noticed after data elements error, [Adobe Client Data Layer] Initializing adobeDataLayer as it wasn't found during the initialization.

 

reddy_y11_0-1715743561337.png

 

Is this something to do with data elements error?

Avatar

Community Advisor

HI @reddy_y-11 

interesting, as it seems, you are having the Adobe Client Data Layer extension installed, correct?

As you have pointed out, the automatic initialization of the adobeDataLayer happens later, which is an indication, that at this stage, the underlying page has not yet defined it by itself e.g., there is no such line from your end before the launch script, correct?

 

window.adobeDataLayer = window.adobeDataLayer || [];

 

 

Anyway, the error seems indicate that it is already evaluating a data element before this extension activation has even happened.

 

Is there a URL where this can be looked at?

 

[Update] after checking with @reddy_y-11 , my assumption in

  • Adobe Client Data Layer and Adobe Analytics extensions are installed
  • Analytics is using a global config which is trying to initially set the hierarchy, based on a Data Element which is trying to evaluate the ACDL state
  • by the time the global config is executed, the Adobe Client Data Layer has not yet enriched the "adobeDataLayer" array with additional functionality i.e., a getState function
  • the initialization time of the Adobe Client Data Layer extension is surely too late, but we cannot do anything about this outselves

Approach to circumvent/fix this

  • not recommended: enrich the adobeDataLayer array write your own getState function until it is overwritten by the actual functionality from the extension
  • recommended: defer the AA global initialization data that is relying on the ACDL's computed state to a rule that is executed when the ACDL is receiving data. You can set the event to either "all data changes" or to fire on "specific events"
    bjoern_k_0-1715755187872.png

     

    @reddy_y-11 in the sample URL you sent me, you may want to mark the first data push to the ACDL with a specific event such as "initial_data" and could listen to this to trigger the AA initialization.

 

Cheers

Cheers from Switzerland!

Avatar

Community Advisor and Adobe Champion

Thanks @bjoern__koth!

 

Yeah, checking that screenshot, the JS errors are happening really soon in the execution (before , which aligns with my initial assumption that it was a timing issue. The code trying to pull the hierarchy was happening before everything was ready.

 

As you said Bjoern, we can't do much to the timing of the Data Layer, but maybe the timing of the Hierarchy code could be adjusted? Without seeing the implementation I don't know immediately offhand how to do that, but I have done some creative solutions in my own implementation to get around different timing issues....

 

Since I didn't get the sample URL, I can't see what you saw, so I am not sure if the Data Elements are still properly populating in the tracking (as in the code tries to set multiple times, and this error is thrown only for the initial attempt)... if that is the case, a try/catch around the block of code and some extra checks for "does this function exist yet, etc might be enough to prevent the errors from actually firing, but that is only if the code is eventually succeeding and this is a bit of a cosmetic fix.