First, what is google analytics: this is a web analytics service that provides essential analytics tools and statistics for Search Engine Optimization (SEO).
In this article, I will show you step by step guide on how to add google analytics to your website or WordPress without a plugin.
It is ok to use a plugin, but the disadvantage of a plugin is that it makes your website heavy and slow. But I can show you how to do this manually.
Simple Steps In Adding Google Analytics To Your Website Or WordPress
Step1: Sign up for google analytics @ Sign up. Before you can do this, you need to have an account to be able to sign up. Sign in if you have a google account, or create an account. I will assume you have a google account. Proceed to sign in
You have to understand that there is an updated version of google analytics called GA4. This is a new design for the future of measurement. It collects both website and app data to better understand the customer’s journey.
Step2: After signing into your Google account, go ahead and click start measuring
Step3: In the next slide, you input your property name, change the time zone to your country’s time, and also choose a currency.
On that same page, click on the show advance option and put ON the create Universal Analytics Property on the right-hand side of the screen. The Universal Analytics Property option is for the old google analytics, and the updated version is the Google Analytics 4. The Universal Property will be phased out on the 1st of July, 2023.
Input your website URL and click on next.
Step4: In the next stage, just go ahead and check the boxes you think or you want google analytics to track its activities, then click create below.
After clicking create, your google analytics should be ready for use.
After creating your google analytics, the next step is to locate your tracking ID or measurement ID
Step 5: If you are using GA4, which is the latest google analytics, it is called measurement id, which is what I will be talking about. To locate it, click on the Admin which is found in the lower left corner of your google analytics page
After clicking the Admin, the next page which will appear will look like this
Go ahead and click on the data Streams. The Data Streams is where you will find vital informations.
After clicking on the Data Streams, click on the dropdown below add Stream, there you will find your
The stream id is like your tracking code, which is what will be used in configuring your website. When using a plugin, you only need the measurement id, but since we are configuring this manually there will be a little scripting involved. Don’t worry about the scripting, the script is already written, and all you have to do is copy and paste.
On that same page, scroll down and click on Global sit tag. There you will see the script and a copy button, copy the script.
The copied script will be inserted into the <header> of your website themes. Before you do this, be sure to back up your website themes because a little mistake can sure mess up your website.
If you are using WordPress, I will show you in a second where this script copied from your google analytics will be placed.
In your WordPress, go to Appearance, then click on Theme File Editor
On the next page by the right-hand side of the screen, click on the header.php, there you will see a bunch of scripts. Go to the header closing tag, i.e </header> inside there you can paste the script copied from your Google Analytics page
After pasting your script from the GA4 page, just go ahead and update files. Don’t forget to back up your files before editing.