Add segment.io analytics
Make a few changes after review comments

Add comment on segment.io boilerplate code.
Make check for public site common code.
Wrap error handler code in try/catch.
Merge pull request #154 from andrew-polk/feature/addSegmentIoAnalytics

Add segment.io analytics