Add Google Analytics Tracking To A Website

Sameer Saini February 23, 2022
Add Google Analytics Tracking To A Website

Have you created a new website or are the owner of an existing website and want to see how many people are coming to your website and what pages are they viewing?

You have come to the right post. In this post, we will see how we can add Google Analytics to your website step by step and check your website's traffic and real-time information.


Why Add Google Analytics To Your Website?

Every website or blog needs reporting.

Without reporting, you would have no information about users coming onto your website and using it.

You would have no information of how your website is performing, what are the most viewed pages of your website, how your website is performing in terms of speed and load times, and also what flow are users taking on your website.

All of this precious information helps website owners improve their website so that they can get good quality traffic on their website and they can achieve the purpose of the website.

Google Analytics is the best website analytic tool out there.

It's fast, performant, and gives you more than enough information about your website.


Get Google Analytics Tracking Code

In this blog post, we will go step by step and get a Google Analytics Tracking Code from the Google Analytics website and then we will insert that code in your website.

Step 1 - Log in to Google Analytics using your Google Account (Gmail Account)



Step 2 - Click on the Admin button on the left-hand bottom of the screen after you log in to Google Analytics

Getting Google Analytics Tracking Code

Step 3 - From the left-most column titled Account, If you don't have an account in the dropdown or you want to use a different account, click on the "Create Account" button and create an account for yourself. Otherwise, use one of the accounts in the dropdown.

Step 4 - Once you have selected the account, from the middle column titled Property, select the property you want or create a new one (You might have created a new Google Analytics Tracking property if you created a new account in the previous step). 

Once you have selected the property, click on the Traffic Info button and click on the Tracking Code link.

Getting Google Analytics Tracking Code


Step 5 - On the Tracking Code page, you will see some Website tracking code that looks similar to the below. On this page, Google tells you that paste the below code in the <HEAD> section of every page you want to track. Copy this code somewhere handy as we will use this code and add it to your website.

Getting Google Analytics Tracking Code



Add Google Analytics Tracking Code To Website (HTML)

Now that you have created your own Google Analytics property and have a tracking code, it's now time to add this tracking code to your website.

As Google says, we have to add this tracking code to the <head> tag on every page we want to track.

The scripts in an HTML web page look like below, copy your own code in the head tag of your website.

Adding Google Analytics Tracking Code To Website HTML


If you are using a language in which you can use a master page that has a common head and tracks all of the pages, you just have to paste this tracking code once then.

WordPress and other website builders now have a section where you can add the Google Analytics tracking code.