How to Exclude Bot Traffic in GA4

GA4 Bot Traffic

Google Analytics 4 (GA4) excludes traffic from known bots and spiders by default. This traffic is identified using a combination of Google research and the International Spiders and Bots List, maintained by the Interactive Advertising Bureau

However, things can slip through the cracks and a GA4 property can still collect data from spam traffic. Here are additional actions you can take to exclude or filter out bot traffic in GA4.

  1. Block Specific IPs from Your Website

    If you have a WordPress website, you can install a security plugin such as WordFence to prevent malicious bots, spiders, or crawlers from accessing your site. This plugin also allows you to permanently block traffic from specific IPs or IP ranges if you continue to encounter malicious activity.

    IP Block

    Blocking traffic from specific IP addresses or ranges helps deter your GA4 property from collecting spam traffic. Once these IP addresses or ranges are blocked, they cannot access your website, meaning GA4 cannot collect and track data from this spam traffic. This helps your GA4 gather cleaner and more accurate data.

  2. Block Specific Countries or Regions from Your Website

    If you continue to receive malicious traffic from certain countries, you can block traffic from these regions using plugins or other website security features.

    Country IP Block

    Doing this further prevents GA4 from collecting spam data.

  3. Identify Bot or Spider Traffic in GA4 and Exclude Traffic From GA4 Reports

    If your GA4 inevitably collects spam data, which is completely normal and understandable, you can manually exclude this data in your GA4 reports.

    To do so, take the following steps:

    1. Go to the Traffic acquisition report

      GA4 Traffic Acquisition

    2. Select Session source / medium as the Dimension and Search for referral

      GA4 Referral Sources

    3. Select the Customize Report Pencil Icon and Add Filter

      GA4 Report Filter

    4. Create a Filter By Using Session source / medium as the Dimension, Match Type is does not contain, and enter a value of a spam referral source / medium website

      GA4 Referral Exclusion

You can apply this manual approach to as many spam referral websites as you find, ensuring your GA4 report shows data from real visitors as much as possible. While some spam may still slip through the cracks, this approach can significantly enhance the accuracy of your GA4 report.

If you have any additional questions about GA4, please feel free to contact us and our GA4 consultant will be happy to help!