3 ms·
How does this script impact the performance of a site? Specifically... 1. It includes code to load up various analytics tools even if you never use them. For
by bluesmoon 14y ago
How does this script impact the performance of a site?
Specifically...
1. It includes code to load up various analytics tools even if you never use them. For example, if I only use GA and Mixpanel, do I really want to serve the bytes for all the other plugins to my users? Maybe it would be useful to only package the JavaScript that a certain site needs.
2. The script still blocks the onload event. See this post for a way around that: http://calendar.perfplanet.com/2012/the-non-blocking-script-loader-pattern/ http://calendar.perfplanet.com/2012/the-non-blocking-script-...
3. How does having multiple analytics solutions on a page affect the load time of that page?
Lastly, I couldn't tell from the docs how to call methods before the script has finished loading. Is it similar to GA's method queue pattern?
- Hovertruck 14y ago> It includes code to load up various analytics tools even if you never use them. For example, if I only use GA and Mixpanel, do I really want to serve the bytes for all the other plugins to my users? Maybe it would be useful to only package the JavaScript that a certain site needs. It only has code that knows how to load each script, which isn't that much. So for example if you don't tell it to load chartbeat.js, it will never load chartbeat.js. Regarding load time of pages, it's one thing we (Chartbeat) take really seriously, e.g. our default implementation waits until after onload before downloading anything and we keep our JS as light as possible. This script does, unfortunately, throw some of that out the window with it's implementation though. I'm working on my pull request already. :)
- ianstormtaylor 14y agoLooking forward to it! Sorry to mess with your onload
- ianstormtaylor 14y agoFor the last question, all of the providers are initialized just like they would be normally, so GA's queue is setup already and it will just be routed the track calls.