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
-
Dark Traffic Mystery!
Hey everyone, My team and I have been digging into this problem and can't find an answer - and it turns out this has been an issue for over year. I'll try to explain the best I can, but let me know if you have any questions. My predecessor noticed a non-existent page URL getting traffic in GA. He had the web dev team create a page so he could see where the traffic is coming from. The page has every directive under the sun on it; noindex, nofollow, noarchive, nosnippet, noodp, noydir, noimageindex, notranslate All of the traffic is (direct) / (none). It gets about 300 visits per day. Avg. time on page is 15:40, bounce rate is 99.6% and it doesn't show up in the funnel. Previous page path is 92% entrance; 8% homepage. Geo is 92% US; then diversified across countries. Browser is predominately Chrome. OS is only Windows, and device is only desktop. I've run this page through a backlink checker, and we get nothing. I've run it through Screaming Frog and it has no internal links pointing to it. I've tried putting quotes around the URL and googling it and we get a few websites, but they're very low authority and it isn't likely that they're sending 300+ visits per day. Also, since all of the traffic is direct, I don't think it's coming from a backlink anyway. This has become a personal quest for several of us, as we really want to figure out where that traffic is coming from. Any thoughts? What am I missing? It's kind of driving me crazy because I can't figure out what I've missed, so if anyone figures this out and is coming to Pubcon in November, I'll buy you a beer!! 🙂
Reporting & Analytics | | rachelmeyer0 -
Bot Traffic Higher Than Unfiltered?
We filtered bot traffic from one of our Google Analytics accounts and traffic is higher than with the unfiltered view. Does anyone have an idea what might be causing this?
Reporting & Analytics | | Leithmarketing0 -
Track subdomain in analytics
Hi, Our jobs section has recently been moved on to a subdomain https://jobs.ourwebsite.co.uk/home.html which is handled by a third party. Our analytics for the jobs section was lost as no code was added to the pages. Previously it was part of the main site. How do I track it as a subdomain so that it appears to be part of our main site? We have the old GA and universal GA code on the site Thanks
Reporting & Analytics | | Houses0 -
Google analytics : exclude traffic to a subdomain
Hi, I have a website with a client access on a subdomain. I want to exclude the traffic to that subdomain because it messes up my conversion goal for the main site. Per example, 2 out of 10 visitors are existing clients that want to access to my SaaS product. The 8 other are potential clients. I want to exclude the 2 clients from my stats so I could have the good conversion percentage for my free trial for the other 8 potential clients. Thanks in advance for your help!
Reporting & Analytics | | slestage0 -
Direct traffic decline
I've noticed a few of our sites (tour, hotel, and local attraction) which are very established and reasonably high brand recognition that have experienced a significant decrease in branded traffic (-20-30% compared to same period from the previous year) the past few months. There have been no changes in offline marketing though we are seeing a slight decrease in visitor arrivals (-5%) and higher hotel room rates. Is there a chance that Google's not set may be affecting direct traffic numbers? Any other thoughts on how we can figure out why brand traffic is dipping? Thanks
Reporting & Analytics | | SoulSurfer80 -
Subdomain tracking codes on subdomain and not root
Afternoon all. I’m pretty sure this is going to be fine but I thought I would seek some confirmation before I action anything. We have a blog subdomain on our site, I have just noticed that the entire blog (built in Wordpress) has no analytics tracking code on it. As this is built in Wordpress I have just logged in on an admin account I think people forgot I had and added the code to the header section as it is a two second job. My question is this – On the main account, subdomain tracking has not been turned on, so the root domain has not got the additional _gaq.push(['_setDomainName', 'rootdomain.co.uk']); line of code in it. I have included this on the blog.rootdomain.co.uk code as is necessary to enable tracking. Will this work or cause tracking issues? I think it should be ok. I don’t want to have to update the root domain code if I can avoid it as that will need to go through the development team and may take weeks as they are swamped and under resourced. Thanks, Rich.
Reporting & Analytics | | Sarbs0 -
When will traffic data be working ? also whats with the spike in duplicate listing issues with everyone.
Hi There, We have no traffic data, is this something we are doing wrong or is this an issue with SEOMOZ ? Also duplicate listings have gone sky high, check goggle analytics's and all ok ? Any answers ? Thanks Charlie
Reporting & Analytics | | pro580 -
How Can I Record .zip Traffic in Google Analytics
The company I am with shows traffic coming in to .zip files in Google Analytics. The traffic being recorded stopped a while back, but I know people are still downloading/visiting these .zip ULRs. I'm not sure how they were recording/tracking the .zip URLs (in Analytics) before, but I'd like to track them once again. Does anyone know how to do this? Thanks
Reporting & Analytics | | poolguy0