Reputation: 441
I have Adobe Analytics set-up as a tool in DTM. I have a "Page Name" data element which references a JS Object ( digitalData.page.pageInfo.pageID). In the tool set-up area, Global Variables, I have prop1 set to %Hostname%:%Page Name%. I also have under Pageviews and Content, Page Name set to %Hostname%:%Page Name%. Issue is at the point DTM sets the values here, it doesn't have access to the digitalData object (timing issue I'm trying to resolve below).
I have I had an issue with the object not being available when the DTM code was running so I put in a page load rule to suppress the Analytics call
s.abort = true;
and then in the 3rd party JavaScript area I put in code to check for the object to be detected and I get the expected value in my console output.
(function() {
try {
function checkObj(){
if (digitalData === null || digitalData === undefined) {
setTimeout(checkObj(), 200);
}else{
var pn = _satellite.getVar("Page Name");
console.log("----> object available - Page Name DE holds:" + pn);
_satellite.track("Analytics Call");
return;
}
}
checkObj();
} catch(e) {e.message(e);}
})();
In the Direct Call Rule, "Analytics Call", I set the Adobe Page Name and prop1 again to %Hostname%:%Page Name% but the page name is still blank (only host name is output with colon) when the Analytics Call goes out?
In testing, I noticed in the Analytics Tool set-up, in the Pageviews and Content section, if I remove the values from the Page Name setting text box then nothing is output for pageName when the analytics call goes out?
So my issue is how do I get the Page Name and prop1 variables to update with the new value of the digitalData object when the analytics call goes out?
Upvotes: 0
Views: 1597
Reputation: 421
Because this seems to be a race condition between when your DL object is available and when the page load rule executes, I would do the following:
Example code in DC rule
if(Data_Layer_Obj)
s.pageName = datalayer.pageName
}
Waiting for a Data Element here may be a challenge because of the timing issues between the page load rule and your data layer objects.
Hope this helps.
Upvotes: 1