Data Element Translator

A Data Element Translator takes the result of another data element and returns a translation based on that value. If no translation is found it will return an empty string or the configured default value.

Dynamic AA Report Suite based on hostname

One situation where this data element can be pretty handy is in the determination of an Adobe Analytics report suite based upon the hostname where Launch is running. Imagine that you had the following report suite mappings given to you in a spreadsheet as shown below:

The old solution would be to create a custom code data element that would run some logic in javascript and return the report suite value (see below).

//THIS IS THE OLD WAY!!! YOU DON'T NEED TO DO THIS ANYMORE!!!
//Custom code data element for mapping report suites by hostname
var aaRsId;
switch (document.location.hostname) {
 //Production hosts
 case "www.brand_x.com":
   aaRsId = "glbcom.bx.rsprod";
   break;
 case "www.brand_y.com":
   aaRsId = "glbcom.by.rsprod";
   break;
 case "www.brand_z.com":
   aaRsId = "glbcom.bz.rsprod";
   break;



 //Staging hosts
 case "stage.brand_z.com":
   aaRsId = "glbcom.bz.rsstg";
   break;
 case "stage.brand_z.com":
   aaRsId = "glbcom.bz.rsstg";
   break;
 case "stage.brand_z.com":
   aaRsId = "glbcom.bz.rsstg";
   break;



 //catch all 
 default:
   aaRsId = "glbcom.dev";
   break;
}
return aaRsId;

That code is solid. It works. But if you are not programmer it can be pretty daunting to write and maintain. Using the SDI Toolkit's Data Element Translator, the process looks like this.

First, we create the data element which will serve as out input. For this example, it will be a simple Core Extension > Page Value data element and we'll name it hostname. Although we can be pretty certain that the value returned by this data element will already be lowercase and will have no leading or trailing whitespace, we've selected the Force lowercase value and Clean text options anyway. This is a good general practice especially when we'll be using that value to feed a translation.

Now we can use the hostname data element (created above) to feed a translation using a Data Element Translator Data Element Type.

Just to bring it all back home, below is an example of our new AA Report Suite data element in use.

Pro Tip: The example above translate to static string values. Although there is no Data Element Selector shown for the outputs, you can use %data element name% in the output fields allowing the configuration to be a logic router.

Last updated