Possible Duplicate:
How do I dynamically load Google Analytics JavaScript?
Hi Google Analytics call is slowing down my web page load. Is there a way to initiate call to Google Analytics only after the complete web page has been rendered?
Possible Duplicate:
How do I dynamically load Google Analytics JavaScript?
Hi Google Analytics call is slowing down my web page load. Is there a way to initiate call to Google Analytics only after the complete web page has been rendered?
Generally the new analytics js code has a setting to load asynchronously(after the page has loaded that is). Something like
ga.setAttribute('async', 'true');
I also think you can get the asynchronous code from the "tracking code" of the analytics panel if you choose to display the advanced options but i'm not sure about that. :)
Asynchronous GA snippet, extracted from HTML5 Boilerplate:
var _gaq=[["_setAccount","UA-XXXXX-X"],["_trackPageview"]]; // Change UA-XXXXX-X to be your site's ID
(function(d,t){var g=d.createElement(t),s=d.getElementsByTagName(t)[0];g.async=1;
g.src=("https:"==location.protocol?"//ssl":"//www")+".google-analytics.com/ga.js";
s.parentNode.insertBefore(g,s)}(document,"script"));