Regular expressions (change URL name to name)

ivanm55578074 11-07-2016

Hi All,

We have a POC of adobe catalyst analytics 🙂

We have implemented the tag manager Tealium, and we will proceed to implement the tag "Adobe SiteCatalyst"

We will not tagging pages manually with names (homepage, search, list...), but we would like to know if there is a possibility of using regualrs expressions to rename the URL full to name.


PAGE: change to to Homepage.

PAGE: change to Help.

PAGE: change to contact.





Mark Solution

Are these answers useful?
Help other community members by marking useful answers as accepted.

Accepted Solutions (0)

Answers (5)

Answers (5)

Simon_Pilkowski 12-07-2016

Hi Ivan,

you do not need to use RegEx. If your case is as simple as described you can go for the document.location object in the browser. 

document.location.pathname will contain what you need.
Your code should look something like this: 

var pageName = document.location.pathname; 
// Will replace pageName with homepage if pageName equals "/" or will remove the slashes 
// This will only work for the first level if you need deeper structures (like to work you should define how this shall look like in your report
pageName = pageName == "/" ? "Homepage" : pageName.split("/").join(""); 
// Will set the first character of pageName to uppercase
pageName = pageName.charAt(0).toUpperCase() + pageName.slice(1);


Just go to any website and paste this code to the Console and you will se this work for the first folder level. 
If you have something like you will get ab 


I hope this helps.



Simon_Pilkowski 15-07-2016

Hi Ivan,

this depends.
How many pages are we talking about? 
What you can do in the screenshot you provided I would call monkey work;)

If you have really limited pages you can do so, but I would recommend the classification rule builder for this. 
Once you need to change the naming you will just have to change the rule and everything will be re-classified.

Now you have to decide if you want to do this by hand;)




ivanm55578074 15-07-2016
I've seen this option ( Page Name , attach capture) , i dont know if it could also its a solution.
Or should do in "admin / classification rule builder


ivanm55578074 15-07-2016

Hi Simon, thanks you!.

I can not always apply that nomenclature, we have a tagging plan standard, such as the listing: "" in the tagging standard use pageName "list", and this no appear on the URL.

And the same detail (in our nomenclature we put on the "detail" tagging, but the url not appear:

Thanks you very much! your solutions is very interesting 🙂