WPBeginner

Beginner's Guide for WordPress

  • Blog
    • Beginners Guide
    • News
    • Opinion
    • Showcase
    • Themes
    • Tutorials
    • WordPress Plugins
  • Start Here
    • How to Start a Blog
    • Create a Website
    • Start an Online Store
    • Best Website Builder
    • Email Marketing
    • WordPress Hosting
  • Deals
    • Bluehost Coupon
    • SiteGround Coupon
    • WP Engine Coupon
    • HostGator Coupon
    • Domain.com Coupon
    • Constant Contact
    • View All Deals »
  • Glossary
  • Videos
  • Products
X
☰
Beginner's Guide for WordPress / Start your WordPress Blog in minutes
Choosing the Best
WordPress Hosting
How to Easily
Install WordPress
Recommended
WordPress Plugins
View all Guides

WPBeginner» Blog» Beginners Guide» How to Install Google Analytics in WordPress for Beginners

How to Install Google Analytics in WordPress for Beginners

Last updated on December 5th, 2019 by Editorial Staff
2.7k Shares
Share
Tweet
Share
Pin
Special WordPress Hosting offer for WPBeginner Readers
How to Install Google Analytics in WordPress for Beginners

Do you want to install Google Analytics in WordPress? Knowing how your audience interacts with your website is crucial for your success.

The best way to know your audience is through your traffic stats, and this is what Google Analytics provides for FREE.

In this article, we will share why Google Analytics is important, and how you can easily install Google Analytics in your WordPress website (step by step).

How to Install Google Analytics in WordPress

First, we will explain why Google Analytics is important and how it can help you grow your website.

After that, we will show you how to sign up for a Google Analytics account and different methods to install it on your WordPress site.

Finally, we will explain how to view your traffic reports in Google Analytics.

