Archived topic
Google Tag manager code insertion breaks frontend header/menu
6 replies · Started by Morten on October 18, 2019
Hey! I've added two hooks to my side:
The main google tag manager code in the WP_head.
And the fallback code in before_header with priority 0.
But when i do, my frontend menu/navigation breaks. The main navigation jumps down below the logo, and the sticky menu disappears completely. Is this a known thing, and what can i do to get out of it? I'd prefer not to add any code manually, and i have no php knowledge.
I've disabled the hooks for now, as our site can't run with them enabled, obviously :P
Hi there,
instead of the before_header hook select Custom Hook and add: wp_body_open
This will be included in the Hook list in the next update.
Hi David,
I just did that, breaks my site in the same way as before.
Hi again David,
Could it be something as simple as removing the (i guess obsolete)
<!-- Google Tag Manager -->
<!-- End Google Tag Manager —>
from the code snippet? Or will that break the google code instead?
I think that worked, still testing.
Can you share the exact code you're adding to the Hooks ?
When adding code in the forum, please highlight the code and hit the Code button.
Same problem here. The menu in frontend disappear after inserting the Google Tag Manager code as mentioned here: https://docs.generatepress.com/article/implement-google-tag-manager/
How did you solved this?
Hi there,
if you want to start a new topic where you can share a link to your site with the 'broken' code in place and i can take a look at what the issue is.