Step by Step Guide to link your site to Google Analytics

Have you come across this guide because you want to know how to link the site to Google Analytics, so you can monitor the traffic on your web pages?

You’re at the right place: linking the site to Google Analytics is a fairly simple process. You will be able to do everything in a few minutes and without much difficulty just by following the steps suggested below.

Let’s start right away.

Note! Before starting to follow what is suggested in the guide, make sure you have a Gmail account with which to access Google Analytics (if you do not already have an account you can create it directly from the Analytics login page).

Link your site to Google Analytics: tracking code

First, log in to Google Analytics. Then, click Administration in the top menu. A screen organized on three columns will open.

Expand the drop-down menu in the left column and click “Create a new account “. Here you will be asked to provide some information, all very simple. You will need to enter an identifying name for the site you want to link, the URL, the website name, select the sector to which it belongs and the time zone where you are.

Once this is done, you can click “Get tracking ID” at the bottom of the page.

The tracking ID is a code, consisting of two initial letters and a series of numbers, which usually starts with UA.

To link the site to Google Analytics, you will need to enter this code on your pages (in the following paragraphs I will explain how).

Link the site to Google Analytics manually

First, let’s see how to make the connection without using any additional tools (which we will discuss in the sections below). If you want to limit the number of plugins installed on your site, you can easily enter the analytics code without major difficulties.

When you are in the screen where the tracking codes are present, copy what you find in the section entitled “Website monitoring”. This is a code that starts with the <script> tag and ends with the closing tag </ script> . If you look carefully at the code, you will see that towards the end (precisely, at the third last line) the tracking code at the top of the page is already included.

Copy everything in the window that contains the code. So, log in to your WordPress site.

WARNING! The following steps involve modifying some site files. This means adding codes to those already present. If you are not familiar with working directly on the codes, I suggest you go to the next section where it is explained how to link the site to Google Analytics using the plugins (without working on the codes). In any case, if you choose to proceed with the manual method, make sure you have a complete backup of your site before making any changes to the existing files.

When you are inside the Dashboard, navigate to Appearance> Editor. Here, in the list of files you see on the right, find and select the option called Theme Header (header.php).

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

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

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

Link the site to Google Analytics with a plugin

The second method to link the site to Google Analytics is with a plugin. There are dozens of plugins that offer this functionality; For this guide I selected Google Analytics for WordPress by MonsterInsights. This tool is used by over a million sites, enjoys excellent ratings with 4 out of 5 stars and is the “brother” of the famous WordPress SEO by Yoast (if you do not already use this plugin, I suggest you install it right away and read  the guide on how to configure it ).

Then install Google Analytics for WordPress by MonsterInsights. Once the plugin is activated, you can link the site to Google Analytics.

After activating and installing the plugin, you will find a new menu called Insights. Open it and then click on Authenticate with your Google account. Accept the terms of use and then select the Google Analytics account to use. At this point click on Verify Credentials to check the site.

As you can see, it’s very simple. The collected data should be available within a few hours on your Google Analytics account.

Google Analytics for WordPress by MonsterInsights is also available for a fee. For those who have just started an online business but want to better invest on the functionality of Google Analytics, the Basic package from $39 per year is the best choice. With the Basic package you get advanced statistics but easily readable thanks to a well organized bulletin board, various types of tracking, a year of support and updates and the license for use for a site. For $99 a year, the plus package is available, with more features. The most expensive and feature-rich version of services is that Pro, which costs $199 a year, is dedicated to websites that have a significant volume of traffic and a large catchment area. The Pro version also provides access to e-commerce tracking and priority support.

You can get more information by visiting the “pricing” section of the MonsterInsights official website.


Today you have learned two ways to link the site to Google Analytics. They are both simple, but if you’ve just started working with WordPress I would 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.

Were you able to connect your site to Analytics? Or do you have any questions about the steps to follow? As always, for any questions or concerns, do not hesitate to leave your comment below.

Leave a Comment