Expand my Community achievements bar.

SOLVED

DTM data layer

Avatar

Level 3

Hi All

Version CQ5.5

We have a data layer object defined for our site. The data layer will get consumed by DTM

We also have a number of custom components e.g custom button component. As part of capturing the interaction of the user with each instance of the button, we need to update certain elements/attributes of the data layer. 

Taking into consideration that the custom button component can be used by the author across multiple places in the site, or even in the same page, is it possible as a CQ component developer to provide enough information on the data layer, for each button to be uniquely identified? Or the data layer approach might no be the best solution for this use case

I also would like to understand what will be the best away technically, to update the data layer for each custom component that i'm developing

Thanks,

1 Accepted Solution

Avatar

Correct answer by
Administrator

Hi 

Please share with me exact use-case to help you out in this.

As far as i got your problem, You need to save some set of values when ever some particular event is happening.

Lets say we have 3 custom buttons on the page: b1 b2 b3

Assuming b1 b2 b3 is in div parent.

The information we need to save on

b1 is i1 i2 i3

b2 is i2 i3 i4

b3 is i2 i4 i5

 

So at the DTM level, we can create a Event Base rule on "div parent" and can save all the information in the evars and associate event1 for it.

When Event based rule is applied on "div parent", we can gauge which button is clicked, by checking it by $(this).text;

You can play with it as per your need.

I hope this will help you.

 

Thanks an Regards

Kautuk Sahni



Kautuk Sahni

View solution in original post

4 Replies

Avatar

Level 3

Hi,

I am also looking for the best way to capture information regarding user interaction with the web site using Data Layer and DTM. Have you figured out the best way possible?

Regards,

Jay

Avatar

Correct answer by
Administrator

Hi 

Please share with me exact use-case to help you out in this.

As far as i got your problem, You need to save some set of values when ever some particular event is happening.

Lets say we have 3 custom buttons on the page: b1 b2 b3

Assuming b1 b2 b3 is in div parent.

The information we need to save on

b1 is i1 i2 i3

b2 is i2 i3 i4

b3 is i2 i4 i5

 

So at the DTM level, we can create a Event Base rule on "div parent" and can save all the information in the evars and associate event1 for it.

When Event based rule is applied on "div parent", we can gauge which button is clicked, by checking it by $(this).text;

You can play with it as per your need.

I hope this will help you.

 

Thanks an Regards

Kautuk Sahni



Kautuk Sahni

Avatar

Level 3

Hi Kautuk,

Thank you for your reply. Your approach looks apt, however, where can I check for the button text '$(this).text'?

Is it inside onclick function for div parent id in JSP before sending it to DTM? or while creating an Event Based Rule, I can check the text value before sending it to Analytics (lets say)? If its while creating Event Based Rule, where exactly in DTM ?

Also, my use case is: I have created a data layer which has an event information. Refer the below screen shot:

So, for every event tracking, I want to use below code:

And then I can create a Direct Call Rule for 'Learn More event', which would send the event info to Analytics.

I am very much particular about using a data layer for every metadata information (including events), Wanted to know how relevant it will be if we can store the event information in data layer and later can use push method for updating those events rather than using an Event Based Rule mapped with html tags of the page ?

I am very new to DTM, just wanted to know the best approach for event tracking using DTM.

Thanks,

Avatar

Administrator

jayak13010535 wrote...

Hi Kautuk,

Thank you for your reply. Your approach looks apt, however, where can I check for the button text '$(this).text'?

Is it inside onclick function for div parent id in JSP before sending it to DTM? or while creating an Event Based Rule, I can check the text value before sending it to Analytics (lets say)? If its while creating Event Based Rule, where exactly in DTM ?

Also, my use case is: I have created a data layer which has an event information. Refer the below screen shot:

So, for every event tracking, I want to use below code:

And then I can create a Direct Call Rule for 'Learn More event', which would send the event info to Analytics.

I am very much particular about using a data layer for every metadata information (including events), Wanted to know how relevant it will be if we can store the event information in data layer and later can use push method for updating those events rather than using an Event Based Rule mapped with html tags of the page ?

I am very new to DTM, just wanted to know the best approach for event tracking using DTM.

Thanks,

 

 

 

 

 

You can put "text '$(this).text" logic in the JavaScript of Event-based rule.

The event-based rule would be applied to parent div, and $(this) will point to button inside patent selected. 

For DTM related Best Practice, Please reach out to http://help-forums.adobe.com/content/adobeforums/en/marketing-cloud-forum/activation.html

 

I hope this will help you.

Thanks and Regards

Kautuk Sahni



Kautuk Sahni