revised to work with analytics.js