GA disappeared with the theme update

Dear support team,

I have several issues from the recent update.

  1. Google Analytics code. My code disappeared and none of the plugins work for me. I was trying to manually insert the code in /framework/views/header/base.php as it was suggested in one of the topics, but it didn’t work. I’ve installed child theme as per suggestion in another forum thread, but it removed my main menu and brought a few more unexpected issues mentioned further, so I uninstalled it.

  2. After installing the childs’ theme I started getting on my homepage recent posts Permalink to, images became darker and white image icon appeared in the center. I found on this forum JS Global how to remove permalink to, but the darken images with icon remain there.

Hope to hear from you.

Thank you for your time :slight_smile:

Hello @Natalia.sipcova,

Thanks for asking and apologies for the problems you are facing.

  1. First, you should never add codes directly in theme files because when you update the theme, there is a high probability of those files getting replaced and thereby breaking the workflow of website. That’s why we always recommend users install and use Child theme.
  2. Installing child theme in a normal situation should not break the website as the job of child theme is to inherit the functions of parent theme. Until and unless you made changes, installing child theme generally won’t break website.

To add Google Analytics code, please add following code in child theme function.php file:

add_action('wp_head', 'wpb_add_googleanalytics');
function wpb_add_googleanalytics() { ?>

// Paste your Google Analytics code


<?php } ?>

Replace // Paste your Google Analytics code with the tracking code.

I see that you haven’t installed Child theme on the website. Please make sure to install and setup child theme. I am sharing the relevant resources that you can use to install and setup child theme.

https://theme.co/apex/child-themes

You also have the option to use plugins like Insert Headers and Footers to add Google Analytics plugin. In case you are interested, please take a look at following source.

Thanks.

Thank you @Prasant for your prompt answer. I activated the child theme again and now I am back to same issues:

  1. When I insert the code suggested by you together with my GA tracking code, it gives a message: “Scrape nonce check failed. Please try again.” (Edit: Inserted code via FTP)

  2. The main menu is disappeared and instead there are words: “Assign a menu”.

Thank you for your time

Warm regards,
Natalia.

Hi again,

  1. Can you please try following https://wordpress.org/support/topic/scrape-nonce-check-failed-please-try-again/ if this doesn’t help then try adding the code via Appearance > Editor > functions.php

  2. That’s the default behavior, when you activate the child theme for the first time you’ll need to re-assign the menu. Just re-assign the menu.

Hope this helps!

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.