Setting pagename to path in DTM

Avatar

Avatar

fixepah

Avatar

fixepah

fixepah

15-10-2015

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!

View Entire Topic

Avatar

Avatar

fixepah

Avatar

fixepah

fixepah

15-10-2015

I'm not sure I'm doing this right, but when I put that code into the console, I get a syntax error:

[img]Console error for DTM.png[/img]