2

We have recently had a website redesign, still with the same web address and host. Since launching the redesign Google Analytics has shown a huge drop in visitors, first to half and in the last three days it has shown zero people visited the site.

We know that we have had visitors in the last few days, through social media stats and people contacting us. What has gone wrong and how do we make sure Google Analytics shows the correct stats?

  • It sounds like the redesigned template doesn't have the GA tracking snippet in the <head>. Have you checked to see if it is still there? – Stephen Ostermiller Oct 8 '18 at 10:54
  • To be honest I am a bit confused as to where the template for the homepage is. We have our back end in word press and all the other pages seem to be there but not the homepage. Trying to sort this out with our web designers. – Hannah Broughton Oct 8 '18 at 14:45
  • @HannahBroughton: If you would like to modify any of your Template Files, you would typically find them within the following Directory: /example.com/httpdocs/wp-content/themes/theme-name. As for the <head> Tag, this would be found within the header.php file, within the same Directory. – Craig Oct 11 '18 at 22:53
3

The common issue of this error is that is we forgot to attach the google analytics id again or there is mistake in google analytics tracking code. It has happened to me quite often carefully analyzing should fix the issue.

2

Check the backend of your website and see if there's a tracking code for Google Analytics in it. Aside from that, you can also check the real-time traffic in your site. If it's not fetched while you are on the site (unless you have excluded your IP), the tracking code is missing. Another thing you can do is to check the tracking code info in the admin section of the GA property. It's a function to check if the GA code is properly installed.

might as well check the https and http version (just in case you've also updated the site's SSL)

1

If checking that the correct Google Analytics code is setup does not resolve this, then there is every likelihood that the robot.txt file is currently disallowing indexing of the site. This would be because it was set this way during development.

Often CMSes (like WordPress) will have a checkbox which can be checked to dissuade bots from crawling the site (and Google's bot always honours that).

So check your general Settings in your site to see if this needs to be updated.

0

Google Tag Manager

Firstly, I would suggest downloading Google's Tag Assistant in Google Chrome. You can then head back over to your website, where the Tag Assistant will inform you on whether it can 'see' your Google Analytics Tracking code.

header.php file

Your next port of call is going to be to download FileZilla. This is a free piece of software that will provide you access to all of your Web Files.

Once you have successfully installed this piece of software, you need to log into your server via the File > Site Manager method. This should take you to a screen, which looks something like:

enter image description here

It is important that you do not use the below login area, since this would result in sending your login credentials into 'Cyber Space' in plain text. In other words, they could be intercepted and then used for malicious purposes:

enter image description here

You may need help, from your hosting company, in obtaining the relevant login credentials.

Once you are logged in, you you should see all of your Web files appear within the main screen. Once identified, you need to head to head to your website's theme folder. Its Directory would looking something like:

/var/www/vhosts/example.com/httpdocs/wp-content/themes/theme-name

Just be mindful that your Directory may look a little different.

Once you are within your Theme, you need to find the header.php file. Drag this over to your Desktop and open it up. I would suggest using Notepad++.

You then need to see if the Google Analytics Tracking software is still displayed and that the correct UA has been used.

Google Tracking Codes are vary slightly, depending on the options you have selected within Google Analytics. That said, you would be looking for something like:

<script>
    window.dataLayer = window.dataLayer || [];
    function gtag(){dataLayer.push(arguments);}
    gtag('js', new Date());
    gtag('config', 'UA-xxxxxxxxx-x');
</script>

If your UA is nowhere to be found, then there is your problem. If you are running an eCommerce site, you may have other files, such as header-shop.php too, within the same folder. If this is the case, check such a file to ensure that the Google Analytics Tracking Code is also present.

If you have created a Child Theme, you will also want to check the header.php and any header-xyz.php files there too.

robots.txt

Your robots.txt file would typically be stored within:

/var/www/vhosts/example.com/httpdocs

Again, your setup may be slightly different. Either way, you are looking to get into the folder that houses the wp-admin, wp-content and wp-includes folders. Once you have located the robots.txt file, download it to your computer and see if it contains the following entry:

User-agent: *
Disallow: /

If it does, remove it. Then save the file and drag it back into the Folder you downloaded it from.

Plugins

Some people prefer to use Plugins to manage their Google Analytics. Check your WordPress Dashboard for any Google Analytics Plugins that may either:

  • Contain incorrect information;
  • Have no information stored but is still overriding your own coding.

Either way, deactivate the Plugin and see if this brings about the desired solution,

WordPress Settings

If you are still experiencing issues, head into your WordPress Dashboard. Once logged in, head over to Settings > Reading. Then ensure that the 'Discourage search engines from indexing this site' option is not selected. I doubt this would change anything but worth a shot if all else has failed.

See how you get on with the above.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.