how to remove bot traffic from my Mixpanel reports?
Hi Luisa S., Please stand by as I search the Mixpanel knowledge base for an AI-powered answer. I normally take about 15 seconds or so. In case AI cannot answer your question, feel free to reach out to Mixpanel support at mixpanel.com/get-support. If you have follow-up questions for this thread, please tag me again with your question: @kapa.ai <follow-up question> 👋
Feel free to ask a follow-up question once I've answered by mentioning me with @kapa.ai
You can’t fully “delete” historical bot data from Mixpanel, but you can both prevent new bot events from being ingested and filter/hide existing bot traffic so it doesn’t affect reports.
1. Block bot traffic going forward (JavaScript SDK)
Mixpanel’s JS SDK already filters some major crawlers (Googlebot, Bing, etc.).[Bot traffic] For other bots, you can set the special $ignore super property to stop their events from being ingested:
1. Detect bots via navigator.userAgent.
2. If it matches your bot pattern, register $ignore: true.
Example from the docs (blocking user agents containing Mozilla/4.0):
``` js var userAgentBotTest = navigator.userAgent; mixpanel.register({"User Agent": userAgentBotTest}); if (/(Mozilla/4.0)/i.test(userAgentBotTest)) { mixpanel.register({"$ignore": true}); }
LBKSAny events sent while `$ignore` is `true` will be dropped and won’t appear in reports.[[Bot traffic](https://docs.mixpanel.com/docs/tracking-best-practices/bot-traffic)]
You can adapt the regex to your own bot patterns (e.g., specific frameworks, headless browsers, etc.). The docs note that `$ignore` must be `true` or a non-empty string to work.[[Bot traffic](https://docs.mixpanel.com/docs/tracking-best-practices/bot-traffic)]
---
2. Handle historical bot traffic
Events already ingested are immutable, but you can exclude them from analysis:
- If you can identify bot events by a property (e.g. user agent, device, location), create a Custom Event that includes only non-bot traffic (or explicitly excludes the bot pattern). Then use that custom event in reports instead of the raw event.[Bot traffic] - Optionally hide the original noisy event in Lexicon so it doesn’t clutter dropdowns; hidden events are excluded from “All Events” and most report flows, but still ingested.[Hiding data]
If the bot incident is severe and clearly scoped (e.g., a spike over a short time window), you can also consider Data Deletion with filters (event + time range + properties) to permanently remove those events, but this is irreversible and should be used only for well-identified problematic data.[Data clean-up]
kapa.ai is still learning and improving, please let me know how I did by reacting below.
ℹ️ Tip: Mention @kapa.ai in the thread for follow-ups or DM the app for 1-to-1 help.
