Context Aware
Last updated
Last updated
When accessing data layer values within any context, the use of this data element type is advised as it will take care of the complexity of knowing whether to access the value in the context of the Data Layer Push event or to access the last known value.
Since this Data Element Type is provided by the Data Layer Manager, there is no need to specify anything more than the path of the attribute as provided in the pushed Event Object. In the example below to reference the siteLanguage attribute, we would simply provide page.siteLanguage
as the Data Layer Path.
If you wish to access the root data layer object, appEventData
in all of the examples here), simply leave the Data Layer Path empty.
It is often necessary to access values that exist within arrays of objects. As an example, if we wanted to directly access the productID from within the following example, we would specify product.0.productInfo.productID.
In order for the Context Aware Data Element to have the context of a Data Layer Push Event, the event must be passed into the data element. This is done automatically by Launch when you use the %dataElementName%
syntax but it must be passed explicitly when using _satellite.getVar
.
Below is an example of this in the javascript of a Code > Custom Code Action
Event Context is not available when "Execute Globally" is selected for Core > Custom Code Actions. This is an unfortunate baggage from DTM. There is generally no reason to select "Execute Globally" for this action type.
The optional transformations checkboxes were added in v2.1.5 and are pretty self-explanatory; they allow you to transform boolean true to a string value of '1', boolean false to a string value of '0', and undefined to a string value of '0' if desired.
These options are primarily useful when a data element is used to populate an Adobe Analytics Counter or Numeric event.
These all default to being unselected. For the boolean conversions, the evaluation is explicit (i.e. value
=== true
) so only real boolean values will be converted (no loose casting takes place).