Ok I am having a hard time with this one. I just inherited a 3.8.x Joomla site and all I'm trying to do is include a GTM script in the head of the document. What's happening is that anything within script tags or injected via $document->addScript(''); will be moved down to the end of the document.

How can I simply include a script tag in the head, and prevent it from being moved to the footer?

up vote 3 down vote accepted

Default Joomla behaviour is to add scripts to the head element.

Try looking where <jdoc:include type="head" /> appears in your template (under template/YOURTEMPLATE/index.php) - it may have been moved to the footer here.

Likewise, it might be a plugin which is moving the scripts to the footer, so you might want to review which have been installed.

A Google tells me that there is one called ScriptsDown, so it could well be that.

Turns out I DID have the ScriptsDown plugin installed, although it didn't show up the first time I searched for it in my early exploration of this issue. I'm guessing I had a typo.

Anyways, this was the issue. Disabling this plugin fixed my problem; thanks for your help!

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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