View Visitor IP Address in Google Analytics

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

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.


Interested in even more great insights? Download our 2018 Ecommerce Trends + Tech Brand Growth Guidebook. This comprehensive, 36-page report outlines the top trends, challenges, and opportunities retailers face as they look to grow their business.


7 thoughts on “View Visitor IP Address in Google Analytics

    1. You are correct Chris, this is an old blog post. We made an update to reflect this with the post. Unfortunately, this is not something you can do anymore. We’d encourage you to take a look through our more recent content on Google Ads, as it should have some valuable insights for you!

Leave a Reply

Your email address will not be published. Required fields are marked *