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"
}
});
Solved! Go to Solution.
Topics help categorize Community content and increase your ability to discover relevant content.
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?
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.
@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.
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?
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.
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
Views
Replies
Total Likes
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?
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.
Views
Replies
Total Likes
Yeah it's a little unintuitive when to pass it in. In general it doesn't hurt to do so in every getVar call
Views
Replies
Total Likes
Thank you both @bjoern__koth and @JudithKo
I've also found a nice blog based on the ACDL extension which mainly talked about tricks
https://www.andylunsford.com/blog/tips-tricks-for-using-the-adobe-client-data-layer-extension/
Views
Likes
Replies