kapa.ai I track pageviews via the front-end javascript library but purchases via the node library. I pass a device ID with both to join these events, however when I'm looking at attribution for these purchases, the attributed channel is "referral" for every order, why might this be?
Please stand by Matthew M. as I search the knowledge base. I normally take about 15 seconds or so. 👋
Feel free to ask a follow-up question once I've answered by mentioning me with @kapa.ai
Based on the knowledge sources, the issue likely stems from how attribution properties (such as UTM parameters and referrer information) are being handled between your front-end (JavaScript) and back-end (Node.js) tracking.Key points:What you should do:Summary:
The reason all your purchases are attributed to "referral" is likely because the purchase events sent from your backend do not include the original UTM/referrer properties. You need to explicitly pass these properties with your server-side events to enable accurate attribution in Mixpanel. Passing only the device ID is not sufficient for attribution purposes.
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.
kapa.ai this doesn't make sense I'm afraid. After someone lands, subsequent pageviews wouldn't include UTM properties, so how would it work in a purely front-end JS scenario?
Let me check the knowledge base for you again. One moment! 📚
Great question! In a purely front-end JavaScript scenario, Mixpanel handles this by persisting UTM parameters as "super properties." Here’s how it works: - When a user first lands on your site with UTM parameters in the URL, the Mixpanel JS SDK automatically captures these UTM parameters and sets them as super properties. Super properties are automatically included with every subsequent event tracked from the client-side SDK, even if the UTM parameters are not present in the URL on later pageviews or actions. This means that even if a user navigates to other pages (where the UTM parameters are no longer in the URL), the original UTM values are still attached to all events, including conversions like purchases, as long as those events are tracked from the front-end (Web Attribution, Super Properties).- Additionally, the first-seen UTM parameters are stored as user profile properties prefixed with initial_ (e.g., initial_utm_source). These represent first-touch attribution and persist on the user profile for future reference (FAQs: Sending Data to Mixpanel).- By default, UTM parameters are persisted in a last-touch manner as super properties. This means if a new UTM parameter is detected on a subsequent page load, it will update the super property for future events. If not, the original value remains (Web Attribution).So, in a front-end-only scenario, attribution works because the SDK ensures UTM parameters are automatically included with all relevant events, even after the initial landing.Key difference with your setup: When you send purchase events from the backend (Node.js), the backend does not have access to the browser’s super properties or cookies, so you must manually pass the UTM/referrer data to the backend and include it in the event. Otherwise, attribution will not work as expected (Server-Side Attribution).If you have further questions about how to bridge this gap between front-end and back-end, let me know!
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.
kapa.ai is there a way I can carry these UTM properties across a users journey on our site to purchase? I don't want to have to store UTM values in a database for the majority of users who won't convert
Let me check the knowledge base for you again. One moment! 📚
Yes, in a purely front-end JavaScript implementation, you do not need to store UTM values in your own database to persist them across a user's journey. The Mixpanel JavaScript SDK automatically handles this for you using super properties: - When a user lands on your site with UTM parameters, the SDK captures and stores them as super properties in a cookie or local storage. - These super properties are then automatically included with every subsequent event tracked from the client-side, even if the UTM parameters are no longer present in the URL on later pages or actions. - This means that if a user eventually makes a purchase (and you track that purchase from the front-end), the original UTM values will be included on the purchase event, enabling accurate attribution—no need for you to store UTM values yourself.> "Super properties are global event properties that you define once and apply to all events... Your super properties are stored in the cookie generated by the domain that is loading the library. They will persist for the life of that cookie, which by default is 365 days." Setting Super Properties> "Mixpanel’s Javascript library tracks all UTM tags by default... UTM parameters are by default persisted across events as Super Properties." Web AttributionIf you are tracking purchases from the backend, you would need to pass these UTM values from the client to the server at the time of purchase, since the backend does not have access to the browser's super properties or cookies. But for a front-end only flow, Mixpanel's SDK handles this persistence for you automatically.
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.
kapa.ai whats the name of the cookie that these super properties are stored in?
Let me check the knowledge base for you again. One moment! 📚
I'm sorry, but the knowledge sources provided do not specify the exact name of the cookie where Mixpanel stores super properties. The documentation confirms that super properties are stored in a cookie generated by the domain that loads the library, but it does not mention the cookie's name Setting Super Properties.
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.
