Last update on:

How to Set Up Google Analytics for WordPress

In this tutorial, I will show you how to create and link a Google Analytics Account to your WordPress website using the Rank Math plugin we installed in a previous session.

Here’s a list of topics I will be covering:

Before we dive into the setup process, let me explain what Google Analytics (GA) is.

What is Google analytics?

Google Analytics logo

Google analytics is a software offered by Google themselves that allows webmasters like yourself, to track and view various metrics relating to your site.

Once you register your website with google analytics, you will be able to login to your site’s dashboard and see various data relating to your website.

Data, such as, the number of visitors your site is getting, which pages are performing best, where visitors are coming from etc.

Is Google Analytics Free?

Yes, this tool is absolutely free and is offered as part of Google’s suit of free software to help webmasters improve their websites.

Google also offers a paid version of their Analytics which is called Google analytics 360. This is a marketing platform for medium and large Businesses. GA360 allows the Marketing teams of corporations to track the results of their paid marketing campaigns.

As an independent webmaster you will not need this. The free Google analytics will give you all the information you need for SEO ranking purposes.

How does Google analytics Work?

Google Analytics works through the inclusion of a block of JavaScript code installed within pages in your website.

When visitors to your website view a page, this JavaScript code syncs to a JavaScript file which in turn implements the tracking process for Google Analytics.

The tracking operation retrieves data about the page request through various means and sends this information to the Analytics server.

Sounds complicated right? Don’t worry. With the use of our Rank Math SEO plugin, connecting our website to GA will be a piece of cake.

Before we do this, however, we need to setup a Google Analytics account.

How to setup Google Analytics

I’m assuming you don’t already have an active account with Google Analytics, so I’ll show you how to create one first.

Summary of Steps
  1. Go to ‘’.
  2. Click on the Blue ‘START MEASURING Button
  3. Create a new account name.
  4. For Property Name input the name of your site.
  5. Choose the timezone of where you physically located.
  6. Choose the currency.
  7. Click on ‘Show Advanced Options’
  8. Turn on ‘Create a Universal Analytics property’ (far right on/off lever)
  9. Insert the name of your website in the Website URL fields. 
  10. Choose ‘Create a Universal Analytics property only’
  11. Press NEXT
  12. Select your industry, Business Size and Measure Customer Engagement..
  13. Click CREATE

Go to and click on the blue START MEASURING button.

This takes you to the Account set-up page.

Welcome to Google Analytics setup page

First create a new account name. I suggest you give it the same name as your website. So, in my case it will be ‘WP Website Wiki’.

Choose the data sharing options you want to allow google to track. I just tick all options because I don’t mind sharing my data with google, especially since this should help them improve their services and give me more precise data on my website.

Click on the NEXT button.

Property Setup in Google Analytics

Next is the Property Set-up.

Property refers to your website, so for Property Name input the name of your website once again.

Reporting Time Zone refers to the time zone they will use for the charts and graphs in their reports. I suggest you choose the time-zone of where you physically are located.

Then choose the currency you prefer to track your earnings with.

Press NEXT

Next section is About your Business or Business Information.

First select your industry, i.e., the niche that your site is in. Then for Business Size, if you’re an individual just choose, Small.

Next part choose ‘Choose your Business Objectives’. Here I like to tick the last option that says ‘Get Baseline reports’. This is the most generic setting and gives you all reports that are useful for most website owners.

Now click CREATE.

In the ‘Start Collecting Data’ window, click on Web option.

In the pop-up window that comes up insert the URL of your website in the Website URL fields. This should include .com, or .net or whatever your TLD is at the end.

Under ‘Stream Name’ insert just the main name of your website (SLD). So in my case I will include WP Website Wiki, for example.

Now click on Create Stream button.

A pop-up window will come up with the following message ‘Data collection isn’t active for your website. If you installed tags more than 48 hours ago, make sure that they are set up correctly.’

Disregard this message as we will be setting up GA4 through our Rank Math plugin directly on WrodPress.

So close this ‘Web Stream Details’ window in GA4, and click on the Next button. Google analytics will tell you ‘Data Collection is Pending’. This will take a few days. So now you can close the Google Analytics page and head back to our WordPress dashboard.

