Do I need to add the Mixpanel code to each page in Webflow or just in the project settings?

TL;DR
  • Add Mixpanel’s JavaScript code once in Webflow’s Project Settings under Custom Code to enable tracking on all pages.  
  • Publish your site for tracking to work, and use Webflow interactions or custom JavaScript for tracking specific events.

To integrate Mixpanel with your Webflow site, you only need to add the tracking code once in your Project Settings, not on each page.

1. Add Mixpanel Code in Project Settings

  • Go to Project Settings from your Webflow Dashboard.
  • Click the Custom Code tab.
  • In the Footer Code or Head Code section (as Mixpanel recommends), paste your Mixpanel JavaScript snippet.
  • This ensures the code loads on every page of your website, enabling site-wide tracking.

2. Publish Your Site

  • After inserting the script in the Project Settings, click Publish to push changes live.
  • Tracking will only work on published pages (not in preview mode).

3. Consider Page-Specific Events (if needed)

  • If you're tracking custom events or triggering events based on user interactions (like button clicks), you’ll need to:
  • Use Webflow's interactions or custom JavaScript embedded in specific pages or elements via Page Settings → Before </body> or via Custom Code blocks.
  • Mixpanel functions like mixpanel.track("Button Click") would go in those places.

Summary

Add the Mixpanel base tracking code once in Project Settings to enable site-wide functionality. Use page-specific code only for custom event tracking based on individual interactions.

Rate this answer

Other Webflow Questions