Expand my Community achievements bar.

Join us for the next Community Q&A Coffee Break on Tuesday April 23, 2024 with Eric Matisoff, Principal Evangelist, Analytics & Data Science, who will join us to discuss all the big news and announcements from Summit 2024!
SOLVED

Adobe Client Data Layer Push method

Avatar

Level 2

Hi, I am currently using the Adobe Client Data Layer to collect my page data. I am able to see the collected data when I type "window.adobeDataLayer", but when I use "adobeDataLayer.getState()", it shows me an empty array without any page data: 

 

img2.png

 

I know that is because I used the following method to pass the data to adobeDataLayer, instead of the push method (adobeDataLayer.push()):

 

img3.png

 

So I am quite confused, since using this method I am able to see the collected data when "window.adobeDataLayer", but not "adobeDataLayer.getState()", what are the differences between these two? And is this the right way to store the data in adobeDataLayer? Is it a must to use the adobeDataLayer.push() method?

 

Any insights would be greatly appreciated! 

 

1 Accepted Solution

Avatar

Correct answer by
Community Advisor

There is a script that needs to be installed to use ACDL. That script modifies the adobeDataLayer array's push() method, so that ACDL is able to set-and-update values within its own internal, computed data layer, and so that getState() can return what you expect it to.

So the simple solution is: always use push(), don't use any other JavaScript array methods, e.g. setting adobeDataLayer[0].

View solution in original post

2 Replies

Avatar

Correct answer by
Community Advisor

There is a script that needs to be installed to use ACDL. That script modifies the adobeDataLayer array's push() method, so that ACDL is able to set-and-update values within its own internal, computed data layer, and so that getState() can return what you expect it to.

So the simple solution is: always use push(), don't use any other JavaScript array methods, e.g. setting adobeDataLayer[0].