You can use this API in both WebSiteFunctions and PageFunctions contexts. Go to the Dev tools ribbon tab, then click Website functions or Page functions depending on the scope you want your function to be.
PageFunctions are only accessible from the page that declared them. You cannot call a function that is declared on another page. If you want to create global functions, you must use WebsiteFunctions.
WebsiteFunctions are accessible from any page. The output script is referenced on all your pages.