Navigation
This is archived content. Visit our new forum.
  • Author
    Posts
  • #1234801

    sunefroeslev
    Participant

    Hi

    I run the domain https://egdent.dk
    We want to use Google Tag Manager and have struggled with it for some days now.
    Google Tag Manager has 2 tags/snippets. One needs to go in the head section, the other one needs to go in the body section.

    I have tried a lot of different solutions but the result is the same every time. The result is that the tag in the budy section works fine no mather what solution I choose to go with. The tag in the head section is never shown.

    I have tried to use the plugin “Header and Footer Scripts”.
    I have tried to use the plugin “Google Tag Manager for WordPress”
    I have tried to go to my child theme functions.php and insert the code.
    I have tried to go to my child theme _header.php and insert the code.

    I really do not understand, why this is not working.
    Hope to hear from you with some help soon.

    Best regards

    #1235232

    Jade
    Moderator

    Hi there,

    Would you mind providing us with login credentials so we can take a closer look? To do this, you can make a post with the following info:

    – Link to your site
    – WordPress Admin username / password
    – FTP credentials

    Don’t forget to select Set as private reply. This ensures your information is only visible to our staff.

    #1237559

    sunefroeslev
    Participant
    This reply has been marked as private.
    #1237608

    Lely
    Moderator

    Hello There,

    1.) Unfortunately, we’re not using email address here. Please create one for us and just disable after we’re done checking.

    2.) Did you forgot FTP password?
    Can you give us the code you have added that is not working?

    #1237664

    sunefroeslev
    Participant
    This reply has been marked as private.
    #1237665

    sunefroeslev
    Participant
    This reply has been marked as private.
    #1237692

    Christopher
    Moderator

    Hi there,

    Please provide us with FTP account username as well.
    For the time being please add following code in child theme’s functions.php file :

    function google-tag-manager_code() { ?>
    
      <script>
        // google-tag-manager.
      </script>
    
    <?php }
    
    add_action( 'wp_head', 'google-tag-manager_code' );

    Hope it helps.

    #1237722

    sunefroeslev
    Participant
    This reply has been marked as private.
    #1237752

    Paul R
    Moderator

    Hi,

    Login provided doesn’t seem to work.

    Kindly check again and let us know.

    Thanks

    #1237764

    sunefroeslev
    Participant
    This reply has been marked as private.
    #1237795

    Christian
    Moderator

    Please use the code

    function google_tag_manager_code() { ?>
    
      <script>
        // google-tag-manager.
      </script>
    
    <?php }
    
    add_action( 'wp_head', 'google_tag_manager_code' );

    Thanks.

    #1237809

    sunefroeslev
    Participant
    This reply has been marked as private.
    #1237856

    Christian
    Moderator

    It did not crash because the code is correct. Previously, it has a syntax error.

    Did you replace

     <script>
        // google-tag-manager.
      </script>

    with your own code? Also, I see your HTML is minified. Please clear all caches deactivate all third party plugins while we investigate.

    Thanks.

    #1237875

    sunefroeslev
    Participant
    This reply has been marked as private.
    #1237936

    sunefroeslev
    Participant

    Hi again

    I am here with an update.
    It seems to be working now actually. The two things that did the trick was.
    – Including the right function code (with my own tag AND without syntax error)
    – Disable the plugin “Above the fold”.

    Unfortunately we need the plugin “Above the fold” for optimizing CSS and Java delivery.
    But now I know what causes the problem.