Simplifying Digital Marketing
Wordpress Google Analytics

How to setup Google Analytics on WordPress Website10 min read

Google Analytics is a free, all-in-one tool that lets you track your website’s data and traffic.

Google Analytics

Google Analytics will tell you how many people visit your site, which pages they look at, how many of them buy something, and how they interact with your content. This information is very important for making your website work better.

There are two different kinds of code for Google Analytics.

You may be familiar with the Google Universal Analytics (UA) code. This is going away, and Google Analytics 4 will take its place.

GA4 is much more flexible and can be used on both websites and apps. Google UA, on the other hand, can only be used on websites.

Setting up Google Analytics on your website

Set up your free Google Analytics account. This is the first thing you should do.

You will be asked to use your Gmail account to sign in. After that, you’ll be signed in.

Select the “Start Measuring” button.

Google Analytics Home Page
Screenshot from Google Analytics Website

On the next screen, you’ll be asked to name your account. You can track more than one site with the same account, so you might want to use something broad like the name of your business.

Screenshot from Google Analytics Website

The next step is to set up properties. This should include the name of your website, the time zone, and the currency used at this business’s location.

On the next screen, Google Analytics will ask you a few questions about your business and how you plan to use it.

If you click on the agreement terms and choose “email communications,” you’ll be taken to the admin dashboard.

Screenshot from Google Analytics Website

Set up the data stream as the next step.

You should choose “web stream” when adding Google Analytics to a WordPress site.

Next, you will add your site’s URL and name.

When you click the Create Stream button, you will see the stream name, stream URL, stream id, and measurement id.

You will use the measurement id to add something to your website.

Screenshot from Google Analytics Website

Adding Google Analytics to your WordPress site

Any WordPress site can add Google Analytics in three different ways.

How comfortable you are with making changes to your website’s code will determine which option is best for you.

In the first option, you can add Google Analytics to your website without knowing how to code.

The second choice is to use a WordPress plugin that requires you to copy and paste a small amount of code.

You must change the code in your website’s theme files for the third choice.

1. Using the plugin for Google Analytics

A plugin is the easiest way to add your Google Analytics tag code to WordPress.

The most popular is Google Analytics for WordPress by MonsterInsights. It makes it easy to add your Google Analytics code to your site.

The free version should work fine if you don’t need advanced tracking and reporting tools. Then it would help if you switched to the pro version.

Screenshot from Website
  • Step 1: Install the MonsterInsights plugin and turn it on.
  • Step 2: Start the Wizard and fill in information about your site, then click the Connect MonsterInsights button. This will take you through a few pages of settings that should already be chosen for your setup.
  • Step 3: Next, you’ll be asked to sign in to your Gmail account and give permission to access your Google account.
  • Step 4: Click “Allow,” and it will show the Google Analytics account to which it will connect.
  • Step 5: Click Complete Connection to connect to your Google Analytics account. In the end, it will offer to upgrade to Pro, but you can finish the installation without upgrading by clicking the link at the bottom.

Now that everything is set up, you can see Insights in your WordPress dashboard. The WordPress dashboard now shows Reports, Settings, and any other tools that have been chosen.

A header/footer plugin is the second way to put your Google Analytics tag on your site.

This method is beneficial if you want to track different metrics for different pages since it can be used on both individual and site pages.

Screenshot from Website

WPCode Insert Headers and Footers Plus Custom Code Snippets – Over 1 million people use the WordPress Code Manager plugin to add code to the header and footer.

  • Step 1: Add the Headers and Footers plugin on your WordPress site.
  • Step 2: In your Google Analytics account, click on Tagging Instructions and then click on the Install Manually tab.
  • Step 3: Copy the code for the Google Tag.
  • Step 4: On the left side of your WordPress dashboard, you’ll see a link to the Code Snippets plugin.
  • Step 5: From the drop-down menu, choose Header & Footer. Then, paste your code into the Header section.
  • Step 6: Hit Save Changes.

3. Put a piece of Google Analytics code directly in the Header.php file

This is another way to add your Google Analytics code if you are comfortable working right in your theme’s code. Remember that you are directly changing the theme files, so if you change or update your theme, you will lose your Google Analytics code and have to add it again every time you change or update the theme.

  • Step 1: Go to Appearance > Theme File Editor in the WordPress dashboard.
  • Step 2: Choose the theme’s parent and the file “header.php.”
  • Step 3: Copy and paste the code right before the /head> element.
  • Step 4: To save your changes, click Update File.
Screenshot from Website

Checking that your Google Analytics tags work

Once you’ve added the Google Analytics tag to your website, you can use the Tag Assistant (Legacy) by Google Chrome Extension to ensure it’s working correctly.

Just add the Chrome extension to your browser, go to the WordPress site where you installed Google Analytics, and it will tell you which tags are there and if there are any errors.

Screenshot from Google Extensions Website

Once Google Analytics is set up on your WordPress site

Once your Google Analytics tag is set up, you can go to the Google Analytics site to see the dashboard.

If you choose to install Google Analytics on your WordPress site with the MonsterInsight plugin instead, you can view the reports and data right from your WordPress dashboard.

Google Analytics is a powerful tool that can help you determine how people find and use your website, how well pages convert, how many people visit your site, and much more.

There are three easy ways to add the Google Analytics tag to a WordPress site:

  • Plug-in for Google Analytics (such as MonsterInsights).
  • Header/Footer plugin (such as WPCode).
  • Add right to the header.php file of the theme.

You can use the data from Google Analytics to learn essential things about how people use your website, which will help you make changes.

It’s important to note that Google Analytics can’t collect data from the past. If you don’t want to miss any data, you should add Google Analytics to your website as soon as possible.

Verified by MonsterInsights