Web site monitoring

Devlounge lists three web site monitoring services : Montastic, Mon.itor.us, and LinkPatch.  These services check your web sites regularly and notify you when something goes down.  They also provide additional services, like checking for broken links and such.

While I personally prefer a full featured monitoring tool such as Nagios (with SMS integration via Clickatell), it’s good to know that there are simple and straight-forward ways for basic monitoring.  After all,  installing and configuring Nagios makes sense only if you are geek or monitoring things is a big part of your business.

Update: Also http://www.alertra.com/ was recommended to me by Michael Cohen over on Google Buzz.

How accurate is Google Analytics?

That’s the question that I was asked recently by one of the co-workers.   It is simple and not so simple at the same time.  It really depends on what you are looking for, what is the acceptable accuracy, and what is that you are comparing Google Analytics with.

For example, if you compare the numbers from your Google Analytics reports to the summaries of the web server logs, you’ll probably find that Google Analytics reports lower numbers.  Almost like not everything is recorded.  Which is true because Google Analytics is using JavaScript to track your visitors.  Server logs record all hits to your web server, but the information in logs is very limited – it won’t be enough for anything but very basic tracking.

How much will numbers differ?  Here is what Google Analytics blog has to say:

Google Analytics uses JavaScript tags to collect data. This industry-standard method yields reliable trends and a high degree of precision, but it’s not perfect. Most of the time, if you are noticing data discrepancies greater than 10%, it’s due to an installation issue. Common problems include JavaScript errors, redirects, untagged pages and slow client-side load times.

Having used Google Analytics on a number of sites over a number of years, I’d say that that is just about right.

CakePHP : Building factories with models and behaviors

CakePHP is a wonderful framework.   Recently I proved it to myself once again (not that I need much of that proof anyway).  The problem that we had at work was a whole lot of code in once place and no obvious way of how to break that code into smaller, more manageable pieces.  MVC is a fine architecture, but it wasn’t obvious to me how to apply it to larger projects.

In our particular case, we happen to have several data types, which are very similar to each other, yet should be treated differently.  Two examples are:

  1. Client account registrations.   Our application supports different types of accounts and each type has its own processing, forms, validations, etc.  However, each type of account is still an account registration.
  2. Financial transactions.  Our clients can send us money via a number of payment methods – credit cards, PayPal, bank wires, etc.  Each type of the transaction has its own processing, forms, validations, etc.  However, each type of the transaction is still a financial transaction of money coming in.

Having a separate model for each type of account or for each type of transaction seems excessive.  There are differences between each type, but not enough to justify a separate model.  Having a single model though means that it’ll continue to grow with each and every difference that needs to be coded in.  Something like a class factory design pattern would solve the problem nicely, but the question is how to fit it into an existing MVC architecture.  Read the rest of this post for a demonstration.

Continue reading CakePHP : Building factories with models and behaviors