Expand my Community achievements bar.

SOLVED

Data layer values are coming as 'null' in the Edge Network- Analytics Web SDK setup

Avatar

Level 2

I am configuring analytics web SDK setup for one website where ACDL is implemented. In the console, I can see the data layer values populating in the data layer. However, the values are coming as 'null' when sending Web SDK events.

1 Accepted Solution

Avatar

Correct answer by
Level 3

Hi @firefighteradi 

in addition to what @Jennifer_Dungan wrote, it's maybe worthwhile testing this in your console.

 

adobeDataLayer.getState("data.loginMessage")

 

 

Should there have been any other previous push to the data layer, your access to index 0 will obviously not work.

 

However, since you do not seem to use an eventInfo subobject, the pushed data is aggregated into the so-called computed state (whereas anything pushed into an eventInfo sub-object would only be processable during this specific ACDL push event).

 

 

// push to computed state
adobeDataLayer.push({
  data: {
    loginMessage: "foo",
  }
});

// read from computed state
adobeDataLayer.getState("data.loginMessage"); // returns "foo"

 

 

Should this work, I would suggest to change your data element "Login Message- DMS Web" from type "Javascript Variable" to the "Adobe Client Data Layer" extension's "Data Layer Computed State" type with "path.loginMessage" as path value.

bk_work_0-1713301018446.png

 

Maybe check out Andy Lunsford's Adobe Client Data Layer's cheat sheet to get a better understanding.

 

Cheers

Björn

View solution in original post

9 Replies

Avatar

Level 2

Hello,

Thanks for your message. It is hard to answer your question without any context.
Can you describe the way you populate your XDM Schema ?

Best regards

Avatar

Level 2

Hello,

 

Thanks for your reply.

 

I am populating the schema through data element.

firefighteradi_0-1713253342987.png

 

firefighteradi_0-1713253164421.png

 

and then sending the event through rule.

firefighteradi_1-1713253246087.png

 

 

Avatar

Level 2

Hello,

Theoretically, you have done everything right. 
Now, you have to figure out if the data in the dataLayer is ready when the rule is sent.
I advise you to use the "eye" function in the Console with the following code "_satellite.getVar('Login Message- DMS Web')" and control if the dataElement is populated when you need it.

Best regards

Avatar

Level 2

Getting null value only. What can be the possible reason for it?

image.png

Avatar

Level 2

Hello,

I am not familiar with this dataElement construction but it means that the issue is on the dataElement.
On my projects, i usually use the Adobe Client Data Layer extension to construct this type of dataElement. 
Or, if you want to use the Core extension, you can use the following code with Custom Code

return adobeDataLayer[0].data.loginMessage

Best regards

Avatar

Community Advisor

In the same place that the satellite var was tested, you can also test the Data Layer...

 

console.log(adobeDataLayer);

// or

console.log(adobeDataLayer[0]);

// or

console.log(adobeDataLayer[0].data);

// or

console.log(adobeDataLayer[0].data.loginMessage)

 

Basically, test at various levels your data layer and make sure that your reference is actually working.... 

Avatar

Correct answer by
Level 3

Hi @firefighteradi 

in addition to what @Jennifer_Dungan wrote, it's maybe worthwhile testing this in your console.

 

adobeDataLayer.getState("data.loginMessage")

 

 

Should there have been any other previous push to the data layer, your access to index 0 will obviously not work.

 

However, since you do not seem to use an eventInfo subobject, the pushed data is aggregated into the so-called computed state (whereas anything pushed into an eventInfo sub-object would only be processable during this specific ACDL push event).

 

 

// push to computed state
adobeDataLayer.push({
  data: {
    loginMessage: "foo",
  }
});

// read from computed state
adobeDataLayer.getState("data.loginMessage"); // returns "foo"

 

 

Should this work, I would suggest to change your data element "Login Message- DMS Web" from type "Javascript Variable" to the "Adobe Client Data Layer" extension's "Data Layer Computed State" type with "path.loginMessage" as path value.

bk_work_0-1713301018446.png

 

Maybe check out Andy Lunsford's Adobe Client Data Layer's cheat sheet to get a better understanding.

 

Cheers

Björn

Avatar

Level 2

I was missing this. Thanks for your answer- I installed the Adobe Client Data Layer extension and it is working now.