Wordfence Issue when header and footer plugin is active

Having an issue adding code via a header and footer plugin.

  • Jonathan Solorzano
    • Staff

    Hi Shop ,

    Thank you for reaching out to WPMU Support!

    I'm sorry for the trouble you are having with the header/footer plugin. In order to better assist you, could you please provide me with the actual code used that generated the warning message?

    When doing a quick test, the code tag <h1>Test</h1> was added to the header/footer plugin and no issue was encountered. So it seems it might be related to the specific code you used.

    Please also wrap your code using our code tags(view screenshot) that are inside this ticket's text editor, so that the code you include is properly formatted and can be sent without any issue.

    I will then proceed to replicate the behavior and troubleshoot it further.

    Look forward to your response.

    Best,

    Jonathan S

  • Shop
    • Flash Drive

    Hi Jonathan
    Thanks for getting back to us the code we where trying to add is below.
    One thing we though was odd was we dont have wordfence installed on the site so unsure why it is slowing up.

    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-W9BX4G6');</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-W9BX4G6"
    height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript>
    <!-- End Google Tag Manager (noscript) -->
  • Jonathan Solorzano
    • Staff

    Hi shop,

    Sorry for the delayed response.

    Could you please provide me with support access so that I can test the code you provided. The previous access expired and the WP admin credentials you had share through a previous chat with the username info@ is currently not working.

    Look forward to your reply.

    Best,
    Jonathan S

  • Shop
    • Flash Drive

    Hi Jonathan
    Thanks for getting back to me.
    I've extended the support.
    I've also used a different plugin to add the GTM id to the site, but am curious as why wordfence would be displayed when the plugin isn't added to the site.

  • Jonathan Solorzano
    • Staff

    Hi shop,

    Thank you for providing that information.

    So I've done a few tests as well as re-checking your Cpanel configuration and here are my findings:

    1) Wordfence is not setup inside the shaneblack.ie site. However, there is a code added to the htaccess main file inside your hosting configuration(location:disappointed:home/thewebs3/public_html/.htaccess) - This is what is throwing the warning.

    2) The current GTM plugin you setup seems to work with GTM tags, but the actual code is currently not working properly. You could probably use GTM preview mode(https://support.google.com/tagmanager/answer/6107056?hl=en) and verify if the actual container is working on your site.
    I'm using Chrome's Tag assistant extension and can see the GTM tag is not firing correctly. When looking at the code properly, the call made to https://www.googletagmanager.com/gtm.js?id=GTM-W9BX4G6 is not returning correctly.

    What I recommend is the following:

    a) Verify the actual GTM tag provided or given to you is a valid tag(check the container and its setup to make sure its valid)

    b) Resend me the GTM code so that I can troubleshoot it further by removing the Wordfence code from the .htaccess file.

    Look forward to your reply.

    Best,
    Jonathan S

  • Shop
    • Flash Drive

    Hi Jonathan
    Thank you so much for looking into this further
    The code provide by the client fro GTM is below:

    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-W9BX4G6');</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-W9BX4G6"
    height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript>
    <!-- End Google Tag Manager (noscript) -->
  • Jonathan Solorzano
    • Staff

    Hi Shop ,

    The current GTM tag your client has provided is not working. This tag is either not activated or published.

    I went ahead and created a test account(using my credentials) in https://tagmanager.google.com/ and generated a GTM tag. I was able to add the tag and test it using the header/footer plugin and compared it to the client's tag that was added with the GTM plugin. You can see that my GTM is serving without any issue(shows green), but the client's tag is having errors.

    Please reach out to client and have them verify that the GTM container for the tag they provided is active and/or published properly. You can refer to this article for additional details: https://support.google.com/tagmanager/answer/6107163?hl=en

    In regards to the Wordfence setup, I was able to add my test tag using the header/plugin because I temporarily removed the Wordfence code that was causing the block. I then added my GTM test tag, saved it, and added the Wordfence code back to the site setup. I did not remove any Wordfence files or plugin because your hosting site structure using the main site thewebsiteshop.ie has Wordfence setup for all the other subdomains.

    Removing them would affect those sites as well. I recommend verifying with the web admin who setup the hosting site structure in your hosting to understand how the Wordfence is setup in order to avoid any future issues with additional codes added to your other sites.

    Please let me know once the client has provided you with an active working GTM tag so that I can proceed to add it for you on the header/footer plugin and test it.

    Best,
    Jonathan S

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.