I would like to put a hard cap on the number of monthly session replays I record. I need more than the percentage limit. Is there a way to do this? As long as I have a way to determine the currently monthly total number of session replays recorded, then I can code the rest.
Hi Josh C., 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
I'm sorry, but the knowledge sources do not mention a built-in way in Mixpanel to set a hard cap on the number of monthly session replays recorded. The available configuration options only allow you to set a sampling percentage (e.g., record_sessions_percent
), not an absolute cap on the number of replays per month. However, you can estimate the number of replays by monitoring the number of Session Start events, which can serve as a proxy for the number of potential replays generated. This allows you to adjust your sampling rate, but it does not provide a direct mechanism to enforce a hard cap. There is no documented method to programmatically retrieve the current monthly total of session replays recorded via the SDK or API, which would be necessary for implementing your own cap logic in code. If you need more precise control, you may need to monitor replay counts manually through Mixpanel reports and adjust your sampling or recording logic accordingly, but this would not be a real-time or automated hard cap solution Session Replay FAQ Session Replay Android FAQ.If this is a critical requirement, I recommend reaching out to Mixpanel support or your account manager to discuss your use case and see if there are any workarounds or upcoming features that could help.
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.
Let me check the knowledge base for you again. One moment! 📚
If you manually start a recording session using the Mixpanel SDK, the recording will automatically stop in the following scenarios: - The user leaves your website or app. - The user is inactive for more than 30 minutes (the default idle timeout). - You explicitly call the method to stop the session recording.If the user navigates to a different page within your site, the behavior depends on whether your implementation reloads the JavaScript context. In typical single-page applications (SPAs), the recording may persist across page changes. However, if the page reloads and the JavaScript context is reset, the recording will stop unless you re-initialize and restart it.To summarize: manual recording will not persist if the user leaves the site or the app, or if the session times out due to inactivity. For restricted areas, you can programmatically stop and restart recording as needed Session Replay Privacy Controls Implement Session Replay (Web).
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.
Let me check the knowledge base for you again. One moment! 📚
Your plan aligns well with the capabilities described in the Mixpanel documentation. Here’s what the knowledge sources confirm: - Sampling Limit: Mixpanel’s built-in sampling (record_sessions_percent
) allows you to set a percentage of sessions to record, and you can set this as low as you like (e.g., 1% = 1 out of 100 sessions). However, there is no mention of a lower bound below 1% or support for an absolute number cap. The documentation recommends starting with a low sampling rate and adjusting as needed, but acknowledges that this approach may not be reliable for fluctuating traffic, as you noted Implement Session Replay (Web) Session Replay FAQ.- Manual Control: You can programmatically start and stop session recording using methods like mixpanel.start_session_recording()
and mixpanel.stop_session_recording()
. This allows you to implement your own logic for when to record sessions, such as using a variable generated server-side to randomly select ~150 visits per day and only start recording for those users Manual Capture.- Frontend Logic: Your approach to have the frontend read a variable (e.g., from your backend or a feature flag service) to decide whether to start a session replay is supported by the SDK’s manual capture methods.Summary:
Your plan to implement a custom rate-limiting mechanism by randomly selecting a set number of users per day and manually starting session replay for them is feasible and aligns with Mixpanel’s documented capabilities. The built-in percentage-based sampling is not precise enough for your needs, especially with fluctuating traffic, so your approach is a good workaround.If you need to ensure you never exceed a hard cap, you’ll need to manage the selection and tracking logic outside of Mixpanel, as there is no built-in absolute cap or real-time replay count API in Mixpanel.Let me know if you need example code or further details on implementing this logic!
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.
Let me check the knowledge base for you again. One moment! 📚
If your web app is a traditional multi-page application (where navigating to a different page causes a full page reload), the recording session will stop when the user leaves the current page. This is because the Mixpanel Session Replay SDK will be unloaded, and recording will not persist across page loads unless you re-initialize and restart the recording on the new page.If your app is a single-page application (SPA) where navigation does not reload the page (i.e., it uses client-side routing), the recording session can persist across page changes, as the JavaScript context remains active.The documentation states:
"Session Replay runs on your website/app until either: - The user leaves your website/app - The user is inactive for more than 30 minutes - You call manually stop a session recording using an SDK method."
Session Replay Privacy ControlsSo, in a multi-page app with full reloads, the session replay will stop when the user navigates to a new page. You would need to re-initialize and start recording again on each new page if you want continuous coverage.
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.