You can add custom code in the following ways:
Adding code to several pages
Add the code in the templates:
Editing the Source code of a specific page
Within the document editor select the Source button; the HTML source code of the article will now be displayed.
Click the Source button again to return to the article. You could then preview it before selecting Save to commit your changes.
Adding an HTML module in an article
You can also add an html module into an article to keep your code in a module and prevent it from being accidentally edited. Put your cursor in the article where you want the code to go and select the module button on the toolbar and scroll down to find the grey html module.