Exclude IP From Google Analytics Reports

  • follow us in feedly
Published March 4, 2013 by Brad Knutson
Google Analytics Exclude IP

Often times clients of mine will see large spikes in site traffic at the beginning of their websites life. This large amount of traffic shortly after a sites release gets people excited and expecting equal growth very quickly.

Often times, companies will send out press releases or internal emails to their employees when a site launches. Sort of like “hey guys, go look at our new website!”

This internal traffic registers in Google Analytics as unique visitors, and traffic levels spike. As soon as the initial blast of activity dies down, site traffic slows significantly, and some clients panic. What happened?!?!

The large surge of traffic is often times internal traffic. As developers, we’re constantly tweaking things around launch, constantly refreshing the page. This could go on for days. All these hits register with Google as unique visitors. We don’t necessarily want this though, do we? We want our Google Analytics reports to reflect external visitors – potential customers.

So how do we remove ourselves from Google Analytics reports?

Removing Single IP Address from Google Analytics

Fortunately, Google had made this fairly easy on us. Unfortunately, Google doesn’t keep legacy IP address data on site visitors so we can’t go back and remove certain visitors, we can only remove them going forward.

  1. Log into your Google Analytics account.
  2. Click on the Admin tab.
  3. Drill down until you’ve clicked on the specific Google Analytics profile that you are interested in.
  4. Click the Filters tab.
  5. Click the +New Filter button.
  6. Choose Create new Filter and choose a unique name (perhaps include the date).
  7. Next to Filter Type choose Custom filter.
  8. Choose Exclude.
  9. Choose IP Address in the Filter Field.
  10. In the Filter Pattern field, enter a regular expression for the IP address.

    For a single IP address, it’s rather simple. Let’s say you have an IP address of 127.0.0.1 (I know, I know…this is localhost and you would never get traffic from here – this is just for an example), you would enter

    127\.0\.0\.1

  11. Click the Save button at the bottom of the page.

The form should look similar to this:

Google Analytics Exclude IP Filter

That wasn’t too bad, was it? Let’s test out to make sure that our filter is working properly. If you blocked your own IP address, you can now refresh your website and go to the Real Time -> Overview section of Google Analytics to see live traffic. If you see yourself navigating around the website, then you likely have gotten the IP address incorrect, or your traffic is coming from an IP that you didn’t exclude.

Excluding a Range of IP Addresses

To exclude a range of IP addresses, you’ll want to write a regular expression to include the range. For example, if you want to exclude 127.0.0.1 to 127.0.0.255 then this would be the value you enter in Filter Pattern.

^127\.0\.0\.([1-9]|[1-9][0-9]|1([0-9][0-9])|2([0-4][0-9]|5[0-5]))$

Not familiar with regular expressions? Google has a nifty tool that will help you generate the regex that can be found here: http://support.google.com/analytics/bin/answer.py?hl=en&answer=1034771.

Again, remember to test your filter to make sure that your traffic isn’t being recorded in Google Analytics reports.

The following two tabs change content below.
Founder at Inbounderish
Brad Knutson is a Web Developer in the Twin Cities area of Minnesota. He has experience working with WordPress and Drupal, and also has an interest in SEO and Inbound Marketing.

Keep Up-to-Date

Subscribe

Topics

See a complete list of topics discussed in blog posts here.

Check These Out

Get 2 Weeks Free! Sign Up Today! Premium Managed WordPress Hosting Genesis Framework for WordPress SEO is complex. Tools should be simple. Thesis Theme for WordPress:  Options Galore and a Helpful Support Community

6 thoughts on “Exclude IP From Google Analytics Reports

  1. Tor Arne Thune

    Great, I had been looking for this. Now how about if I connect using IPv6? I’m guessing google-analytics.com accepts IPv6 connections just as my website does, so I added a filter like this: 2a09\:d29\:ea98\:ab56\:3a34\:77dd\:fe2c\:6473. I’m not sure if I have to escape colons though?

    Reply
    1. Brad Knutson Post author

      Since I posted this article, Google Analytics has changed their interface a little bit. You now have the option to avoid using regex if you want. On the filter page, if you choose to exclude an IP address, you have a checkbox for IPv6. If you click that, then just enter your value in the textbox.

      Google Analytics Exclude IPv6

    2. Tor Arne Thune

      Oh, yes. Totally didn’t see that as I went for custom filter right away. Thanks!

  2. jamie Richardson

    Hi Brad

    Thanks for your article. I have a client whos old IT supplier created a whole world of filters. It’s a busy site and the Real time test methiod wont work as there are soooo many visitors at any time.

    Is there a way to test that a particular ip is being blocked?

    Regards

    J

    Reply
    1. Brad Knutson Post author

      Hi Jamie,

      You can still use the Real-time method to verify this is working. Find out where your IP Address Geolocation is (http://whatismyipaddress.com/ will tell you) and filter down to the state or city. Hopefully that provides enough clarity that you can verify this is working or not.

      Hope that helps!
      Brad

Share Your Thoughts

Your email address will not be shown.

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code class="" title="" data-url=""> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong> <pre class="" title="" data-url=""> <span class="" title="" data-url="">