Segment.io's Analytics.js packaged for Meteor.
Exposes analytics as a global client variable.
Set your api key with Meteor.settings as Meteor.settings.public.analytics_api_key
{
"public": {
"analytics_api_key": "YOUR-ANALYTICS-API-KEY",
"analytics_localhost_active":true //optional, this will enable analytics on localhost, disabled by default
}
}Here's how to track page loads, if you're using iron-router:
Router.onRun(function(){
if(Session.equals('AnalyticsJS_loaded', true))
analytics.page(this.path);
});For more types of tracking, refer to the Analytics.js documentation.
This package is for client side metrics only. You'll want the npm package and the analytics-node npm to record server side metrics. See #10