简体   繁体   中英

How do I add Google Analytics to a Meteor app?

I see that we cannot directly add code to our HTML tag in Meteor, what is a good/canon way of adding Google Analytics to Meteor? I googled it and there are many outdated resources, but the most up to date is a package called meteor-ganalytics. I'm not sure if it does directly that. Any help?

We've created a package that integrates Google Analytics, Mixpanel, KISSmetrics and other platforms under one API with Meteor.

The package adds the packages and makes them ready-to-use in the Meteor. All you need to do is add the package and and add your trackingIDs/tokens in settings.

okgrow:analytics

There is a package available meteor add datariot:ganalytics that adds GA to Meteor. It allows the user to configure analytics and set GA events.

Found here: https://github.com/datariot/meteor-ganalytics

If you use Iron Router, you may then look at this package:

https://atmospherejs.com/reywood/iron-router-ga

Install it, then add your Google Analytics account ID to settings.json file

then add

Router.configure({ trackPageView: true });

And it will stark tracking your routes. No extra code required.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM