- This topic has 5 replies, 2 voices, and was last updated 4 years, 5 months ago by
Leo.
-
AuthorPosts
-
October 28, 2021 at 2:37 pm #1981338
Mario
Hi there,
I tried to insert the Google Global Site Tag (gtag.js) from my Goggle Analytics admin panel into the header section of my website using a hook as per the advice in the documentation (I set the hook position to wp_head and to Entire Site). However, when I look at the HTML code of the website, I can see that it’s actually located in the body section (after <body>) and the code itself has also changed from what I copied and pasted into the hook text box.
How do I resolve this?October 28, 2021 at 3:17 pm #1981372Leo
StaffCustomer SupportHi there,
However, when I look at the HTML code of the website, I can see that it’s actually located in the body section (after <body>)
That’s not really possible as the
wp_headhook is located here:
https://github.com/tomusborne/generatepress/blob/master/header.php#L17Can you disable all plugins except GP premium to test first?
October 28, 2021 at 3:44 pm #1981400Mario
Hi Leo,
I can’t disable all other plugins – it is a live site. The code in line 313:
}</style></head><body class="home page-template-default page page-id-10914 wp-custom-logo wp-embed-responsive post-image-aligned-center slideout-enabled slideout-mobile sticky-menu-no-transition sticky-enabled both-sticky-menu mobile-header mobile-header-logo mobile-header-sticky no-sidebar nav-below-header separate-containers nav-search-enabled header-aligned-left dropdown-hover full-width-content elementor-default elementor-kit-7434" itemtype="https://schema.org/WebPage" itemscope> <script async src="https://www.googletagmanager.com/gtag/js?id=UA-XXXXXXX"></script> <script>window.dataLayer = window.dataLayer || [];
You can see it is in line after the </head>.October 28, 2021 at 3:50 pm #1981408Leo
StaffCustomer SupportCan you start a staging site so we can go through some debugging tests?
Make sure you are actually using the
wp_headhook:
https://github.com/tomusborne/generatepress/blob/master/header.php#L17and not the
wp_body_openhook which is right after the opening of the <body>:
https://github.com/tomusborne/generatepress/blob/master/header.php#L27October 29, 2021 at 9:10 am #1982970Mario
Hi Leo,
Thanks for the help.
I have made the research on my development site and found that the problem was with a plugin: Asset CleanUp Pro – Move All <SCRIPT> tags From HEAD to BODY – I have disabled.
The analytics code is bak in the head section.October 29, 2021 at 1:03 pm #1983227Leo
StaffCustomer SupportNo problem 🙂
-
AuthorPosts
- You must be logged in to reply to this topic.