Trusted WordPress tutorials, when you need them most.
Beginner’s Guide to WordPress
WPB Cup
25 Million+
Websites using our plugins
16+
Years of WordPress experience
3000+
WordPress tutorials
by experts

How to Install Google Analytics in WordPress for Beginners

Editorial Note: We earn a commission from partner links on WPBeginner. Commissions do not affect our editors' opinions or evaluations. Learn more about Editorial Process.

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 WordPress (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:

Ready? Let’s get started!

Why Is Google Analytics Important for Bloggers?

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

Who visits your website?

This part of analytics shows the geographical location of your audience, which browser the user used 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 creating a custom website 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 to 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 they stay on your website, and the bounce rate (the percentage of users who exit your site on the first visit).

Using this information 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 the 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 best time to publish your post. If that time zone is not compatible with yours, then you can schedule your post for that hour.

How do people find your website?

This section of the analytics shows you where the users come from. For example, do they use search engines, enter direct links, or click on referral links from another site?

It also shows you what percentage of your visitors came from each of these sources. Google Analytics gives you a 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, like Google, Yahoo, Bing, and so on.

The breakdown of referral sources shows you which sites you need to work with the most. If your top referral source is Facebook, you need exclusive Facebook content to make your 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 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 methods that don’t work.

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

Video Tutorial

Subscribe to WPBeginner

If you’d prefer written instructions, keep reading.

How to Sign Up With Google Analytics

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

Step 1: First, you need to visit the Google Analytics website to sign up. When you are on the website, simply click the ‘Get started today’ button.

Click get started today

Next, you will be asked to log in 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 using your Google account

Step 2: Once you have signed in with your Gmail account, you will see a welcome screen like the one below.

This is where you will sign up for Google Analytics with your Gmail account. Go ahead and click the ‘Start measuring’ button.

Click start measuring button

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 your Google account name

Google Analytics will also show multiple account data-sharing settings.

These settings give you control over sharing your Google Analytics data. You can keep the default settings and move on to the next step.

Account data sharing settings

Step 3: On the next screen, you will need to create a Google Analytics property.

Google introduced a new version of Analytics called Google Analytics 4 or GA4. It’s the latest version that tracks your website and mobile apps in the same account. Plus, you get new features, metrics, and a different interface for your reports.

Go ahead and enter a property name, and select your reporting time zone and currency. Then click the ‘Next’ button.

Enter property name

On the next screen, you’ll need to select an ‘Industry category’ from the dropdown menu for your website and choose a ‘Business size’ from the given options.

When you are done, just click the ‘Next’ button.

Enter business details

Next, you’ll need to choose business objectives and select how you intend to use Google Analytics with your business. This will help get personalized reports for your business.

For instance, there are options like generating leads, driving online sales, raising brand awareness, examining user behavior, and more.

You can choose multiple options or all of the given options that meet your needs. We recommend selecting the ‘Get baseline reports’ option so that you get all the Google Analytics reports populated in your account.

Choose your business objectives

When you are done, simply click the ‘Create’ button.

Step 4: Now you will be presented with your Google Analytics Webs stream options.

Since we are setting up Google Analytics for a WordPress site, go ahead and select the ‘Web’ as the platform.

Select data collection option

After that, you’ll need to enter your website URL and Stream name.

By default, Google Analytics will have an ‘Enhanced measurement’ option enabled. This allows you to track pageviews, scrolls, outbound clicks, file downloads, and more in Google Analytics.

Note: If you plan to use the MonsterInsights plugin, then you should turn off the ‘Enhanced measurement’ option. Otherwise, the plugin will collect and display double the amount of data.

Next, you can click the ‘Create stream’ button.

Enter website URL and stream name

You can now see your Stream name, URL, ID, and Measurement ID.

It will also show different enhanced measurements that it will record.

View stream ID and measurement ID

At the top, you will also see an alert bar that will show you how to add Google Analytics to your WordPress site.

Go ahead and click the ‘View tag instructions’ button. You should now see different ways to add the Google Analytics tracking code to your WordPress website.

View Analytics installation instructions

Next, you can switch to the ‘Install manually’ tab.

You’ll then see the Google Analytics tracking code.

Install GA code manually

Go ahead and copy this tracking code because you will need to enter it in your WordPress site depending on the method you use below. You can also simply leave this browser tab open and switch back to copy the code when needed.

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 set up 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 set up Google Analytics in WordPress. We will show you three methods where the first option is the easiest and the last is 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 pageviews in your Google Analytics account.

Method 1: Google Analytics for WordPress by MonsterInsights

MonsterInsights is the most popular Google Analytics plugin for WordPress. Over 3 million websites use it, including the likes of Bloomberg, PlayStation, Zillow, WPBeginner, 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 eCommerce tracking, ads tracking, author tracking, and so on. 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, and you’ll see a welcome screen. Go ahead and click the ‘Launch the Wizard’ button.

Launch setup wizard

Clicking on it will open the 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 the ‘Save and Continue’ button.

Choose what describe your website

Next, you need to connect MonsterInsights with your WordPress website.

Simply click on the ‘Connect MonsterInsights’ button.

Connect MonsterInsights with your site

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

Go ahead and choose your Google account or enter your email to sign in.

Choose Google account to sign in

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

Click on the ‘Allow’ button to continue.

Allow access to your Google account

The next step to completing the connection 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.

Connect analytics with your site

After that, simply click on the ‘Complete Connection’ button to continue. MonsterInsights will now install Google Analytics on your website.

Next, you will be asked to select the recommended settings for your website.

Recommended settings

The default settings will 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.

MonsterInsights will also ask who can see the reports. You can choose different WordPress user roles.

Once you are done, just click on the ‘Save and Continue’ button to save your settings.

Who can see the reports

Next, MonsterInsights will show you a list of website tracking features you would like to enable.

You can scroll down and click on the ‘Continue’ button or the ‘Skip for Now’ option.

Choose which tracking features to enable

On the next screen, MonsterInsights will show that you’ve successfully set up Google Analytics tracking.

You can see that Google Analytics is connected, the tracking code is installed, and data is now being collected.

Tracking should be all setup

Next, you can scroll down and see a field to enter your license key.

Go ahead and click the ‘Complete Setup without Upgrading’ option for now.

Continue setup without upgrading

You’ve successfully added Google Analytics to your WordPress website.

Disable Enhanced Measurement in Google Analytics

Now, if you created a Data Stream in GA4 on your own instead of letting MonsterInsights create one, then you’ll need to switch off Enhanced Measurement.

That’s because MonsterInsights adds multiple custom-enhanced tracking features. Leaving the Enhanced Measurement option enabled will skew your data and show incorrect results.

First, you can head to the Google Analytics tab or window in your browser. From here, click on the ‘Admin’ settings option in the bottom left corner.

Switch to admin view in Google Analytics

Once you are on the ‘Admin’ page, you’ll see different settings.

Simply click on the ‘Data Streams’ option.

Go to admin and data stream settings

Next, you’ll see your Data Streams.

Simply select the data stream you connected with MonsterInsights.

Select your data stream

On the next screen, you will need to disable the ‘Enhanced measurement’ option.

To do that, simply click the toggle.

Disable enhanced measurement

Next, a popup window will open, confirming that you’d like to turn off the enhanced measurement.

Go ahead and click the ‘Turn off’ button.

Click turn off button for enhanced measurement

Change Data Retention Settings in Google Analytics

By default, Google Analytics will set the data retention setting to 2 months. However, you can change this so that you can use your data in custom reports beyond 2 months.

First, you need to head to Admin » Data Settings » Data Retention in Google Analytics.

Open data retention settings

Next, you can click the ‘Event data retention’ dropdown menu.

From here, simply select the ’14 months’ option and click the ‘Save’ button.

Change data retention settings

Remember, it will take Google Analytics some time before showing your stats.

View Google Analytics Reports Inside WordPress Dashboard

The best thing about MonsterInsights is that you can view your Google Analytics reports inside your WordPress dashboard.

Simply visit the Insights » Reports page to check out a quick overview of your analytics data.

Dashboard reports

You can also add annotations directly to your MonsterInsights reports to record key changes you make to your website.

For example, you can add a note when you publish a new blog post, add a new landing page, and so on. This makes it easy to track how these events impact your traffic.

View your site notes under the report

For more details, see this guide on how to get GA4 site annotations in WordPress.

In addition, it comes with a Popular Posts addon that allows you to show your top-performing content to boost your traffic and pageviews.

MonsterInsights Popular Posts Widget

You can use it to automatically add inline popular posts links to boost engagement.

If you are running an online store, then it can also automatically add your top-performing products at the end of each blog post to boost sales:

MonsterInsights popular products

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: Install Google Analytics in WordPress With WPCode

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 (Global site tag) that you copied in Step 4 earlier when creating a Google Analytics account.

Install GA code manually

Next, you need to install and activate the WPCode plugin. For more details, see our step-by-step guide on how to install a WordPress plugin.

Upon activation, you need to visit the Code Snippets » Header & Footer page. Here you must paste the Google Analytics tracking code that you copied earlier into the ‘Header’ section.

Enter tracking code in header using WPCode

Don’t forget to click the ‘Save Changes’ button to store your settings.

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

Method 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 and paste code snippets in WordPress.

First, you will need to copy the Google Analytics tracking code that you copied in Step 4 earlier. You can view it in the Web Stream Installation section under the ‘Install manually’ tab.

Install GA code manually

Now there are two common ways to add this code to 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 code that you copied earlier right after the <body> tag.

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

2. Add via Functions File

You can also add Google Analytics tracking code to the 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 } ?>

