Is it possible to add a super property eg "journey status" as part of the page load events stored in a global component? kapa.ai
Yes, it's possible to add a super property like "journey status" to page load events using Mixpanel's super properties functionality. Super properties are global event properties that you define once and they're automatically included with all tracked events, including page load events.Super properties are stored in local storage (like cookies or localStorage in browsers, or device storage in mobile apps) and persist between sessions. This makes them ideal for tracking user journey status across different pages.Here's how you can implement this:
Web Implementation (JavaScript)
mixpanel.register({
"journey_status": "onboarding"
});LBKS// When tracking page views, this super property will be included automatically
mixpanel.track("Page View");LBKS```LBKSLBKSYou can set this in a global component that loads early in your application lifecycle. For example, if you're using automatic page view tracking, you can set the super property before initializing Mixpanel: LBKSLBKS```LBKS// Set super properties first
mixpanel.register({
"journey_status": "onboarding"
});LBKS// Then enable automatic page view tracking
mixpanel.set_config({ track_pageview: true });LBKS```LBKSLBKSWhen the user progresses in their journey, you can update the super property: LBKSLBKS```LBKS// Update the journey status when user completes onboarding
mixpanel.register({
"journey_status": "active_user"
});LBKS```LBKSLBKSSuper properties are particularly useful for this kind of global state that you want included with all events, as noted in Mixpanel's documentation on [setting super properties](https://docs.mixpanel.com/docs/tracking-methods/sdks/javascript#setting-super-properties).LBKSThe best practice is to use super properties for information you know about the user rather than about specific events - journey status is a perfect example of this use case, as mentioned in Mixpanel's [best practices for events](https://docs.mixpanel.com/docs/data-structure/events-and-properties#best-practices).
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.