• assespera

    (@assespera)


    Hi! I need help to install the google tag on my site. I don’t want to use any plugin but do it via FTP.
    Since the YITH Wonder theme is a block theme, there is no php file where to paste the code with the google tag and I just can’t figure out how to do it. Can anyone help me with the process?

    Thank you very much

Viewing 1 replies (of 1 total)
  • Install Google Tag Manager on your block theme (like YITH Wonder) via FTP:

    1️⃣ Go to: /wp-content/themes/YITH-wonder/functions.php
    2️⃣ Add this code:

    phpCopy

    Edit

    add_action('wp_head', function() {
    ?>
    <!-- Google Tag Manager -->
    <script>(your GTM head code here)</script>
    <?php
    });
    add_action('wp_body_open', function() {
    ?>
    <!-- Google Tag Manager (noscript) -->
    <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-XXXX"
    height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript>
    <?php
    });

    ✅ Replace GTM-XXXX with your GTM ID.
    ✅ Save → Clear cache → Test.

Viewing 1 replies (of 1 total)

The topic ‘Google Tag Manager’ is closed to new replies.