Beginner's Guide for WordPress / Start your WordPress Blog in minutes

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 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 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 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 do they stay on your website, and what is the bounce rate (the percent of users who 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 best time to publish your post. If that time zone is not compatible with yours, then you can schedule your post to meet at that hour.

How do people find your website?

This section of the analytics shows you where did 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 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 signup process is quite simple, 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’re on the website, simply click the ‘Get started today’ button.

Click get started today

Next, 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 using your Google account

Step 2: Once you sign in with your Gmail account, you will be prompted to a welcome screen like the one below.

This is where you will signup 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.

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.

Enter your account name

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.

Important Note: If you already have a Universal Analytics account, then it’s critical to start tracking data in Google Analytics 4 (GA4) as well. That’s because Google will sunset Universal Analytics on July 1, 2023. After the sunset date, Universal Analytics will not receive any data and will eventually stop working.

Setting up a Google Analytics 4 property after the sunset date will mean starting from scratch. However, you can start sending data into GA4 today while still using Universal Analytics. This way, you’ll have historical data in Google Analytics 4 for comparison and analysis when Universal Analytics closes.

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

Enter property name and select timezone

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.

Enter business information

Next, you’ll need to scroll down and select how you intend to use Google Analytics with your business, like measure engagement, optimize advertising cost, increase conversions, and more.

You can choose multiple options or all of the given options that meet your needs. When you’re done, simply click the ‘Create’ button.

Choose your intended use for analytics

Once you click on the Create button, a popup window will open with Google Analytics terms of service agreement.

Simply click the checkbox for ‘I also accept the Data Processing Terms as required by GDPR’ and then click the ‘I Accept’ button.

Accept terms of service agreement

Next, you’ll see a popup with options on which communication emails you’d like to receive from Google Analytics.

Simply click the checkbox for the updates you want to receive and then click the ‘Save’ button.

My communication options

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

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

Choose web as platform

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 page views, scrolls, outbound clicks, file downloads, and more in Google Analytics.

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

Enter website URL and stream name

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

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

View web stream details

Google Analytics will also show different ways to add Google Analytics code to your WordPress website under the ‘Tagging Instructions’ section.

If you click the ‘Global site tag (gtag.js) option, you’ll see the Google Analytics tracking code.

Tagging instructions details

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 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 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 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). Plus, it offers a Dual Tracking feature that lets you add Universal Analytics and Google Analytics 4 to your WordPress website without editing code.

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, 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 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 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.

MonsterInsights will also ask who can see the reports. You can choose different WordPress user roles. Once you’re done, 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 setup Google Analytics tracking.

You can see that Google Analytics is connected, 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.

Next, you’ll need to create a Measure Protocol API Secret. This will allow MonsterInsights to track events like eCommerce purchases, form conversions, and more.

To start, you can login to your Google Analytics account. Then head over to the ‘Admin’ settings page and 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, scroll down to the ‘Advanced Settings’ section.

After that, click on the ‘Measure Protocol API Secrets’ option.

Select measurement protocol API secrets option

You’ll now see a new window slide in with your Measurement Protocol API Secrets. Initially, this page will be empty, and you won’t have any API secrets.

Go ahead and click the ‘Create’ button.

Create an API key

Next, you’ll need to enter a nickname for your API secret.

Once you’ve done that, simply click the ‘Create’ button.

Enter a name for your API

Your API secret will now be created.

Go ahead and copy the API secret that’s under the ‘Secret Value’ field.

Copy the secret value

Next, you’ll need to enter the Secret Value in MonsterInsights.

You can do that by going to Insights » Settings from your WordPress admin panel and then clicking the ‘General’ tab.

General settings tab

Then head over to the ‘Google Authentication’ section.

Simply enter the Secret Value under the ‘Measurement Protocol API Secret’ field.

Enter measurement protocol API secret in MonsterInsights

You’ve successfully set up the Measurement Protocol API Secret.

Now, let’s see how to use dual tracking in MonsterInsights if you have a Universal Analytics account.

