You can find more information on asynchronous tracking code by following the link "New! Try the asynchronous tracking code" that takes you on documentation (in English) of the tracking code asynchronously. Here's what look like the previous code with asynchronous function:
Code:
<script type = " text / javascript " > var _gaq = _gaq | | [ ] ; _gaq . push ( [ ' _setAccount ' , ' UA-XXXXXXXX-X ' ] ) ; _gaq . push ( [ ' _trackPageview ' ] ) ; ( function () { var ga = document . createElement ( ' script ' ) ; ga . type = ' text/javascript ' ; ga . async = true ; ga . src = ( ' https: ' = = document . location . protocol ? ' https://ssl ' : ' http://www ' ) + ' .google-analytics.com/ga.js ' ; (document . getElementsByTagName ( ' head ' ) [ 0 ] | | document . getElementsByTagName ( ' body ' ) [ 0 ] ) . appendChild (ga) ; } )() ; </script>
If you want to use this code, change the account number "UA-XXXXXX-X" with your own and include the script in each of your pages. This time, this script should be included as high as possible on the page as it will not slow the loading of the page. The old script should be removed from the site otherwise we would lose all the advantages of asynchronous script . This asynchronous loading is not supported by all browsers. On browsers that do not support this feature, this code will be executed as the old tracking code.
Bookmarks