How to Find IP Address on Google Analytics

Cody Schneider8 min read

Looking for an IP address in Google Analytics might feel like a straightforward task, but you’ll quickly discover that the raw data simply isn’t there. Google intentionally hides full IP addresses to protect user privacy and comply with global data laws. This article explains why Google does this and provides practical, alternative ways to get the user information you actually need.

GraphedGraphed

Still Building Reports Manually?

Watch how growth teams are getting answers in seconds — not days.

Watch Graphed demo video

Why Can't You See Full IP Addresses in Google Analytics?

Finding an IP address in Google Analytics is impossible by default, and that's by design. The reason boils down to one critical acronym: PII, or Personally Identifiable Information. Around the world, data privacy regulations like the GDPR in Europe and the CCPA in California classify IP addresses as PII because they can be used to pinpoint an individual's location or online activity.

To operate globally and help its users stay compliant, Google's terms of service strictly prohibit the collection of any PII, including full IP addresses. To enforce this, Google Analytics 4 automatically anonymizes every user's IP address the moment it’s collected.

How IP Anonymization Works in GA4

Ever wonder what "IP anonymization" actually means? It’s a simple but effective process. When a user visits your site, Google's systems capture their IP address, process the general location data (like city, country, and region), and then immediately discard the raw IP address. In Universal Analytics, this was an optional setting you had to enable, but in GA4, it's automatic and mandatory - you can't turn it off.

Specifically, Google "masks" the IP by setting the last octet (the last set of digits) of a user’s IPv4 address to zero. For example:

  • A visitor's original IP might be: 123.456.78.91
  • After anonymization, it becomes: 123.456.78.0

This process makes it impossible to identify the specific individual but still allows Google to provide you with accurate aggregate geographic data, which is what most marketers need anyway.

GraphedGraphed

Still Building Reports Manually?

Watch how growth teams are getting answers in seconds — not days.

Watch Graphed demo video

What You Can See Without User IPs

While you can't get an individual’s exact IP address, Google Analytics still gives you rich, aggregated geographic information. For tracking marketing campaign performance, understanding your user base, or optimizing content for specific regions, this is often more than enough.

Finding Geographic Data in GA4

Here’s how to find the location data Google provides:

  1. Log in to your Google Analytics 4 property.
  2. On the left-hand navigation panel, go to Reports > Demographics > Demographic details.
  3. Just above the chart, you'll see a dropdown menu. Click it and select Country, Region, or City to see user data grouped by that location.

You can see key metrics like Users, Sessions, Engagement rate, and Conversions for each location. This allows you to answer important business questions like:

  • Which countries are driving the most valuable traffic?
  • Are our latest marketing campaigns performing well in the target cities?
  • Do users from a specific region engage with our website more than others?

Alternative Methods for Capturing IP Addresses (Proceed with Caution)

If you have a specific, legitimate business need to capture full IP addresses - like advanced fraud detection or compliance requirements - there are technical workarounds. However, be aware:

**Disclaimer:** Collecting IP addresses classifies them as Personally Identifiable Information (PII) under laws like GDPR. Before implementing any of these methods, you should update your privacy policy, obtain user consent, and consult with legal counsel to ensure you are fully compliant with the data privacy regulations in your region.
GraphedGraphed

Still Building Reports Manually?

Watch how growth teams are getting answers in seconds — not days.

Watch Graphed demo video

Method 1: Use Google Tag Manager (GTM) and a Custom Dimension

This is the most common technical solution for sending IP addresses to Google Analytics. It involves a public API to fetch the user’s IP and Google Tag Manager to send it to GA4 as a custom parameter.

Step 1: Create a Custom JavaScript Variable in GTM

First, you need to grab the user's IP. A simple way to do this is with a free IP-lookup API. We'll use ipify.org in this example.

  1. In Google Tag Manager, go to Variables and click New under "User-Defined Variables."
  2. Name the variable something clear, like "JS - User IP Address."
  3. Click Variable Configuration and choose Custom JavaScript as the variable type.
  4. Paste the following code into the Custom JavaScript box. This code calls the API and returns the user's IP address:
