[Support request] HTML Tag removed from Theme Header (Google Analytics and Google webmaster)

Home Forums Support [Support request] HTML Tag removed from Theme Header (Google Analytics and Google webmaster)

Home Forums Support HTML Tag removed from Theme Header (Google Analytics and Google webmaster)

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #1519211
    kyle

    Hi there, I have no idea why, but my HTML tag for google webmaster tools and google analytics was removed from my theme header? How is this possible???

    #1519227
    David
    Staff
    Customer Support

    Hi there,

    how was the code added to your site ?

    #1519241
    kyle

    It was added through the theme editor and has been active for about 8 months. And all of a sudden disappeared.

    #1519279
    David
    Staff
    Customer Support

    You should never make direct edits to the parent Theme files as they will be lost when the theme is updated. Changes to theme code should only be done with a Child Theme.

    However, for adding GT / GTM codes to the site – this guide explains how to do that with hooks.

    https://docs.generatepress.com/article/implement-google-tag-manager/

    Simple rule with Hooks for adding code – you can use these hooks:

    wp_head – for code inside the <head></head>
    wp_body_open – for code immediately after the opening <body> tag
    wp_footer – for code in the footer before the closing </body> tag

    Using the Hook method will not be affected by Theme updates.

    #1519948
    kyle

    Thankyou that worked, i got a firght and thought all my data was lost!

    #1520250
    David
    Staff
    Customer Support

    Glad to be of help!

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