What's the exact syntax for populating data layer elements in Adobe Launch using ACDL? | Community
Skip to main content
December 24, 2024
Solved

What's the exact syntax for populating data layer elements in Adobe Launch using ACDL?

  • December 24, 2024
  • 2 replies
  • 1553 views

Simple question for you folks, but I don't get it. It's the first time I am using the event driven approach in Adobe Launch.

I manage to trigger the server call for overlay events, but do not know how to retrieve the values from eventInfo attributes. I tried "event.message.eventInfo.articleName", "adobeDataLayer.eventInfo.articleName", "eventInfo.articleName" but none of these return any value, so I wonder what's the exact syntax to retrieve the values? Do I need to configure anything else in Launch before? I am using version 2.0.2 of the Adobe Client Data Layer.

window.adobeDataLayer.push({

    "event": "overlay",

    "eventInfo": {

        "articleId": "10787",

        "articleName": "Lorem Ipsum",

        "articleDateTime": "4.12.2024",

        "contentType": "news",

        "rating": "25"

    }

});

Best answer by bjoern__koth

Hi @judithko 

to be precise: the _extension_ does not support eventInfo based data elements.

You can still use custom code to return that code information though

 

return event.message.eventInfo.someprop

 

Just make sure to make it failsafe by using optional chaining


return event?.message?.eventInfo?.someprop

 

!!! to retrieve this data elements, it is _mandatory_ to pass in the event as second parameter 

 

_satellite.getVar("myDataElement", event);

 

Maybe that's what's missing?

 

2 replies

Gokul_Agiwal
Community Advisor
Community Advisor
December 24, 2024

Hi @judithko 

Are you using ACDL extension or you're injecting the ACDL file directly? 

here in your case, the approach you tried - 

  • adobeDataLayer.eventInfo.articleName: The adobeDataLayer object contains all pushed data but does not directly expose event-specific attributes like eventInfo.
  • eventInfo.articleName: This alone won't work because it must be accessed via the event object.

So basically, The values in eventInfo are available on the event object passed by the ACDL. Here's how you can access them: 

 

 

window.adobeDataLayer.addEventListener("overlay", function(event) { console.log(event.eventInfo.articleName); // Accesses "Lorem Ipsum" });

 

 

 

In case if you're unsure and facing issues then you can debug through browser console - 

Run console.log(window.adobeDataLayer) in your browser's developer console to verify the structure and content.

Hope this helps. 

 

bjoern__koth
Community Advisor and Adobe Champion
Community Advisor and Adobe Champion
December 24, 2024

@judithko how and where are you trying to access the eventInfo?


event.message.eventInfo.articleName should work if you are inside of a rule that was triggered by an ACDL event.

 

It's a little annoying that there is no way to create eventInfo-based data elements through the extension whereas accessing the computed state is supported.

Cheers from Switzerland!
Gokul_Agiwal
Community Advisor
Community Advisor
December 24, 2024

Hi @bjoern__koth Thanks, 

so correct me - as per my understanding, event.message alone not work. it should be access like event.message.event or event.message.eventInfo 

but the event.message.event reference to the current active event only right? 

 

bjoern__koth
Community Advisor and Adobe Champion
Community Advisor and Adobe Champion
December 25, 2024

event.message.event is the named event attribute that was pushed into the ACDL. In the example, it's "overlay". It's not mandatory to push the "event" attribute.

 

"event" itself refers to the event that triggered the Launch rule that executes. Hence going through the "message" is required.

 

"adobeDataLayer.eventInfo" to my knowledge does not exist.

Cheers from Switzerland!