Adobe Data Layer Implementation (EDDL Approach)
Hello All -
I was working on one of the Data Layer requirements and while I went through the Adobe documentation I learned we can primarily push the data to Analytics in two essential ways :
- Pushing an Event Object (Push an Event Object/Data)
window.adobeDataLayer = window.adobeDataLayer || [];
window.adobeDataLayer.push({
"page": {
"title": "Getting Started"
}
});
2. Pushing a Function (Callback Approach)
window.adobeDataLayer = window.adobeDataLayer || [];
var myHandler = function(event) {
console.log(event);
};
window.adobeDataLayer.push(function(dl) {
dl.getState();
dl.addEventListener("click", myHandler);
});
Now, as far as I have seen we have been using the (2) approach whenever there is a "click" or other HTML events are performed. But Yet, I could not understand the utility of the (2) as in why we would write a callback function?
I did scanned through https://github.com/adobe/adobe-client-data-layer/wiki#architecture completely.
Thanks,
Tanika
