Skip to main content

Bot detection

This server flow scores every incoming event for bot and AI-agent traffic before it reaches your destinations. The Express source forwards the request user agent, the bot transformer reads it, and a demo destination logs the annotated events. Nothing is dropped: scoring is annotation, and you filter downstream.

{
"version": 4,
"flows": {
  "default": {
    "config": {
      "platform": "server",
      "bundle": {
        "packages": {
          "@walkeros/collector": {},
          "@walkeros/server-source-express": {},
          "@walkeros/server-transformer-bot": {},
          "@walkeros/destination-demo": {}
        }
      }
    },
    "sources": {
      "express": {
        "package": "@walkeros/server-source-express",
        "config": {
          "settings": { "port": 8080 },
          "ingest": {
            "map": {
              "userAgent": { "key": "headers.user-agent" }
            }
          }
        }
      }
    },
    "transformers": {
      "bot": {
        "package": "@walkeros/server-transformer-bot"
      }
    },
    "destinations": {
      "console": {
        "package": "@walkeros/destination-demo",
        "config": {
          "settings": { "name": "Event Logger" }
        }
      }
    },
    "collector": { "run": true }
  }
}
}

Run it

Save the config as flow.json and push an event through the built flow with the destination mocked. Nothing is sent anywhere:

npx walkeros push flow.json -e '{"name":"page view"}' --simulate destination.console

You should see:

success: true
Duration: 42ms

What you get

Every event now carries user.botScore and user.agentScore (0-99, higher means more bot). In production the demo destination logs each annotated event; a request from GPTBot looks like this (from the transformer's examples):

[demo] {
"name": "page view",
"user": {
  "botScore": 95,
  "agentScore": 95
},
...
}

Offline runs have no user agent, so simulated events score the missing-UA baseline of 70. To act on the scores, add a mapping condition on your real destinations that drops or segments events where botScore exceeds 50. See Bot detection for the full filtering recipes.

Next steps

💡 Need implementation support?
elbwalker offers hands-on support: setup review, measurement planning, destination mapping, and live troubleshooting. Book a 2-hour session (€399)