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
    • Business Name Ideas
  • 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 July 7th, 2020 by Editorial Staff
3.4k Shares
Share
Tweet
Share
Pin
Free WordPress Video Tutorials on YouTube by WPBeginner
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 web, apps, or apps and web. Make sure you select ‘Web’.

      Select web

      After that, you need to enter website name, website’s URL, country, and 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.

      You cann also simply leave this browser tab open and switch back to copy the code when needed.

      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.

      Note: You need to use only one of these methods on your website to avoid double tracking of page views in your Google Analytics account.

      Method 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 Connection’ 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 » 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.

      Method 2. Insert Headers and Footers Plugin

      This method is 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 will need to copy your Google Analytics tracking code that you copied earlier in Step 4 when signing up for Google Analytics account.

      Google Analytics tracking code

      Next, 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 tracking code that you copied earlier into the ‘Scripts in 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.

      First, you will need to copy your Google Analytics tracking code that you copied earlier in Step 4 when signing up for Google Analytics account.

      Google Analytics tracking code

      Now there are two common ways to add this code in your WordPress theme files. You can choose either one of them (not both).

      1. Add code in header.php file

      Simply edit the header.php file in your WordPress theme and paste the Google Analytics tracking that code you copied earlier 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 tracking 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.

3.4k Shares
Share
Tweet
Share
Pin
Popular on WPBeginner Right Now!
  • How to Properly Move Your Blog from WordPress.com to WordPress.org

  • Google Analytics in WordPress

    How to Install Google Analytics in WordPress for Beginners

  • How to Start Your Own Podcast (Step by Step)

    How to Start Your Own Podcast (Step by Step)

  • Checklist

    Checklist: 15 Things You MUST DO Before Changing WordPress Themes

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

803 Comments

