Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
Bedrock Mission!

Learn more

View all

Sign in to view all badges

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

prahme
Level 2
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

 

0 Replies