-
AuthorPosts
-
August 18, 2019 at 9:14 pm #1128729
Hi,
I try to install the google Tag manager, I don´t know if it happens because its not the final domain yet.
I past the head code in enfold google service and the body code in child Theme functions.php
But it seems not to work.
August 19, 2019 at 3:44 am #1128789Hey jillinnemann,
Where exactly is that code supposed to go, into the header? If so then we can give you a function to try out.
Best regards,
RikardAugust 19, 2019 at 5:41 pm #1128963the second part needs to be before die Body tag.
I red the first part of the header code is finde in your google service section.August 20, 2019 at 5:37 am #1129109Hi,
Ok, please try this in your functions.php file:
function jillinnemann_google_script(){ ?> <!– 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-5R2C5XW’);</script> <!– End Google Tag Manager –> <!– Google Tag Manager (noscript) –> <noscript><iframe src=”https://www.googletagmanager.com/ns.html?id=GTM-5R2C5XW” height=”0″ width=”0″ style=”display:none;visibility:hidden”></iframe></noscript> <!– End Google Tag Manager (noscript) –> <?php } add_action('wp_head', 'jillinnemann_google_script');
Best regards,
RikardAugust 20, 2019 at 10:36 am #1129170Maybe its because this Sektion needs to be in the body, not the Header?
The Header code is fine and can be insert into google service.
may be this part needs a change?add_action(‘wp_head’, ‘reybex_google_script’);
—————August 20, 2019 at 10:36 am #1129171it needs to be close to the opened body tag
August 20, 2019 at 10:48 am #1129182still same error
August 20, 2019 at 1:25 pm #1129209Hi,
Thanks for that, but we can’t guess where it’s supposed to go. Could you check the documentation to see where exactly it’s supposed to go?
Best regards,
RikardAugust 20, 2019 at 1:50 pm #1129217Here is the documentation:
https://www.dropbox.com/s/en5yhaeu8u5uhqf/Bildschirmfoto%202019-08-20%20um%2013.49.20.png?dl=0August 21, 2019 at 6:09 am #1129440Hi,
Please try this instead:
function jillinnemann_google_script_after_body(){ ?> THE SCRIPT WHICH IS SUPPOSED TO GO AFTER THE OPENING BODY TAG GOES HERE <?php } add_action('wp_body_open', 'jillinnemann_google_script_after_body');
Make sure that you are running WordPress 5.2 or higher, otherwise it won’t work.
Best regards,
RikardSeptember 20, 2019 at 5:50 pm #1140280Hi,
I’m not able to use the hook'wp_body_open'
, whereas'wp_head'
and'wp_footer'
works fine.Running WordPress 5.2.3 with Enfold 4.2.6.
No child theme.Any suggestion?
Thanks!September 23, 2019 at 6:21 am #1140831 -
AuthorPosts
- You must be logged in to reply to this topic.