What would be the best way to filter page views between the main domain and subdomains
Hi jtw, 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
To filter page views between the main domain and subdomains in Mixpanel, you can use the "Initial Referring Domain" property. This property is automatically tracked by Mixpanel's JavaScript library and can be used to distinguish between different domains and subdomains.Here's how you can approach this:1. Track page views: Ensure you're tracking page views as events. You can do this by setting track_pageview: true
in the mixpanel.init()
call, as mentioned in the Install Mixpanel FAQ.2. Use the "Initial Referring Domain" property: This property is automatically tracked and stored in the Mixpanel cookie when a user first visits your site. It will not change on future site visits as long as the cookie is not cleared, as explained in the Traffic Attribution documentation.3. Create a filter in your Mixpanel reports: When analyzing your page view data, you can create a filter based on the "Initial Referring Domain" property. This will allow you to separate page views from your main domain and various subdomains.4. Consider cross-subdomain tracking: By default, Mixpanel's cookie works across subdomains. However, if you're using hosted subdomains that don't allow cross-subdomain cookies, you might need to adjust your configuration. As mentioned in the Mixpanel Cookie documentation, you can disable cross-subdomain cookies by setting the cross_subdomain_cookie
configuration option to false
.Remember that if you're using server-side tracking, you'll need to implement page view tracking manually. In this case, you should track different pages as an event property rather than as different events for better analysis, as suggested in the Server-Side Best Practices.By following these steps, you should be able to effectively filter and analyze page views between your main domain and subdomains in Mixpanel.
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.