How to fix Google Analytics code?
Nowadays, nearly three quarters of small businesses and virtually all large businesses have a website. The front-facing part of a website is what people tend to pay the most attention to, but it’s essential to know the internal structure of your site to see if it’s helping accomplish your goals. Primarily, you must know what your visitors do when they arrive at your site and how long they spend there.
These aspects of your website visitors’ behavior can be tracked by implementing Google Analytics codes on your website. But Google Analytics isn’t error-free. You could come against related Google Analytics code issues or code that’s added incorrectly. Given the importance of the analytics, these are problems that need to be solved quickly. Here’s how to check Google Analytics code for issues and what to do if you find any.
How can I make sure Google Analytics code is added properly?
As an asynchronous code, Google Analytics can run at the same time as other scripts that are running on the page. If a code takes time to run or has a bug, the other code running asynchronously is unaffected.
You can check if a site uses Google Analytics by looking at its site code. To comb through the code, right-click on a page in Google Chrome or another browser to see its PAGE SOURCE (site code).
Google Analytics tracking information can be found in the code, as shown in the image below:
When you add tags to your website, you will generate a page view for every page that a user navigates to during a visit. This information is processed by Google Analytics, which can deduce a great deal of information, including:
- Overall time spent on your website by a single user.
- The length of time spent on each page.
- The order in which visitors viewed those pages.
- How quickly a user leaves your website.
- What internal links have been visited.
You can dig even further into the analytics, but the information above is useful for any website owner to know.
How to fix Google Analytics code?
There are a few common problems that are associated with Google Analytics code. When the code isn’t functioning properly you aren’t going to get good user data, rendering the analytics basically useless. To avoid that scenario, use the solution below as soon as a problem is identified, and it should clear up the issues you’re experiencing.
Problem: You haven’t installed Google Analytics code properly or it ended up in the wrong code installation.
Solution: First, always check that the appropriate code has been installed for the account that you are currently logged into. Simply navigate to the “Admin” section of your account, which can be found on the right side of the top-level menu. Then select “Tracking Info,” followed by “Tracking Code” in the Property column.
In this section, you’ll find specific instructions and accurate code that’s ready to be copied and pasted, which needs to be installed on every page you want to track. Doing so should fix issues related to improper installation. If you aren’t comfortable working within the back-end of your website, your developer should be involved in the process.
This simple solution should clear up issues, but if it doesn’t you may need to reach out to the Google Analytics team to explore the problem further.
How many pages of your site require the Google Analytics code to be added?
Many website owners know the importance of using Google Analytics, but they don’t know the best practices for optimizing it. If you add new pages, what will happen? Is it essential to include the tag each time? Does every page on a website need to have the Google Analytics code added?
The short answer to those questions is, not necessarily. Implementing Google Analytics can require lots of tedious manual effort for large websites with dozens pages, and all that work may not be necessary.
However, adding the code to every page template is a very good idea. Since the page template has the same header module, you only need to add it once and it will be applied to every page on your site that uses the template.
You’ll need to paste the code into two header modules separately if you have two different page types. And if you have three different page layouts you’ll have three separate header modules and you’ll need to add the Google Analytics code to each one.
Final word on fixing Google Analytics code issues
Google Analytics can seem intimidating if you aren’t familiar with incorporating code. But once you know what to do and where the code is located, it’s fairly easy to correct issues. Now you know what to do if your website traffic appears to have flatlined or dropped off significantly and Google Analytics code is the root of the problem.