Google advises putting the google analytics script right before closing the .
However, I would prefer to combine it with the rest my javascript
From Google Analytics setup instructions:
Paste your snippet (unaltered, in it’s entirety) into every web page that you want to track. Paste it immediately before the closing
</head>
tag.If your website uses templates to generate pages, enter it just before the closing tag in the file that contains the
<head>
section.