RSS
 

CakePHP Iteration Tracking and Split Testing with MixPanel

29 Mar

When developing your business, online or offline, it’s important to test your ideas and objectively evaluate the results. Offline you can do this with order tracking, Microsoft Excel, customer surveys, etc., but online we have more sophisticated tools. This post will provide you with a definitive way to track iterations and split testing for any web or mobile application using MixPanel.

Why MixPanel?

After reviewing Google Analytics and MixPanel (I did not review KISSmetrics) I found MixPanel to be much more flexible. Google Analytics only allowed 5 custom variables, and, it was confusing as to how/when they would be set and how long they would stick. MixPanel provided an easy way for me to track customers, iterations, split tests, and then view the data by cohort.

How does it work?

Users will be assigned an iteration and split test when they visit your site for the first time. When you up the iteration number, the split test value will be chosen at random for the new iteration. We’ll use themes to show them different interfaces, and, we’ll use the CakePHP MixPanel plugin to track them (note: I’m not the original author of the plugin but I added new features and support for CakePHP 1.3. Kudos to Noahm for the original.)

1. Install the plugin

# CakePHP 1.3
git submodule add git@github.com:dkullmann/CakePHP-Mixpanel.git plugins/mixpanel
cd plugins/mixpanel
git checkout 1.3

# CakePHP 2.1
git submodule add git@github.com:dkullmann/CakePHP-Mixpanel.git Plugins/Mixpanel

2. Setup your config

# Sample from my config file which is environments.php:
'Iteration.iteration' => 1,
'Iteration.split_tests' => array('A', 'B'),
'Iteration.split_notes' => 'Different webinar pops',

3. Add the MixPanel code to your controller

By adding the following code to our AppController, we’ll have enabled iteration tracking, and, tagging users by their ID and name in MixPanel if they are authenticated.

# app_controller or AppController depending on your version of CakePHP
public $components = array('Mixpanel.mixpanel');
public function beforeFilter() {
    $this->_setupMixpanel();
    $this->_setupIteration();
}
protected function _setupMixpanel() {
    $user = $this->Auth->user();
    if (!empty($user)) {
        $this->Mixpanel->identify($user['User']['id']);
        $this->Mixpanel->name_tag($user['User']['username']);
    }
    if (Configure::read('debug')) {
         $this->Mixpanel->settings['properties']['test'] = 1;
    } else {
         $this->Mixpanel->settings['properties']['test'] = 0;
    }
}
protected function _setupIteration() {
    $iterationSettings = Configure::read('Iteration');
    if (empty($iterationSettings)) {
        return false;
    }
    $iterationCookie = $this->Cookie->read('Iteration');
    if (empty($iterationCookie) || $iterationCookie['iteration'] < $iterationSettings['iteration']) {
        $iterationCookie['iteration'] = $iterationSettings['iteration'];
        $iterationCookie['split_test'] = $iterationSettings['split_tests'][ rand(0, count($iterationSettings['split_tests']) - 1) ];
        $this->Cookie->write('Iteration', $iterationCookie);
    }
    $this->theme = 'SplitTest' . $iterationCookie['split_test'];
    $this->Mixpanel->register($iterationCookie);
}

4. Add the Mixpanel Helper

# in your app_controller/AppController
public $helpers = array('Mixpanel.mixpanel');
# In your layout
<!-- Mixpanel should go before $scripts_for_layout so you can add mpq/mixpanel events in scripts -->
<?php echo $this->Mixpanel->embed(); ?>
<?php echo $scripts_for_layout; ?>

5. Results

After you’ve setup your funnels in MixPanel it’s very easy to see which split test is winning, check out my MixPanel funnel here.

In addition, whenever you up the “iteration” value in your config the visitors will get assigned a new split test.

6. Gotchas!

The only caveat here is that if you call mpq / mixpanel events directly from the JS API they wont have the “settings” values. If you want a value to persist throughout all mixpanel API calls make sure to set it with MixpaneLComponent::register();

Leave questions and comments below!

 
 

How-To: Find Your Lean Startup Hypothesis

14 Jan

Lately I’ve been speaking with quite a few entrepreneurs about applying lean startup methods to their business and many are having difficulty finding their hypothesis. It’s hard to hone in on the proper scope the hypothesis should test, focusing on a macro-hypothesis such as “people will buy things online” is pointless as it’s already proven, and focusing on a micro-hypothesis such as “this link should be on the left instead of the right” will cause paralysis of analysis. So what’s the right hypothesis for a new business or initiative?

1. Don’t start by thinking of all possibly hypothesis’ for your business. Think of reasons why your business could fail, and start there.

Instead of trying to boil every initiative down into 5-10 hypothesis (marketing, product, customer segments, etc.) think of why your business might fail. I’ll use the real life example of my business FlipComp in which my partner and I are working with real estate investors. We got ahead of ourselves and built a product already, however, we still are trying to figure out what the right hypothesis are and retrofit lean onto our business (customer development + innovation accounting.)

