How to Add Google Analytics to WordPress- Beginner’s Guide

Are you looking for a way to improve the performance of your WordPress website? Why don’t you try using Google Analytics? In this article, we will discover the functionality of this tool and all the advantages that you can get by using it. Also, we will explain how to add Google Analytics to your WordPress website.

How to sign up for Google Analytics

Before you can add Google Analytics to your WordPress site, you must first sign up. Don’t worry, the process is quite simple and only requires a Google account.

See the steps to sign up for Google Analytics below:

  1. If you’re not signed in to your Google account or just don’t have one yet, navigate to the .

  2. Now, go to Google Analytics, click on the button configure free to start the process.
  3. In the page Create Accountenter your account name, adjust the Account data sharing settings and then click Following.
  4. In the next section, select how you want to measure your site. Click on the option Web and then continue to the next page.
  5. Enter your website details (ie name, URL, industry category, time zone, etc.) in the third section. Once you’re done, click the button To create.
  6. Google Analytics will then present your Terms of Service. Check all the necessary boxes, then click the button I agree.
  7. That is all! You have successfully created a Google Analytics account.

How to install Google Analytics in WordPress

There are two ways to install Google Analytics on your WordPress site. The first is by using a plugin and the second is to do it manually. See how to do it below.

Add the official WordPress plugin

If you don’t want to modify your theme, you can use a third-party plugin that does the work for you. Not only is it easier, but it reduces the risk of breaking code.

You can consult our guide to learn.

Since there are so many great ones to choose from, we took the liberty of creating this guide using one of the best plugin options on the market: .

With over 3 million installs, MonsterInsights is a great Google Analytics plugin for your marketing needs. The biggest advantage of the plugin lies in its ability to create custom reports based on your chosen parameters.

If you only need the basic features of a web analytics tool, MonsterInsights offers a free lite version. If you need more options, you can upgrade to the for a starting price of $99.50 per year and is an excellent option for small businesses. There are also more options available if you need them.

Here’s how to add Google Analytics with MonsterInsights:

  1. From your WordPress dashboard, go to Plugins -> Add New.
  2. Find the plugin Google Analytics Dashboard Plugin for WordPress by MonsterInsights. Download it and activate it.
  3. Go back to your WordPress dashboard. The new option should appear Insights.
  4. Scroll down and you will see the button Launch the Wizard! Click on it. Follow the instructions to complete the initial setup. This is where you will need to connect MonsterInsights with your Google Analytics account.
  5. Follow the instructions and fill in the necessary information. Once everything is done, you will see the button Finish Setup & Exit Wizard.
  6. Congratulations, you have completed the integration process. You can go to Insights -> Reports to see the performance of your site.

Manually Add Google Analytics to WordPress

Once you have registered your Google Analytics account, you will get a tracking code that you must place on your website.

To add the Google Analytics code to the file functions.php, you need to have a child theme installed. How is this? In addition to being relatively easier to modify, the child theme retains all the changes you’ve made, even when you update the parent theme.

Read this article for more information on .

Get Google Analytics tracking code

Once you have completed the registration process, the service will redirect you to the area where you can obtain the Google Analytics code. However, if you want to retrace the steps, here’s how to get your tracking code manually:

  1. Sign in to your Google Analytics account, then navigate to the menu admin In the bottom left.
  2. Click on the menu Tracking information. Then click on the submenu Tracking code.
  3. You should now be able to see your Tracking ID and the global site tag. Save both codes, as you will need them later.

Once you have obtained the tracking code, you can go to your WordPress to begin the setup steps.

1. functions.php code

There are a couple of ways to add Google Analytics to WordPress using the code snippet.

The first location where you can add the Google Analytics tracking code is the file functions.php. Create a new function containing the code snippet.

NOTE: For precautionary reasons, it is better to create a backup copy of the file before modifying it.

  1. In your WordPress dashboard, navigate to the section theme editor on the menu Appearance.
  2. open the file Theme Functions (functions.php) from the right column.
  3. Add the following code snippet to the file. Don’t forget to replace the tracking ID with yours. add_action(‘wp_head’,’my_analytics’, 20); function my_analytics() { ?>
  4. Once you’re done, click the button update file to save the changes.

You can also add the Google Analytics tracking code to the file Theme Header (header.php).

  1. go to theme editor one more time.
  2. open the file Theme Header (header.php) in the right column.
  3. Paste the code snippet into the header area, or more specifically, above the tag .
  4. Once you’re done, click the button update file to save the changes.

Google Tag Manager

Another method that you can use with Google Analytics and WordPress is the Google method. This is used to increase speed by allowing you to update your own conversion tracking tags, view site analytics, and more.

Easily add or change your labels as you like, or include third-party labels for web and mobile apps. The best thing is that you can update or add more scripts from the user interface instead of doing it in WordPress.

After signing up, download the WordPress Tag Manager. On your WordPress site, go to Plugins -> Add New -> search Google Tag Manager -> Activate.

Once you have done this, you will need to enter your Google Tag ID into the plugin. To do this, go to your Tag Manager site and click admin. Here you will find an ID that starts with GTMcopy it.

Then in WordPress go to Settings -> Google Tag Manager and paste it into the section Google Tag Manager ID.

What is Google Analytics?

Google Analytics is one of the most popular web analytics tools on the market. This free service powered by Google can give you valuable data on website traffic and audience behavior. So you can make data-driven decisions to plan for your site’s growth well in advance.

If you want to learn more about ,sign up for the free Analytics Academy courses. These are ideal for both beginners and advanced, professionals and more.

Why is Google Analytics important?

Often when starting a blog, the main goal is to get more followers and more traffic. Google Analytics is one of the tools that can help you with this.

Here are four reasons why you should consider adding Google Analytics to your WordPress site:

  • Get information about your audience. See who visits your website and where your audience is. You can also see what users are doing and how long they stay on your site. By segmenting your audience, you will be able to develop a business growth plan in a calculated way.
  • Optimize your marketing strategies. Knowing about your market segments will make it easier for you to make decisions and create the right marketing campaigns to achieve optimal results.
  • Maintain quality content. Since the tool allows you to see which pages and links receive the most clicks, you can create better content to meet the needs and preferences of your audience.
  • Identify the most active moment. Post time is one of the most important factors that can affect your website traffic. Once you know those peak times, you can adjust your post time accordingly.

conclusion

Google Analytics is a powerful free web analytics tool that collects crucial information about web performance and target audience. By gaining analytics about your website, you can make data-driven decisions to grow your WordPress website in the most efficient way.

In short, there are two ways to add Google Analytics to a WordPress site:

  • With a Google Analytics plugin for WordPress: we recommend using for this.
  • add it manually: adds a code snippet along with the tracking code to the file functions.php either header.php.

We hope that this guide has been useful to you on how to add Google Analytics to WordPress. If you have any more questions, feel free to leave a comment below.

Gustavo is passionate about creating websites. He focuses on the application of SEO strategies at for Spain and Latin America, as well as the creation of high-level content. When he is not applying new WordPress tricks you can find him playing the guitar, traveling or taking an online course.

See also  How to install an SSL certificate on an Apache web server
Loading Facebook Comments ...
Loading Disqus Comments ...