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
Solved! Go to Solution.
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!
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!
Hi @yuhuisg
I tried the steps which u mentioned, but getting the below error
VM460:1
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
Do not name the data element as 'event.message.....' use something in line with your normal naming conventions.
Views
Replies
Total Likes
Views
Replies
Total Likes
On the subject of ACDL I'm having some difficulties in picking up values using DCP (Launch)
I'm trying to pick up the values of an event driven change using DCP. The example below i'd like to pass Value1 into an eVar :
I've created the rule in DCP, added the ACDL - data Pushed to the Events. The rule fires perfectly on the event 'searchFilter', however when trying to map the value1. to the analytics extension it's just not pulling through.
What I have noticed is we do not have any 'eventInfo' value in the data Layer. Would this be the issue?
Any help on this would be appreciated
Views
Replies
Total Likes
You shouldn't be using "event.message" here. This is because the "search" object that is pushed gets appended to ACDL's computed data layer state.
So, create a data element from the ACDL extension > Data Layer Computed State. Enter "search.searchCriteriaCategory" as the path.
Views
Replies
Total Likes
Many thanks for the reply, I've tried this approach but i'm seeing undefined. It's a pain as I think I'm left to writing if loop statements to collect data.
Views
Replies
Total Likes
If you're resorting to writing loop statements, then it means your ACDL implementation has something fundamentally wrong.
Try this: go to your website and perform a search that results in your "search" object being pushed into the data layer. Then, open your browser console and type
adobeDataLayer.getComputedState("search.searchCriteriaCategory");
adobeDataLayer.getState("search.searchCriteriaCategory");
Do you get back your expected searchCriteriaCategory value?
If so, then it means ACDL is working properly. Then it also means that there could be a problem in your Launch rule. Verify that your Launch rule is being triggered with the ACDL extension > Data Pushed event with "searchFilter" as the specific event.
Views
Replies
Total Likes
Hi @yuhuisg many thanks for the information. Having come from traditional data Layer to ACDL it's a learning curve.
I tried running your suggestion in console after the data Layer had been updated but it returns the following:
Uncaught TypeError: adobeDataLayer.getComputedState is not a function
Views
Replies
Total Likes
Sorry, my mistake. It should be adobeDataLayer.getState().
Views
Replies
Total Likes