How to Set Up Dual Tracking When Using Universal Analytics

If you already have a Universal Analytics account, then MonsterInsights makes it super easy to track both Universal Analytics and Google Analytics 4 through its Dual Tracking feature. The best part is that you don’t have to edit any code.

Just note that Universal Analytics will sunset on July 1, 2023, and you won’t be able to track your website data after the sunset date. We highly recommend that you set up a Google Analytics 4 property today and start sending data to GA4.

To set up dual tracking, you can start by going to Insights » Settings from your WordPress dashboard and then click the ‘General’ tab.

General settings tab

After that, scroll down to the ‘Google Authentication’ section.

Under the ‘Dual Tracking Profile’ field, you can enter the Univeral Analytics (UA) code.

Enter your UA Code

You can find the Universal Analytics code in Google Analytics by going to the ‘Admin’ settings page.

Click admin settings

After that, click on ‘Property Settings’ under the Property column.

You’ll see the ‘Tracking Id’ in the following format: UA-123456789-1.

Find your tracking ID

You’re now successfully tracking Universal Analytics with Google Analytics 4 on your WordPress site. Remember, it will take Google Analytics some time before showing your stats.

The best part 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

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

You can find it in the Web stream details under the ‘Tagging Instructions’ section.

Tagging instructions details

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 the 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.

Enter tracking code in header

Don’t forget to save your changes 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 the Google Analytics tracking code that you copied in Step 4 earlier. You can view it in the Web stream details section under the ‘Tagging Instructions’ section.

Copy the tracking code

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 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.

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 } ?>

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.

See Reports in Universal Analytics

Universal analytics report

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.

Here’s what different reports in Universal Analytics tell you:

  • Real-time 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.

See Reports in Google Analytics 4

GA4 reports

Google Analytics 4 reports are a bit different from 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, there are no goals in GA4, and more.

That said, you can expect more new features, reports, and metrics coming soon to Google Analytics 4 since development on Universal Analytics has ended and it will sunset in July 2023.

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 brings 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 get insights about user retention.
  • Demographics help 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, 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.

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.

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

