finish analytics implementation

Finish the analytics implementation. Wire it into stagehand.

fix #4