Expand my Community achievements bar.

SOLVED

Event Forwarding: Referencing a data element from within another data element

Avatar

Level 3
Hi

When using data elements in the tagging part of Data Collection, I am able to use _satellite.getVar("xxx") to reference another data element.

What is the equivalent of this in Event Forwarding?

Usecase: Using Google Ads Enhanced Conversions, I've set up a Secret element for our EMEA organisation, and another one for the NA organisation.  The extension only has room for one Secret, so I've created another data element called "secretChooser" which checks the region coming in on the arc object and then returns the appropriate secret element.  But it is failing on the _satellite.getVar() function call.

 

 

var env = utils.getBuildInfo().environment;
var region = arc.event.xdm._polo.region;

if (region == 'us') {
return _satellite.getVar("googleOAuth2Secret");
}
else if(region.match(/(au|tw|my|sg|hk|jp|kr)/) != null) {
return "";
}
else { //EU access token
return _satellite.getVar("emeaGoogleAuthSecret");
}

 

 

And the error message is:

 

Failed to execute "Send Conversion". Failed to execute module for data element "googleAuthSecretChooser". _satellite is not defined 

ReferenceError: Failed to execute "Send Conversion".

Failed to execute module for data element "googleAuthSecretChooser". _satellite is not defined at Object.source (worker.js:2:40457)

 

This doesn't seem to be covered in any documentation that I can find.

 

Thanks
Ben
1 Accepted Solution

Avatar

Correct answer by
Community Advisor

Hi @Ben_Step  - To access the value of a data element in custom code, use the getDataElementValue method. 
Reference: https://experienceleague.adobe.com/docs/experience-platform/tags/extensions/server/core/overview.htm... 

View solution in original post

4 Replies

Avatar

Correct answer by
Community Advisor

Hi @Ben_Step  - To access the value of a data element in custom code, use the getDataElementValue method. 
Reference: https://experienceleague.adobe.com/docs/experience-platform/tags/extensions/server/core/overview.htm... 

Avatar

Level 2

Hello,

Can you please give me the syntax on how to add getDataElementValue in the event forwarding. Say for example I have created "Host' in client side data element.

 

But, how we can refer client side data element "Host" in event forwarding data element. 

Can you kindly guide us with the example. Thanks!

Hi @Vijayakumar_Raju_CBE 

you can not directly refer a client side data element in event forwarding. you can assign it to a schema field, and can refer the schema path in event forwarding data element creation.

 

SreelathaSe_0-1716202237885.png