If you are a beginner with google analytics, this post would be helpful to you in setting up Google Analytics to your WordPress website without adding plugins. I understand how a newbie finds it hard to find out where is the tracking info in Google Analytics property and then figure out where to insert the tracking code on the website.
That is why you will find this article helpful. Let’s follow step by step with pictures attached below to Set up Analytics for a website (Universal Analytics) in 2 minutes only.
Note: This article is for those guys who have already had Google Analytics Account.
Step 1: Open Admin setting

Log into your Google Analytics account and click on Admin (Gear icon) in the left taskbar at the bottom as the picture above, then click on Create Property (Middle column)
Step 2: Create a property
Fill name for the property and choose the reporting time zone and currency as required in Property Setup

Next, you need to click Show advanced options (below the property-setup fields) and then turn on the switch for Create a Universal Analytics property. Fill the gap as required with the website URL. Next, choose to Create Both a Google Analytics 4 property and a Universal Analytics property as recommended by Google.

After that, you should click Next to switch to About your business below and provide information about your business (This step like a survey from Google), and then click Create

Step 3: Getting tracking code from The Universal Analytics property
Once you click Create after filling in business information from step 3, the two properties have been created. Both these properties have the same name, but Google Analytics 4 property will have a “GA4” designation at the end of its name. Learn more detail about Universal Analytics versus Google Analytics 4 data. In this article, I only guide you on how to get a tracking code from the Universal Analytics property. Follow the pictures below, choose the property with the name you have created without “GA4”

In the property column, you click Tracking Info, and then Tracking Code to see Website Tracking, then copy all code (Google Analytics script) under Global Site Tag (The area I drew a red rectangle)

Step 4: Add the Tracking Code to WordPress
Now, you log in to your WordPress dashboard and navigate to Appearance >> Theme Editor (Or Customize >> CSS/HTML Editor). Then click the Theme Header (header.php) file on the right-hand side below the Tempe Files section.

All you need to do now is to paste the tracking code you just copied from your Analytics profile from step 3 before closing the </head> tag as Google required and then click Update File.

Step 5: Make sure your Google Analytics tracking code works well
Last but not least, do not forget to check to make sure your Google Analytics tracking code works well. After finishing step 4, just relax and wait for around hours and then go back to Google Analytics, navigate to Real-Time >> Overview. A the same time, open an incognito tab (Or Private browsing) to access your WordPress website. If Google Analytics tracking code works well on your site, you can see the number of active users appear on Overview. If so, it means that you are successful on the first step of the journey to becoming a Google Analytics expert. Congratulation!.
