Refactor analytics scripts, and version 1 of funnel analysis

Reviewers: usmanm, sbisker

Reviewed By: usmanm

Differential Revision: http://phabricator.locu.com/D4736