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.
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.
Solved! Go to Solution.
Topics help categorize Community content and increase your ability to discover relevant content.
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.
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.
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);
Views
Like
Replies