When we’re deciding on the most efficient way of implementing a tracking tool, we come across multiple challenges, including the question of making it easier for the website developers or easier for ourselves regarding tag management configuration.
Despite a lot more variables in this decision, I found it much more handsome to use an EDDL (Event-Driven Data Layer), since it’s easier to explain/communicate to the developers.
Differences between EDDL and CEDDL
When talking about data layers, you might come across the two most used, EDDL and CEDDL.
EDDL = Event-Driven Data Layer.
CEDDL = Customer Experience Digital Data Layer. Legacy W3C.
I tried to find a less confusing abbreviation. Unfortunately, this one made the most sense. They’re both types of data layers. A good way to remember the difference is the CEDDL is 25% more cumbersome to spell and implement. That’s being generous. The Event-Driven Data Layer describes what you’re implementing: a data layer that is constructed and transmitted to your TMS (Tag Management System) by events.
The general consensus while talking to other industry experts has been that the W3C is outdated and that the EDDL is the future.
Starting point: Facing the issues of arrays
While the EDDL is a simple JavaScript object, we can definitely use the ADC (Adobe Data Collection) data elements to grab the information referring to the relevant object name.
First, if we use the same object path, an array of actions happens without a page refresh. Let’s take the example of two clicks on a single page that both push a link name and type into the data layer.
Using the data elements JavaScript variable, we’re unable to automatically decide on the last element of the array, which is the last one we’ve clicked. Assuming that both of the clicks are using the same trigger (i.e. a direct call for link clicks, however, it doesn’t matter), we need to know which is the “computed state” of the array.
With computed state, I mean the last added push to the data layer for these specific interactions.
How to get the computed state in a data element
At this moment, we need to create a simple custom code. I’ll explain what the code does below the example for the object “name”.
const latestAction = dataLayer.actions.slice(Math.max(dataLayer.actions.length - 1, 0));
const latestActionName = latestAction[0].name;
return latestActionName;
In the first line, I’m slicing the array and forcing it to contain just the last existing object. In the second line, I grab the value of [0] of the sliced array, which is the only one existing. Then returning this value.
In this way, we make sure to have the last object of the array in our data element. You could then repeat it for other objects in the array.
Is Adobe’s solution incoming?
While navigating around with EDDLs, I came across an extension for ADC which is called the Adobe Client Data Layer (ACDL), which is already unveiled on GitHub. You can also install it through the extension catalog. I’m not going into detail, as I currently don’t have tried it, but it might be worth keeping an eye on it.
NEW: We created a dedicated article for that.