Refactor analytics.js

Rename 3 functions