Here is a quick overview of what you’ll learn in this article.

  • Why is Google Analytics Important
  • How to Sign up with Google Analytics
  • How to Install Google Analytics Using MonsterInsights (Recommended)
  • How to Install Google Analytics Using Insert Headers & Footers Plugin
  • How to Install Google Analytics in WordPress Theme (Advanced)
  • Viewing Reports in Google Analytics
  • Making the Most out of Google Analytics
    • Ready let’s get started.

      Video Tutorial

      Subscribe to WPBeginner

      If you don’t want to watch the video tutorial, then you can continue reading the text version below:

      Why is Google Analytics Important for Bloggers?

      Once you start a blog, your #1 goal is to get more traffic and subscribers. Google Analytics help you make data-driven decisions by showing you the stats that matter. You can see:

      Who visits your website?

      This part of analytics answers what is the geographical location of your audience, which browser did the user use to visit your site and other important information such as screen resolution, JavaScript support, Flash support, language and more.

      This data is extremely useful, and it can help in numerous ways. When getting a custom design, you can use the user data to make sure that your site will be compatible with your audience.

      If most of your users don’t have Flash support, then you should avoid adding the flash element in your site. If most of your users are on 1280 screen resolutions, then make sure that your design is compatible with that resolution or smaller.

      What do people do when they are on your website?

      You can track where the users are going on your website, how long do they stay on your website, and what is the bounce rate (the percent of users exit your site on the first visit).

      By using this information, you can decrease the bounce rate and increase your pageviews.

      You can also find your most popular articles, articles that are not doing so well, and what kind of content your users are looking for.

      When do people visit your website?

      By looking at the hottest hours in the day for your site, you can pick the time when you publish your post. If that time zone is not compatible with yours, then you can schedule your post to meet that hour.

      How do people find your website?

      This section of the analytics shows you where did the users come from (for example: Search Engines, Direct Links, Referral links from another site).

      It also shows you what percentage of your visitors came from each of these sources. Google analytics gives you the breakdown of each of these categories. If it is the search engine category, then it shows you which search engine got you the most traffic, Google, Yahoo, Bing etc.

      The breakdown of referral sources shows you which sites you need to work with the most. If your top referral source is Facebook, then you need to have exclusive Facebook content to make your Facebook audience feel special.

      If your top referral source is an external website, then you might want to consider having a partnership with that website (guest post exchange or something else).

      How do people interact with your content?

      Google analytics shows how your users interact with your site’s content. It shows you what percent of the user clicked on which link on your site and much more.

      You can run A/B split tests by creating content experiments in Google Analytics to understand what works best to meet your goals.

      By seeing the user interactivity, you can work your content around your users. By seeing the answers to the questions above, you can focus on the strategies that work for your site and avoid strategies that don’t work.

      Simply put, eliminate the guesswork and focus on stats that matter, so you can make data driven-decisions.

      How to Signup with Google Analytics

      Google Analytics is available for free and all you need is a Google or Gmail account to sign up. The sign up process is quite simple, follow the step by step instructions below to create your Google Analytics account.

      Step 1: First you need to visit Google Analytics sign up.

      You will be asked to login with your Google account. If you already have a Google or Gmail account, then you can use that to sign-in. Otherwise, you can go ahead and create a Google account for yourself.

      Sign in with your Google account

      Step 2: Once you sign-in with your Gmail account, you will be prompted to a screen like the one below. This is where you will signup for Google analytics with your Gmail account.

      Sign up for Google Analytics

      After that, you will be asked to provide an account name. This name will be used internally so you can use anything like your business name.

      Enter account name

      Step 3: On the next screen, you will be given choice to choose between a website or mobile app. Make sure you select website.

      Select website

      After that, you need to enter website name, website’s URL, country, and the time zone.

      Provide website details

      Once you have entered this information, click on the Next button. You will be presented with Google Analytics terms and service which you must agree to, so click on ‘I Agree’ button.

      Step 4: Now you will be presented with your Google Analytics tracking code. You can copy this tracking code because you will need to enter it in your WordPress site depending on the method you use below.

      Google Analytics tracking code

      We suggest leaving the analytics browser tab open as you may need to revisit it, once you have installed the code on your WordPress site.

      Now that you have setup a Google Analytics account, let’s take a look at how to install Google Analytics in WordPress.

      How to Install Google Analytics in WordPress

      There are a few different ways to setup Google Analytics in WordPress. We will show you three methods where the first option is the easiest and the last being the hardest.

      You can choose the one that best suits your needs.

      1. Google Analytics for WordPress by MonsterInsights

      MonsterInsights is the most popular Google Analytics plugin for WordPress. Over 1 million websites use it including the likes of Bloomberg, PlayStation, Zillow, and more.

      It is the easiest and by far the best way to add Google Analytics to WordPress (for all users beginners and experts alike).

      MonsterInsights is available as both, a paid premium plugin, and a free version. In this tutorial, we will be using the MonsterInsights free version.

      You can use the MonsterInsights Pro version if you want more advanced features like E-commerce tracking, Ads tracking, Author tracking, etc. The process of setting them up is the same.

      Let’s get started.

      The first thing you need to do is install and activate the MonsterInsights plugin. For more details, see our step by step guide on how to install a WordPress plugin.

      Upon activation, the plugin will add a new menu item labeled ‘Insights’ to your WordPress admin menu. Clicking on it will bring the MonsterInsights setup wizard.

      MonsterInsights setup wizard

      First, you will be asked to choose a category for your website (a business website, blog, or online store). Select one and then click on ‘Save and Continue’ button.

      Next, you need to click on the ‘Connect MonsterInsights’ button.

      Connect MonsterInsights

      This will bring up a popup that will take you Google accounts where you will be asked to sign in or select a Google account if you are already signed in.

      Sign in or select a Google account to continue

      Next, you will be asked to allow MonsterInsights to access your Google Analytics account.

      Allow MonsterInsights to access your Google Analytics account

      Click on the ‘Allow’ button to continue.

      The final step is to select the profile you want to track. You need to select your website here and then click on the ‘Complete authentication’ button to continue.

      Select your website profile to compete setup

      MonsterInsights will now install Google Analytics on your website. After that you will be asked to select the recommended settings for your website.

      Recommended settings for Google Analytics

      The default settings would work for most websites. If you use an affiliate link plugin, then you need to add the path you use to cloak affiliate links. This will allow you to track your affiliate links in Google Analytics.

      Click on the Save and Continue button to save your settings.

      Next, MonsterInsights will show you paid add-ons that you can access if you upgrade to PRO. You can simply click on the ‘Save and Continue’ button to skip this step.

      Upgrade to pro

      After that, you will be asked to install WPForms plugin, which is the best WordPress contact form plugin. You can install it or simply click on ‘Skip this Step’

      Recommended plugin

      That’s all you have successfully installed and setup Google Analytics on your WordPress site. Remember, it will take Google Analytics sometime before showing your stats.

      Google Analytics successfully installed using MonsterInsights

      The best part about MonsterInsights is that you can view your Google Analytics reports inside your WordPress dashboard. Simply visit Insights &raqo; Reports page to check out a quick overview of your analytics data.

      Your Google Analytics reports in WordPress dashboard

      Note: MonsterInsights was formerly known as Google Analytics for WordPress by Yoast. WPBeginner’s founder, Syed Balkhi, acquired the plugin in 2016 and rebranded it to MonsterInsights. Now it is part of our family of premium WordPress plugins.

      2. Insert Headers and Footers Plugin

      This method is not as not as good as MonsterInsights because you will not be able to do advanced tracking configuration, and you will not be able to view Google Analytics data in your WordPress dashboard.

      First, you need to install and activate the Insert Headers and Footers plugin. For more details, see our step by step guide on how to install a WordPress plugin.

      Upon activation, you need to visit Settings » Insert Headers and Footers page. Here you need to paste the Google Analytics code that you copied in step 4 into the headers section.

      Adding Google Analytics tracking code using Insert Headers and Footers plugin

      Don’t forget to click on the save changes button to store your settings.

      That’s all, you have successfully installed Google Analytics on your site.

      3. Install Google Analytics in WordPress Theme

      This method is for advanced users who are familiar with the code. It is somewhat unreliable because your code will disappear if you switch or update the theme. We almost never recommend using this method.

      If this is your first time adding code to your WordPress files, then you should check out our guide on how to copy paste code snippets in WordPress.

      Add code in header.php file

      Simply edit the header.php file in your WordPress theme and paste the code you copied in step 4 right after the <body> tag.

      Don’t forget to save your changes and upload the file back to your server.

      Add via Functions File

      You can also add Google Analytics tracking code to WordPress functions file. It will then automatically add the tracking code to every page on your WordPress site.

      You will need to add this code to your theme’s functions.php file.

      <?php
      add_action('wp_head', 'wpb_add_googleanalytics');
      function wpb_add_googleanalytics() { ?>
      
      // Paste your Google Analytics code from Step 4 here
      
      <?php } ?>
      

      Viewing Reports on Google Analytics Website

      Google Analytics is capable of showing you a treasure of data collected from your stats. You can view this data by visiting your Google Analytics dashboard.

      Google Analytics reporting

      You will see the built-in Google Analytics reports in the left column. Each section is divided into different tabs and clicking on a tab will expand it to show more options.

      • Real-time This report will show you a real time view of your traffic.
      • Audience tab will show reports to help you understand your users.
      • Acquisition reports explore where your users came from.
      • Behavior reports summarize what your users do after they arrive on your site.
      • Conversion reports show how well you’re doing against your goals.

      Making the Most out of Google Analytics

      Google Analytics is an incredibly powerful tool with tons of awesome features. Some of them are quite obvious and easy to use, others require some additional setup.

      Here are some of the resources that will help you make the most out of Google Analytics reports.

      • Track user engagement in WordPress with Google Analytics
      • Track WooCommerce customers in Google Analytics
      • Track outbound links in WordPress

      Google Analytics works best with Google Search Console (formerly Google Webmaster Tools). It allows you to see how your website is doing in search results. See our complete Google Search Console guide to learn how to use it to grow your website.

      We hope this article helped you learn how to install Google Analytics in WordPress. You may also want to see our ultimate WordPress SEO guide for beginners.

      If you liked this article, then please subscribe to our YouTube Channel for WordPress video tutorials. You can also find us on Twitter and Facebook.

