If I want to enable session replay and use Segment events, do I need to enable device mode destination filters in segment?
Hi Bradley A., 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
Based on the knowledge sources, you can use Mixpanel Session Replay with Segment in either cloud mode or device mode, but there are specific implementation requirements.To use Session Replay with Segment, your app must have the Mixpanel Javascript SDK installed with Session Replay enabled, regardless of which mode you're using. The key requirement is that you need to connect your Segment data stream with Mixpanel's Session Replay using middleware.For Segment's Analytics.js, you would add middleware to ensure all event calls include session replay properties: LBKS// Middleware to add Mixpanel's session recording properties to Segment events analytics.addSourceMiddleware(({ payload, next, integrations }) => { if (payload.obj.type === 'track' || payload.obj.type === 'page') { if (window.mixpanel) { const segmentDeviceId = payload.obj.anonymousId; // ------------------------------------------- // Comment out one of the below mixpanel.register methods depending on your ID Management Version // Original ID Merge mixpanel.register({ $device_id: segmentDeviceId, distinct_id : segmentDeviceId }); // Simplified ID Merge mixpanel.register({ $device_id: segmentDeviceId, distinct_id : "$device:"+segmentDeviceId }); // ------------------------------------------- const sessionReplayProperties = mixpanel.get_session_recording_properties(); payload.obj.properties = { ...payload.obj.properties, ...sessionReplayProperties }; } } if (payload.obj.type === 'identify') { if (window.mixpanel) { const userId = payload.obj.userId; mixpanel.identify(userId); } } next(payload); });LBKS
According to the documentation, Session Replay works with CDPs like Segment, and as confirmed by Mixpanel's Senior Product Manager: "Absolutely, our Session Replay works with customers that ingest data using CDPs like Segment, mParticle, Rudderstack, and even Google Tag Manager" Session Replay Q&A with Mixpanel Senior Product Manager DJ Satoda.The implementation requires "one line of code in your SDK initialization to determine what percent of sessions you want to record" and "another short snippet of code that ties together your user identification and our SDK and your CDP's SDK" Session Replay Q&A with Mixpanel Senior Product Manager DJ Satoda.So while you don't specifically need to enable device mode destination filters, you do need to ensure proper integration between Segment and Mixpanel using the appropriate middleware code.
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.
Hey Bradley! I'm the PM for Mixpanel's session replay feature. Just wanted to jump in and confirm for you: for your event tracking, you can do either. The key for Segment is you just still need:
our SR SDK installed in your app
initialize it with their Mixpanel project token
identify with whatever value ends up being their Mixpanel distinct ID
Let me know if any questions 🙂