I would not modify the PortalTemplate.aspx nor is it needed. Javascript and JQuery is "Ok" till someone hits your site who has either one or both blocked and/or restricted, or if you are pulling from CDN and there is a network interruption, etc. The best way is what Dawid suggested and It is what i recommend. Just add the below to your Master Page template, which I usually add at the bottom and it will work just fine.
<script runat="server">
protected void Page_Load(object sender, EventArgs e)
{
CMS.DocumentEngine.DocumentContext.CurrentBodyClass += " PUT YOU CLASS(ES) HERE"; //Notice you will need a space after the first double quote.
}
</script>