How to Add Google Analytics to WordPress Site or Blog?

If you are a beginner with WordPress and want to add Google Analytics to your site or blog, then the following guide will help to do that.

Integration of Google Analytics is simple. Here, we like to suggest that in setup – only add code to your site, instead of using heavy plugins which show all GA data in WordPress dashboard.

Simple code integration on the website and analyse data on GA dashboard is good practice. By this you can save extra load on your website.

Now, Following are steps to add Google Analytics code to WordPress site or blog.

1. Create Google Analytics account and get GA code

First requirement to integrate Google Analytics to the WordPress site is a Google Analytics account. You can create an account using your Gmail account.

Here are support pages for Universal Analytics and GA4 properties. By following this page instruction, you can create a GA account.

Next to copy GA4 property code for the website, follow the “Add the global site tag directly to your web page” section in the support page.

And, to copy old Universal Analytics properties code for the website, follow the “Set up the Analytics global site tag” support page.

2. Add GA code to WordPress site using plugin or widget

In the second step, you need to integrate Google Analytics JavaScript code to your site or blog.

You can do this by different methods. Here are two simple methods to add GA code in WordPress site.

  1. Install “Insert Headers and Footers” plugin, and add code in site header section using plugin.
  2. Add “Custom HTML” widget to sidebar or in available area and add code to widget. GA code will work the same from header, body or footer area.

Once you add GA code using one of above methods, next open your website and confirm that code is available on site. You can do this from page view-source code in the browser.

3. Check Google Analytics stats

After completing the first 2 steps, login to your Google Analytics dashboard and check your site statistics.

In the beginning you will not get all stats, due to less data. But, to make sure your GA integration works properly, you can visit your site page and check real-time statistics in GA dashboard.

At Last,

Hope you find this post simple and helpful for adding Google Analytics to the WordPress process.