function() {
  try {
    var xhr = new XMLHttpRequest(),
        xhr.open('GET', 'https://api.ipify.org?format=json', false),
        xhr.send(null),
    if (xhr.status === 200) {
      var data = JSON.parse(xhr.responseText),
      return data.ip,
    }
  } catch (e) {
    return 'undefined',
  }
}

This script synchronously calls the API, meaning it will pause other scripts for a moment to get the IP. While simple, for high-traffic sites, an asynchronous (or 'Promise-based') approach would be better for performance.

Step 2: Create a Custom Dimension in GA4

Next, you need to tell GA4 where to store this new IP address data.

  1. In your GA4 property, go to Admin.
  2. In the "Data display" column, click Custom definitions.
  3. Click the Create custom dimensions button.
  4. Configure the dimension as follows:
  5. Click Save.

Step 3: Modify Your GA4 Configuration Tag in GTM

Finally, send the IP address from GTM to GA4.

  1. In GTM, go to Tags and find your main Google Analytics: GA4 Configuration tag. Click to edit it.
  2. Expand the Fields to Set section.
  3. Click Add Row.
  4. Click Save, and then Submit to publish your changes.

After a day or so, you should be able to see the user_ip_address parameter in your GA4 event reports or by building a custom exploration.

Method 2: Use Your Server Logs

Your website’s server automatically logs the IP address of every visitor who requests a file. Software like Apache or Nginx generates access logs that contain raw hit-level data, including timestamps, requested URLs, user agents, and full IP addresses. This method doesn't send the data to GA, but it's a direct way to see who is accessing your site.

To get this data, you'll need access to your server, which you can usually get via an FTP client or a control panel like cPanel. The downside is that this data is completely separate from your GA data - you won't magically be able to connect an IP from a server log to a session in GA without a significant data-stitching project.

What Are You Really Trying to Accomplish?

Often, marketers seek out IP addresses to solve a specific business problem, not just for the sake of collecting data. Consider your underlying goal, as there is almost always a better, more privacy-friendly way to achieve it directly within Google Analytics.

GraphedGraphed

Still Building Reports Manually?

Watch how growth teams are getting answers in seconds — not days.

Watch Graphed demo video

If Your Goal Is: Filtering Out Internal Traffic

This is the most common reason to look for an IP. You want to exclude visits from your own team, office, or freelancers to get cleaner, customer-focused data. But hunting down every employee’s IP is tedious and unnecessary.

  • Better Solution: Use the built-in IP filtering tools in GA4.

If Your Goal Is: Identifying B2B Visitors

Another common use case, especially for B2B companies, is trying to identify the names of companies visiting your website for outbound sales efforts. The problem is that a single office IP doesn't tell the whole story, especially with remote work.

  • Better Solution: Use a dedicated B2B visitor ID tool. Services like Leadfeeder, ZoomInfo, or a CRM like HubSpot have built-in technologies that use reverse IP lookups combined with other data signals to accurately identify visiting companies. These platforms are designed for this specific purpose and are far more reliable than manual IP tracking.

If Your Goal Is: Monitoring Spam and Bot Traffic

Many people assume they need IPs to identify and block spam bots hitting their website. While IP filtering can help, it's an endless game of whack-a-mole because spammers constantly rotate through different IP addresses.

  • Better Solution: Trust GA4's built-in defenses. In your web data stream settings (Admin > Data Streams > Your Stream), there is a section for "bot filtering." Be sure that "Filter out all known bot and spider traffic" is enabled. It's on by default and does an excellent job of cleaning up your data.

Final Thoughts

Ultimately, you cannot view full user IP addresses in Google Analytics because of critical global privacy standards. While technical workarounds exist using Google Tag Manager or server logs, they bring legal obligations that require careful consideration. Before going down that path, step back and ask what you’re trying to achieve - chances are there’s a safer, more effective solution available right inside GA4 or with a specialized tool.

Instead of wrestling with technical setups to uncover a single data point, you can get much clearer insights by combining all your performance data. We built Graphed to eliminate this friction. By securely connecting your platforms like Google Analytics, Shopify, and your ad accounts, you can ask plain-English questions like, "Which countries had the highest conversion rate last month?" or "Show me a dashboard of my sales pipeline from HubSpot." Instead of manual data wrangling, you get real-time answers and automated dashboards. You can try Graphed for free to see how easy analytics can be when freed from technical roadblocks.

Related Articles