Support » Plugin: WP Mobile Menu - The Mobile-Friendly Responsive Menu » Javascript is wrapping google tag manager code

  • Resolved pslcbs

    (@pslcbs)


    Hi,
    I’m experiencing a trouble with your plugin because when I enable it with “Enable mobile menu” setting your module wraps in an additional <div> all the <body> tag content, including the google tag manager code inside <body> and Google doesn’t find it in it’s correct place. The code shows as follows:

    <body class="customize-support mob-menu-slideout-over">
      <div class="mobmenu-push-wrap">
    	<!-- Google Tag Manager (noscript) -->
    		<noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-XXXXXXX" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript>
    	<!-- End Google Tag Manager (noscript) -->
    .......

    But if I disable Mobile Menu plugin with “Enable mobile menu” the code is correct and Google detects it correctly

    Is not possible to decide what code is wrapped and what not?

    Thank you for your answer

    The page I need help with: [log in to see the link]

Viewing 7 replies - 1 through 7 (of 7 total)
  • Plugin Author Rui Guerreiro

    (@takanakui)

    Hi @pslcbs,

    That is caused by the Slideout Push content display type, change it to Slideout Over content and that won’t happen.

    You aren’t in the latest plugin version since I removed that Enable Button since it was redundant.

    Upload to the latest version and change to Slideout Over Content Display type will do the trick.

    Let me know the result.

    Hi,
    No, with 2.5.1 version, it not was caused about ‘Slideout push’ content display type because I changed it to ‘Slideout Over’ and the result is the same, with the same classes and moreover the ‘Slideout over’ display doesn’t works, the menu displayed is always the ‘Slideout push’ version:

    <body class=”mob-menu-slideout-over”>
    <div class=”mobmenu-push-wrap”>
    <!– Google Tag Manager (noscript) –>
    <noscript><iframe src=”https://www.googletagmanager.com/ns.html?id=GTM-XXXXXXX&#8221; height=”0″ width=”0″ style=”display:none;visibility:hidden”></iframe></noscript>
    <!– End Google Tag Manager (noscript) –>

    I upgraded to 2.6 version and the resulting html code is ok for google tag but the trouble now is that the display is always a ‘Slideout over’ empty display no matter of the setting tried ‘Slideout over’ or ‘Slideout push’, left or right version.
    The menu is there, in html, but is not displayed to user

    Now is 2.6 installed for if you want to give a look. But not for long time because I will downgrade to 2.5.1 to have at least the menu displayed.

    Thanks

    Plugin Author Rui Guerreiro

    (@takanakui)

    Hi @pslcbs,

    It seems your theme isn’t implementing the body_class template tag. We need to add a class to the body to later style the menu when it is displayed.

    https://developer.wordpress.org/reference/functions/body_class/

    Just replace the current body markup
    <body>

    by this one

    <body <?php body_class(); ?>>

    Also I think the plugin that is minifying the scripts is breaking a few scripts, can you exclude the file mobmenu.js from that minification. The Minify plugins have always an option for that since they can’t guarantee that the process won’t break any script.

    Give it a try and let me know.

    Ok, fixed!!
    Thank you very much for your great and speedy support despite it was not a trouble caused by your module.
    The solution was to replace
    <body>
    by
    <body <?php body_class(); ?>>

    Now it works correctly displaying not wrapping all body contents in mobile menu divs

    Not necessary to exclude the Mobile Menu js file mobmenu.js from the minifying plugin.

    Thanks again!

    Plugin Author Rui Guerreiro

    (@takanakui)

    @pslcbs That’s great. What matters is that is sorted.
    If you have 2 minutes we would appreciate a review at https://wordpress.org/support/plugin/mobile-menu/reviews/

    Thanks

    Done! 😉

    Plugin Author Rui Guerreiro

    (@takanakui)

    Thanks I appreciate that.

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Javascript is wrapping google tag manager code’ is closed to new replies.