Tutorial: How to insert Google Analytics on WordPress site?

How to insert Google Analytics on WordPress site
Spread the love

Tutorial: How to insert Google Analytics on WordPress site? – In this article, you will find out how to easily connect Google Analytics to your website, thanks to this tool you can keep the site statistics under control and have a lot of fundamental information to grow your blog.

If you want to learn more about Google Analytics, after installing it and connecting it to your website, I suggest you read the book Web Analytics 2.0b by Avinash Kaushik, it is considered “the bible of Analytics” and you can buy it on Amazon through the box below:

Configuring Google Analytics and connecting your site or inserting the tracking code is a rather simple operation, which can be done in various ways: through the use of specific plugins or manually, and in this BOND article, you will discover both procedures.

Clearly, to insert Google Analytics on your website you will need a Gmail account through which you can access Google Analytics and thus create your “Account” for the site/blog (or sites) you manage.

Connect WordPress to Google Analytics: Tracking Code

Once logged in to Google Analytics you can go to the Administration section (you can find the administration item at the top of the menu) and from here you will have 3 columns: from the left column click on  Create a new account then enter the required information, i.e .:

  • Account name
  • Website name
  • Website URL
  • Industry category
  • Time zone

At this point you can click on  Get Tracking ID, this is the code that will allow you to track visits to your blog, and is usually available in three versions:

  • Compact: it consists of the letters  UA and a series of numbers
  • Classic HTML (Javascript code)
  • PHP

To manually insert the Analytics code on your site you will have to take the javascript code (the one that starts with <script> and ends with </script>  and you will have to insert it into your site: some templates have the voice  “google analytics” or other scripts in the admin panel (by the way, if you are looking for a good template take a look at my selection of the best WordPress templates).

If you do not find this item you can still go from the WordPress dashboard to  Appearance – Editor and here look for the header.php file.

At this point go to the end of the page and before the closing </head> tag pastes the code you copied from Google Analytics, then click on  Update the file: now you have manually installed Google analytics.

Warning: if you update the template, remember to re-enter the Google Analytics code, otherwise you will lose all data from the day of the template update, as the Google Analytics code has been “skipped”.

Plugin to install Google Analytics on WordPress

If you prefer to manage everything with a plugin, today there are many available, I recommend  Google Analytics by Yoast, simple and functional, it will allow you to authenticate with your Google account to quickly configure Google Analytics on WordPress.

If you prefer you can also enter the  UA code manually, then save the settings and you have correctly configured Analytics on WordPress.

Among the other plugins that allow you to install Analytics on WordPress, I also mention  Google Analyticator and  Google Analytics Dashboard for WP.

It must be said, to be fair, that some of these plugins will also allow you to check the statistics directly within WordPress, but they will burden the site with additional functions 

The original version of the article:

One of the indispensable and extremely comfortable plugins for WordPress is the plugin that allows you to implement Google Analytics.

Implementing Google analytics allows you to check and always keep an eye on all the blog statistics, therefore it allows you to view the bounce rate, on which pages our visitors arrive at, what they are looking for on the internet, and many, many other functions.

Analytics is undoubtedly one of the best statistical systems available online.

There are various ways to install WordPress within a website, my advice is to avoid putting too many plugins, go inside WordPress in the “Appearance – Editor” section of the template (and every time you change the template you will have to insert the code) and go to the “Header” page, then look for the </head> line and insert the Analytics code before this line.

But let’s also see how Analytics works and how it can be implemented via plugins.

The service is free up to (if I’m not mistaken) 5,000,000 visits per month, a very, very substantial figure, which is why everyone can use analytics, and if they reach 5,000,000 visitors per month, they can easily pay google for the service.

Implementing Analytics is a simple operation: there is a plugin that allows you to automatically insert analytics, here is the guide that explains how to implement it:

Download the plugin from Yoast SEO Blog, unpack it and upload it to the “plugins” folder (a subfolder of wp-content).

Go to activate the plugin on the plugin entry of your WordPress board, access analytics, register, and copy the identification code.

Return to your WordPress and copy the code by going to “settings” Analytics. Save your settings and… you are already done ?

Spread the love

Alfred Williams, a distinguished business writer, navigates the corporate landscape with finesse. His articles offer invaluable insights into the dynamic world of business. Alfred's expertise shines, providing readers with a trustworthy guide through the complexities of modern commerce.