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

Who Me Too'd this topic


Level 2


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

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()
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.



Who Me Too'd this topic