How to add Google Analytics into website.

Inserting Google Analytics into the website is important for most web managers. Google Analytics has been increasingly improved, from the interface to the measurement features in the new version, Google Analytics 4. In this article, I will guide and make sure you can insert Google Analytics into your website such as WordPress.

A quick introduction to Google Analytics

Google Analytics is the forefather of measurement and statistics tools for website. Since Google Ads was born, Google analytics has also become a great assistant for conversion measurement and generating volume files for remarketing

The usual metrics we will be concerned about are as follows: 



-Page loading speed

-Page viewing time


More advanced metrics you need to measure events to see:



-Behavior flow

But in this article, I only focus on guiding you to insert Google Analytics into your website. For more details about measurement in Analytics, perhaps I have to do another article because it is very diverse.

Now, let’s start inserting Google Analytics into your website. 

How to generate and get Google Analytics code

The first thing we need to do is get the Google Analytics code. If you have never created a Google Analytics account, please see the instruction below. 

Create a Google Analytics account

Actually, your Gmail account is your Analytics account, unless you don’t have Gmail, just create it. Use your Gmail and start following the instructions.

Step 1: Go to and click the Start Measuring button 

Step 2: Enter your Account name and then click Next

Step 3: You enter an arbitrary property name, select the time zone as Norway GMT+02 and select the currency as Norwegian Krone. Then you click the Next button.

Step 4: You select the Industry Category and Business Size suitable for your website and then click Create. 

Step 5: You check the 2 terms boxes and click the I accept button 

After completing this step you will be transferred to the management interface inside, please do the below to get the Google Analytics code.

Get the Google Analytics code

Step 1: You go to Administration (settings icon) and then click on Data Streams of the property. Then you choose Web.

Step 2: You enter the website domain name in the website URL, and enter the arbitrary Stream Name. Then you click Create Stream.

Step 3: This is the data stream you just created. Click on it to get the measurement tag code.

Step 4: You copy the Measurement Tag Code or the Measurement Code ID, depending on how you insert it into the website as follows:

Measurement tag code: To insert Google Analytics into your WordPress website, hand code the website.
Measurement ID: To insert Google Analytics into LadiPage, Haravan provider’s web, or add to Google Tag Manager.

How to insert Google Analytics into WordPress website

You should not insert the code into the theme’s file, because if you update the theme, you will lose Google Analytics (Unless you use a child theme). Use a simple plugin to insert Google Analytics code into WordPress following this tutorial.

Step 1: Go to your WordPress website admin to install the Insert Headers and Footers plugin as follows.

Step 2: Go to Settings and then Insert Headers and Footers. Then you paste the Measure Tag (Tracking Tag) snippet in the Body or Footer section to reduce the impact on first second page load speed. Then press Save.

How to insert Google Analytics into your website using Tag Manager

First you need to add Google Tag Manager in your website. I will guide you in another article.

If you have already inserted Google Tag Manager into your website, then follow these instructions to add Google Analytics to your website through Google Tag Manager.

Step 1: Go to and select the correct container added to your website. Then you click Tags in the left menu column and then click the New button to add a tag.

Step 2: The tag settings window appears, click Select trigger below.

Step 3: You choose All Pages

Step 4: Having finished the activation conditions, click Select Tag Configuration above.

Step 5: You choose Google Analytics: Configure GA4. You paste the measurement ID into the tag. Then, you enter a name for the tag you want and click Save.

Step 6: After creating the Google Analytics tag in Tag Manager, click the Submit button outside

Step 7: You don’t need to fill in anything, just click Publish and you’re done.

How to add Google Analytics to WordPress by using Google Tag Manager.

Go to Plugins, add “Google Tag Manager for WordPres”
Go to Installed Plugins, choose Google Tag Manager and press Setting
Here you can paste your Google Tag Manager ID and copy this code line
Go to Appearance, choose Theme Editor, then choose Theme Header on the right side. Now you can paste the code line right to this position. Then press Update File.


After inserting Google Analytics, you can assign Google Analytics permissions to employees or agencies. In addition, if you are interested in website measurement, please see the articles in this category.

Whether you have successfully installed Google Analytics on your website or not, please leave a comment below. I will reply to help you do it. Good luck with your installation!

Leave a comment

Your email address will not be published. Required fields are marked *