[Resolved] google analytics issue

Home Forums Support [Resolved] google analytics issue

Home Forums Support google analytics issue

  • This topic has 3 replies, 3 voices, and was last updated 2 months ago by Elvin.
Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #2007141
    liza

    Hi,

    The google tag manager code is not showing up on my site when I viewed the page source.I placed my google analytics global site tag on my website using generatepress editor a year ago. Now, google analytics notified me that my website is not receiving hits..so I wanted to add again the global site tag using Gneratrepress theme editor..but I can’t find the head.php anymore..have there been some changes? please help. Link to the website is in the private info field. Thanks!

    #2007163
    Leo
    Staff
    Customer Support

    Hi there,

    The code should be added using the hook element module:
    https://docs.generatepress.com/article/hooks-element-overview/

    The wp_head hook would be what you are looking for:
    https://docs.generatepress.com/article/wp-head/

    Reference:
    https://github.com/tomusborne/generatepress/blob/master/header.php#L17

    If you added the code directly to the parent theme’s header.php file before, it would be erased during updates.

    It’s never a good idea to edit the parent theme’s core files.

    #2008849
    liza

    Hi,

    Thank you..I did exactly what you told me but the google tag manager code is still not visible when viewing it via “view page source.” Thanks.

    #2008940
    Elvin
    Staff
    Customer Support

    Hi Liza,

    What Leo mentioned may have been the case. It it is indeed what happened, I’m afraid we can’t recover the previous files that were erased when the theme updated.

    You’ll have to get the appropriate google tag manager code again from Google and place it abiding by good practice it won’t be a hassle in the future.

    Reminder: In the future, please make sure to use a child theme’s functions.php or a Code Snippets plugin to add your codes in so this doesn’t happen again. 😀

    A wise man once said:
    "Have you cleared your cache?"

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