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
-
Help! Need to Get Traffic Back Up in Saturated Market
I was looking in one of my client's Google Analytics profiles, and noticed that they had two major drops in traffic before we started working with them—and they've never really recovered. The first, and most significant drop was around January 2015. And then the again, but not as drastic of a drop, was around September 2015. They are a heating and cooling company, but they are located out west so this shouldn't be a seasonality thing. Here is a link to what the BIG drop is traffic looks like in January 2015: http://imgur.com/a/Y1s8U To get a clearer picture, here are the numbers for the overall website traffic:
Reporting & Analytics | | BlueCorona
September 1, 2015 - September 30, 2015: 30,923 sessions
September 1, 2015 - September 30, 2016: 13,768 sessions Year over year traffic to the website dropped by 55%. Here is a link to what year over year looks like in Google Analytics: http://imgur.com/a/TPdJQ Like I said, we weren't working with them at the time so I don't know specifics about what might have caused this, but their numbers have never even come close to reaching what they used to be prior to the noticeable drop after September 2015. Does anyone have any insights into why this might be? Was there an algorithm change back then that could still be impacting them? Any ideas how to get them back to where they once were? Any input is greatly appreciated! Thanks.1 -
How to FILTER in Google Analytics an ad campaign from linkedin?
Hi mozzers We are setting up an a linkedin ad campaign for our agency and want to track its traffic and conversions. The linkedin ad will carry UTMs for each link. For tracking this campaign accurately I thought about creating a new GA View with a specific filter. So my question is about the filtering, should i use the INCLUDE, REFERRAL with pattern LINKEDIN.COM (see image)? if not what would be the best way to track this campaign? My other concern is that we are also running other a job ad on linkedin and I feel these hits will be tracked as well. Is there a way to separate those 2 campaigns? Thanks guys! MzE5hqE.png
Reporting & Analytics | | Ideas-Money-Art0 -
Filter the Spam traffic
Hello everyone, We have to filter traffic from spam website like webcrawler.com semalt.com social-button.com etc. So we created custom filter with Filter field: referral Filter Pattern: Webcrawler.com|semalt.com|in-g61.mail.yahoo.com|d47c5f40.linkbucks.com|buttons-for-website.com|semalt.semalt.com|forum.topic34157145.darodar.com|social-buttons.com While verification of filter there is error displaying i.e. This filter would not have changed your data. Either the filter configuration is incorrect, or the set of sampled data is too small. Please help in resolving issue..
Reporting & Analytics | | Obbserv0 -
Goals tracking across subdomains
Hi all, I'm having some trouble with regards to setting up goals tracking in Analytics across subdomains and was hoping that someone could help me out. Okay I work for an insurance company and we use a Quote & Buy portal for our insurance policies. Our website - www.example.com sends the traffic to quotes.example.com. Both of these sites have the same Google Analytics tracking ID. The quotes.example.com has no duplicate URLs which appear one our website, therefore I only set up the account to only include the hostname for each. Does this sound correct? The goals issue is if I now set up a goal in the quotes.example.com account, someone comes to www.example.com via Google and then clicks through to our journey and completes, will this count as a referral from www.example.com or as a goal from Organic? I'm totally stuck so any help would be appreciated. Thanks Ben
Reporting & Analytics | | Markerstudy0 -
Loss of referral traffic after change of CMS, host
I have a client that changed from MoveableType to Wordpress. He also changed from a dedicated server to WP Engine. He may have blocked search engines for a week or two, so his organic traffic is down but only by 25%. He's 301 redirecting all of the old pages. The mystery is that his referral traffic from Google is down 90%. It's a popular blog, so that's thousands. It's been going on a month now. Anyone seen this before?
Reporting & Analytics | | Hyper-Dog0 -
Subdomain referral
Hi, We have two sites mysite.com and aa.mysite.com. We want to track these sites separately. We created two different properties with IDs UA-XXX-1 for main domain UA-XXX-2 for subdomain. gaq code for main domain is as following, gaq code for subdomain is as following, It works well for subdomain. But we want to see traffic from subdomain to main domain as referral.
Reporting & Analytics | | OkanKortan
What is wrong with the gaq code of main domain?
Do i need to change code or is it enough to inactivate subdomain tracking option in profile settings of main domain? Thanks in advance,0 -
Huge Traffic Drop?
I am seeing a huge 30-40% traffic drop which started around 8-9 PM EST last night. I am compare the stats of today with last Saturday and the drop is significant. I am checking it in Google Analytics and Clicky and both report the same. The Adsense impressions drop also show the same. The rankings of my top keywords seem to be fine. I re-checked them using ranktracker for Google US, UK and others. I don't understand what has happened here. Anyone else seeing the drop? Is there a Google Panda update underway?
Reporting & Analytics | | abhim120 -
Subdomain and relative link paths cause crawl errors
I have a Wordpress blog on our subdomain and we use relative paths on our domain. It appears as though Google bot is crawling from the subdomain categories back to the domain relative paths. This of course results in hundreds of 404 pages. Any suggestions as to how to resolve this issue without changing the relative path structure of our domain? I can provide more information if need be. While I realize these issues are not that pressing, I'd obviously like to remove as many errors as possible. If anyone has encountered this problem, especially in Wordpress I'd really like to hear your solution or lack there of. Thank you in advance.
Reporting & Analytics | | BethA0