Building a segment to exclude internal traffic by IP address in Piwik PRO

PUBLISHED 2 Aug 2023 - UPDATED 15 Aug 2023

Segments in Piwik PRO are a great way to temporarily exclude internal traffic from reports and dashboards, based on IP address. Here's how to do it.

One of the most common analytics questions I hear is: how do I stop internal traffic from showing up in my reports? The solution often involves filtering out or excluding traffic based on IP address, and Piwik PRO offers a couple of ways to do this.

The first is to use the 'Filter' function, which stops data from specified IP addresses being collected at all. But this has two main limitations: first, it's a permanent change (any data not collected is lost forever), and second, it doesn't apply to historic data. In other words, you need to set the filter up before you collect your data - which requires a bit of forward planning!

If you only want to exclude internal traffic temporarily, or if you're working with historic data, another option - and the one I go through in this post - is to use a segment. Segments in Piwik PRO work very much like segments in the old version of Google Analytics, Universal Analytics, if you're familiar with those. However there's one caveat that makes setting a segment to exclude internal traffic trickier than it should be.

Compiling your list of IP addresses

But before we get into the process of setting up your Segment, make sure you have the list of IP addresses you want to exclude from your reports. You can get your IP address by going to a site such as - if you send this link to your colleagues, they should then be able to provide you with their IP address. The site will list an IPv4 address or an IPv6 address: Piwik PRO can work with either of these.

IP address from What Is My IP Address

I don't actually live in Sheffield - it's an example

I'm not going to get into the pros and cons of excluding internal traffic based on IP address rather than other approaches, but just bear in mind that it isn't foolproof. You may find you have a dynamic IP address that changes whenever you reset your router. This means that you could spend more time managing and updating your segment than doing anything else! Also, an IP address filter or segment won't help with excluding traffic from mobile devices.

Creating a segment in Piwik PRO

By default, reports, custom reports and dashboards in Piwik PRO have the 'All visitors' segment selected - you'll see this listed at the top.

All Visitors segment in Piwik PRO report

To create our new segment:

  1. Go to any report or dashboard, for example the Audience overview (Reports > Audience overview)
  2. Click the '+' icon alongside 'All visitors'

Add segment in Piwik PRO

  1. Click on the Manage segments option at the bottom of the dropdown
  2. On the Manage segments screen, click Add a segment
  3. Give your new segment a name, such as 'Not Staff IPs'

Segments consist of different conditions - any user that meets those conditions will be part of the segment. And the conditions are built up using dimensions - these are the green things listed on the right of the 'Manage segments' page:

Dimensions in Piwik PRO

If you type 'IP' into the search box above this list of dimensions, the list will be filtered to only these two:

  • IPv4 address
  • IPv6 address

IP-related metrics in Piwik PRO segment

These are the dimensions we'll be using for our segment.

Adding an IP address condition

Let's go ahead and add our first condition. Drag the relevant dimension (in my case 'IPv4 address') into the box that says 'Drop a dimension from the list on the right to create a new condition'.

Once you've done that, the condition will say something like:

IPv4 address equals e.g.,

Blank IP address dimension in Piwik PRO segment

Paste your IP address into the value field (the bit that says 'e.g'). Piwik PRO will then calculate the number of visitors included in this segment (based on traffic in the last 30 days). In my case, the segment includes one visitor, or 0.2% of my total:

Condition showing IP address equals in Piwik PRO

It would be great if Piwik PRO let you exclude segments from reports. If that was the case, we could just add a condition for each internal IP address and be done with it. But segments define the visitors we want to report on, not the ones we don't want to report on. So in our condition, we need to click on 'equals' and change it to 'not equals':

Dimension dropdown in Piwik PRO

Here's where something strange happens. As my 'equals' condition accounted for 0.2% of visitors, I would expect my 'not equals' condition to account for 99.8% of visitors. Instead it gives me a figure of around 64%:

Condition showing ip address not equals in Piwik PRO

The reason for this is that some visitors don't have an identified IP address at all, and these are included in neither the 'IP address equals' or the 'IP address not equals' condition! Instead we have to add a second condition to account for these visitors.

Drag another IP address dimension into the 'OR' box and set it to 'is empty'. Now your segment will include all visitors except for those matching the IP address you specified. In my case, the segment includes 99.8% of recent site visitors:

Condition stating ip address is empty in Piwik PRO

Excluding multiple IP addresses

Now you can continue adding internal IP addresses to your segment. IMPORTANT: Each new IP address will need both an 'IP address now equals' condition and an 'IP address is empty' condition, following this pattern:

IP address not equals VALUE 1
IP address is empty


IP address not equals VALUE 2
IP address is empty


Keep an eye on the visitors calculation as you go to make sure you haven't gone wrong.

Here's (part of) my working example:

IP address segment in Piwik Pro

Once you've finished adding all your IP addresses, click on the blue 'Create a segment' button at the bottom (you won't be able to do this unless you've first given your segment a name).

Applying your segment

Now, in any report or dashboard, click the '+' button at the top (alongside 'All visitors') to access your list of segments. Select your new segment to apply it to that report or dashboard.

Each widget will now show two values, one for 'All visitors' and one for your segment that excludes internal IPs. You can now (temporarily) remove the 'All visitors' segment if you like, by clicking the 'x' button alongside it. This will leave you only looking at traffic with internal IPs excluded:

Piwik PRO report with segment applied

Notify of
Inline Feedbacks
View all comments
James Clark
Hi! I'm James Clark and I'm a freelance web analyst from the UK. I'm here to help with your analytics, ad operations, and SEO issues.
What do you think? Leave a commentx
linkedin facebook pinterest youtube rss twitter instagram facebook-blank rss-blank linkedin-blank pinterest youtube twitter instagram