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 -
How can I distinguish new visitors from existing (customers) in Google Analytics to attain an avg # of new visitor traffic per day/week?
i do marketing for a business software site where we have hundreds of clients and each account has on avg 100 users. I am having a very challenging time to attempting to figure out the real number of unique traffic that our site receives. **(what's creating the issue is that we have thousands of user accounts where our users log-in via our site to access our app/platform). Would love help with this! Christian
Reporting & Analytics | | Sundance_Kidd0 -
Universal cookie loss specific traffic
Hi there, A month ago we have installed the Universal Analytics tracking code on our website (www.smartphonehoesjes.nl). Since that time, direct traffic has risen unnaturally and organic traffic dropped unnaturally. I dived into this problem and I discovered there is a cookie loss on when visitors are switching from /cart to the first step checking out. The problem is that not all browsers cause these cookie issues, only Safari and IE older versions (9 and older) and some cases of Chrome. All iPads cause cookie issues (50% of all cases). iPhones cause not a single problem because we are using a separate mobile (m.) site which does not cause cookie problems. We don't have a mobile site for tablets yet, soon it will come. My biggest question is: how can I fix the Safari desktop cookie loss after switching domains from /cart to the first step of the chckout process? Olders versions of IE will slowly fade out and the iPad problem will be fixed when the mobile website is available for tablets. I hope someone can help me.
Reporting & Analytics | | MarcelMoz
Thanks in advance. Marcel0 -
What type of links/redirect is Yahoo! using?
So I'm trying to figure out exactly what type redirect or hyperlinking Yahoo! is using on their article pages. For example:
Reporting & Analytics | | William.Lau
https://shopping.yahoo.com/blogs/fashionate/spring-clean-your-beauty-routine--10-tips-on-looking-fresh-this-season-000058218.html Hover over an external link, it shows you the ending URL. Right or left click it, it gives you a 302 redirect. When you actually left click it, it adds and "id" attribute, I assume for tracking. However, when you left click the the hyperlink, it no longer shows as a 302. I have limited working knowledge of web development techniques, so anyone with advance knowledge or have actually done this, it'd be helpful to understand this more.0 -
How do I set a filter in Google Analytics?
I want to filter out direct traffic from the service provider msn. For some reason they are crawling our traffic and its throwing off my data. So I want to exclude direct, but only from msn. Would I set my first filter for direct then msn or vice versa? Thanks
Reporting & Analytics | | EcommerceSite0 -
Analytics Filter for URL's
Hi Fellow Mozzers I am setting my analytics and need to set some filters and need some help. I have a number of Local Sites i need to include and can't find how to do it. some of the the paths are local.imsm.com/new-york/ local.imsm.com/chicago/ local.imsm.com/long-beach/ local.imsm.com/atlanta/ each of the local URL's are /name/ any help would be great
Reporting & Analytics | | imsmlouis0 -
Overall site traffic - 3 quick questions
3 things : 1. Does Google factor in overall site traffic in rankings? So for 2 sites, all other things being pretty much equal, the one with higher traffic will be listed higher? 2. Does this logically imply that sites with lower traffic overall face an uphill struggle to be ranked highly??? 3. As an extension to this, would it be true to say that by increasing site traffic, say with Google Adwords or other online or offiline or whatever advertising, that might help get higher SEO rankings??? Thanks so much for your responses. This forum is great!
Reporting & Analytics | | inhouseninja0 -
Why does Google Analytics think PPC traffic is organic?
I have a bastard of a problem... Google Analytics is incorrectly tracking PPC traffic as SEO which is screwing up all my reporting . I don't care for rankings, I care for actual SEO traffic and I can't be sure that what i am seeing is correct which is driving me nuts. Any ideas?
Reporting & Analytics | | Red_Mud_Rookie1