Try This Code
app/code/VendoreName/GoogleTagManager
registration.php
<?php
\Magento\Framework\Component\ComponentRegistrar::register(
\Magento\Framework\Component\ComponentRegistrar::MODULE,
'VendoreName_GoogleTagManager',
__DIR__
);
app/code/VendoreName/GoogleTagManager/etc
module.xml
<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd">
<module name="VendoreName_GoogleTagManager"/>
</config>
app/code/VendoreName/GoogleTagManager/view/frontend/layout
default.xml
<?xml version="1.0"?>
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
<body>
<referenceBlock name="head.additional">
<block class="Magento\Framework\View\Element\Template" name="googletagmanager_head" template="VendoreName_GoogleTagManager::gtm_head.phtml" />
</referenceBlock>
<referenceContainer name="after.body.start">
<block class="Magento\Framework\View\Element\Template" name="googletagmanager_body" template="VendoreName_GoogleTagManager::gtm_body.phtml" />
</referenceContainer>
</body>
</page>
app/code/VendoreName/GoogleTagManager/view/frontend/templates
gtm_head.phtml
<script>..</script> <!-- Add your script tag GTM code -->
app/code/VendoreName/GoogleTagManager/view/frontend/templates
gtm_body.phtml
<noscript>..</noscript> <!-- Add your noscript GTM code -->
Click here to download
magento setup:static-content:deploy
To create an issue use github.com/magepal/magento2-googletagmanager/issues/new