I'm working on a module for Magento 2, it's my first time writing a Magento module and I feel like there is something very basic I somehow fail to understand, I'm trying to add a code snippet to every page on the frontend, the code snippet is using data from the backend so I can't just add the script in
default_head_blocks.xml, it has to be a PHTML file, but either I'm placing the file in the wrong location or not calling it correctly, I just can't seem to get anything printed on the screen, how can I achieve this?
All I want is to print a code snippet to the header of every page on the frontend, an example that adds
<script> alert(1); </script>
would be great help.
Pretty new to this Magento thing so any help, tip or advice will be welcome.