if you don't use a local .js file, change the 4th parameter to the Google Analytics script URL
i.e. change: 'js/analytics.js' -> 'https://www.google-analytics.com/analytics.js'
add this after line 12:
ga 'create', 'UA-XXX...', 'auto'
ga 'send', 'pageview'