I have been trying to create a filter for excluding Duckduck Go and Baidu search engine Bot Traffic from Google Analytics 4 for one of my websites. I am unable to create a filter for it. Internal & developer traffic can be filtered in GA4. I have added the excluded referral list on GA4 but the traffic is still showing on GA4.

Could you please guide me on how to create and exclude a bot from GA4?

  • How are these search engines triggering GA4 traffic? I'm out of touch but I understood that GA4 tracking is embedded in javascript, which would not typically be run by these search engines.
    – davidgo
    Apr 24, 2023 at 23:33

2 Answers 2


I planned on doing the same so I created a GTM variable and blocking trigger that prevents Amazon and Screaming Frog runs from popping up and distort my GA4/Looker reports. So I created a GTM variable jsv-isBot:

function() {
  // Get the user agent string
  var userAgent = navigator.userAgent;

  // Check if the user agent contains any of the specified bot strings
  var isScreamingFrogBot = userAgent.indexOf('Screaming Frog') !== -1;

  // Return true if any of the bot strings is found, else return false
  return isAmazonBot || isScreamingFrogBot || isSemrushBot;

The blocking trigger fires on isBottraffic equals true and is blocking for the GA4 configuration tag.


No way to filter it out in an easy way.

One thing you could do is add GTM blocking rules that detect the bots and block the tags from firing for the bots.

I go more in-depth about advanced techniques in here: GA4 massive spam spikes from cities in different country

  • yes, it's actually pretty simple. Here this doc describes how to add trigger exceptions: support.google.com/tagmanager/answer/7679318?hl=en Your exceptions would be based on the bots user agents, so you will be blocking tags from firing when the users user agents would contain bot-specific user agents. Just look up the user agents of the bots you want to block.
    – BNazaruk
    Apr 30, 2023 at 15:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.