After analyzing our business we cam up with 40-50 hypothesis, it would take way too many to test and take way too long (we’d be out of money before we were done.) So I scrapped my list and started over, instead I used an exercise I got from Michael Karnjanaprakorn which I really liked – I came up with reasons why my business would fail:

  1. If our flagship product which analyzes real estate investments isn’t a “must-have” for our customers we will not be able to sell subscriptions and will fail
  2. If users refuse to bid on our wholesale real estate deals and instead go around us we wont be able to capture and we will fail
  3. If we cannot create a market place with enough critical mass to interest real estate wholesaler we will fail

 

That’s pretty much it. If we can sell subscriptions, we have some product/market fit. If we can attract buyers and sellers, we have product/market fit. There is no fluff about email clicking or specific features – these are our core hypothesis that everything else will be based on. Also, the more novel your idea is the more novel your hypothesis’ will end up being. In our case we are simply saying we need to attract buyers and sellers.

2. For each reason you will fail build a corresponding hypothesis

Our reasons for failure are converted into:

  1. Real estate investors will pay us for our flagship product
  2. If we post a real estate deal visitors be willing to bid on a $100k+ item through our site
  3. Wholesalers will be willing to give us their listings as exclusives on our site

 

3. For extra data points, take your business concept to others entrepreneurs you know and respect and ask them to come up with reasons for failure.

Repeat 1 & 2, this time do it with other entrepreneurs who’s opinions you respect. Be careful not to argue why your business will work, instead, simply ask why they think it wouldn’t. Your job as an entrepreneur isn’t to talk them into thinking your right, it’s to prove that you are right by testing your hypothesis.

If you’ve been through this exercise (or similar ones) leave your comments below.

 
 

The 3 Best Lean Startup Resources

30 Dec

I’ve been building technology products for years, but when I read Eric Ries book “The Lean Startup” two weeks ago I knew I had fallen behind the curve. In order to catch up I needed to rapidly turn his theories into practice and apply them to my latest venture. If you have been learning about lean you may have found turning lean theories into practice is a daunting task. After spending a few days brainstorming on how to retrofit my business into lean to no avail I decided I needed to research a bit more. After a full day of searching, reading, and testing, I found what I needed to make the transition to lean a smooth and manageable process. Here are the results of my research:

1. GoLeanMean Incubator / Dashboard

The GoLeanMean team started two projects using the lean methodology, SendLove.to and BetterShift. As they developed each product they used an internal toolset called the LeanMean Dashbaord to manage their hypothesis testing and innovation accounting. It worked so well that within a few months of starting each project they decided to be part of the lean revolution itself and supply their system for entrepreneurs to use.

Recently they’ve gained funding and attention from VC’s and you can apply to be in their first “class” of entrepreneurs. If you are serious about being an entrepreneur I suggest you apply (I already have.)

Link: http://goleanmean.com/

Disclaimer: I invested personally in SendLove.to and had first hand experience with the team at GoLeanMean. They are in a very big way responsible for assisting my transition into lean.

2. Lean Canvas

Lean Canvas is a toolset created by Ash Maurya who’s focus is turning lean theories into practice. The tools Lean Canvas provides are best accompanied by his eBook ($19, or $15 if you tweet about it) which walks you through each step. Maurya does a phenomenal job transcribing customer development and lean concepts into concrete, actionable steps anyone can apply to a new business. Maurya will even give you a free 30-minute session to go over the tools with you which he schedules automatically for you with Tungle.me.

My meeting with Ash is set for next week and my Lean Canvas has been completed. I’ve shared it with my partner and we are focusing on making up for missed steps in the customer development process that may have been valuable. I’m looking forward to using the built-in hypothesis validation tools next week for our first experiments.

3. Books, Blogs, and More Books

These fall more into the “materials” category than the “tools” category. Here are the best lean and lean-related reads, I would describe the first three as “must-haves” and the rest as “nice to have”:

  1. The Lean Startup by Eric Ries – The father of the lean movement
  2. Running Lean by Ash Maurya – Mentioned earlier, helps turn theory into practice
  3. Four Steps to the Epiphany by Steve Blank – Much of your hypothesis testing comes in the form of customer development – this is the customer development bible.
  4. Ash Maurya Lean Workshops – He’s postponed these until next year (Jan 2012) but you can find updates on his website after then.
  5. Don’t Just Roll The Dice by Neil Davidson – Guide to software pricing, very short and available for free as a PDF if you search online.
  6. About Face 3 and Rocket Surgery Made Easy – The former focuses on interaction design but dives in deep to customer development. The latter focuses on usability interviews and is a short easy read. These are just “nice to have” supplement texts in my opinion.

I’m still on the hunt for more

The lean movement is still relatively new as far as shifts in business management paradigms go – there are limited products and services that support applying lean to your business. If you’ve found other useful resources please share them in the comment section below.