Is there a way to manage the events that are Autocaptured?
Hi Idan D., 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
Yes, Mixpanel provides several ways to manage which events are Autocaptured:
- Custom Configuration: When initializing the Mixpanel Javascript SDK, you can customize which types of events are Autocaptured (e.g., clicks, inputs, pageviews, scrolls, form submissions) by adjusting the autocapture configuration options. For example, you can enable or disable specific event types or change how pageviews are tracked:
mixpanel.init('YOUR_PROJECT_TOKEN', {
autocapture: {
pageview: "full-url",
click: true,
input: true,
scroll: true,
submit: true,
capture_text_content: false,
},
});
[Docs: Javascript SDK Autocapture](https://docs.mixpanel.com/docs/tracking-methods/sdks/javascript#autocapture)
- Omitting Elements: You can exclude specific elements from being tracked by adding the .mp-no-track class to them, or mark them as sensitive with .mp-sensitive to prevent their inclusion in any tracking, including the $elements property of other events.
- Blocking by Selector or URL: Use the block_selectors option to block specific classes or elements, and block_url_regexes to block Autocapture on certain pages:
mixpanel.init('YOUR_PROJECT_TOKEN', {
autocapture: {
block_selectors: ['.class1', 'button.class2'],
block_url_regexes: [/\/login\/?$/, /\/payment\/?$/]
},
});
[Docs: Omitting Elements from Autocapture](https://docs.mixpanel.com/docs/tracking-methods/sdks/javascript#autocapture)
- Advanced Callbacks: You can provide custom functions with allow_element_callback or block_element_callback to programmatically determine which elements should or should not be tracked.
- Disabling Autocapture: You can disable Autocapture entirely by setting autocapture: false in your SDK configuration.
These options allow you to fine-tune what is collected, helping you focus on the most valuable data and maintain privacy compliance. For more details, see the Autocapture documentation.
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.
