Expand my Community achievements bar.

SOLVED

How to add Data Layer

Avatar

Level 10

Hi all,

 

I understand Data Layer is a JS Object that should be on the web page to collect events, etc and pass to Adobe Launch.

 

But a typical AEM implementation will have multiple pages.

 

How to add this Data Layer to each of these pages?

 

I highly appreciate all your replies.

 

Thanks,

RK.

1 Accepted Solution

Avatar

Correct answer by
Level 8

Hi @AEM_Forum 

 

You can refer this article to know : How to create data layer:

https://medium.com/@toimrank/adobe-analytics-data-layer-1cf2c9b187a7

To your queries

1: Where is Data Layer placed physically: The script will be part of page component. So, this will be available in each AEM page.

2: Where do we add this statement?  Base template:  Script is placed in Base page template.

3: 3.We do not get to see Adobe Data Layer? :  Check the View Page source.

 

4. Data Later is basically to catch events and pass this info to Tag Manager?: Yes.  Once you keep the Adobe Launch script in the language page properties section. This script will execute during every page load time. This reads your Data layer details and pass it to Adobe Analytics.

Note: By default Adobe Launch script is placed in Akamai CDN.

 

 

View solution in original post

5 Replies

Avatar

Community Advisor

@AEM_Forum  Add the JS that Initializes your data layer object in the root/base page template so that this object is available in all AEM pages.

Avatar

Level 10

Thanks Harwinder.

 

Where is Data Layer placed physically?

 

What is the JS that Initializes the data layer object and how to add it in the root/base page template?

How does this JS refer to the actual Data Layer?

 

Thanks,

RK.

 

Avatar

Community Advisor

@AEM_Forum The initializing code should look something like this : 

 window.adobeDataLayer = window.adobeDataLayer || [];.

 

More details on setup - https://experienceleague.adobe.com/en/docs/experience-manager-learn/sites/integrations/adobe-client-...

 

Avatar

Level 10

Hi Harwinder,

 

I went through multiple URLs but could not get it.

 

Trying to understand at a high level on how it should be done.

 

And my questions are pretty much pointed ones.

 

So, if you could answer in laymen's terms, it helps me a lot.

 

1.Where is Data Layer placed physically?

2.Where do we add this statement?  Base template?

window.adobeDataLayer = window.adobeDataLayer || [];.

3.We do not get to see Adobe Data Layer?

4. Data Later is basically to catch events and pass this info to Tag Manager?

 

Thanks,

RK.

Avatar

Correct answer by
Level 8

Hi @AEM_Forum 

 

You can refer this article to know : How to create data layer:

https://medium.com/@toimrank/adobe-analytics-data-layer-1cf2c9b187a7

To your queries

1: Where is Data Layer placed physically: The script will be part of page component. So, this will be available in each AEM page.

2: Where do we add this statement?  Base template:  Script is placed in Base page template.

3: 3.We do not get to see Adobe Data Layer? :  Check the View Page source.

 

4. Data Later is basically to catch events and pass this info to Tag Manager?: Yes.  Once you keep the Adobe Launch script in the language page properties section. This script will execute during every page load time. This reads your Data layer details and pass it to Adobe Analytics.

Note: By default Adobe Launch script is placed in Akamai CDN.