• Resolved hbna

    (@hbna)


    When I installed the Head & Footer code and added css styles to individual pages, everything works fine. When I add the Google Tag Manager code to the head section of the site-wide page, and then click on any external link that is set to target=”_blank”, I see a code at the bottom of the page. It starts with “function() { var filepath?…” like it hasn’t been wrapped in <script> tags. It only happens when I click on an external link. When I remove the target=”_blank” it doesn’t happen. I’ve tried changing themes, deactivating all plugins and then reactivating only the header footer plugin thinking maybe another plugin is creating this issue. I’ve also tried adding the GTM code to another GTM management plugin. Nothing seems to fix this issue except to make external links open in a same window which is not ideal. It seems like the issue appears with the combination of the GTM code (no matter where it is added) and opening an external link. You can see this happening when you go to the site home page I indicated and in the blue “Get Started Online” row, click on the last link in the “Choose an Option” dropdown. That will open a new window. Close it and then scroll down the home page and you will see the code. Anyone have any ideas?

    The page I need help with: [log in to see the link]

Viewing 6 replies - 1 through 6 (of 6 total)
  • Plugin Author Aleksandar Uro?evi?

    (@urkekg)

    Hello @hbna,

    Thank you for choosing Head & Footer Code for your project!

    Issue you experiencing is not caused by our plugin but prove that it works as expected (injects GTM tag on pages).

    Anyway, make sure you wrap to the <script></script> the JS code in GTM Tag #42 within GTM container GTM-527QQ79 as that one injects to the page footer unwanted code visible to visitors:
    https://drive.google.com/file/d/1MO1hoHkFLhMpaF1n6P3j31cB23ntyf8r/view?usp=drive_link

    Please let me know if you have any further questions.

    Aleksandar

    Thread Starter hbna

    (@hbna)

    I loaded a completely new WordPress Install, starting from scratch. I did nothing to the install. Right after that, I downloaded your plugin with no other plugin added. Then I created an external link with target=”_blank” on the new home page. Then I clicked on the link and came back to the page the link is on and got the same code in the footer of the new site. https://physicianb1dev.wpenginepowered.com/

    • This reply was modified 9 months, 2 weeks ago by hbna.
    Plugin Author Aleksandar Uro?evi?

    (@urkekg)

    Sure, because on the clean new website you also load your GTM container GTM-527QQ79, which has a Custom HTML tag (ID 42) which injects to page plain JS code:

    function() { var filepath = https://www.facebook.com/.pathname.split("/"); var filename = filepath.pop(); var decodedFilename = decodeURI(filename); return decodedFilename.indexOf(".") > -1?decodedFilename:'n/a'; }

    as you can see on screenshot https://drive.google.com/file/d/1aFYQTnYJXN3IMNEu9AZE6F3WdZZaRph2/view?usp=drive_link

    If you remove the GTM container snippet from the Head & Footer Code, or pause the Custom HTML tag with ID 42 and publish the container, there will be no code injected when you click on target="_blank" links.

    After all, are you okay to find Custom HTML tag with id 42 in your GTM container GTM-527QQ79 and provide screenshot of that tag content?

    Thanks,

    Aleksandar

    Thread Starter hbna

    (@hbna)

    Well I created a new GTM and installed it and could not duplicate the issue. So sorry to bother you with this. Its in our GTM code tags that have been created over the years.

    Thread Starter hbna

    (@hbna)

    I like your Head and Footer code. It has been very helpful for me over the years.

    Plugin Author Aleksandar Uro?evi?

    (@urkekg)

    Tha are great news, thank you for your confirmation.

    If you don’t mind, feel free to review Head & Footer Code plugin

    Cheers,
    Aleksandar

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Wierd function code appears at bottom of site after installing GTM’ is closed to new replies.