Site logo

[Resolved] WPcode light

Home Forums Support [Resolved] WPcode light

Home Forums Support WPcode light

Viewing 15 posts - 1 through 15 (of 23 total)
  • Author
    Posts
  • #2517170
    Michael

    The Google ads support team asked me to install the WPcode light plugin to add some header and footer code. However, the plugin didn’t work. Is this because there might be a conflict between the plugin and generatepress? Is there another way to add code to all headers and footers?

    Thanks,

    Michael

    #2517296
    Leo
    Staff
    Customer Support
    #2536682
    Michael

    I regret I need more help on this:

    (It’s Google code to track Google ads)

    I need to add this code in the Global head section of the website above the closing head tag </head> :

    https://jsfiddle.net/4Lh7zvkn/

    Additionally, paste the code in the Global footer section of the website above the closing body tag </body>:

    https://jsfiddle.net/yfzb86gL/3/

    Can you give me more specific instructions on how to do this? I haven’t managed to get this from the articles you referenced

    Michael

    #2536732
    David
    Staff
    Customer Support

    Hi there,

    1. go to Appearance > GeneratePress and Enable the Elements Module.

    2. in Appearance > Elements -> Add New –> Hook Element.

    https://docs.generatepress.com/article/hooks-element-overview/

    3. In the Text Area paste in the code that you need to add before the </head> tag.

    4. Set the Hook to: wp_head

    5. Set the Display Rules to Entire Site

    6. Publish that element.

    Then repeat the above steps from step 3 for the second code, changing these points:

    3. In the Text Area paste in the code that you need to add before the </body> tag.

    4. Set the Hook to: wp_footer

    #2539560
    Michael

    Thanks that looks great,

    I’ve added and published, however, a question on reflection:

    I didn’t give the hook a name; does that matter,

    Michael

    #2539702
    David
    Staff
    Customer Support

    It doesn’t matter, as WP will just create a no title slug for it.
    But you can go back and edit the element, and give it a title for future reference.

    #2541771
    Michael

    Unfortunately, https://jsfiddle.net/4Lh7zvkn/ is now viable at the top of every page (for a viewer) and Google says the tags aren’t firing), can you tell me what I’ve done wrong?

    Michael

    #2541772
    Michael
    #2541830
    Ying
    Staff
    Customer Support

    Hi Michael,

    What’s the exact code you pasted in the hook element?

    #2542238
    Michael

    This was the full instructions from Google

    (I’ll have a look to see if I’ve made any obvious errors)

    Paste the code in the Global head section of the website above the closing head tag </head> :

    https://jsfiddle.net/4Lh7zvkn/

    (Please click on the above mentioned link to access the code )

    Additionally paste the code in the Global footer section of the website above the closing body tag </body>:

    https://jsfiddle.net/yfzb86gL/3/

    (Please click on the above mentioned link to access the code )

    Kindly revert as soon as the codes have been added to the backend of your website so that I can check from my end and see if the codes are firing as expected..

    #2542484
    David
    Staff
    Customer Support

    Can you provide a screenshot of the GP Hook elements, where you added the codes ?

    #2542615
    Michael
    #2542929
    David
    Staff
    Customer Support

    Ah ok, in the JSFiddle links, you will see the code eg.

    <!-- Google tag (gtag.js) -->
    <script async src="https://www.googletagmanager.com/gtag/js?id=AW-1072711480"></script>
    <script>
      window.dataLayer = window.dataLayer || [];
      function gtag(){dataLayer.push(arguments);}
      gtag('js', new Date());
    
      gtag('config', 'AW-1072711480');
    </script>
    

    That is what needs to be added in the Hook Element, NOT the URL to the jsfiddle.

    #2542966
    Michael

    I’m sorry, would you clarify a question?

    Does the code you’ve given me go in both the header and footer or are there different codes for each?

    Michael

    #2543370
    Fernando
    Customer Support

    Hi Michael

    Try hooking the code here to wp_head: https://jsfiddle.net/4Lh7zvkn/

    Whereas this one, try hooking the code to wp_body_open: https://jsfiddle.net/yfzb86gL/3/

Viewing 15 posts - 1 through 15 (of 23 total)
  • You must be logged in to reply to this topic.