Move segment.io code to header and script loading to footer