Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
BedrockMission!

Learn More

View all

Sign in to view all badges

Parsing URL minus domain & QSP to Page Name

Avatar

Avatar
Validate 1
Level 1
Jmaguire
Level 1

Like

1 like

Total Posts

15 posts

Correct Reply

0 solutions
Top badges earned
Validate 1
Boost 1
View profile

Avatar
Validate 1
Level 1
Jmaguire
Level 1

Like

1 like

Total Posts

15 posts

Correct Reply

0 solutions
Top badges earned
Validate 1
Boost 1
View profile
Jmaguire
Level 1

22-02-2021

Hi,

 

Apologies if this is mentioned but I couldn't find anything in Adobe documentation or on the forums.

 

A site I'm working on doesn't use a data layer and currently only passes URL into the Page Name variables. I'm looking for a workaround to pass URL minus domain and query string parameters into the Page Name var, possibly with slashes replaced by colons.

 

Is there a rule for this I can use within Adobe Launch? Assume it may require some custom code.

 

Thanks,

James

Accepted Solutions (1)

Accepted Solutions (1)

Avatar

Avatar
Affirm 50
MVP
evolytics_brian
MVP

Likes

80 likes

Total Posts

170 posts

Correct Reply

54 solutions
Top badges earned
Affirm 50
Applaud 25
Establish
Seeker
Give Back
View profile

Avatar
Affirm 50
MVP
evolytics_brian
MVP

Likes

80 likes

Total Posts

170 posts

Correct Reply

54 solutions
Top badges earned
Affirm 50
Applaud 25
Establish
Seeker
Give Back
View profile
evolytics_brian
MVP

22-02-2021

@Jmaguire -

The simplest approach might be to create a "page name" data element that parses the pathname per your requirements. 


Maybe start with something like this:

var path = document.location.pathname;

if (path === "/") {
  // specify a default value if the path is "/" (assume home page)
  path = "homepage";
} else {
  // remove leading "/", then replace all remaining "/" with ":"
  path = path.replace(/^\//, "").replace(/\//g, ":");
}

return path;

 

Then, in your rules, reference the data element. 

Answers (1)

Answers (1)

Avatar

Avatar
Seeker
Moderator
PratheepArunRaj
Moderator

Likes

314 likes

Total Posts

866 posts

Correct Reply

264 solutions
Top badges earned
Seeker
Bedrock
Engage 1
Affirm 250
Contributor
View profile

Avatar
Seeker
Moderator
PratheepArunRaj
Moderator

Likes

314 likes

Total Posts

866 posts

Correct Reply

264 solutions
Top badges earned
Seeker
Bedrock
Engage 1
Affirm 250
Contributor
View profile
PratheepArunRaj
Moderator

23-02-2021

Dear Jmaguire,

Why do you want to capture the pathname + Query String Parameters in the pagename? I would not recommend it because it will result in duplication of the pages.

URL: https://experienceleaguecommunities.adobe.com/adobe-analytics-questions/message-id/21725?q=test

Pagename: /adobe-analytics-questions/message-id/21725?q=test

You are trying to achieve the above right? If yes, please do not go for it, particularly in the Page Name variable.

Thanks, Arun.