Mixpanel Integration with Ghost

Until the API and APP/Plugin Dev Process gets sorted out I have simply forked the Ghost project and implemented the feature I needed.

Download

You can pull the fork from my repo here: https://github.com/nottinhill/Ghost.

Make sure to edit core/server/controller/frontend.js with your Mixpanel token as described below.

Set your Mixpanel Token in Ghost

This fork of Ghost has Mixpanel Analytics integrated. In order to track page/post hits on your blog you need edit core/server/controller/frontend.js like so:

// Set your MixPanel Token Here
mixpanel    = Mixpanel.init('48acf5a5c39b81a6cd0fd66c6ea1a66c'),

In Mixpanel you can now access slugs aka the permalink. You could setup a custom event like this:

Mixpanel integration with Ghost Blog

In core/server/controller/frontend.js you could also conveniently let express.js send other parameters to Mixpanel as described at the Mixpanel Help Site.

You will need to do a npm install against the packages.json from my repo to pull mixpanel into ghost. In case you have no idea what this means just change directory into the pulled fork and do a:

$ npm install

Now you are good to go!

Further tracking

I will add FrontPage tracking as soon as I have the time. Until the you could simply track from inside the index.hbs like so:

<script type="text/javascript">mixpanel.track("FrontPage");<script>

In case you want to track your homepage like this until I hjave implemented the feature you should not forget to add the standart mixpanel script voodoo to your default.hbs. Here's a more recent screenshot of this technique, so far I am really happy about the possibilities and benefits over Google Analytics, which is much to cluttered and bloated in my taste.

MixPanel-With-Ghost-Image