The ROI Revolution Blog

View Visitor IP Address in Google Analytics

September 20, 2006

View Visitor IP Address in Google AnalyticsThere’s no way to view your visitors IP addresses right out of the box with Google Analytics. You can view visitor location and ISP in Marketing Optimization > Visitor Segment Performance, under the Domains and Geo Location reports.

But surely Google Analytics must collect the IP address, or there’s no way that it could calculate visitor location and ISP.

In fact, it does collect this data from each visitor that accesses your site. Better still, the data is easily accessible with a fairly straightforward Advanced Filter and the User Defined variable. Here’s how.


You’ll need to create a new filter for your profile. Bear in mind that if you are using any custom visitor segmentation with the __utmSetVar function, you should set up a new profile for the IP address data. If you don’t, you’ll overwrite your custom segmentation.

In the Filter Manager, enter the following filter information:

Filter Name: IP Extraction
Filter Type: Advanced
Field A -> Extract A: Visitor IP Address / (.*)

You can leave Field B and Extract B blank.

Output To -> Constructor: User Defined / $A1

( Click here for a screenshot )

Then be sure to apply the filter to your profile.

This will take the User Defined field and replace it with the IP address (which is used behind the scenes in several reports, but unfortunately does not headline in its own). You will then be able to Cross Segment by User Defined in your reports to see all of the IP addresses for a particular entry, or view them in the User Defined report under Marketing Optimization > Visitor Segment Performance.

Now, there is a huge caveat to this entire procedure. If you take a look at Item 7 in the Google Analytics Terms of Service, you’ll notice that you are not allowed to “associate any data gathered from Your website(s) (or such third parties’ website(s)) with any personally identifying information from any source”. So, using the filter above will break the ToS. Just a heads up.

An update to this post: There has been a lot of talk lately in the analytics blogosphere and beyond about Google’s commitment to privacy and the way they handle sensitive data (like IP addresses). The excellent GA Experts blog post about the (extremely quick) response taken by Google on this matter:

Previously, by stripping out the visitor IP address and adding it to the User Defined variable, the IP address would show up in reports. However, now this report (Marketing Optimisation -> Visitor Segment Performance -> User-defined) now shows a value of ‘(not set)’ for all visitors, as it would if the User Defined variable had never been used.

We’ve noticed the same thing, so we recommend that anyone who has attempted this hack on their own Google Analytics profiles remove it. As we’ve mentioned above, it violated your Terms of Service and it no longer works.

Take the next step. Ecommerce retailers spending at least $5,000/month in AdWords qualify for a free 20-minute AdWords Diagnostic Checkup.

© 2002-2014 ROI Revolution, Inc. All rights reserved.