analytics icon indicating copy to clipboard operation
analytics copied to clipboard

reduce file size

Open macrozone opened this issue 7 years ago • 7 comments

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

macrozone avatar May 18 '17 13:05 macrozone

maybe we can use something like https://github.com/meteor/meteor/issues/8745 ?

macrozone avatar Jun 15 '17 22:06 macrozone

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 avatar Jun 22 '17 18:06 jlichti

@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!

Floriferous avatar Jul 14 '17 14:07 Floriferous

I didn't dig into it since it was easy for me to just replace with a npm package.

jlichti avatar Jul 16 '17 10:07 jlichti

Which package did you use, and did it do any sort of automatic logging?

Floriferous avatar Jul 24 '17 11:07 Floriferous

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); };

jlichti avatar Jul 24 '17 12:07 jlichti

Cross ref: https://github.com/meteor/node-stubs/issues/6

RobertLowe avatar Mar 16 '18 03:03 RobertLowe