Excluding one URL from a segment with multiple canonical URL definitions | Community
Skip to main content
New Participant
January 10, 2023
Solved

Excluding one URL from a segment with multiple canonical URL definitions

  • January 10, 2023
  • 2 replies
  • 1142 views

Hi team,

 

I have a segment to include a list of pages based on the folder or a specific URL. I use:

 

Include HIT 

 

Canonical URL starts with "https://www.xxx.com/us/en/folder-1"  name

or

Canonical URL starts with "https://www.xxx.com/us/en/folder-2"  name

 

Now I need to exclude one page url from "https://www.xxx.com/us/en/folder-1" folder.

For this rule I can't use "or" as that brings back more URLs outside of the desired folders. And I can't use a mix of "or" and "and". 

 

If I add a new container to have Exclude HIT, that container gets added within the first "Include HIT" container. So I am still unable to use a mix of "or" and "and" between those two containers. I found this example in the community which is something that I think is similar to what I am trying to do, but again I can't add a mix of Pages as one container with "or" and another container to Exclude HIT one page URL.

 

Can you please advise on how to solve it?

 

Thank you!

 

 

 

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by Jennifer_Dungan

You can absolutely do this with containers and using both "or" and "and".

 

In your Hit Level Segment, first create one container... inside this container add your Canonical URL contains rules with "or"

 

The create a second container (using an "and" between the containers) and make the second container an exclude, then add the url you want excluded

 

Like so:

 

 

This will result in your segment returning all the urls that contain "A" or "B" but exclude "C"

 

 

The example you linked to was a little more simple... it only had 1 item being matched, so that didn't need to be in it's own container... so they only used one container to perform the exclude...

 

In your case, since you need to use an "Or" for your inclusions, you just need to wrap them in their own container so you can use the "or" for the various options, and then use the "and" between the two containers.

2 replies

Jennifer_Dungan
Jennifer_DunganAccepted solution
New Participant
January 10, 2023

You can absolutely do this with containers and using both "or" and "and".

 

In your Hit Level Segment, first create one container... inside this container add your Canonical URL contains rules with "or"

 

The create a second container (using an "and" between the containers) and make the second container an exclude, then add the url you want excluded

 

Like so:

 

 

This will result in your segment returning all the urls that contain "A" or "B" but exclude "C"

 

 

The example you linked to was a little more simple... it only had 1 item being matched, so that didn't need to be in it's own container... so they only used one container to perform the exclude...

 

In your case, since you need to use an "Or" for your inclusions, you just need to wrap them in their own container so you can use the "or" for the various options, and then use the "and" between the two containers.

Leyla-1Author
New Participant
January 10, 2023

Thank you @jennifer_dungan  for your reply. I made an update earlier this morning with the same solution:) We are all on the same page. Thanks again! 

Leyla-1Author
New Participant
January 10, 2023

Think I figured it out. I had to add two containers within one main container. That allowed me to do one container with "or" and then second container added as "and". Screenshot below. 

Thank you! 

@alphatest_en_prod