YOOtheme Pro is here! The best WordPress and Joomla theme. Learn more

Avatar james.elvidge asked

Where to add these google codes in head and body of Yootheme Pro

Hi,
I need to add these tags and I have no idea where to do this at? I'm using Yootheme Pro with Joomla. I know the one needs to go in the head and the other in the body but where? My index.php file doesn't have a head or body tags. Please oh please help.

Paste this code as high in the <head> of the page as possible:

<!-- 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-WVKKVXW');</script>
<!-- End Google Tag Manager -->

Additionally, paste this code immediately after the opening <body> tag:

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

  • Joomla
  • General Question
  • YOOtheme Pro

Edited

9 Answers

1

Avatar james.elvidge answered

Hi Sascha,
When placing this code in the custom code area how does one piece of code get placed in the <head> and the other get placed in the <body>?

1

Avatar nemanja Support answered

I think those codes go in the footer as asynchromous, i might be wrong

If you want to specifically control them it s best to go in template php

Best would be to place it in the backed as Sascha advised, now if you want something more customized to your needs let me know if you have more questions

Edited

0

Avatar sascha Yootheme answered

Open YOOtheme Pro and go to Settings -> Custom Code and enter the scripts there.

0

Avatar patrick.faasse.70 answered

Hi Sascha,
Adding a head script works that way but how can you add the noscript code just within the body tag. Can you override just the theme.php without having to setup a child theme? Or any other easy way for that matter? I prefer to use as few 3rd party plugins as possible and believe this should be a core template function.
Regards, Patrick

0

Avatar danny.malouin answered

This seems important
I am also trying to configure our Google Tag Manager but can't through the custom code interface.
So, BUMP +1 for me
Danny

0

Avatar danny.malouin answered

BTW; a third party plugin is a solution but I would like to avoid that (yet another extension to manage)

0

Avatar danny.malouin answered

Sasha's solution works only for the first code snippet
I suppose to NOSCRIPT version would need to be added in a module somewhere on top of the site ?

Know someone who can answer? Share a link to this question via email or twitter.