22

Does anyone know if/where I can find IP addresses of my visitors in Google Analytics Universal reports?

3
  • 2
    You shouldn't be able to.
    – Osvaldo
    Feb 17, 2015 at 17:05
  • You could try this or you should be able to track ip addresses by collecting them with javascript and set them as "variables" in GA js code. Mar 10, 2016 at 8:21
  • You could also use Statcounter which does track the user's IP address.
    – user71607
    Nov 2, 2016 at 15:43

4 Answers 4

19

No, you won't be able to find that info. GA doesn't make it available in your reports due to privacy issues, and any collection of it is in violation of Google Analytics' Terms of Service. Please read Google's Analytics usage guidelines for clarification.

[Update July 26, 2016]

IP collection through GA is a grey area in that there is no right or wrong. It will, however, require due diligence in the investigation with your privacy lawyers/experts or into the jurisdictions of your locale (eg. European privacy laws). Alternatively, you could always make it non-argument by setting the last octet of your addresses to 0. This would sufficiently make it anonymous.

2
  • 2
    Thanks. I have checked and google is collecting IP address but does not allow us to see it. Google uses it to get visitor location etc
    – zachu
    Feb 18, 2015 at 9:45
  • As always... Google having access isn't a security issue though.
    – Mattt
    Jan 5, 2021 at 19:54
7

You can't do it via Google Analytics. However, you can setup your GA account so that each user is assigned a User-ID so that you can track each user with more detail if thats what you are looking to do. Note: this will require some change within your account and from privacy perspective this can be a real pain as well.

Or if you simply want to find the IP addresses that make requests to your site then you can check your server log. That log will list every IP address.

1
  • 2
    Can you explain how to do this? Dec 10, 2015 at 18:31
6

Here are the instructions to view IP addresses in Google Analytics.

  1. Add the following code to your pages, before the traditional Google Analytics code:

    <?php 
      if (!empty($_SERVER['HTTP_CLIENT_IP'])) {
      $ip=$_SERVER['HTTP_CLIENT_IP'];}
      elseif (!empty($_SERVER['HTTP_X_FORWARDED_FOR'])) {
      $ip=$_SERVER['HTTP_X_FORWARDED_FOR'];} else {
      $ip=$_SERVER['REMOTE_ADDR'];}
    ?>
    
  2. Then add this code to your webpages before </body>:

    <script type='text/javascript'>
     _gaq.push(['_setCustomVar', 1, 'IP', '<?=$ip;?>', 1]);
    </script>
    
  3. To see the data:
    1. Create a report in "Custom Reporting".
    2. Select Custom Variable (Value 01) as first dimension.
    3. Select all the web metrics you want to see (visits, pageviews, time on site, etc.)

Voilà!

1
  • 7
    As @nyuen answered, sending personal information (like names, email addresses or any similar data like IP addresses) to Google is prohibited. Doing so is against their terms of service and could result in your account being terminated and your data destroyed.
    – Ronald
    Jul 26, 2016 at 15:12
4

Tracking user IPs wouldn't be to beneficial to the overall product that Google is trying to deliver.

You can however find the IP's within the Apache (or IIS) log files though. Then you can take those IP's and create filters.

This article outlines the process but is specific to RFC 1918 addresses, but that's not a requirement of the filter. Not sure if it accepts CIDR notation either but worth looking into.

0

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