Google advises putting the google analytics script right before closing the .
However, I would prefer to combine it with the rest my javascript
You're risking nothing really. Putting
tags at the end of the is recommendable because of the blocking nature while executing the Javascript it encloses...
That is simply not true, jAndy.
You won't be able to get some features, such as real-time reporting, or Google Webmaster Tools verification, unless the code sits within the . The whole point of the asynchronous code is that it does it can load while the rest of the page is loading. There is no UX risk from placing it within the
, and it is best-practice to do so. source: Google Analytics Support
@Stratboy I doubt it's the GA code that's breaking the layout. A properly tagged script - especially one that does not display any content, like GA's - would not affect the layout. I'd look elsewhere for your layout issues. Perhaps try validating it with W3C for some clues?