812 CommentsLeave a Reply

  1. I am new to google analytics. Today I got the code and just wanted to paste in correct place. I was wondering whether to keep in end of head section or body section. because as per google analytics instruction it was mentioned to keep in the end of head section. I am now able to successfully install google analytics. Thanks for your help.

  2. Seems like the easiest way is to insert the script into the footer. Just did that, now I’ll wait 12-24 hours. Hope it works!

  3. Can you set this up if WordPress hosts your blog? Do you have specific directions for that scenario?

  4. I Am having a problem with Google Analytics, the first time i installed it i was getting correct updates, then i changed my address from http://www.green-van.com/test

    to http://www.green-van.com and made a new step 6. but since then the same statistics, 3 visits and never any new ones. i am using google analitycs wp plug in now, and in my footer.php i have this

    Cufon.now();

    i don’t know if that is interfering with anything.

    maybe i should not use the wp-plugin and do the code directly inside the footer?

    can i send the footer.php or the functions.php to see if things are in the correct order?

    kind regards,

    Giannis

  5. @ardegas The code above works perfectly fine because all it is doing is adding an action in wp_footer to add google analytics…. the only reason why it would not work is if you paste the code in a manner which is not semantically right. Shoot over an email with your functions.php file code using pastebin or similar service… will evaluate and let you know what is wrong.

  6. @wpbeginner I’m using a child theme, and functions.php is almost blank. The only function I have now is an empty function: <code><?php function twentyten_posted_on() { } ?></code>. I use this function to remove some metadata from my theme. Without the php tags this function won’t work. So it looks I’m using the right semantics. I’m pulling my hairs right now.

  7. @ardegas You need to make sure that you are using the write semantics… For example you probably do not need the first <?php code because often functions.php files are already in php… So make sure that you are not opening the php tag if it is already open or closing it when it should be opened….

  8. I tried to insert the Analytics code using functions.php, but it gave me this error:

    <i>Warning: Cannot modify header information – headers already sent…</i>. I couldn’t even log in after. I ended removing this offending code from the file manager. It was bad. It’s a pity, because this snippet of code looks beautiful. I tried to remove any offending white space, but it was of no use, and now I’m afraid to even touch the functions.php file again.

  9. The dashboard will not save the snippet. I have tried placing it just about </body> and also above the wp_footer tag (the note says you shouldn’tt seperate this from the close body tag) Still NOT saving the code.

  10. @martinfarr1 The footer.php is located in your theme’s folder which can be found /wp-content/themes/your-theme-name/

    If you really don’t have a clue, then try one of the Google Analytics plugin for WordPress.

  11. where do i find footer.php? Have been trying to do this for days but am a total beginner I’m afraid!

  12. @BrianBraker That is because you pasted the other PHP codes without opening the php tag.<?php add_action(‘wp_footer’, ‘add_googleanalytics’); function add_googleanalytics() { ?> <script type=”text/javascript”> var _gaq = _gaq || []; _gaq.push([‘_setAccount’, ‘UA-24076071-1’]); _gaq.push([‘_trackPageview’]); (function() { var ga = document.createElement(‘script’); ga.type = ‘text/javascript’; ga.async = true; ga.src = (‘https:’ == document.location.protocol ? ‘https://ssl’ : ‘http://www’) + ‘.google-analytics.com/ga.js’; var s = document.getElementsByTagName(‘script’)[0]; s.parentNode.insertBefore(ga, s); })(); </script> <?php }

    //Here you can paste all the other codes

    ?>

  13. Did not work. Completely screwed up the function.php file so site did not load. Uploaded back up file.There is a bunch of other code in function.php file

    Here it is:

    <?php add_action(‘wp_footer’, ‘add_googleanalytics’); function add_googleanalytics() { ?> <script type=”text/javascript”> var _gaq = _gaq || []; _gaq.push([‘_setAccount’, ‘UA-24076071-1’]); _gaq.push([‘_trackPageview’]); (function() { var ga = document.createElement(‘script’); ga.type = ‘text/javascript’; ga.async = true; ga.src = (‘https:’ == document.location.protocol ? ‘https://ssl’ : ‘http://www’) + ‘.google-analytics.com/ga.js’; var s = document.getElementsByTagName(‘script’)[0]; s.parentNode.insertBefore(ga, s); })(); </script> require_once(TEMPLATEPATH . ‘/epanel/custom_functions.php’); require_once(TEMPLATEPATH . ‘/includes/functions/comments.php’); require_once(TEMPLATEPATH . ‘/includes/functions/sidebars.php’); load_theme_textdomain(‘StudioBlue’,get_template_directory().’/lang’); require_once(TEMPLATEPATH . ‘/epanel/options_studioblue.php’); require_once(TEMPLATEPATH . ‘/epanel/core_functions.php’); require_once(TEMPLATEPATH . ‘/epanel/post_thumbnails_studioblue.php’); $wp_ver = substr($GLOBALS[‘wp_version’],0,3); if ($wp_ver >= 2.8) include(TEMPLATEPATH . ‘/includes/widgets.php’); global $shortname; if (get_option($shortname.’_enable_dropdowns’) <> ‘false’) { update_option($shortname.’_enable_dropdowns’,’false’); }; ?>

  14. Hi there,

    Is a method or a plugin how to show the data delivered by Google Anlalytic directly on wordpress, without going to Google Analytics webpage ?

  15. hello,

    I am using the free wordpress version. Where do I find this part – “theme’s footer.php right above the tag”, so that I can simply copy and paste?

    Thank you!

  16. You can use the same code for the meta robots? in this way:

    add_action(‘wp_head’, ‘insert_meta_robots’);
    function insert_meta_robots() {
    ?>

    <?php
    }

  17. This is somewhat of a disaster! I added the code and now I can’t access my blog, it’s completely whited out

    Parse error: syntax error, unexpected $end in /home3/sulukuc1/public_html/wp-content/themes/constructor/functions.php on line 344

    I saw this error message after I pasted the code in my funtions.php:

    Warning: session_start() [function.session-start]: Cannot send session cache limiter – headers already sent (output started at /home3/sulukuc1/public_html/wp-content/themes/constructor/functions.php:21) in /home3/sulukuc1/public_html/wp-content/themes/constructor/libs/Constructor/Admin.php on line 31

    Warning: Cannot modify header information – headers already sent by (output started at /home3/sulukuc1/public_html/wp-content/themes/constructor/functions.php:21) in /home3/sulukuc1/public_html/wp-admin/theme-editor.php on line 89

    Please help!!!!!!!

  18. I’ve read in the Thesis forums that the new GA code is asynchronous and needs to go in the header to work properly. It also doesn’t affect page load like the old code.

  19. Hello,

    When I put the Google Analtyics code in the footer.php and in the functions.php my whole blog dissapeared! Total white-out! What happened? What can I do to get it back?

  20. Hello,
    Almost, but not quite there, I would like the first option of copy and pasting the code- but, I cannot find the “theme’s footer.php right above the tag” – not in tools, settings, themes, general, etc etc. Sorry to ask its probably simple! I added it to the normal ‘text’ widget works for all else but this.

  21. Great compilation of what a beginner needs to know about Google Analytics and WordPress! I scheduled 1 hour to find out how to setup Analytics for my new site, I was done in 5 minutes… – Thank you!

  22. Magnificent tutorial, thanks. I’m in the 12 – 24 waiting period to see if it works but I already appreciate you instructions and your willingness to reply to comments. I actually found what I was looking for in one of your responses to a poster.

  23. Great, clear description – even for someone is a codaphobe. Thanks. I am wondering tho, if when google activates this if the stats will appear in the wordpress dashboard like my other stats package did (the wordpress.com stats) which seems to be broken as of today. Thanks!

    • There are some advanced Google Analytics plugin that does that, but we recommend that you check on Google Analytics site, to get the full report. Because no plugin gives full integration.

      Admin

  24. I am not able to figure out still, how do you edit the footer (or header for that matter) of the theme of the webpage?
    can you please give instructions where can I find way to edit my footer?

    I have tried ‘Edit CSS’, ‘Extras’, and also some other options in the ‘Theme’ menu. Couldn’t get it done. :(

    Please help.

  25. I’m thinking about going the plugin route – do I need to use both plugins or one or the other?

    I know that the “Google Analytics for WordPress” asks me where I want to embed it but then then “Google Analyticar” doesn’t ask anything about embedding so I’m wondering if it does it or if I have to do something manually…

    Thanks for this walk through!!!

      • I am attempting to use the Google Analytics for WordPress plugin to add the code to my wordpress site. It gives an option for installing the code in the header. When I look at my header file after activating and authenticating the plugin, I see no added code in my header file. Is there somewhere else the code is installed besides the header for my theme?

        • It should add it in the area, but it will not modify your theme. If the code is not showing in your theme, then it can mean that your theme does not have a wp_head(); hook in the header.php.

    • Google has not changed anything… All companies would like to have their scripts added in the header << But it is not wise for the webmaster. Any smart webmaster / developer would keep scripts like analytics in the footer to speed up the load time…

      WPBeginner has the codes in the footer. Twitter.com has the code in the footer and many other sites as well.

      Admin

      • Ok… apparently the commenting system doesn’t like angle brackets. That second paragraph should have said:

        If you want more accurate analytics you will use the new snippet version and you will put it in the head. If you are paranoid about page load times you will put it just before the close body tag.

        • How does the placement reflect accuracy? Whether you put the script in the head, or at the end…. upon the full page load, it will still count one user…

  26. Would love to know your thoughts on which method you recommend for installation. Such as are there advantages to placing the code by hand vs. using a plugin?

  27. This is one of the few features I did use a plugin for, even though it can definitely be achieved manually be pasting the code as you explained, thanks for sharing.

  28. Great tips for a newbie like me i will certainly try it now. The beauty of WPress is that it has a very little limitation.

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