With the steps mentioned above, we have just created a Google Tracking ID that will allow google to track the information passing through our website and relay that in the GA Dashboard for us to view.

How to add google analytics to WordPress

In this next section we will connect or add google analytics to our WordPress site.

After creating the Google Tracking ID in the previous step, GA wizard should have sent you to the page where you can find the info you need to connect the Google analytics account to your WordPress website.

You should see the Tracking ID and Website Tracking Global Site Tag.

You can always retrieve your tracking ID information by logging into Google analytics, clicking on the Admin COG wheel (bottom left corner of the GA Home page).

Where to find the Google analytics Admin COG wheel

Once in the Admin page, click on the TRACKING INFO link.

Where to find the Google analytics tracking info

Before we can start using the GA dashboard, we need to link the Google analytics Tracking code to our WordPress site. For this we will use our favorite SEO plugin, Rank Math.

If you have been following my other previous tutorials, you should already have this plugin installed. If not, you can find the details here.

Summary of Steps
  1. In WP dashboard click on Rank Math in the side Menu
  2. Find the card that says ‘Analytics’ and click on the ‘Settings’ Button in that card.
  3. Click on ‘Connect Your Rank Math Account’
  4. Log in with the same email used to create your Google Analytics Account.
  5. Click on all Data options to allow viewing and press ‘CONTINUE’
  6. Go on the ‘Analytics’ Tab on Rank Math and choose the account from the drop-down menu, choose the property and choose ‘All Website Data’ from the View drop-down option
  7. Switch the ‘Install Analytics Code’ to ON. Click on SAVE before next step.
  8. In the Analytics section Click on the ‘Exclude logged-in users’ option.
  9. Now scroll down and SAVE

To insert the GA tracking code to our WordPress site go to your WP dashboard and go on Rank Math in the side Menu.

Find the card that says Analytics and click on the SETTINGS Button in that card.

Google analytics settings on Rank Math plugin

If you have not yet connected your google account to Rank Math you will need to do the following steps:

  • Log in with the same email account you created your Google Analytics account.
  • Click on all the data options, to allow viewing and press CONTINUE

You should now be seeing the ‘Analytics’ TAB section of the General Setting under Rank Math in your WP dashboard

Go on the ‘Analytics’ Section and choose your GA account from the Account drop-down menu, choose the relevant website from Property drop-down menu, and under Data stream option make sure it shows the correct website.

Rank Math Google analytics installation Settings

Switch the ‘Install Analytics Code’ to ON and a new drop-down option should come up.

Now scroll down and press on SAVE CHANGES.

Scroll back up to the Analytics section again and Click on the EXCLUDE LOGGED-IN-USERS option. This will exclude yourself from the visit counts in Google Analytics.

Now scroll down and SAVE again.

The Analytics code should now be installed on your website. You can verify that this is working because the small circle next to Analytics Title in Rank Match Dashboard turns Green.

Confirmation that Google Analytics is linked to Rank Math plugin

You’re done, and you can now benefit from all the insights that Google analytics provides.

How long does it take for google analytics to start tracking?

Google Analytics will start tracking immediately once the tracking code has been installed in your WordPress site, as we did in the steps above.

Just log into your GA dashboard and start looking around to familiarize yourself with the dashboard and the different reports that it offers.

Google offers free training on their analytics. You can access their training in the Google Analytics Academy.

Not only does GA track the number of visitors you get to your site, but it also provides key insights into how your WordPress site is performing and suggestions on how you can improve your site to rank better in Google search.

With Google Analytics you will be able to track everything happening on your site, from how much traffic your website is getting to where that traffic is coming from.

Other metrics you can track, include, how visitors are behaving, track mobile traffic vs desktop traffic, identify trends and much, much more.

What’s Next?

If you’ve been following our tutorials, in consecutive order, you should now have both Google Analytics and Google Search Console activated and linked to your website.

Not only are they linked to your WP site, but they have also been linked to Rank Math, the SEO plugin we installed to ensure our WP site is optimized for Search Engine rankings.

In the next tutorial we will be working on another important SEO element; Page Speed setup.

For a full list of my WordPress tutorials, check out this page.