23 September 2012

Measure your blog performance : Mixpanel workaround fun

by manos_parzakonis

This is mostly a measure blog so I can safely presume that if you are bloggers yourself then you are measuring the performance of your efforts using a web analytics solution. In case you don’t then you are missing some exciting stuff going on with your online ramblings I can assure you…

Now, there is sufficient data to assume that you are using Google Analytics (Usage statistics and market share of Google Analytics for websites) but there are so many tools out there to have a look out for. I use more than one tools in this blog (none of which messes with your privacy however!). One alternative story is Mixpanel. I prefer Mixpanel when it comes to funnels plus you can define formulas making it really attracting. You can get some details from this Zippy Kid’s post. Now, how you can use it to your blog?

Install the basic code

As you may be familiar with, most analytics tools work with Javascript. Go to your project page and grab the code

Now paste this into your footer (footer.php located in the Appearance > Editor in case of a WordPress blog) and you will have tracking in all your pages. Let’s not confuse however that the reason we implementing Mixpanel tracking into our blog, site or whatever isn’t pageviews but events with attributes that are of interest to us.

Code for special events

I really want to have a segmentation based on the posts that visitor view on my blog prior to reaching specific goals that I have defined. Say that one goal is someone to go to my CV page, when he goes there I feel so much richer that I credit myself with 1,5Eur (this buys me a Cola in Greece)

We just used the most basic function of Mixpanel,


which is a mix of trackEvent and trackPageview that Google Analytics uses for his own tracking.  We can use it in plain to send a specific event to mixpanel but we can use it better in order to have more data at hand. So, say that I need to monitor the posts per Category and whether they supply code to readers. Then I can break this down to posts as well.

Make sure you tag all your posts in a consistent way. You can get organised with a document where you keep all your tracking codes so your can simply paste them over your new blog theme when time comes :).

Another interesting point to track is whether visitors that use your search box get results or not. Paste the following inside the section of SearchResults.php that defines that results are delivered. You will identify it by something like the following that essentially marks a code area that has post (aka results for the corresponding search query)

Now insert your Mixpanel tag

Of course you can assign a Value to this, in fact you should definetely do so…

Next go to the comments.php page and add a tag that fires an event when a comment is made and assign a value (I credit myself with 11Euros for each comment)

So, till now we managed to set Goals,Posts and Comments events assign value to each event, pass category and some Boolean data to Mixpanel. If I knew the first thing about php and Javascript I would definitely go the extra step and pass via WordPress functions the category & post title to automate further the script instead of hard coding the tracking code for each post.

tags: analytics - blog - events - mixpanel - pageviews - tracking - web