Leave a Reply
  1. Ricardo says:
    Feb 5, 2021 at 8:30 am

    Hii!! I have a question… if you do this by changing the header.php on the theme.. wouldn’t it be erased when the theme updates?…

    Reply
    • WPBeginner Support says:
      Feb 5, 2021 at 9:41 am

      You are correct unless you create a child theme.

      Reply
  2. Urc Ite says:
    Jan 31, 2021 at 5:29 pm

    Hey, nice tutorial.

    However, after installing the monsterInsights plugin, my website loads a bit slower.

    When I run the speed test, it says “reduce render blocking”.
    Is that normal??

    Reply
    • WPBeginner Support says:
      Feb 1, 2021 at 2:43 pm

      More than likely, the tool you are using does not like the Google Analytics tag where it is and due to Goole wanting the tag in the header it can very mildly slow a site but not enough to normally be noticeable.

      Reply
  3. Holley says:
    Jan 25, 2021 at 12:16 pm

    I am a total non-techy newbie just starting out on a blog. I’m so glad I found you! Thank you for providing easy to understand step by step directions.

    Before I found out about you, I installed a header/footer plug-in on my site based on someone’s recommendation. After watching this tutorial, is there a way to undo what I’ve done and switch to MonsterInsights plug-in? I like having it on my Dashboard and it seems easier to read (once I know what all that stuff means :)

    Reply
    • WPBeginner Support says:
      Jan 26, 2021 at 10:09 am

      You would remove the code from the Insert Headers and Footers plugin and the code would be removed from your site and you would be able to add using the plugin method at that point :)

      Reply
  4. Jeff says:
    Dec 31, 2020 at 7:27 pm

    Google Analytics does not any longer look like what you show. They have changed it.

    Reply
    • WPBeginner Support says:
      Jan 4, 2021 at 10:13 am

      Thank you for letting us know about that update, we’ll look to update our article when we are able :)

      Reply
  5. gwendolyn says:
    Dec 6, 2020 at 8:39 pm

    OMG… THANK YOU SOOOO MUCH. I’m starting a blog with Word Press and I have really struggled to get set up for google analytics until I found you!

    You were a Blessing!!!

    Thanks for your help

    Reply
    • WPBeginner Support says:
      Dec 7, 2020 at 11:56 am

      Glad our guide could help :)

      Reply
  6. William Hails says:
    Nov 30, 2020 at 11:50 am

    I don’t know what I did wrong but my setup is not complete… it is not connected to my gmail account but only to my website ?

    Reply
    • WPBeginner Support says:
      Dec 1, 2020 at 9:16 am

      If you have created your account then you should be able to log in with the google account you signed up with. If you have multiple Gmail accounts you may want to change accounts to see if you set up analytics on a different account.

      Reply
  7. faisal says:
    Nov 21, 2020 at 3:03 pm

    may time i tried to install google analystics i functions.php in wordpress.

    its given errors

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

    syntax error, unexpected ‘<', expecting end of file.

    guide me what i do now.whats its solutions.

    Reply
    • WPBeginner Support says:
      Nov 23, 2020 at 1:48 pm

      You would want to try removing line 1 from the code in our guide for that specific error.

      Reply
  8. Tikyda says:
    Nov 19, 2020 at 11:58 pm

    Thanks a lot for sharing on how to install Google Analytics.

    Reply
    • WPBeginner Support says:
      Nov 20, 2020 at 10:18 am

      Glad our guide was helpful :)

      Reply
  9. Marsha says:
    Nov 9, 2020 at 9:01 pm

    I installed Google Analytics to my blog using Monster Insights via the tutorial above but I can only see analytics using the Monster Insights dashboard on WP, the analytics is not showing up on the Google Analytics website at all.

    Reply
    • WPBeginner Support says:
      Nov 10, 2020 at 10:59 am

      You would want to make sure if you have multiple properties that you’re checking the correct one and you have given 48 hours for Google Analytics to populate the data.

      Reply
  10. Elena says:
    Nov 3, 2020 at 11:28 am

    I keep getting this message:
    “The selected account doesn’t have any Google Analytics Web properties.
    Please select another Google Account and make sure your Google Analytics property is set as “Web” not “Apps and web” or “Apps”.

    You can find more details about setting up your Google Analytics property in this article.

    Try picking a different app/profile to auth into”

    I’ve linked my account to Web only, but I don’t know if it’s an issue with how I worded the property? Please help! Thank you!

    Reply
    • WPBeginner Support says:
      Nov 4, 2020 at 10:14 am

      If you have multiple properties, ensure you are connecting to the correct one, you can also reach out to MonsterInsight’s support for assistance with that error if everything is set correctly.

      Reply
  11. Lourdes says:
    Oct 31, 2020 at 5:41 pm

    Super Helpful!!!! thanks!!

    Reply
    • WPBeginner Support says:
      Nov 2, 2020 at 10:15 am

      You’re welcome :)

      Reply
  12. Claire says:
    Oct 30, 2020 at 10:43 am

    Can you set up Google Analytics for multiple websites with the same Google account? And how?

    Reply
    • WPBeginner Support says:
      Nov 2, 2020 at 9:46 am

      In your Google Analytics Admin section, there is the option to add a new account that would be your new site.

      Reply
  13. David Pasquaone says:
    Oct 7, 2020 at 4:00 pm

    Thanks! Exactly what I needed. ✌

    Reply
    • WPBeginner Support says:
      Oct 8, 2020 at 9:06 am

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

      Reply
  14. putri says:
    Sep 29, 2020 at 10:29 pm

    Thank you for the post! Your content helps me a lot in setting Google Analytics up! :D

    Reply
    • WPBeginner Support says:
      Sep 30, 2020 at 10:22 am

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

      Reply
  15. Charlotte van Noord says:
    Sep 26, 2020 at 3:18 am

    after following the instructions I got this error showing up:
    syntax error, unexpected ‘<', expecting end of file

    Reply
    • WPBeginner Support says:
      Sep 28, 2020 at 10:23 am

      It would depend on how you are attempting to add the code, you may want to try some of the other recommended methods in the article for the moment.

      Reply
  16. Kiran says:
    Sep 25, 2020 at 11:30 am

    Very helpful for the beginner

    Reply
    • WPBeginner Support says:
      Sep 28, 2020 at 9:57 am

      Glad you found our guide helpful :)

      Reply
  17. mahmoud says:
    Sep 20, 2020 at 6:08 pm

    Thanks.
    Great information

    Reply
    • WPBeginner Support says:
      Sep 21, 2020 at 1:23 pm

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

      Reply
  18. Thomas says:
    Sep 16, 2020 at 2:14 pm

    Thank you for making this well thoughtout content. For FREE!

    Reply
    • WPBeginner Support says:
      Sep 16, 2020 at 3:01 pm

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

      Reply
  19. shine htet linn says:
    Sep 16, 2020 at 11:13 am

    Dear Team,
    I tried to connect Google analytics code to the wordpress using insert Header and Footer plugin. But when i verify it said “verification unsuccessful”. Please help me to solve it.

    Reply
    • WPBeginner Support says:
      Sep 17, 2020 at 10:28 am

      You would want to start by clearing the caching on your site for the most common solution to this issue.

      Reply
  20. Srai says:
    Sep 15, 2020 at 6:35 am

    Excellent instructions. Thanks a bunch!

    Reply
    • WPBeginner Support says:
      Sep 16, 2020 at 1:13 pm

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

      Reply
  21. Stephanie says:
    Aug 20, 2020 at 9:54 am

    Amazing! I love how you walked through each step, was so much easier to understand, all three methods when watching you calming and in real time go through it as a newbie.

    Bookmarking and Subscribing

    Reply
    • WPBeginner Support says:
      Aug 20, 2020 at 10:31 am

      Glad our guide was helpful :)

      Reply
  22. David ayeni says:
    Aug 18, 2020 at 12:57 pm

    thanks alot, this was really helpful, fixed it in minutes, How to i add adsense to my website after that, is there any article on that

    Reply
    • WPBeginner Support says:
      Aug 19, 2020 at 10:57 am

      For adding Adsense you would want to take a look at our article below:
      https://www.wpbeginner.com/beginners-guide/how-to-add-google-adsense-to-your-wordpress-site/

      Reply
  23. Chisom says:
    Aug 16, 2020 at 1:48 pm

    Hello, Thanks for this helpful article, but i have a question,
    If i use the Monster insight or the “Insert header and footer plugin”, if i create a new page after setting the analytics up, will it be automatically added to the new page or i will have to set it up again.

    Reply
    • WPBeginner Support says:
      Aug 18, 2020 at 10:18 am

      Using either of those methods would automatically add the code to your new posts and pages :)

      Reply
  24. Ian Warner says:
    Aug 16, 2020 at 7:50 am

    Thanks for this helpful information. I want to install Google Analytics without Google Tag Manager. Where do I find the code for this please?

    Reply
    • WPBeginner Support says:
      Aug 17, 2020 at 3:48 pm

      You would not add Google Tag Manager if you do not want to use it on your site.

      Reply
  25. Dileepa K says:
    Aug 11, 2020 at 1:51 am

    Thanks for this detail explanation. Very helpful

    Reply
    • WPBeginner Support says:
      Aug 11, 2020 at 11:00 am

      You’re welcome :)

      Reply
  26. Gabbi says:
    Aug 6, 2020 at 4:01 pm

    OMG so helpful and easy! Follow all the steps now I am set up! Thanks a bunch

    Reply
    • WPBeginner Support says:
      Aug 7, 2020 at 9:58 am

      You’re welcome :)

      Reply
  27. Brian says:
    Aug 4, 2020 at 4:29 am

    Very helpful. The steps to take were clear and understood.

    Reply
    • WPBeginner Support says:
      Aug 4, 2020 at 11:15 am

      Glad you found our article helpful :)

      Reply
  28. Helen C says:
    Jul 27, 2020 at 9:09 pm

    Thanks, I dont know alot about any of this but I installed google analytics with no problem by following your tutorial.

    Now on to something else! :)

    Reply
    • WPBeginner Support says:
      Jul 29, 2020 at 10:05 am

      Glad our guide was able to help :)

      Reply
  29. Eli says:
    Jul 24, 2020 at 2:22 pm

    Super helpful; thanks brother.

    Reply
    • WPBeginner Support says:
      Jul 27, 2020 at 11:34 am

      You’re welcome :)

      Reply
  30. Johnny Come Lately says:
    Jul 21, 2020 at 6:31 pm

    Thank you! Very useful video. I used the Headers and Footers Plugin as I prefer to have google analytics app on my phone and I can view all websites from that.

    Reply
  31. taekookyizhan says:
    Jul 20, 2020 at 4:19 am

    this article was super helpful and contained everything I wanted to know. thank you

    Reply
    • WPBeginner Support says:
      Jul 23, 2020 at 9:28 am

      You’re welcome :)

      Reply
  32. Paul says:
    Jul 13, 2020 at 4:12 pm

    Can’t wait to learn more.

    Reply
    • WPBeginner Support says:
      Jul 14, 2020 at 10:39 am

      We hope our guides can help :)

      Reply
  33. Heather says:
    Jun 30, 2020 at 7:52 pm

    Thank you! This was super easy to follow and I was able to setup Google Analytics using Monster Insights very quickly following this guide.

    Reply
    • WPBeginner Support says:
      Jul 1, 2020 at 8:49 am

      You’re welcome, glad we could help simplify the process :)

      Reply
  34. Amin Al Salim says:
    Jun 18, 2020 at 6:58 am

    It’s quite very good and useful

    Reply
    • WPBeginner Support says:
      Jun 18, 2020 at 9:10 am

      Thank you, glad you found our guide helpful :)

      Reply
  35. Avi says:
    Jun 13, 2020 at 3:32 pm

    Hey! Amazing tutorial.

    But while going with the 3rd method I faced an error which says :
    Your PHP code changes were rolled back due to an error on line 1006 of file wp-content/themes/oceanwp/functions.php. Please fix and try saving again.

    syntax error, unexpected ‘<', expecting end of file

    Please help.

    Reply
    • WPBeginner Support says:
      Jun 16, 2020 at 8:26 am

      Your functions.php likely did not close its PHP, you should be able to add the code without the first line :)

      Reply
      • Rich says:
        Aug 5, 2020 at 2:28 am

        Yep, that worked for me – removed ‘<?php' and the error dispeared.

        Thanks..

        Reply
  36. dell says:
    Jun 2, 2020 at 11:15 am

    Hi. My plan is free. It doesn’t support plugin installation. In that case, what can I do for using google analytics?

    Reply
    • WPBeginner Support says:
      Jun 3, 2020 at 8:45 am

      For WordPress.com sites, you would need to check with the support documentation for what they allow at the moment.

      Reply
  37. Lisanne says:
    May 29, 2020 at 4:54 am

    Hello,

    I did instal Google Analytics correctly and it works perfectly!

    But it is tracking my own IP as well.

    Is there an solution to this problem?
    I couldn’t found it anywhere.

    Reply
    • WPBeginner Support says:
      May 29, 2020 at 9:34 am

      This is one of the reasons why we recommend MonsterInsights, it should filter out your own visits without needing to set up a filter in Google Analytics.

      Reply
  38. Enni says:
    May 14, 2020 at 4:20 am

    I follow the steps exactly from the video tutorial, but I can’t update my file of theme editor, it says this:

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

    syntax error, unexpected ‘<', expecting end of file

    Reply
    • WPBeginner Support says:
      May 14, 2020 at 9:41 am

      We would recommend taking a look at our guide on copying snippets from the web below for the most common reasons for an issue like that:
      https://www.wpbeginner.com/beginners-guide/beginners-guide-to-pasting-snippets-from-the-web-into-wordpress/

      Reply
  39. Janet says:
    May 5, 2020 at 10:14 am

    Thank you for all of this, G Analytics is something I struggle with implementing as my brain shuts down at the thought, but you’ve made it more clear to me!

    I’m using Insert Headers and Footers to paste the code, but I already have code on there for other stuff – can I paste code directly below?

    Reply
    • WPBeginner Support says:
      May 5, 2020 at 10:47 am

      Yes, you would add the new code below your current code :)

      Reply
  40. Peggy says:
    Apr 27, 2020 at 1:32 pm

    Thank you. I am just launching my website and you have been such a great resource. This quickly explained how to set up Google analytics in my website and I love that I don’t have to put code on each page as I was very confused on the google analytics page.

    Reply
    • WPBeginner Support says:
      Apr 28, 2020 at 1:13 pm

      Glad our guide was able to simplify the process for you :)

      Reply
  41. mayank jain says:
    Apr 20, 2020 at 3:32 pm

    thannks a lot man ..really helped alot

    Reply
    • WPBeginner Support says:
      Apr 21, 2020 at 1:44 pm

      Glad our article was helpful :)

      Reply
  42. Efren says:
    Apr 17, 2020 at 11:47 am

    Really cannot find a good site where to explain how to add the Google tracking code to a wordpress site without plugin. Why plugin is needed anyway? IS there any other website apart from this wordpress where i can add the hmtl code i want without having to purchase, add plugin, update my account or anything like that? Man, they make it complicated :D

    Reply
    • WPBeginner Support says:
      Apr 21, 2020 at 12:45 pm

      It sounds like you are on WordPress.com which would be the main factor for that issue, you may want to take a look at our comparison here:
      https://www.wpbeginner.com/beginners-guide/self-hosted-wordpress-org-vs-free-wordpress-com-infograph/
      WordPress.com requires one of their paid plans currently to connect Google Analytics

      Reply
  43. andreia says:
    Apr 4, 2020 at 5:49 pm

    just to say thank you :)

    Reply
    • WPBeginner Support says:
      Apr 6, 2020 at 3:17 pm

      You’re welcome, glad you liked our guide :)

      Reply
  44. Jaymin Thakkar says:
    Apr 3, 2020 at 11:38 am

    Hello,

    I’m using #3 to add GA in WordPress Theme. I just wanted to know if add code in header.php file then do I also have to add via functions.php? Will only update in header.php work?

    Reply
    • WPBeginner Support says:
      Apr 6, 2020 at 8:43 am

      You would use one of the methods, you would not want to use both and it is personal preference on which method you use

      Reply
      • Jaymin Thakkar says:
        Apr 14, 2020 at 9:44 am

        Thank You so much for the information!

        Reply
        • WPBeginner Support says:
          Apr 14, 2020 at 10:59 am

          You’re welcome :)

  45. Elisabeth says:
    Mar 13, 2020 at 7:58 am

    Thank you so much for the information! You mention it takes some time for Google Analytics to connect to the website. How long is that process generally? My Siteground dashboard shows sessions and pageviews, but GA still shows zero.

    Thanks for your help!

    Reply
    • WPBeginner Support says:
      Mar 13, 2020 at 8:39 am

      normally 24-48 hours but times can vary

      Reply
  46. Sandra says:
    Mar 5, 2020 at 12:09 pm

    Will this plugin report the hits back to my main analytics (web) account? Because I’m unable to paste the analytics code on my web pages.
    Will like to hear your response, Thanks.

    Reply
    • WPBeginner Support says:
      Mar 6, 2020 at 8:43 am

      As long as it is connected it will send the information back to your Google Analytics account.

      Reply
  47. Vanessa Williams says:
    Mar 3, 2020 at 4:02 pm

    Thanks for sharing this topic. It’s help a lot.

    Reply
    • WPBeginner Support says:
      Mar 4, 2020 at 8:48 am

      You’re welcome, glad you like our guide :)

      Reply
  48. Michael says:
    Feb 29, 2020 at 4:28 am

    Thanks for your excellent guides.

    Reply
    • WPBeginner Support says:
      Mar 2, 2020 at 11:26 am

      You’re welcome, glad you like our guides :)

      Reply
  49. Kelly says:
    Feb 28, 2020 at 4:24 pm

    Thank you for the information! I have Google Analytics, but didn’t know how to read it. You cleared that up here. Thanks :)

    Reply
    • WPBeginner Support says:
      Mar 2, 2020 at 11:09 am

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

      Reply
  50. Cheri Moe says:
    Feb 27, 2020 at 8:50 pm

    Thank you for continually posting articles and videos to help us walk through the process and set up great sites. I’ve been wanting to learn more about GA and this article and video were the perfect starting point for me!

    Reply
    • WPBeginner Support says:
      Feb 28, 2020 at 10:24 am

      You’re welcome, glad our guides are able to help you :)

      Reply
