Move JS functions into mixpanel.init