I would like your opinion about an issue and solution i have with google plus one button ( and any other social widget ).
We have a high traffic site , that runs fast and smoothly ( under 1 seconds load time ). When trying to implement the google plus button we saw our load time grow to absurdity.
Google is blabbing about load times all around and they still make a slow widget ?
We need the social widgets , but the load speed is crucial for our users and SEO.
I was thinking to load the google button after the site was loaded so users would not notice any speed difference , but still had the ability to plus bullshit us.
I would like to hear the cons for this approach, or maybe even a better solution.
Using the mouseover event on the body to load the social widgets. It works , but I am not sure if this is acceptable.
http://www.webpagetest.org shows the same speed as before the button implementations.
Using jquery :
<div id="testcase"></div>
<script type="text/javascript">
$(document).ready(function() {
$('body').mouseover(function() {
$('body').unbind();
// google html
$('#testcase').html('<g:plusone size="medium" annotation="inline"></g:plusone>');
// Google code
var po = document.createElement('script'); po.type = 'text/javascript'; po.async = true;
po.src = 'https://apis.google.com/js/plusone.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(po, s);
});
});
</script>
Please let me know what you think or if I could improve this idea.