[Resolved] Google Tag Manager breaks menu

Home Forums Support Google Tag Manager breaks menu

  • This topic has 9 replies, 2 voices, and was last updated 7 months ago by David.
Viewing 10 posts - 1 through 10 (of 10 total)
  • Author
    Posts
  • #1168937
    Manuel

    The menu in frontend disappears after inserting the Google Tag Manager code as mentioned here: https://docs.generatepress.com/article/implement-google-tag-manager/

    Tried as element with hooks and also as PHP with the Snippet plugin. Same result.
    Deactivating all plugins also didn’t work.

    How can we solve this?

    #1168964
    David
    Staff
    Customer Support

    Hi there,

    can you clear and disable your cache plugin – let me know so i can take a closer look

    #1168975
    Manuel

    Hi David,
    the cache is cleared and the plugin deactivated.

    Best regards,
    Manuel

    #1168981
    David
    Staff
    Customer Support

    I think our documents have been updated incorrectly.

    The first script you have the wp_body_open hook. Change this to WP_Head

    The second script change the hook to wp_body_open

    #1169017
    Manuel

    Hi David,
    unfortunately this didn’t solve the issue.

    #1169218
    David
    Staff
    Customer Support

    Do you have a plugin adding the GTM as well ? As i can see scripts twice.
    If so can you remove that and then can you paste the code you have added to the two hooks here.
    Please highlight the code and hit the the code button before submitting.

    #1169974
    Manuel

    Hook: wp_head, entire site

    <!-- Google Tag Manager -->
    <script>(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':
    new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],
    j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src=
    'https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);
    })(window,document,'script','dataLayer','GTM-XXXXXX');</script>
    <!-- End Google Tag Manager —>

    Hook: wp_body_open, entire site, priority 0

    <!-- Google Tag Manager (noscript) -->
    <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-XXXXXX"
    height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript>
    <!-- End Google Tag Manager (noscript) —>
    #1170114
    David
    Staff
    Customer Support

    Aah – see this:

    <!-- End Google Tag Manager —>

    replace with:

    <!-- End Google Tag Manager -—>

    And this:

    <!-- End Google Tag Manager (noscript) —>

    replace with:

    <!-- End Google Tag Manager (noscript) -—>

    #1170160
    Manuel

    Hi David,
    sorry for the inconvenience! You were right. There were not the right –> after the line. These two are the correct ones:

    <!-- End Google Tag Manager -->

    <!-- End Google Tag Manager (noscript) -->

    #1170211
    David
    Staff
    Customer Support

    You’re welcome – not an inconvenience at all as it helped us correct an error in our documentation.

Viewing 10 posts - 1 through 10 (of 10 total)
  • You must be logged in to reply to this topic.