how to set event name in Mixpanel for page view or page load event
Hi B, 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 set the event name for page view or page load events in Mixpanel, you have a few options: 1. Use the default event name:
By default, when you enable automatic page view tracking, Mixpanel uses the event name $mp_web_page_view
. You can enable this by setting the track_pageview
option to true
when initializing Mixpanel: LBKSmixpanel.init('YOUR_PROJECT_TOKEN', { track_pageview: true });LBKS
2. Customize the event name:
If you want to use a custom event name for page views, you can manually track the page view event using the track()
method: LBKSmixpanel.track("Custom Page View Event Name", { "page": "Pricing" });LBKS
3. Use the track_pageview()
method:
You can also use the track_pageview()
method, which will use the default event name $mp_web_page_view
, but allow you to add custom properties: LBKSmixpanel.track_pageview({ "page": "Pricing" });LBKS
It's important to note that the default page view event includes properties such as page title, URL components, and marketing parameters automatically.For more detailed information on tracking page views in Mixpanel, you can refer to the Mixpanel JavaScript SDK documentation.
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.