Webmasters Stack Exchange is a question and answer site for pro webmasters. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

We have a constantly changing list of IPs that needs to be filtered out of google analytics, is there some API, or way to fetch the list of IPs to be included in a Google Analytics filter?

share|improve this question
up vote 0 down vote accepted

Sadly, no , although this would be a great feature though. The best thing you can do is block ranges of IP, you can do this with the following format:- to

Regex's to


Google have an IP range generation tool to help you out with this.

share|improve this answer
Thanks, I guess my solution will be to manually script my way through the Analytics website using some linux command line tools then. Ranges won't do it for me. Maybe I'll do it with a JMeter script. – David Parks May 28 '12 at 4:54
@DavidParks that would do it. Good luck. – toomanyairmiles May 28 '12 at 9:02

You can now do this as part of their Google Analytics Management API.

Example in Python

# Note: This code assumes you have an authorized Analytics service object.
# See the Filters Developer Guide for details.

# This request creates a new filter.
          'name': 'My Domain Filter',
          'type': 'EXCLUDE',
          'excludeDetails': {
              'field': 'GEO_DOMAIN',
              'matchType': 'EQUAL',
              'expressionValue': 'example.com',
              'caseSensitive': False

except TypeError, error:
  # Handle errors in constructing a query.
  print 'There was an error in constructing your query : %s' % error

except HttpError, error:
  # Handle API errors.
  print ('There was an API error : %s : %s' %
         (error.resp.status, error.resp.reason))
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.