Announcement

Collapse
No announcement yet.

Trouble with implementing Google Tag in Genesis (Used Skin:Freshly)

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Trouble with implementing Google Tag in Genesis (Used Skin:Freshly)

    Hello guy,

    I really hope you can help me with this topic as I am trying now for a couple of days implementing my Google Tag code into the header and body as it is described with google. I used for that the instruction: https://sridharkatakam.com/add-googl...-code-genesis/ as well as the instruction by Google and also in Genesis in the Theme Settings (in the header and body).

    All three methods did not work. Now I do not know what exactly I can do to make the Google tag work as I really need it.

    I would be more than happy if someone could help me with that.
    My web page is: https://secrets2trade.com/

    Best regards and a great Sunday,
    Sanjay

  • #2
    You got Super Cache and Autoptimize active. Did you make sure to clear ALL caches and also swipe stored scripts (Autoptimize) after adding that code? Also describing how and which code you put exactly where would really help.

    Comment


    • #3
      Hello SiGa,
      Thank you for your response. Well, let me start by explaining how I placed the code and where exactly. First, this is the code:

      For the head section (<head>):
      <!-- 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-M5CMR4N');</script>
      <!-- End Google Tag Manager -->

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

      I placed the code in theme settings, below under header and footer script. However, for the body part, I looked in my cPanel in the corresponding head.php. However, since I am running with Genesis this did not work. Therefore, I deleted the code.

      Then I found the instruction: https://sridharkatakam.com/add-googl...-code-genesis/
      I thought to simply follow the steps. Therefore I went into my cPanel again in the function.php file (i searched for it) and added the code simply at the end of the whole funtion.php. However, this also did not work as it did not accept this code. Did I maybe insert the code given in the instruction (https://sridharkatakam.com/add-googl...-code-genesis/) in the wrong place?

      Best greetings,
      Sanjay

      Comment


      • #4
        Thanks for the description - that´s very helpful for both you and us (to help you).

        The first two snippets are placed properly (Genesis Theme settings).
        However, the third is not. Dynamik is a bit different than other childthemes and you should NEVER edit core files you´ll find in the theme folder. Those edits will get lost with the next update of Dynamik and some edits might never work if you place them there.

        So, when you follow tutorials saying to place something in functions.php, you won´t need FTP. Instead you go to Dynamik Custom - Functions (Remove whatever you put into function.php file earlier first.). You´ll see two lines there (opening php tag) - don´t touch them. Copy and paste the code from Sridhars tutorial, put it under those two lines. Save. Then don´t forget to clear caches.

        Dynamik Custom tabs give you the places to put pretty much everything - CSS, PHP, JS, Templates, Custom Widgets, Hooks.... Right there in dashboard. No FTP needed.
        Another possible place - if you go with skins - are the CSS / PHP / JS tabs of the skin (in this case PHP button, see comments at the very bottom of the file).
        Last edited by SiGa; 05-15-2017, 03:09 PM.

        Comment

        Working...
        X