Fixes Bug 1045003 - analytics is not defined

Grunt has reformatted a lot lines, but I'll comment with the changes I've made
Used require to make sure `analytics.js` was loaded before this function is called