Small businesses sometimes have to choose the DIY route for SEO due to limited marketing capital. But most of them jump head over heels without even knowing the basics. Like, where is the Google analytics code, or how it works? On other occasions, businesses might take over a website or acquire it. How do you detect the analytics code so that you can change the ID?
Google Analytics is the cornerstone of successful optimisation. 56% of websites on the Internet use it. That’s because it is very effective, and 100% free. Why wouldn’t you leverage the power of such a strong analytics tool when you have it at your disposal? Without it, your SEO optimisation efforts are half-baked. You will be taking action without any idea of their outcome. That’s regardless of whether it is positive or negative. In other words, feeling your way around in the dark. That’s something that we don’t recommend one bit.
If you have struggled to know where is the Google Analytics Code and how to install it on your site, then here’s some help.
What is the Google Analytics code?
Where did the traffic originate from? Was it Google search or paid ads? What browser are the visitors using? How much time did the visitor spend on your site? Did they bounce back immediately? What link did they click on?
The data is granular and priceless from an SEO perspective. Besides, Google analytics connects with a plethora of Google Products, like Google ads and the Search Console. That’s why important to know where is the Google analytics code, and how to install it.
Where is the Google Analytics code found?
Coming on to the most important part of this article. Where can you find the Google analytics code? We are going to look at this from different perspectives and common scenarios.
Finding the Analytics code for newbies
Do you have a Google Analytics account? If you don’t, then head to the GA website and sign up for one. You will have to enter your account name, the website URL, the industry and the time zone that you want the reports in. Google will show you the terms and conditions. Once you hit accept, the software will generate two important things.
- Your Tracking ID – This is a string of numbers followed by UA. Something that looks like UA-xxxxx-1. In this case, the xxxxx is your personal account number. The second set is something called property number, which again is unique to your account.
- Universal Analytics Tracking code – This is your Google Analytics code. You will see a recommendation from Google to install this on every page on your website. But there are easier ways to get this done.
Congratulations! You’ve just found the answer to ‘Where is the Google Analytics code’.
Where is the Google Analytics code on an existing website
If you have recently acquired a website, you’d want to change the GA code to your own. Else, Google will send the tracking data to the person who’s tracking ID is in the code. We recommend taking a look at the <head> tag for HTML web pages. You will find it in the Header.php file on WordPress sites.
Finding it is relatively easy. Look for code that begins with the following string.
<!—Global site tag (gtag.js)
It will end with </script>. Just above this line in the code, you will find the tracking ID. All you need to do is swap the ID with your own one. But to be doubly sure, you can just swap the entire code snipped with your own.
Where is the Google Analytics Code installed & how?
Google analytics code installation is critical. It is the most important part of tracking. Time and again, we have seen experienced web developers goof up with code installation. Sometimes, they don’t paste the entire code. We have even seen the incorrect placement of code. In either of these cases, the code won’t work.
That’s why we have a team of skilled web developers at Rockstar Marketing, who work with our SEO team. The SEO team sets up the GA account and collects the code. But it’s our developers who overlook everything to rule out misplacements and errors.
Coming back to installations, here are some of the common ways in which you can install Google Analytics code.
Installing on a static website
On a static website, your web developer will have to manually add the GA code to the <Head> tag. There is no ideal position within the tag to place the code. The only thing to watch out for is that the code is complete. Also, it should be pasted before the </head> tag is closed.
The Analytics code is pasted in the head to ensure that the code fires even if the visitor exits the page before the rest of the page’s content loads. However, most websites these days use CMS. There are various ways in which you can install Google Analytics code on CMS websites.
Using Google Tag Manager
Google Tag Manager is a free tool that makes complex tag installation easy. You can use it to install your Google analytics code and a whole bunch of other tracking codes. For instance, Facebook Pixels. In addition to this, you can also add specific codes for remarketing and event tracking. For example, tracking the number of times someone downloads a file. In normal circumstances, you’d have to manually paste the code on each download link.
But with Google Tag Manager, you just need to add one new tag. It automatically updates and tracks all downloads. The first thing to do is set up a ‘Tag Manager account’. You can sign up using an existing Google account as well. Once the account is set up, it’s time to create a container.
The container is essentially a box that comes preloaded with all the macros and rules for deploying tracking code. You can use new containers to install each new code on your website. Give your container a name, select where you will be using it and hit create. This is where things can get a little tricky.
Two Snippets of Code
The Google Tag Manager container is two snippets of code. One goes in the header and the other in the body tag. If you have a static website, your developer will have to manually paste these codes on all the website pages. The caveat is that you don’t need to paste the Google Analytics code then. All you need is the tracking id which you already generated.
Head to the ‘Google Tag Manager’ dashboard and click on ‘New Tag’. Choose Configuration and select Universal Analytics. Then click the Google Analytics setting and hit ‘New Variable’. You will see a box where you can enter your tracking ID. Now, click on ‘Triggering’ and select ‘All Pages’ under ‘Choose a trigger’.
You’ve just set up Analytics to track all web pages on your website. Here’s the great part about Google Tag Manager. Every time you want to track a new property, you just need to create a new tag and add the tracking ID.
Last but not the least, you can use plugins to install Google analytics. The advantage with plugins is that it’s copy-paste. You will not have to fiddle with code and wonder where is the google analytics code anymore.
Just install the plugin and paste your code. That’s it. The disadvantage is that plugins can be clunky. Some of them bloat your WordPress installation slowing it down. A lot of them offer limited features in the free version. You’ll have to subscribe to get access to more advanced features.
That said, you can always read reviews before selecting a plugin. Here are some plugins that we’ve used in the past (please be aware that we are not affiliated with any of them):
- GA Google Analytics – Very lightweight plugin that does not add bloat. It’s GDPR compliant too.
- Google Analytics by 10Web – Offers a decent free version. The premium version costs $30 though.
- MonsterInsights – Hands down, the most popular plugin for tracking. It is loaded to the brim with features. But the premium version costs $99.50/year.
Before we end this guide, here’s a final tip. Always verify whether the code is working properly. One way to do this is login to Google Analytics and check real-time data. But there’s an easier way. Use ‘Google Tag Assistant’, a free chrome extension offered by Google. Once you install the extension, just load your website. The assistant will check and verify analytics tags and display any errors promptly.
To sum it up
We hope that this brief guide helps you find where is the google analytics code. Ensure that you install the code properly and verify whether it is working. In case you are inexperienced, we recommend working with a professional SEO team. Rockstar Marketing works with businesses of all sizes. We have flexible pricing packages that can fit into your budget. Speak to us now.