Expand my Community achievements bar.

Dive into Adobe Summit 2024! Explore curated list of AEM sessions & labs, register, connect with experts, ask questions, engage, and share insights. Don't miss the excitement.
SOLVED

DTM data layer

Avatar

Level 3

Can someone please share a code snippet or a sample of how we would populate the data layer in a CQ component to expose data to DTM?

1 Accepted Solution

Avatar

Correct answer by
Employee

In your page template you can just add a code-snippet like

<script>

var digitalData={... your datalayer };

</script>

This way DTM can access it.

View solution in original post

4 Replies

Avatar

Level 10

Here is the official AEM docs on this subject:

http://docs.adobe.com/docs/en/aem/6-0/administer/integration/marketing-cloud/dtm.html

I will search to see if there are other pieces of content on this use case. 

Avatar

Level 3

Thanks for the reply

We are currently on an older version, CQ.5.5 . The aim is to 'somehow' populate the data layer, so the information populated are passed on to DTM

What i need to find out is how i populate the data layer object and also how  do we send custom events to DTM

Previously with direct sytecat  integration we would fire event tracking by using adv.trackEvent from s_code. How can we 

1) Populate and send data layer to DTM

2) Fire event tracking i.e. similar to sytecat adv.trackEvent

Avatar

Correct answer by
Employee

In your page template you can just add a code-snippet like

<script>

var digitalData={... your datalayer };

</script>

This way DTM can access it.

Avatar

Level 3

Great! Data Layer is clear

Regarding custom events such as lets say click of one of the social links. Do we implement something like ?

Code generate by component

<a href=”http://facebook.com” onclick=”trackClickInteraction();”>Social Link</a>

create a JS external file which is included in each page

this.trackClickInteraction = function() {

..........

s.tl(....);

}

Does the above seem like a reasonable solution? Do we need to include onClick event  and s.tl call, or DTM uses a different mechanism to capture custom events?