2.7k Shares
Share
Tweet
Share
Pin
Popular on WPBeginner Right Now!
  • How to Start Your Own Podcast (Step by Step)

    How to Start Your Own Podcast (Step by Step)

  • Revealed: Why Building an Email List is so Important Today (6 Reasons)

    Revealed: Why Building an Email List is so Important Today (6 Reasons)

  • How to Properly Move Your Blog from WordPress.com to WordPress.org

  • Error Establishing a Database Connection in WordPress

    How to Fix the Error Establishing a Database Connection in WordPress

About the Editorial Staff

Editorial Staff at WPBeginner is a team of WordPress experts led by Syed Balkhi. Trusted by over 1.3 million readers worldwide.

The Ultimate WordPress Toolkit

687 Comments

Leave a Reply
  1. Jaliah Nabbowa says:
    Nov 27, 2019 at 3:54 am

    Hi, I am using a personal plan so I can’t install any plugins.

    I have gone to my dashboard to try and install the code manually, so I scrolled to appearance but I don’t have an editor option.

    Does this mean I have to upgrade to business plan? Because that would be too costly for me.

    Reply
    • WPBeginner Support says:
      Nov 27, 2019 at 10:11 am

      That would depend on WordPress.com’s current limitations, our guides are for WordPress.org sites, you can see the difference here: https://www.wpbeginner.com/beginners-guide/self-hosted-wordpress-org-vs-free-wordpress-com-infograph/ :)

      Reply
  2. reena says:
    Nov 14, 2019 at 11:31 pm

    i have added my google analytic code to.my wordpress site ,so then also i am not getting traffic to my website,what will be the readon for the same

    Reply
    • WPBeginner Support says:
      Nov 15, 2019 at 10:03 am

      There are multiple possible reasons for low traffic, for increasing your site’s traffic you would want to take a look at our article here: https://www.wpbeginner.com/beginners-guide/how-to-increase-your-blog-traffic/

      Reply
  3. Mina says:
    Oct 28, 2019 at 2:58 am

    Thank you for the information. I am currently using the first option but I recently got a message that says: No Hits

    Property is not receiving hits.

    I am no longer getting a page view analysis or any info.
    What can I do to resolve it?

    Reply
    • WPBeginner Support says:
      Oct 28, 2019 at 1:46 pm

      Have you tested with an incognito browser to see if it counts a hit? The MonsterInsights plugin would normally filter out admin activity

      Reply
  4. Colleen says:
    Oct 16, 2019 at 10:42 am

    I love when you make WordPress so easy for me!

    Reply
    • WPBeginner Support says:
      Oct 16, 2019 at 12:26 pm

      Glad we can help remove any confusion :)

      Reply
  5. Amer says:
    Oct 15, 2019 at 2:55 pm

    I have blog on wordpress.com with premium (8 dollars a month) subscription and I can’t implement code from Google Analitycs. Is there any script for that or I must upgrade for bussienes plan or maybe migrate on wordpress.org

    Reply
    • WPBeginner Support says:
      Oct 16, 2019 at 10:10 am

      Currently, you would need to use their business plan or move to WordPress.org.

      Reply
  6. Nancy Moore says:
    Oct 12, 2019 at 12:16 am

    Thank you so much! The tutorial was fantastic. I use MonsterInsight.

    Reply
    • WPBeginner Support says:
      Oct 14, 2019 at 10:31 am

      You’re welcome, glad our article was helpful :)

      Reply
  7. Maria says:
    Oct 11, 2019 at 3:03 am

    Hi there! Thank you for yet another amazing article. So I had installed GA via Monster Insights a couple of years ago but I also have the Headers & Footers plugin for other uses anyway. I am currently looking into getting rid of some plugins so I want to ditch the Monster Insights one as I never look at the metrics from WP anyway. What should I do? Add the GA tracking code to header first and then delete Monster Insights plugin or vice versa? Will this change affect my stats somehow? Will I lose any stats in the process? Thank you so much in advance.

    Reply
    • WPBeginner Support says:
      Oct 11, 2019 at 10:52 am

      You would want to add your code after removing MonsterInsights, you shouldn’t lose any data you would only lose any specific setup that you had in MonsterInsights such as filtering out your visits.

      Reply
  8. CocktailTravellers says:
    Oct 7, 2019 at 12:06 am

    Amazing tutorial, thank you for taking the time to record and show all 3 methods. I have watched so many video’s that simply say, now add the code to your website, and then move on to the next topic. Have been looking for ages to find a video that shows you how to add the code.
    Thanks to Jaison from bluehost help for connecting me with this video!

    Reply
    • WPBeginner Support says:
      Oct 7, 2019 at 10:53 am

      Glad our video could be helpful :)

      Reply
  9. Mohamed says:
    Sep 14, 2019 at 3:09 pm

    I could not pass this point
    Connect MonsterInsights’
    should i try another way????

    Reply
    • WPBeginner Support says:
      Sep 16, 2019 at 10:22 am

      It would depend on the issue you’re running into, if there is an error, reach out to MonsterInsight’s support and they will be able to assist

      Reply
  10. Laura says:
    Sep 13, 2019 at 3:12 pm

    Thank you! This article made it easy and quick to get set up! Blessings to you!

    Reply
    • WPBeginner Support says:
      Sep 16, 2019 at 9:50 am

      Glad our article could be helpful :)

      Reply
  11. Paige says:
    Sep 11, 2019 at 10:55 am

    Well, unfortunately this plugin crashed my website and WP is asking for $185 to fix it. I cannot access my website to uninstall Google Analytics. Any suggestions? I am a true Beginner to all of this.

    Reply
    • WPBeginner Support says:
      Sep 12, 2019 at 9:16 am

      A developer may be asking for $185 but WordPress shouldn’t be requesting money to fix your site. If you believe the error is from this plugin you can disable it using the method in our article here: https://www.wpbeginner.com/plugins/how-to-deactivate-all-plugins-when-not-able-to-access-wp-admin/

      Reply
  12. Ridwan says:
    Sep 10, 2019 at 6:04 am

    Thanks for the article, it’s helpful

    Reply
    • WPBeginner Support says:
      Sep 10, 2019 at 9:45 am

      You’re welcome, glad you found our content helpful :)

      Reply
  13. Chris says:
    Aug 31, 2019 at 3:03 am

    Hi. In section 3 where you say to add the code immediately after the tag, shouldn’t that be immediately after the opening tag?

    Reply
    • WPBeginner Support says:
      Sep 4, 2019 at 9:22 am

      We recommend the location we do in the article as your site would load the scripts above it first to start displaying your site before loading Google Analytics rather than first waiting for Google Analytics tracking then displaying your content.

      Reply
  14. Juliette says:
    Aug 30, 2019 at 3:14 pm

    Thank you for yet another great article!

    Reply
    • WPBeginner Support says:
      Aug 30, 2019 at 3:31 pm

      You’re welcome :)

      Reply
  15. Becky Antkowiak says:
    Aug 29, 2019 at 10:35 pm

    Hi, yesterday I installed using Monster Insights and kept scrolling to read, then closed down for the evening. Today, I opened it back up, forgot that I’d already installed MI and used the header/footer method. Will they cancel each other out, or is it okay to leave it?

    Thanks,
    Becky

    Reply
    • WPBeginner Support says:
      Aug 30, 2019 at 9:37 am

      You would want to remove the header method and keep the MonsterInsights method if you want to keep using MonsterInsights. If you don’t remove the extra method then it would show incorrect information.

      Reply
  16. Roma says:
    Aug 27, 2019 at 4:36 pm

    Thanks so helpful, and so easy to follow. I stuck with your header and footer plugin as analytics stop communicating with another plugin that I was using.

    Reply
    • WPBeginner Support says:
      Aug 28, 2019 at 9:20 am

      You’re welcome, glad our guide could be helpful :)

      Reply
  17. Patrick Schmitt says:
    Aug 18, 2019 at 12:36 pm

    The insert header and footer plugin helped me a lot. I use Flatsome child plugin and dont know how it works with that system…

    with the plugin it was easy going :)

    Thanks a lot!
    Cheers,
    Patrick

    Reply
    • WPBeginner Support says:
      Aug 19, 2019 at 10:54 am

      Glad our plugin could be helpful :)

      Reply
  18. Nicolai says:
    Jul 30, 2019 at 8:12 am

    Thanks! This made the process so easy!

    Reply
    • WPBeginner Support says:
      Jul 30, 2019 at 9:51 am

      Glad our recommendations could help :)

      Reply
  19. aniodo samuel says:
    Jul 25, 2019 at 4:39 pm

    great job it really helped.

    Reply
    • WPBeginner Support says:
      Jul 26, 2019 at 10:01 am

      Glad our article helped :)

      Reply
  20. San says:
    Jun 7, 2019 at 2:29 pm

    Hi,
    Thanks for this article, it’s very clear and easy to follow. I have successfully installed monsterInsights and have been tracking for a few days now.

    However Analytics seems to track only normal pages and not post-type pages (posts, news, etc.) on my site. Any ideas how to fix this? Thanks!

    Reply
    • WPBeginner Support says:
      Jun 10, 2019 at 11:22 am

      If it’s not tracking your analytics correctly for your posts, if you reach out to MonsterInsights’ support they should be able to help you check for any errors with the plugin.

      Reply
  21. Shireen says:
    Jun 1, 2019 at 10:43 am

    Your PHP code changes were rolled back due to an error on line 534 of file wp-content/themes/infinite/functions.php. Please fix and try saving again.

    syntax error, unexpected ‘<'

    That's the message I get :-/

    Reply
    • WPBeginner Support says:
      Jun 3, 2019 at 11:53 am

      It would depend on the method you were using to place the code for why that error is popping up. If you’re using the manual method you may want to try adding to your functions.php

      Reply
  22. Alessio says:
    May 10, 2019 at 2:11 am

    Can I use Google Analytics with a Premium subscription in WP?
    I’ve this doubt ’cause on the official subscription page they say that the Premium account doesn’t support Google Analytics.

    Reply
    • WPBeginner Support says:
      May 10, 2019 at 11:30 am

      If you’re on WordPress.com then they normally require the business plan, our tutorials are for WordPress.org sites :)

      Reply
  23. Ubaid says:
    Apr 19, 2019 at 7:21 am

    How I check google analytics is successfully installed on my website?

    Reply
    • WPBeginner Support says:
      Apr 19, 2019 at 11:14 am

      You would either use inspect element to see if your code was added to your site or you could wait the 14-48 hours to see if it starts collecting your site information.

      Reply
  24. Melissa says:
    Apr 15, 2019 at 10:22 am

    When I try to set up google analytics it says my URL is invalid. I have checked it and triple- triple checked it. I’m not sure what im doing wrong.
    any suggestions?

    Reply
    • WPBeginner Support says:
      Apr 15, 2019 at 1:23 pm

      You may want to check that if your site is using https the url you have set in Google Analytics is also the same.

      Reply
  25. Ally says:
    Apr 14, 2019 at 7:39 pm

    Hello, I have a free wordpress.com account and to use the MonsterInsights or headers/footers plugins, it is requiring me to upgrade to a premium business account. Is there a way to use Google Analytics without paying for a business account?

    Thank you in advance.

    Reply
    • WPBeginner Support says:
      Apr 15, 2019 at 12:55 pm

      Not for WordPress.com at the moment, for clarification our tutorials are for WordPress.org sites: https://www.wpbeginner.com/beginners-guide/self-hosted-wordpress-org-vs-free-wordpress-com-infograph/

      Reply
  26. Julie M says:
    Apr 8, 2019 at 12:24 pm

    Thank you so much for this tutorial! Step by step instructions were perfect!

    Reply
    • WPBeginner Support says:
      Apr 8, 2019 at 1:23 pm

      Thank you, glad our article could help :)

      Reply
  27. Merrily says:
    Mar 28, 2019 at 4:31 pm

    Hi, I have tried following the steps in your tutorial, but when I try to connect to google analytics, I am constantly told that I google analytics is only available with a “g suite” email, not an email ending in gmail.com. But I see in your example where it says “allow monster insights to access your google account” that your sample email ends in gmail.com. How can I get past this to access google analytics for my site? Thanks.

    Reply
    • WPBeginner Support says:
      Mar 29, 2019 at 10:37 am

      You would want to ensure you are using the same email you used to create your Google Analytics account and if you continue to have that problem, if you reach out to the plugin’s support they should be able to assist.

      Reply
  28. Carrie says:
    Feb 25, 2019 at 4:19 pm

    Is it okay to have the Yoast SEO plug in AND monster Insights, or should I get rid of the plug in? (I was finding it difficult anyways and don’t think I have it set up properly)

    Reply
    • WPBeginner Support says:
      Feb 26, 2019 at 11:42 am

      You can use both plugins, MonsterInsights helps you see what Google Analytics is saying about your site while Yoast helps Google understand what your site is about :)

      Reply
  29. Anthony says:
    Feb 21, 2019 at 9:17 am

    Is it OK to add the UA-XXXXXXXX code to BOTH the “Monster Insights” plugin – AND TO – the “All in One SEO ” plugin at the same time ?

    Reply
    • WPBeginner Support says:
      Feb 21, 2019 at 10:56 am

      You would want to only add it using one method to reduce the chance of issues :)

      Reply
  30. Faizan Zafar says:
    Feb 2, 2019 at 2:34 pm

    I am very much confused how to add google analytics to my site. If i donot want to use the pluggin which steps I should take?

    Reply
    • WPBeginner Support says:
      Feb 4, 2019 at 2:39 pm

      If you do not want to use a plugin then you would want to create a child theme and use the third method in the article to add the code. For how to create a child theme you can take a look at: https://www.wpbeginner.com/glossary/child-theme/

      Reply
  31. Eric says:
    Jan 7, 2019 at 4:14 pm

    Very good post. As a newbee in this field, I was able to install the Insert Headers and Footers Plugin and connect with Google Analytics. This was for my Photography website.
    Besides this, I also have a business website where I want to install this plugin and have Google Analytics. How can I do this? When I signin with Google, I am always redirect to Google Analytics of my Photography website?
    How can I have a new script for my business website?
    I hope to get a clear answer as I’m a newbee :-)

    Reply
    • WPBeginner Support says:
      Jan 7, 2019 at 11:51 pm

      Hi Eric,

      Google Analytics allows you to add multiple websites. It calls them properties. Under your Google Analytics account click on the “Admin” menu at the bottom left corner of the screen. After that you will see an option to Add Property.

      Reply
  32. Michelle says:
    Jan 4, 2019 at 7:42 pm

    I’m so grateful for this article! I have been banging my head trying to figure this out on my own. Thank you!

    Reply
    • WPBeginner Support says:
      Jan 8, 2019 at 10:04 am

      Glad our guide could help you :)

      Reply
  33. Daniel Ajumobi says:
    Dec 18, 2018 at 10:29 pm

    Thanks so so much.
    Quite helpful and relieving.

    Reply
    • WPBeginner Support says:
      Dec 19, 2018 at 10:53 am

      Glad our article could be helpful :)

      Reply
  34. Tiago says:
    Nov 10, 2018 at 5:56 pm

    Hi, I already had the Headers and footers plugin, since I have installed Monstterinsights, can I now uninstall Headers and Footers? Thanks.

    Reply
    • WPBeginner Support says:
      Nov 12, 2018 at 3:57 am

      Hi Tiago,

      If you were using Insert Headers and Footers plugin just for Google Analytics code, then you can uninstall it after setting up MonsterInsights.

      Reply
  35. Melanie says:
    Oct 25, 2018 at 12:36 pm

    Being a newbie at blogging, I see now that when I first set up my blog I used the Insert Headers and Footers for my Analytics code. A year later (not knowing what I was doing) managed to set up MonsterInsights with a new Google Analytics account. I have now realized that I have two Google Analytics accounts tracking the same blog- one through Insert Headers and Footers and the other through MonsterInsights. Interesting to note, Insert headers and footers shows more visitors a month (almost 5,000 more). Which one do you think is more accurate? Which one do you think I should keep? Are there any negatives if I stop using one of them? Thanks so much for this video and advice!

    Reply
  36. Tyler says:
    Oct 13, 2018 at 9:38 am

    I can NOT seem to access the functions.php folder ANYWHERE!!! :( For whatever reason when I click on “Appearance” in the sidebar all I see is “Themes, customize, widgets, menus, header, background, theme options, amp, and Mobile” Where is Editor?? What is going on??

    Reply
    • WPBeginner Support says:
      Oct 14, 2018 at 2:51 pm

      Hi Tyler,

      functions.php is a file not a folder. You can also access it using FTP, simply connect to your website and go to wp-content/themes/your-theme-folder/ inside you will see your theme’s functions.php file which you can then edit using a plain text editor like notepad.

      Reply
  37. zoziano says:
    Sep 22, 2018 at 1:49 pm

    Well, i thought you were kidding. Many Tutorials make it so complicated and you got it done in 3 minutes!
    Thank you so much for that!

    Reply
  38. krider says:
    Sep 20, 2018 at 3:53 pm

    which one is best plugin one or directly adding code to header…which one make page slow or website slow as compare to other

    Reply
  39. Daniel says:
    Aug 13, 2018 at 11:17 am

    It is awesome thanks for the guidance!!!!!!!!

    Reply
  40. Sagar Mandan says:
    Aug 12, 2018 at 12:29 am

    Hi,

    I was using last method previously. I recently upadated theme. I was adding code in header.php and was adding code below tag. Because now I am unable to track and also unable to see code in view source Does mosterinsights show on analytics.google.com.

    Am I correct.

    Reply
  41. Helena says:
    Aug 11, 2018 at 3:07 pm

    I don’t know what’s wrong but my Analytics only detects AMP view so I tried to add new GA account and followed all these steps. Hope my stats back to normal. Thank you.

    Reply
  42. Gabriel says:
    Aug 1, 2018 at 11:26 am

    Hi…
    Is it posaible to add two websites to a single google analytic account?
    If yes, how can I do that?

    Reply
    • WPBeginner Support says:
      Aug 2, 2018 at 7:30 pm

      Hi Gabriel,

      Yes, you can add multiple websites to Google Analytics using the same Google account. Simply go to Google Analytics dashboard and click on the ‘Admin’ button. On the next screen, you can click on ‘Create New Account’ button and add another website.

      Reply
  43. Speaker Tim White says:
    Jul 13, 2018 at 1:57 am

    Hi guys!

    Long time fan and customer (Love my WPForms!).

    Question regarding this great post:

    Are there any negative effects if I add BOTH plugins?

    Thanks for your great work,

    Speaker Tim White

    Reply
    • WPBeginner Support says:
      Jul 13, 2018 at 3:21 pm

      Hello Tim,

      Yes, there are negative effects if you used both plugins. They will both be loading Google Analytics which would affect reporting. We recommend using MonsterInsights, because it will give you access to beautiful reports and advanced features.

      Reply
  44. Timo says:
    Jul 1, 2018 at 4:03 am

    Great description! I’m a WordPress-beginner and found it incredibly useful. I set it up in just a few minutes thanks to your detailed step-by-step-instructions! :)

    Reply
  45. Cory says:
    Jun 12, 2018 at 6:08 pm

    Thank you so much! This was incredibly helpful! The video made it so easy.

    Thank you guys :)

    Reply
  46. Le Huu Tai says:
    Jun 10, 2018 at 4:32 am

    Hey dude,

    This is really complete. However, I rather to know that is it better to install GA later when a new site reaches a certain decent traffic

    thank you

    Reply
    • Joey S says:
      Jun 13, 2018 at 1:24 am

      I’m not sure I agree with this. I don’t think it’s ever too early to setup GA. in fact it’s one of the first things I setup. Almost no fun if you can’t see what kind of traction your blog is getting.

      Reply
  47. majju says:
    Jun 6, 2018 at 6:57 am

    when i’m clicking on monsterinsight install. nthng is happening and install button is not accessible to me.

    Reply
  48. Rohit jaiswal says:
    Apr 30, 2018 at 4:14 am

    Simply edit the header.php file in your WordPress theme and paste the code you copied in step 4 right after the tag.

    Is it really true ” right after the tag.” ?

    Reply
  49. Dave says:
    Apr 25, 2018 at 10:34 am

    I run a marketplace website that enables content owners sell their products. So I want each owner to be able to see, in real time, the analytics of each product they own, like number of items sold, how much was made, customer location, etc. when they login to their portal. Is this feature available with MonsterInsights?

    Reply
    • WPBeginner Support says:
      Apr 25, 2018 at 7:16 pm

      Hi Dave,

      It is actually done by your eCommerce software. Please see our guide on how to create an online marketplace using WordPress.

      Reply
  50. Paul Larkin says:
    Apr 25, 2018 at 9:59 am

    Excellent. Brilliant. Very clear explanation. Easy to follow. I used Monster Insights and it was exactly as you said. Many, Many, Thanks, Paul

    Reply
