To use external script simply head to the 'scripts' page by clicking it in the sidebar and pressing the '+ script' button:
Once clicked upon, name your script, choose insertion location and past/write your script in the box. Finally, place your script by clicking '+ Create script' button.