fix JS bug preventing analytics from loading
move analytics to <head> section

to match to the current recommendation from Google