We really care about web performance. We promise.
However, we sometimes get challenged on this when we tell people to put our snippet at the top of thier page.
Those that are familiar with web performance have likely heard about the original '14 rules' for making your site faster. Those that haven't, be sure to check them out! http://stevesouders.com/hpws/rules.php
Rule #6: Put Scripts at the Bottom
Why does this rule exist?
As we got smarter, we looked at ways that we could work around the download issue. We can now ensure that downloading of JS does not block, and the more modern browsers started expanding support for more parallel downloads.
These posts talks about non-blocking script techniques – which allows you to download the script in a non-blocking way (the foundation for the best practice used today).
This post came along, which talked about the difference between ‘defer’ and ‘async'
And we improved even more on the ‘perfect snippet’:
However, we still were blocking the window.onload event from firing.
Facebook (and our own Philip Tellis) worked together to address this:
2013: http://calendar.perfplanet.com/2012/the-non-blocking-script-loader-pattern/ <— A truly asynchronous loader which does not block onLoad is born
The last entry covers the technique we use for loading our mPulse snippet. This is the preferred method that is recognized throughout the web performance community.
Please post any questions or thoughts!