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

View Filter using REGEX for "visits to hostnames"

Follower ✭ ☆ ☆
# 1
Follower ✭ ☆ ☆

Hi! 

I'm working with an app and our users create a subdomain within our domain. 

I'm thinking about creating a view ONLY for this subdomains in GA but it seems that I can't use a filter using REGEX. 

This would be the regex to be used: \w*\.mydomain\.com\/{1}\w+

Is there a way to use regex 

1 Expert replyverified_user

View Filter using REGEX for "visits to hostnames"

Explorer ✭ ✭ ☆
# 2
Explorer ✭ ✭ ☆

Hi @Santi C,

Can you try using '\w*\.mydomain\.com'  in hostname filter pattern. This will filter traffic to all subdomains (anytext.mydomain.com)

If you want to filter traffic to a specific page in subdomain then you'll have to include Request URI filter in addition to hostname filter.

Hope this helps,
Thanks,
Ritwik

View Filter using REGEX for "visits to hostnames"

Follower ✭ ☆ ☆
# 3
Follower ✭ ☆ ☆

Thanks! I'll try this one and let you know. Quick question, does GA uses different regex than the standard? 

View Filter using REGEX for "visits to hostnames"

Top Contributor
# 4
Top Contributor

It uses a type of regex similar to POSIX regex

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

View Filter using REGEX for "visits to hostnames"

Visitor ✭ ✭ ✭
# 5
Visitor ✭ ✭ ✭

@Ritwik B it seems that the "regex" is still not working, I added it with the following settings: 

Filter Type: Predefined

Include only / traffic to the hostname / that contain 

Hostname: \w*\.mydomain\.com

 

Am I doing something wrong? 

View Filter using REGEX for "visits to hostnames"

Explorer ✭ ✭ ☆
# 6
Explorer ✭ ✭ ☆

Hi @Santiago C,

Try 
Filter Type: Custom
Include Hostname
Filter Pattern: \w*\.mydomain\.com
(assuming hostname is mydomain.com)

If you have hostname as www.mydomain.com and you want to include all subdomains. Try
Filter Type: Custom
Exclude Hostname
Filter Pattern: www\.

(To check the hostname in anlaytics, try applying it as a secondary dimension)

Let me know, if this helps.

Thanks,
Ritwik