Hi everyone!
Sometimes we have a situation where we reference the value of a different data element in a separate data element i.e. we define a variable in custom code using _satellite.getVar().
I was wondering if this introduces a race condition meaning that you end up with a data element that doesn't return a value at the point when it's requested even though there may be one as the functions that set the values of the data elements don't run in a specific order.
Use case is when we create fallbacks to account for any issues with data layer properties.
For example, we pass an order ID to the data layer on sale, but this value is also presented in an element in the DOM. So we have two data elements:
var orderReferenceElement = _satellite.getVar("orderReferenceElement") // Data element with value from DOM
if(digitalData && digitalData.order && digitalData.order.id){ // Checking if data layer property is available
var dataLayerOrderReference = digitalData.order.id;
}
return (typeof dataLayerOrderReference !== "undefined") ? dataLayerOrderReference : orderReferenceElement
There shouldn't ever be a situation where the value is unspecified in Analytics as the page load rule fires on window loaded, meaning that if the data layer isn't ready, there's definitely the element in the DOM at that point.
Any help would be greatly appreciated.
Solved! Go to Solution.
Topics help categorize Community content and increase your ability to discover relevant content.
Views
Replies
Total Likes
I do this fairly frequently, and so far, I've never encountered race conditions. So it looks like when Launch finds a reference to a data element in any component (whether in another data element or in an event or condition or action), it evaluates the data element and returns the value to the component that uses it.
Views
Replies
Total Likes
I do this fairly frequently, and so far, I've never encountered race conditions. So it looks like when Launch finds a reference to a data element in any component (whether in another data element or in an event or condition or action), it evaluates the data element and returns the value to the component that uses it.
Views
Replies
Total Likes
Views
Replies
Total Likes
Views
Like
Replies
Views
Likes
Replies