Check 41.14 · Tracking and analytics setup

Exclude internal traffic if relevant

Exclude visits from your teams, contractors and test environments from GA4 or Matomo, by IP address or by cookie, testing the filter before activating it.

Priority
Critical
Difficulty
Easy
Estimated time
30 min to 1 h
Free, no account: your progress is saved in this browser.

Ask an AI to check this point on your site

Opens the assistant with a ready-made question: this check, its goal and your site URL.

For Gemini, Copilot or another assistant, copy the question. The link opens the chosen service directly: nothing goes through this site.

In short

Internal traffic means visits from your employees, your agency, your developers and your tests. On a small site, it can account for a significant share of visits and, above all, of test conversions. Excluding internal traffic means flagging it and then removing it from the data, by IP address or by a marker set in the browser. Once the task is done, the reports only reflect the behavior of real visitors.

Why it matters

Teams visit their own site every day: checking a page, showing a product, testing a form, proofreading an article. These visits look like direct or organic traffic (an employee who searches for the company name in Google), spend a long time on pages and trigger test conversions. They distort the conversion rate, engagement time and most viewed pages.

The weight of this traffic depends on the size of the site. For a site that receives a few hundred visits a month and a team of ten people, the effect is significant; for a site with several hundred thousand visits, it is often negligible, except for test conversions. Hence the “if relevant”: measure first, exclude afterwards.

Exclusion is permanent. In GA4, an active filter deletes the matching data before processing: it will never be available, neither in reports nor in BigQuery. Hence the importance of testing the filter before activating it.

What it improves

  • Conversion rate Without the teams' test submissions. See track conversions and conversion rate (opens in a new tab).
  • Organic and AI traffic Without brand searches and prompt tests made by your teams. An employee who checks whether ChatGPT cites the site, then clicks, creates an “AI” visit that is not one.
  • Engagement Duration and pages per session closer to reality.
  • Rankings No effect.

How to check

  1. Know your IP addresses: from the office network, type “what is my IP address” into a search engine. Note the IPv4 address and, if it is shown, the IPv6 address. Do the same for the company VPN and at the agency.
  2. Current state in GA4: Admin > Data collection and modification > Data filters. Does an “Internal Traffic” filter exist, and in what state (Testing, Active, Inactive)? Then Data streams > your stream > Configure tag settings > Show more > Define internal traffic: are the IP rules up to date?
  3. Current state in Matomo: Administration > Websites > Manage, edit the site and look at the Excluded IPs field; also check the global list in Administration > Websites > Settings.
  4. Test: from the office, visit the site. In Matomo, your visit must not appear in the Visits Log. In GA4 with a filter in Testing state, your events carry the “Test data filter name” dimension.

How to implement

Before you start

List the sources of internal traffic and the right method for each:

Source Fixed IP address? Method
Office with a business connection Usually yes IP rule
Company VPN Yes (VPN exit addresses) IP rule
Remote work, mobile connections No Browser marker (cookie)
Agency or contractor Varies IP rule if fixed, otherwise marker
Staging and test environments Not applicable Do not load the production tag
Developers in debug mode Not applicable GA4 “Developer traffic” filter

Good to know: your company's or your client's internal rules may require informing employees about this marker. The internal traffic marker only serves to exclude their visits, never to track them individually.

GA4: define internal traffic by IP address

  1. Admin > Data collection and modification > Data streams, click your Web stream.
  2. “Configure tag settings”, then “Show more”, then “Define internal traffic”.
  3. “Create”: give the rule a name (“Nantes office”). The traffic_type value is internal by default; keep it, or use a more specific value (agence) if you want to filter separately.
  4. Under “IP addresses”, choose a match type and a value:
Match type Example Use
IP address equals 203.0.113.24 A fixed address
IP address is in range (CIDR notation) 203.0.113.0/28 or 2001:db8:1200::/48 An office range, an IPv6 network
IP address begins with 203.0.113. A simple range
  1. “Add condition” for each additional address (conditions are combined with OR), then “Create”.

At this stage, events coming from these addresses carry traffic_type=internal, but nothing is excluded yet.

GA4: create and test the filter

  1. Admin > Data collection and modification > Data filters > Create Filter.
  2. Choose “Internal Traffic”. Name the filter (40 characters at most, starting with a letter).
  3. Operation “Exclude”, value of the traffic_type parameter: internal.
  4. State “Testing”, then “Create”.
  5. The next day, create a free-form exploration: rows “Test data filter name” and “Event name”, value “Event count”. Your office visits should appear with the filter's name; those of visitors, with no value.
  6. If the result is correct, go back to the filter and change its state to “Active”.

A filter can take 24 to 36 hours to apply. A property accepts at most 10 data filters. In the same list, also activate the “Developer Traffic” filter if it is offered: it excludes from reports the events sent in debug mode (Tag Assistant, Tag Manager preview, debug_mode), which remain visible in DebugView.

For people without a fixed IP, have the tag itself carry the traffic_type parameter when a cookie is present.

  1. Publish a non-indexed page, known only to the team, that sets the cookie, for example https://example.com/outils/trafic-interne:
<script>
  document.cookie = 'internal_traffic=1; max-age=31536000; path=/; SameSite=Lax; Secure';
</script>
<p>This browser is now flagged as internal traffic.</p>

Add a <meta name="robots" content="noindex"> tag to it and do not link to it anywhere.

  1. With gtag.js, read the cookie before the tag's configuration:
const isInternal = document.cookie.split('; ').includes('internal_traffic=1');

gtag('config', 'G-XXXXXXXXXX', isInternal ? { traffic_type: 'internal' } : {});
  1. With Tag Manager: create a “1st Party Cookie” variable named internal_traffic, then a “Lookup Table” variable that returns internal when the cookie equals 1. In the Google tag, “Configuration settings” section, add the traffic_type parameter with this variable as its value.

