Expand my Community achievements bar.

SOLVED

Excluding one URL from a segment with multiple canonical URL definitions

Avatar

Level 2

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!

 

 

 

1 Accepted Solution

Avatar

Correct answer by
Community Advisor

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:

 

Jennifer_Dungan_0-1673365513554.png

 

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.

View solution in original post

3 Replies

Avatar

Level 2

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 

 

Leyla_0-1673361675105.png

 

 

 

Avatar

Correct answer by
Community Advisor

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:

 

Jennifer_Dungan_0-1673365513554.png

 

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.

Avatar

Level 2

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!