Setting pagename to path in DTM
I've got the following code to assign the path value to a data element:
if(location.pathname){
return location.pathname;
}
else
return '';
Is this correct if I want to have the URL path as the pagename value in the Pages report? The reason I ask is I am seeing full URLs as Page values in the reporting.
Thanks!