Expand my Community achievements bar.

Join us at Adobe Summit 2024 for the Coffee Break Q&A Live series, a unique opportunity to network with and learn from expert users, the Adobe product team, and Adobe partners in a small group, 30 minute AMA conversations.

Page Name Concedenation through Data element - Warning Message

Avatar

Level 4

Team, 

 

Basically we were trying to concatenate the three values in the page name section through data element. However, we see the previous page is capturing on the page name instead of the current page name. checked the code in the browser console and it is firing fine as expected using 'this.hierarchyString;" at the end of the code. But I get an error on custom code as "expected an assignment or function call and instead saw an expression " when I use "this" instead of "return" at the end of the statement. Therefore, what should I use exactly at the end of the statement to get the value of "hierarchyString" without any error or warning? Please assist me for the same and let me know if any.

 

Extension - Core

Data Element Type : Custom Code

 

----------------Custome Code---------------------

var hierarchyString = _satellite.getVar('Data Layer - Page Title');

if(_satellite.getVar('Data Layer - contentHierarchy Level 1')){
hierarchyString = _satellite.getVar('Data Layer - contentHierarchy Level 1');
}
if(_satellite.getVar('Data Layer - contentHierarchy Level 2')){
hierarchyString = hierarchyString + ":" + _satellite.getVar('Data Layer - contentHierarchy Level 2');
}
if(_satellite.getVar('Data Layer - contentHierarchy Level 3')){
hierarchyString = hierarchyString + ":" + _satellite.getVar('Data Layer - contentHierarchy Level 3');
}
if(_satellite.getVar('Data Layer - contentHierarchy Level 4')){
hierarchyString = hierarchyString + ":" + _satellite.getVar('Data Layer - contentHierarchy Level 4');
}
if(_satellite.getVar('Data Layer - contentHierarchy Level 5')){
hierarchyString = hierarchyString + ":" + _satellite.getVar('Data Layer - contentHierarchy Level 5');
}

this.hierarchyString; // or return hierarchyString;

-----------------------------------------------------

 

Topics

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

0 Replies