Quite recently Google changed their Analytics code to provide better browser support, and to help address speed loading issues often caused by other scripts on the page. Previously the tracking code has been placed before the last tag within a page, however often when a page doesn’t load properly, or is slow to load and a visitor has already navigated away from that page, tracking has not recorded that visitor information specific to that page. On the Google Analytics code help centre, Google have provided instructions stating you should: “Note: To ensure the most streamlined operation of the asynchronous snippet with respect to other scripts, we recommend you place other scripts in your site in one of these ways:
- before the tracking code snippet in thesection of your HTML
- after both the tracking code snippet and all page content (e.g. at the bottom of the HTML body)
If that isn't an option, you can still put the asynchronous snippet at the bottom of the page. You can also split your snippet to retain some of the benefits of asynchronous tracking.†The change is very welcome to help provide more accurate website statistics. To find out more about these changes visit their help page at: Tracking Sites with the Asynchronous Snippet