Alanytics script which can be lazy loaded by js
meteor add zaku:lazy-analytics
var analytics = {account: 'UA-XXXXXXX-Y'};
Meteor.Router.add({
'/': function() {
analytics.pageview();
return 'home';}
})
In your controller code:
analytics.pageview();
analytics.pageview("/hello");
analytics.event("account","signin");
analytics.event("account","signin","DataRiot");
analytics.event("account","signin","DataRiot", 2);
You can also provide options for the Google Analytics cookie:
{
"account":"UA-XXXXXXX-Y",
"cookieName": "new_cookie_name",
"cookieDomain": "mynew.domain.com",
"cookieExpires": 60 * 60 * 24 * 28, /* Time in seconds. */
"trackInterests": true, /* Enable also GA website and */
"trackInPage": true /* force/ignore the Google check. */
}
If you pass debug: true
as a setting, the package will output console logs on analytics.pageview()
and analytics.event()
.