Migrate analytics into analytics.js. Closes #295.