Expand my Community achievements bar.

SOLVED

Data Elements - call event.detail object and use it in custom code

Avatar

Level 2

Hello,

 

We have a WEB project done on React.js

 

The developers call a dispatchEvent in JS when the page loads.

In Adobe Launch, we created a Rule that is triggered when this event is sent, like the following:

 

prahme_0-1635513424914.png

 

And then inside this rule, we need to read the values that the developers are sending to us in an object sent with the DispatchEvent.

We found that to access these variables, we have to call the object "event.detail" like the following : event.detail.NameOfVariable

 

So we created data elements that read all variables, for example: 

 

prahme_1-1635513554168.png

 

In our Rule, we wrote a custom code : 

console.log(_satellite.getVar("Page")); 

 

This returns "undefined" all the time.

 

However, when we call it directly in the interface it sends the correct value.

 

prahme_3-1635513888703.png

 

Do you have any idea why this is happening?

 

We need our variables to be read in Data Elements, it is easier to maintain.

 

Thank you

 

1 Accepted Solution

Avatar

Correct answer by
Community Advisor
1 Reply

Avatar

Correct answer by
Community Advisor