Implementing Google Analytics on the WordPress site

Implementing Google Analytics on the WordPress site

Google Analytics is an important tool from Google that every website owner should be familiar with. By implementing an analytics code on your site, you can perform data analysis of surfer entries, you can check stay times, what platform the surfer came from, what are the most viewed pages on the site and more…In this article we will explain what analytics is, how to add Google Analytics code to a WordPress site and how to install analytics on an HTML site as well.What is Google Analytics? Why do you even need Analytics? Open a Google Analytics account Adding a new site to Analytics Find the tracking code in your account Implementing Google Analytics code on the site Implementing Google Analytics in WordPress Implementing Google Analytics in WordPress in the header.php file Implementing Google Analytics in the HTML site What to do after I embed the code on the site? A guide to implementing Google Analytics on the site

What is Google Analytics?

One of the most important things for improving an existing website promotion is tracking and analyzing the website data and in order to meet the need of tracking Google have developed the excellent tool called Google Analytics.After implementing the Analytics code on your site, you can track the amount of daily visits you have on the site, you can see where your viewers come from, how long they stayed on the site, how many pages they visited, which pages on the site receive the most expectations and the like.Google Analytics is currently the leading tool for tracking users and sites and is installed on almost every serious site on the web, yes and of course we have installed it on this site as well.The addition of the tracking code is recommended to be done immediately after the process of building the website for the business is completed. If you work with a website builder it is advisable to even ask him to perform the process for you.

Why do you even need Analytics?

After you have invested a lot of time and money in developing a website for a business, all that is left to do is promote it in the search engines in order to generate traffic to the site. You will not be able to perform the process of promoting a site on Google effectively without analyzing the visitor data and views on the site.With Google Analytics you can get the following data:There were several daily visits to the site From which sites did the visitors come to the site How long the viewer has been on the site In several pages, the viewer visited the site From which countries did the viewers come Have viewers of your site surfed through your desktop computer, tablet or smartphone Which pages get the most hits All of these and more are just a small part of the information that can be collected and analyzed using Google Analytics.

Open a Google Analytics account

In order to open a Google Analytics account you will need a Gmail account or any other Google account. Once you already have an existing Google account you can connect to Analytics without having to register and create a new user. To get started, click on the following link and go to the Analytics website:https://analytics.google.com/If you already have an account, click on the “Register” button (you will not really need to register as long as the site is connected to a Gmail user). If you do not have an account yet then you will need to create a new account.Once you have logged in to add a new site, click on the gear icon (administrator) and under the Property option, click Create New Property (this property is a new site that can be added to the account).

Add a site to Analytics when there is an existing user

After opening the account or logging in to the existing account you will have the option to enter the details of the site where you want to perform the tracking. Enter the details of your site and note that in the URL you will choose the correct site protocol.If your site has a security protocol https make sure to mark it with options, if your site does not have a security protocol then leave the option marked as http. Marking the wrong option can hurt the site’s tracking so make sure you choose the right option.

Finding the tracking code in Analytics

In order to connect Analytics to the site and view the data, it is necessary to add JavaScript code to the top of your site. The code you need to add can be found in the Analytics management area.To find the code click on the administrator icon (settings gear button). Under the “Property” column make sure the correct property / site is checked (if you have more than one site there will be several options). Then click on “Tracking Details” and “Tracking Code”.After clicking on the “Tracking Code” button, you will see on the next page the Google Analytics code that you will need to copy into your s

Implementing Google Analytics on the WordPress site

Implementing the Google Analytics code on the site is not a complicated operation and we will divide the implementation into HTML sites and WordPress sites.On WordPress sites we will present 2 options of implementation one by plugin and one by adding the code directly to the header.php page.Our recommendation is to use the WordPress plugin to avoid future problems. For example, if you insert the code directly into a WordPress template without the use of a sub -template, a situation may arise in which the code will be deleted in the future if you update or change the existing template.If you have completed the process of building a WordPress site and you want to add the Analytics code to the site, the recommended way to implement the code is through a plugin and not manually.As stated above updates and changes in the template by which the site is built can cause the code to stop working and you will lose important and valuable tracking data so it is highly recommended to avoid this.The code can be added using the GA Google Analytics plugin . The extension allows you to implement the Analytics code by entering a “tracking ID” that appears on the page of the tracking code in your account.Finding a tracking ID number – In order to find your tracking ID number, log in to the analytics account and there log in to the administrator >> Tracking details >> Tracking code:

Login to the tracking code page

Inside the page you will see the tracking code that you will need to copy into the WordPress plugin:Example tracking number in Google AnalyticsInstalling the WordPress plugin and associating it with the site – Now you need to install the GA Google Analytics plugin . If you do not know how to install a plugin in WordPress, watch the video at the top of the page.Once installed, go to the WordPress administration area , where you go to settings and select the Google Analytics option (the plugin you just installed).

Sign in to the GA Google Analytics plugin in WordPress

Inside the plugin select the Plugin Settings option and enter the tracking code in the GA Tracking ID panel. We do not recommend inserting the Analytics code into the header.php file directly as changing or updating the WordPress template you are using may cause the code to be deleted.If you are still making the changes it is recommended to do so using the child-theme template so that updating the template will not remove the code from the page.To embed the code in the header.php in WordPress go to the WordPress administration area and select there the option of “Design” and then go to the page of “Edit” to edit the template files.Inside the page that opens, select the edit option of the header.php file, where you will enter the Analytics code between the <head> tags.<! DOCTYPE html> <html> <head>Enter here the tracking code between the 2 head tags</head> <body data-rsssl = 1>

Implementing the code on the HTML site

When you want to embed the Google Analytics code in the HTML site you can do so by editing all the pages where you want to track and add the code between the site’s tags. It is advisable to back up the site before adding the code.You can watch the example below to understand how to enter the code on the HTM website:<! DOCTYPE html> <html> <head>Enter here the tracking code between the 2 head tags</head> <body data-rsssl = 1> I linked my site to Analytics What now? If you have followed the guide and succeeded in implementing Analytics on the WordPress site successfully, wait a day or two and log in to your Google account to make sure that the account is active and that you have entries.Even if you do not know what to do with the tracking data a day will come and this information will be useful, especially if you start taking actions to promote the site down the road. Monitoring is the first and most important step in improving the site in the future.If after two days you still do not see changes in your analytics account it means that you may have performed a certain action incorrectly. In this case, it is recommended to go through the guide again and perform the steps once more.Once you are done with Analytics and everything has passed successfully the next step on the way is to add a site to Google Search Console so that you can also analyze search data and keywords from Google.