How to connect your site to Google Analytics

If you want to monitor the traffic on your site in a detailed way, and not just have a report on the number of visits (which will actually not help you to develop a strategy to grow your online business), then I recommend you connect the site to Google Analytics.

The procedure is quite simple and if you follow all the steps that I show you in this guide, within a few minutes everything will be configured to know the behavior of your visitors and find out how to improve the flow of traffic to your site.

Do you want to learn how to use Analytics to the fullest?

Before we begin, however, let me ask you a question.

Already have a Gmail account?

It will be necessary in order to access Google Analytics.

Create it right before you start, otherwise you can also do it from the Analytics login page.

The tracking code to link the site to Google Analytics

When you log into Google Analytics , you will be asked for your Google account username and password, or you can create a new one.

Once logged in, click the Configure for free button .

The first screen will ask you to name this account.

Within a single account you can add different tracking codes, so if you plan to administer several websites, choose a name that identifies all your business (your company name, or your name for example) and more the single site.

I suggest you leave all the options you find in the Account sharing settings section active , because they will allow you to have more precise data and to request the intervention of Google’s support technicians in case of problems.

Select Next .

The next screen will ask you what you want to monitor, a website, an app or both.

For the moment we are interested only connect the site to Google Analytics, so we will select the Web option .

In the last screen you will have to enter the name of the site, its URL, the sector it belongs to and the time zone.

Be careful to select the http or https prefix correctly.

I take this opportunity to remind you that it is very important to activate the SSL certificate on your website . If you haven’t done so yet, activate it now!

Data related to a website is called by Analytics Property , so an Analytics property is nothing more than your website and the data linked to it.

Click on Create to confirm the data entered and start.

The tracking ID

At this point, you will get the tracking code that you will need for connect your site to Google Analytics.

First, you will find a Tracking ID, which is a code consisting of the letters UA followed by a series of numbers.

This is the code that identifies your property.

You will also be provided with a script starting with <! – Global site tag and ending with </script> .

This information will have to be entered on your site and in the next paragraphs I will show you how to do it.

Connect the site to Google Analytics manually

First, let’s see how to make the connection without using any additional tools (which we will talk about in the following sections instead).

If you want to limit the number of plugins installed on your site, you can easily enter the Analytics code without much difficulty.

When you are inside the screen where the tracking codes are present, copy the script located inside the section entitled Website monitoring .

If you look closely at the code, you’ll see that the Tracking ID at the top of the page is already included towards the end.

Copy everything inside the window that contains the code.

Then, log into your WordPress site.

WARNING! The steps that follow involve modifying some site files.

This means adding codes to those already present.

When you are inside the Board, navigate to Appearance> Editor .

Here, in the list of files you see on the right find and select the one called Theme Header (header.php).

Now, copy the code you took from Google Analytics right before the </head> tag into the file .

Finally, click “Update file” at the bottom of the page.

Once this is done, your site has been linked to Google Analytics and after a couple of days you will start seeing traffic data within the Analytics tracking panel.

Analytics link via plugin

The second method for connect the site to Google Analytics it is with a plugin.

There are dozens of plugins that offer this functionality.

This tool is used by over 2 million sites, enjoys excellent ratings with 4.5 out of 5 stars and is the “brother” of the famous WordPress SEO by Yoast.

Once the plugin is activated, a wizard to connect your site to Google Analytics.

All you have to do is enter your Google login details to complete the configuration, without the need to add the tracking code.


Today you have learned two methods for connect your site to Google Analytics.

They are both simple, but if you are just starting to work with WordPress, I definitely recommend the second method, so you can take advantage of the features offered by the plugin and avoid the risk of making errors within the files.

Read More

Scroll to Top