Site logo

Archived topic

google analytics issue

3 replies · Started by liz on November 16, 2021

Viewing posts 1–4 of 4

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!

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.

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.

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. :D

This archived topic is closed to new replies.