How to filter out traffic from subdomain using regex?
-
Hi There,
We have a test server that lives on a subdomain which we'd like to filter out in Google Analytics.
We're using the hostname filter but are having trouble understanding the regex needed, we're using this as the filter pattern:
Will that work? The profile is new so we can't test the pattern. Any pointers in the right direction would be much appreciated.
Cheers
Ben
-
Actually, I this we just put the hostname in there right?
A previous consultant had put a regular expression in there (the one from the question) but I suspect we just add the hostname.
-
Or do we just put this into the field?
domain
Will simply find 'domain' anywhere?
Cheers
Ben
-
Thanks Martijn, much appreciated.
It now looks like we're escaping the . (dot) - is that right? We're actually trying to match anything before and after 'domain' - to match any site on our test server.
Do we need something like this instead?
^domain.
Sorry I'm not understanding how this works - have read so many tutorials but can't figure out what the 'anything' character is?
Cheers
Ben
-
Hi Ben,
This won't completely work as the . (dot) also has a function in Regular Expression which means it can be any single character. So what you need to do is escape that one. Then it will eventually become something like:
.*domain.com.
Martijn.
Got a burning SEO question?
Subscribe to Moz Pro to gain full access to Q&A, answer questions, and ask your own.
Browse Questions
Explore more categories
-
Moz Tools
Chat with the community about the Moz tools.
-
SEO Tactics
Discuss the SEO process with fellow marketers
-
Community
Discuss industry events, jobs, and news!
-
Digital Marketing
Chat about tactics outside of SEO
-
Research & Trends
Dive into research and trends in the search industry.
-
Support
Connect on product support and feature requests.
Related Questions
-
How to filter blog pageviews using segments with regex
I must be overcomplicating this. I have a website with a blog structure that includes year subfolders, so: website.com/2019/blog-title, website.com/2018/blog-title, website.com/2017/blog-title, etc. I want to create a segment that I can apply in Site Content > All Pages to get quick stats for all blogs, regardless of year. (Pageviews, time on site, etc.) Unfortunately, Content Drilldown doesn't work well here as it is grouping by each year. I have tried setting up a segment using regex, but am getting a mixture of all pages, not just blog pages. I have set up the segment the following way: Advanced > Conditions > Page, Matches Regex, /2019/(.*?)/ Advanced > Conditions > Page, Matches Regex, /2018/(.*?)/ Advanced > Conditions > Page, Matches Regex, /2017/(.*?)/ Am I going about this all wrong? Is my regex wrong? Any advice is appreciated! Side note: glaringly obvious that now is the time to clean up my URLs. But I'd still love to see the data in its current URL state. Thank you!
Reporting & Analytics | | SoleGraphics0 -
How to exclude traffic for a specific mobile device in Google Analytics view?
Hi, Need help on how to exclude traffic for a specific mobile device in Google Analytics view. I have been searching and the only information available is excluding IP address of internal traffic. Is there any way to exclude traffic through a mobile MAC address?
Reporting & Analytics | | Khadija_K0 -
Using Filters On Google Analytics
Hi Guys, I am In need of some technical help with regards to Google analytics. One of my clients has a site providing HR Software on SaaS basis. The users login via the site for the various HR Tools. Obviously this is skewing the analytics data and showing 10,000+ extra visitors that actually don't exist. Now I understand i can add filters and exclude certain pages for instance the login page, however, some users will visit the home page then click login. How can I exclude them just to show new visitors to the site rather than users that are just trying to login. Hope this makes sense Neil
Reporting & Analytics | | nezona0 -
Senuke and traffic generator program is a good idea?? I think i got some problems now.
First of all thanks for reading, especially if you are the one whose bright ideas will help me out:) I started using senuke xcr about 3 months ago, obviously at the beginning i didnt make much success(not like I do now). Later i bought that inferno thingy and it actually works. First 2 weeks didnt make much difference(although i could see some little but stable uprising) but after 4th week ended, the average impression and queries doubled up, 6th went up again, its like every week or two it jumps up and keeps it there. Also the actual traffic from keywords went up! When about the second week finished, i started using a traffic generator program, first it leveled out the impressions and seemed to help a bit. Lately i think it messed it all up, plus about 2 weeks ago there was 2-3 dayswhen i sent a bit more traffic than usual and around that time the average rising of impressions didnt happened, it might even went down. Now i stopped using traffic g. and everything stayed the same no improvement!! Anyone could help me? I need to get it moving up again! Also im still nowhere near the top as the keywords are competitive well at least for me. What do i do wrong and what should i do? Also what about traffic generator? ps is it safe or/and or allowed to write that? Thanks
Reporting & Analytics | | Sugafree0 -
How to devide Google traffic into local google traffic (.com , .uk , .cn etc) in Analytics
Hi, friends In google analytics , we can see search traffic from google, but is it possible to deeply see from which local google? eg: .com , .uk, .hk etc? Thanks alots
Reporting & Analytics | | topchinaseo
Boson0 -
We lost great amount of Google Traffic. Need Expert Advice, Please!
We are in the business of selling home and commercial light fixtures for about 10 years now. Our website is a very large ecommerce website with more than 40K pages including category, sub-category and product pages. We have been getting decent organic traffic mostly from highly competitive keywords and also from product/solution specific long tail keywords. Recently when Google changed the EMD algo we have seen a dip in the traffic (say about 60%). I can't be so sure that this is because of EMD update, but it started happening only after this update. There has been a rank drop from 1st page to 2nd page, decrease in no. of keywords driving traffic, decrease in no. of pages driving traffic, all these things have an negative impact on our organic revenue. I know that our back link portfolio is bad and the reason behind this is the SEO companies that we previously worked with, Thanks to them for this sloppy work. Other than back links, Is there anything fundamentally wrong on our website. Here is the URL http://bit.ly/QVFHgr
Reporting & Analytics | | goldenageusa0 -
Which one should I be using 301 redirects
Hiya guys, I have a little problem, not sure which one I should be using, for 301, be easy on me I've not dealt with this before. So we have http://www.talknightlife.co.uk and I've done redirects for http://talknightlife.co.uk to http://www.talknightlife.co.uk host http://www.talknightlife.sheffieldspeedcameras.co.uk to http://www.talknightlife.co.uk Because my website is purely a forum and in the canonical error from the optimisation tool is showing 301 canonical = http://www.talknightlife.co.uk/forum.php should I be redirecting that to http://www.talknightlife.co.uk or the other way round, or just leave it ? I'm a little confused Cheers in advanced for your help guys
Reporting & Analytics | | Lukescotty0 -
How do I find backlinks and/or SERPs for a subdomain
I realize this is probably a very basic question but if I want to find backlinks to a sub-domain of my site, how would I do that? Also, if I wanted to see what search terms were bringing traffic to one specific page of my site, how would I do that?
Reporting & Analytics | | aarnswife0