Don’t forget to replace the ‘Paste your Google Analytics tracking code from Step 4 here’ section in the above snippet with your Google Analytics code.

Viewing Reports in Google Analytics

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

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.

GA4 reports

Google Analytics 4 reports are a bit different from previous Universal Analytics reports. In the left column, you’ll see a dedicated Reports option. The reports are grouped together under 2 broad categories, including Life Cycle and User.

One of the most noticeable differences you’ll find in GA4 reports is that there’s no bounce rate metric. Other than that, you’ll find a new reporting interface, new metrics like engagement time, no goals in GA4, and more.

Here’s a breakdown of different reports in Google Analytics 4:

  • Realtime report is similar to Universal Analytics and shows active users on your site in real time.
  • Acquisition report shows which medium users use to find your websites, like organic, referral, email, and affiliate.
  • Engagement report shows conversions and events that take place on your site.
  • Monetization report shows all your eCommerce data in one place, along with new reports like in-app purchases and publisher ads.
  • Retention report basically shows new vs. returning visitors and helps you get insights about user retention.
  • Demographics report helps you see website traffic from top countries, cities, and more. It also shows gender breakdown and interest reports.
  • Tech report shows which device, browser, operating system, app version, and screen size people use the most to view your website.

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, while others require some additional setup.

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

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.

