Yahoo's decline aides Open ID

This is a little cynical, but I’m thinking that Yahoo would not have started the Open ID drive had they not been having difficulties.  Being in trouble encourages you to mix it up a little, and I’m (cynical) thinking that grasping at straws brought on this move.  Any way you slice it it’s good for the web.  I was ragging on Microsoft’s Phil Holden over a year back to do something similar…great to see the 800 pound gorillas getting on this thing.

Search and web apps and conversion funnels

The truth about Google Analytics is that it’s not half as helpful as people make it out to be if you are running a subscription based web app. Why? You can’t correlate things like search terms with conversions to paying subscribers. I know you can with trials using their little code snippets, but seriously who cares?! Paying subscribers are what matter.

I wrote an article a while back about tracking conversions for your web app and optimizing your conversion funnel. The following is a technical follow on to that article and describes how we at FreshBooks know which sites – and which search terms – turn traffic into, not just trials, but paying subscribers.

Take it away Jeffrey:

We use cookies set in PHP to track entry pages, referring domains and referring URLs. Cookies are used because their value is stored even if the user leaves the FreshBooks website or if the user closes their browser window.

We set two cookies, the referring URL and the URL used to access the FreshBooks website (entry page). We also set the cookie to expire in 90 days so if they come back at a later date we still have data from the first time they visit us. The code below shows how to do this. It is place at the top of every page on the FreshBooks website

setcookie(“referrer”, $_SERVER[‘HTTP_REFERER’], time() + 3600 * 24 * 90);
setcookie(“entrypage”, $_SERVER[‘REQUEST_URI’], time() + 3600 * 24 * 90);

Because this code is run on every page we have to make sure it does not set a new cookie every time a visitor clicks on a different FreshBooks page and we also make sure we don’t overwrite the users cookies if they are visit us before and came back.

if(!$_COOKIE[‘referrer’] and !$_COOKIE[‘entrypage’] and eregi(“”, $_SERVER[‘HTTP_REFERER’]) == false) {
setcookie(“referrer”, $_SERVER[‘HTTP_REFERER’], time() + 3600 * 24 * 90);
setcookie(“entrypage”, $_SERVER[‘REQUEST_URI’], time() + 3600 * 24 * 90);

Now when a user subscribes it’s as simple as storing these values in a database which can be used for reporting purposes. First we check if the user has cookies set then we use a simple mysql statement to insert these values into the database:

if($_COOKIE[‘referrer’] or $_COOKIE[‘entrypage’]) {
$referring_url = $_COOKIE[‘referrer’];
$entry_page = $_COOKIE[‘entrypage’];
$pieces = explode(“/”, $referring_url);
$referring_domain = $pieces[2];

$query = “insert into tracking (referring_url, entry_page, referring_domain) value (‘$referring_url’, ‘$entry_page’, ‘$referring_domain’);”
$result = mysql_query($query, $connect);

So there you have it folks. This is all based on predefined PHP variables – standard stuff really. Anyone and everyone building web apps should be taking advantage of them. End of story.