AdWords is now Google Ads. Our new name reflects the full range of advertising options we offer across Search, Display, YouTube, and more. Learn more

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

Advanced Segments - creating a segment with Regex

Visitor ✭ ✭ ✭
# 1
Visitor ✭ ✭ ✭

Hi

 

I am trying to isolate a group of 4 pages and all child pages underneath using an advanced segement filtering by 'Page' and 'matches regex'. The 4 pages I want to isolate are:

 

/Solutions/CATV-Headend/

/Solutions/Outside-Plant-Solutions/

/Solutions/Central-Office-Solutions/

/Solutions/Solutions/Residential-MDU/

 

In order to achieve the above I created the following regex:

 

^\/Solutions\/CATV-Headend.*|\/Solutions\/Outside-Plant-Solutions.*|\/Solutions\/Central-Office-Solutions.*|\/Solutions\/Solutions\/Residential-MDU.*

 

However, the home page ie / is appearing in the data.

 

Can anyone see why this might be the case - is my regex incorrect? Do I need to escape the - too?

 

Thanks in advance for any help offered.

 

Anna

 

 

1 Expert replyverified_user
1 ACCEPTED SOLUTION

Accepted Solutions
Marked as Best Answer.
Solution
Accepted by topic author Anna G
June 2016

Re: Advanced Segments - creating a segment with Regex

Top Contributor
# 2
Top Contributor
Hi :-)
The thing with segments, is that they are session based, not page based.
So, a segment will show all sessions that included those pages that you want, however it will also include any other page data also included in those same sessions.

So if i came to your site and visited /Solutions/CATV-Headend/ and also visited the homepage / and some other page all within the same session, then it would show all those visited pages.

You may do better to create a custom report with a regex filter, to single out just the pages you are wanting data for.
Regex isn't my forte however the regex can be simplified somewhat
^\/Solutions\/(CATV\-Headend|Outside\-Plant\-Solutions|Central\-Office\-Solutions|Residential\-MDU).*
Bronwyn Vourtis, Google Analytics Top Contributor
Was my response helpful? If yes, please mark it as the ‘Best Answer.’ Learn how here

View solution in original post

Marked as Best Answer.
Solution
Accepted by topic author Anna G
June 2016

Re: Advanced Segments - creating a segment with Regex

Top Contributor
# 2
Top Contributor
Hi :-)
The thing with segments, is that they are session based, not page based.
So, a segment will show all sessions that included those pages that you want, however it will also include any other page data also included in those same sessions.

So if i came to your site and visited /Solutions/CATV-Headend/ and also visited the homepage / and some other page all within the same session, then it would show all those visited pages.

You may do better to create a custom report with a regex filter, to single out just the pages you are wanting data for.
Regex isn't my forte however the regex can be simplified somewhat
^\/Solutions\/(CATV\-Headend|Outside\-Plant\-Solutions|Central\-Office\-Solutions|Residential\-MDU).*
Bronwyn Vourtis, Google Analytics Top Contributor
Was my response helpful? If yes, please mark it as the ‘Best Answer.’ Learn how here

Re: Advanced Segments - creating a segment with Regex

Visitor ✭ ✭ ✭
# 3
Visitor ✭ ✭ ✭
Hi Bronwyn

Many thanks for your response. You have been very helpful:-)

Regex works a treat.

Anna

Re: Advanced Segments - creating a segment with Regex

Top Contributor
# 4
Top Contributor
You're welcome Anna, if you have further GA questions, please post back

Cheers
Bronwyn
Bronwyn Vourtis, Google Analytics Top Contributor
Was my response helpful? If yes, please mark it as the ‘Best Answer.’ Learn how here

Re: Advanced Segments - creating a segment with Regex

Visitor ✭ ✭ ✭
# 5
Visitor ✭ ✭ ✭
Hi Bronwyn

Another quick question if I may.

Because a segment is session based, if I were to look at page views for the home page for example, within the segment, those page views would only have occured if there was also a view of any of the four other pages ie:

/Solutions/CATV-Headend/
/Solutions/Outside-Plant-Solutions/
/Solutions/Central-Office-Solutions/
/Solutions/Solutions/Residential-MDU/

in the same session.

Ie the regex I gave earlier is saying; only include sessions where there has been a view of one of the four pages list above.

Does this make sense? And am I correct in my thinking?

Many Thanks

Anna :-)

Re: Advanced Segments - creating a segment with Regex

Explorer ✭ ✭ ☆
# 6
Explorer ✭ ✭ ☆
You're correct - in my opinion it works exactly as you wrote it.

One word of addition to Bronwyn's answer - you don't need to escape "-" character in your Regex. It's a special character but only when you specify a range for example [a-z] or [0-9]. In all other cases you may leave it like it is without "\".

Re: Advanced Segments - creating a segment with Regex

Visitor ✭ ✭ ✭
# 7
Visitor ✭ ✭ ✭
Hi Andrzej

I thought so - many thanks for confirming and the additional information.

Anna