Quick summary
Installing Mixpanel via a vanilla JavaScript snippet is the fastest way to start tracking user behavior on any webpage. This guide walks through locating the snippet in the Mixpanel docs, adding it to your HTML, and initializing page view tracking with your Project Token.
Steps
- Mixpanel supports multiple installation methods depending on your technology stack — this demo covers the simplest approach: a vanilla JavaScript installation. Visit the Mixpanel docs for in-depth guides on other methods.
- Open the Mixpanel docs and navigate to the Quickstart section. Under Code, select JavaScript to reveal the available code snippets.
- Copy the code snippet from the code block by using the small copy button or selecting the code directly.
- Paste the snippet into your webpage's HTML before the closing </head> tag to ensure Mixpanel loads on every page.
- Inside Mixpanel, go to Project Settings Overview under Access Keys to retrieve your unique Project Token.
- Within the same head tag, initialize Mixpanel and enable page view tracking by adding mixpanel.init('PROJECT_TOKEN', {track_pageview: true}); inside a script tag, then save your changes.
- Mixpanel is now fully installed and tracking your project. Visit the Mixpanel dashboard to view live statistics and confirm data is flowing in.
.gif)



