I'm trying to add an inline script tag into the header, by creating a new text block in default_head_blocks.xml, but my setText method doesn't seem to be applying it correctly.
Here's my setup:
THEME_DIR/Magento_Theme/layout/default_head_blocks.xml
<?xml version="1.0"?>
<!--
/**
* Copyright © 2016 Magento. All rights reserved.
* See COPYING.txt for license details.
*/
-->
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
<head>
<block type="Magento\Framework\View\Element\Text" name="my_script">
<action method="setText">
<argument translate="true" name="text" xsi:type="string">
<![CDATA[<script>console.log("I'm loaded!");</script>]]>
</argument>
</action>
</block>
</head>
</page>
What is the correct way to insert inline script tags into the header?