Lagos, Nigeria

How To Set Up Google Analytics For a WordPress Site

WordPress Logo Dark Mode

WordPress Logo Dark Mode

Google Analytics is a powerful tool for collecting and viewing metrics on page views, user behavior, and other useful data. Best part is, it’s entirely free to use, so there’s no reason not to set it up for your website.

Setting Up Google Analytics

Head over to the Google Analytics dashboard and sign in. If it’s your first time using it, you can simply click “Start Measuring” to set it up. If you have an existing site, and want  to add another, you’ll need to click the settings icon in the bottom left and click “Create Account” to add a new one.

Creating an account will automatically create a “Property” for you, which represents your site. You can have multiple properties per account, but just one is fine for a single site.

To set up analytics, you’ll need to connect your website with a data stream. You can do this from the settings menu by clicking “Data Streams” > “Web.”

You’ll need to enter your website URL, and a name for the stream. Don’t worry, “Advanced Measurement” is free.

On the next screen, you’ll be presented with your “MEASUREMENT ID.” You will need this to link it to WordPress.

Enabling Google Analytics In WordPress

You have a few ways of adding the script to WordPress. If you’re comfortable modding your site directly, you can simply add the tracking script to the <header> of your site:

<!-- Global site tag (gtag.js) - Google Analytics -->
<script async src=""></script>
  window.dataLayer = window.dataLayer || [];
  function gtag(){dataLayer.push(arguments);}
  gtag('js', new Date());

  gtag('config', 'G-LE23FH7NGK');

Otherwise, you can configure the analytics with a simple plugin. Head over to “Plugins” and click “Add New.” Search for “Google Analytics.”

There are a couple good ones, but “GA Google Analytics” is basic and just adds the tag and tracking code with some configuration.

Install and activate it, and then paste in the G-XXXXX.. tracking code that Google gave you. The default configuration is fine, so just save changes.

You should now see the script in the footer/header of your page’s HTML. After 24-48 hours, you’ll start to see entries in the Google Analytics console.

This post was written by Anthony Heddings and was first posted to

Do you find this article helpful? Your Friend might too. So, please Share it with them using the Share button above.
Will you like to get notified when I post new updates? Then Follow me on any of my social media handles: Google News, Telegram, WhatsApp, Twitter, Facebook, Pinterest.
You can also drop your email address below if you wish to be notified by mail.

[newsletter_form type="minimal" lists="undefined" button_color="undefined"]

Tags: ,