---
title: "3 Best Mixpanel WordPress Integration Methods"
description: "Mixpanel is a powerful, on-site web analytics application focused on complex event tracking and A/B testing for deep user behavior analysis. Externally hosted on Mixpanel.com, the analytics toolkit..."
url: https://www.inmotionhosting.com/support/edu/wordpress/plugins/mixpanel/
date: 2020-12-24
modified: 2022-11-30
author: "InMotion Hosting Contributor"
categories: ["WordPress Plugins"]
type: post
lang: en
---

# 3 Best Mixpanel WordPress Integration Methods

[**Mixpanel**](https://mixpanel.com) is a powerful, on-site [web analytics application](https://www.inmotionhosting.com/support/website/analytics/choose-the-best-analytics-tool/) focused on complex event tracking and A/B testing for deep user behavior analysis. Externally hosted on Mixpanel.com, the analytics toolkit can produce in-depth dashboards and experiments based on what users do in webpages, [contact forms](https://www.inmotionhosting.com/support/edu/wordpress/how-to-use-contact-form-7-to-add-a-form/), and other interactive website elements. This will help you improve customer retention and digital product engagement for up-selling opportunities.

Many digital product marketing experts debate whether it’s a better option or worthy [alternative to Google Analytics](https://mixpanel.com/compare-to/google-analytics/#). Mixpanel is a strong choice if **user segmentation** and activity, rather than just where users are coming from, is the core need from your analytics application. Others argue that organizations should use both for their differing strengths for a full-fledged **product analytics stack**.

What’s less debatable is that business owners using a content management system (CMS) such as [WordP](https://www.inmotionhosting.com/support/edu/wordpress/)ress and PrestaShop want a straightforward method for integrating Mixpanel without sacrificing the ongoing task that is [cybersecurity](https://www.inmotionhosting.com/support/security/why-security-is-important-for-small-businesses/).

Below we’ll cover how to:

- [Integrate Mixpanel in WordPress with a Plugin](#plugin)
  - [Premium Mixpanel Plugin for WooCommerce](#woo)
  - [Mixpanel Plugin for WordPress](#old)
- [Integrate Mixpanel in WordPress with the JavaScript API](#java)
  - [Hacking MixPanel for Mixpanel](#hack)
  - [Using the Insert Headers and Footers Plugin](#insert)
- [View Basic Analytics in Mixpanel](#mix)

Improve the performance and security of your WordPress website with our [WordPress VPS Hosting](https://www.inmotionhosting.com/vps-hosting/wordpress?mktgp=t&irgwc=1&affiliates=5001860&utm_campaign=Jumbotron&utm_source=supportcenter&utm_medium=cta&utm_term=wp-hosting-performance) plans. Featuring blazing fast servers with advanced caching, 99.99% uptime, and a robust toolkit developed by WordPress experts.

![check mark](https://design.inmotionhosting.com/assets/legacy/images/check.svg)Improve Core Web Vitals ![check mark](https://design.inmotionhosting.com/assets/legacy/images/check.svg)Free SSL & Dedicated IP ![check mark](https://design.inmotionhosting.com/assets/legacy/images/check.svg)Advanced Server Caching ![check mark](https://design.inmotionhosting.com/assets/legacy/images/check.svg)US & EU Data Centers

[VPS for WordPress](https://www.inmotionhosting.com/vps-hosting/wordpress?mktgp=t&irgwc=1&affiliates=5001860&utm_campaign=Jumbotron&utm_source=supportcenter&utm_medium=cta&utm_term=wp-hosting-performance)

## Integrate Mixpanel in WordPress with a Plugin

There are a few [WordPress plugins for Mixpanel](https://wordpress.org/plugins/tags/mixpanel/) integration. We’ll discuss the pros and cons of the two most popular ones.

### Premium Mixpanel Plugin for WooCommerce

There’s a [paid **Mixpanel WooCommerce plugin**](https://woocommerce.com/products/mixpanel/) by Skyverge for those willing to pay for complex analytics management within your WordPress dashboard. Once you add your [Mixpanel token ID](https://help.mixpanel.com/hc/en-us/articles/115004490503-Project-Settings) in the plugin settings, your [WooCommerce Mixpanel integration](https://docs.woocommerce.com/document/mixpanel/) is squared away.

However, this option won’t satisfy WordPress users who are:

- Using a different [eCommerce plugin](https://www.inmotionhosting.com/support/product-guides/wordpress-hosting/ecommerce-plugins/) other than [WooCommerce](https://www.inmotionhosting.com/support/edu/wordpress/woocommerce/)
- Not wanting to pay for a premium WordPress plugin
- Content with only viewing analytics in an external dashboard (Mixpanel.com in this case)

### MixPanel Plugin for WordPress

Some users may resort to using the outdated[ **MixPanel WordPress plugin**](https://wordpress.org/plugins/mixpanel-integration/) by Jitta Raghavender Rao, if they don’t give up on using Mixpanel entirely. It’s really easy to use: 

[![MixPanel plugin settings](https://www.inmotionhosting.com/support/wp-content/uploads/2020/12/wordpress-mixpanel-settings-300x243.png)](https://www.inmotionhosting.com/support/wp-content/uploads/2020/12/wordpress-mixpanel-settings.png)

1. [Install the WordPress plugin](https://www.inmotionhosting.com/support/edu/wordpress/plugins/install-wordpress-plugins/).
2. In the WordPress dashboard, go to *Settings > Mixpanel Options.*
3. Type your [Mixpanel token ID](https://help.mixpanel.com/hc/en-us/articles/115004490503-Project-Settings), “false”, and “false” again (unless you have subdomains under the site).
4. Click **Save Changes**.

But again, the issue is that the plugin is *outdated*. It hasn’t been updated* in over six years*. This is a major security risk as many [**cyber attacks**](https://www.inmotionhosting.com/support/website/i-think-my-website-has-been-hacked/) result from exploited known vulnerabilities in outdated, abandoned software. It doesn’t matter how much work you may have done to [harden your VPS](https://www.inmotionhosting.com/support/product-guides/vps-hosting/ways-to-harden-your-vps-hosting/) or [unmanaged server](https://www.inmotionhosting.com/support/product-guides/cloud-server/secure-cloud-server-hosting/), how strict your web application firewall (WAF) is, or what [antivirus (AV) software](https://www.inmotionhosting.com/support/security/clamav-or-imunifyav/) you have running regularly with a fancy [cr](https://www.inmotionhosting.com/support/edu/cpanel/how-to-run-a-cron-job/)on job. You would become an easier target for cyber criminals.

That brings us to the recommended method of integrating Mixpanel in WordPress websites.

## Integrate Mixpanel in WordPress with the JavaScript API

Mixpanel warns that using the [JavaScript** **application programming interface (API)](https://help.mixpanel.com/hc/en-us/articles/115004546843-Implement-Mixpanel-on-Wordpress-Shopify-PrestaShop-Google-Sites) is the best way to get the most out of Mixpanel as other integration methods restrict your capabilities. This is because of the sheer amount of customization possible with Mixpanel JavaScript calls, how you code your website, and how you want to track what and where.

Still, that shouldn’t be too surprising. Google Analytics plugins don’t allow you to do *everything* in WordPress as you can in the external dashboard. There is, for example, a [Matomo WordPress plugin](https://www.inmotionhosting.com/support/edu/wordpress/plugins/matomo-analytics/) that houses most features from the standalone web application. But that’s a fully developed analytics suite within the plugin, not an *integration* to an external web app.

Regardless, what if you don’t care for an analytics *suite* in your dashboard? What if you’re simply **testing Mixpanel against Google Analytics** or other options to determine what’s best for your needs? Only being able to manipulate log analysis in an external website might be enough for you to get a decent feel on the user experience (UX) of Mixpanel’s capabilities.

### Hacking MixPanel for Mixpanel

If you read the [MixPanel plugin](https://wordpress.org/plugins/mixpanel-integration/) description, you’ll see the following statement:

> You no longer need to add the mixpanel.track() javascript snippet in your theme files.

This made me wonder: *what is that full *[*mixpanel.track code*](https://developer.mixpanel.com/docs/javascript-full-api-reference#mixpaneltrack)* and where exactly does it go?* So I *begrudgingly* installed and configured the outdated MixPanel plugin. Then I searched for the Mixpanel script with the [Firefox HTML inspector](https://developer.mozilla.org/en-US/docs/Tools/Page_Inspector/How_to/Open_the_Inspector). After finding the plugin’s default Javascript code in the `<body>` section, I wondered what’s a better way to insert the simple tracking code into WordPress. This led me to use the [**Insert Headers and Footers** plugin](https://www.inmotionhosting.com/support/edu/wordpress/add-schemas-insert-headers-and-footers-wordpress-plugin/) which eases the ability to add schema markup for search engine optimization (SEO).

*It worked!*

Now, is it a little dank? **Yes**.

Are there better ways to accomplish this? **Most likely**. This method still requires installing another plugin. You could edit your functions.php file instead. Issues might arise which affect your theme or other plugins, though.

Is it worth a shot? **Yeah**, it’s better than hoping your website isn’t infiltrated because of a years-old plugin.

Will it break the website? **It should not**. But if you’re using [Content-Security-Policy (CSP)](https://www.inmotionhosting.com/support/edu/wordpress/plugins/http-headers-security/), you may need to add `https://*.mixpanel.com/*` to your CSP header. Otherwise, the script won’t load in browsers to track user input.

### Using the Insert Headers and Footers Plugin

1. [Log into your WordPress dashboard](https://www.inmotionhosting.com/support/edu/wordpress/logging-into-wordpress-dashboard/).
2. [Install the **Insert Headers and Footers** plugin](https://www.inmotionhosting.com/support/edu/wordpress/plugins/install-wordpress-plugins/).
3. [![Mixpanel HTML code snippet](https://www.inmotionhosting.com/support/wp-content/uploads/2020/12/mixpanel-javascript-sdk-1024x803.png)](https://www.inmotionhosting.com/support/wp-content/uploads/2020/12/mixpanel-javascript-sdk.png)Create an account at [Mixpanel.com](https://mixpanel.com).
4. On the *Set up Mixpanel* page, under *Install Library (SDK)*, copy the HTML snippet.
5. In your WordPress dashboard, select *Settings*, then **Insert Headers and Footers**.
6. Paste the Mixpanel HTML snippet into the *Scripts in Header* section.
7. [![Mixpanel scripts in Insert Headers and Footers plugin](https://www.inmotionhosting.com/support/wp-content/uploads/2020/12/wordpress-mixpanel-scripts.png)](https://www.inmotionhosting.com/support/wp-content/uploads/2020/12/wordpress-mixpanel-scripts.png)The code below is from the [MixPanel plugin](https://wordpress.org/plugins/mixpanel-integration/). As stated earlier, this option is easier than editing your WordPress files. But this tracking code will only gather page views. You’ll need to research [official Mixpanel documentation](https://developer.mixpanel.com/docs/javascript-full-api-reference#mixpaneltrack) or contact a developer to produce an in-depth tracking solution. Add the following JavaScript code in the plugin *Scripts in Body*** **section: <script>mixpanel.track("Viewed Page", {'Page Name': document.title, 'Page URL': window.location.pathname});</script>
8. At the bottom, select **Save**.
9. View a couple of your WordPress site pages in a [private browsing session](https://www.inmotionhosting.com/support/resources/how-to-start-a-private-browsing-session/).
10. On the bottom of your Mixpanel setup page, beside *Check for Incoming Data*, select **Check**.
11. You should see “*We successfully received your data!*” Select **Start Using Mixpanel**.

## View Basic Analytics in Mixpanel

At this point, you can create a Mixpanel dashboard to compile the information you want to focus on. To quickly see results, though, use the Insights tool.

1. At the top, select **Analysis** > **Insights**.
2. Select **Your Top Events**, then **Viewed Page**.
3. Under *Breakdowns*, select **+ Add**.
4. Select **Page Name**. From here, you can add additional filters and chart changes to fit your needs.

![Mixpanel Insights Report](https://www.inmotionhosting.com/support/wp-content/uploads/2020/12/mixpanel-insights-1-1024x709.png)

Still have questions about integrating Mixpanel with [WordPress](https://www.inmotionhosting.com/support/edu/wordpress/)? Know a better way? Let us know in the comments below.
