1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

How can i find the IP adresse for my visitors

Discussion in 'Google Analytics' started by Realbob, Sep 5, 2016.

  1. #1
    Hi everyone,
    SEMrush
    Does anyone know if/where I can find IP addresses of my visitors in Google Analytics Universal reports?

    Maybe a specific code thta i have to add to my pages ?

    Many thanks.
     
    Realbob, Sep 5, 2016 IP
    SEMrush
  2. tahmina Rimmi

    tahmina Rimmi Member

    Messages:
    179
    Likes Received:
    10
    Best Answers:
    0
    Trophy Points:
    43
    #2
    hello
    Realbob

    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:

    - Create a report in "Custom Reporting".
    - Select Custom Variable (Value 01) as first dimension.
    - Select all the web metrics you want to see (visits, pageviews, time on site, etc.)

    thank u
     
    tahmina Rimmi, Sep 5, 2016 IP
  3. Realbob

    Realbob Peon

    Messages:
    2
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    1
    #3
    Thanks four your reply !
    I'll check this with my dev team.
     
    Realbob, Sep 7, 2016 IP