How can I find the IP address for my visitors in Google Analytics Universal reports?

178,127

Solution 1

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.

Solution 2

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.

Solution 3

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à!

Solution 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.

Share:
178,127

Related videos on Youtube

zachu
Author by

zachu

Updated on September 18, 2022

Comments

  • zachu
    zachu over 1 year

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

    • 最白目
      最白目 about 9 years
      You shouldn't be able to.
    • user3055004
      user3055004 about 8 years
      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.
    • user71607
      user71607 over 7 years
      You could also use Statcounter which does track the user's IP address.
  • zachu
    zachu about 9 years
    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
  • ignacio chiazzo
    ignacio chiazzo over 8 years
    Can you explain how to do this?
  • Ronald
    Ronald almost 8 years
    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.
  • Mattt
    Mattt over 3 years
    As always... Google having access isn't a security issue though.