As the title says I'm trying to add some script before the closing body tag.
So far I have created my own vendor/theme and am referencing the magento theme module.
<referenceContainer name="before.body.end"> <block class="\Magento\Framework\View\Element\Template" template="Magento_Theme::templates/html/js.phtml" name="modulejs"/> </referenceContainer>
and I have /my-vendor/my-theme/Magento_Theme/templates/html/js.phtml which contains my script.
Pretty new to this so no idea if this is nearly right, it's pieced together from various bits I have found.