Integrating Google Analytics in WordPress

Google Analytics is a free web service that tracks and analyzes the traffic of our website. We will be able to discover all types of statistics of our web, which can help us to better understand its operation. Despite being a well-known service, there are still many websites and blogs that do not use it, so they can not know if their texts or products are actually working.

Why should I install Google Analytics?

One of the benefits we get when using Google Analytics is to know with total reliability the number of visitors that our website receives. We can also analyse our bounce rate (we have already talked about in Silo Creativo.)

Here we show you some statistics and reports of Google Analytics:

  • How your visitors have accessed to your website: from a search engine, a link, typing your web directly in the browser …
  • Data about your visitors: age, gender, country …
  • Visitor pages and pages: average time spent on each page or post, how they have had access to them …
  • Type of device from which they enter your web: from desktop PC, smartphone, tablet …
  • Reports on your content: your most viewed pages, the time it takes to load …


As you can see, you are missing a few things if you have never used Analytics. There are very important data that can help you focus on certain content or create new ones, as you observe how your web is working.

Although there are other alternatives, Google Analytics is a very effective tool, besides being completely free. There is also a premium version, although for most users, the tool offered by the free version is more than enough.

Sign up for Google Analytics

Before entering WordPress, we must sign up for Google Analytics. The process is extremely simple. We just have to go to the Google Analytics website and click on the sign in button. Keep in mind that we will need a Google account to register.


We will go to a screen where they will ask for our data, including the name of our website and its URL, the category of the sector where we include our website and the time zone. We will click on Get a tracking ID, and then, we will be within our profile in Google Analytics.

From this point, we can have Analytics in our web under WordPress in two ways: without plugin or with plugin. If we do not install a plugin, we will save space on our hosting and we will remove WordPress from the load of having an extra plugin, which it is always good. By contrast, to be able to see the metrics we must go to the Analytics website. However, by installing a Google Analytics plugin, we will have access to those analytics from the WordPress admin panel itself.

Let’s see how each of them does, so you choose the best for you.

Installing a Google Analytics plugin in your WordPress

If we take a look inside the repository of WordPress plugins (In Spanish), we will see that there are many under the label of Google Analytics. In this case, let’s take as example Google Analytics Dashboard for WP, which is one of the most downloaded and with better ratings.


As we have already mentioned, one of the biggest advantages of installing a plugin of this type is that we will be able to see the metrics of our web page inside the administration panel of WordPress. It is much more comfortable if we do not want to be with many tabs open while we work.

Adding the Google Analytics admin panel in WordPress

Once we have installed and activated the plugin, let’s go to Google Analytics> General Settings within the WordPress admin panel.


First, we need to authorise the plugin by clicking on the Authorise plugin button. In the next screen, we will ask for an access code, which we can obtain by clicking on the text in red colour.


It is simply an authorisation we need to access our Google account. Once we have the code, we paste it, and we save it. And all the work will be done!

We will have access to all the global metrics on our website from the Google Analytics section in the WordPress administration panel. But if, for example, we want to know how a specific post or page is working, we can also know that. Just go to All Posts or All Pages (depending on what information we look for) and you will see how a new column will be added to the right. If we click on it, we will have access to the individual statistics.

Adding a Google Analytics code to your WordPress template

Once you have registered, and you have introduced your website under WordPress in the Google Analytics panel, you will be provided with a Javascript code. This code will be the one that we must introduce in our website.


We move to the WordPress Themes Editor, which we found inside the admin panel, in Appearance> Editor. Once there, we look for the header.php file of our theme. In this file, right under thetag, we paste the Javascript code that we have provided from the Google Analytics web. We only have to click on the Update file button, so that our changes are saved. If you are interested in having more information about HTML, do not miss our article about it.


There are other ways to insert this code, for example if we edit the file functions.php. But we think that the way we have discussed above is the simplest one.

Verifying that Google Analytics works on your WordPress

We only need to check that we have done everything correctly. To do this, we must return to our Google Analytics account, choose our website in the Admin section and click on tracking info.

If we see that the tracking status that indicates us is receiving data, this means that we have done everything correctly. Google Analytics is already collecting data from our website.

If we go to the Reports tab, we can see a vision of the analysis that Analytics is doing on our website. Although we must keep in mind that it may take 24 to 48 hours for us to begin to provide these statistics.

Leave a Reply

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