RSS
 

Archive for the ‘Uncategorized’ Category

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.