How to Add Google Analytics to WordPress Without a Plugin?

Are you looking for an option to add Google Analytics into your WordPress Site without a plugin? If you are wondering “how to install Google Analytics on WordPress website”, this guide will help you.
Importance Of Google Analytics For Your WordPress Website:
Some of the major benefits of adding Google Analytics code to your WordPress website:
- Identify the traffic sources and the countries where the traffic comes from
- Understand your audience better with Google Analytics integration to WordPress website
- Track the web pages and blogs, and know what type of content generates a lot of traffic
- Track the conversions and revenue generated
- Improve your website user experience
Let’s see how to connect Google Analytics into a website without using any plugin.
Here we go!
Google Analytics 3
You’re only 5 steps away from adding the tracking code manually for your site.
Let’s see what is the best way to install Google Analytics on the WordPress website.
Step #1: Create a Google Account
Create a Google account if you haven’t, and set up a property.
Step #2: Log In To Google Analytics
Now sign into Google Analytics. Select your email address and log in.
Step #3: Get Your Google Analytics Tracking ID & Copy Tracking Code
After you’ve logged in into Google Analytics, go to the Admin at the bottom-left corner of your Analytics dashboard.
You can see three columns in the Admin settings. In the middle column, go to the Tracking Info and then select the Tracking code link.
You’ll be able to see the Tracking Code tab to show your property’s unique tracking ID. You will come across the complete Google Analytics tracking code.
The Tracking Code tab will open and show your property’s unique tracking ID, along with the full Google Analytics tracking code.
After getting your GA tracking code, you will need to copy the full code.
Step #4: Log In To WordPress And Add The Code
Log in the admin of your WordPress website.
Once logged in into the admin panel, go to the Appearance > Theme Editor tab in the sidebar. On this screen, you can see all of your site’s files listed on the right side, and each file’s code snippet displayed in the middle of the page.
If you’re only planning to track visitor activity on some specific pages of your website, then add code in the particular page.
But if you want to add code for the entire site, then click the header.php file along with the right-hand side. Click on it to open and the code editor will be displayed in the middle of the screen.
Find the closing </head> tag. Once you find it, paste Google Analytics tracking code just before the </head> tag. After that click on the “Update File” button to save your changes.
Step #5: Test Your Connection To Google Analytics
After adding Google Analytics code to WordPress, it takes 24 to 48 hours for new data to populate.
So while you won’t see any traffic to your site immediately, you can retest the connection that you have established.
Check by returning to the Tracking Code tab in Google Analytics. To the right of your Tracking ID is a Status Update. To confirm everything is working properly, click on Send Test Traffic. This will open your site in a small window.
If all is well, your account should update to show an active user count of 1. Wow!
If you don’t see user count immediately, be patient. Google says this can take up to a minute.
Google Analytics 4
In GA4, only 2 to 3 steps are different from GA3.
Step #1: Create A Google Account
Same as GA3.
Step #2: Log In To Google Analytics
Same as GA3.
Step #3: Get Your Google Analytics Stream ID & Copy Stream Code
After logged in into Google Analytics, Go to the Admin at the bottom-left corner of your Analytics dashboard.
You would see three columns of Admin settings. In the middle column, click on Data Streams and then click the Web.
After that Add your site URL and click on the “Create Stream” button.
After that go to the “Global site tag” tab and need to copy the full code.
Step #4: Log In To WordPress And Add The Code
Same as GA3.
Step #5: Test Your Connection To GA
After adding Google Analytics code to WordPress, it takes 24 to 48 hours for new data to populate.
So while you won’t start seeing the data on any traffic to your site immediately, you can test the connection you’ve established.
If the active user count doesn’t appear immediately, be patient. Google says this can take up to a minute.
Google Analytics is one of the most well-known web analytics tools in the market. Being powered by Google, it offers valuable insights related to traffic on your site and audience behavior.
Yes. There are several ways to connect Google Analytics with WordPress. The best part is that all of them end up with the same result: The stats of your WordPress website will be tracked and collected in Google Analytics dashboard.
Analytics can be valuable to many different aspects of your website. Any type of site includes four key areas.