The “Internal Traffic” filter created above then excludes these visits just like the office ones. Each person must visit the page on each of their browsers and devices, and again after clearing their cookies.

For a single workstation, Google also offers a browser add-on that disables Google Analytics on every page visited; it prevents measurement, which amounts to the same thing for the person concerned.

Matomo

  • By IP address, for one site: Administration > Websites > Manage, edit the site, Excluded IPs field, one address or range per line. Matomo accepts wildcards (203.0.113.*) and CIDR notation (203.0.113.0/24, 2001:db8::/32).
  • By IP address, for all sites: Administration > Websites > Settings, global list of excluded IPs (super user).
  • By cookie: each person opens their personal Matomo settings and clicks the link to exclude their visits with a cookie. Matomo sets a matomo_ignore cookie, with no expiry date, in that browser.
  • By user agent: a list of excluded user agents exists in the same settings, useful for internal monitoring tools.

The exclusion only applies to new visits; past visits remain in the reports. Matomo excludes the IP before anonymizing it: anonymization does not interfere with filtering.

WordPress

Versions WordPress 6.4 and later.

Teams working in the WordPress admin also browse the public site. Two options:

  • Do not load the tag for logged-in users with an editing role, if you are the one inserting the code:
// wp-content/themes/votre-theme-enfant/functions.php
add_action('wp_head', function (): void {
    if (current_user_can('edit_posts')) {
        return;
    }

    get_template_part('partials/analytics');
}, 1);
  • Plugins: Site Kit by Google and the Matomo Analytics plugin offer, depending on their versions, settings to exclude logged-in users or certain roles; check their tracking settings.

This method does not cover visits made without being logged in: combine it with the IP rule or the cookie.

Laravel

Versions Laravel 11 to 13.

Add the traffic_type parameter for team accounts, on top of IP filtering, in the partial that loads the tag:

{{-- resources/views/partials/analytics.blade.php --}}
@production
    <script>
        gtag('config', @json(config('services.google_analytics.measurement_id')), {{ Js::from(
            auth()->user()?->is_staff ? ['traffic_type' => 'internal'] : (object) []
        ) }});
    </script>
@endproduction

The block assumes that gtag.js has already been loaded and that users have an is_staff column; adapt the condition to how you manage roles. The @production directive already prevents any collection from local and staging environments.

Staging and test environments

The simplest approach is not to load the production tag outside production: a condition on the environment in the code, or an empty environment variable. If staging needs to be measured, use a separate GA4 property or Matomo site. Regularly check the “Hostname” dimension in GA4: an unexpected hostname (staging.example.com, localhost) reveals a leak.

Maintain the exclusion

Review the list twice a year and whenever you change internet provider, office, VPN or agency. Record the filter's activation date in the tracking plan: comparisons with the previous period must take it into account.

Common mistakes

  • Activating the filter straight away without going through the Testing state: a rule that is too broad (a CIDR range covering an entire carrier) permanently deletes real visitors.
  • Forgetting IPv6: many office and mobile connections go out over IPv6, and an IPv4-only rule does not catch them.
  • Excluding the IP of a coworking space or public Wi-Fi shared with potential customers.
  • Believing that defining internal traffic is enough: without an active filter, visits are only flagged.
  • Letting staging send data to the production property.
  • Forgetting the agency that tests forms and creates fake conversions every week.
  • Never reviewing the address list, even though providers' IPs change.

Frequently asked questions

Should you exclude internal traffic on a small site?

Yes, a small site is where the effect is strongest. When the site receives few visits, a handful of employees who look at it every day and test the forms are enough to distort the conversion rate and the most viewed pages. On a very large site, internal traffic weighs little in visits, but at least exclude test conversions.

Is the GA4 internal traffic filter retroactive?

No. GA4 data filters only apply to data received after they are activated and have no effect on history. Conversely, once the filter is active, excluded data is permanently deleted and will never be available, neither in reports nor in BigQuery. So always test the filter in the Testing state before activating it.

How do you exclude internal traffic when employees work remotely?

An IP address rule does not work for home or mobile connections whose IP changes. Have an internal, non-indexed page set a cookie, then have the tag add the traffic_type parameter when that cookie is present, with gtag.js or a Tag Manager variable. In Matomo, each person can set the exclusion cookie from their personal settings.

How do I find my office's IP address to exclude it?

From a computer connected to the office network, type “what is my IP address” into a search engine: it shows the public address, sometimes in both IPv4 and IPv6. Repeat while connected to the VPN if the company uses one. Ask your internet provider whether the address is fixed; an address that changes makes the rule useless within a few days.

Updated on

Topic checklist (PDF)

And now?

In the “Tracking and analytics setup” topic

  1. Set up Google Search Console
  2. Verify the domain property via DNS
  3. Set up Bing Webmaster Tools
  4. Set up GA4, Matomo or an equivalent
  5. Set up Google Tag Manager if needed
  6. Check data collection
  7. Handle applicable consent requirements
  8. Track conversions, forms and quote requests
  9. Track phone and email clicks
  10. Track downloads and sign-ups
  11. Track purchases
  12. Set up cross-domain tracking if needed
  13. Fix duplicate conversions
  14. Exclude internal traffic if relevant
  15. Identify organic and AI landing pages
  16. Create a dedicated channel for AI traffic
  17. Identify ChatGPT, Perplexity, Gemini, Copilot and Claude referrers
  18. Use available UTM parameters
  19. Connect analytics to the CRM if relevant
  20. Measure lead quality and revenue
  21. Document the limits of attribution
  22. Set up Consent Mode v2 if you use Google tags