Question

How Can I Implement Mixpanel on a Website Built Using WordPress?

  • 9 February 2021
  • 5 replies
  • 26 views

I am trying to figure out how I can add MixPanel code on every single page on my WordPress website. To help in doing this, I am really trying to figure out the file structure for my WordPress website (and WordPress websites in general) so I can locate the HTML/CSS pages for each page in order to add the MixPanel code. 

Any guides or tutorials in this regard which can help in achieving this would be greatly appreciated. 

P.S: I am not just talking about the generic adding of a snippet of code to the the <head></head> section - as done with Google Analytics code - as can be done under Appearance>>Theme Editor in the WordPress backend. 


5 replies

Badge +1

@tobi123 the correct answer is dependent on many factors outside of Mixpanel:

  1. What theme are you using?
  2. Are you working inside a Child Theme (this is something you should 100% do)
  3. Have you research plugins to help with WordPress + Mixpanel?

You will need to add some code to the head of your site, as you alluded to above. 

A good place to start is with a Google search for “mixpanel installation on wordpress” and see which method is easiest to follow.

Implement Mixpanel on Wordpress, Shopify, PrestaShop & Google Sites
https://help.mixpanel.com/hc/en-us/articles/115004546843-Implement-Mixpanel-on-Wordpress-Shopify-PrestaShop-Google-Sites

Any WordPress plugin for mixpanel?
https://community.mixpanel.com/sending-data-to-mixpanel-11/any-wordpress-plugin-for-mixpanel-761

I am on the same path as you, and trying to figure this out as well. My struggles are in the javascript needed to capture the events I have defined.

A step 1 to 100 guide is what I am working on, but it is not a top priority at the moment for me personally, but if you want to expand on that here, it could help someone in the future.

Badge +1

The showstopper for me, as a non backend engineer (for a few years now) is step 1 in Mixpanel’s docs. These steps will be a blocker for most WordPress site owners. This is something that can be done, it is not too difficult, but it will take more hours or reading and learning before you can complete Step 1.
 

 

Badge +1

@tobi123 another way to go about this is to look into implementing Mixpanel with Google Tag Manager (GTM), but GTM is hardly easy to use and figure out either, but it is worth a look.

Implementing Mixpanel with Google Tag Manager
https://help.mixpanel.com/hc/en-us/articles/360001355166-Implementing-Mixpanel-with-Google-Tag-Manager
 

Community Tip: Implementing Mixpanel via Google Tag Manager
https://mixpanel.com/blog/community-tip-implementing-mixpanel-via-google-tag-manager/
 

@jyoung thanks for the reply. 

 

I already went through some of the guides which you posted. 

I use the Oxygen Theme for my WordPress website and from what I understand, when using the Oxygen Theme, there is no need for a child theme (https://oxygenapp.com/user-guide/no-child-themes/). 

 

Yes, I have done research into Mixpanel plugins and from what I understand, the versatility and what can be done with MixPanel is much more limited, as compared to when a developer puts MixPanel code on every single MixPanel page. 

 

I also know how to put MixPanel code into the <head></head> section of WordPress website. But I am not sure about the quality to data which would be obtained. From what I understand, it would be no better than say putting Google Analytics on a web page and that defeats the whole point of using MixPanel to begin with. 

 

I never  knew about using Google Tag Manager, this is something I would definitely look into! 

 

Also, if you are interested in hoping on a Zoom call or something, let me know so that we can fix and day and time. 

 

Cheers, 

Tobi

Badge +1

Oxygen and Divi are very similar where they say that you don’t need a child theme, but I would 100% still use one to ensure any deeper customizations to functions.php, etc. can be isolated.

This is what I suggest:

  1. Install Bitnami to run WordPress locally where mistakes can be made and deleted without risk
    1. https://bitnami.com/stack/wordpress/installer
  2. Use the default WordPress 2021 theme since what works here should work in any theme.
  3. Set up Mixpanel to track a simple click event, such as when a user clicks on the Blog link.
    1. This is where things are not as easy as they should be, there is not guide for a non-technical person, step-by-step, that are easy to follow.
    2. If we could figure out how to track an event, user and super property for a simple link click, that would provide the foundation for all other tracking.

 

 

Reply


Mixpanel