If you want to improve your WordPress SEO rankings and get more traffic, then we recommend using the AIOSEO plugin for WordPress, which is an all-in-one SEO toolkit.

There’s also a free version of AIOSEO that you can use too.

This plugin will help you fully optimize your WordPress site with proper schema markup, sitemaps, and everything you need to improve your SEO rankings.

We hope this article helped you learn how to install Google Analytics in WordPress. You may also want to see our ultimate guide to increasing your blog traffic and our comparison of the best email marketing services.

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.

Disclosure: Our content is reader-supported. This means if you click on some of our links, then we may earn a commission. See how WPBeginner is funded, why it matters, and how you can support us. Here's our editorial process.

Editorial Staff

Editorial Staff at WPBeginner is a team of WordPress experts led by Syed Balkhi with over 16 years of experience in WordPress, Web Hosting, eCommerce, SEO, and Marketing. Started in 2009, WPBeginner is now the largest free WordPress resource site in the industry and is often referred to as the Wikipedia for WordPress.

The Ultimate WordPress Toolkit

Get FREE access to our toolkit - a collection of WordPress related products and resources that every professional should have!

Reader Interactions

842 CommentsLeave a Reply

  1. Syed Balkhi says

    Hey WPBeginner readers,
    Did you know you can win exciting prizes by commenting on WPBeginner?
    Every month, our top blog commenters will win HUGE rewards, including premium WordPress plugin licenses and cash prizes.
    You can get more details about the contest from here.
    Start sharing your thoughts below to stand a chance to win!

  2. Alexia says

    I’m trying to install the GCE on my WordPress site, and I’ve got the code installed in the of the theme header.php. The code validates for both pages on Google Analytics. But when I try to then load my “original” page on my site, I get a 404 error. I’ve been researching and it seems like it is something to do with the server security, but my contact at our host is having trouble determining how to address this. Do you have any specific suggestions for what server files / permissions needs to be modified to get this to work? Thanks!

  3. Rebecca Hauptman Cashman says

    I installed the plugin, and the next step is to go to the settings area, however this plugin doesn’t have a settings area. There is the option of “deactivate” and “edit” but other plugins have the “settings”, “deactivate” and “edit” links… this one doesn’t. What do I do now?

    Thanks

  4. Nick says

    Thanks for the article. It helped with a few issues I’ve been having. First and foremost of course was not having the code in my site. I was able to get it working with both functions.php and the recommended header/footer plugin.

  5. elenaleksandra says

    Hi! Thanks. I use different analytics tools and they give me different reports. Who to believe?

    • Darshan Paladiya says

      I think you should trust Google. That is because apart from directly added tracking code, no other company can has as much data about your website as Google has.

      And apart from that, most of the organic traffic from any website is mostly from Google. So original Google analytics data can be more useful in creating a solid strategy that impacts your Google results compared to any other service.

      That’s how I think, I am not an expert but surely an SEO with 18 months of experience. Anyway good luck with your site.

  6. Rodger says

    Regarding Insert Headers and Footers method, Would be worthwhile to advise on pasting the script in the Insert Header or Insert Footer space – These scripts will be printed in the section. OR These scripts will be printed above the tag.

  7. Giovanni says

    I pasted my Google Analytics code using Insert Headers and Footers, but the status of my tracking ID is still showing not installed. How long does this take to show it has been installed or did I do anything wrong?

  8. Molly Fabs says

    I’ve added my tracking code to the header.php file of my theme (suits), by manually pasting it in. I’ve tried it right after the body tag, as you suggest, and also right before the close of the head tag, which I’ve seen advised elsewhere. (not pasting the code twice, just trying it in each location by itself). In both instances, my Analytics account says: tracking not installed. Any idea why GA isn’t seeing my code? Thanks in advance!

  9. Devesh says

    Hello,
    I have created a blog on wordpress.com, but where will be paste code of google analytics in wordpress.com ?

  10. Jim says

    Hi,

    I inadvertently have the Google Analytics script in my home page twice. Once put in by someone helping and another by a plug-in.

    I’ve been able to view/modify the HTML in the past, I think, I but can’t for the life of me find where to access the full HTML.

    I can see visual vs text but don’t believe that gives me enough of the HTML to modify/remove one of the Analytics scripts.

    I’ve also looked at Appearance>Editor but that seems to be about themes..

    I can see what I want to remove if I go to a “view source” page looking at my page from a web browser.. but can’t find it to remove it through WP.

    Any help would be appreciated.
    thanks
    Jim H
    PS I am using a Genesis theme News Pro and Premise..

  11. Amber says

    Thank you for this! I have a question. Google analytics has me at 3 visitors and then 0 visitors where wordpress has me at 30 and 50 for those days. I did just start my blog. Why would GA not be picking it up? Thanks!

    • @ginabegin says

      How are you seeing analytics from WordPress itself? I thought this was just available on WordPress.com sites, not .org, and that Google Analytics was only available for .org.

      • Darshan Paladiya says

        Hey @ginabegin:disqus, I think you should try installing plugin, either “Jetpack” or “Google Analytics Dashboard for WP”.
        Both of them make site analytic available in WordPress.org

  12. Becky Manuel says

    Hi,
    I’m ready to paste my code, and you said do it after the body tag, but I’m not sure exactly where you mean. As in, hit return after I see the words <body >
    then paste?
    Or paste at the bottom of that whole block (which would be the end of the page) as the last item on the whole page?
    Please help thank you

      • Sophie says

        Where is the tag? I can only see once space for scripts in header and another space for scripts in footer?

        • Darshan Paladiya says

          Sophie, don’t mind it. Usually you will see only blank space for scripts. Still it works. The case depicted by Becky is exception.

          Just give your Analytics some time after installing script in those fields.

  13. Bozo Pub says

    Hello,

    thanks for the informative article. I’m interested in following:

    I had a website in Joomla, with already inserted analytics code. Now, I have created a blog in WP, with the same name, but with changed adress (now it have /blog in the extension).
    What is the procedure to keep running the existing code because I want to keep running my statistics record from previous site.

    Thanks

    • Darshan Paladiya says

      Simply, you can’t do it. Google analytics data of one url can’t continue with another one.

  14. Jerzy says

    Hi,

    If the WP theme I’m using as a Google Analytics configuration already built in, I am correct in assuming that I don’t need to follow the 3 steps of pasting code in your tut above?

    Thank you.

  15. Kathrine K. says

    Hi!

    Thanks for a wonderful guide!
    I was wondering what happens if I have my code in the header.php right before the ? I read another guide before yours, stating that this was where to put it.. That’s where it is now and my analytics seem to work?

    Best,
    Kathrine

  16. Jenna says

    I installed the plugin but there was no settings page. Is there a certain area in the code that I paste the script?

    Thank you!

  17. Nishith G. says

    I started it 1 hour ago and finished it now. Thanks to this beautifully crafted article that helped a newbie like me to finalize each and everything so smoothly.

    Waiting for the data to populate in GA dashboard now.

    God bless you Syed.

  18. Rosanne says

    Hi, I downloaded the plug in and followed the directions listed, but on GA it still says that it’s not installed…I’ve given it 12 hours…Any trouble shooting ideas? I chose to paste the script into the footer and made sure I hit save after I copied over the script.

  19. Ronald says

    I have just started building a new site on WordPress and am building it on my computer as a local host first before I transfer it over to an online host. What I want to know is can/should I activate the Google Analytics plugin now or wait until I have uploaded it to a online host.

  20. Lucia says

    Thank you so much for these clear and detailed instructions. I did everything you said and it worked out great up until pasting the code into the header and footer plugin. Because after I do that, the code is actually visible in the header of my website. What am I doing wrong?

    Thanks for your support!

    • Nick says

      You may also be posting code which is missing the tag. This will cause PHP to read it as regular HTML depending on the particular situation and very likely could be the reason you’re seeing plain text at the top of your site after posting a script in to the header.

  21. Norman Weathers says

    I’ve just started a wordpress site at quriousity.com and need to track my traffic. Your advice is invaluable.

  22. Carlos says

    Hello,

    Thanks for the informative article.

    I followed the instructions for CapitalHustle.com however the Google Analytics still shows “Tracking Not Installed.”

    I pasted the code into the header and footer sections of the plugin settings. Am I missing something?

    Thanks!

    Carlos

  23. E.S. Ivy says

    The headers and footers plug-in is really nice so that I don’t have to worry about messing up the rest of the code!

    I was wondering, am I right that this also means that a WordPress upgrade won’t make these changes disappear? I keep putting of learning how to make a child theme. :) And I think this was the one change I had made to my code previously. I forgot about it and then it disappeared with a WordPress update.

  24. Dave Jackson says

    on a site I manage, I have installed google analytics but despite having visited the site using my phone so it is from a different ip address from where I am managing it, it still shows up as there being no traffic. How long after installing do I have to wait before I start seeing results?

  25. Hemant says

    Hi,

    This article is really helpful, thanks for sharing. I am looking forward to read more articles in future. Keep writing!!! cheers.

  26. Paige says

    I have recently switched from Blogger to WordPress and want to transfer my Google Analytics over. How do I do this?

  27. Dan says

    I used the plug-in method to install google analytics, but it keeps saying that tracking is not installed. I copied the tracking code from google and pasted it directly into the settings for the plugin insert header and footer. Any suggestions for what I can do to fix it or any idea why it is not working? My website is http://www.thesimplestform.com/
    The tracking code shows up when you do view source.

  28. Dan says

    I used the plug-in method to install google analytics, but it keeps saying that tracking is not installed. I copied the tracking code from google and pasted it directly into the settings for the plugin insert header and footer. Any suggestions for what I can do to fix it or any idea why it is not working?

    • E.S. Ivy says

      I was having this problem too. Not sure if it was just time, but I also have W3 Total Cache installed and it might have helped to empty the page cache.

  29. Emmanuel Rosani says

    Thank you for this awesome blog post! I’ve successfully installed Google Analytics to my new first WordPress site..

    Cheers,
    Emman

  30. Kat says

    I have Google Analytics installed on my web site, and i’ve just created a folder area to house our new blog. Do I need a separate tracking code to track the blog statistics, or just install same site-wide tracking code through the header/footer plug-in? If so, where in Google Analytics would I view the blog stats specifically? Thanks for your help!

    • WPBeginner Support says

      if your new blog is actually a separate website on its own, then you better create a new project in Google Analytics. If it is under the same website but in a subdirectory then you can use the same analytics code.

      Admin

  31. Samantha says

    Thank you, this was very helpful. I was really confused about how to get that code into “every page on my website” without going though a bunch of work, but that “insert header and footer” plugin is a really fast and easy way to do it! Thanks again,

    -Samantha

  32. Carole Rains says

    I have been using Google Analytics for about 6 months, but want to utilize the Demographics and Interests data. I keep getting a message that I need to implement a code change to allow that data to be accessed, but I’m not sure how or where to make this code change. Can you provide some guidelines please?

    • WPBeginner Support says

      Carole when you first integrated Google Analytics in your website you would have inserted a piece of code somewhere on your site. Now you need to update that code and replace it with the new one.

      Admin

  33. Stephanie says

    If using the “Insert Header and Footer” plugin, should the Google Analytics code snippet be installed in BOTH Header and Footer or either?
    Thanks

  34. Brooke Muckersie says

    Hi there, just one thing… is this an error in your post?

    “Direct Paste Method
    Copy the code that you received in Step 6, and paste it in your theme’s header.php right after the tag.”

    Shouldnt that be ‘before the tag.’ (not after)?

      • Hugh says

        Doesn’t Google Analytics make asynchronous calls? I guess that’s why instructions say “Paste your snippet (unaltered, in it’s entirety) into every web page you want to track. Paste it immediately before the closing tag.”

        Yoast’s plugin Google Analytics for WordPress also loads the tracking code in the header

  35. vivek says

    I used the plugin you recommended and i doubt that is it important to paste the whole Google Analytics code in both header and footer boxes?? or header is enough??

  36. Shiv Saroya says

    As we all know Google Analytics has changed it dashboard like anything. day by day it becomes more user friendly. Nice post. Keep sharing like this.

  37. Hayley Reed says

    Hi there
    I am using the header and footer plugin for GA in my wp blog and was wondering if there was any way to exclude pages such as the legal pages etc

    thanks

    • Hugh says

      You could try using filters (Admin > Views > Filters). A custom filter excluding the page title field may work

      Another option is including the GA code conditionally, of course, in this case you can not use a plugin

Leave a Reply to Jessamae Tilar 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.