Expand my Community achievements bar.

Join us on September 25th for a must-attend webinar featuring Adobe Experience Maker winner Anish Raul. Discover how leading enterprises are adopting AI into their workflows securely, responsibly, and at scale.
SOLVED

Setting the Data Variable Object with a Data Element

Avatar

Level 2

Hello all,

 

I'm using the Data Object to set eVars to send to Adobe Analytics for reporting purposes. Inside the Data Object, I want to set all the variables using a data element to return a JSON. 

2025-02-03_16-54-57.PNG

 

My Data object is set to the following.

 

 

var dataTest = {
    "eVar1": "%dataelement1%",
    "eVar2": "%dataelement2%",
    "eVar3": "%dataelement3%"
};

return dataTest;

 

 

However, when I check Omnibug to see the values that are being returned, I see this instead of my expected values:

events[0].data.__adobe.analytics.eVar1%dataelement1%
events[0].data.__adobe.analytics.eVar2%dataelement2%
events[0].data.__adobe.analytics.eVar3%dataelement3%

 

Inserting the JSON directly into the same area as the Data Element also returns the correct values instead of the data element names.

 

Did I miss something in my setup, or is it even possible to set these via Data Element and have the values be dynamic?

 

I'm guessing that if a data element is used, it will return the literal string that is in the key value pairs in the JSON. I've also tried using "_satellite.getVar('dataelement1')" as the value and I get "_satellite.getVar('dataelement1')" returned.

Topics

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

1 Accepted Solution

Avatar

Correct answer by
Level 2

I worked it out. I needed to remove the quotes around the _satellite.getVar('') command. I was copying the literal format of when you set it manually in the individual parts and needed to adjust. Thanks everyone who took a look at it.

View solution in original post

2 Replies

Avatar

Correct answer by
Level 2

I worked it out. I needed to remove the quotes around the _satellite.getVar('') command. I was copying the literal format of when you set it manually in the individual parts and needed to adjust. Thanks everyone who took a look at it.

Avatar

Community Advisor

Yah you cannot use percentage syntax in a data element with custom code.

Always use _satellite.getVar

Also, should you use the Adobe Client Data Layer, make sure to pass in the event as second parameter

 

_satellite.getVar("some DE", event);

Cheers from Switzerland!