Hi All,
I am using Adobe Client Data Layer provided by AEM.
Created a Rule name "General Page Load" in Data Collection Platform and added the below Javascript code under "Event"
var pageShownEventHandler = function(evt) {
// defensive coding to avoid a null pointer exception
if(evt.hasOwnProperty("eventInfo") && evt.eventInfo.hasOwnProperty("path")) {
//trigger Launch Rule and pass event
console.debug("cmp:show event: " + evt.eventInfo.path);
var event = {
//include the path of the component that triggered the event
path: evt.eventInfo.path,
//get the state of the component that triggered the event
component: window.adobeDataLayer.getState(evt.eventInfo.path)
};
//Trigger the Launch Rule, passing in the new `event` object
// the `event` obj can now be referenced by the reserved name `event` by other Launch data elements
// i.e `event.component['someKey']`
trigger(event);
}
}
//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:show", pageShownEventHandler);
});
after adding this created a data element using the custom code
if(event && event. Component && event.component.hasOwnProperty('@type')) {
return event. Component['@type'];
}
But the event object is coming as undefined when we executed this rule. And I am not able to get the expected values also.
Please help us in resolving this issue.
https://experienceleague.adobe.com/docs/experience-manager-learn/sites/integrations/analytics/collec... - Referred this link for above implementation
Cheers,
Chandru A
Views
Replies
Total Likes
I suggest doing the following in Adobe Launch instead:
(When "event.eventInfo...." is pushed into adobeDataLayer, it gets "captured" in Adobe Launch's native event object as "event.message.eventInfo....". So the data element created at step 2 helps you to retrieve this.)
I find this setup to be more intuitive because:
Hope that works for you! ![]()
Views
Replies
Total Likes
Hi @yuhuisg
I tried the steps which u mentioned, but getting the below error
VM460:1
Data element circular reference detected: event.message.eventInfo -> event.message.eventInfo -> event.message.eventInfo -> event.message.eventInfo -> event.message.eventInfo -> event.message.eventInfo -> event.message.eventInfo -> event.message.eventInfo -> event.message.eventInfo -> event.message.eventInfo -> event.message.eventInfo
Anything we missed out in the implementation ?
Cheers,
Chandru A
Views
Replies
Total Likes
Are you pushing event.message.eventInfo into adobeDataLayer again?
Can you share your action's complete code?
Views
Replies
Total Likes