Setting up Google Tag Manager

Hi guyz!
I want to setup google tag manager but the description google offers seems not to work for me/our theme. Google says to implement tag manager snippet after opening <body> tag. I'm using the child theme so I had to look for the body tag. Found it in header.php but I'm not sure if it's right and where to insert it exactly.. Could you please support?
thx in advance!

Comments

  • Hi,

    as you wrote above, you must paste the code right after the <body> tag. But please notice that we do not offer any files modifications so you must do all changes yourself at your own risk. But if you don't know how, then you must contact with your website developer.

    Thanks for understanding!
  • edited July 2015
    Ok, I understand. But the body-tag is not visible as quoted by you above. Could you please give a hint?

    In the header.php it looks like this:

    <!-- body -->
    <body <?php body_class(); ?>>
    ...

    Is it right to put code after that??
  • *** SOLVED ***

    You can go to: Design - Theme Options - Global - Hooks - Top  and paste Google Tag Manager Code in custom field to be executed after opening <body> tag
  • We're glad to hear that you found the right section :)
  • Just use the plugin DuracellTomi's Google Tag Manager for WordPress - you'll find it in the plugins directory.  https://duracelltomi.com/

    Use the file injection method and insert your GTM-Code - it works fine.

    Rashid.


  • Rashid - yes, you can do it that way. But, while I'm not an expert Wordpress developer, I can tell you that best practice with Wordpress development is to use as few plugins as possible. Actually, funny thing is that the reason I'm on this page is because I've been using a wordpress plugin to insert GTM onto a Betheme site ("Insert Headers and Footers") and was checking to see if there was a way to handle GTM injection via default Betheme. Turns out there is. 

    I appreciate paderdeko posting the solution. Super helpful. I'm doing that now and will then deactivate the Insert Headers and Footers plugin. Once I've confirmed that GTM is functional on the site I'll then delete the plugin. I'm trying to reduce the number of plugins active and installed on my site(s).
  • Hi, what about the javascript? Where should I put that?
  • epicroofing
    Hi,
    javascript can be pasted in theme options>custom css&js>JS
    thanks
  • Hi,

    I tried adding the Google Tag Manager script by following both of the two options suggested in this thread: 

    1. Design - Theme Options - Global - Hooks - Top
    and 
    2. javascript can be pasted in theme options>custom css&js>JS

    It does not seem to work, I can't see the tags in the Google Tag Assistant. Are there any other solutions?

    Thanks!

    Regards,
    Ella
  • You can insert it into Theme Options > SEO in Google | Remarketing field.
    It will place this code before the closing </body> tag, so it have to work.

    Thanks
  • I doesn't work for me. I tried both but Google doesn't fire any of it. Please help.
  • Please always attach a link so we can check it out. If the page is offline(localhost) then our help will be limited, you will have to contact us when the page is online. Also please make sure that the page is not under maintenance before you provide us the link.
    It is always a good idea to also attach a screenshot, for that use services like snag.gy or pasteboard.co
    thanks
  • Hi, I tried all solutions above and my code doesn't appear except for the commentary :

    <!-- Global site tag (gtag.js) - Google Analytics -->

    Any idea why ?
  • Hello @jbnews,

    Please always attach a link to your website so we can check it out. If the page is offline(localhost) then our help will be limited, you will have to contact us when the page is online. Also please make sure that the page is not under maintenance before you provide us the link.

    It is always a good idea to also attach a screenshot, for that use services like snag.gy or pasteboard.co

    thanks

Sign In or Register to comment.
This website uses cookies

We use cookies to personalise content and ads, to provide social media features and to analyse our traffic. We also share information about your use of our site with our social media, advertising and analytics partners who may combine it with other information that you’ve provided to them or that they’ve collected from your use of their services.

Cookies are small text files that can be used by websites to make a user's experience more efficient.

The law states that we can store cookies on your device if they are strictly necessary for the operation of this site. For all other types of cookies we need your permission. This means that cookies which are categorized as necessary, are processed based on GDPR Art. 6 (1) (f). All other cookies, meaning those from the categories preferences and marketing, are processed based on GDPR Art. 6 (1) (a) GDPR.

This site uses different types of cookies. Some cookies are placed by third party services that appear on our pages.

You can at any time change or withdraw your consent from the Cookie Declaration on our website.

Learn more about who we are, how you can contact us and how we process personal data in our Privacy Policy.

Please state your consent ID and date when you contact us regarding your consent.