All docs

Custom Code

Some services ask you to paste a snippet into every page, a chat widget, a heatmap tool or a consent banner. Pasting it into the template works until the template updates and the snippet disappears. Custom Code holds it in AI Boost instead and writes it into every page.

It is the last screen under Tools in the sidebar. Only a Super User can change it, because what goes in here runs on every page of your site. Anyone else sees the boxes with a note saying so, and cannot type in them.

Nothing you paste here is corrected or tidied. AI Boost only closes an HTML comment you left open. A missing closing tag in the head can break the layout of every page, not one setting. Paste what the service gave you, whole, and check the site afterwards.

Switch it on

Custom Code, section 01 Custom code injection with the Enable Custom Code Injection switch, and section 02 Head with the box Inject before </head> and its character count

Enable Custom Code Injection, in section 01, is off when you install. Nothing in the three boxes below it reaches a page until it is on, so a snippet can wait here while you make sure it is right. The line under the switch reminds you that the AI Boost plugin must be enabled in Joomla's plugin manager too. The package switches it on as it installs, so this matters only if someone has switched it off.

The three positions

Section 03 Body Start with the box Inject after opening <body>, and section 04 Body End with the box Inject before </body>

Each section holds one box, and each box puts its code at one position in every page.

Section and boxWhere the code goesWhat belongs there
Head, box Inject before </head>in AI Boost's part of the head, before its verification and analytics tagsAnything the page needs before it draws, a stylesheet, a font or a preconnect link. AI Boost writes it before its verification and analytics tags, so a consent script that must run before those belongs here
Body Start, box Inject after opening <body>just after <body>Almost nothing. A few tools insist on being first in the body. If Tag Manager's container ID is on Analytics & Verification and Measure visits is on, AI Boost writes its noscript fallback there for you. Paste one here only for a container you entered nowhere else
Body End, box Inject before </body>just before </body>Anything that can wait, a chat widget, a feedback button, a script that may load after the page

Paste whole tags, one after another. Prefer Body End when a service allows it. Placed there, a script cannot delay the words the visitor came to read.

Under each box a count shows how many characters you pasted. The box also warns when a tag is left open, a closing tag does not match, or a bracket does not close. A snippet with no warning can still be wrong, so check the site after you paste.

A worked example

The hotel adds a booking chat widget. Its provider gives one line and says it may go at the end of the page:

<script src="https://chat.example.com/widget.js" data-hotel="aldwick" async></script>

Paste it into Body End, switch on Enable Custom Code Injection, and open the site in a private window. The chat button appears on every page.

What not to put here

  • Google Analytics, Tag Manager or Meta Pixel. They belong on Analytics & Verification, where one switch turns them all off and nothing is counted twice.
  • Verification tags. They go on the Verification sub-tab of Analytics & Verification, even for a service such as Pinterest that has no row there, because one box takes other services' tags whole.
  • Structured data you wrote by hand. It will sit beside AI Boost's and may say something different about the same business. Use Structured Data.

A Meta Pixel event that fires on a click, such as AddToCart, is the exception. Its fbq('track', 'AddToCart') call belongs in your own click handler, and Body End is one place to put that handler.

Check it on your site

Open your site in a private window and look for what the snippet does, a chat button or a banner. Pages, Check addresses, Code shows the code AI Boost adds to any page, the three boxes' code included, so you can see what arrived and where.

If something breaks

Switch off Enable Custom Code Injection. Every page loses the three boxes' code at once, and what you pasted stays here for you to fix.