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 needed - traffic reduced by half for no apparent reason - not sure what to do
My client site, https://www.helpinhearing.co.uk/ - has regularly been showing traffic of between 1000 & 1500 sessions per month. I've just looked at their Analytics for September and the sessions have dropped to just over 600! And not only was there a period of around 11 days from September 19th onwards when there was either zero traffic or 1 or 2 visits, but also from October 4th to today (8th Oct) also no visits at all. This has never happened and we've managed this website for several years now. I cannot fathom out why this may be the case. We haven't changed anything on the site from a technical point of view, just added content and usual blog etc pages. Search Console lists 147 pages as 404 errors but there are no urgent messages or alerts/warnings. I really don't know how to proceed and try and find out what is going on with the site. Can anyone offer suggestions?
Reporting & Analytics | | mfrgolfgti0 -
Filter staff IP address in Analytics
Hi, I'm trying to filter staff visits from Analytics on a new view. IT have given me an IP address range and I have found the following advice: "For an IP address range, you’ll have to select Custom Filters, then choose Exclude, and IP Address from the dropdown list. Then, enter a regular expression for the IP Address" If this is correct, how do I write the IP address range 1xx.xxx.xxx.160 - 1xx.xxx.xxx.223 in RegEx? Thanks
Reporting & Analytics | | Houses0 -
Verifying Site Ownership & Setting Up Webmaster tools for clients who use Hubspot
We are a Hubspot partner agency. I'm trying to find the best route for managing Google's tools as an extra resource for insight, not the primary basis for marketing effort. I also want to explore adwords in more depth. Finding a lot of our clients don't have one or the other or both Analytics/Webmaster tools in place. Can I verify site ownership to set up webmaster tools simply by having admin access to their analytics account or will that require ownership of the analytics account? With Google merging things together these days I'm not sure of the best approach to take. Usually clients have their site hosted somewhere and built on some platform and ADD a Hubspot blog and the landing pages/cta's, Hubspot tools on a subdomain hosted by Hubspot. Hubspot has tools in it's website settings for adding google analytics (actually it's just a field to add code to the header area). If a client has universal analytics on their primary domain do I still need to go and add a separate analytics property for the subdomain and go through Hubspot's tools to install it on the subdomain? Or just use the same code from their primary domain and add it to the Hubspot header? What is the best route? Any additional thoughts on this subject are welcome - with so much updating and changing coming from Google (and Hubspot as we implement 3.0 - COS) I'm trying to avoid wasted effort, outdated methods, etc. Thanks!
Reporting & Analytics | | rhgraves651 -
How to filter many cities from Google analytics
I need to filter hundreds of cities from my traffic reports. I've been told that adding them all in this format: |Knutsford|Ripon|Cheadle Hulme|Congleton| and using the 'matching reg/exp from the drop down should do it... Unfortunately that doesn't seem to be working as I can still see cities like London in the results.... Any ideas?
Reporting & Analytics | | david.smith.segarra0 -
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 -
If I am changing my domain for my website and want to keep using the same Google Analytics account to keep the data from the old domain. How should I proceed?
If I am changing my domain for my website and want to keep using the same Google Analytics account to keep the data from the old domain. How should I proceed? Do I have to start a new Google Analytics account for the new domain? If so how do I keep the old data? Or can I use the same GA account? Thank you.
Reporting & Analytics | | brianhughes1 -
Getting traffic for another site
Hi Everyone, Our website url/brand is very close to another website url/brand. We are non-competing entities. It appears as though this other company has begun a marketing program which has resulted in our traffic skyrocketing. However, it seems to have also resulted in our Pages/Visit and Visit Duration to decrease and our Bounce Rate to increase. Can anyone suggest how to deal with this type of scenario? Thanks,
Reporting & Analytics | | AC_Pro
Robert0 -
Filter out IP address of Site Search analytics
Hi Mozzers, I have a filter that excludes all internal traffic from my sites. But this does not seem to work on site search > Search Terms See here:- http://productforums.google.com/forum/#!searchin/analytics/filter$20site$20search/analytics/pO18L31hEO4/tJ3lKVNT3YYJ Any ideas? Or is it a bug, etc Thanks S
Reporting & Analytics | | Metropolis0