analytics
analytics copied to clipboard
reduce file size
with meteor 1.5. and the new bundle-analyizer you get a good picture of the bundle size.
This library is huge (166kb) and contributes to 10% of the file size. Is it possible to reduce file size? we only need google analytics.
okgrow:analytics version 2.1.1
maybe we can use something like https://github.com/meteor/meteor/issues/8745 ?
The library also seems to pull in meteor-node-stubs for me which adds another 300kb. I'm testing and reduced my bundle by about 600kb without okgrow:analytics.
@jlichti Just realised it is indeed this package that pulls in meteor-node-stubs, did you figure out why?
Got the same bundle-size reduction as you when removing it, huge!
I didn't dig into it since it was easy for me to just replace with a npm package.
Which package did you use, and did it do any sort of automatic logging?
I used this package: https://github.com/react-ga/react-ga
I'm using flow router on this project so I added a trigger:
FlowRouter.triggers.enter((context, redirect) => { logPageView(); ... });
And my logPageView() method is:
const logPageView = () => { ReactGA.set({ page: window.location.pathname + window.location.search }); ReactGA.pageview(window.location.pathname + window.location.search); };
Cross ref: https://github.com/meteor/node-stubs/issues/6