Expand my Community achievements bar.

Join us January 15th for an AMA with Champion Achaia Walton, who will be talking about her article on Event-Based Reporting and Measuring Content Groups!
SOLVED

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

Avatar

Level 1

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"

    }

});

Topics

Topics help categorize Community content and increase your ability to discover relevant content.

1 Accepted Solution

Avatar

Correct answer by
Community Advisor

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?

 

Cheers from Switzerland!


View solution in original post

9 Replies

Avatar

Community Advisor

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. 

 

Avatar

Community Advisor

@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!


Avatar

Community Advisor

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? 

 

Avatar

Community Advisor

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!


Avatar

Level 1

Hi Björn, 

this might the be open question for me: "there is no way to create eventInfo-based data elements through the extension" (I am using the extension in launch). The code above works and I see the articleName in the web developer console, but still I don't get how to pass this information in prop5 within the overlay tracking call as this is still empty. I always have to create a data element in the "Adobe Analytics Set variables" config, right? I used the custom code but the data element is still empty. 

Kind regards, 

Judith

Avatar

Correct answer by
Community Advisor

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?

 

Cheers from Switzerland!


Avatar

Level 1

you made my day @bjoern__koth thank you ! It was the very simple solution to use custom code within data elements with the following  javascript code

"return event.message.eventInfo.someprop" to pass the values to Adobe Analytics.

Avatar

Community Advisor

Yeah it's a little unintuitive when to pass it in. In general it doesn't hurt to do so in every getVar call

Cheers from Switzerland!