Page Name Concedenation through Data element - Warning Message

Jayakrish

22-01-2020

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;

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

 

Adobe Analytics Adobe Launch Data Elements

Accepted Solutions (0)

Answers (0)