I use Joomla 3 and I've put 3 Custom HTML modules in debug position. Those modules contain javascript snippets of tracking code for different services (kinda like Google Analytics). Everything seems to be working fine now. But I'm just double-checking if it's OK to do it that way?

1 Answer 1


As per the answer at: https://stackoverflow.com/a/2837959/1983389 JavaScript can be added to the head, body or called via an external file so it should be fine to include it in a module.

The only issues I have discovered with this method are:

Default margins / padding for the debug module position

Some templates include default margins and padding for module positions so you may end up with unwanted spacing in your layout when using the debug module position only for code. This can usually be solved via custom CSS such as {display: none;} or similar for the debug modules.

Code Being Stripped when saving in the editor

As you have probably discovered, Joomla and/or your editor will often strip non-html code from your Custom HTML module when it is saved. You can usually get around this issue by one or more of the following methods:

  1. amending the Text Filters in Global Configuration
  2. using a third party extension such as Regular Labs Sourcerer or similar so that code is retained on saving
  3. temporarily setting the default editor to "None" in Global Configuration when editing your Custom HTML modules
  4. amending the default editor settings to allow JavaScript code (if possible)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.