Adobe Client Data Layer. Issue with cmp:click event. | Community
Skip to main content
July 5, 2021
Solved

Adobe Client Data Layer. Issue with cmp:click event.

  • July 5, 2021
  • 2 replies
  • 2103 views

Hi.

I'm making some tests over this dummy site, using a rule firing with this custom code:

//PageLoaded
function pageShownEventHandler (evt) {
var event = {
//include the path of the component that triggered the event
path: "dummy_text",
//get the state of the component that triggered the event
component: window.adobeDataLayer.getState()
};
trigger(event);
alert("Show me this.");
}

//set the namespace to avoid a potential race condition
window.adobeDataLayer = window.adobeDataLayer || [];
//push the event listener for cmp:show into the data layer
window.adobeDataLayer.push(function (dl) {
//add event listener for `cmp:show` and callback to the `pageShownEventHandler` function
dl.addEventListener("cmp:click", pageShownEventHandler);
});

, and when I click over any clickable element (those with the data-cmp-clickable attribute), it does not fire.

However, if I replace the text in red by the following:

dl.addEventListener("cmp:show", pageShownEventHandler);

, it fires.

I've been trying different options but to no avail.

Any ideas about it?

Thanks in advance.

IL.

 

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by qazwsx2

Hi,

 

Custom code looks fine.

Do you have URL to look this issue?

 

Regards,

Rajan

2 replies

qazwsx2Accepted solution
April 15, 2022

Hi,

 

Custom code looks fine.

Do you have URL to look this issue?

 

Regards,

Rajan

NimashaJain
Adobe Employee
Adobe Employee
June 27, 2022

@ivanlorenzo Did it got resolve? if it got resolved, can you please share solution?