How to add Google Analytics to WordPress: Quick and Easy Guide

Have you been avoiding adding Google Analytics to your WordPress site because the amount of information out there feels too technical or overwhelming?

There are many ways to go about doing this, but for brevity and efficiency to get beginners on the ground running, I have created this quick and easy guide to teach you how to add Google Analytics to WordPress.

This method will be using the SEO plugin, Rank Math. This plugin is great because it adds Google Analytics and Search Console to your WordPress site and it provides very useful SEO information.

This post contains affiliate links which means I may receive a commission on purchases made through the links. This is at no additional cost to you and helps keep the site running.

In this post you will learn how to:

  • Sign up to Google Analytics
  • Sign up to Google Search Console
  • Install Rank Math to WordPress
  • Use the Rank Math Setup Wizard
  • Add Google Analytics to WordPress
  • Filter out your traffic from Google Analytics

How to set up Google Analytics

First you will need a Google Account if you don’t already. It is common practice to make a specific Gmail (Google) Account for your website or business name. This is a great for branding and organizing your work.

Once you are logged into the account you wish to connect visit Google Analytics.

If you have never set up Google Analytics before:

Click Set up for free button on the homepage of Google Analytics

Screenshot of Google Analytics sign up page

Then you will be taken to a screen where it asked for Account Name and data permission. Write the name of your company or website in the box and select the permissions you accept.

Property Setup is where you create the Property under the Account. The Account and Property can be of the same name.

Select your reporting time and currency.

Select Show advanced options which will bring up the box shown below “Create a Universal Analytics property”

Screenshot of Google Analytics sign up page

Here you will turn on Create a Universal Analytics property. You MUST do this. Otherwise, it will not be compatible. Type in the URL of the website.

You can choose to create both a Google Analytics 4 (GA4) and a Universal Analytics Property. No need to worry about GA4 quite yet!

Click Next.

About your business is three small demographics about your business. Select your industry category, business size, and how you intend to use Google Analytics.

Click Create.

Terms of Service Agreement should appear and follow the instructions on the screen.

If you want to add another website to your Google Analytics:

If you already have a website connected to your Google Analytics and want to add another just visit Google Analytics. Click Admin on the bottom left menu.

Under the first column labeled Account click + Create Account. You will follow the same steps as above.

How to install Rank Math to WordPress

In the WordPress Dashboard click on Plugins on the left side menu.

Add New, type in Rank Math in search. Click Install, then Activate.

Screenshot of WordPress Plugin page

You will see Deactivate or Setup Wizard as options under the plugin on the Plugins page. Click Setup Wizard to begin.

A screen saying “Connect FREE Account” will appear. Click Connect Your Account.

You will then be taken to a page to login or create a Rank Math account.

If you need to make an account you can use Facebook, Google, or login or create a new account via email.

Once you register or log in it will ask you if you want to activate Rank Math on your website. Check that the login information and website are correct. Click OK.

Then you will see the Setup Wizard.


Download this FREE workbook to find the perfect keywords and a content strategy that will put your business in front of your dream customers.

How to add Google Analytics to WordPress

how to add google analytics to wordpress using rank math

Easy: For websites where you only want to change the basics and let Rank Math do most of the heavy lifting. Most settings are set to default as per industry best practices. One just has to set it and forget it.

Advanced: For the advanced users who want to control every SEO aspect of the website. You are offered options to change everything and have full control over the website’s SEO.

Custom Mode (Available only for Pro accounts)
Select this if you have a custom Rank Math settings file you want to use.

You can switch between any of these at any point so no worries if you want to make adjustments.

I prefer to use Advanced.

The first screen is about your site. You will be asked for information regarding your activities.

Select what your website is for:

Personal Blog
Community Blog/News Site
Personal Portfolio
Small Business Website
Other Personal Website
Other Business Website

Select the Business Type, or get as close as possible.

Make sure the Company Name is correct

Upload your logo and default social share image if you have them available.

Once this is complete you will begin connecting your Google Account to Rank Math.

Screenshot of Rank Math setup wizard

Click Connect Google Services.

A screen will come up showing your Google account(s). Select which email you would like the Google Analytics to connect to.

Three small pop ups will appear.

Grant Rank Math SEO permission:

  1. See and download your Google Analytics data
  2. View and manage Search Console data for your verified sites
  3. Manage the list of sites and domains you control

Then you will be taken to a final screen to confirm your choices in connecting your account to Rank Math. Review it and select Allow when you are ready.

Note that Rank Math needs access to these items. If you are not comfortable with this then you can install Google Analytics without a plugin but you will not gain access to features like writing your meta descriptions, tracking internal and external links, and more.

Once you select Allow you will be taken to this screen.

Screenshot of Rank Math connecting to Google Analytics

Here you can connect Search Console and Analytics. By clicking on Search Console you will be asked for your URL, it should automatically connect. If not then you can go to Search Console and add a new property.

Once that is done, click on the Analytics tab below.

Select the Account you created before, then select the Property and View.

If you did not set up your Google Analytics account before this step your Account will not show as avaliable. If the website is not showing up in Property and View you may need to return to the first step and make sure when creating the new account that you also created a Universal Analytics Property.

Click to install analytics code.

Click save and then to the next part of the Setup Wizard.

Now you should be at Sitemap.

On this page I have everything selected and for most websites these settings are applicable.

Screenshot of Rank Math set up wizard for adding Google Analytics to WordPress

Click Save and Continue

Next step is Optimiztion.

I use the following settings.

Noindex Empty Category and Tag Archives selected on. This helps with SEO by keeping empty categories and tags from indexing on Google when they have no content.

I choose to have Nofollow External links off. Rank Math has a built in option in WordPress where you can select to make each individual link Nofollow. Just don’t forget to use it in when necessary.

I am a huge fan of Open External Links in New Tab. Some may disagree with me but I personally think that if you have an external link in an article, once someone clicks that, they are taken away from your page and can easily forget about your website. If it opens in a new tab, your page is still there for them to easily access.

Screenshot of Rank Math seo tweaks

Click Save and Continue and you are ready to go! Click Return to Dashboard and here you will see the entire Rank Math menu and options that can be adjusted any time in the backend of WordPress.

Excluding your visits from Google Analytics

Now that you are all set up there is one small tweak to Google Analytics that I highly advise you to do. That is to exclude your visits to your website from Google Analytics. This is important so that you don’t skew your analytics data.

In Google Analytics click Admin. On the third column to the right titled View click on Filters.

Screenshot of Google Analytics creating a filter

The click the red button that says + Add Filter.

Enter filter name. I tend to use Me or Home.

Filter type, Predefined.

Screenshot of GA adding a new filter

In the dropdown box below select Exclude.

In the dropdown box next to that select traffic from the IP addresses.

Then in the final box, select that are equal to.

For IP address type in yours.

If you need help finding your IP go to type in “What is my IP address?” and it will give it to you. Copy that number and enter it into the filter form.

Click save.

If you work from multiple locations and access your website often you can exclude other IPs by just adding another filter.

*This solution works if you have a static IP, which might be the case if you are working from an office. If you are working from home or on multiple devices then your IP will be changing fairly often. This will need a different solution.

Save this article to Pinterest.

Save this article to read later or to share with friends.

A Pinterest Pin with the text how to add Google Analytics to WordPress: Easy Guide for Beginners