Add HTML Before the Closing Body Tag

Matt Aunger Updated by Matt Aunger

Customizing your docs with JavaScript snippets and CSS is an awesome way to make them stand out.

Most of the time you'll find dropping your custom code into Settings > Code > CSS or Scripts works super well by adding code into the <head> portion of your knowledge base. But there might be the odd occasion where you'll wanna add a snippet somewhere else. Sometimes scripts need to be added before the closing </body> tag.

For this you'll wanna use the example below replacing Your Code with your custom code and saving the entire snippet into Settings > Code > Scripts 🙃

 var someHTML = 'Your Code'; // string of HTML here
 ready(function() {
   document.body.insertAdjacentHTML('afterend', someHTML);

 function ready(fn) {
   if (document.attachEvent ? document.readyState === "complete" : document.readyState !== "loading"){
   } else {
     document.addEventListener('DOMContentLoaded', fn);

What did you think of this doc?

Overriding the Font on Your Knowledge Base

How to Change the Logo Link

Get in touch