Skip to Main Content

How to install Google Analytics on your WordPress blog

Divi: the easiest WordPress theme to use

Divi: The best WordPress theme of all time!

With over 600.000 downloads, Divi is the most popular WordPress theme in the world. It is complete, easy to use and comes with more than 62 free templates. [Recommended]

Knowing how your visitors behave on your blog is very important to your success. The best way to know these is to use traffic statistics for your site. Google Analytics, a service offered by Google is available for free and allows you to receive this analytics data.

In this tutorial, I will show you how to install Google Analytics on WordPress.


Why Google Analytics is so important to your blog?

Google Analytics lets you keep track of:

Those who visit your blog

This element is quite decisive because it answers the question of the geographical location of your audience, the different browsers used and other information as important as the screen resolution, compatibility with JavaScript, Flash language and much more .

These data are extremely useful, and they can help you in many ways. When using a new theme, you can use mobile data to make sure mobile users do not have to worry about browsing your blog. If your visitors do not use Flash technology, then you should avoid adding them to your blog.

What they do when they visit your blog

You can follow the navigation of each visitor on your blog, see the time spent by them and see the bounce rate (the percentage of visitors who leave your blog after a first visit). Using this information, you can decrease the bounce rate and increase the depth of the page views.

When they visit your blog

This information can determine the peak time of your site, and you can choose this time to publish articles or display special promotions. This is how you can plan your articles.

How did they go to access your blog

This section of the analysis shows you where your visitors come from (for example: search engines, direct links or another site and in this case we speak of referent).

This section also shows you the percentage of origin from each source. Google Analytics also gives you a breakdown of each source. And especially with regard to sources, you will be able to see which search engines bring you more visitors.

Easily create your website with Elementor

Elementor allows you to easily create any website design with a professional look. Stop paying expensive for what you can do yourself. [Free]

How They Interact With Your Blog's Content

Google Analytics shows you how your users interact with your blog content. It shows you the percentage of people who clicked on a link. This will allow you to put together A / B tests to see the content that makes more impact.

How to get a Google Analytics account

The first step: you must start by creating a Google account. to do this, I invite you to Google sign-up page.

You will go to a login page with a login form. If you have a Gmail account, then you can log in directly, if not you must create an account and click again on the previous link.


Second step : Once you sign in with your Google Account, you'll see a screen like the one below. It is on this window that you will be able to connect on Google Analytics With your Gmail account.


Are you looking for the best WordPress themes and plugins?

Download the best plugins and WordPress themes on Envato and easily create your website. Already more than 49.720.000 downloads. [EXCLUSIVE]

Step 3: On the next screen, you will have the choice between the website or the mobile application. Make sure the option " website "Is selected.

Currently Google offers universal access with a single account, which offers exceptional features and an analytics account. You are free to use it.


Carefully read the information requested and fill it out. For example, you will fill in information such as the name of the website, the website address, the time zone of the reports, the category of the website and much more. Once done, click on " Get a tracking ID"You will then access the Google Analytics integration code on your WordPress blog.

google-analytics code

How to install Google Analytics on WordPress

There are two methods to do this. One with a plugin and the other by entering the tracking code into a file of your theme.

Using a plugin

Remember, I showed you how to create a plugin. All you have to do is add the following code.

google-analytics-integration code

Note: JavaScript code is provided by Google (Js Tracking CodeI just copied it to my PHP function.

Do not forget to replace the mention "Your Code HERE" by the identifier of your Google Analytics account. The latter is often composed of UA And a series of numbers.

In addition, you can use the plugin ' Header and Footer »Available on

Easily create your Online Store

Download free WooCommerce, the best e-commerce plugins to sell your physical and digital products on WordPress. [Recommended]

Paste the code into a theme file

This is a method I do not recommend, but you can still use it if you do not plan to change the theme. All you have to do is open the "header.php" file for your theme and paste directly the tracking code Js provided by Google.

Note: Google offers several ways to integrate Google Analytics, so you have a choice.


That's all you need to do to install Google Analytics on your blog. Feel free to share the tutorial with your friends on your favorite social networks.

This article features 0 comments

Leave a comment

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

This site uses Akismet to reduce unwanted. Learn more about how your comments data is used.

Back To Top