Analytics
4.5K members online now
4.5K members online now
Ask questions about filter set-up and issues with using filters in Google Analytics reports
 
Guide Me
star_border
Reply

Segment results that include specific string URL

[ Edited ]
Visitor ✭ ✭ ✭
# 1
Visitor ✭ ✭ ✭

Please, I want to create a segment to return page views on a particular URL string (pages in a particular directory)

 

eg with a website that has pages - 

 

myweb.com/oranges/love-your-fruit

myweb.com/bananas/not-sure-of-them

myweb.com/oranges/really-love-my-fruit

myweb.com/bananas/why-yellow-is-bad-for-you

 

I want to create a segment that returns stats for all URLs that contain myweb.com/bananas/  or  myweb.com/bananas/*

 

I have tried

'page contains' = myweb.com/bananas/ 

But this seems to return pages without /bananas/ in URL but have a link on page where /bananas/ is in that link. 

 

I have also tried

'page title contains' = 'bananas' (because all pages in /bananas directory also have 'bananas' in page title)

same problem

 

Surely this should be ridiculously easy to do and I'm missing something basic here? 

 

thanks

 

 

 

 

 

1 Expert replyverified_user
1 ACCEPTED SOLUTION

Accepted Solutions
Marked as Best Answer.
Solution
Accepted by topic author Silver D
June

Re: Segment results that include specific string URL

Rising Star
# 4
Rising Star

Without seeing exactly what you're doing it's a little hard to figure out. Regexs are greedy so 'bananas' should capture all URIs where 'bananas' is present. Couple of things to try/test:

- the filter box on the content reports uses regular expressions so experiment with bananas there and see what happens

- use a tool like regexpal to test out different variations of your regex, against your urlsScreen Shot 2017-06-14 at 14.16.12.pngscreen shot of regexpal showing how an expression can be tested

John Wedderburn, Advertiser Community, Rising Star
Was my response helpful? If yes, please mark it as the ‘Best Answer.’ Learn how here.

View solution in original post

Segment results that include specific string URL

Rising Star
# 2
Rising Star

Segments are session based i.e. when you create a segment with the rule 'page includes bananas' all the other activity, including pages, from that session is reported. This is useful when you wish to analyse sessions which share a common trait. However, if you want to report the performance of a group of pages then you'll need to use a custom report. This could have dimension as page and metric as page view, it also needs to have a filter which equals something like 'page contains bananas'; this will only report the metrics for the pages which meet this rule and ignore all other hits.

John Wedderburn, Advertiser Community, Rising Star
Was my response helpful? If yes, please mark it as the ‘Best Answer.’ Learn how here.

Segment results that include specific string URL

Visitor ✭ ✭ ✭
# 3
Visitor ✭ ✭ ✭

Thanks very much for your help John, 

 

I can use that solution to filter pages with a shared 'page title' using a simple regex e.g. 

include page title regex (bananas)

 

But I can't figure how to filter for the URL. I've tried a filter  -

include page regex (bananas)  

 

Thinking that should return pages with URIs like myweb.com/bananas/not-sure-of-them

 

Google ? says 'Page' = 

"The pages visited, listed by URI. The URI is the portion of a page's URL following the domain name; for example, the URI portion of www.example.com/contact.html is /contact.html."

 

but i'm missing something here ... 

Marked as Best Answer.
Solution
Accepted by topic author Silver D
June

Re: Segment results that include specific string URL

Rising Star
# 4
Rising Star

Without seeing exactly what you're doing it's a little hard to figure out. Regexs are greedy so 'bananas' should capture all URIs where 'bananas' is present. Couple of things to try/test:

- the filter box on the content reports uses regular expressions so experiment with bananas there and see what happens

- use a tool like regexpal to test out different variations of your regex, against your urlsScreen Shot 2017-06-14 at 14.16.12.pngscreen shot of regexpal showing how an expression can be tested

John Wedderburn, Advertiser Community, Rising Star
Was my response helpful? If yes, please mark it as the ‘Best Answer.’ Learn how here.

Segment results that include specific string URL

[ Edited ]
Visitor ✭ ✭ ✭
# 5
Visitor ✭ ✭ ✭

Thanks again john, 

 

Yes, was my regex that was issue. I missed escaping the / slash in URI

 

The regex tester really helped http://www.regexpal.com/

 

cheers