« 1 … 9 10 11

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
Smash Balloon
Smash Balloon
Add Custom Social Media Feeds in WordPress. 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]
    • 30 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 2021 (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 (2021)
    • 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 (2021)
    • SiteGround Reviews from 4464 Users & Our Experts (2021)
    • Bluehost Review from Real Users + Performance Stats (2021)
    • How Much Does It Really Cost to Build a WordPress Website?
    • How to Create an Email Newsletter the RIGHT WAY (Step by Step)
    • Free Business Name Generator (A.I Powered)
    • 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 2021 – Step by Step Guide
Deals & Coupons (view all)
LiveChat logo
LiveChat Inc Coupon
Get a 30 day free trial and 30% OFF LiveChat, one of the best live chat service providers for WordPress users.
LearnDash
LearnDash Coupon
Get the lowest price on the best learning management system (LMS) plugin for WordPress.
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).

Join our team: We are Hiring!

Site Links
  • About Us
  • Contact Us
  • FTC Disclosure
  • Privacy Policy
  • Terms of Service
  • Free Blog Setup
  • Free Business Tools
  • Growth Fund
Our Sites
  • OptinMonster
  • MonsterInsights
  • WPForms
  • SeedProd
  • Nameboy
  • RafflePress
  • Smash Balloon
  • AIOSEO

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

Managed by Awesome Motive | WordPress hosting by SiteGround | WordPress Security by Sucuri.