Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
Bedrock Mission!

Learn more

View all

Sign in to view all badges

Coffee Break: Join us on Wednesday, April 5th at 10am PT to chat with Ben Gaines, Director of Product Management for Adobe Analytics. Ben will be online to answer your Analytics and Adobe Summit questions.
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].

Avatar

Level 2

Hi Yuhui, 

Thank you for your answer!