cleaned up the analytic system
handle ti.end by sending to database
fixed app hang when analytics is turned off
Merge pull request #74 from pec1985/analytics-backport

Analytics backport