« 1 … 7 8 9

Leave a Reply Cancel reply

Thanks for choosing to leave a comment. Please keep in mind that all comments are moderated according to our comment policy, and your email address will NOT be published. Please Do NOT use keywords in the name field. Let's have a personal and meaningful conversation.

Over 1,320,000+ Readers

Get fresh content from WPBeginner

Featured WordPress Plugin
SeedProd WordPress Coming Soon Page Plugin
SeedProd
Jump start your website with viral coming soon pages. Learn More »
How to Start a Blog How to Start a Blog
I need help with ...
Starting a
Blog
WordPress
Performance
WordPress
Security
WordPress
SEO
WordPress
Errors
Building an
Online Store
Useful WordPress Guides
    • 7 Best WordPress Backup Plugins Compared (Pros and Cons)
    • How to Fix the Error Establishing a Database Connection in WordPress
    • Why You Need a CDN for your WordPress Blog? [Infographic]
    • 25 Legit Ways to Make Money Online Blogging with WordPress
    • Self Hosted WordPress.org vs. Free WordPress.com [Infograph]
    • Free Recording: WordPress Workshop for Beginners
    • 24 Must Have WordPress Plugins for Business Websites
    • How to Properly Move Your Blog from WordPress.com to WordPress.org
    • 5 Best Contact Form Plugins for WordPress Compared
    • Which is the Best WordPress Popup Plugin? (Comparison)
    • Best WooCommerce Hosting in 2019 (Comparison)
    • How to Fix the Internal Server Error in WordPress
    • How to Install WordPress - Complete WordPress Installation Tutorial
    • Why You Should Start Building an Email List Right Away
    • How to Properly Move WordPress to a New Domain Without Losing SEO
    • How to Choose the Best WordPress Hosting for Your Website
    • How to Choose the Best Blogging Platform (Comparison)
    • WordPress Tutorials - 200+ Step by Step WordPress Tutorials
    • 5 Best WordPress Ecommerce Plugins Compared
    • 5 Best WordPress Membership Plugins (Compared)
    • 7 Best Email Marketing Services for Small Business (2019)
    • How to Choose the Best Domain Registrar (Compared)
    • The Truth About Shared WordPress Web Hosting
    • When Do You Really Need Managed WordPress Hosting?
    • 5 Best Drag and Drop WordPress Page Builders Compared
    • How to Switch from Blogger to WordPress without Losing Google Rankings
    • How to Properly Switch From Wix to WordPress (Step by Step)
    • How to Properly Move from Weebly to WordPress (Step by Step)
    • Do You Really Need a VPS? Best WordPress VPS Hosting Compared
    • How to Properly Move from Squarespace to WordPress
    • How to Register a Domain Name (+ tip to get it for FREE)
    • HostGator Review - An Honest Look at Speed & Uptime (2019)
    • SiteGround Reviews from 1032 Users & Our Experts (2019)
    • Bluehost Review from Real Users + Performance Stats (2019)
    • How Much Does It Really Cost to Build a WordPress Website?
    • How to Create an Email Newsletter the RIGHT WAY (Step by Step)
    • 7 Best CRM Software for Small Businesses (Compared)
    • How to Create a Free Business Email Address in 5 Minutes (Step by Step)
    • How to Install Google Analytics in WordPress for Beginners
    • How to Move WordPress to a New Host or Server With No Downtime
    • Why is WordPress Free? What are the Costs? What is the Catch?
    • How to Make a Website in 2019 – Step by Step Guide
Deals & Coupons (view all)
WPEngine
WP Engine Coupon
Get 20% OFF on all WP Engine hosting plans or 4 months free on annual payment.
Visual Composer
Visual Composer Coupon
Get 20% OFF on Visual Composer WordPress page builder plugin.
Featured In
About WPBeginner®

WPBeginner is a free WordPress resource site for Beginners. WPBeginner was founded in July 2009 by Syed Balkhi. The main goal of this site is to provide quality tips, tricks, hacks, and other WordPress resources that allows WordPress beginners to improve their site(s).

Site Links
  • About Us
  • Contact Us
  • FTC Disclosure
  • Privacy Policy
  • Terms of Service
  • Free Blog Setup
Our Sites
  • OptinMonster
  • MonsterInsights
  • WPForms
  • SeedProd
  • Nameboy
  • RafflePress

Copyright © 2009 - 2019 WPBeginner LLC. All Rights Reserved. WPBeginner® is a registered trademark.

Managed by Awesome Motive | WordPress hosting by HostGator | WordPress CDN by MaxCDN | WordPress Security by Sucuri.